From c4cc315e6b46adabc9f649c7b14e6c2b0bcc3346 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期四, 10 四月 2025 14:00:42 +0800
Subject: [PATCH] 修改检验任务

---
 src/views/business/productOrder/components/add.vue |  150 ++++++++++++++++++++++++++++++++++---------------
 1 files changed, 103 insertions(+), 47 deletions(-)

diff --git a/src/views/business/productOrder/components/add.vue b/src/views/business/productOrder/components/add.vue
index d8edd51..55d3413 100644
--- a/src/views/business/productOrder/components/add.vue
+++ b/src/views/business/productOrder/components/add.vue
@@ -20,10 +20,10 @@
           <el-button
             v-if="active == 1 && addObj.sampleType != undefined && (addObj.sampleType.indexOf('鐢电紗') > -1 || addObj.sampleType.indexOf('缁煎悎') > -1)"
             size="small" type="primary" @click="openCableConfig">鐢电紗閰嶇疆</el-button>
-          <el-button v-if="active == 1 && addObj.sampleType != undefined && addObj.sampleType.indexOf('鐢电紗') > -1" size="small"
-            type="primary" @click="openAuxiliaryCore">杈呭姪绾胯姱閰嶇疆</el-button>
-          <el-button v-show="active == 1 || (tabIndex == 4 && active == 2)" :loading="saveLoad" size="small" type="primary"
-            @click="save">鎻愪氦</el-button>
+          <el-button v-if="active == 1 && addObj.sampleType != undefined && addObj.sampleType.indexOf('鐢电紗') > -1"
+            size="small" type="primary" @click="openAuxiliaryCore">杈呭姪绾胯姱閰嶇疆</el-button>
+          <el-button v-show="active == 1 || (tabIndex == 4 && active == 2)" :loading="saveLoad" size="small"
+            type="primary" @click="save">鎻愪氦</el-button>
           <!-- 瀹℃牳 -->
           <el-button v-show="active == 3" :disabled="saveLoad" :loading="saveLoad" size="small"
             @click="upInsOrderOfState(2)">涓嶉�氳繃</el-button>
@@ -144,14 +144,14 @@
             </el-col>
             <el-col :span="6">
               <el-form-item label="鐢熶骇鍗曚綅:" prop="production">
-                <el-input v-model="addObj.production" :disabled="active > 1 && tabIndex != 4" clearable placeholder="璇疯緭鍏�"
-                  size="small"></el-input>
+                <el-input v-model="addObj.production" :disabled="active > 1 && tabIndex != 4" clearable
+                  placeholder="璇疯緭鍏�" size="small"></el-input>
               </el-form-item>
             </el-col>
             <el-col :span="6">
               <el-form-item label="鐢熶骇鍗曚綅EN:" prop="productionEn">
-                <el-input v-model="addObj.productionEn" :disabled="active > 1 && tabIndex != 4" clearable placeholder="璇疯緭鍏�"
-                  size="small"></el-input>
+                <el-input v-model="addObj.productionEn" :disabled="active > 1 && tabIndex != 4" clearable
+                  placeholder="璇疯緭鍏�" size="small"></el-input>
               </el-form-item>
             </el-col>
             <el-col :span="6">
@@ -226,7 +226,7 @@
               </el-form-item>
               <el-form-item label="妫�楠屾爣鍑�:" style="margin-bottom: 6px;margin-top: 6px">
                 <el-select v-model="standardMethodListId" :loading="methodLoad" :placeholder="active > 1 ? '' : '璇疯緭鍏�'"
-                  clearable size="small" @change="changeStandardMethodListId" @focus="methodFocus">
+                  clearable size="small" @change="changeStandardMethodListId" @focus="methodFocus" multiple>
                   <el-option v-for="item in methods" :key="item.id" :label="item.code" :value="item.id">
                   </el-option>
                 </el-select>
@@ -287,7 +287,7 @@
               <el-select v-model="scope.row.standardMethodListId" :disabled="scope.row.model == null || active > 1"
                 :loading="methodLoad" :readonly="active > 1" clearable placeholder="妫�楠屾爣鍑�" size="small"
                 style="width: 100%;" @change="(value) => methodChange(value, scope.row)" @clear="productList = []"
-                @focus="methodFocus">
+                @focus="methodFocus" multiple>
                 <el-option v-for="item in methods" :key="item.id" :label="item.code" :value="item.id">
                 </el-option>
               </el-select>
@@ -352,10 +352,10 @@
               </span>
             </template>
           </el-table-column>
