From fd7c3cbc7a4116fd12a54270249ec3940b865646 Mon Sep 17 00:00:00 2001
From: zhangherong <571457620@qq.com>
Date: 星期一, 24 三月 2025 13:14:44 +0800
Subject: [PATCH] art: 设备台账-新增 修改

---
 src/views/eam/equipment/modules/EamEquipmentModal.vue |   59 +++++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 51 insertions(+), 8 deletions(-)

diff --git a/src/views/eam/equipment/modules/EamEquipmentModal.vue b/src/views/eam/equipment/modules/EamEquipmentModal.vue
index a91f44e..39bd6c2 100644
--- a/src/views/eam/equipment/modules/EamEquipmentModal.vue
+++ b/src/views/eam/equipment/modules/EamEquipmentModal.vue
@@ -161,13 +161,21 @@
 
         <a-row :gutter="24">
           <a-col :span="6">
-            <a-form-model-item prop="orgId" label="浣跨敤閮ㄩ棬">
-              <a-input placeholder="璇疯緭鍏ヤ娇鐢ㄩ儴闂�" v-model="model.orgId"/>
+            <a-form-model-item prop="orgId" label="浣跨敤杞﹂棿">
+              <a-tree-select v-model="model.orgId"
+                             style="width: 100%"
+                             :tree-data="treeData"
+                             :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
+                             placeholder="璇烽�夋嫨浣跨敤杞﹂棿"
+                             allow-clear
+                             tree-default-expand-all
+                >
+              </a-tree-select>
             </a-form-model-item>
           </a-col>
           <a-col :span="6">
             <a-form-model-item prop="equipmentManager" label="璁惧绠$悊鍛�">
-              <a-input placeholder="璇疯緭鍏ヨ澶囩鐞嗗憳" v-model="model.equipmentManager"/>
+              <j-search-select-tag  placeholder="璇烽�夋嫨璁惧绠$悊鍛�" v-model="model.equipmentManager" dict="sys_user,realname, username, del_flag=0"/>
             </a-form-model-item>
           </a-col>
           <a-col :span="6">
@@ -178,7 +186,12 @@
           </a-col>
           <a-col :span="6">
             <a-form-model-item prop="mdcFlag" label="鏄惁瀹炴柦MDC">
-              <lx-switch checked-children='鏄�' un-checked-children='鍚�' v-model="model.mdcFlag"/>
+              <lx-switch checked-children='鏄�' un-checked-children='鍚�' @change="handleMdcFlagChange" v-model="model.mdcFlag"/>
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="6" v-if="model.mdcFlag === '1'">
+            <a-form-model-item prop="deviceType" label="MDC璁惧绫诲瀷">
+              <j-search-select-tag placeholder="璇烽�夋嫨璁惧绫诲瀷" v-model="model.deviceType" dict="mdc_equipment_type,equipment_type_name, id, equipment_type_states='Y'" />
             </a-form-model-item>
           </a-col>
         </a-row>
@@ -219,11 +232,13 @@
 </template>
 
 <script>
-import { httpAction } from '@/api/manage'
+import { getAction, httpAction } from '@/api/manage'
 import { validateDuplicateValueInDelFlag } from '@/utils/util'
+import JSelectProduction from '@comp/jeecgbiz/JSelectProduction.vue'
 
 export default {
   name: 'EamEquipmentModal',
+  components: { JSelectProduction },
   data() {
     return {
       title: '鎿嶄綔',
@@ -265,15 +280,27 @@
         ],
         technologyStatus: [
           { required: true, message: '璇烽�夋嫨鎶�鏈姸鎬�' }
+        ],
+        orgId: [
+          { required: true, message: '璇烽�夋嫨浣跨敤杞﹂棿' }
+        ],
+        equipmentManager: [
+          { required: true, message: '璇烽�夋嫨璁惧绠$悊鍛�' }
+        ],
+        deviceType: [
+          { required: false, message: '璇烽�夋嫨璁惧绫诲瀷' }
         ]
       },
       url: {
         add: '/eam/equipment/add',
-        edit: '/eam/equipment/edit'
-      }
+        edit: '/eam/equipment/edit',
+        loadProductionOptions:'/mdc/mdcProduction/loadProductionTreeOptions'
+      },
+      treeData: [],
     }
   },
   created() {
+    this.loadAllProductionTree();
   },
   methods: {
     add() {
@@ -322,8 +349,24 @@
     },
     handleCancel() {
       this.close()
+    },
+    loadAllProductionTree() {
+      //鍔犺浇杞﹂棿閫夋嫨鏍�
+      getAction(this.url.loadProductionOptions).then(res => {
+        if (res.success) {
+          this.treeData = [...res.result]
+        }else {
+          that.$message.warning(res.message)
+        }
+      })
+    },
+    handleMdcFlagChange(checked){
+      if (checked) {
+        this.validatorRules.deviceType[0].required = true
+      } else {
+        this.validatorRules.deviceType[0].required = false
+      }
     }
-
   }
 }
 </script>

--
Gitblit v1.9.3