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 ++++++++++++--
 src/api/api.js                                                 |    5 ++
 src/views/system/modules/UserModal.vue                         |   30 +++++++-------
 src/views/system/modules/ProductionManager/ProductionModal.vue |    1 
 4 files changed, 44 insertions(+), 21 deletions(-)

diff --git a/src/api/api.js b/src/api/api.js
index e43da5b..401f30a 100644
--- a/src/api/api.js
+++ b/src/api/api.js
@@ -101,6 +101,8 @@
 //鍔犺浇鎴戠殑閫氬憡淇℃伅
 const getUserNoticeInfo= (params)=>getAction("/sys/sysAnnouncementSend/getMyAnnouncementSend",params);
 const getTransitURL = url => `/sys/common/transitRESTful?url=${encodeURIComponent(url)}`
+//绯荤粺閰嶇疆鍙傛暟鍊艰幏鍙�
+const getSystemConfigValue = (params)=>getAction("/system/sysParams/query/by/settingKey",params);
 // 涓浆HTTP璇锋眰
 export const transitRESTful = {
   get: (url, parameter) => getAction(getTransitURL(url), parameter),
@@ -169,7 +171,8 @@
   deleteByProduction,
   queryById,
   addEquipment,
-  editEquipment
+  editEquipment,
+  getSystemConfigValue
 }
 
 
diff --git a/src/views/system/modules/ProductionManager/ProductionModal.vue b/src/views/system/modules/ProductionManager/ProductionModal.vue
index d854dd5..3a93426 100644
--- a/src/views/system/modules/ProductionManager/ProductionModal.vue
+++ b/src/views/system/modules/ProductionManager/ProductionModal.vue
@@ -121,7 +121,6 @@
         })
       },
       add (depart) {
-        debugger
         this.visible = true;
         this.model = {}
         if(depart){
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'
+          }
+        })
+      },
 
     }
   }
diff --git a/src/views/system/modules/UserModal.vue b/src/views/system/modules/UserModal.vue
index 58dc87c..a3bb819 100644
--- a/src/views/system/modules/UserModal.vue
+++ b/src/views/system/modules/UserModal.vue
@@ -150,21 +150,21 @@
           ></j-select-production>
         </a-form-model-item>
 
-        <!--<a-form-model-item-->
-          <!--label="閫夋嫨璁惧"-->
-          <!--:labelCol="labelCol"-->
-          <!--:wrapperCol="wrapperCol"-->
-          <!--v-show="!productionDisabled"-->
-        <!--&gt;-->
-          <!--<a-input-search-->
-            <!--:readOnly="true"-->
-            <!--v-model="model.equipmentIds"-->
-            <!--@search="deviceSearch"-->
-            <!--enter-button-->
-            <!--placeholder="璇烽�夋嫨璁惧"-->
-            <!--:disabled="!model.selectedProduction"-->
-          <!--/>-->
-        <!--</a-form-model-item>-->
+        <a-form-model-item
+          label="閫夋嫨璁惧"
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          v-show="!productionDisabled"
+        >
+          <a-input-search
+            :readOnly="true"
+            v-model="model.equipmentIds"
+            @search="deviceSearch"
+            enter-button
+            placeholder="璇烽�夋嫨璁惧"
+            :disabled="!model.selectedProduction"
+          />
+        </a-form-model-item>
 
         <!--<a-form-model-item-->
           <!--label="棣栭〉鏉冮檺"-->

--
Gitblit v1.9.3