From b7e9807061998a4b250ceaca7e6320e89cc6767f Mon Sep 17 00:00:00 2001
From: qx <1084500556@qq.com>
Date: 星期六, 08 二月 2025 18:09:19 +0800
Subject: [PATCH] qx

---
 src/views/hosp/order/index.vue |  229 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 218 insertions(+), 11 deletions(-)

diff --git a/src/views/hosp/order/index.vue b/src/views/hosp/order/index.vue
index c5e9a65..2056b76 100644
--- a/src/views/hosp/order/index.vue
+++ b/src/views/hosp/order/index.vue
@@ -243,6 +243,15 @@
           >寮哄埗鎾ら攢</el-button
         >
       </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          size="mini"
+          @click="ResumeAppointment"
+          :disabled="multiple"
+          >鎭㈠棰勭害</el-button
+        >
+      </el-col>
       <right-toolbar
         :showSearch.sync="showSearch"
         @queryTable="getList"
@@ -612,7 +621,7 @@
                         :props="defaultProp"
                         show-checkbox
                         node-key="id"
-                        @check="handlepackage"
+                        @check-change="handlepackage"
                         :default-checked-keys="checkedkeys"
                         :filter-node-method="filterpackage"
                         ref="treas"
@@ -673,7 +682,7 @@
                         :props="defaultProps"
                         show-checkbox
                         node-key="proId"
-                        @check="handleCurrentChecked"
+                        @check-change="handleCurrentChecked"
                         :default-checked-keys="checkedkey"
                         :filter-node-method="filterNode"
                         ref="tree"
@@ -966,7 +975,7 @@
                         :props="defaultProp"
                         show-checkbox
                         node-key="id"
-                        @check="handlepackage"
+                        @check-change="handlepackage"
                         :default-checked-keys="checkedkeys"
                         :filter-node-method="filterpackage"
                         ref="treas"
@@ -1027,7 +1036,7 @@
                         :props="defaultProps"
                         show-checkbox
                         node-key="proId"
-                        @check="handleCurrentChecked"
+                        @check-change="handleCurrentChecked"
                         :default-checked-keys="checkedkey"
                         :filter-node-method="filterNode"
                         ref="tree"
@@ -1662,6 +1671,7 @@
   getOrderList,
   getNewDateList,
   revokeTjOrderByTjNum,
+  huifuyuyuejilu,
   getTransitionInfo,
   getBlproByTjh,
   revokeBlProByBldhAndTjh,
@@ -1782,6 +1792,7 @@
       activeNames: "first",
       // 闈炲涓鐢�
       multiple: true,
+      tjNUms:[],
       // 鏄剧ず鎼滅储鏉′欢
       showSearch: true,
       userId: "",
@@ -2132,6 +2143,34 @@
       });
     },
 
