From 1f69274b3f62e60378d7c5dbce05357366aaf2a6 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期三, 19 三月 2025 17:21:50 +0800
Subject: [PATCH] 能力范围修改80%+合并装备代码

---
 src/views/structural/capabilityAndLaboratory/capability/index.vue |   68 ++++++++++++++++++++++++++-------
 1 files changed, 53 insertions(+), 15 deletions(-)

diff --git a/src/views/structural/capabilityAndLaboratory/capability/index.vue b/src/views/structural/capabilityAndLaboratory/capability/index.vue
index ea3b1cd..3fbef5c 100644
--- a/src/views/structural/capabilityAndLaboratory/capability/index.vue
+++ b/src/views/structural/capabilityAndLaboratory/capability/index.vue
@@ -126,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";
@@ -244,6 +244,7 @@
             }
           },
         },
+        { label: '杞﹂棿鍚嶇О', prop: 'workShopName' },
         { label: '鍒涘缓浜�', prop: 'createUserName' },
         { label: '鏇存柊浜�', prop: 'updateUserName' },
         { label: '鍒涘缓鏃堕棿', prop: 'createTime' },
@@ -281,6 +282,16 @@
               clickFun: (row) => {
                 this.bindPartFirst(row);
               },
+            },
+            {
+              name: '杞﹂棿缁戝畾',
+              type: 'text',
+              clickFun: (row) => {
+                this.bindWokshop1(row);
+              },
+              disabled: (row) => {
+                return row.objectType != '鍘熸潗鏂�'
+              }
             },
           ]
         }
@@ -674,9 +685,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
     },
     // 鍘傚瀵嗗害缁戝畾
@@ -720,20 +739,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