From af62acf44d4424689378b1f0c6bb99b98d47565f Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期二, 25 三月 2025 10:09:17 +0800
Subject: [PATCH] 车间绑定修改

---
 src/views/structural/capabilityAndLaboratory/capabilityComponents/testObjectEditForm.vue |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/src/views/structural/capabilityAndLaboratory/capabilityComponents/testObjectEditForm.vue b/src/views/structural/capabilityAndLaboratory/capabilityComponents/testObjectEditForm.vue
index e6489d7..e8052d0 100644
--- a/src/views/structural/capabilityAndLaboratory/capabilityComponents/testObjectEditForm.vue
+++ b/src/views/structural/capabilityAndLaboratory/capabilityComponents/testObjectEditForm.vue
@@ -24,6 +24,12 @@
               :value="item.value"></el-option>
           </el-select>
         </el-form-item>
+        <el-form-item label="杞﹂棿锛�" prop="objectType" v-if="editForm.objectType == '鍘熻緟鏂�' || editForm.objectType == '鍖呮潗'">
+          <el-select v-model="editForm.workShopId" placeholder="璇烽�夋嫨" size="small">
+            <el-option v-for="item in workshopList" :key="item.id" :label="item.name" :value="item.id">
+            </el-option>
+          </el-select>
+        </el-form-item>
       </el-form>
       <span slot="footer" class="dialog-footer">
         <el-button @click="closeDia">鍙� 娑�</el-button>
@@ -37,6 +43,7 @@
 
 import { obtainItemParameterList } from "@/api/structural/laboratoryScope";
 import { addTestObject, upTestObject } from "@/api/structural/capability";
+import { selectWorkShop } from "@/api/structural/workshop.js"
 
 export default {
   name: "EditForm",
@@ -55,6 +62,7 @@
         specimenNameEn: '', // 妫�楠屽璞N
         // code: '', // 瀵硅薄浠e彿
         objectType: '', // 瀵硅薄绫诲瀷
+        workShopId: '',//杞﹂棿
       },
       laboratoryList: [],
       editFormRules: {
@@ -67,18 +75,29 @@
         objectType: [
           { required: true, message: '璇疯緭鍏ュ璞$被鍨�', trigger: 'change' }
         ],
+        workShopId: [
+          { required: true, message: '璇烽�夋嫨杞﹂棿', trigger: 'change' }
+        ],
       },
-      operationType: ''
+      operationType: '',
+      workshopList: []
     }
   },
   // 鏂规硶闆嗗悎
   methods: {
+    selectWorkShop() {
+      selectWorkShop({ size: -1, current: -1 }).then(res => {
+        this.workshopList = res.data.records
+      })
+    },
     openDia(type, row) {
       this.operationType = type
       this.obtainItemParameterList()
+      this.selectWorkShop()
       this.editFormDia = true
       if (type === 'add') {
         this.resetForm("editForm");
+        this.editForm = {}
       } else {
         this.editForm = { ...row }
       }
@@ -88,6 +107,10 @@
       this.$refs.editForm.validate(valid => {
         if (valid) {
           this.editLoad = true
+          if (this.editForm.objectType != '鍘熻緟鏂�' && this.editForm.objectType != '鍖呮潗') {
+            this.editForm.workShopId = ''
+          }
+          this.editForm.workShopName = this.editForm.workShopId ? this.workshopList.find(m => m.id == this.editForm.workShopId).name : ''
           if (this.editForm.id) {
             // 淇敼
             upTestObject(this.editForm).then(res => {

--
Gitblit v1.9.3