From e6a54db987bdf6d04f6e122d80f2b5bb0449c1a1 Mon Sep 17 00:00:00 2001
From: su1124 <1583764726@qq.com>
Date: 星期四, 20 六月 2024 16:44:51 +0800
Subject: [PATCH] su

---
 src/views/system/package/index.vue |   80 ++++++++++++++++++++++++++++++----------
 1 files changed, 60 insertions(+), 20 deletions(-)

diff --git a/src/views/system/package/index.vue b/src/views/system/package/index.vue
index 5644531..1a2b1b7 100644
--- a/src/views/system/package/index.vue
+++ b/src/views/system/package/index.vue
@@ -301,7 +301,7 @@
     <el-dialog
       :title="title"
       :visible.sync="open"
-      width="1100px"
+      width="1500px"
       append-to-body
     >
       <el-form
@@ -499,7 +499,7 @@
       </el-table> -->
 
       <el-row :gutter="20">
-        <el-col :span="6">
+        <el-col :span="7">
           <div
             style="text-align: center; margin-bottom: 10px; margin-top: 10px"
           >
@@ -519,6 +519,7 @@
               :default-checked-keys="checkedkey"
               :filter-node-method="filterNode"
               ref="tree"
+              :render-content="renderContent"
             >
             </el-tree>
           </div>
@@ -541,6 +542,7 @@
               @check-change="handleCurrentChecked1"
               :default-checked-keys="checkedListkey"
               ref="trees"
+              :render-content="renderContent"
             >
             </el-tree>
           </div>
@@ -561,9 +563,9 @@
             >
               <el-table-column prop="propinName" label="妫�鏌ラ」鐩�">
               </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>
+              <el-table-column prop="proName" label="鏄庣粏椤圭洰" width="260px">
               </el-table-column>
 
               <!-- <el-table-column
@@ -584,6 +586,7 @@
                 </template> 
               </el-table-column>-->
             </el-table>
+            <span>鍚堣锛歿{ pics }}鍏�</span>
           </div>
         </el-col>
       </el-row>
@@ -640,7 +643,6 @@
   components: { Packages },
   data() {
     let checkPhoneNum = (rule, value, callback) => {
-      console.log(value);
       let patter = new RegExp(/^1\s*[3456789]\s*(\d\s*){9}$/);
       if (value == "" && value == undefined && !value) {
         return callback("");
@@ -651,6 +653,7 @@
       }
     };
     return {
+      pics: "",
       filterText: "",
       DataList: [],
       list1: true,
@@ -696,6 +699,7 @@
       newproName: [],
       // 鎵�鏈変綋妫�椤圭洰路
       allList: [],
+      treeList: [],
       // 鎵�鏈夊椁愭暟鎹�
       // allpackage:[],
       // 寮瑰嚭灞傛爣棰�
@@ -794,7 +798,6 @@
       });
     },
     sel(val) {
-      console.log(val);
       let id = val;
       this.keys = "";
       id.forEach((item) => {
@@ -808,9 +811,7 @@
         this.categoryList = response.rows;
       });
     },
