From 2e4a6c4526b6c22808d5877f2050da852bfaebe7 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期二, 30 十二月 2025 14:31:47 +0800
Subject: [PATCH] 外购成品检验功能迁移v1

---
 src/views/business/materialOrder/customsInspectionOrder.vue |  182 ++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 170 insertions(+), 12 deletions(-)

diff --git a/src/views/business/materialOrder/customsInspectionOrder.vue b/src/views/business/materialOrder/customsInspectionOrder.vue
index 099ef87..c31a242 100644
--- a/src/views/business/materialOrder/customsInspectionOrder.vue
+++ b/src/views/business/materialOrder/customsInspectionOrder.vue
@@ -1,6 +1,6 @@
 <template>
   <div class="app-container">
-    <div>
+    <div v-show="!cableConfigShow&&!auxiliaryShow">
       <div class="header">
         <div>
           <span>閲囪喘璁㈠崟淇℃伅</span>
@@ -24,6 +24,8 @@
           <el-button v-show="active==1" size="small" @click="templateDia=true">
             <span style="color: #3A7BFA;">淇濆瓨妯℃澘</span>
           </el-button>
+          <el-button v-if="active==1&&addObj.sample!=undefined&&(addObj.sample.indexOf('鐢电紗')>-1 ||addObj.sample.indexOf('缁煎悎')>-1)" size="small" type="primary" @click="openCableConfig">鐢电紗閰嶇疆</el-button>
+          <el-button v-if="active==1&&addObj.sample!=undefined&&addObj.sample.indexOf('鐢电紗')>-1" size="small" type="primary" @click="openAuxiliaryCore">杈呭姪绾胯姱閰嶇疆</el-button>
           <el-button v-show="active==1 && addObj.orderType === '杩涘巶妫�楠�'" :loading="noNeedCheckLoad" size="small" type="primary" @click="noNeedCheck">鍏嶆</el-button>
           <el-button v-show="active==1" :loading="saveLoad" size="small" type="primary" @click="save">鎻愪氦</el-button>
           <el-button size="small" @click="goBack">
@@ -32,7 +34,7 @@
         </div>
       </div>
     </div>
-    <div class="search">
+    <div class="search"  v-show="!cableConfigShow&&!auxiliaryShow">
       <el-form ref="addObj" :inline="true" :model="addObj" :rules="addObjRules" label-width="90px">
         <el-row>
           <el-col :span="6">
@@ -145,7 +147,7 @@
         </el-row>
       </el-form>
     </div>
-    <div>
+    <div  v-show="!cableConfigShow&&!auxiliaryShow">
       <div style="display: flex;justify-content: space-between;background-color: #F5F7FB;margin-bottom: 6px">
         <div v-if="active==1">
           <el-form :inline="true" :model="addObj1" label-width="90px">
@@ -169,7 +171,7 @@
           </el-form>
         </div>
         <div style="margin-bottom: 6px;margin-top: 6px">
-          <el-button v-show="active==1" :disabled="sampleList.length === 2" size="small" type="primary" @click="handleSplitCountNum">鎷嗗垎</el-button>
+          <el-button v-show="active==1" :disabled="sampleList.length === 3" size="small" type="primary" @click="handleSplitCountNum">鎷嗗垎</el-button>
         </div>
       </div>
 
@@ -433,6 +435,10 @@
         <el-button :loading="noNeedCheckLoad" type="primary" @click="handleNoNeedCheck">纭� 瀹�</el-button>
       </span>
     </el-dialog>
+    <!--鐢电紗閰嶇疆-->
+    <cableConfig v-if="cableConfigShow" ref="cableConfigShow" :active="active" :isSpecial="isSpecial" :sampleSelectionList="sampleSelectionList" @goBackAdd="goBackAdd"/>
+    <!--杈呭姪绾胯姱閰嶇疆-->
+    <auxiliary-wire-core v-if="auxiliaryShow" :active="active" :isSpecial="isSpecial" :sampleSelectionList="sampleSelectionList" @goBackAdd2="goBackAdd2"></auxiliary-wire-core>
   </div>
 </template>
 
