Commit 58fef6c8 authored by “yiyousong”'s avatar “yiyousong”

perf: 优化

parent 284a6a2d
......@@ -22,10 +22,10 @@
<!-- 部门管理 -->
<div class="department-list">
<a-spin :spinning="deptLoading">
<div v-if="department.length">
<div v-if="departList.length">
<div
:class="{ department_off: true, active: active === i }"
v-for="(v, i) in department"
v-for="(v, i) in departList"
:key="v.id"
@click="changeDept(v.id, i)"
>
......@@ -59,9 +59,7 @@
</div>
</div>
<div>
<div class="department_span">
简称:{{ v.deptAbb ? v.deptAbb : "--" }}
</div>
<div>简称:{{ v.deptAbb ? v.deptAbb : "--" }}</div>
<div>
联系电话:{{ v.deptTelphone ? v.deptTelphone : "--" }}
</div>
......@@ -127,7 +125,7 @@
<div class="table-content">
<!-- 表格 -->
<a-table
:scroll="{ y: 560 }"
:scroll="{ y: 550 }"
:loading="loading"
bordered
:columns="columns"
......@@ -333,6 +331,7 @@ export default {
visibleWork: false,
visibleAdd: false,
department: [], // 部门列表
departList: [], // 部门列表
deptTotal: 0, // 部门总数
windowData: [], // 窗口列表数据
page: 1,
......@@ -351,19 +350,19 @@ export default {
filters: {
workmanList(arr) {
if (arr.length) {
let workers = arr
.map((v) => {
return v.name;
})
.join("/");
return workers;
let workerList = [...arr];
let worker = workerList.sort((a, b) => {
return b.lastLoginTime - a.lastLoginTime;
})[0].name;
return worker;
}
},
},
watch: {
deptSearchVal(newVal) {
if (newVal === "") {
this.getDeptListData();
this.departList = this.department;
// this.getDeptListData();
}
},
},
......@@ -404,18 +403,18 @@ export default {
});
},
// 获取部门列表
async getDeptListData(obj = {}) {
async getDeptListData() {
this.deptLoading = true;
let res = await getDeptList({
siteId: this.siteId,
page: 1,
size: -1,
...obj,
});
this.deptLoading = false;
let { code, data } = res.data;
if (code === 1) {
this.department = data.data;
this.departList = data.data;
this.deptTotal = data.total;
}
},
......@@ -484,7 +483,7 @@ export default {
let res = await delDept({ id: num });
let { code, msg } = res.data;
if (code === 1) {
_this.getDeptListData(_this.siteId);
_this.getDeptListData();
_this.$message.success(msg);
}
},
......@@ -504,11 +503,15 @@ export default {
deptId: this.deptId,
...obj,
});
let { code, data } = res.data;
if (code === 1) {
this.total = data.pageInfo.totalResult;
this.windowData = data.data;
this.loading = false;
if (res.data.code === 1) {
let { total, data } = res.data.data;
if (!data.length && this.page > 1) {
this.page -= 1;
this.getWindowListData();
}
this.total = total;
this.windowData = data;
}
},
// 新增窗口
......@@ -542,7 +545,7 @@ export default {
let res = await delWindow({ id: num });
let { code, msg } = res.data;
if (code === 1) {
_this.getWindowListData(_this.siteId);
_this.getWindowListData();
_this.$message.success(msg);
}
},
......@@ -563,8 +566,13 @@ export default {
this.getWindowListData();
},
// 左边搜索
onSearch(value) {
this.getDeptListData({ name: `%${value}%` });
onSearch(val) {
if (val != "") {
this.departList = this.department.filter((v) => {
return v.name.includes(val);
});
// this.getDeptListData();
}
},
// 右边搜索
onSearchRight() {
......@@ -687,7 +695,6 @@ export default {
}
.department_span {
margin-right: 3px;
font-size: 5px;
}
.department_off {
// margin-left: 20px;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment