From 87c0c5e680d467f2e618c6aa3cd78b7e7faa747d Mon Sep 17 00:00:00 2001
From: zhaowei <zhaowei>
Date: 星期五, 14 二月 2025 15:00:08 +0800
Subject: [PATCH] 设备结构树: 1、实现文档批量删除功能 2、实现文档列表的排序以及筛选功能 3、实现树节点车间与设备的权限配置功能 系统管理:删除DNC部门管理页面以及在菜单管理中删除对应菜单

---
 src/views/dnc/base/modules/DeviceStructure/DeviceStructureMainTop.vue |   65 +++++++++++++++++++++++++++-----
 1 files changed, 55 insertions(+), 10 deletions(-)

diff --git a/src/views/dnc/base/modules/DeviceStructure/DeviceStructureMainTop.vue b/src/views/dnc/base/modules/DeviceStructure/DeviceStructureMainTop.vue
index d5ae553..debcfd5 100644
--- a/src/views/dnc/base/modules/DeviceStructure/DeviceStructureMainTop.vue
+++ b/src/views/dnc/base/modules/DeviceStructure/DeviceStructureMainTop.vue
@@ -1,29 +1,34 @@
 <template>
-  <a-tabs v-model="activeTabKey" @contextmenu.native="e=>e.preventDefault()"
+  <a-tabs v-model="activeTabKey" @change="handleTabChange" @contextmenu.native="e=>e.preventDefault()"
           v-if="Object.keys(currentTreeNodeInfo).length!==0">
     <a-tab-pane :key="1" tab="鍙戦��">
-      <!--<NcDocumentTableList ref="ncDocumentTableListRef" />-->
       <HasSentDocumentTableList ref="hasSentDocumentTableListRef" :currentTreeNodeInfo="currentTreeNodeInfo"
                                 @handleTableContextMenuOpen="handleTableContextMenuOpen" :size="tableContainerSize"/>
     </a-tab-pane>
 
     <a-tab-pane :key="2" tab="鎺ユ敹">
-      <!--<OtherDocumentTableList ref="otherDocumentTableListRef" :currentTreeNodeInfo="currentTreeNodeInfo"-->
-      <!--@handleTableContextMenuOpen="handleTableContextMenuOpen" :size="tableContainerSize"/>-->
+      <HasReceivedDocumentTableList ref="hasReceivedDocumentTableListRef" :currentTreeNodeInfo="currentTreeNodeInfo"
+                                    @handleTableContextMenuOpen="handleTableContextMenuOpen"
+                                    :size="tableContainerSize"/>
     </a-tab-pane>
 
     <TableContextMenu :tableRowInfo="currentRightClickedTableRowInfo" ref="tableContextMenuRef"/>
+
+    <DocumentBatchDeleteModal :currentDocumentInfo="currentRightClickedTableRowInfo" :size="tableContainerSize"
+                              @reloadDocumentListData="reloadDocumentListData" ref="documentBatchDeleteModalRef"/>
   </a-tabs>
 </template>
 
 <script>
   import dncApi from '@/api/dnc'
   import TableContextMenu from '../../../common/TableContextMenu'