@@ -451,15 +457,24 @@
   selectStandardProductList,
   selectStandardTreeListByPartNo
 } from "@/api/business/rawMaterialOrder";
+import {dateFormat} from "@/utils/date";
+import {bigEval} from "@/utils/bigEval";
+import AuxiliaryWireCore from "../productOrder/components/auxiliaryWireCore.vue";
+import cableConfig from "../productOrder/components/cable-config.vue";
 
 export default {
   name: "CustomsInspectionOrder",
   dicts: ['check_type', 'urgency_level'],
-  components: {},
+  components: {cableConfig, AuxiliaryWireCore},
   props: {
   },
   data() {
     return {
+      cableConfigShow: false,
+      auxiliaryShow: false,
+      isSpecial: false,
+      sampleSelectionList: [],//鏍峰搧琛ㄦ牸閫変腑鏁版嵁
+      isOutsourcing: 'f',//鏄惁澶栬喘鎴愬搧
       customsInspection: {},
       orderType: '',
       active: 0,
@@ -614,6 +629,17 @@
     //   this.addObj.method = null
     //   this.productList = []
     // },
+    isOutsourcing:{
+      deep:  true,
+      handler(newVal){
+        if(newVal && newVal==='t'){
+          this.addObj.appointed = dateFormat(new Date(),'yyyy-MM-dd')
+          this.addObj.testQuantity = this.customsInspection.qtyArrived
+          this.addObj.orderType = '杩涘巶妫�楠�'
+          this.addObj.typeSource = 0
+        }
+      }
+    },
     productList: {
       deep: true,
       handler(val) {
@@ -643,6 +669,7 @@
   created() {
     this.active = this.$route.query.active
     this.orderType = this.$route.query.orderType
+    this.isOutsourcing = this.$route.query.isOutsourcing
     this.currentId = this.$route.query.currentId
     this.isReport = this.$route.query.isReport
     this.customsInspection = this.$route.query.customsInspection
@@ -651,6 +678,7 @@
   activated() {
     this.active = this.$route.query.active
     this.orderType = this.$route.query.orderType
+    this.isOutsourcing = this.$route.query.isOutsourcing
     this.currentId = this.$route.query.currentId
     this.isReport = this.$route.query.isReport
     this.customsInspection = this.$route.query.customsInspection
@@ -660,6 +688,82 @@
   //   this.getInfo() // 鑾峰彇鏁版嵁
   // },
   methods: {
+    goBackAdd () {
+      this.cableConfigShow = false
+    },
+    goBackAdd2 () {
+      this.auxiliaryShow = false
+    },
+    // 缂栬緫瑕佹眰鍊艰〃鏍�
+    editSpecial () {
+      this.isSpecial = true
+      this.$nextTick(() => {
+        this.$refs.productTable.doLayout();
+      });
+    },
+    areObjectsValuesEqual (objects, property) {
+      if (!objects || objects.length === 0) return false;
+      const firstValue = objects[0][property];
+      return objects.every(obj => obj[property] === firstValue);
+    },
+    // 杈呭姪绾胯姱閰嶇疆
+    openAuxiliaryCore () {
+      if (this.active == 1) {
+        if (this.sampleIds.length === 0) {
+          this.$message.error("鏈�夋嫨鏍峰搧")
+        } else if (this.sampleIds.length === 1) {
+          if (!this.sampleSelectionList[0].standardMethodListId) {
+            this.$message.error("鏍峰搧鏈�夋嫨妫�楠屾爣鍑�")
+            return
+          }
+          this.auxiliaryShow = true
+        } else {
+          // 鍚屾椂閰嶇疆澶氫釜鏍峰搧鐨勭數缂嗛厤缃椂蹇呴』閫夋嫨鐩稿悓鐨勬楠屾爣鍑�
+          if (!this.sampleSelectionList.every(value => value.standardMethodListId)) {
+            this.$message.error("鏍峰搧鏈�夋嫨妫�楠屾爣鍑�")
+          } else {
+            if (!this.areObjectsValuesEqual(this.sampleSelectionList, 'standardMethodListId')) {
+              this.$message.error("璇烽�夋嫨鐩稿悓鐨勬楠屾爣鍑�")
+              return
+            }
+            this.auxiliaryShow = true
+          }
+        }
+      } else {
+        if (this.sampleId === null) {
+          this.$message.error('鏈�変腑鏍峰搧')
+        }
+      }
+    },
+    //鎵撳紑鐢电紗閰嶇疆寮规
+    openCableConfig() {
+      if (this.active == 1) {
+        if (this.sampleIds.length === 0) {
+          this.$message.error("鏈�夋嫨鏍峰搧")
+        } else if (this.sampleIds.length === 1) {
+          if (!this.sampleSelectionList[0].standardMethodListId) {
+            this.$message.error("鏍峰搧鏈�夋嫨妫�楠屾爣鍑�")
+            return
+          }
+          this.cableConfigShow = true
+        } else {
+          // 鍚屾椂閰嶇疆澶氫釜鏍峰搧鐨勭數缂嗛厤缃椂蹇呴』閫夋嫨鐩稿悓鐨勬楠屾爣鍑�
+          if (!this.sampleSelectionList.every(value => value.standardMethodListId)) {
+            this.$message.error("鏍峰搧鏈�夋嫨妫�楠屾爣鍑�")
+          } else {
+            if (!this.areObjectsValuesEqual(this.sampleSelectionList, 'standardMethodListId')) {
+              this.$message.error("璇烽�夋嫨鐩稿悓鐨勬楠屾爣鍑�")
+              return
+            }
+            this.cableConfigShow = true
+          }
+        }
+      } else {
+        if (this.sampleId === null) {
+          this.$message.error('鏈�変腑鏍峰搧')
+        }
+      }
+    },
     save1 () {
       if (this.bsm1DiaList.length > 0) {
         this.bsm1DiaList.forEach(item => {
@@ -771,6 +875,9 @@
             this.$set(this.addObj, 'receiverDate', this.customsInspection.receiverDate)
             this.$set(this.addObj, 'orderNo', this.customsInspection.orderNo)
             this.$set(this.addObj, 'declareUser', this.customsInspection.declareUser)
+            if(this.isOutsourcing==='f'){
+              this.$set(this.addObj, 'testQuantity', this.customsInspection.testQuantity)
+            }
             this.$set(this.addObj, 'testQuantity', this.customsInspection.testQuantity)
             this.$set(this.addObj, 'buyUnitMeas', this.customsInspection.buyUnitMeas)
             this.$set(this.addObj, 'updateBatchNo', this.customsInspection.updateBatchNo)
@@ -1094,6 +1201,37 @@
         this.saveLoad = false
       })
     },
+    /**
+     * 鑾峰彇灏忔暟鐨勬渶澶т綅鏁�
+     * @param number  鍨嬪彿鍙傛暟
+     * @param ask     瑕佹眰鍊�
+     * @param calcNum 璁$畻鍊�
+     */
+    getDecimalPlaces(number, ask, calcNum) {
+      console.log("璁$畻灏忔暟鐐�-->", number, ask, calcNum);
+      let count1 = 0;
+      let count2 = 0;
+      const reg = /(\d+\.)(\d+)/g;
+      let matches = [];
+      if (ask) {
+        matches = ask.match(reg);
+      }
+      if (
+        matches &&
+        matches.length > 0 &&
+        matches[0].toString().indexOf(".") > -1
+      ) {
+        count1 = matches[0].toString().split(".")[1].length;
+      }
+      if (number.toString().indexOf(".") > -1) {
+        count2 = number.toString().split(".")[1].length;
+      }
+      if (calcNum.toString().indexOf(".") > -1) {
+        const pointLength2 = calcNum.toString().split(".")[1].length;
+        count2 = count2 > pointLength2 ? count2 : pointLength2;
+      }
+      return count1 > count2 ? count1 : count2;
+    },
     handleAsk(ask,symbolItem, value) {
       try{
         let code = [">", "<", "=", "锛�", "锛�", "鈮�", "鈮�", "卤", "*", "/"];
@@ -1106,7 +1244,13 @@
             let index = code.findIndex(b => m.includes(b))
             if (index > -1) {
               let arr = m.split(code[index]).filter(b => !!b)
-              let num = eval(this.replaceAll(arr[0], symbolItem, value))
+              let calcNum = this.$Big(
+                bigEval(this.replaceAll(arr[0], symbolItem, value))
+              );
+              let num = calcNum.toFixed(
+                this.getDecimalPlaces(value, ask, calcNum)
+              );
+              // let num = eval(this.replaceAll(arr[0], symbolItem, value))
               m = code[index] + '' + num
               arr1.push(m)
             }
@@ -1135,7 +1279,13 @@
           let index = code.findIndex(b => ask.includes(b))
           if (index > -1) {
             let arr = ask.split(code[index]).filter(b => !!b)
-            let num = eval(this.replaceAll(arr[0], symbolItem, value))
+            let calcNum = this.$Big(
+              bigEval(this.replaceAll(arr[0], symbolItem, value))
+            );
+            let num = calcNum.toFixed(
+              this.getDecimalPlaces(value, ask, calcNum)
+            );
+            // let num = eval(this.replaceAll(arr[0], symbolItem, value))
             return code[index] + '' + num
           }
         }
@@ -1442,6 +1592,9 @@
       })
     },
     getProNum() {
+      this.sampleSelectionList.forEach((m, i) => {
+        this.$set(this.sampleSelectionList[i], 'proNum', m.insProduct.filter(a => a.state == 1).length)
+      })
       this.$refs.sampleTable.doLayout()
     },
     methodFocus() {
@@ -1455,10 +1608,10 @@
       }).then(res => {
         this.methodLoad = false
         try {
-          if (res.data.standardMethodList.length == 0 && this.selectTree.split('-').length == 5) {
-            let arr = this.selectTree.split('-')
+          if (res.data.standardMethodList.length == 0 && this.selectTree.split(' - ').length == 5) {
+            let arr = this.selectTree.split(' - ')
             let arr0 = arr.slice(0, arr.length - 1)
-            let selectTree = arr0.join('-').substring(0, arr0.join('-').length - 1)
+            let selectTree = arr0.join(' - ').substring(0, arr0.join(' - ').length - 1)
             selectsStandardMethodByFLSSM({
               tree: selectTree
             }).then(ress => {
@@ -1511,6 +1664,7 @@
       val.forEach(a => {
         this.sampleIds.push(a.id)
       })
+      this.sampleSelectionList = val
     },
     // 閫変腑琛ㄦ牸琛岀殑鍥炶皟
     rowClick(row, column, event) {
@@ -1524,7 +1678,11 @@
       this.sampleId = row.id
       if (this.active !== 1) {
         this.sampleIds = []
-        this.sampleIds.push(row.id)
+        this.sampleSelectionList.forEach(ele=>{
+          if(ele.id == row.id){
+            this.sampleIds.push(row.id)
+          }
+        })
       }
       // this.productList = row.insProduct
       if (this.productList !== null) {
@@ -1650,7 +1808,7 @@
         })
       }
       this.productList = []
-      let num = this.selectTreeTem.split('-').length;
+      let num = this.selectTreeTem.split(' - ').length;
       if (num != 5) {
         this.selectTree = this.selectTreeTem + ' - ' + e
       } else {

--
Gitblit v1.9.3