From c82f8a6de3360777d737d48ceac9429da79c2264 Mon Sep 17 00:00:00 2001 From: Chopper711 Date: Mon, 11 Dec 2023 07:58:22 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=83=A8=E9=97=A8=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E5=8A=9F=E8=83=BDbug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lili/department-tree-choose.vue | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/manager/src/components/lili/department-tree-choose.vue b/manager/src/components/lili/department-tree-choose.vue index 34200c70..c7c229ca 100644 --- a/manager/src/components/lili/department-tree-choose.vue +++ b/manager/src/components/lili/department-tree-choose.vue @@ -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)); } }, // 选择回调