Browse Source

Merge branch 'cjh' of 121.41.102.225:Nidong/jiufang

mushencc 3 years ago
parent
commit
49b39390b6
2 changed files with 127 additions and 70 deletions
  1. 27 27
      src/routerMap/index.js
  2. 100 43
      src/views/Agreement/match/matching.vue

+ 27 - 27
src/routerMap/index.js

@@ -2224,33 +2224,33 @@ const routerMap = [
     component: (resolve) =>
       require(["@/views/Agreement/productMessage/detail"], resolve),
   },
-  {
-    path: "/cms/Agreement/match/list",
-    name: "MatchList", //合同-->匹配-->匹配列表
-    meta: {
-      index: 3,
-    },
-    component: (resolve) =>
-      require(["@/views/Agreement/match/list"], resolve),
-  },
-  {
-    path: "/cms/Agreement/match/matching",
-    name: "Matching", //合同-->匹配-->匹配操作
-    meta: {
-      index: 3,
-    },
-    component: (resolve) =>
-      require(["@/views/Agreement/match/matching"], resolve),
-  },
-  {
-    path: "/cms/Agreement/match/check",
-    name: "MatchCheck", //合同-->匹配-->查看
-    meta: {
-      index: 3,
-    },
-    component: (resolve) =>
-      require(["@/views/Agreement/match/check"], resolve),
-  },
+  // {
+  //   path: "/cms/Agreement/match/list",
+  //   name: "MatchList", //合同-->匹配-->匹配列表
+  //   meta: {
+  //     index: 3,
+  //   },
+  //   component: (resolve) =>
+  //     require(["@/views/Agreement/match/list"], resolve),
+  // },
+  // {
+  //   path: "/cms/Agreement/match/matching",
+  //   name: "Matching", //合同-->匹配-->匹配操作
+  //   meta: {
+  //     index: 3,
+  //   },
+  //   component: (resolve) =>
+  //     require(["@/views/Agreement/match/matching"], resolve),
+  // },
+  // {
+  //   path: "/cms/Agreement/match/check",
+  //   name: "MatchCheck", //合同-->匹配-->查看
+  //   meta: {
+  //     index: 3,
+  //   },
+  //   component: (resolve) =>
+  //     require(["@/views/Agreement/match/check"], resolve),
+  // },
   // 测试用
   {
     path: "/cms/ordermannage/businessorderlist/editcopy",

+ 100 - 43
src/views/Agreement/match/matching.vue

@@ -138,7 +138,7 @@
                       :columns="contractColumns"
                       border
                       @on-selection-change="checkedContract"
-                      :max-height="500"
+                      :max-height="400"
                       :data="contractData"
                       show-summary
                       :summary-method="handleSummary"
@@ -160,8 +160,8 @@
 
                 <div
                   style="margin-top: 15px"
-                  v-for="matched_info in matchedList"
-                  :key="matched_info.number"
+                  v-for="(matched_info,index) in matchedList"
+                  :key="matched_info.id"
                   class="matched-block"
                 >
                   <Row type="flex" justify="space-between" align="top">
@@ -193,7 +193,7 @@
                       </div>
                       <div>
                         <Button
-                          @click="handleShowCurrencyMatched1(matched_info)"
+                          @click="handleShowCurrencyMatched1(matched_info,index)"
                           size="small"
                           type="text"
                           >{{
@@ -304,13 +304,14 @@
                   <div v-if="matched_info.isCurrenct">
                     <Table
                       ref="selection"
+                      max-width="600"
                       @on-selection-change="checkedDeepen"
+                      @on-select-cancel="cancelDeepen"
                       :columns="matchedSheetTableColumns"
                       border
-                      :max-height="500"
+                      :max-height="330"
                       on-selection-change
                       :data="matched_detail"
-                      style="width: 100%"
                       show-summary
                       :summary-method="deepenSummary"
                     >
@@ -339,8 +340,8 @@
         <TabPane label="已匹配" name="2">
           <div class="context-tabs">
             <div
-              v-for="matched_info in matchedDetailList"
-              :key="matched_info.number"
+              v-for="(matched_info, index) in matchedDetailList"
+              :key="index"
               class="matched-block"
             >
               <Row type="flex" justify="space-between" align="top">
@@ -354,7 +355,8 @@
                   <div>
                     <Checkbox
                       v-model="matched_info.del_isSelect"
-                      @on-change="(e) => MatchedSelect(matched_info, e)"
+                      @on-change="(e) => MatchedSelect(matched_info, index, e)"
+                      :disabled="matched_info.product_state == 1"
                       class="del_check"
                       >选择</Checkbox
                     >
@@ -374,6 +376,7 @@
                       @click="handleMatchedSet(matched_info, 1)"
                       type="primary"
                       size="small"
+                      :disabled="matched_info.product_state == 1"
                       >撤销匹配</Button
                     >
                   </span>
@@ -502,8 +505,11 @@
                     style="width: 100%"
                   >
                     <template slot="setSlot" slot-scope="{ row }">
-                      <a @click="cancelMatch(row)" style="margin: 0 5px"
-                        >撤销匹配</a
+                      <Button
+                        @click="cancelMatch(row)"
+                        style="margin: 0 5px"
+                        :disabled="row.product_state == 1"
+                        >撤销匹配</Button
                       >
                     </template>
                   </Table>
@@ -564,6 +570,8 @@ export default {
   data() {
     // 这里存放数据
     return {
+      matchedIndex:null,
+      copy_matchedList: [], //拷贝表格状态
       ifMatching: true, //确认按钮
       currencyTag: "1", //当前分页
       info: {
@@ -720,48 +728,56 @@ export default {
           type: "index",
           resizable: true,
           key: "index",
+          width: 100,
         },
         {
           title: "区域",
           align: "center",
           key: "region",
           resizable: true,
+          width: 100,
         },
         {
           title: "图号",
           align: "center",
           key: "url_number",
           resizable: true,
+          width: 100,
         },
         {
           title: "产品名称",
           align: "center",
           key: "product_title",
           resizable: true,
+          width: 100,
         },
         {
           title: "数量",
           align: "center",
           key: "num",
           resizable: true,
+          width: 100,
         },
         {
           title: "单位",
           align: "center",
           key: "unit",
           resizable: true,
+          width: 100,
         },
         {
           title: "饰面",
           align: "center",
           key: "finish",
           resizable: true,
+          width: 100,
         },
         {
           title: "备注",
           align: "center",
           key: "remark",
           resizable: true,
+          width: 100,
         },
         {
           title: "金额",
@@ -769,6 +785,7 @@ export default {
           key: "total_price",
           resizable: true,
           slot: "total_price",
+          minWidth: 100,
         },
       ], //深化信息表头
       unmatchedRoomTableColumnsModal: [],
@@ -783,6 +800,7 @@ export default {
       matched_detail: [],
       checkedContractList: [], //合同选择的数据
       checkedDeepenList: [], //深化信息选择的
+      cancelDeepenList: [],
       revocationList: [], //撤销匹配选中的列表
       search: {
         product_title_list: [],
@@ -811,13 +829,13 @@ export default {
         this.matched_detail[row._index].total_price = Number(
           this.matched_detail[row._index].total_price
         ).toFixed(2);
-        if (row.total_price > 0) {
-          this.matched_detail.forEach((e) => {
-            if (e.id == row.id) {
-              e.total_price = row.total_price;
-            }
-          });
-        }
+        // if (row.total_price > 0) {
+        //   this.matched_detail.forEach((e) => {
+        //     if (e.id == row.id) {
+        //       e.total_price = row.total_price;
+        //     }
+        //   });
+        // }
 
         return;
       }
@@ -928,7 +946,6 @@ export default {
       return sums;
     },
     handleMatchedSet(row, type) {
-      console.log(this.matchedSelectedList);
       if (this.matchedSelectedList.length == 0 && type != 1) {
         return this.$Message.warning("请选择");
       }
@@ -946,7 +963,6 @@ export default {
           time: this.matchedTimeList,
         };
       }
-      console.log(params);
       this.axios.post("/api/contract_match_revoke", params).then((res) => {
         if (res.code == 200) {
           this.matchedSelectedList = "";
@@ -1006,7 +1022,6 @@ export default {
         })
         .then((res) => {
           if (res.code == 200) {
-            console.log(res.data);
             this.contractData = res.data.data;
             this.contractTotal = res.data.total;
             this.searchRegionList = res.data.region_list;
@@ -1014,10 +1029,22 @@ export default {
           }
         });
     },
-    MatchedSelect(row, e) {
-      row.del_isSelect = e;
-      if (e == false) {
-        this.isMatchedSelectAll = e;
+    MatchedSelect(row, index, e) {
+      this.matchedDetailList[index].del_isSelect = e;
+      if (e) {
+        let sureData = this.matchedDetailList.filter((v) => {
+          return v.del_isSelect == true;
+        });
+        let unSureData = this.matchedDetailList.filter((v) => {
+          return v.product_state == 0;
+        });
+        if (sureData.length == unSureData.length) {
+          this.isMatchedSelectAll = true;
+        } else {
+          this.isMatchedSelectAll = false;
+        }
+      } else {
+        this.isMatchedSelectAll = false;
       }
       // this.matchedSelectedList = [];
       this.matchedSelectedList = "";
@@ -1029,11 +1056,15 @@ export default {
           this.matchedTimeList.push(v.crt_time);
         }
       });
-      if (this.matchedDetailList.every((target) => target.del_isSelect)) {
-        this.isMatchedSelectAll = true;
-      } else {
-        this.isMatchedSelectAll = false;
-      }
+      // if (
+      //   this.matchedDetailList.every(
+      //     (target) => target.del_isSelect
+      //   )
+      // ) {
+      //   this.isMatchedSelectAll = true;
+      // } else {
+      //   this.isMatchedSelectAll = false;
+      // }
     },
     ifCheckAll(s) {
       this.revocationList = s;
@@ -1064,9 +1095,8 @@ export default {
         this.deepenList();
         this.contractList();
         this.ifMatching = true;
+        this.getMatchedDetailList(this.copy_matchedList[this.matchedIndex]);
       }
-      // name == 2 && this.handleMatchedListInit();
-      // name == 1 && this.contractList();
     },
     deepenList() {
       //深化信息接口
@@ -1076,10 +1106,19 @@ export default {
         params: { order_no: this.$route.query.order_no, state: 0 },
       }).then((res) => {
         this.matchedList = [];
-        res.data.map((v) => {
-          v.isCurrenct = false;
-        });
+        if (this.copy_matchedList.length == 0) {
+          res.data.map((v) => {
+            v.isCurrenct = false;
+          });
+        }
         this.matchedList = res.data;
+        this.matchedList.forEach((e) => {
+          this.copy_matchedList.forEach((b) => {
+            if (e.order_no === b.order_no) {
+              e.isCurrenct = b.isCurrenct;
+            }
+          });
+        });
       });
     },
     handleMatchedListInit() {
@@ -1137,13 +1176,15 @@ export default {
       }
       this.$forceUpdate();
     },
-    handleShowCurrencyMatched1(row) {
+    handleShowCurrencyMatched1(row,index) {
       if (!row) {
         return this.matchedList.map((v) => (v.isCurrenct = false));
       }
       if (row.isCurrenct) {
+       
         row.isCurrenct = !row.isCurrenct;
       } else {
+ this.matchedIndex = index;
         this.matchedList.map((v) => (v.isCurrenct = false));
         row.isCurrenct = true;
       }
@@ -1278,7 +1319,18 @@ export default {
     checkedDeepen(se) {
       this.checkedDeepenList = se;
     },
+    cancelDeepen(b, a) {
+      //取消匹配列表
+      this.cancelDeepenList = a;
+      this.matched_detail.forEach((e) => {
+        if (e.id == a.id) {
+          e.total_price = 0;
+          e._checked = false;
+        }
+      });
+    },
     getMatchedDetailList(row, type) {
+      if(row){
       this.matched_detail.forEach((e) => {
         if (e.total_price > 0) {
           this.checkedDeepenList.push(e);
@@ -1322,6 +1374,7 @@ export default {
               }
             });
           });
+      }
     },
 
     getMatchedDetailList1(row) {
@@ -1429,6 +1482,7 @@ export default {
         return this.$Message.warning("请选择深化信息中的内容");
       }
       // 匹配保存
+      this.copy_matchedList = JSON.parse(JSON.stringify(this.matchedList));
       let contractDetailId = [];
       this.checkedContractList.forEach((e) => {
         contractDetailId.push(e.id);
@@ -1455,7 +1509,8 @@ export default {
           if (res.code == 200) {
             this.contractList();
             this.deepenList();
-            this.handleShowCurrencyMatched1(false);
+            // this.handleShowCurrencyMatched1();
+            this.getMatchedDetailList(this.copy_matchedList[this.matchedIndex]);
             this.ifMatching = true;
             this.checkedContractList = [];
             this.checkedDeepenList = [];
@@ -1498,11 +1553,13 @@ export default {
       this.matchedTimeList = [];
       this.matchedDetailList.forEach((e) => {
         if (this.isMatchedSelectAll) {
-          e.del_isSelect = true;
-          e.isSelect = true;
-          // this.matchedSelectedList.push(e.order_no);
-          this.matchedSelectedList = e.order_no;
-          this.matchedTimeList.push(e.crt_time);
+          if (e.product_state == 0) {
+            e.del_isSelect = true;
+            e.isSelect = true;
+            // this.matchedSelectedList.push(e.order_no);
+            this.matchedSelectedList = e.order_no;
+            this.matchedTimeList.push(e.crt_time);
+          }
         } else {
           e.del_isSelect = false;
           e.isSelect = false;
@@ -1568,7 +1625,7 @@ span {
 }
 .context-tabs {
   position: relative;
-  max-height: 80%;
+  max-height: 85%;
   overflow: hidden;
   overflow-y: auto;
   padding: 15px;