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 |   98 +++++++++++++++++++++++++++----------------------
 1 files changed, 54 insertions(+), 44 deletions(-)

diff --git a/src/views/hosp/project/index.vue b/src/views/hosp/project/index.vue
index 3a457bc..339d010 100644
--- a/src/views/hosp/project/index.vue
+++ b/src/views/hosp/project/index.vue
@@ -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);
@@ -1389,10 +1400,10 @@
       this.form.proName = "";
       this.form.proId = null;
       this.form.resultType = "1";
-      
+
       // 鍏堣幏鍙栫瀹ゅ垪琛ㄦ暟鎹�
       this.getDeptList();
-      
+
       getlist().then((response) => {
         if (response.code == 200) {
           this.loading = false;
@@ -1730,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();
@@ -1942,7 +1952,7 @@
 
       // 绛夊緟鍙充晶琛ㄦ牸鍒锋柊
       await this.getList();
-      
+
       // 绔嬪嵆鍒锋柊褰撳墠椤圭洰鏁版嵁锛岀‘淇濇暟鎹槸鏈�鏂扮殑
       await this.refreshCurrentProjectData();
 

--
Gitblit v1.8.0