-          <el-table-column label="鏉′欢" min-width="140" prop="radius" show-overflow-tooltip>
+          <el-table-column label="璇曢獙鏉′欢" min-width="140" prop="radius" show-overflow-tooltip>
             <template slot-scope="scope">
               <el-input v-if="(active == 1 || tabIndex == 4) && (isAskOnlyRead || isSpecial)" v-model="scope.row.radius"
-                :autosize="{ minRows: 1, maxRows: 3 }" clearable placeholder="鏉′欢" size="small" type="textarea"
+                :autosize="{ minRows: 1, maxRows: 3 }" clearable placeholder="璇曢獙鏉′欢" size="small" type="textarea"
                 @change="e => requestChange(e, scope.row, 'radius')">
               </el-input>
               <span v-else>{{ scope.row.radius }}</span>
@@ -365,7 +365,8 @@
             <template slot="header" slot-scope="scope">
               <div style="display: flex;align-items: center;flex-direction: column;font-size: 14px">
                 <span>璇曢獙鏂规硶</span>
-                <el-input v-if="active == 1" v-model="methodS" placeholder="璇疯緭鍏�" size="mini" @input="searchFilterList" />
+                <el-input v-if="active == 1" v-model="methodS" placeholder="璇疯緭鍏�" size="mini"
+                  @input="searchFilterList" />
               </div>
             </template>
           </el-table-column>
@@ -522,8 +523,8 @@
             <div class="search_label" style="width: 80px;">瑕佹眰鍊硷細</div>
             <div class="search_input">
               <el-radio-group v-model="item.bsm1Val" v-removeAriaHidden @input="upBsmAll(item)">
-                <el-radio v-for="(a, ai) in JSON.parse(item.bsmRow.sectionCopy)" :key="ai"
-                  :label="a">{{ JSON.parse(item.bsmRow.askCopy)[ai] }}</el-radio>
+                <el-radio v-for="(a, ai) in JSON.parse(item.bsmRow.sectionCopy)" :key="ai" :label="a">{{
+                  JSON.parse(item.bsmRow.askCopy)[ai] }}</el-radio>
               </el-radio-group>
             </div>
           </el-col>
@@ -765,7 +766,7 @@
       totalArr: [],
       addObj1: {},
       model: null,
-      standardMethodListId: null,
+      standardMethodListId: [],
       symbolList: ['RTS'],
       inspectionItem: null,
       inspectionItemSubclass: null,
@@ -776,7 +777,7 @@
       temId: '',
       sonLaboratoryList: [],
       selectiveEcho: [], // 妫�楠屼笅鍗曠殑鏃跺�欏嬀閫夋楠岄」鐩�,濡傛灉浣跨敤绛涢�夋彁浜ゆ樉绀烘楠岄」鐩负绌� 鍥炴樉鍒楄〃
-      quarterItemOptions: [], // 鏌ヨ瀛e害淇℃伅
+      quarterItemOptions: [], // 鏌ヨ鍙潬鎬т俊鎭�
       specialStandardMethod: '',
       isSpecial: false,
     }