-  import HasSentDocumentTableList from './HasSentDocumentTableList'
+  import HasSentDocumentTableList from './Document/HasSentDocumentTableList'
+  import HasReceivedDocumentTableList from './Document/HasReceivedDocumentTableList'
+  import DocumentBatchDeleteModal from '../../../common/DocumentBatchDeleteModal'
 
   export default {
     name: 'DeviceStructureMainTop',
-    components: { HasSentDocumentTableList, TableContextMenu },
+    components: { DocumentBatchDeleteModal, HasReceivedDocumentTableList, HasSentDocumentTableList, TableContextMenu },
     props: {
       currentTreeNodeInfo: {
         type: Object
@@ -33,7 +38,8 @@
       return {
         activeTabKey: 1,
         tableContainerSize: 'small',
-        currentRightClickedTableRowInfo: {}
+        currentRightClickedTableRowInfo: {},
+        hasLoadedDataTabKeyArray: []
       }
     },
     created() {
@@ -47,7 +53,6 @@
        */
       handleTableContextMenuOpen(record) {
         this.currentRightClickedTableRowInfo = Object.assign({}, record)
-        console.log('currentRightClickedTableRowInfo', this.currentRightClickedTableRowInfo)
         this.$refs.tableContextMenuRef.currentMenuLevel = record.param
         this.$refs.tableContextMenuRef.menuStyle.top = event.clientY + 'px'
         this.$refs.tableContextMenuRef.menuStyle.left = event.clientX + 'px'
@@ -61,8 +66,31 @@
        */
       loadHasSentDocumentListData(treeNodeInfo) {
         this.$nextTick(() => {
-          if (this.$refs.hasSentDocumentTableListRef) this.$refs.hasSentDocumentTableListRef.loadData(1)
+          if (this.$refs.hasSentDocumentTableListRef) {
+            this.$refs.hasSentDocumentTableListRef.loadData(1)
+            this.hasLoadedDataTabKeyArray.push(this.activeTabKey)
+          }
         })
+      },
+
+      /**
+       * tab鏍囩鍒囨崲鏃惰Е鍙�
+       * @param activeTabKey 褰撳墠宸叉縺娲籺ab鐨刱ey
+       */
+      handleTabChange(activeTabKey) {
+        this.$bus.$emit('handleSwitchDeviceDocClassCode', activeTabKey)
+        if (activeTabKey && !this.hasLoadedDataTabKeyArray.includes(activeTabKey)) {
+          if (activeTabKey === 1) {
+            this.$nextTick(() => {
+              if (this.$refs.hasSentDocumentTableListRef) this.$refs.hasSentDocumentTableListRef.loadData(1)
+            })
+          } else {
+            this.$nextTick(() => {
+              if (this.$refs.hasReceivedDocumentTableListRef) this.$refs.hasReceivedDocumentTableListRef.loadData(1)
+            })
+          }
+          this.hasLoadedDataTabKeyArray.push(activeTabKey)
+        }
       },
 
       /**
@@ -75,6 +103,8 @@
         if (this.currentTreeNodeInfo.key !== attributionId) return
         if (docClassCode === 'SEND') {
           if (this.$refs.hasSentDocumentTableListRef) this.$refs.hasSentDocumentTableListRef.loadData(1)
+        } else {
+          if (this.$refs.hasReceivedDocumentTableListRef) this.$refs.hasReceivedDocumentTableListRef.loadData(1)
         }
       },
 
@@ -132,6 +162,16 @@
             that.$destroyAll()
           }
         })
+      },
+
+      /**
+       * 鐐瑰嚮鎵归噺鍒犻櫎鍚庡嚭鐜板脊绐�
+       * @param modalTitle 寮圭獥鏍囬
+       */
+      handleBatchRemove(modalTitle) {
+        if (!this.$refs.documentBatchDeleteModalRef) return
+        this.$refs.documentBatchDeleteModalRef.title = modalTitle
+        this.$refs.documentBatchDeleteModalRef.visible = true
       },
 
       /**
@@ -222,7 +262,6 @@
           }
         })
       },
-
 
       /**
        * 鐐瑰嚮鍙戝竷鏃惰Е鍙戝綋鍓嶆枃妗e彂甯�
@@ -357,6 +396,12 @@
         })
       },
 
+      // 閲嶇疆tabKey骞朵笖閲婃斁鍔犺浇鏂囨。鍒楄〃鐨勬帴鍙�
+      releaseLoadDocumentListApi() {
+        this.hasLoadedDataTabKeyArray = []
+        this.handleTabChange(this.activeTabKey)
+      },
+
       // 鎺у埗鍙抽敭鑿滃崟鍏抽棴
       handleMenuClose() {
         this.$refs.tableContextMenuRef.menuVisible = false

--
Gitblit v1.9.3