Browse Source

替换文件 ---cjh

17767204043 3 năm trước cách đây
mục cha
commit
cfbf5dc239
2 tập tin đã thay đổi với 361 bổ sung362 xóa
  1. 96 166
      src/views/Agreement/match/check.vue
  2. 265 196
      src/views/Agreement/match/matching.vue

+ 96 - 166
src/views/Agreement/match/check.vue

@@ -54,32 +54,12 @@
                 >选择</Checkbox
               >
             </div>
-            <span>制单日期:{{ matched_info.crt_time }}</span>
-            <!-- <div style="margin-left:100px">
-                <span>{{
-              matched_info.matching_status == 0
-                ? "未匹配"
-                : matched_info.matching_status == 1
-                ? "匹配中"
-                : "匹配完成"
-            }}</span>
-            </div> -->
-          </Col>
-          <!-- <Col span="3">
-            <span>产品名称:{{ matched_info.product_name }}</span>
+            <span
+              >制单日期:{{
+                func.replaceDate(matched_info.crt_time).split(" ")[0]
+              }}</span
+            >
           </Col>
-          <Col span="3">
-            <span>区域:{{ matched_info.region }}</span>
-          </Col> -->
-          <!-- <Col span="2">
-            <span>{{
-              matched_info.matching_status == 0
-                ? "未匹配"
-                : matched_info.matching_status == 1
-                ? "匹配中"
-                : "匹配完成"
-            }}</span>
-          </Col> -->
           <Col style="display: flex; justify-content: space-between" span="6">
             <span>
               <Button
@@ -201,22 +181,20 @@
           </Col>
         </Row>
         <div v-if="matched_info.isCurrenct">
-          <div
-            v-for="(matched_detail, index) in matchedDetailList"
-            :key="index"
-          >
+          <div>
             <Table
               ref="selection"
               @on-selection-change="ifCheckAll"
-              v-show="!matched_detail.isHidden"
               :columns="matchedSheetTableColumns"
               border
               :max-height="500"
               on-selection-change
-              :data="matched_detail.data"
+              :data="matchedDetailList"
+              show-summary
+              :summary-method="handleSummary"
               style="width: 100%"
             >
-              <template slot="setSlot" slot-scope="{ row }">
+              <!-- <template slot="setSlot" slot-scope="{ row }">
                 <Button
                   @click="underProduction(row)"
                   style="margin: 0 5px"
@@ -224,7 +202,7 @@
                   :disabled="productionBtn"
                   >下生产</Button
                 >
-              </template>
+              </template> -->
             </Table>
           </div>
         </div>
@@ -253,7 +231,6 @@
         >
       </div>
     </Modal>
-    <div @click="test()">测试按钮</div>
   </div>
 </template>
 
@@ -275,9 +252,9 @@ export default {
       project_name: this.$route.query.project_name,
       isMatchedSelectAll: false,
       matchedInfo: {
-        region:"", //区域
-        url_number:"",//图号
-        product_title:""//产品名称
+        region: "", //区域
+        url_number: "", //图号
+        product_title: "", //产品名称
       },
       urlMatchedList: [],
       productMatchedList: [],
@@ -287,64 +264,64 @@ export default {
       matchedDetailList: [],
       matchedList: [],
       productionBtn: false,
+
       matchedSheetTableColumns: [
         {
-          type: "selection",
-          width: 60,
-          align: "center",
-        },
-        {
           title: "序号",
           align: "center",
           type: "index",
           resizable: true,
           width: 100,
+          key: "index",
         },
         {
           title: "区域",
           align: "center",
-          key: "compose_name",
+          key: "region",
           resizable: true,
           width: 100,
         },
         {
           title: "图号",
           align: "center",
-          key: "region",
+          key: "url_number",
           resizable: true,
           width: 160,
         },
         {
           title: "产品名称",
           align: "center",
-          key: "house_number",
+          key: "product_title",
           resizable: true,
           width: 160,
         },
         {
           title: "数量",
           align: "center",
-          key: "part_name",
+          key: "num",
           resizable: true,
           width: 180,
         },
         {
           title: "金额",
           align: "center",
-          key: "line",
+          key: "total_price",
           resizable: true,
           width: 170,
         },
-        { title: "操作", align: "center", slot: "setSlot", width: 100 },
+        // { title: "操作", align: "center", slot: "setSlot", width: 100 },
       ], //匹配表头
       processModal: false,
       process_man: "",
       processManList: [],
       cut_order_product_ids: [],
       matchedSelectedList: [],
+      matchedTimeList: [], //多选后的时间列表
       delList: [],
+      timeList: [],
       showDel: false,
       detailList: {},
+      params: {},
     };
   },
   // 生命周期 - 创建完成(可以访问当前this实例)
