From 9e0426e8e28dd530663cdbe80f258d1622cc9e7d Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期五, 21 三月 2025 13:35:02 +0800
Subject: [PATCH] 原材料变更为原辅料,新增基础配置包材

---
 src/views/structural/capabilityAndLaboratory/capability/index.vue |  116 +++++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 82 insertions(+), 34 deletions(-)

diff --git a/src/views/structural/capabilityAndLaboratory/capability/index.vue b/src/views/structural/capabilityAndLaboratory/capability/index.vue
index 046c120..56b44a6 100644
--- a/src/views/structural/capabilityAndLaboratory/capability/index.vue
+++ b/src/views/structural/capabilityAndLaboratory/capability/index.vue
@@ -97,7 +97,8 @@
     <EditForm ref="editForm" @refreshList="refreshList1"></EditForm>
     <testObjectEditForm ref="testObjectEditForm" @refreshList="refreshList"></testObjectEditForm>
     <BindPartDialog v-if="bindPartDialog" :bindPartDialog="bindPartDialog" :currentRow="currentRow" :type="type"
-      @closeBindPartDialog="closeBindPartDialog"></BindPartDialog>
+      @closeBindPartDialog="closeBindPartDialog" :currentObj="currentObj">
+    </BindPartDialog>
     <BindSupplierDensityDialog v-if="bindSupplierDensityDialog" :bindSupplierDensityDialog="bindSupplierDensityDialog"
       :currentRow="currentSupplierDensityRow" @closeBindPartDialog="closeBindSupplierDensityDialog">
     </BindSupplierDensityDialog>
@@ -125,7 +126,7 @@
 import {
   addProduct,
   delItemParameter, delProduct, delTestObject, selectItemParameterList, selectProductListByObjectId,
-  selectTestObjectList, upProduct, updateWorkShop
+  selectTestObjectList, upProduct, updateWorkShop, updateObjectWorkShop
 } from "@/api/structural/capability";
 import limsTable from "@/components/Table/lims-table.vue";
 import EditForm from "@/views/structural/capabilityAndLaboratory/capabilityComponents/EditForm.vue";
@@ -154,13 +155,13 @@
         { label: '璇曢獙瀹�', prop: 'sonLaboratory' },
         { label: '瑕佹眰鎻忚堪', prop: 'askTell' },
         { label: '瑕佹眰鍊�', prop: 'ask' },
+        { label: '璇曢獙鏉′欢', prop: 'radiusList' },
         { label: '璁¢噺鍗曚綅', prop: 'unit' },
         { label: '宸ユ椂(H)', prop: 'manHour' },
         { label: '棰勮鏃堕棿(H)', prop: 'manDay' },
         { label: '宸ユ椂鍒嗙粍', prop: 'manHourGroup' },
         { label: '鍒涘缓鏃堕棿', prop: 'createTime' },
         { label: '淇敼鏃堕棿', prop: 'updateTime' },
-        { label: '鏉′欢', prop: 'radiusList' },
         {
           dataType: 'action',
           fixed: 'right',
@@ -232,7 +233,7 @@
         { label: '妫�楠屽璞�', prop: 'specimenName' },
         { label: '妫�楠屽璞N', prop: 'specimenNameEn' },
         { label: '浜у搧', prop: 'product' },
-        { label: '瀵硅薄浠e彿', prop: 'code' },
+        // { label: '瀵硅薄浠e彿', prop: 'code' },
         {
           label: '瀵硅薄绫诲瀷', prop: 'objectType',
           dataType: 'tag',
@@ -243,6 +244,7 @@
             }
           },
         },
+        { label: '杞﹂棿鍚嶇О', prop: 'workShopName' },
         { label: '鍒涘缓浜�', prop: 'createUserName' },
         { label: '鏇存柊浜�', prop: 'updateUserName' },
         { label: '鍒涘缓鏃堕棿', prop: 'createTime' },
@@ -274,13 +276,23 @@
                 this.upProduct(row);
               },
             },
-            // {
-            //   name: '闆朵欢缁戝畾',
-            //   type: 'text',
-            //   clickFun: (row) => {
-            //     this.bindPartFirst(row);
-            //   },
-            // },
+            {
+              name: '闆朵欢缁戝畾',
+              type: 'text',
+              clickFun: (row) => {
+                this.bindPartFirst(row);
+              },
+            },
+            {
+              name: '杞﹂棿缁戝畾',
+              type: 'text',
+              clickFun: (row) => {
+                this.bindWokshop1(row);
+              },
+              disabled: (row) => {
+                return row.objectType != '鍘熻緟鏂�' && row.objectType != '鍖呮潗'
+              }
+            },
           ]
         }
       ],
