From fbe1bdd6f59de5b296ae989d028065b750354ce3 Mon Sep 17 00:00:00 2001
From: lkk <364857242@qq.com>
Date: 星期三, 30 七月 2025 15:31:18 +0800
Subject: [PATCH] 1

---
 src/views/hosp/project/index.vue |  165 +++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 105 insertions(+), 60 deletions(-)

diff --git a/src/views/hosp/project/index.vue b/src/views/hosp/project/index.vue
index ec93cd3..c690436 100644
--- a/src/views/hosp/project/index.vue
+++ b/src/views/hosp/project/index.vue
@@ -1546,7 +1546,7 @@
         this.deptList = this.handleTree(response.data, "proId");
       });
     },
-    getDeptTree() {
+    /* getDeptTree() {
       this.loadings = true;
       return deptTree111()
         .then((response) => {
@@ -1564,7 +1564,7 @@
         .finally(() => {
           this.loadings = false; // 鏃犺鎴愬姛鎴栧け璐ワ紝缁撴潫鍔犺浇
         });
-    },
+    }, */
     handleNodeClick(date) {
       this.treeDate = date;
       this.xiugaiList = {};
@@ -1722,28 +1722,39 @@
       }
     },
     handleUpdate1() {
-      this.updateLoading = true;
+      // this.updateLoading = true;
       this.form = {};
-      this.form = this.xiugaiList;
-      this.form.proStatus = this.form.proStatus.toString();
-      this.form.sfcyyc = this.form.sfcyyc.toString();
       this.proParent = true;
       this.isPriceDisabled = true;
-      getlist()
-        .then((response) => {
-          if (response.code == 200) {
-            this.loading = false;
-            this.projectOptions = [];
-            const project = { proId: 0, proName: "涓荤被鐩�", children: [] };
-            project.children = this.handleTree(response.data.list, "proId");
-            this.key = response.data.key;
-            this.projectOptions.push(project);
-          }
-        })
-        .finally(() => {
-          this.updateLoading = false;
-        });
-      this.open = 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("鍔犺浇鏁版嵁澶辫触");
+      })
     },
     handleUpdate(row) {
       this.reset();
@@ -1751,48 +1762,79 @@
       const proId = row.proId || this.ids;
       this.proParent = false;
       this.isPriceDisabled = false;
-      getProject(proId).then((response) => {
-        this.form = response.data;
-        this.showPrise = this.form.proParentId === "0";
-        this.showRentPrise = !this.showPrise;
-        this.form.proStatus = this.form.proStatus.toString();
-        this.form.sfcyyc = this.form.sfcyyc.toString();
-        this.form.consumablesList = response.data.consumablesList;
-        this.form.tjStandardList = response.data.tjStandardList;
-        if (this.form.tjStandardList) {
-          this.form.tjStandardList.forEach((item) => {
-            item.tjSex =
-              item.tjSex === "0" || item.tjSex === "鐢�"
-                ? "鐢�"
-                : item.tjSex === "1" || item.tjSex === "濂�"
-                ? "濂�"
-                : null;
-            item.tjType =
-              {
-                0: "濠村効",
-                1: "骞煎効",
-                2: "鍎跨",
-                3: "灏戝勾",
-                4: "闈掑勾",
-                5: "涓勾",
-                6: "鑰佸勾",
-              }[item.tjType] || item.tjType;
-          });
-        }
-        getlist().then((response) => {
-          if (response.code == 200) {
-            // this.loading = false;
-            this.projectOptions = [];
-            const project = { proId: 0, proName: "涓荤被鐩�", children: [] };
-            project.children = this.handleTree(response.data.list, "proId");
-            this.key = response.data.key;
-            this.projectOptions.push(project);
+      listDept(this.queryParams).then((response) => {
+        this.parentNameList = response.data;
+        // this.deptList = this.handleTree(response.data, "proId");
+        getProject(proId).then((response) => {
+          this.form = response.data;
+          this.form.deptId = response.data.deptId;
+          this.showPrise = this.form.proParentId === "0";
+          this.showRentPrise = !this.showPrise;
+          this.form.proStatus = this.form.proStatus.toString();
+          this.form.sfcyyc = this.form.sfcyyc.toString();
+          this.form.consumablesList = response.data.consumablesList;
+          this.form.tjStandardList = response.data.tjStandardList;
+          if (this.form.tjStandardList) {
+            this.form.tjStandardList.forEach((item) => {
+              item.tjSex =
+                item.tjSex === "0" || item.tjSex === "鐢�"
+                  ? "鐢�"
+                  : item.tjSex === "1" || item.tjSex === "濂�"
+                  ? "濂�"
+                  : null;
+              item.tjType =
+                {
+                  0: "濠村効",
+                  1: "骞煎効",
+                  2: "鍎跨",
+                  3: "灏戝勾",
+                  4: "闈掑勾",
+                  5: "涓勾",
+                  6: "鑰佸勾",
+                }[item.tjType] || item.tjType;
+            });
           }
+          getlist().then((response) => {
+            if (response.code == 200) {
+              // this.loading = false;
+              this.projectOptions = [];
+              const project = { proId: 0, proName: "涓荤被鐩�", children: [] };
+              project.children = this.handleTree(response.data.list, "proId");
+              this.key = response.data.key;
+              this.projectOptions.push(project);
+            }
+          });
+          // this.loadPage();
+          this.open = true;
+          this.title = "浣撴椤圭洰淇℃伅缁存姢";
         });
-        // this.loadPage();
-        this.open = true;
-        this.title = "浣撴椤圭洰淇℃伅缁存姢";
       });
+    },
+    // 鍒锋柊褰撳墠閫変腑椤圭洰鐨勬暟鎹�
+    async refreshCurrentProjectData() {
+      if (this.id) {
+        try {
+          const response = await getInfoByProId(this.id);
+          this.xiugaiList = response.data;
+          console.log("鍒锋柊椤圭洰鏁版嵁鎴愬姛:", this.xiugaiList);
+          return response.data;
+        } catch (error) {
+          console.error("鍒锋柊椤圭洰鏁版嵁澶辫触:", error);
+          this.$message.error("鍒锋柊椤圭洰鏁版嵁澶辫触");
+          this.xiugaiList = null; // 鍒锋柊澶辫触鏃堕噸缃负 null
+          return null;
+        }
+      }
+      return null;
+    },
+    // 璋冭瘯鏂规硶锛氭鏌ュ綋鍓嶆暟鎹姸鎬�
+    debugDataState() {
+      console.log("=== 鏁版嵁鐘舵�佽皟璇� ===");
+      console.log("褰撳墠ID:", this.id);
+      console.log("xiugaiList:", this.xiugaiList);
+      console.log("form:", this.form);
+      console.log("treeDate:", this.treeDate);
+      console.log("==================");
     },
     getSelectValue(val) {
       this.form.consumablesList.forEach((formitem) => {
@@ -1896,6 +1938,9 @@
 
       // 绛夊緟鍙充晶琛ㄦ牸鍒锋柊
       await this.getList();
+      
+      // 绔嬪嵆鍒锋柊褰撳墠椤圭洰鏁版嵁锛岀‘淇濇暟鎹槸鏈�鏂扮殑
+      await this.refreshCurrentProjectData();
 
       this.pageLoading = false; // 鉁� 缁熶竴鍔犺浇鐘舵�佹帶鍒�
     },

--
Gitblit v1.8.0