From a00b50f20267948804399af79f0c5c1dec671a2c Mon Sep 17 00:00:00 2001
From: zhaowei <zhaowei>
Date: 星期一, 09 六月 2025 16:56:52 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/views/dnc/base/modules/ProductStructure/ProductStructureTree.vue |  100 ++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 72 insertions(+), 28 deletions(-)

diff --git a/src/views/dnc/base/modules/ProductStructure/ProductStructureTree.vue b/src/views/dnc/base/modules/ProductStructure/ProductStructureTree.vue
index 3fea23d..9d8320b 100644
--- a/src/views/dnc/base/modules/ProductStructure/ProductStructureTree.vue
+++ b/src/views/dnc/base/modules/ProductStructure/ProductStructureTree.vue
@@ -1,17 +1,17 @@
 <template>
-  <a-card class="tree_con" :loading="cardLoading" :bordered="false" @contextmenu.native="e=>e.preventDefault()">
+  <a-card class="tree_con" :loading="cardLoading" :bordered="false" @contextmenu.native.stop="openBaseContextMenu">
     <a-spin :spinning="loading">
       <div style="display: flex;flex-direction: column;height: 100%">
         <div style="display: flex;justify-content: space-between">
           <a-input placeholder="杈撳叆鍏抽敭瀛楄繘琛屾悳绱�" allowClear v-model="searchInput"
-                   @change="handleSearchInputChange"/>
-          <a-tooltip title="鍒锋柊">
-            <a-button icon="reload" @click="getTreeDataByApi" style="width: 18%;margin-left: 8px"></a-button>
-          </a-tooltip>
-          <a-button type="primary" v-has="'product_add'" icon="plus" style="margin-left: 8px"
-                    @click="$refs.productModalFormRef.triggerCorrespondingMethod({modalTitle:'娣诲姞浜у搧',methodName:'handleProductAdd'})">
-            浜у搧
-          </a-button>
+                   @change="handleSearchInputChange" />
+          <!--          <a-tooltip title="鍒锋柊">-->
+          <!--            <a-button icon="reload" @click="handleTreeReload" style="width: 18%;margin-left: 8px"></a-button>-->
+          <!--          </a-tooltip>-->
+          <!--          <a-button type="primary" v-has="'product_add'" icon="plus" style="margin-left: 8px"-->
+          <!--                    @click="$refs.productModalFormRef.triggerCorrespondingMethod({modalTitle:'娣诲姞浜у搧',methodName:'handleProductAdd'})">-->
+          <!--            浜у搧-->
+          <!--          </a-button>-->
           <!--          <a-dropdown :trigger="['click']" placement="bottomCenter" style="margin: 0 8px">-->
           <!--            <a-menu slot="overlay">-->
           <!--              <a-menu-item key="1" @click="expandedKeys = allTreeKeys">灞曞紑鎵�鏈�</a-menu-item>-->
@@ -25,22 +25,22 @@
         </div>
 
         <!--浜у搧缁撴瀯鏍�-->
-        <div style="flex: 1;overflow:auto;margin-top: 10px">
+        <div id="tree-container" style="flex: 1;overflow:auto;margin-top: 10px">
           <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, key:treeKey,type}">
               <ProductStructureTreeContextMenu ref="contextMenuRef"
-                                               :treeParams="{label,treeKey,searchValue,type}"/>
+                                               :treeParams="{label,treeKey,searchValue,type}" />
             </template>
 
-            <a-icon slot="switcherIcon" type="down"/>
-            <a-icon slot="product" type="shopping"/>
-            <a-icon slot="component" type="camera"/>
-            <a-icon slot="part" type="hdd"/>
-            <a-icon slot="processSpecVersion" type="tag"/>
-            <a-icon slot="process" type="apartment"/>
-            <a-icon slot="processStep" type="tool"/>
+            <a-icon slot="switcherIcon" type="down" />
+            <a-icon slot="product" type="shopping" />
+            <a-icon slot="component" type="camera" />
+            <a-icon slot="part" type="hdd" />
+            <a-icon slot="processSpecVersion" type="tag" />
+            <a-icon slot="process" type="apartment" />
+            <a-icon slot="processStep" type="tool" />
           </a-tree>
         </div>
       </div>
@@ -48,19 +48,27 @@
 
     <!--浜у搧寮圭獥-->
     <ProductModal ref="productModalFormRef" :currentTreeNodeInfo="rightClickSelected"
-                  @submitSuccess="getTreeDataByApi"/>
+                  @submitSuccess="getTreeDataByApi" />
     <!--閮ㄤ欢寮圭獥-->
-    <ComponentModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/>
+    <ComponentModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess" />
     <!--闆朵欢寮圭獥-->
-    <PartModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/>
+    <PartModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess" />
     <!--宸ヨ壓瑙勭▼鐗堟湰寮圭獥-->
