From 43cf1a348650fc00b3e638396406814bf5f7ebfd Mon Sep 17 00:00:00 2001
From: zhaowei <zhaowei>
Date: 星期三, 15 一月 2025 17:55:02 +0800
Subject: [PATCH] 1、产品结构树页面新增工步功能 2、产品结构树页面新增导入文档或NC程序功能

---
 src/views/dnc/base/modules/ProductStructure/ProductStructureMainTop.vue |   55 ++++++++++++++++++++++++-------------------------------
 1 files changed, 24 insertions(+), 31 deletions(-)

diff --git a/src/views/dnc/base/modules/ProductStructure/ProductStructureMainTop.vue b/src/views/dnc/base/modules/ProductStructure/ProductStructureMainTop.vue
index 790df03..3d1233e 100644
--- a/src/views/dnc/base/modules/ProductStructure/ProductStructureMainTop.vue
+++ b/src/views/dnc/base/modules/ProductStructure/ProductStructureMainTop.vue
@@ -1,12 +1,12 @@
 <template>
-  <a-tabs v-model="activeTabKey" @change="handleTabChange" @contextmenu.native="e=>e.preventDefault()"
+  <a-tabs v-model="activeTabKey" @contextmenu.native="e=>e.preventDefault()"
           v-if="Object.keys(currentTreeNodeInfo).length!==0">
-    <a-tab-pane :key="1" tab="NC鏂囨。" v-if="currentTreeNodeInfo.type!==1">
+    <a-tab-pane :key="1" tab="NC鏂囨。" v-if="currentTreeNodeInfo.type===5||currentTreeNodeInfo.type===6">
       <NcDocumentTableList ref="ncDocumentTableListRef" :currentTreeNodeInfo="currentTreeNodeInfo"
                            @handleTableContextMenuOpen="handleTableContextMenuOpen" :size="tableContainerSize"/>
     </a-tab-pane>
 
-    <a-tab-pane :key="2" tab="鍏朵粬鏂囨。">
+    <a-tab-pane :key="1" tab="鍏朵粬鏂囨。" v-else>
       <OtherDocumentTableList ref="otherDocumentTableListRef" :currentTreeNodeInfo="currentTreeNodeInfo"
                               @handleTableContextMenuOpen="handleTableContextMenuOpen" :size="tableContainerSize"/>
     </a-tab-pane>
@@ -25,8 +25,7 @@
     components: { TableContextMenu, OtherDocumentTableList, NcDocumentTableList },
     data() {
       return {
-        activeTabKey: null,
-        hasLoadingDataTabKey: [],
+        activeTabKey: 1,
         tableContainerSize: 'small',
         currentRightClickedTableRowInfo: {},
         currentTreeNodeInfo: {}
@@ -34,19 +33,7 @@
     },
     created() {
       this.$bus.$on('sendCurrentTreeNodeInfo', this.receiveCurrentTreeNodeInfo)
-    },
-    watch: {
-      activeTabKey: {
-        handler(value) {
-          // tab鍒囨崲鏃跺姞杞藉搴旀枃妗e垪琛紝褰撳墠鏍戣妭鐐逛笅宸茬粡鍔犺浇杩囩殑鏂囨。鍒楄〃涓嶅啀閲嶅鍔犺浇
-          if (!this.hasLoadingDataTabKey.includes(value)) {
-            if (value === 1) this.$nextTick(() => this.$refs.ncDocumentTableListRef.loadData(1))
-            else this.$nextTick(() => this.$refs.otherDocumentTableListRef.loadData(1))
-            this.hasLoadingDataTabKey.push(value)
-          }
-        },
-        deep: true
-      }
+      this.$bus.$on('importFileSuccess', this.reloadDocumentListData)
     },
     methods: {
       /**
@@ -70,23 +57,29 @@
         // 浠庢爲缁勪欢鎺ュ彈鏍戣妭鐐逛俊鎭悗浠庣埗缁勪欢娴佸叆瀛愮粍浠�
         this.currentTreeNodeInfo = treeNodeInfo
         // 娓呯┖涓婁竴鑺傜偣宸茬粡鍔犺浇杩囧緱鏂囨。鍒楄〃tabKey
-        this.hasLoadingDataTabKey = []
-        if (treeNodeInfo.type !== 1) {
-          this.activeTabKey = 1
-          this.$nextTick(() => this.$refs.ncDocumentTableListRef.loadData(1))
+        if (treeNodeInfo.type === 5 || treeNodeInfo.type === 6) {
+          this.$nextTick(() => {
+            if (this.$refs.ncDocumentTableListRef) this.$refs.ncDocumentTableListRef.loadData(1)
+          })
         } else {
-          this.activeTabKey = 2
-          this.$nextTick(() => this.$refs.otherDocumentTableListRef.loadData(1))
+          this.$nextTick(() => {
+            if (this.$refs.otherDocumentTableListRef) this.$refs.otherDocumentTableListRef.loadData(1)
+          })
         }
-        this.hasLoadingDataTabKey.push(this.activeTabKey)
       },
 
-      handleTabChange(activeTabKey) {
-        // tab鍒囨崲鏃跺姞杞藉搴旀枃妗e垪琛紝褰撳墠鏍戣妭鐐逛笅宸茬粡鍔犺浇杩囩殑鏂囨。鍒楄〃涓嶅啀閲嶅鍔犺浇
-        if (!this.hasLoadingDataTabKey.includes(activeTabKey)) {
-          if (activeTabKey === 1) this.$nextTick(() => this.$refs.ncDocumentTableListRef.loadData(1))
-          else this.$nextTick(() => this.$refs.otherDocumentTableListRef.loadData(1))
-          this.hasLoadingDataTabKey.push(activeTabKey)
+      /**
+       * 涓婁紶鏂囦欢鎴愬姛鍚庤Е鍙�
+       * @param docClassCode 鏂囨。绫诲埆
+       * @param attributionId 鑺傜偣Id
+       */
+      reloadDocumentListData({ docClassCode, attributionId }) {
+        // 濡傛灉涓婁紶鐨勬枃妗d笉鏄墍灞炰簬褰撳墠鎵�灞曠ず鑺傜偣鐨勬枃妗e垯涓嶉噸鏂拌幏鍙栨枃妗e垪琛�
+        if (this.currentTreeNodeInfo.id !== attributionId) return
+        if (docClassCode === 'NC') {
+          if (this.$refs.ncDocumentTableListRef) this.$refs.ncDocumentTableListRef.loadData(1)
+        } else {
+          if (this.$refs.otherDocumentTableListRef) this.$refs.otherDocumentTableListRef.loadData(1)
         }
       },
 

--
Gitblit v1.9.3