From 02db0a235f5ba38a966280d4f5376a4e468ea48f Mon Sep 17 00:00:00 2001
From: qx <1084500556@qq.com>
Date: 星期一, 14 四月 2025 11:48:14 +0800
Subject: [PATCH] qx

---
 src/views/system/comp/index.vue |  360 +++++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 248 insertions(+), 112 deletions(-)

diff --git a/src/views/system/comp/index.vue b/src/views/system/comp/index.vue
index 2e9b8d3..a81a3a7 100644
--- a/src/views/system/comp/index.vue
+++ b/src/views/system/comp/index.vue
@@ -117,7 +117,7 @@
     </div>
 
     <div>
-      <el-dialog :title="title" :visible.sync="opens" width="1350px" append-to-body :close-on-click-modal="false">
+      <el-dialog :title="title" :visible.sync="opens" width="1350px" append-to-body :close-on-click-modal="true">
         <el-row :gutter="20">
           <el-col :span="7" :xs="24">
             <div style="padding: 0 20px">
@@ -289,8 +289,10 @@
                 </template>
               </el-table-column>
             </el-table>
-            <div style="font-size: 16px;margin-top: 10px;">褰撳墠椤圭洰鏉℃暟锛�<span style="font-weight: 700;">{{ OnenewpacName.length }}</span>鏉�</div>
-       
+            <div style="font-size: 16px;margin-top: 10px;">褰撳墠椤圭洰鏉℃暟锛�<span style="font-weight: 700;">{{
+              OnenewpacName.length
+            }}</span>鏉�</div>
+
           </el-col>
           <el-col :span="2" :xs="24">
             <div style="margin: 240% 16%">
@@ -298,10 +300,10 @@
             </div>
           </el-col>
           <el-col :span="8" :xs="24">
-            <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
+            <el-form :model="queryParams1" ref="queryForm" size="small" :inline="true" v-show="showSearch"
               label-width="68px" @submit.native.prevent>
               <el-form-item label="椤圭洰鍚嶇О" prop="proName">
-                <el-input ref="inputName" v-model="queryParams.proName" placeholder="璇疯緭鍏ラ」鐩悕绉�" clearable
+                <el-input ref="inputName" v-model="queryParams1.proName" placeholder="璇疯緭鍏ラ」鐩悕绉�" clearable
                   @keyup.enter.native="handleSearchFor" style="width: 140px" />
               </el-form-item>
               <el-form-item>
@@ -329,13 +331,13 @@
 
           <el-col :span="15" :xs="24">
             <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="46px"
-              style="height: 35px" @submit.native.prevent>
+              style="height: 50px" @submit.native.prevent>
               <el-form-item label="鍘熶环">
                 <el-input ref="inputName" v-model="queryParams.price" placeholder="鍚堣" clearable style="width: 140px" />
               </el-form-item>
               <el-form-item label="鎶樻墸">
                 <el-input-number ref="inputNumber" style="width: 150px" v-model="youhui" :precision="1" :step="0.1"
-                  :min="0" :max="20" @change="debounceNumberChange" :debounce="3000"></el-input-number>
+                  :min="0" :max="10" @change="debounceNumberChange" :debounce="3000"></el-input-number>
               </el-form-item>
               <el-form-item label="鐜颁环">
                 <el-input ref="inputName" v-model="queryParams.xianprice" placeholder="鍚堣" clearable
@@ -345,7 +347,8 @@
                 <el-button icon="el-icon-refresh" size="mini" @click="resetQuerys">閲嶇疆</el-button>
               </el-form-item>
             </el-form>
-            <el-table border v-loading="loading" :data="OnenewpacName" :row-class-name="tableRowClassName" height="478">
+            <el-table border v-loading="loading" :data="OnenewpacName" :row-class-name="tableRowClassName" height="478"
+              :cell-style="{ padding: '5px 0' }">
               <el-table-column label="椤圭洰鍚嶇О" align="center" prop="proName" width="410">
 
                 <template slot-scope="scope">
