From 72a256b377fb61525c9c2982b35d1cb13b47497a Mon Sep 17 00:00:00 2001
From: wwl <xchao828@163.com>
Date: 星期五, 07 三月 2025 14:21:46 +0800
Subject: [PATCH] 1

---
 src/views/hosp/project/index.vue |   32 ++++++++++++++++++++++++++------
 1 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/src/views/hosp/project/index.vue b/src/views/hosp/project/index.vue
index c499b82..5558efe 100644
--- a/src/views/hosp/project/index.vue
+++ b/src/views/hosp/project/index.vue
@@ -9,8 +9,8 @@
         <div class="scrollable-container">
           <div class="content">
             <el-tree :data="deptOptions" :props="defaultProps" :expand-on-click-node="false"
-              :filter-node-method="filterNode" ref="tree" node-key="id" :default-expanded-keys="treeId"
-              highlight-current @node-click="handleNodeClick" :render-content="renderContent" />
+              :filter-node-method="filterNode" ref="tree" node-key="id" :default-expanded-keys="treeId"  
+              highlight-current @node-click="handleNodeClick" :render-content="renderContent"  v-loading="loadings"/>
           </div>
         </div>
       </el-col>
@@ -418,6 +418,7 @@
 import IconSelect from "@/components/IconSelect";
 import { listConsumables } from "@/api/hosp/consumables";
 import { Message } from "element-ui";
+import cnchar from 'cnchar';
 import {
   listSfxm,
   getSfxm,
@@ -475,6 +476,7 @@
       ChangeList: [],
       // 閬僵灞�
       loading: true,
+      loadings: false,
       key: "",
       // 閫変腑鏁扮粍
       ids: [],
@@ -667,7 +669,7 @@
       };
       getAllChildListById(data).then((response) => {
         this.projectList = response.data.list;
-        console.log("杩涙潵浜嗗垪琛ㄥ苟涓旇幏鍙栧埌浜嗗��", this.projectList);
+        // console.log("杩涙潵浜嗗垪琛ㄥ苟涓旇幏鍙栧埌浜嗗��", this.projectList);
 
         this.loading = false;
       });
@@ -887,7 +889,6 @@
       deptTree111().then((response) => {
         this.deptOptions = response.data;
         this.treeId.push(this.treeDate.id);
-        console.log(this.treeId)
       });
 
     },
@@ -924,12 +925,31 @@
     // 绛涢�夎妭鐐�
     filterNode(value, data) {
       if (!value) return true;
-      return data.label.indexOf(value) !== -1;
+      const input = value.toLowerCase();
+      const label = data.label;
+      
+      // 1. 鐩存帴涓枃鍖归厤
+      if (label.includes(input)) return true;
+
+      // 2. 鍏ㄦ嫾鍖归厤锛堟敮鎸佸ぇ灏忓啓锛�
+      const fullPinyin = cnchar.spell(label, 'low', 'array').join('');
+      if (fullPinyin.includes(input)) return true;
+
+      // 3. 棣栧瓧姣嶇畝鎷煎尮閰�
+      const simplePinyin = cnchar.spell(label, 'first', 'low').replace(/\s+/g, '');
+      if (simplePinyin.includes(input)) return true;
+
+      // 4. 甯︾┖鏍肩殑鍏ㄦ嫾鍖归厤锛堝锛歾hang san锛�
+      const spacedPinyin = cnchar.spell(label, 'low', ' ').replace(/\s+/g, ' ');
+      if (spacedPinyin.includes(input)) return true;
+
+      return false;
     },
+
     // 鑺傜偣鍗曞嚮浜嬩欢
     handleNodeClick(date) {
 
-      console.log("璋冪敤浜唄andleNodeClick ", date.id, this.id)
+      // console.log("璋冪敤浜唄andleNodeClick ", date.id, this.id)
       this.treeDate = date;
       if (date.qf == "0") {
         this.xiugais = true;

--
Gitblit v1.8.0