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/ProductStructure/ProductStructureTree.vue |   41 ++++++++++++++++++++++-------------------
 1 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/src/views/dnc/base/modules/ProductStructure/ProductStructureTree.vue b/src/views/dnc/base/modules/ProductStructure/ProductStructureTree.vue
index 328e26f..0a5eee6 100644
--- a/src/views/dnc/base/modules/ProductStructure/ProductStructureTree.vue
+++ b/src/views/dnc/base/modules/ProductStructure/ProductStructureTree.vue
@@ -9,7 +9,7 @@
             <a-menu slot="overlay">
               <a-menu-item key="1" @click="expandedKeys = allTreeKeys">灞曞紑鎵�鏈�</a-menu-item>
               <a-menu-item key="2" @click="expandedKeys = ['-1']">鍚堝苟鎵�鏈�</a-menu-item>
-              <a-menu-item key="3" @click="queryTreeData">鍒锋柊</a-menu-item>
+              <a-menu-item key="3" @click="getTreeDataByApi">鍒锋柊</a-menu-item>
             </a-menu>
             <a-button>
               <a-icon type="bars"/>
@@ -24,7 +24,7 @@
 
         <!--浜у搧缁撴瀯鏍�-->
         <div style="flex: 1;overflow:auto;margin-top: 10px">
-          <a-tree ref="tree" show-icon :expandedKeys.sync="expandedKeys"
+          <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="{ label, parentId, entity, key:treeKey,type}">
@@ -45,7 +45,7 @@
 
     <!--浜у搧寮圭獥-->
     <ProductModal ref="productModalFormRef" :currentTreeNodeInfo="rightClickSelected"
-                  @submitSuccess="queryTreeData"/>
+                  @submitSuccess="getTreeDataByApi"/>
     <!--閮ㄤ欢寮圭獥-->
     <ComponentModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/>
     <!--闆朵欢寮圭獥-->
@@ -54,6 +54,8 @@
     <ProcessModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/>
     <!--宸ユ寮圭獥-->
     <ProcessStepModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/>
+    <!--鏉冮檺閰嶇疆寮圭獥-->
+    <AssignPermissionModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/>
   </a-card>
 </template>
 
@@ -66,10 +68,12 @@
   import PartModal from './Part/PartModal'
   import ProcessModal from './Process/ProcessModal'
   import ProcessStepModal from './ProcessStep/ProcessStepModal'
+  import AssignPermissionModal from './Permission/AssignPermissionModal'
 
   export default {
     name: 'ProductStructureTree',
     components: {
+      AssignPermissionModal,
       ProcessStepModal,
       ProcessModal,
       PartModal,
@@ -98,11 +102,11 @@
       }
     },
     created() {
-      this.queryTreeData()
+      this.getTreeDataByApi()
       this.$bus.$on('treeMenuItemMethodTrigger', this.triggerCorrespondingMethod)
     },
     methods: {
-      queryTreeData() {
+      getTreeDataByApi() {
         this.loading = true
         this.cardLoading = true
         dncApi.getProductStructureTreeApi().then(res => {
@@ -145,27 +149,24 @@
         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) {
-                  that.queryTreeData()
+                  that.getTreeDataByApi()
                   that.$notification.success({
                     message: '娑堟伅',
                     description: res.message
@@ -177,6 +178,12 @@
                   })
                 }
               })
+              .finally(() => {
+                that.$destroyAll()
+              })
+          },
+          onCancel: () => {
+            that.$destroyAll()
           }
         })
       },
@@ -187,7 +194,7 @@
       modalFormSubmitSuccess(isAddNextLevel) {
         // 鍒ゆ柇鏄惁涓烘坊鍔犱笅绾у苟涓斿垽鏂埗鑺傜偣鏄惁灞曞紑
         if (isAddNextLevel && !this.expandedKeys.includes(this.rightClickSelected.id)) this.expandedKeys.push(this.rightClickSelected.id)
-        this.queryTreeData()
+        this.getTreeDataByApi()
       },
 
       /**
@@ -257,8 +264,8 @@
         }
       },
 
-      triggerCorrespondingMethod({ methodName, modalTitle }) {
-        if (this[methodName]) this[methodName](modalTitle)
+      triggerCorrespondingMethod({ methodName }) {
+        if (this[methodName]) this[methodName]()
       },
 
       /**
@@ -296,10 +303,6 @@
 
   /deep/ .ant-card-body, /deep/ .ant-spin-nested-loading, /deep/ .ant-spin-container {
     height: 100%;
-  }
-
-  /deep/ .ant-tree-node-content-wrapper {
-    width: calc(100% - 24px);
   }
 
   /deep/ .ant-tree-title, .ant-tree-title .ant-dropdown-trigger {

--
Gitblit v1.9.3