-    shangpin(vals) {
-      console.log(vals);
-    },
+    shangpin(vals) {},
     // 鍙栨秷鎸夐挳
     cancel() {
       this.open = false;
@@ -876,6 +877,8 @@
       this.open = true;
       this.title = "浣撴濂楅淇℃伅缁存姢";
       this.DataList = [];
+      this.checkedkey = [];
+      this.checkedListkey = [];
       this.getDataList();
       // getAllList().then((response) => {
       //   this.allList = response.data;
@@ -928,7 +931,7 @@
       // });
       getPacInFo(this.forms.pacId).then((response) => {
         this.form = response.data;
-        this.form.keywords=this.form.keywords.slice(0, -1);
+        this.form.keywords = this.form.keywords.slice(0, -1);
         this.form.keywords = this.form.keywords.split(",");
         this.DataList = [];
         this.checkedkey = [];
@@ -942,7 +945,7 @@
       this.open = true;
       getPacInFo(row.pacId).then((response) => {
         this.form = response.data;
-        this.form.keywords=this.form.keywords.slice(0, -1);
+        this.form.keywords = this.form.keywords.slice(0, -1);
         this.form.keywords = this.form.keywords.split(",");
         this.DataList = [];
         this.checkedkey = [];
@@ -1031,7 +1034,6 @@
     },
     //  // 榛樿鎺ュ彈鍥涗釜鍊� { 褰撳墠琛岀殑鍊�, 褰撳墠鍒楃殑鍊�, 琛岀殑涓嬫爣, 鍒楃殑涓嬫爣 }
     objectSpanMethod({ row, column, rowIndex, columnIndex }) {
-      // console.log(row, column, rowIndex, columnIndex);
       let fields = ["propinName"];
       let cellValue = row[column.property];
       if (cellValue && fields.includes(column.property)) {
@@ -1050,11 +1052,19 @@
         }
       }
     },
-
+    renderContent(h, { node, data, store }) {
+      return (
+        <span class="custom-tree-node">
+          <span>{node.label}</span>
+          <span>({data.proPrice}鍏�)</span>
+        </span>
+      );
+    },
     getDataList() {
       this.loading = true;
       getProParentIdDxList().then((response) => {
         this.Treedata = response.data.list;
+        console.log(this.Treedata, 666);
         if (this.form.tjProjectList) {
           this.form.tjProjectList.forEach((item) => {
             this.Treedata.forEach((item1) => {
@@ -1067,6 +1077,7 @@
                     item2.disabled = true;
                     this.checkedListkey.push(item2.proId);
                     this.DataList.push(item2);
+                    console.log(this.DataList);
                     if (this.DataList.length != 0) {
                       this.DataList.forEach((item) => {
                         if (item.proParentId == item1.proId) {
@@ -1100,7 +1111,6 @@
       });
     },
     handleCurrentChecked(data, checked, checkedNodes) {
-      console.log(data, checked);
       this.dataObj = data;
       this.checkedObj = checked;
       if (checked == true) {
@@ -1113,7 +1123,9 @@
             this.checkedListkey.push(item.proId);
             this.DataList.push(item);
             this.spliceData();
+            this.pics = 0;
             this.DataList.forEach((item1) => {
+              this.pics += item.proPrice;
               if (item1.proParentId == data.proId) {
                 item1.propinName = data.proName;
                 item1.propinPrice = this.dataObj.proPrice;
@@ -1121,10 +1133,12 @@
             });
           });
           this.TotalPrice1 = 0;
+          this.pics = 0;
           if (this.DataList.length != 0) {
             this.list1 = false;
             this.DataList.forEach((item) => {
               this.TotalPrice1 = item.proPrice + this.TotalPrice1;
+              this.pics += item.proPrice;
             });
           }
         });
@@ -1136,11 +1150,15 @@
             item.disabled = true;
           });
           this.checkedListkey = [];
-          console.log(this.TreedataList.length);
+          console.log(this.DataList);
           this.DataList.forEach((item, index) => {
             if (item.proParentId == this.dataObj.proId) {
               this.DataList.splice(index, this.TreedataList.length);
             }
+          });
+          this.pics = 0;
+          this.DataList.forEach((item, index) => {
+            this.pics += item.proPrice;
           });
         });
       }
@@ -1166,7 +1184,9 @@
           if (item.proId == data.proId) {
             this.DataList.splice(index, 1);
             this.TotalPrice1 = 0;
+            this.pics = 0;
             this.DataList.forEach((item1) => {
+              this.pics += item1.proPrice;
               this.TotalPrice1 = item1.proPrice + this.TotalPrice1;
             });
           }
@@ -1181,8 +1201,10 @@
         });
         this.spliceData();
         this.TotalPrice1 = 0;
+        this.pics = 0;
         this.DataList.forEach((item1) => {
           this.TotalPrice1 = item1.proPrice + this.TotalPrice1;
+          this.pics += item1.proPrice;
         });
       }
     },
@@ -1207,7 +1229,18 @@
       if (this.form.pacName) {
         this.form.tjProjectList = [];
         if (this.DataList.length != 0) {
-          this.DataList.forEach((item) => {
+          this.treeList = JSON.parse(JSON.stringify(this.DataList));
+          for (var i = 0; i < this.treeList.length; i++) {
+            for (var j = i + 1; j < this.treeList.length; j++) {
+              if (
+                this.treeList[i].proParentId == this.treeList[j].proParentId
+              ) {
+                this.treeList.splice(j, 1);
+                j--;
+              }
+            }
+          }
+          this.treeList.forEach((item) => {
             this.form.tjProjectList.push({
               // id: 0,
               proName: item.propinName,
@@ -1226,12 +1259,12 @@
               // } else {
               //   this.form.pacStatus = 1;
               // }
-              if(this.keys){
+              if (this.keys) {
                 this.form.keywords = this.keys;
-              }else{
+              } else {
                 this.form.keywords = this.form.keywords.toString();
               }
-            
+
               updatePackage(this.form).then((response) => {
                 this.$modal.msgSuccess("淇敼鎴愬姛");
                 this.open = false;
@@ -1244,7 +1277,6 @@
               // } else {
               //   this.form.pacStatus = 1;
               // }
-              // console.log(this.form.tjProjectList);
               // return;
               addPackage(this.form).then((response) => {
                 this.$modal.msgSuccess("鏂板鎴愬姛");
@@ -1385,4 +1417,12 @@
   overflow-y: auto;
   border: 1px solid #d9d9d9;
 }
+/* .custom-tree-node {
+    flex: 1;
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+    font-size: 14px;
+    padding-right: 8px;
+  } */
 </style>
\ No newline at end of file

--
Gitblit v1.8.0