From 2bd9b32aa6378ff6a841780628b844a42dbd8f01 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期五, 31 十月 2025 16:39:29 +0800
Subject: [PATCH] 下载采集器功能

---
 src/views/business/materialOrder/customsInspectionOrder.vue |  169 ++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 146 insertions(+), 23 deletions(-)

diff --git a/src/views/business/materialOrder/customsInspectionOrder.vue b/src/views/business/materialOrder/customsInspectionOrder.vue
index 35d165b..949c6b5 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>
@@ -12,14 +12,20 @@
           <el-select v-show="active==1" v-model="template" placeholder="涓嬪崟妯℃澘" size="small" style="margin-right: 10px;"
                      @change="selectInsOrderTemplateByIdList">
             <el-option v-for="(a, ai) in templates" :key="ai" :label="a.name" :value="a.id">
-              <span style="float: left">{{ a.name }}</span>
-              <i class="el-icon-delete" style="float: right; color: #66b1ff; font-size: 16px"
-                 @click.stop="handleDelete(a)"></i>
+              <div style="display: flex; align-items: center; justify-content: space-between;">
+                <span>{{ a.name }}</span>
+                <i class="el-icon-delete"
+                   style="color: #66b1ff; font-size: 16px; cursor: pointer;"
+                   @click.stop="handleDelete(a)">
+                </i>
+              </div>
             </el-option>
           </el-select>
           <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">
@@ -28,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">
@@ -141,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">
@@ -165,7 +171,8 @@
           </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" size="small" type="primary" @click="handleSplitCountNum">鎷嗗垎</el-button>
+          <el-button v-show="active==1" :disabled="sampleList.length<=1" size="small" type="danger" @click="handleDeleteSplitCountNum">鍒犻櫎鎷嗗垎</el-button>
         </div>
       </div>
 
@@ -321,7 +328,7 @@
         <el-table-column :filter-method="filterHandler" :filters="filters" label="瀛愬疄楠屽" min-width="130" prop="sonLaboratory"
                          show-overflow-tooltip></el-table-column>
       </el-table>
-    </div>
+    </div >
     <!--鐗规畩鍊煎鐞嗘-->
     <el-dialog :before-close="beforeClose" :close-on-click-modal="false" :close-on-press-escape="false" :show-close="false"
                :visible.sync="bsm1DiaAll"
@@ -429,6 +436,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>
 
@@ -440,22 +451,30 @@
   delRawMaterOrderTemplate,
   getInsOrder,
   getUserNow,
-  notificationRawOrder, selectRawMaterOrderTemplate,
+  notificationRawOrder,
+  selectRawMaterOrderTemplate,
   selectRawMaterOrderTemplateById,
   selectsStandardMethodByFLSSM,
   selectStandardMethodEnum,
   selectStandardProductList,
   selectStandardTreeListByPartNo
 } from "@/api/business/rawMaterialOrder";
-
+import {dateFormat} from "@/utils/date";
+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,
@@ -479,8 +498,8 @@
         sample: null, // 鏍峰搧鍚嶇О
         qtyArrived: '', // 鏍峰搧鎬绘暟
         testQuantity: '', // 鎶芥鏁伴噺
-        company: '涓ぉ绉戞妧瑁呭鐢电紗鏈夐檺鍏徃', // 濮旀墭鍗曚綅
-        companyId: '1233268751', // 濮旀墭鍗曚綅id
+        company: '涓ぉ鑰愪笣鏈夐檺鍏徃', // 濮旀墭鍗曚綅
+        companyId: '1233268761', // 濮旀墭鍗曚綅id
         receiverDate: '', // 鎺ユ敹鏃堕棿
         appointed: '', // 绾﹀畾鏃堕棿
         buyUnitMeas: '', // 鍗曚綅
@@ -610,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) {
@@ -639,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
@@ -647,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
@@ -656,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 => {
@@ -743,7 +851,7 @@
             })
           }
         })
-      } else {
+      } else{
         notificationRawOrder({ifsInventoryId:this.customsInspection.id}).then(res => {
           if (res.code === 200) {
             if (res.data === 1) {
@@ -767,16 +875,17 @@
             this.$set(this.addObj, 'receiverDate', this.customsInspection.receiverDate)
             this.$set(this.addObj, 'orderNo', this.customsInspection.orderNo)
             this.$set(this.addObj, 'declareUser', this.customsInspection.declareUser)
-            this.$set(this.addObj, 'testQuantity', this.customsInspection.testQuantity)
+            if(this.isOutsourcing==='f'){
+              this.$set(this.addObj, 'testQuantity', this.customsInspection.testQuantity)
+            }
             this.$set(this.addObj, 'buyUnitMeas', this.customsInspection.buyUnitMeas)
             this.$set(this.addObj, 'updateBatchNo', this.customsInspection.updateBatchNo)
             this.$set(this.addObj, 'partDetail', this.customsInspection.partDesc)
             if (this.orderType == 1) {
               this.$set(this.addObj, 'orderType', 'Quarterly inspection')
             }
-            const str = res.data.treeName.split('-')
-            this.selectTreeTem = str.join(' - ')
-            this.selectTree = str.join(' - ')
+            this.selectTreeTem = res.data.treeName
+            this.selectTree = res.data.treeName
             this.addListInfo(this.codeLevel, res.data) // 鍘熸潗鏂欐牱鍝佹槸鍥哄畾鐨勶紝灏遍粯璁よ祴鍊间竴鏉℃暟鎹紝鍙媶鍒�
             this.selectInsOrderTemplate() // 鍘熸潗鏂欐ā鏉垮垪琛ㄦ煡璇�
           } else {
@@ -845,6 +954,12 @@
       selectRawMaterOrderTemplate({partNo:this.addObj.partNo}).then(res => {
         this.templates = res.data
       })
+    },
+    //鍒犻櫎鎷嗗垎琛�
+    handleDeleteSplitCountNum(){
+      this.count--;
+      this.sampleList.pop()
+      this.computationalPairing(this.sampleList.length)
     },
     // 鎷嗗垎
     handleSplitCountNum () {
@@ -1439,6 +1554,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() {
@@ -1452,10 +1570,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 => {
@@ -1508,6 +1626,7 @@
       val.forEach(a => {
         this.sampleIds.push(a.id)
       })
+      this.sampleSelectionList = val
     },
     // 閫変腑琛ㄦ牸琛岀殑鍥炶皟
     rowClick(row, column, event) {
@@ -1521,7 +1640,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) {
@@ -1647,7 +1770,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