@@ -811,11 +812,11 @@
     },
     'addObj.sample'(val) {
       this.model = null
-      this.standardMethodListId = null
+      this.standardMethodListId = []
     },
     'addObj.sampleNum'(val) {
       this.model = null
-      this.standardMethodListId = null
+      this.standardMethodListId = []
     },
     tabIndex(val) {
       if (val == 4 && this.active == 2) {
@@ -855,6 +856,11 @@
           };
           this.addObj.type = String(this.addObj.type)
           this.sampleList = this.HaveJson(res.data.sampleProduct);
+          this.sampleList.forEach(m => {
+            if (m.standardMethodListId) {
+              m.standardMethodListId = JSON.parse(m.standardMethodListId)
+            }
+          })
           this.specialStandardMethod = this.sampleList[0].specialStandardMethod
           this.getProNum()
           this.addObj.sampleNum = this.sampleList.length
@@ -1078,9 +1084,18 @@
     save() {
       this.$refs['addObj'].validate((valid) => {
         if (valid) {
+          // 閫夋嫨澶氫釜鏍囧噯
+          let isHaveStandardMethodListId = false
           this.sampleList.forEach(item => {
+            // 璧嬪�肩壒娈婃爣鍑�
             item.specialStandardMethod = this.specialStandardMethod
+            if (!item.standardMethodListId || item.standardMethodListId.length == 0) {
+              isHaveStandardMethodListId = true
+            }
           })
+          if (isHaveStandardMethodListId) {
+            return this.$message.error('璇烽�夋嫨鏍囧噯')
+          }
           try {
             this.sampleList.forEach(item => {
               if (item.insulating) {
@@ -1105,6 +1120,32 @@
             if (e === true) throw e
           }
           let sampleList = this.HaveJson(this.sampleList)
+          // 澶氶�夋楠屾爣鍑嗘椂锛屾楠岄」涓嶈兘閲嶅閫夋嫨
+          for (let i = 0; i < sampleList.length; i++) {
+            if (sampleList[i].insProduct.length > 0) {
+              let set = new Set();
+              for (let j = 0; j < sampleList[i].insProduct.length; j++) {
+                if (sampleList[i].insProduct[j].state == 1) {
+                  let num0 = set.size;
+                  set.add(
+                    sampleList[i].insProduct[j].inspectionItem +
+                    "-" +
+                    sampleList[i].insProduct[j].inspectionItemSubclass
+                  );
+                  let num1 = set.size;
+                  if (num0 == num1) {
+                    this.$message.error(
+                      sampleList[i].insProduct[j].inspectionItem +
+                      "-" +
+                      sampleList[i].insProduct[j].inspectionItemSubclass +
+                      "閲嶅"
+                    );
+                    return;
+                  }
+                }
+              }
+            }
+          }
           sampleList.forEach(a => {
             if (a.insProduct.length > 0) {
               a.insProduct.forEach(c => {
@@ -1268,6 +1309,9 @@
         })
       } else {
         // 甯歌鎻愪氦
+        sampleList.forEach(m => {
+          m.standardMethodListId = JSON.stringify(m.standardMethodListId)
+        })
         addInsOrder({ insOrder: this.addObj, sampleList: sampleList }).then(res => {
           this.saveLoad = false
           this.$message.success('宸叉彁浜�')
@@ -1376,7 +1420,7 @@
     handleNodeClick(val, node, el) {
       this.selectTree = ''
       this.models = val.children
-      this.selectTree = getReversedTreePath(node)
+      this.selectTree = this.getReversedTreePath(node)
     },
     /**
    * 鑾峰彇鍙嶅悜鎷兼帴鐨勬爲璺緞瀛楃涓�
@@ -1417,21 +1461,31 @@
     },
     activeStandardTree() {
       let trees = this.selectTree.split(" - ")
-      if (trees.length < 3) {
+      if (trees.length < 4) {
         this.$message.error('鏈�夋嫨瀵硅薄')
         return
       }
       this.addObj.factory = trees[0]
       this.addObj.laboratory = trees[1]
-      this.addObj.sampleType = trees[2]
-      if (trees[3] === undefined || trees[3] === '' || trees[3] === '- ') {
-        this.addObj.sample = trees[2]
+      if (trees[2] == '鍖呮潗' || trees[2] == '鍘熻緟鏉�') {
+        this.addObj.sampleType = trees[4]
+        if (trees[5] === undefined || trees[5] === '' || trees[5] === '- ') {
+          this.addObj.sample = trees[4]
+        } else {
+          this.addObj.sample = trees[5]
+        }
+        this.addObj.model = (trees[6] == undefined ? null : trees[6])
       } else {
-        this.addObj.sample = trees[3]
+        this.addObj.sampleType = trees[3]
+        if (trees[4] === undefined || trees[4] === '' || trees[4] === '- ') {
+          this.addObj.sample = trees[3]
+        } else {
+          this.addObj.sample = trees[4]
+        }
+        this.addObj.model = (trees[5] == undefined ? null : trees[5])
       }
       this.addObj.sampleView = this.addObj.sample
       this.addObj.sampleViewEn = this.sampleViewEn
-      this.addObj.model = (trees[4] == undefined ? null : trees[4])
       this.selectStandardTree = false
       this.sampleList = []
       for (var i = 0; i < this.addObj.sampleNum; i++) {
@@ -1441,7 +1495,7 @@
         this.sample.sample = this.addObj.sample
         this.sample.model = this.addObj.model
         this.sample.unit = this.addObj.unit
-        this.sample.standardMethodListId = null
+        this.sample.standardMethodListId = []
         this.sample.insProduct = []
         this.sample.id = this.count
         this.sample.childSampleList = []
@@ -1486,7 +1540,7 @@
         this.sample.sample = this.addObj.sample
         this.sample.model = this.addObj.model
         this.sample.unit = this.addObj.unit
-        this.sample.standardMethodListId = null
+        this.sample.standardMethodListId = []
         this.sample.insProduct = []
         this.sample.id = parseInt(i + 1)
         this.sample.childSampleList = []
@@ -1511,12 +1565,12 @@
     },
     rowClick(row, column, event) {
       this.currentMethod = row
-      let obj = this.methods.find(a => a.id == this.currentMethod.standardMethodListId)
-      if (obj && obj.code == '鎶�鏈姹�') {
-        this.isAskOnlyRead = true
-      } else {
-        this.isAskOnlyRead = false
-      }
+      // let obj = this.methods.find(a => a.id == this.currentMethod.standardMethodListId)
+      // if (obj && obj.code == '鎶�鏈姹�') {
+      //   this.isAskOnlyRead = true
+      // } else {
+      //   this.isAskOnlyRead = false
+      // }
       this.sampleId = row.id
       if (this.active !== 1) {
         this.sampleIds = []
@@ -1710,7 +1764,8 @@
       selectStandardProductList({
         model: this.addObj.model ? this.addObj.model : row.model,
         modelNum: row.modelNum,
-        standardMethodListId: val,
+        standardMethodListIds: val,
+        state: 1,
         factory: selectTreeList.join(" - "),
         cores: row.cores,
         conductorMaterial: row.conductorMaterial,
@@ -1760,21 +1815,22 @@
           }
         }
       }
-      if (val === null || val === '') return
+      if (!val || val.length == 0) return
       this.currentMethod = row
-      let obj = this.methods.find(a => a.id == this.currentMethod.standardMethodListId)
-      if (obj && obj.code == '鎶�鏈姹�') {
-        this.isAskOnlyRead = true
-      } else {
-        this.isAskOnlyRead = false
-      }
+      // let obj = this.methods.find(a => a.id == this.currentMethod.standardMethodListId)
+      // if (obj && obj.code == '鎶�鏈姹�') {
+      //   this.isAskOnlyRead = true
+      // } else {
+      //   this.isAskOnlyRead = false
+      // }
       this.getProductLoad = true
       let selectTreeList = this.selectTree.split(" - ")
       this.addObj.model && (selectTreeList[selectTreeList.length - 1] = this.addObj.model)
       selectStandardProductList({
         model: this.addObj.model ? this.addObj.model : row.model,
         modelNum: row.modelNum,
-        standardMethodListId: val,
+        standardMethodListIds: val,
+        state: 1,
         cores: row.cores,
         factory: selectTreeList.join(" - "),
       }).then(res => {
@@ -1974,14 +2030,14 @@
         if (this.sampleIds.length === 0) {
           this.$message.error("鏈�夋嫨鏍峰搧")
         } else if (this.sampleIds.length === 1) {
-          if (!this.sampleSelectionList[0].standardMethodListId) {
+          if (!this.sampleSelectionList[0].standardMethodListId || this.sampleSelectionList[0].standardMethodListId.length == 0) {
             this.$message.error("鏍峰搧鏈�夋嫨妫�楠屾爣鍑�")
             return
           }
           this.auxiliaryShow = true
         } else {
           // 鍚屾椂閰嶇疆澶氫釜鏍峰搧鐨勭數缂嗛厤缃椂蹇呴』閫夋嫨鐩稿悓鐨勬楠屾爣鍑�
-          if (!this.sampleSelectionList.every(value => value.standardMethodListId)) {
+          if (!this.sampleSelectionList.every(value => value.standardMethodListId && value.standardMethodListId.length > 0)) {
             this.$message.error("鏍峰搧鏈�夋嫨妫�楠屾爣鍑�")
           } else {
             if (!this.areObjectsValuesEqual(this.sampleSelectionList, 'standardMethodListId')) {
@@ -2002,14 +2058,14 @@
         if (this.sampleIds.length === 0) {
           this.$message.error("鏈�夋嫨鏍峰搧")
         } else if (this.sampleIds.length === 1) {
-          if (!this.sampleSelectionList[0].standardMethodListId) {
+          if (!this.sampleSelectionList[0].standardMethodListId || this.sampleSelectionList[0].standardMethodListId.length == 0) {
             this.$message.error("鏍峰搧鏈�夋嫨妫�楠屾爣鍑�")
             return
           }
           this.cableConfigShow = true
         } else {
           // 鍚屾椂閰嶇疆澶氫釜鏍峰搧鐨勭數缂嗛厤缃椂蹇呴』閫夋嫨鐩稿悓鐨勬楠屾爣鍑�
-          if (!this.sampleSelectionList.every(value => value.standardMethodListId)) {
+          if (!this.sampleSelectionList.every(value => value.standardMethodListId && value.standardMethodListId.length > 0)) {
             this.$message.error("鏍峰搧鏈�夋嫨妫�楠屾爣鍑�")
           } else {
             if (!this.areObjectsValuesEqual(this.sampleSelectionList, 'standardMethodListId')) {

--
Gitblit v1.9.3