Commit 8f212b31 authored by “yiyousong”'s avatar “yiyousong”

perf: 优化

parent e113ab7b
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
<!-- 部门管理 --> <!-- 部门管理 -->
<div class="department-list"> <div class="department-list">
<a-spin :spinning="deptLoading"> <a-spin :spinning="deptLoading">
<div v-if="department.length"> <div v-if="departList.length">
<div <div
:class="{ department_off: true, active: active === i }" :class="{ department_off: true, active: active === i }"
v-for="(v, i) in department" v-for="(v, i) in departList"
:key="v.id" :key="v.id"
@click="changeDept(v.id, i)" @click="changeDept(v.id, i)"
> >
...@@ -331,6 +331,7 @@ export default { ...@@ -331,6 +331,7 @@ export default {
visibleWork: false, visibleWork: false,
visibleAdd: false, visibleAdd: false,
department: [], // 部门列表 department: [], // 部门列表
departList: [], // 部门列表
deptTotal: 0, // 部门总数 deptTotal: 0, // 部门总数
windowData: [], // 窗口列表数据 windowData: [], // 窗口列表数据
page: 1, page: 1,
...@@ -360,7 +361,8 @@ export default { ...@@ -360,7 +361,8 @@ export default {
watch: { watch: {
deptSearchVal(newVal) { deptSearchVal(newVal) {
if (newVal === "") { if (newVal === "") {
this.getDeptListData(); this.departList = this.department;
// this.getDeptListData();
} }
}, },
}, },
...@@ -407,12 +409,12 @@ export default { ...@@ -407,12 +409,12 @@ export default {
siteId: this.siteId, siteId: this.siteId,
page: 1, page: 1,
size: -1, size: -1,
name: `%${this.deptSearchVal}%`,
}); });
this.deptLoading = false; this.deptLoading = false;
let { code, data } = res.data; let { code, data } = res.data;
if (code === 1) { if (code === 1) {
this.department = data.data; this.department = data.data;
this.departList = data.data;
this.deptTotal = data.total; this.deptTotal = data.total;
} }
}, },
...@@ -566,7 +568,10 @@ export default { ...@@ -566,7 +568,10 @@ export default {
// 左边搜索 // 左边搜索
onSearch(val) { onSearch(val) {
if (val != "") { if (val != "") {
this.getDeptListData(); this.departList = this.department.filter((v) => {
return v.name.includes(val);
});
// this.getDeptListData();
} }
}, },
// 右边搜索 // 右边搜索
......
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