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 ++++++++++++
 src/components/Preview/filePreview.vue                                                   |    2 
 src/views/structural/capabilityAndLaboratory/capability/index.vue                        |   42 ++++++++++----------
 3 files changed, 46 insertions(+), 23 deletions(-)

diff --git a/src/components/Preview/filePreview.vue b/src/components/Preview/filePreview.vue
index 4b0d62d..09b73a7 100644
--- a/src/components/Preview/filePreview.vue
+++ b/src/components/Preview/filePreview.vue
@@ -100,7 +100,7 @@
       const fileName = this.currentFile.fileName || this.fileUrl.split('/').pop().split('?')[0]
       let state = /\.(jpg|jpeg|png|gif)$/i.test(fileName)
       this.imgUrl = this.fileUrl
-      console.log("鏂囦欢鍚�:", fileName, "鏄惁鍥剧墖:", state)
+      // console.log("鏂囦欢鍚�:", fileName, "鏄惁鍥剧墖:", state)
       return state;
     },
     isPdf() {
diff --git a/src/views/structural/capabilityAndLaboratory/capability/index.vue b/src/views/structural/capabilityAndLaboratory/capability/index.vue
index 103e8cc..ff4930d 100644
--- a/src/views/structural/capabilityAndLaboratory/capability/index.vue
+++ b/src/views/structural/capabilityAndLaboratory/capability/index.vue
@@ -283,16 +283,16 @@
                 this.bindPartFirst(row);
               },
             },
-            {
-              name: '杞﹂棿缁戝畾',
-              type: 'text',
-              clickFun: (row) => {
-                this.bindWokshop1(row);
-              },
-              disabled: (row) => {
-                return row.objectType != '鍘熻緟鏂�' && row.objectType != '鍖呮潗'
-              }
-            },
+            // {
+            //   name: '杞﹂棿缁戝畾',
+            //   type: 'text',
+            //   clickFun: (row) => {
+            //     this.bindWokshop1(row);
+            //   },
+            //   disabled: (row) => {
+            //     return row.objectType != '鍘熻緟鏂�' && row.objectType != '鍖呮潗'
+            //   }
+            // },
           ]
         }
       ],
@@ -315,7 +315,7 @@
       productColumn: [
         { label: '浜у搧鍚嶇О', prop: 'name' },
         { label: '浜у搧鍚嶇ОEN', prop: 'nameEn' },
-        { label: '杞﹂棿鍚嶇О', prop: 'workShopName' },
+        // { label: '杞﹂棿鍚嶇О', prop: 'workShopName' },
         {
           dataType: 'action',
           label: '鎿嶄綔',
@@ -413,7 +413,7 @@
     this.getDicts("product_classification").then((response) => {
       this.productClassification = this.dictToValue(response.data);
     });
-    this.selectWorkShop()
+    // this.selectWorkShop()
   },
   computed: {
     title() {
@@ -586,15 +586,15 @@
     // 浜у搧缁存姢
     upProduct(row) {
       this.currentObj = row;
-      if (this.currentObj.objectType == '鍘熻緟鏂�') {
-        if (this.productColumn.length < 4) {
-          this.productColumn.splice(2, 0, { label: '杞﹂棿鍚嶇О', prop: 'workShopName' })
-        }
-      } else {
-        if (this.productColumn.length == 4) {
-          this.productColumn.splice(2, 1)
-        }
-      }
+      // if (this.currentObj.objectType == '鍘熻緟鏂�') {
+      //   if (this.productColumn.length < 4) {
+      //     this.productColumn.splice(2, 0, { label: '杞﹂棿鍚嶇О', prop: 'workShopName' })
+      //   }
+      // } else {
+      //   if (this.productColumn.length == 4) {
+      //     this.productColumn.splice(2, 1)
+      //   }
+      // }
       this.diaProduct = true
       this.objectId = row.id
       this.productPage.current = 1
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