From 09891cea3bd0c4c6182a786c302dc20921f07ccd Mon Sep 17 00:00:00 2001
From: zhaowei <zhaowei>
Date: 星期二, 11 二月 2025 18:01:50 +0800
Subject: [PATCH] 设备结构树: 1、实现点击设备关联NC程序展示文档详细信息、文件内容预览以及文档内容对比功能 2、实现设备层级导入已接收NC程序功能 全局: 1、解决类似文档出库弹窗在路由跳转后点击后会同时出现多个问题

---
 src/views/dnc/base/modules/DeviceStructure/DeviceStructureTree.vue |   24 +++++++++++++++++++-----
 1 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/src/views/dnc/base/modules/DeviceStructure/DeviceStructureTree.vue b/src/views/dnc/base/modules/DeviceStructure/DeviceStructureTree.vue
index 56c7ec9..f2bb570 100644
--- a/src/views/dnc/base/modules/DeviceStructure/DeviceStructureTree.vue
+++ b/src/views/dnc/base/modules/DeviceStructure/DeviceStructureTree.vue
@@ -22,9 +22,9 @@
           <a-tree blockNode show-icon :expandedKeys.sync="expandedKeys"
                   :selectedKeys="selectedKeys" :treeData="treeDataSource" :autoExpandParent="autoExpandParent"
                   @select="handleTreeSelect" @expand="handleTreeExpand" @rightClick="handleTreeRightClick">
-            <template slot="title" slot-scope="{ title, parentId, entity, key:treeKey,equipmentId}">
+            <template slot="title" slot-scope="{ title, parentId, entity, key:treeKey,equipmentId,type}">
               <DeviceStructureTreeContextMenu ref="contextMenuRef"
-                                              :treeParams="{title,treeKey,searchValue,equipmentId,entity}"/>
+                                              :treeParams="{title,treeKey,searchValue,equipmentId,entity,type,param:currentDeviceDocClassCode}"/>
             </template>
 
             <a-icon slot="switcherIcon" type="down"/>
@@ -62,6 +62,7 @@
         allTreeKeys: [],
         currentSelected: {},
         rightClickSelected: {},
+        currentDeviceDocClassCode: 'SEND',
         url: {
           delete: '/nc/product/delete'
         }
@@ -70,6 +71,7 @@
     created() {
       this.getTreeDataByApi()
       this.$bus.$on('treeMenuItemMethodTrigger', this.triggerCorrespondingMethod)
+      this.$bus.$on('handleSwitchDeviceDocClassCode', this.setCurrentDeviceDocClassCode)
     },
     methods: {
       ...mapActions(['QueryProduction']),
@@ -94,6 +96,11 @@
         })
       },
 
+      setCurrentDeviceDocClassCode(documentActiveTabKey) {
+        if (documentActiveTabKey === 1) this.currentDeviceDocClassCode = 'SEND'
+        else this.currentDeviceDocClassCode = 'REC'
+      },
+
       /**
        * 鏍戣妭鐐归�変腑鏃惰Е鍙�
        * @param selectedKeys 閫変腑鑺傜偣key
@@ -114,24 +121,25 @@
        */
       handleTreeRightClick({ event, node }) {
         const record = node.dataRef
+        // 鑻ュ彸閿椂褰撳墠鍙充晶灞曠ず灞傜骇涓鸿澶囧眰绾т笖褰撳墠鍙抽敭鏍戝眰绾у悓涓鸿澶囧眰绾ф椂鍒欏湪瑙﹀彂鍙抽敭鑿滃崟鍔熻兘鏃跺悓鏃惰Е鍙戝乏閿�変腑鍔熻兘
+        if (this.currentSelected.type === 2 && record.type === 2) this.handleTreeSelect([record.key], { node })
         this.rightClickSelected = Object.assign({}, record)
       },
 
       // 鏍戣妭鐐瑰彸閿崟鍑昏彍鍗曚腑鍒犻櫎鎸夐挳鏃惰Е鍙�
       handleDelete() {
-        this.$confirm({
+        const that = this
+        that.$confirm({
           title: '鎻愮ず',
           content: '纭鍒犻櫎姝ゆ潯璁板綍鍚楋紵',
           okText: '纭',
           okType: 'danger',
           cancelText: '鍙栨秷',
           onOk: () => {
-            console.log('this.rightClickSelected.id', this.rightClickSelected.id)
             if (!this.url.delete) {
               this.$message.error('璇疯缃畊rl.delete灞炴��!')
               return
             }
-            const that = this
             deleteAction(that.url.delete, { id: this.rightClickSelected.id })
               .then((res) => {
                 if (res.success) {
@@ -147,6 +155,12 @@
                   })
                 }
               })
+              .finally(() => {
+                that.$destroyAll()
+              })
+          },
+          onCancel: () => {
+            that.$destroyAll()
           }
         })
       },

--
Gitblit v1.9.3