From 32f13d15d67172b9b2dd12d8c5c661c9602c7d2e Mon Sep 17 00:00:00 2001
From: zhaowei <zhaowei>
Date: 星期二, 01 七月 2025 15:30:20 +0800
Subject: [PATCH] 设备管理模块设备车间管理页面新增机构类型字段以及限制条件

---
 src/views/eam/base/modules/EamProductionModal.vue |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/src/views/eam/base/modules/EamProductionModal.vue b/src/views/eam/base/modules/EamProductionModal.vue
index b24cdd5..7f15578 100644
--- a/src/views/eam/base/modules/EamProductionModal.vue
+++ b/src/views/eam/base/modules/EamProductionModal.vue
@@ -19,8 +19,13 @@
                        v-model="model.parentId" placeholder="璇烽�夋嫨涓婄骇鏈烘瀯" disabled>
         </a-tree-select>
       </a-form-model-item>
-      <a-form-model-item v-if="!seen" label="鏈烘瀯绫诲瀷" hasFeedback prop="factoryCategory">
-        <j-dict-select-tag dict-code="eam_production_type" placeholder="璇烽�夋嫨鏈烘瀯绫诲瀷" v-model="model.factoryCategory"/>
+      <a-form-model-item v-if="!seen&&(model.parentFactoryCategory==1||model.parentFactoryCategory==2)" label="鏈烘瀯绫诲瀷"
+                         hasFeedback
+                         prop="factoryCategory">
+        <a-select v-model="model.factoryCategory" placeholder="璇烽�夋嫨鏈烘瀯绫诲瀷">
+          <a-select-option :value="2" v-if="model.parentFactoryCategory!=2">宸ュ尯</a-select-option>
+          <a-select-option :value="3">宸ユ</a-select-option>
+        </a-select>
       </a-form-model-item>
       <a-form-model-item label="鎺掑簭">
         <a-input-number v-model="model.sorter"/>
@@ -55,8 +60,8 @@
         },
         confirmLoading: false,
         validatorRules: {
-          factoryName: [{ required: true, message: '璇疯緭鍏ユ満鏋勫悕绉�!' }],
-          factoryCategory: [{ required: true, message: '璇烽�夋嫨鏈烘瀯绫诲瀷!' }]
+          factoryName: [{ required: true, message: '璇疯緭鍏ユ満鏋勫悕绉�!', trigger: 'change' }],
+          factoryCategory: [{ required: true, message: '璇烽�夋嫨鏈烘瀯绫诲瀷!', trigger: 'change' }]
         },
         url: {
           queryById: '/eam/BaseFactory/queryIdTree',
@@ -80,12 +85,14 @@
       },
 
       add(record) {
-        const factoryCategory = record ? record.factoryCategory : ''
-        const parentId = record ? record.parentId : factoryCategory
+        if (this.$refs.form) this.$refs.form.clearValidate()
+        const parentFactoryCategory = record ? record.factoryCategory : ''
+        const parentId = record ? record.id : ''
         if (parentId) this.seen = false
         else this.seen = true
         this.visible = true
-        this.model = Object.assign({}, { parentId })
+        this.model = Object.assign({}, { parentId, parentFactoryCategory })
+        if (parentFactoryCategory == 2) this.model.factoryCategory = +parentFactoryCategory + 1
         this.loadTreeData()
       },
 
@@ -123,7 +130,6 @@
 
       close() {
         this.$emit('close')
-        if (this.$refs.form) this.$refs.form.clearValidate()
         this.visible = false
       },
 

--
Gitblit v1.9.3