-    <ProcessSpecVersionModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/>
+    <ProcessSpecVersionModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess" />
     <!--宸ュ簭寮圭獥-->
-    <ProcessModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/>
+    <ProcessModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess" />
     <!--宸ユ寮圭獥-->
-    <ProcessStepModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/>
+    <ProcessStepModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess" />
     <!--鏉冮檺閰嶇疆寮圭獥-->
-    <AssignPermissionModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/>
+    <AssignPermissionModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess" />
+    <!--妫�绱㈢數瀛愭ā鏉垮脊绐�-->
+    <NcDocumentSearchModal :currentDocumentInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess" />
+    <!--妫�绱C鏂囦欢寮圭獥-->
+    <NcDocumentSearchNcModal :currentDocumentInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess" />
+    <!--寮曠敤閮ㄤ欢-->
+    <NcComponentBorrowModal :currentBorrowInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess" />
+    <!--浜у搧缁撴瀯鏍戝熀鏈彸閿彍鍗�(绌虹櫧澶勮Е鍙�)-->
+    <ProductStructureBaseContextMenu ref="baseContextmenuRef" />
   </a-card>
 </template>
 
@@ -76,10 +84,16 @@
 import ProcessStepModal from './ProcessStep/ProcessStepModal'
 import AssignPermissionModal from './Permission/AssignPermissionModal'
 import DeviceCustomTypeModal from '@views/dnc/base/modules/ProductStructure/DeviceCustomType/DeviceCustomTypeModal.vue'
+import ProductStructureBaseContextMenu
+  from '@views/dnc/base/modules/ProductStructure/ProductStructureBaseContextMenu.vue'
+import NcDocumentSearchModal from '@views/dnc/base/modules/ProductStructure/Document/NcDocumentSearchModal.vue'
+import NcDocumentSearchNcModal from '@views/dnc/base/modules/ProductStructure/Document/NcDocumentSearchNcModal.vue'
+import NcComponentBorrowModal from '@views/dnc/base/modules/ProductStructure/Document/NcComponentBorrowModal.vue'
 
 export default {
   name: 'ProductStructureTree',
   components: {
+    ProductStructureBaseContextMenu,
     DeviceCustomTypeModal,
     AssignPermissionModal,
     ProcessStepModal,
@@ -88,7 +102,10 @@
     PartModal,
     ComponentModal,
     ProductModal,
-    ProductStructureTreeContextMenu
+    ProductStructureTreeContextMenu,
+    NcDocumentSearchModal,
+    NcDocumentSearchNcModal,
+    NcComponentBorrowModal
   },
   data() {
     return {
@@ -118,6 +135,7 @@
     this.$bus.$off('treeMenuItemMethodTrigger', this.triggerCorrespondingMethod)
   },
   methods: {
+    // 璋冪敤鎺ュ彛鑾峰彇鏍戠殑鏁版嵁
     getTreeDataByApi() {
       this.loading = true
       this.cardLoading = true
@@ -180,6 +198,7 @@
      * @param node 鑺傜偣瀵硅薄
      */
     handleTreeRightClick({ node }) {
+      if (this.$refs.baseContextmenuRef) this.$refs.baseContextmenuRef.menuVisible = false
       const that = this
       const record = node.dataRef
       const { id, type } = record
@@ -339,8 +358,17 @@
       }
     },
 
-    triggerCorrespondingMethod({ methodName }) {
-      if (this[methodName]) this[methodName]()
+    /**
+     * 鏍戞墍鍦ㄧ埗鍏冪礌鐨勫彸閿簨浠�
+     * @param event 浜嬩欢瀵硅薄
+     */
+    openBaseContextMenu(event) {
+      event.preventDefault()
+      if (event.target.id !== 'tree-container') return
+      this.$refs.baseContextmenuRef.menuStyle.top = event.clientY + 'px'
+      this.$refs.baseContextmenuRef.menuStyle.left = event.clientX + 'px'
+      this.$refs.baseContextmenuRef.menuVisible = true
+      document.body.addEventListener('click', this.handleBaseContextMenuClose)
     },
 
     /**
@@ -369,7 +397,23 @@
           break
         default:
       }
+    },
+
+    // 鎺у埗鍩虹鍙抽敭鑿滃崟鍏抽棴
+    handleBaseContextMenuClose() {
+      if(this.$refs.baseContextmenuRef)this.$refs.baseContextmenuRef.menuVisible = false
+      document.body.removeEventListener('click', this.handleBaseContextMenuClose)
+    },
+
+    // 鍒锋柊閲嶆柊鑾峰彇鏍戠殑鏁版嵁
+    handleTreeReload() {
+      this.getTreeDataByApi()
+    },
+
+    triggerCorrespondingMethod({ methodName }) {
+      if (this[methodName]) this[methodName]()
     }
+
   }
 }
 </script>

--
Gitblit v1.9.3