@@ -355,10 +358,9 @@
               <el-table-column label="鍘熶环" align="center" prop="proPrice" width="85"></el-table-column>
               <el-table-column label="鎶樻墸" width="151">
                 <template slot-scope="scope">
-                  <!-- 鍙緭鍏ョ函鏁板瓧鎶樻墸 -->
-                  <el-input-number v-model.number="scope.row.limits" @input="validateDiscount(scope.row)"
-                    @change="handleManualChange(scope.row)" placeholder="杈撳叆鎶樻墸" size="small" type="number" :min="0"
-                    :step="0.1" :precision="1" :max="20">
+                  <!-- 鍙緭鍏ョ函鏁板瓧鎶樻墸  @input="validateDiscount(scope.row)"-->
+                  <el-input-number v-model="scope.row.limits" @change="handleManualChange(scope.row)" placeholder="杈撳叆鎶樻墸"
+                    size="mini" type="number" :min="0" :step="0.1" :precision="1" :max="10">
                   </el-input-number>
                 </template>
               </el-table-column>
@@ -370,10 +372,12 @@
                 </template>
               </el-table-column>
             </el-table>
-            <div style="font-size: 16px;margin-top: 10px;">褰撳墠椤圭洰鏉℃暟锛�<span style="font-weight: 700;">{{ OnenewpacName.length }}</span>鏉�</div>
-      
+            <div style="font-size: 16px;margin-top: 10px;">褰撳墠椤圭洰鏉℃暟锛�<span style="font-weight: 700;">{{
+              OnenewpacName.length
+            }}</span>鏉�</div>
+
           </el-col>
-          <el-col :span="2" :xs="24">
+          <!-- <el-col :span="2" :xs="24">
             <div style="margin: 240% 16%" class="btntoleft">
               <el-button type="primary" size="medium"
                 style="writing-mode: vertical-rl; text-align: center; letter-spacing: 5px;" @click="resetright">
@@ -382,12 +386,15 @@
                 <i class="el-icon-back"></i>
               </el-button>
             </div>
-          </el-col>
+          </el-col> -->
           <el-col :span="7" :xs="24">
-            <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
+            <el-form :model="queryParams1" ref="queryForm" size="small" :inline="true" v-show="showSearch"
               label-width="68px" @submit.native.prevent>
+              <el-form-item>
+                <el-button type="primary" @click="Package" size="mini" style="margin-right: 20px">閫夋嫨濂楅</el-button>
+              </el-form-item>
               <el-form-item label="椤圭洰鍚嶇О" prop="proName">
-                <el-input ref="inputName" v-model="queryParams.proName" placeholder="璇疯緭鍏ラ」鐩悕绉�" clearable
+                <el-input ref="inputName" v-model="queryParams1.proName" placeholder="璇疯緭鍏ラ」鐩悕绉�" clearable
                   @keyup.enter.native="handleSearchFor" style="width: 140px" />
               </el-form-item>
               <el-form-item>
@@ -444,7 +451,8 @@
                 <el-button icon="el-icon-refresh" size="mini" @click="resetQuerys">閲嶇疆</el-button>
               </el-form-item>
             </el-form>
-            <el-table border v-loading="loading" :data="OnenewpacName" :row-class-name="tableRowClassName" height="478">
+            <el-table border v-loading="loading" :data="OnenewpacName" :row-class-name="tableRowClassName" height="478"
+              :cell-style="{ padding: '5px 0' }">
               <el-table-column label="椤圭洰鍚嶇О" align="center" prop="proName" width="170">
 
                 <template slot-scope="scope">
@@ -459,21 +467,26 @@
                 </template>
               </el-table-column>
             </el-table>
-            <div style="font-size: 16px;margin-top: 10px;">褰撳墠椤圭洰鏉℃暟锛�<span style="font-weight: 700;">{{ OnenewpacName.length }}</span>鏉�</div>
-           
+            <div style="font-size: 16px;margin-top: 10px;">褰撳墠椤圭洰鏉℃暟锛�<span style="font-weight: 700;">{{
+              OnenewpacName.length
+            }}</span>鏉�</div>
+
           </el-col>
