From 7a173d873b252b4b04e6ff034a18f8b808ccab05 Mon Sep 17 00:00:00 2001
From: zhaowei <zhaowei>
Date: 星期五, 14 二月 2025 16:39:00 +0800
Subject: [PATCH] 设备结构树与mdc设备树接口分开为两个接口

---
 src/api/dnc.js                                                                 |    4 +++-
 src/views/dnc/base/modules/ProductStructure/Document/NcDocumentAssignModal.vue |    5 +----
 src/store/modules/Production.js                                                |    4 ++--
 src/views/dnc/base/modules/DeviceStructure/DeviceStructureTree.vue             |   37 ++++++++++++++++++-------------------
 4 files changed, 24 insertions(+), 26 deletions(-)

diff --git a/src/api/dnc.js b/src/api/dnc.js
index 58366f3..0fba512 100644
--- a/src/api/dnc.js
+++ b/src/api/dnc.js
@@ -75,6 +75,8 @@
   },
 
   //-------------------------璁惧缁撴瀯鏍�------------------------------------------------
+  // 鑾峰彇璁惧鏍�
+  getDeviceTreeDataApi: () => getAction('/nc/device/queryTreeListByProduction'),
   // 鍒犻櫎鏂囨。
   deleteDeviceRelativeDocumentApi: ({ docId, attributionId }) => deleteAction(`doc/relative/delete/device/${docId}/${attributionId}`),
   // 鑾峰彇鏈夋潈闄愮殑鐢ㄦ埛鍒楄〃
@@ -86,5 +88,5 @@
   // 绉婚櫎鐢ㄦ埛鏉冮檺
   removeDeviceTreePermissionFromUser: ({ treeNodeType, treeNodeId, isAssignSonNode, userIdArray }) => {
     return postAction(`/nc/device/assign/remove/user/${treeNodeType}/${treeNodeId}/${isAssignSonNode}`, userIdArray)
-  },
+  }
 }
\ No newline at end of file
diff --git a/src/store/modules/Production.js b/src/store/modules/Production.js
index f848422..883a3f5 100644
--- a/src/store/modules/Production.js
+++ b/src/store/modules/Production.js
@@ -21,9 +21,9 @@
 
   actions: {
     // 浜х嚎鏍�
-      QueryProduction({ commit },type='MDC') {
+      QueryProduction({ commit }) {
       return new Promise((resolve, reject) => {
-        getAction("/mdc/mdcEquipment/queryTreeListByProduction",{type}).then(response => {
+        getAction("/mdc/mdcEquipment/queryTreeListByProduction").then(response => {
           if(response.success){
             const result = response.result
             Vue.ls.set(SYS_PRODUCTION, result)
diff --git a/src/views/dnc/base/modules/DeviceStructure/DeviceStructureTree.vue b/src/views/dnc/base/modules/DeviceStructure/DeviceStructureTree.vue
index 1b86a5b..1caf639 100644
--- a/src/views/dnc/base/modules/DeviceStructure/DeviceStructureTree.vue
+++ b/src/views/dnc/base/modules/DeviceStructure/DeviceStructureTree.vue
@@ -41,8 +41,7 @@
 </template>
 
 <script>
-  import { mapActions } from 'vuex'
-  import { deleteAction } from '@/api/manage'
+  import dncApi from '@/api/dnc'
   import DeviceStructureTreeContextMenu from './DeviceStructureTreeContextMenu'
   import AssignPermissionModal from './Permission/AssignPermissionModal'
 
@@ -79,26 +78,26 @@
       this.$bus.$on('handleSwitchDeviceDocClassCode', this.setCurrentDeviceDocClassCode)
     },
     methods: {
-      ...mapActions(['QueryProduction']),
-
       getTreeDataByApi() {
         this.loading = true
         this.cardLoading = true
-        this.QueryProduction('DNC').then(res => {
-          if (res.success) {
-            this.dataList = []
-            this.allTreeKeys = []
-            this.treeDataSource = res.result
-            this.generateList(this.treeDataSource)
-            this.expandedKeys = this.allTreeKeys
-            this.$bus.$emit('sendCurrentTreeNodeInfo', this.treeDataSource[0])
-          } else {
-            this.$message.warn(res.message)
-          }
-        }).finally(() => {
-          this.loading = false
-          this.cardLoading = false
-        })
+        dncApi.getDeviceTreeDataApi()
+          .then(res => {
+            if (res.success) {
+              this.dataList = []
+              this.allTreeKeys = []
+              this.treeDataSource = res.result
+              this.generateList(this.treeDataSource)
+              this.expandedKeys = this.allTreeKeys
+              this.$bus.$emit('sendCurrentTreeNodeInfo', this.treeDataSource[0])
+            } else {
+              this.$message.warn(res.message)
+            }
+          })
+          .finally(() => {
+            this.loading = false
+            this.cardLoading = false
+          })
       },
 
       setCurrentDeviceDocClassCode(documentActiveTabKey) {
diff --git a/src/views/dnc/base/modules/ProductStructure/Document/NcDocumentAssignModal.vue b/src/views/dnc/base/modules/ProductStructure/Document/NcDocumentAssignModal.vue
index 26a68a1..b372634 100644
--- a/src/views/dnc/base/modules/ProductStructure/Document/NcDocumentAssignModal.vue
+++ b/src/views/dnc/base/modules/ProductStructure/Document/NcDocumentAssignModal.vue
@@ -85,7 +85,6 @@
   import { getAction } from '@/api/manage'
   import dncApi from '@/api/dnc'
   import { JeecgListMixin } from '@/mixins/JeecgListMixin'
-  import { mapActions } from 'vuex'
 
   export default {
     name: 'NcDocumentAssignModal',
@@ -186,8 +185,6 @@
       }
     },
     methods: {
-      ...mapActions(['QueryProduction']),
-
       // 鑾峰彇褰撳墠宸ュ簭鎴栧伐姝ュ搴旀枃妗e垪琛�
       loadData() {
         this.dataSource = []
@@ -214,7 +211,7 @@
       getDocumentAssignDeviceTreeByApi() {
         this.spinning = true
         this.treeDataSource = []
-        this.QueryProduction('DNC')
+        dncApi.getDeviceTreeDataApi()
           .then(res => {
             if (res.success) {
               this.dataList = []

--
Gitblit v1.9.3