Commit 644674bc authored by “yiyousong”'s avatar “yiyousong”

perf: 优化部门管理

parent 60a7673c
......@@ -357,13 +357,13 @@ export default {
}
},
},
watch: {
deptSearchVal(newVal) {
if (newVal === "") {
this.getDeptListData();
}
},
},
// watch: {
// deptSearchVal(newVal) {
// if (newVal === "") {
// this.getDeptListData();
// }
// },
// },
// 进入路由前
beforeRouteEnter(to, from, next) {
if (from.path === "/department/adddepartment") {
......@@ -401,13 +401,13 @@ export default {
});
},
// 获取部门列表
async getDeptListData(obj = {}) {
async getDeptListData() {
this.deptLoading = true;
let res = await getDeptList({
siteId: this.siteId,
page: 1,
size: -1,
...obj,
name: `%${this.deptSearchVal}%`,
});
this.deptLoading = false;
let { code, data } = res.data;
......@@ -481,7 +481,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);
}
},
......@@ -501,11 +501,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;
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;
}
},
// 新增窗口
......@@ -539,7 +543,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);
}
},
......@@ -560,8 +564,8 @@ export default {
this.getWindowListData();
},
// 左边搜索
onSearch(value) {
this.getDeptListData({ name: `%${value}%` });
onSearch() {
this.getDeptListData();
},
// 右边搜索
onSearchRight() {
......
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