From 514146014586aa8b98d667edbaf0d6897186173d Mon Sep 17 00:00:00 2001
From: qx <1084500556@qq.com>
Date: 星期五, 11 四月 2025 15:55:43 +0800
Subject: [PATCH] qx

---
 src/views/hosp/project/index.vue |   75 +++++++++++++++++++++++--------------
 1 files changed, 47 insertions(+), 28 deletions(-)

diff --git a/src/views/hosp/project/index.vue b/src/views/hosp/project/index.vue
index 92e9b30..e11fe23 100644
--- a/src/views/hosp/project/index.vue
+++ b/src/views/hosp/project/index.vue
@@ -1,7 +1,7 @@
 <template>
   <div class="app-container">
     <el-row :gutter="20">
-      <el-col :span="3" :xs="24">
+      <el-col :span="4" :xs="24">
         <div class="head-container">
           <el-input v-model="deptName" placeholder="璇疯緭鍏ラ儴闂ㄥ悕绉�" clearable size="small" prefix-icon="el-icon-search"
             style="margin-bottom: 15px" />
@@ -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" v-loading="loadings"/>
+              :filter-node-method="filterNode" ref="tree1" node-key="id" :default-expanded-keys="treeId"
+              highlight-current @node-click="handleNodeClick" :render-content="renderContent" v-loading="loadings" />
           </div>
         </div>
       </el-col>
@@ -79,7 +79,7 @@
           </el-table-column>
           <el-table-column label="椤圭洰鏍囧噯鍊�" align="center" prop="proScope" :show-overflow-tooltip="true" width="90px">
           </el-table-column>
-          <el-table-column label="Lis椤圭洰鍚嶇О" align="center" prop="lisXmmc"  :show-overflow-tooltip="true" width="200px">
+          <el-table-column label="Lis椤圭洰鍚嶇О" align="center" prop="lisXmmc" :show-overflow-tooltip="true" width="200px">
           </el-table-column>
           <el-table-column label="Lis缂栫爜" align="center" prop="lisXmbm" :show-overflow-tooltip="true" width="90px">
           </el-table-column>
@@ -542,6 +542,7 @@
   watch: {
     deptName(val) {
       this.debounceFilter(val);
+     
     },
     treeId(newVal) {
       if (newVal && newVal.length > 0) {
@@ -549,7 +550,7 @@
           const lastId = newVal[newVal.length - 1] || "532";
           const node = this.findNodeById(this.deptOptions, lastId);
           if (node) {
-            this.$refs.tree.setCurrentKey(lastId);
+            this.$refs.tree1.setCurrentKey(lastId);
             const nodeElement = document.querySelector(`.el-tree-node[data-key="${lastId}"] .el-tree-node__content`);
             if (nodeElement) {
               nodeElement.click();
@@ -586,8 +587,8 @@
     });
   },
   methods: {
-    debounceFilter: debounce(function(val) {
-      this.$refs.tree.filter(val);
+    debounceFilter: debounce(function (val) {
+      this.$refs.tree1.filter(val);
     }, 300),
     precomputePinyin() {
       const traverse = (nodes) => {
@@ -603,6 +604,7 @@
       traverse(this.deptOptions);
     },
     filterNode(value, data) {
+      console.log(value, data,2233)
       if (!value) return true;
       const cached = this.pinyinCache.get(data.id);
       if (!cached) return false;
@@ -690,24 +692,24 @@
             this.form.proParentId = row.proId || 0;
             this.open = true;
           } else if (this.treeDate.id) {
-           if(this.treeDate.qf == "0"){
-            this.form.proParentId = "0"
-            this.form.deptId =this.treeDate.id 
-           }else{
-            this.form.proParentId = this.treeDate.id;
-            this.projectOptions.forEach((item) => {
-              item.children.forEach((item1) => {
-                if (this.form.proParentId == item1.proId) {
-                  this.form.deptId = item1.deptId;
-                }
+            if (this.treeDate.qf == "0") {
+              this.form.proParentId = "0"
+              this.form.deptId = this.treeDate.id
+            } else {
+              this.form.proParentId = this.treeDate.id;
+              this.projectOptions.forEach((item) => {
+                item.children.forEach((item1) => {
+                  if (this.form.proParentId == item1.proId) {
+                    this.form.deptId = item1.deptId;
+                  }
+                });
               });
-            });
-           }
-            
-           
+            }
+
+
             this.open = true;
           } else {
-             this.form.proParentId = "0"
+            this.form.proParentId = "0"
             this.open = true;
           }
         }
@@ -729,9 +731,12 @@
       } else if (this.form.proParentId) {
         if (this.form.proParentId != 0) {
           this.dialogTableVisible = true;
-          this.$nextTick(() => {
-            this.chargeId.push(this.deptOptionstree[0].id);
-          });
+          if (this.deptOptionstree.length != 0) {
+            this.$nextTick(() => {
+              this.chargeId.push(this.deptOptionstree[0].id);
+            });
+          }
+
           this.getlistSfxm();
         } else {
           this.dialogTableVisible = false;
@@ -824,7 +829,7 @@
       });
     },
     handleNodeClick(date) {
-     
+
       this.treeDate = date;
       console.log(this.treeDate)
       this.xiugais = date.qf === "0";
@@ -861,6 +866,11 @@
       let data = { proId: this.queryParams.proId };
       getAllChildListById(data).then(() => {
         this.loading = false;
+      });
+      this.deptName = "";
+      // 鎵嬪姩璋冪敤杩囨护鏂规硶锛堥渶绛夊緟 DOM 鏇存柊锛�
+      this.$nextTick(() => {
+        this.$refs.tree1.filter(this.deptName);
       });
     },
     handleClose() {
@@ -900,7 +910,7 @@
     resetQuery() {
       this.resetForm("queryForm");
       this.queryParams.proId = undefined;
-      this.$refs.tree.setCurrentKey(null);
+      this.$refs.tree1.setCurrentKey(null);
       this.handleQuery();
     },
     flexColumnWidth(column) {
@@ -1057,6 +1067,11 @@
           }
         }
       });
+      this.deptName = "";
+      // 鎵嬪姩璋冪敤杩囨护鏂规硶锛堥渶绛夊緟 DOM 鏇存柊锛�
+      this.$nextTick(() => {
+        this.$refs.tree1.filter(this.deptName);
+      });
     },
     processSubmission(isUpdate, isY) {
       if (isUpdate) {
@@ -1099,6 +1114,10 @@
         this.sfxmId = parseInt(item.id);
       });
       this.dialogTableVisible = false;
+       this.getDeptList();
+    this.getDeptTree().then(() => {
+      this.precomputePinyin();
+    });
     },
     handleDelete(row) {
       const proIds = row.proId || this.ids;
@@ -1116,7 +1135,7 @@
           this.getList();
           this.$modal.msgSuccess("鍒犻櫎鎴愬姛");
         })
-        .catch(() => {});
+        .catch(() => { });
     },
     handleExport() {
       this.download(

--
Gitblit v1.8.0