+    ResumeAppointment(){
+      this.isLoading = true;
+      this.$confirm("鎮ㄧ‘璁よ鎭㈠棰勭害锛�", "纭淇℃伅", {
+        distinguishCancelAndClose: true,
+        confirmButtonText: "纭",
+        cancelButtonText: "鍙栨秷",
+      })
+        .then(() => {
+          huifuyuyuejilu(this.tjNUms).then((res) => {
+            this.$modal.msgSuccess("鎭㈠鎴愬姛");
+            // this.isLoading = false;
+            this.getList();
+          });
+        })
+        .catch((action) => {
+          if (action === "cancel") {
+            this.$message({
+              type: "warning",
+              message: "宸插彇娑�",
+            });
+          }
+        })
+        .finally(() => {
+          // 涓嶈鎿嶄綔鎴愬姛杩樻槸澶辫触锛岄兘浼氭墽琛�
+          this.isLoading = false;
+        });
+    },
+
     handleRevoke() {
       this.isLoading = true;
       this.$confirm("鎮ㄧ‘璁よ鎾ら攢锛�", "纭淇℃伅", {
@@ -2325,6 +2364,7 @@
     // 澶氶�夋閫変腑鏁版嵁
     handleSelectionChange(selection) {
       let tjNUms = selection.map((item) => item.tjNumber);
+      this.tjNUms = selection.map((item) => item.tjNumber);
       selection.forEach((item) => {
         this.orderIds = item.orderId;
         this.tjnumbers = item.tjNumber;
@@ -2497,6 +2537,8 @@
         // this.marryalls = 0;
         // this.Datalists = [];
         this.checkedkeys = [];
+
+        this.DataList3 = [];
         getZhList().then((response) => {
           if (response.data) {
             this.packageList = response.data;
@@ -2505,16 +2547,98 @@
         });
       } else {
         // this.TotalPrice1 = 0;
-        this.checkedkey = [];
+        this.checkedkeys = [];
         // this.DataList = [];
+        this.Datalists = [];
+        this.DataList3 = [];
         this.getDataList();
         // if (this.marryalls != 0) {
         //   this.TotalPrice1 += this.marryalls;
         // }
       }
     },
-
     handlepackage(data, checked, checkedNodes) {
+      if (checked == true) {
+        // this.$refs.treas.setCheckedKeys([data.id]);
+        let datas = {
+          zhId: data.id,
+        };
+
+        getlistByZhId(datas).then((res) => {
+          this.packagedataList = res.data.tjProjectList;
+          for (var i = 0; i < this.packagedataList.length; i++) {
+            let proId = this.packagedataList[i].proId;
+            getProSonDxList(proId).then((res) => {
+              this.TreedataList = res.data.list;
+              this.TreedataList.forEach((item) => {
+                this.Datalists.push(item);
+              });
+
+              // 鍚堝苟 Datalists 鍜� DataList 鍒� DataList3
+              this.DataList3 = this.DataList.concat(this.Datalists);
+
+              // 娓呯┖绱姞鍣�
+              this.marryalls = 0;
+              this.TotalPrice1 = 0;
+
+              // 閲嶆柊璁$畻浠锋牸
+              this.DataList3.forEach((item) => {
+                console.log(item.proPrice);
+                this.TotalPrice1 += item.proPrice * item.sl;
+                this.marryalls += item.proPrice * item.sl;
+              });
+
+              // 涓烘瘡涓」鐩坊鍔� propinName
+              this.Datalists.forEach((item1) => {
+                this.packagedataList.forEach((item3) => {
+                  if (item1.proParentId == item3.proId) {
+                    item1.propinName = item3.proName;
+                  }
+                });
+              });
+            });
+          }
+        });
+      } else if (checked == false) {
+        let datas = {
+          zhId: data.id,
+        };
+
+        this.marryalls = 0;
+
+        // 娓呯┖ Datalists 鍜� DataList3
+        this.Datalists = [];
+        this.DataList3 = [...this.DataList]; // 閲嶆柊璁剧疆 DataList3锛屼粎鍖呭惈鍘熷 DataList
+
+        getlistByZhId(datas).then((res) => {
+          this.packagedataList = res.data.tjProjectList;
+          for (var i = 0; i < this.packagedataList.length; i++) {
+            let proId = this.packagedataList[i].proId;
+            getProSonDxList(proId).then((res) => {
+              this.TreedataList = res.data.list;
+              this.checkedListkey = this.checkedListkey.filter(
+                (id) => id !== proId
+              );
+
+              // 浠� DataList3 涓Щ闄ょ浉鍏崇殑瀛愰」
+              this.DataList3 = this.DataList3.filter(
+                (item) => item.proParentId !== proId
+              );
+
+              // 鏇存柊鎬讳环鏍�
+              this.TotalPrice1 = 0; // 娓呯┖浠锋牸
+              this.DataList3.forEach((item) => {
+                this.TotalPrice1 += item.proPrice;
+              });
+            });
+          }
+        });
+      }
+    },
+
+    /* handlepackage(data, checked, checkedNodes) {
+      console.log(checked, 3333);
+
       if (checked.checkedNodes.length != 0) {
         this.$refs.treas.setCheckedKeys([data.id]);
         let datas = {
@@ -2537,7 +2661,7 @@
                     this.marryalls += item1.proPrice;
                     // this.TotalPrice1 = this.marryalls;
                     this.TotalPrice1 = 0;
-                    console.log(this.DataList3, 9999999999);
+
                     if (this.DataList3.length != 0) {
                       this.DataList3.forEach((item) => {
                         console.log(item.proPrice);
@@ -2557,7 +2681,7 @@
         });
       } else if (checked.checkedNodes.length == 0) {
       }
-    },
+    }, */
 
     renderContent(h, { node, data, store }) {
       return (
@@ -2579,6 +2703,8 @@
       this.orderId = row.orderId;
       this.cusId = row.tjCusIdCard;
       this.userId = row.userId;
+      console.log(row, 666);
+
       this.customer = {
         cusIdcard: row.tjCusIdCard,
         cusName: row.tjCustomerName,
@@ -2664,9 +2790,10 @@
     },
 
     // 鐐瑰嚮鑾峰彇姣忎釜鏍戣妭鐐�
-    handleCurrentChecked(data, checked, checkedNodes) {
+    /*  handleCurrentChecked(data, checked, checkedNodes) {
       this.dataObj = data;
-      if (checked.checkedNodes.length != 0) {
+      this.checkedObj = checked;
+      if (checked == true) {
         this.$refs.tree.setCheckedKeys([data.proId]);
         let proId = data.proId;
         getProSonDxList(proId).then((res) => {
@@ -2699,11 +2826,91 @@
           //   }
           // }
         });
-      } else if (checked.checkedNodes.length == 0) {
+      } else if (checked == false) {
         let proId = data.proId;
         getProSonDxList(proId).then((res) => {
           this.TreedataList = res.data.list;
           this.checkedListkey = [];
+          this.TreedataList.forEach((item) => {
+            item.disabled = true;
+          });
+          this.DataList3.forEach((item, index) => {
+            if (item.proParentId == this.dataObj.proId) {
+              this.DataList3.splice(index, this.TreedataList.length);
+            }
+          });
+
+          // 鎵嬪姩鏇存柊鎬讳环鏍�
+          this.TotalPrice1 = 0;
+          this.DataList3.forEach((item, index) => {
+            this.TotalPrice1 += item.proPrice * item.sl;
+          });
+        });
+      }
+    }, */
+    handleCurrentChecked(data, checked, checkedNodes) {
+      this.dataObj = data;
+      this.checkedObj = checked;
+
+      if (checked === true) {
+        // this.$refs.tree.setCheckedKeys([data.proId]);
+        let proId = data.proId;
+        getProSonDxList(proId).then((res) => {
+          this.TreedataList = res.data.list;
+
+          this.TreedataList.forEach((item) => {
+            // item.disabled = true;
+            // this.checkedListkey.push(item.proId);
+            if (!this.checkedListkey.includes(item.proId)) {
+              this.checkedListkey.push(item.proId);
+            }
+            this.Datalists.push(item);
+
+            this.DataList3.push(item);
+
+            this.spliceData();
+            this.DataList3.forEach((item1) => {
+              this.TotalPrice1 += item1.proPrice * item1.sl;
+              if (item1.proParentId == data.proId) {
+                item1.propinName = data.proName;
+                item1.propinPrice = this.dataObj.proPrice;
+              }
+            });
+          });
+
+          // 鏇存柊鎬讳环鏍�
+          this.TotalPrice1 = 0;
+          this.DataList3.forEach((item) => {
+            this.TotalPrice1 += item.proPrice * item.sl;
+          });
+        });
+      } else if (checked === false) {
+        // 褰撳彇娑堥�変腑鏃�
+        let proId = data.proId;
+        getProSonDxList(proId).then((res) => {
+          this.TreedataList = res.data.list;
+
+          // 閬嶅巻 TreedataList 骞剁Щ闄ょ浉鍏崇殑瀛愰」 ID
+          this.TreedataList.forEach((item) => {
+            this.checkedListkey = this.checkedListkey.filter(
+              (id) => id !== item.proId
+            );
+          });
+
+          this.Datalists = this.Datalists.filter(
+            (item) => item.proParentId !== proId
+          );
+
+          // 浠� DataList3 涓Щ闄ょ浉鍏崇殑瀛愰」
+          this.DataList3 = this.DataList3.filter(
+            (item) => item.proParentId !== proId
+          );
+
+          // 鏇存柊鎬讳环鏍�
+          this.TotalPrice1 = 0;
+          this.DataList3.forEach((item) => {
+            this.TotalPrice1 += item.proPrice * item.sl;
+          });
         });
       }
     },

--
Gitblit v1.8.0