From 067c77dee145023f983eea591dfaf3be8ffc1ab9 Mon Sep 17 00:00:00 2001
From: wwl <xchao828@163.com>
Date: 星期三, 22 一月 2025 15:15:31 +0800
Subject: [PATCH] 1

---
 src/views/system/tijian/index.vue |  110 ++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 69 insertions(+), 41 deletions(-)

diff --git a/src/views/system/tijian/index.vue b/src/views/system/tijian/index.vue
index eb807bc..7e99913 100644
--- a/src/views/system/tijian/index.vue
+++ b/src/views/system/tijian/index.vue
@@ -351,7 +351,7 @@
                   </el-table-column>
                   <el-table-column prop="proName" label="鏄庣粏椤圭洰" width="260px">
                   </el-table-column>
-              
+
                   <el-table-column prop="proPrice" label="鍘熶环" width="56px">
                   </el-table-column>
 
@@ -421,16 +421,8 @@
                     </el-table-column>
                     <el-table-column prop="sl" label="鏁伴噺" width="56px">
                     </el-table-column>
-                    <el-table-column
-                      prop="proPrice"
-                      label="鍘熶环"
-                      width="56px"
-                    ></el-table-column>
-                    <el-table-column
-                      prop="proName"
-                      label="鏄庣粏椤圭洰"
-                      width="260px"
-                    >
+                    <el-table-column prop="proPrice" label="鍘熶环" width="56px"></el-table-column>
+                    <el-table-column prop="proName" label="鏄庣粏椤圭洰" width="260px">
                     </el-table-column>
 
                     <el-table-column label="鎿嶄綔" align="center" fixed="right" class-name="small-padding fixed-width"
@@ -485,7 +477,7 @@
               <el-form-item label="浣撴绫诲瀷">
                 <el-select v-model="form.tjType" placeholder="璇烽�夋嫨浣撴绫诲瀷">
                   <el-option v-for="dict in dict.type.dict_team" :key="dict.value" :label="dict.label"
-                    :value="dict.value" :disabled="!form.firmId && dict.value === '1'"></el-option>
+                    :value="dict.value"></el-option>
                 </el-select>
               </el-form-item>
               <el-form-item label="浣撴绫诲埆">
@@ -513,8 +505,8 @@
               <el-form-item style="margin-left: 149px">
                 <el-button type="primary" @click="Package" size="mini" style="margin-right: 20px">閫夋嫨濂楅</el-button>
                 <el-button type="primary" @click="resetpackage" size="mini" style="margin-right: 20px">閲嶇疆濂楅</el-button>
-                <el-button type="primary" @click="submitPrice" :loading="loadingSubmit"
-                  :disabled="confirm || loadingSubmit" v-if="showHidden.has_charge == 'N'" size="mini">绛惧埌鐧昏</el-button>
+                <el-button type="primary" @click="submitPrice" :loading="loadingSubmit" :disabled="loadingSubmit"
+                  v-if="showHidden.has_charge == 'N'" size="mini">绛惧埌鐧昏</el-button>
                 <el-button type="primary" @click="submitCheckinfee" :disabled="confirm"
                   v-if="showHidden.has_charge == 'Y'" size="mini">鐧昏鏀惰垂</el-button>
               </el-form-item>
@@ -588,8 +580,9 @@
               <el-table-column label="鎶樻墸">
                 <template slot-scope="scope">
                   <!-- 鍙緭鍏ョ函鏁板瓧鎶樻墸 -->
-                  <el-input-number v-model.number="scope.row.discount" @input="validateDiscount(scope.row)"  @change="handleManualChange(scope.row)"
-                    placeholder="杈撳叆鎶樻墸" size="small" type="number" :precision="1" :step="0.1" :max="10" :min="0">
+                  <el-input-number v-model.number="scope.row.discount" @input="validateDiscount(scope.row)"
+                    @change="handleManualChange(scope.row)" placeholder="杈撳叆鎶樻墸" size="small" type="number" :precision="1"
+                    :step="0.1" :max="10" :min="0">
                   </el-input-number>
                 </template>
               </el-table-column>
@@ -1081,6 +1074,7 @@
     };
   },
   watch: {
+
     filterText(val) {
       this.$refs.tree.filter(val);
     },
@@ -1654,6 +1648,10 @@
         });
     },
     numberChangeXianPrice(currentValue, oldValue) {
+      // 濡傛灉鐜颁环娌℃湁鍙樺寲锛岀洿鎺ヨ繑鍥�
+      if (this.TotalPrice === this.lastXianPrice || !this.TotalPrice) {
+        return;
+      }
       this.$confirm("纭畾淇敼鎵�鏈夊瓙椤圭殑鎶樻墸鍚楋紵", "鎻愮ず", {
         confirmButtonText: "纭畾",
         cancelButtonText: "鍙栨秷",
@@ -1692,6 +1690,7 @@
               );
             }
           }
