From 28fcbc85bcb8be593f57cbf232968c30d31e8e86 Mon Sep 17 00:00:00 2001
From: zhaowei <zhaowei>
Date: 星期二, 18 三月 2025 10:36:48 +0800
Subject: [PATCH] 1、DNC结构树页面解决因keep-alive标签缓存组件后切换路由无法正常销毁组件从而使组件内事件通过$bus重复调用的问题 2、DNC产品结构树页面工艺规程版本层级下可以导入和挂载其它文档并且展示相关属性信息 3、DNC设备结构树设备的层级由2调整到7并且调整层级影响的相关功能

---
 src/views/dnc/base/modules/ProductStructure/ProductStructureMainTop.vue |   26 ++++++++++++++++++++------
 1 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/src/views/dnc/base/modules/ProductStructure/ProductStructureMainTop.vue b/src/views/dnc/base/modules/ProductStructure/ProductStructureMainTop.vue
index e961d5f..7655c68 100644
--- a/src/views/dnc/base/modules/ProductStructure/ProductStructureMainTop.vue
+++ b/src/views/dnc/base/modules/ProductStructure/ProductStructureMainTop.vue
@@ -1,5 +1,5 @@
 <template>
-  <div v-if="+currentTreeNodeInfo.type!==4">
+  <div>
     <a-tabs v-model="activeTabKey" @contextmenu.native="e=>e.preventDefault()" @change="handleTabChange"
             v-if="Object.keys(currentTreeNodeInfo).length!==0">
       <a-tab-pane :key="1" tab="NC绠$悊" v-if="+currentTreeNodeInfo.type===5||+currentTreeNodeInfo.type===6">
@@ -69,6 +69,12 @@
     this.getDeviceTypeListDisplayPermission('dnc_device_type_process', 'isProcessHasDeviceTypeList')
     this.getDeviceTypeListDisplayPermission('dnc_device_type_step', 'isProcessStepHasDeviceTypeList')
   },
+  beforeDestroy() {
+    this.$bus.$off('sendCurrentTreeNodeInfo', this.receiveCurrentTreeNodeInfo)
+    this.$bus.$off('sendCurrentClickedTypeInfo', this.receiveCurrentClickedTypeInfo)
+    this.$bus.$off('reloadDocumentListData', this.reloadDocumentListData)
+    this.$bus.$off('tableMenuItemMethodTrigger', this.triggerCorrespondingMethod)
+  },
   methods: {
     /**
      * 鑾峰彇璁惧绫诲瀷鍒楄〃鍦ㄥ伐搴忓拰宸ユ灞傜骇鐨勫睍绀烘潈闄�
@@ -89,15 +95,24 @@
      */
     receiveCurrentTreeNodeInfo(treeNodeInfo) {
       console.log('treeNodeInfo', treeNodeInfo)
+      const { id, type } = treeNodeInfo
       // 浠庢爲缁勪欢鎺ュ彈鏍戣妭鐐逛俊鎭悗浠庣埗缁勪欢娴佸叆瀛愮粍浠�
       this.currentTreeNodeInfo = treeNodeInfo
+      this.currentNCDocumentAttributionInfo = Object.assign({}, {
+        attributionId: id,
+        attributionType: type,
+        docClassCode: 'NC'
+      })
       // 娓呯┖涓婁竴鑺傜偣宸茬粡鍔犺浇杩囧緱鏂囨。鍒楄〃tabKey
       this.hasLoadedDataTabKeyArray = []
-      if (+treeNodeInfo.type === 5 || +treeNodeInfo.type === 6) {
+      if (+type === 5 || +type === 6) {
         this.activeTabKey = 1
         this.$nextTick(() => {
-          if (this.$refs.deviceCustomTypeTableList) this.$refs.deviceCustomTypeTableList.setQueryParamAndLoadData()
-          else if (this.$refs.ncDocumentTableListRef) this.$refs.ncDocumentTableListRef.loadData(1)
+          if (this.$refs.deviceCustomTypeTableList) {
+            this.$refs.deviceCustomTypeTableList.setQueryParamAndLoadData()
+            // 鍒囨崲鏍戜箣鍚庢竻绌篘C绋嬪簭鍒楄〃
+            if (this.$refs.ncDocumentTableListRef && this.$refs.ncDocumentTableListRef.dataSource.length > 0) this.$refs.ncDocumentTableListRef.dataSource = []
+          } else if (this.$refs.ncDocumentTableListRef) this.$refs.ncDocumentTableListRef.loadData(1)
         })
       } else {
         this.activeTabKey = 2
@@ -179,7 +194,7 @@
       const { docId, docName } = this.currentRightClickedTableRowInfo
       dncApi.downloadDocumentApi({ docId, docName })
         .then(res => {
-          if (res && !res.success) {
+          if (!res.success) {
             that.$notification.error({
               message: '娑堟伅',
               description: res.message
@@ -254,7 +269,6 @@
         onOk: () => {
           dncApi.documentOutboundApi({ docId, docName })
             .then(res => {
-              console.log('res------------------', res)
               if (res.success) {
                 that.reloadDocumentListData({ docClassCode: param, attributionId, attributionType })
                 that.$notification.success({

--
Gitblit v1.9.3