From 7a173d873b252b4b04e6ff034a18f8b808ccab05 Mon Sep 17 00:00:00 2001 From: zhaowei <zhaowei> Date: 星期五, 14 二月 2025 16:39:00 +0800 Subject: [PATCH] 设备结构树与mdc设备树接口分开为两个接口 --- src/views/dnc/base/modules/DeviceStructure/DeviceStructureTree.vue | 90 +++++++++++--------------------------------- 1 files changed, 23 insertions(+), 67 deletions(-) diff --git a/src/views/dnc/base/modules/DeviceStructure/DeviceStructureTree.vue b/src/views/dnc/base/modules/DeviceStructure/DeviceStructureTree.vue index f2bb570..1caf639 100644 --- a/src/views/dnc/base/modules/DeviceStructure/DeviceStructureTree.vue +++ b/src/views/dnc/base/modules/DeviceStructure/DeviceStructureTree.vue @@ -34,17 +34,21 @@ </div> </div> </a-spin> + + <!--鏉冮檺閰嶇疆寮圭獥--> + <AssignPermissionModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="getTreeDataByApi"/> </a-card> </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' export default { name: 'DeviceStructureTree', components: { + AssignPermissionModal, DeviceStructureTreeContextMenu }, data() { @@ -74,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) { @@ -124,54 +128,6 @@ // 鑻ュ彸閿椂褰撳墠鍙充晶灞曠ず灞傜骇涓鸿澶囧眰绾т笖褰撳墠鍙抽敭鏍戝眰绾у悓涓鸿澶囧眰绾ф椂鍒欏湪瑙﹀彂鍙抽敭鑿滃崟鍔熻兘鏃跺悓鏃惰Е鍙戝乏閿�変腑鍔熻兘 if (this.currentSelected.type === 2 && record.type === 2) this.handleTreeSelect([record.key], { node }) this.rightClickSelected = Object.assign({}, record) - }, - - // 鏍戣妭鐐瑰彸閿崟鍑昏彍鍗曚腑鍒犻櫎鎸夐挳鏃惰Е鍙� - handleDelete() { - const that = this - that.$confirm({ - title: '鎻愮ず', - content: '纭鍒犻櫎姝ゆ潯璁板綍鍚楋紵', - okText: '纭', - okType: 'danger', - cancelText: '鍙栨秷', - onOk: () => { - if (!this.url.delete) { - this.$message.error('璇疯缃畊rl.delete灞炴��!') - return - } - deleteAction(that.url.delete, { id: this.rightClickSelected.id }) - .then((res) => { - if (res.success) { - that.getTreeDataByApi() - that.$notification.success({ - message: '娑堟伅', - description: res.message - }) - } else { - that.$notification.warning({ - message: '娑堟伅', - description: res.message - }) - } - }) - .finally(() => { - that.$destroyAll() - }) - }, - onCancel: () => { - that.$destroyAll() - } - }) - }, - - /** - * 鑷姩灞曞紑娣诲姞涓嬬骇鑺傜偣鐨勭埗鑺傜偣 - */ - modalFormSubmitSuccess(isAddNextLevel) { - // 鍒ゆ柇鏄惁涓烘坊鍔犱笅绾у苟涓斿垽鏂埗鑺傜偣鏄惁灞曞紑 - if (isAddNextLevel && !this.expandedKeys.includes(this.rightClickSelected.id)) this.expandedKeys.push(this.rightClickSelected.id) - this.getTreeDataByApi() }, /** -- Gitblit v1.9.3