From 2752755c47533f191aa886f2c96065121ecd275c Mon Sep 17 00:00:00 2001
From: zhangherong <571457620@qq.com>
Date: 星期五, 21 三月 2025 17:26:39 +0800
Subject: [PATCH] art: 系统管理-用户管理-添加选择设备,并根据是否有设备管理模块功能区分加载 哪个模块的设备倏

---
 src/views/system/modules/SelectDeviceModal.vue |   29 +++++++++++++++++++++++++----
 1 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/src/views/system/modules/SelectDeviceModal.vue b/src/views/system/modules/SelectDeviceModal.vue
index 599de84..e3f8b69 100644
--- a/src/views/system/modules/SelectDeviceModal.vue
+++ b/src/views/system/modules/SelectDeviceModal.vue
@@ -58,6 +58,7 @@
   } from '@/api/manage'
   import BaseTree from '@/views/mdc/common/BaseTree'
   import DepartTree from '@/views/mdc/base/modules/DepartList/DepartListTree/DepartTree'
+  import { getSystemConfigValue } from '@api/api'
 
   export default {
     name: 'SelectDeviceModal',
@@ -85,16 +86,20 @@
         expandedKeys: [],
         checkedKeys: [],
         url: {
-          getDeviceTree: '/mdc/mdcEquipment/loadTreeListByProductionIds'
+          getDeviceTree: '/mdc/mdcEquipment/loadTreeListByProductionIds',
+          getEquipmentTree: '/eam/equipment/loadTreeListByProductionIds',
         },
         selectedWorkshopIds: '',
         dataList: [],
         allTreeKeys: [],
         visible: false,
-        dataSource: []
+        dataSource: [],
+        //绯荤粺鏄惁瀹炴柦璁惧绠$悊妯″潡
+        eamModuleFlag: true,
       }
     },
     created() {
+      this.loadEamSystemConfigValue();
       this.closeAll()
     },
     methods: {
@@ -105,7 +110,15 @@
       queryTreeData(value) {
         this.loading = true
         this.selectedWorkshopIds = value
-        getAction(this.url.getDeviceTree, { ids: value })
+        let url = '';
+        if(this.eamModuleFlag) {
+          //鍔犺浇璁惧绠$悊鐨勬爲缁撴瀯
+          url = this.url.getEquipmentTree
+        }else {
+          //鍔犺浇MDC鐨勬爲缁撴瀯
+          url = this.url.getDeviceTree
+        }
+        getAction(url, { ids: value })
           .then(res => {
             if (res.success) {
               this.dataList = []
@@ -176,7 +189,15 @@
       handleOk() {
         this.$emit('selectFinished', this.deviceNodes)
         this.visible = false
-      }
+      },
+      loadEamSystemConfigValue() {
+        let params = {settingKey: 'has_eam_module'};
+        getSystemConfigValue(params).then(res => {
+          if (res.success) {
+            this.eamModuleFlag = res.result.settingValue === '1'
+          }
+        })
+      },
 
     }
   }

--
Gitblit v1.9.3