@@ -360,10 +337,6 @@ export default {
     this.deepenList();
   },
   methods: {
-    test(){
-      console.log(this.func.replaceDate(1651852800).split(' ')[0]);
-      
-    },
     detail() {
       //详情接口
       this.axios({
@@ -372,107 +345,98 @@ export default {
         params: { order_no: this.$route.query.order_no },
       }).then((res) => {
         if (res.code == 200) {
-          console.log(res);
           this.detailList = res.data;
         }
       });
     },
+    handleSummary({ columns, data }) {
+      const sums = {};
+      columns.forEach((column, index) => {
+        const key = column.key;
+        if (key === "index") {
+          sums[key] = {
+            key,
+            value: "合计",
+          };
+          return;
+        }
+        const values = data.map((item) => Number(item[key]));
+        if (key == "total_price") {
+          const v = values.reduce((prev, curr) => {
+            const value = Number(curr);
+            if (!isNaN(value)) {
+              return prev + curr;
+            } else {
+              return prev;
+            }
+          }, 0);
+          sums[key] = {
+            key,
+            value: (v * 1).toFixed(2),
+          };
+        } else {
+          sums[key] = {
+            key,
+            value: "",
+          };
+        }
+      });
+
+      return sums;
+    },
     deepenList() {
       //深化信息接口
       this.axios({
         method: "post",
         url: "/api/contract_match_detail_deep",
-        params: { order_no: this.$route.query.order_no, state: 0 },
+        params: { order_no: this.$route.query.order_no, state: 1 },
       }).then((res) => {
         this.matchedList = [];
         res.data.map((v) => {
           v.isCurrenct = false;
         });
-        this.matchedList = res.data
-        // this.urlMatchedList = res.data.image_number;
-        // this.productMatchedList = res.data.product_name;
-        // this.matchedList = res.data.list;
-        // res.data.list.forEach((v, index) => {
-        //   if (v.matching_status == 2) {
-        //     this.matchedList.push(v);
-        //   }
-        // });
+        this.matchedList = res.data;
       });
     },
     underProduction(row) {
       //表单里点击下生产事件
-      console.log(row);
       this.processModal = true;
     },
     handleProcess() {
       //下生产通知弹框二次确认
       this.process_control = true;
-      console.log(this.cut_order_product_ids);
-      this.axios({
-        method: "post",
-        url: "/api/bst_pull",
-        data: {
-          cut_order_product_ids: this.cut_order_product_ids,
-          process_man: this.process_man,
-          process_start_time: this.func.replaceDateNoHMS(
-            this.process_start_time
-          ),
-          process_end_time: this.func.replaceDateNoHMS(this.process_end_time),
-        },
-      }).then((res) => {
+      this.$set(this.params, "product_no", this.processNumber)
+      this.axios.post("/api/contract_match_product", this.params).then((res) => {
         if (res.code == 200) {
           this.$Message.success(res.msg);
           this.processModal = false;
           this.matchedSelectedList = [];
           // this.initData();
-          this.detail()
+          this.detail();
+          this.deepenList()
+          setTimeout(() => {
+            this.process_control = false;
+          }, 500);
         }
-        setTimeout(() => {
-          this.process_control = false;
-        }, 500);
       });
     },
     ifCheckAll(s) {
       //   判断table中是否全选
       console.log(s, "这是table中的数据");
     },
-    handelDel() {
-      if (this.delList.length == 0) {
-        return this.$Message.warning("请选择要删除的数据");
-      }
-      this.confirmDelete({
-        content: "强制删除么?",
-        then: () => {
-          this.showDel = true;
-        },
-      });
-    },
     handleMatchedSelectAll() {
       this.isMatchedSelectAll = !this.isMatchedSelectAll;
       this.matchedSelectedList = [];
-      // this.matchedList.map((v) => {
-      //     v.isCurrenct = true
-      //     if (v.product_state == 0) {
-      //         v.isSelect = this.isMatchedSelectAll;
-      //         if (v.isSelect) {
-      //             this.matchedSelectedList.push(v.id)
-
-      //         }
-      //     }
-      // });
+      this.matchedTimeList = [];
       this.matchedList.forEach((e) => {
         if (this.isMatchedSelectAll) {
           e.del_isSelect = true;
           e.isSelect = true;
-          if (this.$refs.selection) {
-            this.$refs.selection[0].selectAll(e.del_isSelect);
-          }
+          this.matchedSelectedList.push(e.order_no);
+          this.matchedTimeList.push(e.crt_time);
         } else {
           e.del_isSelect = false;
           e.isSelect = false;
-          if (this.$refs.selection) {
-            this.$refs.selection[0].selectAll(e.del_isSelect);
-          }
         }
       });
     },
@@ -498,51 +462,40 @@ export default {
     },
     MatchedSelect(row, e) {
       row.del_isSelect = e;
-      if (this.$refs.selection) {
-        this.$refs.selection[0].selectAll(row.del_isSelect);
+      if (e == false) {
+        this.isMatchedSelectAll = e;
       }
-      this.delList = [];
+      this.matchedSelectedList = [];
+      this.matchedTimeList = [];
       this.matchedList.forEach((v) => {
         if (v.del_isSelect) {
-          this.delList.push(v.id);
+          this.matchedSelectedList.push(v.order_no);
+          this.matchedTimeList.push(v.crt_time);
         }
       });
+      if (this.matchedList.every((target) => target.del_isSelect)) {
+        this.isMatchedSelectAll = true;
+      } else {
+        this.isMatchedSelectAll = false;
+      }
     },
     back() {
       this.$router.go(-1);
     },
     handleGoProduction(type, row) {
-      if (this.matchedSelectedList.length == 0 && type == 1) {
-        return this.$Message.warning("请选择");
-      }
-
+      this.processNumber = ""
       if (type === 2) {
-        this.cut_order_product_ids = [row.id];
+        this.params = {
+          time: [row.crt_time],
+          order_no: row.order_no,
+        };
       } else {
-        this.cut_order_product_ids = this.matchedSelectedList;
+        this.params = {
+          time: this.matchedTimeList,
+          order_no: this.matchedSelectedList,
+        };
       }
-      this.axios
-        .post("/api/bst_get_plan_time", {
-          type: -1,
-          id: this.cut_order_product_ids,
-          order_no: this.$route.query.project_number,
-        })
-        .then((res) => {
-          if (res.code == 200) {
-            this.processModal = true;
-            let time = [];
-            res.data.forEach((v) => {
-              time.push(v * 1000);
-            });
-            this.options = {
-              disabledDate(date) {
-                return (
-                  date && (date.valueOf() < time[0] || date.valueOf() > time[1])
-                );
-              },
-            };
-          }
-        });
+      this.processModal = true;
     },
     initData() {
       //获取table中的数据
@@ -582,42 +535,19 @@ export default {
         row.isCurrenct = !row.isCurrenct;
       } else {
         this.matchedList.map((v) => (v.isCurrenct = false));
-        //     this.matchedList.forEach(e=>{
-        //       if(e.id == row.id){
-        //           this.$set(e,"test",true)
-        //       }else if(e.test){
-        //           delete(e.test)
-        //       }else{
-        //           return
-        //       }
-        //   })
-        //   console.log(this.matchedList,"测试");
         row.isCurrenct = true;
       }
       this.getMatchedDetailList(row);
     },
     getMatchedDetailList(row) {
-      console.log(row);
       row.isCurrenct &&
         this.axios
           .post("/api/contract_match_detail_deep_open", {
-            // cut_order_product_id: row.id,
-            // id: this.matchedInfo.id,
-            // number: this.matchedInfo.number,
-            // part_name: this.matchedInfo.part_name,
-            // region: this.matchedInfo.region,
-            order_no:row.order_no,
-            state:1,
-            crt_time:row.crt_time,
-            region:this.matchedInfo.region,
-            product_title:this.matchedList.product_title,
-            url_number:this.matchedList.url_number
+            order_no: row.order_no,
+            state: 1,
+            crt_time: row.crt_time,
           })
           .then((res) => {
-            console.log(res);
-            // this.regionMatchedList = res.data.region;
-            // this.numberMatchedList = res.data.number;
-            // this.partNameMatchedList = res.data.part_name;
             this.matchedDetailList = res.data.data;
             this.$nextTick(function () {
               if (row.del_isSelect == true || row.isSelect == true) {

+ 265 - 196
src/views/Agreement/match/matching.vue

@@ -50,6 +50,7 @@
           匹配
         </Button>
         <Button
+          v-show="currencyTag == 1"
           @click="matchiSngSave"
           type="primary"
           size="small"
@@ -84,12 +85,12 @@
                           filter-by-label
                           transfer
                           clearable
-                          v-model="info.wool_size1"
+                          v-model="search.region_list"
                           size="small"
                           style="width: 120px"
                         >
                           <Option
-                            v-for="(item, index) in wool_size1"
+                            v-for="(item, index) in searchRegionList"
                             :key="index"
                             :label="item"
                             :value="item"
@@ -106,13 +107,13 @@
                           filter-by-label
                           clearable
                           transfer
-                          v-model="info.part_name"
+                          v-model="search.product_title_list"
                           :max-tag-count="2"
                           size="small"
                           style="width: 120px"
                         >
                           <Option
-                            v-for="(item, index) in part_name"
+                            v-for="(item, index) in searchProductTitleList"
                             :key="index"
                             :label="item"
                             :value="item"
@@ -139,6 +140,8 @@
                       @on-selection-change="checkedContract"
                       :max-height="500"
                       :data="contractData"
+                      show-summary
+                      :summary-method="handleSummary"
                     ></Table>
                     <div class="table_bottom">
                       总共<span>{{ contractTotal || 0 }}</span
@@ -154,6 +157,7 @@
                 style="border-top: 1px solid #adb5bd; padding: 10px"
               >
                 <h1>深化信息</h1>
+
                 <div
                   style="margin-top: 15px"
                   v-for="matched_info in matchedList"
@@ -249,13 +253,13 @@
                           transfer
                           clearable
                           filter-by-label
-                          v-model="matchedInfo.number"
+                          v-model="matchedInfo.url_number"
                           :max-tag-count="2"
                           size="small"
                           style="width: 100px"
                         >
                           <Option
-                            v-for="(item, index) in numberMatchedList"
+                            v-for="(item, index) in urlMatchedList"
                             :key="index"
                             :label="item"
                             :value="item"
@@ -273,13 +277,13 @@
                           transfer
                           clearable
                           filter-by-label
-                          v-model="matchedInfo.part_name"
+                          v-model="matchedInfo.product_title	"
                           :max-tag-count="2"
                           size="small"
                           style="width: 100px"
                         >
                           <Option
-                            v-for="(item, index) in partNameMatchedList"
+                            v-for="(item, index) in productList"
                             :key="index"
                             :label="item"
                             :value="item"
@@ -298,32 +302,36 @@
                     </Col>
                   </Row>
                   <div v-if="matched_info.isCurrenct">
-                    <Table
-                      ref="selection"
-                      @on-selection-change="checkedDeepen"
-                      :columns="matchedSheetTableColumns"
-                      border
-                      :max-height="500"
-                      on-selection-change
-                      :data="matched_detail"
-                      style="width: 100%"
-                    >
-                      <template
-                        slot-scope="{ row }"
-                        slot="total_price"
-                        ref="row"
+                    <keep-alive>
+                      <Table
+                        ref="selection"
+                        @on-selection-change="checkedDeepen"
+                        :columns="matchedSheetTableColumns"
+                        border
+                        :max-height="500"
+                        on-selection-change
+                        :data="matched_detail"
+                        style="width: 100%"
+                        show-summary
+                        :summary-method="deepenSummary"
                       >
-                        <div class="service table_slot">
-                          <Input
-                            v-model="row.total_price"
-                            @input="onInputText($event)"
-                            @on-focus="focusInput(row, 'total_price')"
-                            style="width: 80%"
-                            clearable
-                          />
-                        </div>
-                      </template>
-                    </Table>
+                        <template
+                          slot-scope="{ row }"
+                          slot="total_price"
+                          ref="row"
+                        >
+                          <div class="service table_slot">
+                            <Input
+                              v-model="row.total_price"
+                              type="number"
+                              @on-blur="checkPrice(row)"
+                              style="width: 80%"
+                              clearable
+                            />
+                          </div>
+                        </template>
+                      </Table>
+                    </keep-alive>
                   </div>
                 </div>
               </div>
@@ -358,31 +366,7 @@
                       func.replaceDate(matched_info.crt_time).split(" ")[0]
                     }}</span
                   >
-                  <!-- <div style="margin-left:100px">
-                <span>{{
-              matched_info.matching_status == 0
-                ? "未匹配"
-                : matched_info.matching_status == 1
-                ? "匹配中"
-                : "匹配完成"
-            }}</span>
-            </div> -->
                 </Col>
-                <!-- <Col span="3">
-            <span>产品名称:{{ matched_info.product_name }}</span>
-          </Col>
-          <Col span="3">
-            <span>区域:{{ matched_info.region }}</span>
-          </Col> -->
-                <!-- <Col span="2">
-            <span>{{
-              matched_info.matching_status == 0
-                ? "未匹配"
-                : matched_info.matching_status == 1
-                ? "匹配中"
-                : "匹配完成"
-            }}</span>
-          </Col> -->
                 <Col
                   style="display: flex; justify-content: space-between"
                   span="6"
@@ -450,7 +434,7 @@
                   </span>
                 </Col>
                 <Col span="4">
-                  <span>图号</span>
+                  <span>图号</span>
                   <span>
                     <Select
                       filterable
@@ -458,13 +442,13 @@
                       transfer
                       clearable
                       filter-by-label
-                      v-model="matchedInfo.number"
+                      v-model="matchedInfo.url_number"
                       :max-tag-count="2"
                       size="small"
                       style="width: 150px"
                     >
                       <Option
-                        v-for="(item, index) in numberMatchedList"
+                        v-for="(item, index) in urlMatchedList"
                         :key="index"
                         :label="item"
                         :value="item"
@@ -482,13 +466,13 @@
                       transfer
                       clearable
                       filter-by-label
-                      v-model="matchedInfo.part_name"
+                      v-model="matchedInfo.product_title"
                       :max-tag-count="2"
                       size="small"
                       style="width: 150px"
                     >
                       <Option
-                        v-for="(item, index) in partNameMatchedList"
+                        v-for="(item, index) in productList"
                         :key="index"
                         :label="item"
                         :value="item"
@@ -498,7 +482,7 @@
                 </Col>
                 <Col span="2">
                   <Button
-                    @click="getMatchedDetailList(matched_info)"
+                    @click="getMatchedDetailList1(matched_info)"
                     size="small"
                     type="primary"
                   >
@@ -516,6 +500,8 @@
                     :max-height="500"
                     on-selection-change
                     :data="matched_detail"
+                    show-summary
+                    :summary-method="unmatchedSummary"
                     style="width: 100%"
                   >
                     <template slot="setSlot" slot-scope="{ row }">
@@ -598,9 +584,9 @@ export default {
       },
 
       matchedInfo: {
-        id: this.$route.query.id,
-        image_number: [],
-        product_name: [],
+        product_title: [],
+        url_number: [],
+        region: [],
       },
       cut_size: [], //精裁尺寸 未匹配
       number: [], //房号 未匹配
@@ -629,17 +615,14 @@ export default {
       currentChooseNumberUsed: "",
       matchedList: [],
       matchedDetailList: [],
+      matchedTimeList: [],
       unmatchedSheetTableColumns: [
         {
-          type: "selection",
-          width: 60,
-          align: "center",
-        },
-        {
           title: "序号",
           align: "center",
           type: "index",
           resizable: true,
+          key: "index",
         },
         {
           title: "区域",
@@ -695,8 +678,14 @@ export default {
       ], //未匹配房间表头
       unmatchedRoomTableColumnsUsed: [],
       contractColumns: [
-        { title: "全选", align: "center", width: 60, type: "selection" },
-        { title: "序号", align: "center", key: "id" },
+        {
+          title: "全选",
+          align: "center",
+          width: 60,
+          type: "selection",
+          key: "index",
+        },
+        { title: "序号", align: "center", type: "index" },
         { title: "区域", align: "center", key: "region" },
         { title: "产品名称", align: "center", key: "product_title" },
         { title: "数量", align: "center", key: "num" },
@@ -704,29 +693,6 @@ export default {
       ],
       contractData: [],
       contractTotal: "",
-      testData: [
-        {
-          index: "1",
-          middle: "A区",
-          product_name: "抽屉1",
-          number: "1",
-          price: "123",
-        },
-        {
-          index: "1",
-          middle: "A区",
-          product_name: "抽屉1",
-          number: "1",
-          price: "123",
-        },
-        {
-          index: "1",
-          middle: "A区",
-          product_name: "抽屉1",
-          number: "1",
-          price: "123",
-        },
-      ],
       matchedSheetTableColumns: [
         {
           type: "selection",
@@ -738,6 +704,7 @@ export default {
           align: "center",
           type: "index",
           resizable: true,
+          key: "index",
         },
         {
           title: "区域",
@@ -784,6 +751,12 @@ export default {
       checkedContractList: [], //合同选择的数据
       checkedDeepenList: [], //深化信息选择的
       revocationList: [], //撤销匹配选中的列表
+      search:{
+        product_title_list:[],
+        region_list:[]
+      },
+      searchRegionList:[],
+      searchProductTitleList:[]
     };
   },
   // 生命周期 - 创建完成(可以访问当前this实例)
@@ -796,6 +769,148 @@ export default {
     this.contractList();
   },
   methods: {
+    checkPrice(row) {
+      if (row.total_price < 0) {
+        row.total_price = "0.00";
+        this.matched_detail[row._index].total_price = "0.00";
+      } else {
+        row.total_price = Number(row.total_price).toFixed(2);
+        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;
+            }
+          });
+        }
+        return;
+      }
+    },
+    deepenSummary({ columns, data }) {
+      const sums = {};
+      columns.forEach((column, index) => {
+        const key = column.key;
+        if (key === "index") {
+          sums[key] = {
+            key,
+            value: "合计",
+          };
+          return;
+        }
+        const values = data.map((item) => Number(item[key]));
+        if (key == "total_price") {
+          const v = values.reduce((prev, curr) => {
+            const value = Number(curr);
+            if (!isNaN(value)) {
+              return prev + curr;
+            } else {
+              return prev;
+            }
+          }, 0);
+          sums[key] = {
+            key,
+            value: (v * 1).toFixed(2),
+          };
+        } else {
+          sums[key] = {
+            key,
+            value: "",
+          };
+        }
+      });
+
+      return sums;
+    },
+    unmatchedSummary({ columns, data }) {
+      const sums = {};
+      columns.forEach((column, index) => {
+        const key = column.key;
+        if (key === "index") {
+          sums[key] = {
+            key,
+            value: "合计",
+          };
+          return;
+        }
+        const values = data.map((item) => Number(item[key]));
+        if (key == "total_price") {
+          const v = values.reduce((prev, curr) => {
+            const value = Number(curr);
+            if (!isNaN(value)) {
+              return prev + curr;
+            } else {
+              return prev;
+            }
+          }, 0);
+          sums[key] = {
+            key,
+            value: (v * 1).toFixed(2),
+          };
+        } else {
+          sums[key] = {
+            key,
+            value: "",
+          };
+        }
+      });
+
+      return sums;
+    },
+    handleSummary({ columns, data }) {
+      const sums = {};
+      columns.forEach((column, index) => {
+        const key = column.key;
+        if (key === "index") {
+          sums[key] = {
+            key,
+            value: "合计",
+          };
+          return;
+        }
+        const values = data.map((item) => Number(item[key]));
+        if (key == "total_price") {
+          const v = values.reduce((prev, curr) => {
+            const value = Number(curr);
+            if (!isNaN(value)) {
+              return prev + curr;
+            } else {
+              return prev;
+            }
+          }, 0);
+          sums[key] = {
+            key,
+            value: (v * 1).toFixed(2),
+          };
+        } else {
+          sums[key] = {
+            key,
+            value: "",
+          };
+        }
+      });
+
+      return sums;
+    },
+    handleMatchedSet(row, index, type) {
+      if (this.matchedSelectedList.length == 0) {
+        return this.$Message.warning("请选择");
+      }
+      this.axios
+        .post("/api/contract_match_revoke", {
+          id: [],
+          order_no: this.matchedSelectedList,
+          time: this.matchedTimeList,
+        })
+        .then((res) => {
+          if (res.code == 200) {
+            this.matchedSelectedList = [];
+            this.matchedTimeList = [];
+            this.handleMatchedListInit();
+          }
+        });
+    },
     cancelMatch(row) {
       //撤销匹配
       this.axios
@@ -815,7 +930,6 @@ export default {
     },
     checkedDeepen(se) {
       this.checkedDeepenList = se;
-      console.log(this.checkedDeepenList);
     },
     contractSearch() {
       //合同信息搜索按钮
@@ -842,31 +956,38 @@ export default {
       this.axios
         .post("/api/contract_match_detail_contract", {
           order_no: this.$route.query.order_no,
-          region: "",
-          product_title: "",
+          region: this.search.region_list,
+          product_title: this.search.product_title_list,
         })
         .then((res) => {
           if (res.code == 200) {
             this.contractData = res.data.data;
             this.contractTotal = res.data.total;
+            this.searchRegionList = res.data.region_list;
+            this.searchProductTitleList = res.data.product_title_list
           }
         });
     },
     MatchedSelect(row, e) {
       row.del_isSelect = e;
-      if (this.$refs.selection) {
-        this.$refs.selection[0].selectAll(row.del_isSelect);
+      if (e == false) {
+        this.isMatchedSelectAll = e;
       }
-      this.delList = [];
-      this.matchedList.forEach((v) => {
+      this.matchedSelectedList = [];
+      this.matchedTimeList = [];
+      this.matchedDetailList.forEach((v) => {
         if (v.del_isSelect) {
-          this.delList.push(v.id);
+          this.matchedSelectedList.push(v.order_no);
+          this.matchedTimeList.push(v.crt_time);
         }
       });
+      if (this.matchedDetailList.every((target) => target.del_isSelect)) {
+        this.isMatchedSelectAll = true;
+      } else {
+        this.isMatchedSelectAll = false;
+      }
     },
     ifCheckAll(s) {
-      //   判断table中是否全选
-      console.log(s, "这是table中的数据");
       this.revocationList = s;
     },
     back() {
@@ -899,14 +1020,6 @@ export default {
           v.isCurrenct = false;
         });
         this.matchedList = res.data;
-        // this.urlMatchedList = res.data.image_number;
-        // this.productMatchedList = res.data.product_name;
-        // this.matchedList = res.data.list;
-        // res.data.list.forEach((v, index) => {
-        //   if (v.matching_status == 2) {
-        //     this.matchedList.push(v);
-        //   }
-        // });
       });
     },
     handleMatchedListInit() {
@@ -954,7 +1067,6 @@ export default {
           );
         }
       });
-      console.log(`this.matchedReopenList`, this.matchedReopenList);
       this.$forceUpdate();
     },
     handleHiddenMatchedDetail(row) {
@@ -975,7 +1087,7 @@ export default {
         this.matchedList.map((v) => (v.isCurrenct = false));
         row.isCurrenct = true;
       }
-      this.getMatchedDetailList1(row);
+      this.getMatchedDetailList(row);
     },
     handleShowCurrencyMatched(row) {
       if (row.isCurrenct) {
@@ -984,7 +1096,7 @@ export default {
         this.matchedList.map((v) => (v.isCurrenct = false));
         row.isCurrenct = true;
       }
-      this.getMatchedDetailList(row);
+      this.getMatchedDetailList1(row);
     },
     getSheetDetailList(row, type) {
       switch (type) {
@@ -1103,7 +1215,15 @@ export default {
           break;
       }
     },
-    getMatchedDetailList1(row) {
+    checkedDeepen(se) {
+      this.checkedDeepenList = se;
+    },
+    getMatchedDetailList(row) {
+      this.matched_detail.forEach((e) => {
+        if (e.total_price > 0) {
+          this.checkedDeepenList.push(e);
+        }
+      });
       row.isCurrenct &&
         this.axios
           .post("/api/contract_match_detail_deep_open", {
@@ -1111,14 +1231,25 @@ export default {
             state: 0,
             crt_time: row.crt_time,
             region: this.matchedInfo.region,
-            product_title: this.matchedList.product_title,
-            url_number: this.matchedList.url_number,
+            product_title: this.matchedInfo.product_title,
+            url_number: this.matchedInfo.url_number,
           })
           .then((res) => {
             res.data.data.forEach((item) => {
               this.$set(item, "total_price", 0);
             });
             this.matched_detail = res.data.data;
+            this.matched_detail.forEach((e) => {
+              this.checkedDeepenList.forEach((l) => {
+                if (e.id == l.id) {
+                  e._checked = true;
+                  e.total_price = l.total_price;
+                }
+              });
+            });
+            this.regionMatchedList = res.data.region_list; //区域
+            this.urlMatchedList = res.data.url_number_list; //图号
+            this.productList = res.data.product_title_list;
             this.$nextTick(function () {
               if (row.del_isSelect == true || row.isSelect == true) {
                 this.$refs.selection[0].selectAll(true);
@@ -1127,7 +1258,7 @@ export default {
           });
     },
 
-    getMatchedDetailList(row) {
+    getMatchedDetailList1(row) {
       row.isCurrenct &&
         this.axios
           .post("/api/contract_match_detail_deep_open", {
@@ -1135,8 +1266,8 @@ export default {
             state: 1,
             crt_time: row.crt_time,
             region: this.matchedInfo.region,
-            product_title: this.matchedList.product_title,
-            url_number: this.matchedList.url_number,
+            product_title: this.matchedInfo.product_title,
+            url_number: this.matchedInfo.url_number,
           })
           .then((res) => {
             this.matched_detail = res.data.data;
@@ -1193,9 +1324,6 @@ export default {
       );
       this.handleHandingMatchNumChange();
     },
-    confirm() {
-      console.log("确定");
-    },
     handleIsAllowHandingMatch() {
       //匹配按钮
       if (this.checkedContractList.length < 1) {
@@ -1211,10 +1339,6 @@ export default {
       let average = parseFloat(
         parseFloat(priceValue) / parseFloat(this.checkedDeepenList.length)
       ).toFixed(2);
-      //平均值
-
-      console.log(priceValue, "这是和", average, "这是右边的单个的平均值");
-      //this.matched_detail这个是所有的
       this.matched_detail.forEach((e) => {
         this.checkedDeepenList.forEach((l, index) => {
           if (e.id == l.id) {
@@ -1224,13 +1348,6 @@ export default {
           }
         });
       });
-      //  this.matched_detail.forEach((e) => {
-      //   this.checkedDeepenList.forEach((l, index) => {
-      //     if (e.id == l.id) {
-      //        this.$refs.selection[0].objData[index]._isChecked;
-      //     }
-      //   });
-      // });
     },
     matchiSngSave() {
       if (this.checkedContractList.length < 1) {
@@ -1240,12 +1357,6 @@ export default {
         return this.$Message.warning("请选择深化信息中的内容");
       }
       // 匹配保存
-      console.log(
-        this.checkedDeepenList,
-        "这是深化选的",
-        this.checkedContractList,
-        "这是合同选择的"
-      );
       let contractDetailId = [];
       this.checkedContractList.forEach((e) => {
         contractDetailId.push(e.id);
@@ -1263,10 +1374,6 @@ export default {
           }
         });
       });
-      console.log(children, "这是深化");
-      console.log(contractDetailId, "这是选中的合同信息id数组");
-      children.forEach((e) => {});
-      debugger;
       this.axios
         .post("/api/contract_match_save", {
           children: children,
@@ -1312,10 +1419,17 @@ export default {
     },
     handleMatchedSelectAll() {
       this.isMatchedSelectAll = !this.isMatchedSelectAll;
-      this.matchedList.map((v) => {
-        if (v.product_state == 0) {
-          v.isSelect = this.isMatchedSelectAll;
-          this.matchedSelectedList.push(v.id);
+      this.matchedSelectedList = [];
+      this.matchedTimeList = [];
+      this.matchedDetailList.forEach((e) => {
+        if (this.isMatchedSelectAll) {
+          e.del_isSelect = true;
+          e.isSelect = true;
+          this.matchedSelectedList.push(e.order_no);
+          this.matchedTimeList.push(e.crt_time);
+        } else {
+          e.del_isSelect = false;
+          e.isSelect = false;
         }
       });
     },
@@ -1334,51 +1448,6 @@ export default {
       });
       this.isMatchedSelectAll = flag;
     },
-    handleMatchedSet(row, index, type) {
-      if (this.revocationList.length == 0) {
-        return this.$Message.warning("请选择");
-      }
-      let revocationIdList = []
-      this.revocationList.forEach(e=>{
-        revocationIdList.push(e.id)
-      })
-      console.log(revocationIdList,"这是选中的id");
-      return
-      this.axios
-        .post("/api/contract_match_revoke", {
-          id: [row.id],
-          order_no: row.order_no,
-          time: [],
-        })
-        .then((res) => {
-          if (res.code == 200) {
-            this.handleMatchedListInit();
-          }
-        });
-      // switch (type) {
-      //   case 5:
-      //     if (index == -1) {
-      //       this.matchedSelectedList = [row.id];
-      //     } else {
-      //       this.matchedSelectedList = [];
-      //       this.matchedList.map((v) => {
-      //         v.isSelect && this.matchedSelectedList.push(v.id);
-      //       });
-      //     }
-      //     this.axios
-      //       .post("/api/bst_cancer_matching", {
-      //         cut_order_product_id: this.matchedSelectedList,
-      //       })
-      //       .then((res) => {
-      //         if (res.code == 200) {
-      //           this.$Message.success(res.msg);
-      //           this.handleMatchedListInit();
-      //           this.isMatchedSelectAll = false;
-      //         }
-      //       });
-      //     break;
-      // }
-    },
   },
   // 监听属性 类似于data概念
   computed: {},