-          <el-col :span="2" :xs="24">
+          <!-- <el-col :span="2" :xs="24">
             <div style="margin: 240% 16%">
               <el-button type="primary" size="medium " icon="el-icon-back"
                 style="writing-mode: vertical-rl; text-align: center;letter-spacing: 10px;" @click="resetright">纭�
                 璁�</el-button>
             </div>
-          </el-col>
+          </el-col> -->
           <el-col :span="8" :xs="24">
-            <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
+            <el-form :model="queryParams1" ref="queryForm" size="small" :inline="true" v-show="showSearch"
               label-width="68px" @submit.native.prevent>
+              <el-form-item>
+                <el-button type="primary" @click="Package" size="mini" style="margin-right: 20px">閫夋嫨濂楅</el-button>
+              </el-form-item>
               <el-form-item label="椤圭洰鍚嶇О" prop="proName">
-                <el-input ref="inputName" v-model="queryParams.proName" placeholder="璇疯緭鍏ラ」鐩悕绉�" clearable
+                <el-input ref="inputName" v-model="queryParams1.proName" placeholder="璇疯緭鍏ラ」鐩悕绉�" clearable
                   @keyup.enter.native="handleSearchFor" style="width: 140px" />
               </el-form-item>
               <el-form-item>
@@ -494,6 +507,30 @@
         </div>
       </el-dialog>
     </div>
+
+
+    <el-dialog title="閫夋嫨濂楅" :visible.sync="taocan" width="70%" height="700px" :close-on-click-modal="false">
+      <!-- <el-form :model="queryParam" ref="queryForm" size="small" :inline="true" label-width="auto">
+        <el-form-item label="濂楅鍚嶇О" prop="pacName">
+          <el-input v-model="queryParam.pacName" placeholder="璇疯緭鍏ュ椁愬悕绉�" clearable @keyup.enter.native="handle"
+            style="width: 200px" />
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary" icon="el-icon-search" size="mini" @click="handle">鎼滅储</el-button>
+        </el-form-item>
+      </el-form> -->
+      <el-table v-loading="loading" element-loading-text="姝e湪鍔犺浇涓�..." element-loading-spinner="el-icon-loading" border
+        :data="newpacName1" @selection-change="handleSelectionChange1" height="450px" ref="tb">
+        <el-table-column type="selection" width="40px" align="center" label="閫夋嫨" />
+        <el-table-column label="濂楅鍚嶇О" align="center" prop="pacName" width="120px" />
+        <el-table-column label="濂楅浠锋牸" align="center" prop="price" width="120px" />
+        <el-table-column label="濂楅鏄庣粏" align="center" prop="allProName" :show-overflow-tooltip="true" />
+      </el-table>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="cancel1">鍙� 娑�</el-button>
+        <el-button type="primary" @click="submit">纭� 瀹�</el-button>
+      </span>
+    </el-dialog>
 
     <!-- 娣诲姞鎴栦慨鏀逛綋妫�鍗曚綅淇℃伅缁存姢瀵硅瘽妗� -->
     <div class="dia">
@@ -611,6 +648,8 @@
       id: "",
       // 閫変腑鏁扮粍
       ids: [],
+      newpacName1 : [],
+      taocan:false,
       // 鎺у埗鎬у埆閫夋嫨妗嗘槸鍚︾鐢�
       isSexDisabled: false,
       dwIds: [],
@@ -644,6 +683,10 @@
       opens: false,
       openss: false,
       openOne: false,
+      queryParams1: {
+        proName: null,
+        pym: null,
+      },
       // 鏌ヨ鍙傛暟
       queryParams: {
         pageNum: 1,
@@ -655,6 +698,8 @@
         xianprice: null,
         limits: null
       },
+
+
       id: "",
       // 琛ㄥ崟鍙傛暟
       form: {},
