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

perf: 优化部门管理

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