From 58be07dbde1f3375d86204cb215c8372b615a01b Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期三, 09 四月 2025 10:16:53 +0800
Subject: [PATCH] 原辅材车间文件预览调整+成品分配权限限制

---
 src/views/business/productOrder/components/add.vue |   99 ++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 72 insertions(+), 27 deletions(-)

diff --git a/src/views/business/productOrder/components/add.vue b/src/views/business/productOrder/components/add.vue
index 6135f46..30f7a47 100644
--- a/src/views/business/productOrder/components/add.vue
+++ b/src/views/business/productOrder/components/add.vue
@@ -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>
@@ -766,7 +766,7 @@
       totalArr: [],
       addObj1: {},
       model: null,
-      standardMethodListId: null,
+      standardMethodListId: [],
       symbolList: ['RTS'],
       inspectionItem: null,
       inspectionItemSubclass: null,
@@ -777,7 +777,7 @@
       temId: '',
       sonLaboratoryList: [],
       selectiveEcho: [], // 妫�楠屼笅鍗曠殑鏃跺�欏嬀閫夋楠岄」鐩�,濡傛灉浣跨敤绛涢�夋彁浜ゆ樉绀烘楠岄」鐩负绌� 鍥炴樉鍒楄〃
-      quarterItemOptions: [], // 鏌ヨ瀛e害淇℃伅
+      quarterItemOptions: [], // 鏌ヨ鍙潬鎬т俊鎭�
       specialStandardMethod: '',
       isSpecial: false,
     }
@@ -812,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) {
@@ -856,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
@@ -1079,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) {
@@ -1106,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 => {
@@ -1269,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('宸叉彁浜�')
@@ -1452,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 = []
@@ -1497,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 = []
@@ -1522,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 = []
@@ -1721,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,
@@ -1771,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 => {
@@ -1985,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')) {
@@ -2013,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