@@ -753,8 +798,8 @@
     updateProPrice(row) {
       const proPrice = new Big(row.proPrice);
       const limits = new Big(row.limits);
-      const result = proPrice.times(limits.div(10));  // ordPrice * (discount / 10)
-      row.ysPrice = result.toNumber();
+      const result = proPrice.times(limits.div(10)).toNumber();  // ordPrice * (discount / 10)
+      row.ysPrice = result.toFixed(2);
       this.queryParams.xianprice = this.OnenewpacName.reduce((sum, item) => {
         return sum.plus(new Big(item.ysPrice || '0'));
       }, new Big(0)).toNumber();
@@ -763,8 +808,8 @@
     updateProPrice1(row) {
       const proPrice = new Big(row.proPrice);
       const limits = new Big(row.limits);
-      const result = proPrice.times(limits.div(10));
-      row.ysPrice = result.toNumber();
+      const result = proPrice.times(limits.div(10)).toNumber();  // ordPrice * (discount / 10)
+      row.ysPrice = result.toFixed(2);
       const totalYsPrice = this.OnenewpacName.reduce((sum, item) => {
         return sum.plus(new Big(item.ysPrice || '0'));
       }, new Big(0));
@@ -780,10 +825,11 @@
       }
 
       // Update youhui calculation
+
       if (this.queryParams.price !== 0 && this.queryParams.xianprice !== 0) {
         this.youhui = (Math.floor((this.queryParams.xianprice / this.queryParams.price) * 100) / 100) * 10;
       } else {
-        this.youhui = 0;
+        this.youhui = 10;
       }
     },
     debounceNumberChange(currentValue, oldValue) {
@@ -794,12 +840,9 @@
     },
     changeXianjia() {
       // 鍘熷鎶樻墸鐜囪绠�
-
-
       if (this.queryParams.price !== 0) {
         this.youhui = (Math.floor((this.queryParams.xianprice / this.queryParams.price) * 100) / 100) * 10;
       }
-
     },
 
     getList() {
@@ -831,6 +874,7 @@
     cancell() {
       this.openss = false;
       this.openOne = false;
+      this.youhui = 10
       // this.reset();
     },
     // 琛ㄥ崟閲嶇疆
@@ -974,7 +1018,7 @@
             item.ysPrice = result.toNumber();
             this.queryParams.xianprice = this.OnenewpacName.reduce((sum, item) => {
               return sum.plus(new Big(item.ysPrice || '0'));
-            }, new Big(0));
+            }, new Big(0)).toNumber();
           })
           // ----------------------------------------------------------
 
