fix: 部门搜索功能bug修复

master
Chopper711 2023-12-11 07:58:22 +08:00
parent 904046f02c
commit c82f8a6de3
1 changed files with 7 additions and 13 deletions

View File

@ -57,6 +57,7 @@ export default {
departmentTitle: "", // modal
searchKey: "", //
dataDep: [], //
cloneDep: [], //
selectDep: [], //
departmentId: [] // id
};
@ -67,27 +68,20 @@ export default {
initDepartment().then(res => {
if (res.success) {
this.dataDep = res.result;
this.cloneDep = JSON.parse(JSON.stringify(this.dataDep));
}
});
},
searchDep() {
//
if (this.searchKey) {
this.depLoading = true;
searchDepartment({title: this.searchKey}).then(res => {
this.depLoading = false;
if (res.success) {
res.result.forEach(function (e) {
if (e.status == -1) {
e.title = "[已禁用] " + e.title;
e.disabled = true;
}
});
this.dataDep = res.result;
}
this.dataDep = this.cloneDep.filter(item => {
return item.title.indexOf(this.searchKey) > -1;
});
} else {
this.initDepartmentData();
this.dataDep = JSON.parse(JSON.stringify(this.cloneDep));
}
},
//