From 6e08327e5ac538a54c11fe3fe9952b11ce1888e4 Mon Sep 17 00:00:00 2001
From: qx <1084500556@qq.com>
Date: 星期四, 10 四月 2025 16:47:20 +0800
Subject: [PATCH] qx

---
 src/views/system/comp/index.vue |   98 ++++++++++++++++++++++++++-----------------------
 1 files changed, 52 insertions(+), 46 deletions(-)

diff --git a/src/views/system/comp/index.vue b/src/views/system/comp/index.vue
index 1840edc..fbeafe1 100644
--- a/src/views/system/comp/index.vue
+++ b/src/views/system/comp/index.vue
@@ -139,7 +139,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">
@@ -210,10 +210,6 @@
                   <el-input v-model="forms.gtAge" style="width: 54px" />
                 </el-col>
               </el-form-item>
-
-
-
-
             </el-form>
 
             <el-row :gutter="10" class="mb8">
@@ -322,13 +318,13 @@
             </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>
                 <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>
@@ -402,7 +398,7 @@
                 }}</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">
@@ -411,16 +407,16 @@
                 <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>
@@ -505,13 +501,13 @@
             </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="queryParams" ref="queryForm1" 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>
@@ -703,6 +699,10 @@
         xianprice: null,
         limits: null
       },
+      queryParams1: {
+        proName: null,
+        pym: null,
+      },
       id: "",
       // 琛ㄥ崟鍙傛暟
       form: {},
@@ -882,8 +882,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();
@@ -892,8 +892,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));
@@ -923,12 +923,9 @@
     },
     changeXianjia() {
       // 鍘熷鎶樻墸鐜囪绠�
-
-
       if (this.queryParams.price !== 0) {
         this.youhui = (Math.floor((this.queryParams.xianprice / this.queryParams.price) * 100) / 100) * 10;
       }
-
     },
 
     getList() {
@@ -938,7 +935,6 @@
         (this.loading = true);
       listComp(this.queryParams).then((response) => {
         this.compList = response.rows;
-
         response.rows.forEach((item, index) => {
           item.newID =
             (this.queryParams.pageNum - 1) * this.queryParams.pageSize +
@@ -1103,7 +1099,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();
           })
           // ----------------------------------------------------------
 
@@ -1187,7 +1183,7 @@
         });
       } else {
         deptTreeSelect().then((response) => {
-          console.log('222', response.rows);
+        
           this.newpacName = response.rows;
           this.loading = false;
           response.rows.forEach((item, index) => {
@@ -1241,21 +1237,27 @@
       }
     },
     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) {
+      console.log(selection,22222222)
       if (selection) {
         this.dataList = selection;
+        this.resetright()
       }
     },
     resetright() {
@@ -1269,7 +1271,7 @@
         const newItemsToAdd = []; // 鐢ㄤ簬瀛樺偍鏂伴渶瑕佹坊鍔犵殑椤圭洰
 
         this.dataList.forEach((item) => {
-          this.$refs.tre.toggleRowSelection(item, false); // 鍙栨秷閫変腑鐘舵��
+         
           // 浣跨敤 $set 纭繚鍝嶅簲鎬�
           this.$set(item, 'limits', 10); // 璁剧疆闄愬埗鏁伴噺
           this.$set(item, 'ysPrice', item.proPrice); // 璁剧疆鐜颁环涓哄師浠�
@@ -1280,11 +1282,12 @@
             newItemsToAdd.push(item); // 濡傛灉涓嶅瓨鍦ㄧ浉鍚岄」鐩紝鍒欐坊鍔犲埌鏂版暟缁�
             this.updateProPrice(item);
           }
+          this.$refs.tre.toggleRowSelection(item, false); // 鍙栨秷閫変腑鐘舵��
         });
 
         // 娣诲姞鏂伴」鐩埌 OnenewpacName
         this.OnenewpacName.push(...newItemsToAdd);
-
+        console.log(  this.OnenewpacName,2121)
         // 鍒犻櫎閲嶅椤圭洰锛岃繖閲屾垜浠彧闇�澶勭悊鏂版坊鍔犵殑椤圭洰鍜屽師鏈夐」鐩箣闂寸殑閲嶅
         for (let i = this.OnenewpacName.length - newItemsToAdd.length; i < this.OnenewpacName.length - 1; i++) {
           for (let j = i + 1; j < this.OnenewpacName.length; j++) {
@@ -1299,11 +1302,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) {
@@ -1474,13 +1478,16 @@
         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);
@@ -1522,7 +1529,6 @@
       }
       getProjectList().then((response) => {
         this.Treedata = response.data;
-        // console.log(this.Treedata,999888);
       });
     },
 

--
Gitblit v1.8.0