From f2d1b5615b05c002ec63db4df7164c9ed3ecc4a3 Mon Sep 17 00:00:00 2001 From: zhaowei <zhaowei> Date: 星期二, 26 八月 2025 16:42:21 +0800 Subject: [PATCH] 1、优化产品结构树以及设备结构树、列表右键菜单重复右键后出现window菜单问题 2、优化产品结构树节点删除后的loading展示时机 3、优化产品以及设备结构树权限配置获取列表时的loading展示时机 --- src/views/dnc/base/modules/ProductStructure/ProductStructureTree.vue | 89 ++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 81 insertions(+), 8 deletions(-) diff --git a/src/views/dnc/base/modules/ProductStructure/ProductStructureTree.vue b/src/views/dnc/base/modules/ProductStructure/ProductStructureTree.vue index 7ca8dcb..011fb44 100644 --- a/src/views/dnc/base/modules/ProductStructure/ProductStructureTree.vue +++ b/src/views/dnc/base/modules/ProductStructure/ProductStructureTree.vue @@ -30,8 +30,12 @@ :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}"/> + <span v-if="label.indexOf(searchValue) > -1"> + {{label.substr(0, label.indexOf(searchValue))}} + <span class="replaceSearch">{{searchValue}}</span> + {{label.substr(label.indexOf(searchValue) + searchValue.length)}} + </span> + <span v-else>{{ label }}</span> </template> <a-icon slot="switcherIcon" type="down"/> @@ -68,6 +72,10 @@ @submitSuccess="modalFormSubmitSuccess"/> <!--寮曠敤閮ㄤ欢--> <NcComponentBorrowModal :currentBorrowInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/> + + <!--浜у搧缁撴瀯鏍戝彸閿彍鍗曪紙鏍戣妭鐐硅Е鍙戯級--> + <product-structure-tree-context-menu ref="mainContextmenuRef" :treeParams="rightClickSelected"/> + <!--浜у搧缁撴瀯鏍戝熀鏈彸閿彍鍗�(绌虹櫧澶勮Е鍙�)--> <ProductStructureBaseContextMenu ref="baseContextmenuRef"/> @@ -79,7 +87,7 @@ <script> import dncApi from '@/api/dnc' - import { deleteAction } from '@/api/manage' + import { deleteAction, getAction } from '@/api/manage' import ProductStructureTreeContextMenu from './ProductStructureTreeContextMenu' import ProductModal from './Product/ProductModal' import ComponentModal from './Component/ComponentModal' @@ -130,7 +138,8 @@ rightClickSelected: {}, fullScreenSpinning: false, url: { - delete: '/nc/product/delete' + delete: '/nc/product/delete', + webServiceDNCToPlm: '/dnc/guideCardBatch/webServiceDNCToPlm' } } }, @@ -203,9 +212,10 @@ /** * 鏍戣妭鐐瑰彸閿崟鍑昏妭鐐规椂瑙﹀彂 + * @param event 浜嬩欢瀵硅薄 * @param node 鑺傜偣瀵硅薄 */ - handleTreeRightClick({ node }) { + handleTreeRightClick({ event, node }) { if (this.$refs.baseContextmenuRef) this.$refs.baseContextmenuRef.menuVisible = false const that = this const record = node.dataRef @@ -221,7 +231,9 @@ message: '娑堟伅', description: '鏆傛棤璇ヨ妭鐐硅缁嗕俊鎭�' }) + return } + this.openMainContextMenu(event) } else { that.$notification.error({ message: '娑堟伅', @@ -242,11 +254,48 @@ okType: 'danger', cancelText: '鍙栨秷', onOk: () => { - if (!url.delete) { - this.$message.error('璇疯缃畊rl.delete灞炴��!') + that.loading = true + deleteAction(url.delete + `/${id}/${type}`) + .then((res) => { + if (res.success) { + that.getTreeDataByApi() + $notification.success({ + message: '娑堟伅', + description: res.message + }) + } else { + $notification.warning({ + message: '娑堟伅', + description: res.message + }) + } + }) + .finally(() => { + that.$destroyAll() + }) + }, + onCancel: () => { + that.$destroyAll() + } + }) + }, + + // 鍙戦�乶c绋嬪簭鑷充笁缁村伐鑹� + handleSendNcToPlm() { + const that = this + const { rightClickSelected: { id, type }, $confirm, url, $notification } = that + $confirm({ + title: '鎻愮ず', + content: '纭鍙戦�佽nc绋嬪簭锛�', + okText: '纭', + okType: 'danger', + cancelText: '鍙栨秷', + onOk: () => { + if (!url.webServiceDNCToPlm) { + this.$message.error('璇疯缃畊rl.webServiceDNCToPlm!') return } - deleteAction(url.delete + `/${id}/${type}`) + getAction(url.webServiceDNCToPlm, { id: id }) .then((res) => { if (res.success) { that.getTreeDataByApi() @@ -405,12 +454,24 @@ }, /** + * 鎵撳紑鏍戣妭鐐硅彍鍗曚簨浠� + * @param event 鏍戣妭鐐逛簨浠跺璞� + */ + openMainContextMenu(event) { + this.$refs.mainContextmenuRef.menuStyle.top = event.clientY + 'px' + this.$refs.mainContextmenuRef.menuStyle.left = event.clientX + 'px' + this.$refs.mainContextmenuRef.menuVisible = true + document.body.addEventListener('click', this.handleMainContextMenuClose) + }, + + /** * 鏍戞墍鍦ㄧ埗鍏冪礌鐨勫彸閿簨浠� * @param event 浜嬩欢瀵硅薄 */ openBaseContextMenu(event) { event.preventDefault() if (event.target.id !== 'tree-container') return + if (this.$refs.mainContextmenuRef) this.$refs.mainContextmenuRef.menuVisible = false this.$refs.baseContextmenuRef.menuStyle.top = event.clientY + 'px' this.$refs.baseContextmenuRef.menuStyle.left = event.clientX + 'px' this.$refs.baseContextmenuRef.menuVisible = true @@ -443,6 +504,12 @@ break default: } + }, + + // 鎺у埗涓昏鍙抽敭鑿滃崟鍏抽棴 + handleMainContextMenuClose() { + if (this.$refs.mainContextmenuRef) this.$refs.mainContextmenuRef.menuVisible = false + document.body.removeEventListener('click', this.handleMainContextMenuClose) }, // 鎺у埗鍩虹鍙抽敭鑿滃崟鍏抽棴 @@ -496,6 +563,12 @@ align-items: center; } + .replaceSearch { + color: #40a9ff; + font-weight: bold; + background-color: rgb(204, 204, 204); + } + @media screen and (min-width: 1920px) { .tree_con { height: 748px !important; -- Gitblit v1.9.3