From 9ed9db9716f36e797141d9a80119fd0c1f4ac7a5 Mon Sep 17 00:00:00 2001 From: zhaowei <zhaowei> Date: 星期二, 14 一月 2025 15:12:14 +0800 Subject: [PATCH] 1、产品/部件/零件的新增与编辑以及根据层级查询对应文档功能已完成后端联调 2、产品结构树新增节点展开记忆功能方便新增节点后查看 --- src/views/dnc/common/ProductStructureTree.vue | 57 ++++++++++++++++++++++++++++++++++----------------------- 1 files changed, 34 insertions(+), 23 deletions(-) diff --git a/src/views/dnc/common/ProductStructureTree.vue b/src/views/dnc/common/ProductStructureTree.vue index de6e889..c6d958f 100644 --- a/src/views/dnc/common/ProductStructureTree.vue +++ b/src/views/dnc/common/ProductStructureTree.vue @@ -16,7 +16,8 @@ <a-icon type="bars"/> </a-button> </a-dropdown> - <a-button type="primary" @click="$refs.productModalFormRef.handleProductAdd('娣诲姞浜у搧')"> + <a-button type="primary" + @click="$refs.productModalFormRef.triggerCorrespondingMethod({modalTitle:'娣诲姞浜у搧',methodName:'handleProductAdd'})"> <a-icon type="plus"></a-icon> 浜у搧 </a-button> @@ -44,18 +45,20 @@ </a-spin> <!--浜у搧寮圭獥--> - <ProductModal ref="productModalFormRef" :currentTreeNodeInfo="rightClickSelected"/> + <ProductModal ref="productModalFormRef" :currentTreeNodeInfo="rightClickSelected" + @submitSuccess="queryTreeData"/> <!--閮ㄤ欢寮圭獥--> - <ComponentModal :currentTreeNodeInfo="rightClickSelected"/> + <ComponentModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/> <!--闆朵欢寮圭獥--> - <PartModal :currentTreeNodeInfo="rightClickSelected"/> + <PartModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/> <!--宸ュ簭寮圭獥--> - <ProcessModal :currentTreeNodeInfo="rightClickSelected"/> + <ProcessModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/> </a-card> </template> <script> import dncApi from '@/api/dnc' + import { deleteAction } from '@/api/manage' import ProductStructureTreeContextMenu from './modules/ProductStructureTree/ProductStructureTreeContextMenu' import ProductModal from '../base/modules/ProductStructure/Product/ProductModal' import ComponentModal from '../base/modules/ProductStructure/Component/ComponentModal' @@ -87,7 +90,7 @@ currentSelected: {}, rightClickSelected: {}, url: { - delete: '' + delete: '/nc/product/delete' } } }, @@ -107,8 +110,7 @@ this.treeDataSource = res.list this.generateList(this.treeDataSource) // this.expandedKeys = this.allTreeKeys - this.expandedKeys = [this.treeDataSource[0].id] - console.log('treeDataSource', this.treeDataSource) + if (this.expandedKeys.length === 0) this.expandedKeys = [this.treeDataSource[0].id] } else { this.$message.warn(res.message) } @@ -158,26 +160,35 @@ return } const that = this - // deleteAction(that.url.delete, { id: this.rightClickSelected.id }) - // .then((res) => { - // if (res.success) { - // that.queryTreeData() - // that.$notification.success({ - // message: '娑堟伅', - // description: res.message - // }) - // } else { - // that.$notification.warning({ - // message: '娑堟伅', - // description: res.message - // }) - // } - // }) + deleteAction(that.url.delete, { id: this.rightClickSelected.id }) + .then((res) => { + if (res.success) { + that.queryTreeData() + that.$notification.success({ + message: '娑堟伅', + description: res.message + }) + } else { + that.$notification.warning({ + message: '娑堟伅', + description: res.message + }) + } + }) } }) }, /** + * 鑷姩灞曞紑娣诲姞涓嬬骇鑺傜偣鐨勭埗鑺傜偣 + */ + modalFormSubmitSuccess(isAddNextLevel) { + // 鍒ゆ柇鏄惁涓烘坊鍔犱笅绾у苟涓斿垽鏂埗鑺傜偣鏄惁灞曞紑 + if (isAddNextLevel && !this.expandedKeys.includes(this.rightClickSelected.id)) this.expandedKeys.push(this.rightClickSelected.id) + this.queryTreeData() + }, + + /** * 鏍戣妭鐐瑰睍寮�鍚堝苟鏃惰Е鍙� * @param expandedKeys 灞曞紑椤筴ey */ -- Gitblit v1.9.3