From efdd02d3d80253bf93f1c58e3ae25016db2d6b31 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期三, 09 四月 2025 17:25:50 +0800
Subject: [PATCH] 检验任务,进货检验车间文件选择

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

diff --git a/src/views/structural/capabilityAndLaboratory/capabilityComponents/testObjectEditForm.vue b/src/views/structural/capabilityAndLaboratory/capabilityComponents/testObjectEditForm.vue
index e92119c..bc88919 100644
--- a/src/views/structural/capabilityAndLaboratory/capabilityComponents/testObjectEditForm.vue
+++ b/src/views/structural/capabilityAndLaboratory/capabilityComponents/testObjectEditForm.vue
@@ -1,10 +1,12 @@
 <template>
   <div>
-    <el-dialog :title="operationType === 'add' ? '鏂板' : '缂栬緫'" :visible.sync="editFormDia" width="500px" @close="closeDia">
+    <el-dialog :title="operationType === 'add' ? '鏂板' : '缂栬緫'" :visible.sync="editFormDia" width="500px"
+      @close="closeDia">
       <el-form ref="editForm" :model="editForm" :rules="editFormRules" label-width="120px" label-position="right">
         <el-form-item label="鍦烘墍锛�" prop="laboratoryId">
           <el-select v-model="editForm.laboratoryId" clearable placeholder="璇烽�夋嫨" size="small" style="width: 100%">
-            <el-option v-for="item in laboratoryList" :key="item.value" :label="item.label" :value="item.value"></el-option>
+            <el-option v-for="item in laboratoryList" :key="item.value" :label="item.label"
+              :value="item.value"></el-option>
           </el-select>
         </el-form-item>
         <el-form-item label="妫�楠屽璞★細" prop="specimenName">
@@ -13,12 +15,19 @@
         <el-form-item label="妫�楠屽璞N锛�" prop="specimenNameEn">
           <el-input v-model="editForm.specimenNameEn" clearable size="small"></el-input>
         </el-form-item>
-        <el-form-item label="瀵硅薄浠e彿锛�" prop="code">
+        <!-- <el-form-item label="瀵硅薄浠e彿锛�" prop="code">
           <el-input v-model="editForm.code" clearable size="small"></el-input>
-        </el-form-item>
+        </el-form-item> -->
         <el-form-item label="瀵硅薄绫诲瀷锛�" prop="objectType">
           <el-select v-model="editForm.objectType" clearable placeholder="璇烽�夋嫨" size="small" style="width: 100%">
-            <el-option v-for="item in dict.type.object_type" :key="item.value" :label="item.label" :value="item.value"></el-option>
+            <el-option v-for="item in dict.type.product_classification" :key="item.value" :label="item.label"
+              :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>
@@ -32,13 +41,14 @@
 
 <script>
 
-import {obtainItemParameterList} from "@/api/structural/laboratoryScope";
-import {addTestObject, upTestObject} from "@/api/structural/capability";
+import { obtainItemParameterList } from "@/api/structural/laboratoryScope";
+import { addTestObject, upTestObject } from "@/api/structural/capability";
+import { selectWorkShop } from "@/api/structural/workshop.js"
 
 export default {
   name: "EditForm",
   // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
-  dicts: ['object_type'],
+  dicts: ['product_classification'],
   components: {},
   data() {
     // 杩欓噷瀛樻斁鏁版嵁
@@ -50,8 +60,9 @@
         laboratoryId: '', // 鍦烘墍
         specimenName: '', // 妫�楠屽璞�
         specimenNameEn: '', // 妫�楠屽璞N
-        code: '', // 瀵硅薄浠e彿
+        // code: '', // 瀵硅薄浠e彿
         objectType: '', // 瀵硅薄绫诲瀷
+        workShopId: '',//杞﹂棿
       },
       laboratoryList: [],
       editFormRules: {
@@ -61,31 +72,46 @@
         specimenName: [
           { required: true, message: '璇疯緭鍏ユ楠屽璞�', trigger: 'blur' }
         ],
-        code: [
-          { required: true, message: '璇疯緭鍏ュ璞′唬鍙�', trigger: 'blur' }
+        objectType: [
+          { required: true, message: '璇疯緭鍏ュ璞$被鍨�', trigger: 'change' }
+        ],
+        workShopId: [
+          { required: true, message: '璇烽�夋嫨杞﹂棿', trigger: 'change' }
         ],
       },
-      operationType: ''
+      operationType: '',
+      workshopList: []
     }
   },
   // 鏂规硶闆嗗悎
   methods: {
-    openDia (type, row) {
+    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}
+        this.editForm = { ...row }
       }
     },
     // 鎻愪氦缂栬緫
-    handleEdit () {
+    handleEdit() {
       this.$refs.editForm.validate(valid => {
         if (valid) {
           this.editLoad = true
-          if(this.editForm.id){
+          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 => {
               this.editLoad = false
@@ -98,7 +124,7 @@
             }).catch(e => {
               this.editLoad = false
             })
-          }else{
+          } else {
             // 鏂板
             addTestObject(this.editForm).then(res => {
               this.editLoad = false
@@ -116,7 +142,7 @@
       })
     },
     // 鍏抽棴寮规
-    closeDia () {
+    closeDia() {
       this.editFormDia = false
       this.resetForm("editForm");
     },
@@ -137,6 +163,4 @@
 }
 </script>
 
-<style scoped>
-
-</style>
+<style scoped></style>

--
Gitblit v1.9.3