+          this.lastXianPrice = this.TotalPrice;
         })
         .catch(() => {
           this.discount = oldValue;
@@ -1886,9 +1885,10 @@
                 alert("璇诲崱鍣ㄨ繛鎺ュ叧闂�");
               };
             } else if (res.msg == "Y") {
-              this.$refs.aaa.open = true;
+              /* this.$refs.aaa.open = true;
               this.$refs.aaa.getAllList();
-              this.$refs.aaa.title = "璇佷欢瀛楀吀";
+              this.$refs.aaa.title = "璇佷欢瀛楀吀"; */
+
             } else if (res.msg == "S") {
               this.cardreader = true;
               _this.cardreaderradio = 3;
@@ -2288,8 +2288,7 @@
       this.DataList = []; // 娓呯┖宸查�夐」鐩垪琛�
       this.checkedkey = []; // 娓呯┖鏍戠殑閫変腑鐘舵��
       this.checkedListkey = [];
-      this.TreedataList = [];
-      this.$refs.tree.setCheckedKeys([]); // 閲嶇疆鏍戦�変腑鐘舵��
+      this.TreedataList = []
 
       let data = {
         cusId,
@@ -2327,12 +2326,37 @@
         dwId: this.form.firmId || "",
       };
       if (this.form.tjType == 1) {
-        if (!this.form.firmId) {
+        if (!this.form.firmId && !this.form.firmName) {
           this.$message({
             type: "warning",
             message: "璇峰厛缁存姢鍗曚綅锛�",
           });
-        } else {
+        } else if (!this.form.firmId && this.form.firmName) {
+          this.taocan = true;
+          this.loading = true;
+          deptTreeSelect(cusSex).then((response) => {
+            this.newpacName = response.rows;
+            try {
+              if (this.tableData1.length >= 1) {
+                this.newpacName.forEach((item3) => {
+                  this.tableData1.forEach((item4) => {
+                    item4.list.forEach((item6) => {
+                      if (item6.pacName === item3.pacName) {
+                        this.$nextTick(() => {
+                          this.$refs.tb.toggleRowSelection(item3, true);
+                        });
+                        throw Error();
+                      }
+                    });
+                  });
+                });
+              }
+            } catch (error) { }
+            this.loading = false;
+          });
+        }
+
+        else {
           this.taocan = true;
           this.loading = true;
           tuantiSelect(param).then((res) => {
@@ -2490,7 +2514,6 @@
       this.loading = true;
       getProParentIdDxList().then((response) => {
         this.Treedata = response.data.list;
-
         if (this.tableData[0]) {
           this.tableData[0].tjProjectList.forEach((selectionitem) => {
             this.Treedata.forEach((item) => {
@@ -2605,32 +2628,36 @@
         });
       }
     },
-    // 鐐瑰嚮鑾峰彇姣忎釜鏍戣妭鐐�
     handleCurrentChecked(data, checked, checkedNodes) {
       this.dataObj = data;
-      if (checked.checkedNodes.length != 0) {
-        this.$refs.tree.setCheckedKeys([data.proId]);
+      if (checked.checkedNodes.length > 0) {
+        const promises = checked.checkedNodes.map(node => getProSonDxList(node.proId));
+        Promise.all(promises).then(results => {
+          this.TreedataList = results.flatMap(res => res.data.list);
+          this.checkedListkey = [];
+          this.DataList = [];
 
-        let proId = data.proId;
-        getProSonDxList(proId).then((res) => {
-          this.TreedataList = res.data.list;
           this.TreedataList.forEach((item) => {
             this.checkedListkey.push(item.proId);
-
             this.DataList.push(item);
-            this.spliceData();
-            this.DataList.forEach((item1) => {
-              if (item1.proParentId == data.proId) {
-                item1.propinName = data.proName;
-              }
-            });
           });
+
+          this.spliceData(); // 鍋囪杩欎釜鏂规硶鏄綘瀹氫箟鐨勫叾浠栧湴鏂瑰鐞嗘暟鎹殑
+
+          // 鏇存柊鍚嶇О鍜岃绠楁�讳环
+          this.DataList.forEach((item1) => {
+            const parent = checked.checkedNodes.find(node => node.proId === item1.proParentId);
+            if (parent) {
+              item1.propinName = parent.proName;
+            }
+          });
+
           this.TotalPrice1 = 0;
           this.marryall = 0;
           if (this.DataList.length != 0) {
             this.list1 = false;
             this.DataList.forEach((item) => {
-              this.marryall = item.proPrice * item.sl;
+              this.marryall += Number(item.proPrice) * Number(item.sl);
             });
           }
         });
@@ -2785,9 +2812,8 @@
         pacId: _this.pacId,
         proIds: this.proIds,
       };
-
       // 鏍规嵁浣撴绫诲瀷閫夋嫨涓嶅悓鐨勫鐞嗘柟娉�
-      if (this.form.tjType == 1) {
+      if (this.form.firmId) {
         tuantiqueren(data).then((response) => {
           if (response.code == 200) {
             this.processOrderItems(cusId);
@@ -3098,8 +3124,8 @@
     // 鏈�鍚庢彁浜ゆ寜閽�
     submitPrice() {
       let _this = this;
+      this.loadingSubmit = true;
       if (_this.tjCategory !== "") {
-        this.loadingSubmit = true;
         let List = _this.tableData1; //鍗曚釜椤圭洰淇℃伅
         if (this.responseList.cusId) {
           var userId = this.responseList.cusId;
@@ -3149,8 +3175,9 @@
             cusIdCard: item.cusId,
           })); // 鍒涘缓鏂扮殑瀵硅薄锛屽寘鍚� discount 鍜� id
         gaibianzhekou(newArray).then((res) => {
+          this.loadingSubmit = false;
           if (res.code === 200) {
-            this.loadingSubmit = false;
+
             let data;
 
             if (pacId || this.tjOrderList.length > 0) {
@@ -3182,6 +3209,7 @@
               };
               this.listgetOrder(data);
             } else {
+              this.loadingSubmit = false;
               this.$message({
                 type: "warning ",
                 message: "璇烽�夋嫨濂楅!",

--
Gitblit v1.8.0