@@ -336,20 +348,20 @@
                 this.bindWokshop(row);
               },
               showHide: (row) => {
-                if (this.currentObj.objectType != '鍘熸潗鏂�') {
+                if (this.currentObj.objectType != '鍘熻緟鏂�' && row.objectType != '鍖呮潗') {
                   return false
                 } else {
                   return true
                 }
               }
             },
-            {
-              name: '鍘傚瀵嗗害缁戝畾',
-              type: 'text',
-              clickFun: (row) => {
-                this.bindSupplierDensitySecond(row);
-              },
-            },
+            // {
+            //   name: '鍘傚瀵嗗害缁戝畾',
+            //   type: 'text',
+            //   clickFun: (row) => {
+            //     this.bindSupplierDensitySecond(row);
+            //   },
+            // },
           ]
         }
       ],
@@ -502,6 +514,11 @@
       }
     },
     refresh() {
+      this.itemParameterForm = {
+        inspectionItem: null,
+        inspectionItemSubclass: null,
+        sample: null
+      }
       this.resetForm('itemParameterForm')
       this.page.current = 1
       this.refreshTable()
@@ -569,7 +586,7 @@
     // 浜у搧缁存姢
     upProduct(row) {
       this.currentObj = row;
-      if (this.currentObj.objectType == '鍘熸潗鏂�') {
+      if (this.currentObj.objectType == '鍘熻緟鏂�') {
         if (this.productColumn.length < 4) {
           this.productColumn.splice(2, 0, { label: '杞﹂棿鍚嶇О', prop: 'workShopName' })
         }
@@ -673,8 +690,17 @@
     bindPartSecond(row) {
       this.bindPart(row, 1)
     },
+    // 浜у搧-杞﹂棿缁戝畾
     bindWokshop(row) {
+      this.workshopForm.workShopId = row.workShopId
       this.currentProduct = row;
+      this.workshopVisible = true
+    },
+    // 瀵硅薄-杞﹂棿缁戝畾
+    bindWokshop1(row) {
+      this.$set(this.workshopForm, 'workShopId', row.workShopId)
+      this.currentProduct = {};
+      this.currentObj = row;
       this.workshopVisible = true
     },
     // 鍘傚瀵嗗害缁戝畾
@@ -688,6 +714,9 @@
     },
     // 鎵撳紑闆朵欢缁戝畾寮规
     bindPart(row, index) {
+      if (index == 0) {
+        this.currentObj = row
+      }
       this.type = index
       this.currentRow = row
       this.bindPartDialog = true
@@ -715,20 +744,39 @@
       this.$refs['workshopForm'].validate((valid) => {
         if (valid) {
           this.uploading = true
-          updateWorkShop({
-            id: this.currentProduct.id,
-            workShopId: this.workshopForm.workShopId,
-            name: this.workshopList.find(m => m.id == this.workshopForm.workShopId).name
-          }).then(res => {
-            this.uploading = false
-            if (res.code === 200) {
-              this.$message.success('鏂板鎴愬姛')
-              this.getProductList();
-              this.workshopVisible = false
-            }
-          }).catch(err => {
-            this.uploading = false
-          })
+          if (this.currentProduct.id) {
+            // 浜у搧缁戝畾杞﹂棿
+            updateWorkShop({
+              id: this.currentProduct.id ? this.currentProduct.id : null,
+              workShopId: this.workshopForm.workShopId,
+              workShopName: this.workshopList.find(m => m.id == this.workshopForm.workShopId).name,
+            }).then(res => {
+              this.uploading = false
+              if (res.code === 200) {
+                this.$message.success('缁戝畾鎴愬姛')
+                this.getProductList();
+                this.workshopVisible = false
+              }
+            }).catch(err => {
+              this.uploading = false
+            })
+          } else {
+            // 瀵硅薄缁戝畾杞﹂棿
+            updateObjectWorkShop({
+              id: this.currentObj.id ? this.currentObj.id : null,
+              workShopId: this.workshopForm.workShopId,
+              workShopName: this.workshopList.find(m => m.id == this.workshopForm.workShopId).name,
+            }).then(res => {
+              this.uploading = false
+              if (res.code === 200) {
+                this.$message.success('缁戝畾鎴愬姛')
+                this.refreshTable()
+                this.workshopVisible = false
+              }
+            }).catch(err => {
+              this.uploading = false
+            })
+          }
         }
       })
     }

--
Gitblit v1.9.3