From eca9b2e5c274aae761ad2388818194eff4dacb47 Mon Sep 17 00:00:00 2001 From: lkk <364857242@qq.com> Date: 星期一, 04 八月 2025 15:19:32 +0800 Subject: [PATCH] 1 --- src/views/hosp/project/index.vue | 106 ++++++++++++++++++++++++++++++----------------------- 1 files changed, 60 insertions(+), 46 deletions(-) diff --git a/src/views/hosp/project/index.vue b/src/views/hosp/project/index.vue index ed09752..339d010 100644 --- a/src/views/hosp/project/index.vue +++ b/src/views/hosp/project/index.vue @@ -1018,7 +1018,7 @@ }; return { xiugais: true, - xiugaiList: null, // 鏀逛负 null锛屼究浜庡垽鏂槸鍚﹀凡鍔犺浇 + xiugaiList: [], deptOptions: [], dialogTableVisible: false, isPriceDisabled: false, @@ -1193,7 +1193,7 @@ }, created() { // this.getConsumables(); - // this.getDeptList(); + this.getDeptList(); // this.getDeptTree().then(() => { // this.precomputePinyin(); // }); @@ -1213,11 +1213,21 @@ const traverse = (nodes) => { nodes.forEach((node) => { if (node.label) { - const lowerSpell = node.label.spell("low", "array").join(""); - const upperSpell = node.label.spell("up", "array").join(""); + const lowerSpell = cnchar + .spell(node.label, "low", "array") + .join(""); // 瀹屾暣灏忓啓鎷奸煶 + const upperSpell = cnchar.spell(node.label, "up", "array").join(""); // 瀹屾暣澶у啓鎷奸煶 + const shortPinyin = node.label + .split("") + .map( + (char) => + cnchar.spell(char, "array")[0]?.[0]?.toLowerCase() || char + ) // 鎷奸煶棣栧瓧姣� + .join(""); this.pinyinCache.set(node.id, { lowerSpell, upperSpell, + shortPinyin, // 缂撳瓨鎷奸煶绠�鍐� label: node.label, }); } @@ -1225,6 +1235,17 @@ }); }; traverse(this.deptOptions); + }, + filterNode(value, data) { + if (!value) return true; // 濡傛灉鎼滅储鍊间负绌猴紝杩斿洖鎵�鏈夎妭鐐� + const cached = this.pinyinCache.get(data.id); + if (!cached) return false; // 濡傛灉娌℃湁缂撳瓨鏁版嵁锛屼笉鏄剧ず璇ヨ妭鐐� + const searchLower = value.toLowerCase(); // 灏嗘悳绱㈣瘝杞负灏忓啓 + return ( + cached.label.includes(value) || // 鐩存帴鍖归厤姹夊瓧 + cached.shortPinyin.includes(searchLower) || // 鍖归厤鎷奸煶绠�鍐� + cached.lowerSpell.includes(searchLower) // 鍖归厤瀹屾暣鎷奸煶 + ); }, async loadPage() { @@ -1246,7 +1267,7 @@ try { const response = await deptTree111(); this.deptOptions = response.data; - + this.precomputePinyin(); // 淇濊瘉 treeId 鏄暟缁勬牸寮� this.treeId = []; @@ -1278,16 +1299,6 @@ } }, - filterNode(value, data) { - if (!value) return true; - const cached = this.pinyinCache.get(data.id); - if (!cached) return false; - return ( - cached.label.includes(value) || - cached.lowerSpell.includes(value) || - cached.upperSpell.includes(value) - ); - }, filterNode2(value, data) { if (!value) return true; return data.xmmc.includes(value); @@ -1383,12 +1394,16 @@ this.form.hisXmbm = ""; this.form.hisXmmc = ""; this.form.hisdj = ""; - this.loading = true; + // this.loading = true; this.proParent = false; this.form.proPrice = 0.0; this.form.proName = ""; this.form.proId = null; this.form.resultType = "1"; + + // 鍏堣幏鍙栫瀹ゅ垪琛ㄦ暟鎹� + this.getDeptList(); + getlist().then((response) => { if (response.code == 200) { this.loading = false; @@ -1543,7 +1558,7 @@ getDeptList() { listDept(this.queryParams).then((response) => { this.parentNameList = response.data; - this.deptList = this.handleTree(response.data, "proId"); + this.deptList = this.handleTree(response.data, "deptId"); }); }, /* getDeptTree() { @@ -1726,35 +1741,34 @@ this.form = {}; this.proParent = true; this.isPriceDisabled = true; - + // 鍏堝姞杞界瀹ゅ垪琛ㄦ暟鎹紝鍐嶈缃〃鍗曟暟鎹� - Promise.all([ - listDept(this.queryParams), - getlist() - ]).then(([deptResponse, listResponse]) => { - // 鍏堣缃瀹ゅ垪琛� - this.parentNameList = deptResponse.data; - - // 鍐嶈缃〃鍗曟暟鎹� - this.form = this.xiugaiList; - this.form.proStatus = this.form.proStatus.toString(); - this.form.sfcyyc = this.form.sfcyyc.toString(); - - // 澶勭悊椤圭洰閫夐」 - if (listResponse.code == 200) { - this.loading = false; - this.projectOptions = []; - const project = { proId: 0, proName: "涓荤被鐩�", children: [] }; - project.children = this.handleTree(listResponse.data.list, "proId"); - this.key = listResponse.data.key; - this.projectOptions.push(project); - } - - this.open = true; - }).catch((error) => { - console.error("鍔犺浇鏁版嵁澶辫触:", error); - this.$message.error("鍔犺浇鏁版嵁澶辫触"); - }) + Promise.all([listDept(this.queryParams), getlist()]) + .then(([deptResponse, listResponse]) => { + // 鍏堣缃瀹ゅ垪琛� + this.parentNameList = deptResponse.data; + + // 鍐嶈缃〃鍗曟暟鎹� + this.form = this.xiugaiList; + this.form.proStatus = this.form.proStatus.toString(); + this.form.sfcyyc = this.form.sfcyyc.toString(); + + // 澶勭悊椤圭洰閫夐」 + if (listResponse.code == 200) { + this.loading = false; + this.projectOptions = []; + const project = { proId: 0, proName: "涓荤被鐩�", children: [] }; + project.children = this.handleTree(listResponse.data.list, "proId"); + this.key = listResponse.data.key; + this.projectOptions.push(project); + } + + this.open = true; + }) + .catch((error) => { + console.error("鍔犺浇鏁版嵁澶辫触:", error); + this.$message.error("鍔犺浇鏁版嵁澶辫触"); + }); }, handleUpdate(row) { this.reset(); @@ -1938,7 +1952,7 @@ // 绛夊緟鍙充晶琛ㄦ牸鍒锋柊 await this.getList(); - + // 绔嬪嵆鍒锋柊褰撳墠椤圭洰鏁版嵁锛岀‘淇濇暟鎹槸鏈�鏂扮殑 await this.refreshCurrentProjectData(); -- Gitblit v1.8.0