From 44e7c74462e3dd3bf4bf24ab34b126d6e59c41f9 Mon Sep 17 00:00:00 2001
From: qx <1084500556@qq.com>
Date: 星期四, 31 七月 2025 17:59:08 +0800
Subject: [PATCH] qx

---
 src/views/hosp/project/index.vue |   70 ++++++++++++++++++++++++++++-------
 1 files changed, 56 insertions(+), 14 deletions(-)

diff --git a/src/views/hosp/project/index.vue b/src/views/hosp/project/index.vue
index cb569f3..e51de15 100644
--- a/src/views/hosp/project/index.vue
+++ b/src/views/hosp/project/index.vue
@@ -1327,7 +1327,7 @@
       this.form.lisXmbm = param1[0].pacCode;
       this.form.lisXmmc = param1[0].pacName;
     },
-    /* getList() {
+    getList() {
       this.loading = true;
       let data = {
         proName: this.queryParams.proName,
@@ -1339,7 +1339,7 @@
         this.projectList = response.data.list;
         this.loading = false;
       });
-    }, */
+    },
     getConsumables() {
       this.loading = true;
       listConsumables(this.queryParams).then((response) => {
@@ -1665,25 +1665,39 @@
       }
     },
     handleUpdate1() {
+      // this.updateLoading = true;
       this.form = {};
-      this.form = this.xiugaiList;
-      this.form.proStatus = this.form.proStatus.toString();
-      this.form.sfcyyc = this.form.sfcyyc.toString();
-      this.form.proDelivery = this.form.proDelivery.toString();
       this.proParent = true;
       this.isPriceDisabled = true;
-      getlist().then((response) => {
-        if (response.code == 200) {
+      
+      // 鍏堝姞杞界瀹ゅ垪琛ㄦ暟鎹紝鍐嶈缃〃鍗曟暟鎹�
+      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(response.data.list, "proId");
-          this.key = response.data.key;
+          project.children = this.handleTree(listResponse.data.list, "proId");
+          this.key = listResponse.data.key;
           this.projectOptions.push(project);
-          console.log(this.projectOptions, 11111);
         }
-      });
-      this.open = true;
+        
+        this.open = true;
+      }).catch((error) => {
+        console.error("鍔犺浇鏁版嵁澶辫触:", error);
+        this.$message.error("鍔犺浇鏁版嵁澶辫触");
+      })
     },
     handleUpdate(row) {
       this.reset();
@@ -1691,7 +1705,9 @@
       const proId = row.proId || this.ids;
       this.proParent = false;
       this.isPriceDisabled = false;
-      getProject(proId).then((response) => {
+      listDept(this.queryParams).then((response) => {
+        this.parentNameList = response.data;
+        getProject(proId).then((response) => {
         this.form = response.data;
         this.showPrise = this.form.proParentId === "0";
         this.showRentPrise = !this.showPrise;
@@ -1733,6 +1749,8 @@
         this.open = true;
         this.title = "浣撴椤圭洰淇℃伅缁存姢";
       });
+      })
+      
     },
     getSelectValue(val) {
       this.form.consumablesList.forEach((formitem) => {
@@ -1822,6 +1840,9 @@
 
       // 绛夊緟鍙充晶琛ㄦ牸鍒锋柊
       await this.getList();
+      
+      // 绔嬪嵆鍒锋柊褰撳墠椤圭洰鏁版嵁锛岀‘淇濇暟鎹槸鏈�鏂扮殑
+      await this.refreshCurrentProjectData();
 
       this.pageLoading = false; // 鉁� 缁熶竴鍔犺浇鐘舵�佹帶鍒�
     },
@@ -1834,6 +1855,23 @@
         });
       }
     }, */
+    // 鍒锋柊褰撳墠閫変腑椤圭洰鐨勬暟鎹�
+    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;
+    },
     submit() {
       this.ChangeList.forEach((item) => {
         this.form.proPrice = item.ckdj;
@@ -1843,6 +1881,10 @@
         this.sfxmId = parseInt(item.id);
       });
       this.dialogTableVisible = false;
+      this.getDeptList();
+      this.getDeptTree().then(() => {
+        this.precomputePinyin();
+      });
     },
     handleDelete(row) {
       const proIds = row.proId || this.ids;

--
Gitblit v1.8.0