@@ -985,49 +1029,49 @@
 
     },
     numberChangeXianPrice(currentValue, oldValue) {
-  // 濡傛灉鐜颁环娌℃湁鍙樺寲锛岀洿鎺ヨ繑鍥�
-  if (this.queryParams.xianprice === this.lastXianPrice || !this.queryParams.xianprice) {
-    return;
-  }
-
-  this.$confirm("纭畾淇敼鎵�鏈夊瓙椤圭殑鎶樻墸鍚楋紵", "鎻愮ず", {
-    confirmButtonText: "纭畾",
-    cancelButtonText: "鍙栨秷",
-    type: "warning",
-  })
-    .then(() => {
-      // 纭繚淇敼鎶樻墸鐨勫��
-      this.youhui = currentValue;
-
-      let totalYsprice = new Big(0); // 鍒濆鍖栨�� ysprice
-      // 閬嶅巻姣忎釜椤圭洰锛屾洿鏂版瘡涓瓙椤圭殑浠锋牸
-      this.OnenewpacName.forEach((item) => {
-        item.limits = this.youhui;
-        const proPrice = new Big(item.proPrice);
-        const limits = new Big(item.limits);
-        const result = proPrice.times(limits.div(10));  // ordPrice * (discount / 10)
-        item.ysPrice = result.toNumber();
-        totalYsprice = totalYsprice.plus(new Big(item.ysPrice));
-      });
-      // 濡傛灉鎬荤殑 ysPrice 鍜屾煡璇㈠弬鏁颁腑鐨� xianprice 涓嶄竴鑷达紝杩涜璋冩暣
-      if (!totalYsprice.eq(this.queryParams.xianprice)) {
-        const diff = new Big(this.queryParams.xianprice).minus(totalYsprice);
-        // 濡傛灉 OnenewpacName 鏁扮粍涓嶄负绌猴紝璋冩暣鏈�鍚庝竴椤圭殑 ysPrice
-        if (this.OnenewpacName.length > 0) {
-          const lastItem = this.OnenewpacName[this.OnenewpacName.length - 1];
-          const newYsPrice = new Big(lastItem.ysPrice).plus(diff).toNumber();
-          // 浣跨敤 $set 纭繚鍝嶅簲鎬ф洿鏂�
-          this.$set(this.OnenewpacName[this.OnenewpacName.length - 1], 'ysPrice', newYsPrice);
-        }
+      // 濡傛灉鐜颁环娌℃湁鍙樺寲锛岀洿鎺ヨ繑鍥�
+      if (this.queryParams.xianprice === this.lastXianPrice || !this.queryParams.xianprice) {
+        return;
       }
-      // 鏇存柊 lastXianPrice 浠ヤ究涓嬫姣旇緝
-      this.lastXianPrice = this.queryParams.xianprice;
-    })
-    .catch(() => {
-      // 濡傛灉鍙栨秷淇敼锛屾仮澶嶅師鏈夌殑浼樻儬鍊�
-      this.youhui = oldValue;
-    });
-},
+
+      this.$confirm("纭畾淇敼鎵�鏈夊瓙椤圭殑鎶樻墸鍚楋紵", "鎻愮ず", {
+        confirmButtonText: "纭畾",
+        cancelButtonText: "鍙栨秷",
+        type: "warning",
+      })
+        .then(() => {
+          // 纭繚淇敼鎶樻墸鐨勫��
+          this.youhui = currentValue;
+
+          let totalYsprice = new Big(0); // 鍒濆鍖栨�� ysprice
+          // 閬嶅巻姣忎釜椤圭洰锛屾洿鏂版瘡涓瓙椤圭殑浠锋牸
+          this.OnenewpacName.forEach((item) => {
+            item.limits = this.youhui;
+            const proPrice = new Big(item.proPrice);
+            const limits = new Big(item.limits);
+            const result = proPrice.times(limits.div(10));  // ordPrice * (discount / 10)
+            item.ysPrice = result.toNumber();
+            totalYsprice = totalYsprice.plus(new Big(item.ysPrice));
+          });
+          // 濡傛灉鎬荤殑 ysPrice 鍜屾煡璇㈠弬鏁颁腑鐨� xianprice 涓嶄竴鑷达紝杩涜璋冩暣
+          if (!totalYsprice.eq(this.queryParams.xianprice)) {
+            const diff = new Big(this.queryParams.xianprice).minus(totalYsprice);
+            // 濡傛灉 OnenewpacName 鏁扮粍涓嶄负绌猴紝璋冩暣鏈�鍚庝竴椤圭殑 ysPrice
+            if (this.OnenewpacName.length > 0) {
+              const lastItem = this.OnenewpacName[this.OnenewpacName.length - 1];
+              const newYsPrice = new Big(lastItem.ysPrice).plus(diff).toNumber();
+              // 浣跨敤 $set 纭繚鍝嶅簲鎬ф洿鏂�
+              this.$set(this.OnenewpacName[this.OnenewpacName.length - 1], 'ysPrice', newYsPrice);
+            }
+          }
+          // 鏇存柊 lastXianPrice 浠ヤ究涓嬫姣旇緝
+          this.lastXianPrice = this.queryParams.xianprice;
+        })
+        .catch(() => {
+          // 濡傛灉鍙栨秷淇敼锛屾仮澶嶅師鏈夌殑浼樻儬鍊�
+          this.youhui = oldValue;
+        });
+    },
 
 
     changegroupingName() {
@@ -1044,8 +1088,6 @@
       this.loading = true;
       if (this.forms.sex) {
         deptTreeSelect(this.forms.sex).then((response) => {
-          console.log('111', response.rows);
-
           this.newpacName = response.rows;
           this.loading = false;
           response.rows.forEach((item, index) => {
@@ -1058,7 +1100,6 @@
         });
       } else {
         deptTreeSelect().then((response) => {
-          console.log('222', response.rows);
           this.newpacName = response.rows;
           this.loading = false;
           response.rows.forEach((item, index) => {
@@ -1082,7 +1123,6 @@
     handleSearch() {
       if (this.queryParams.pacName) {
         getPackageList(this.queryParams.pacName).then((response) => {
-          console.log('333', response.data);
           this.newpacName = response.data;
           response.data.forEach((item, index) => {
             item.newID =
@@ -1093,7 +1133,6 @@
         });
       } else {
         deptTreeSelect().then((response) => {
-          console.log('44', response.rows);
           this.newpacName = response.rows;
           response.rows.forEach((item, index) => {
             item.newID =
@@ -1112,21 +1151,26 @@
       }
     },
     handleSearchFor() {
-      getProjectList(this.queryParams.proName).then((response) => {
-
-        response.data.forEach((item, index) => {
-          item.newID =
-            (this.queryParams.pageNum - 1) * this.queryParams.pageSize +
-            index +
-            1;
+      // 鍒ゆ柇鏄惁涓烘眽瀛�
+      const isChineseChar = (char) => /[\u4E00-\u9FA5]/.test(char)
+      if (isChineseChar(this.queryParams1.proName)) {
+        this.queryParams1.pym = null
+        getProjectList(this.queryParams1).then((response) => {
+          this.Treedata = response.data;
         });
-        this.Treedata = response.data;
-      });
+      } else {
+        this.queryParams1.pym = this.queryParams1.proName
+        this.queryParams1.proName = null
+        getProjectList(this.queryParams1).then((response) => {
+          this.Treedata = response.data;
+        });
+      }
     },
     // 鍗曢」鏁版嵁鑾峰彇
     handleChangesingle(selection) {
       if (selection) {
         this.dataList = selection;
+        this.resetright()
       }
     },
     resetright() {
@@ -1170,11 +1214,12 @@
         // 閲嶆柊璁$畻鎬讳环鍜岀幇浠�
         this.OnenewpacName.forEach((item) => {
           this.queryParams.price += item.proPrice; // 绱姞鍘熶环
-          this.queryParams.xianprice += item.ysPrice || 0; // 绱姞鐜颁环锛屽鏋測sPrice涓簎ndefined鍒欑疮鍔�0
+          //this.queryParams.xianprice += item.ysPrice || 0;  绱姞鐜颁环锛屽鏋測sPrice涓簎ndefined鍒欑疮鍔�0
         });
-
-        // 璁$畻浼樻儬锛岃繖閲屽亣璁句紭鎯犳槸鐜颁环涓庡師浠风殑宸鐧惧垎姣�
-        this.youhui = (Math.floor((this.queryParams.xianprice / this.queryParams.price) * 100) / 100) * 10;
+        this.queryParams.xianprice = this.OnenewpacName.reduce((sum, item) => {
+          return sum.plus(new Big(item.ysPrice || '0'));
+        }, new Big(0)).toNumber();
+        this.youhui = (Math.floor((this.queryParams.xianprice / this.queryParams.price) * 100) / 100) * 10
       }
     },
     handledbelete(row) {
@@ -1188,14 +1233,16 @@
       // 鐒跺悗鏇存柊鎬讳环鍜岀幇浠�
       this.OnenewpacName.forEach((item) => {
         this.queryParams.price += item.proPrice;
-        this.queryParams.xianprice += item.ysPrice || 0; // 纭繚ysPrice瀛樺湪
+        this.queryParams.xianprice = this.OnenewpacName.reduce((sum, item) => {
+          return sum.plus(new Big(item.ysPrice || "0"));
+        }, new Big(0)).toNumber();
       });
 
       // 璁$畻浼樻儬
       if (this.queryParams.price > 0) {
         this.youhui = (Math.floor((this.queryParams.xianprice / this.queryParams.price) * 100) / 100) * 10;
       } else {
-        this.youhui = 0;
+        this.youhui = 10;
       }
     },
 
@@ -1312,6 +1359,7 @@
           this.forms.groupingName = item.groupingName;
           this.forms.gtAge = item.gtAge;
           this.forms.limits = item.limits;
+          this.youhui = item.limits
           this.forms.ltAge = item.ltAge;
           this.forms.pacName = item.pacName;
           this.forms.payType = item.payType;
@@ -1328,6 +1376,11 @@
       this.groupIds = selection.map((item) => item.id);
       this.singlegg = !selection.length;
     },
+    handleBeforeClose(done) {
+      this.$confirm('纭鍏抽棴锛�')
+        .then(() => done())
+        .catch(() => { /* 鍙栨秷鍏抽棴 */ });
+    },
     xiangmuWh() {
       if (!this.forms.groupingName ||
         !this.forms.sex ||
@@ -1336,7 +1389,6 @@
         return; // Stop execution if any required field is empty
       }
       this.openOne = true;
-
       this.title = "鍒嗙粍椤圭洰缁存姢";
       this.OnenewpacName = [];
       this.queryParams.price = 0;
@@ -1345,13 +1397,19 @@
         let id = this.groupList[0].id || '';
         getDetails(id).then((res) => {
           this.OnenewpacName = res.data.groupingProList;
-          this.queryParams.xianprice = this.OnenewpacName.reduce((sum, item) => {
-            return sum.plus(new Big(item.ysPrice || '0'));
-          }, new Big(0));
-          this.OnenewpacName.forEach((item, index) => {
-            this.queryParams.price += item.proPrice;
-          });
-          this.youhui = (Math.floor((this.queryParams.xianprice / this.queryParams.price) * 100) / 100) * 10
+          // this.queryParams.xianprice = this.OnenewpacName.reduce((sum, item) => {
+          //   return sum.plus(new Big(item.ysPrice || '0'));
+          // }, new Big(0)).toNumber();
+
+          // this.OnenewpacName.forEach((item, index) => {
+          //   this.queryParams.price += item.proPrice;
+          // });
+          // 
+
+          // this.youhui = (Math.floor((this.queryParams.xianprice / this.queryParams.price) * 100) / 100) * 10
+          this.queryParams.xianprice = res.data.ysPrice
+          this.queryParams.price = res.data.price
+          this.youhui = res.data.limits
         });
       }
       // console.log(this.groupList[0].id, 9966);
@@ -1367,7 +1425,6 @@
         deptTreeSelect(this.forms.sex).then((response) => {
           // 濂楅鍚嶇О
           this.newpacName = response.rows;
-          console.log('5', response.rows);
           this.loading = false;
           response.rows.forEach((item, index) => {
             item.newID =
@@ -1381,7 +1438,6 @@
 
         deptTreeSelect().then((response) => {
           this.newpacName = response.rows;
-          console.log('6', response.rows);
           this.loading = false;
           response.rows.forEach((item, index) => {
             item.newID =
@@ -1393,7 +1449,6 @@
       }
       getProjectList().then((response) => {
         this.Treedata = response.data;
-        // console.log(this.Treedata,999888);
       });
     },
 
@@ -1407,9 +1462,6 @@
           proPrice: item.proPrice,
         });
       });
-
-
-
 
       let data = {
         groupingName: this.forms.groupingName,
@@ -1442,7 +1494,6 @@
     },
     // 淇敼鍒嗙粍
     GroupUpdate() {
-      console.log(this.$refs.elTable)
       this.$refs.tbs.clearSelection();
       this.forms = {
         groupingName: "",
@@ -1518,6 +1569,32 @@
       row.index = rowIndex;
     },
 
+
+    Package() {
+      this.taocan = true;
+      deptTreeSelect(this.forms.sex).then((res) => {
+        if (res.rows) {
+          this.newpacName1 = res.rows
+        }
+      });
+    },
+
+
+    handle() {
+      this.loading = true;
+      deptTreeSelect(this.forms.sex, this.queryParam).then((res) => {
+        if (res.rows) {
+          this.newpacName1 = res.rows; // 鏇存柊濂楅鍒楄〃
+        } else {
+          this.newpacName1 = [];
+        }
+        this.loading = false;
+      }).catch(() => {
+        this.loading = false;
+        this.$modal.msgError("鎼滅储澶辫触锛岃绋嶅悗閲嶈瘯");
+      });
+    },
+
     /** 鎻愪氦鎸夐挳 */
     submitForm() {
       this.$refs["form"].validate((valid) => {
@@ -1563,6 +1640,65 @@
           this.$modal.msgSuccess("鍒犻櫎鎴愬姛");
         })
         .catch(() => { });
+    },
+
+    submit() {
+      if (!this.selectedPackage) {
+        this.$modal.msgError("璇峰厛閫夋嫨涓�涓椁�");
+        return;
+      }
+
+      // 娓呯┖宸︿晶琛ㄦ牸
+      this.OnenewpacName = [];
+
+      // 鑾峰彇閫変腑鐨勫椁愰」鐩垪琛�
+      const newProjects = this.selectedPackage.tjProjectList || [];
+
+      // 灏嗛�変腑鐨勫椁愰」鐩坊鍔犲埌宸︿晶琛ㄦ牸
+      this.loading = true;
+      newProjects.forEach(project => {
+        // 涓烘瘡涓」鐩缃粯璁ゆ姌鎵e拰鐜颁环
+        this.$set(project, 'limits', 10); // 榛樿鎶樻墸 10锛堝嵆鍘熶环锛�
+        this.$set(project, 'ysPrice', project.proPrice); // 鐜颁环鍒濆鍖栦负鍘熶环
+        this.OnenewpacName.push(project);
+      });
+
+      // 鏇存柊鎬讳环鍜岀幇浠�
+      this.queryParams.price = this.OnenewpacName.reduce((sum, item) => {
+        return sum + (item.proPrice || 0);
+      }, 0);
+
+      this.queryParams.xianprice = this.OnenewpacName.reduce((sum, item) => {
+        return sum + (item.ysPrice || 0);
+      }, 0);
+
+      // 鏇存柊浼樻儬鍊�
+      this.youhui = this.queryParams.price > 0
+        ? (Math.floor((this.queryParams.xianprice / this.queryParams.price) * 100) / 100) * 10
+        : 0;
+
+      // 鍏抽棴瀵硅瘽妗�
+      this.taocan = false;
+      this.loading = false;
+      this.$modal.msgSuccess("娣诲姞鎴愬姛");
+    },
+    cancel1() {
+      this.taocan = false;
+    },
+
+
+    handleSelectionChange1(selection) {
+      // 瀹炵幇鍗曢�夐�昏緫
+      if (selection.length > 1) {
+        const lastSelected = selection[selection.length - 1];
+        this.$refs.tb.clearSelection();
+        this.$refs.tb.toggleRowSelection(lastSelected, true);
+        this.selectedPackage = lastSelected;
+      } else if (selection.length === 1) {
+        this.selectedPackage = selection[0];
+      } else {
+        this.selectedPackage = null;
+      }
     },
     /** 瀵煎嚭鎸夐挳鎿嶄綔 */
     handleExport() {
@@ -1617,7 +1753,7 @@
 }
 
 ::v-deep .el-dialog {
-  height: 750px;
+  // height: 750px;
   overflow-y: auto;
 }
 

--
Gitblit v1.8.0