fix: 部门搜索功能bug修复
parent
904046f02c
commit
c82f8a6de3
|
@ -57,6 +57,7 @@ export default {
|
||||||
departmentTitle: "", // modal标题
|
departmentTitle: "", // modal标题
|
||||||
searchKey: "", // 搜索关键词
|
searchKey: "", // 搜索关键词
|
||||||
dataDep: [], // 部门列表
|
dataDep: [], // 部门列表
|
||||||
|
cloneDep: [], // 克隆部门列表
|
||||||
selectDep: [], // 已选部门
|
selectDep: [], // 已选部门
|
||||||
departmentId: [] // 部门id
|
departmentId: [] // 部门id
|
||||||
};
|
};
|
||||||
|
@ -67,27 +68,20 @@ export default {
|
||||||
initDepartment().then(res => {
|
initDepartment().then(res => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.dataDep = res.result;
|
this.dataDep = res.result;
|
||||||
|
|
||||||
|
this.cloneDep = JSON.parse(JSON.stringify(this.dataDep));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
searchDep() {
|
searchDep() {
|
||||||
// 搜索部门
|
// 搜索部门
|
||||||
if (this.searchKey) {
|
if (this.searchKey) {
|
||||||
this.depLoading = true;
|
this.dataDep = this.cloneDep.filter(item => {
|
||||||
searchDepartment({title: this.searchKey}).then(res => {
|
return item.title.indexOf(this.searchKey) > -1;
|
||||||
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;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.initDepartmentData();
|
this.dataDep = JSON.parse(JSON.stringify(this.cloneDep));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 选择回调
|
// 选择回调
|
||||||
|
|
Loading…
Reference in New Issue