From 9c7505a22f6c249184228de7c6f256a4d880dfed Mon Sep 17 00:00:00 2001 From: zhaowei <zhaowei> Date: 星期五, 14 三月 2025 09:36:06 +0800 Subject: [PATCH] 1、设备类管理页面完成增删改查功能 2、产品结构树工序及工步层级引入设备类概念由系统参数配置决定是否展示,若设备类存在时则NC文档挂载在设备类下不存在时则按照对应工序或工步层级下 3、产品结构树工序及工步层级的刀具列表实现增删改查功能 4、新增设备类管理页面并完成布局 5、产品结构树接口调整,产品结构树节点实体信息通过点击后调取接口获取 6、产品结构树搜素输入框增加防抖机制,避免每次输入都重新计算消耗性能使页面卡顿 7、新增工序及工步层级的刀具列表并添加系统权限 8、用户管理页面移除新增用户时的密码校验 9、产品结构树各层级属性信息展示由每行3列调整为每行4列 10、产品结构树页面在工序和工步层级实现对设备类的增删改查功能 --- src/views/dnc/base/modules/ProductStructure/ProductStructureTree.vue | 106 +++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 79 insertions(+), 27 deletions(-) diff --git a/src/views/dnc/base/modules/ProductStructure/ProductStructureTree.vue b/src/views/dnc/base/modules/ProductStructure/ProductStructureTree.vue index 97b73a0..37a06d1 100644 --- a/src/views/dnc/base/modules/ProductStructure/ProductStructureTree.vue +++ b/src/views/dnc/base/modules/ProductStructure/ProductStructureTree.vue @@ -2,24 +2,26 @@ <a-card class="tree_con" :loading="cardLoading" :bordered="false" @contextmenu.native="e=>e.preventDefault()"> <a-spin :spinning="loading"> <div style="display: flex;flex-direction: column;height: 100%"> - <div style="display: flex"> + <div style="display: flex;justify-content: space-between"> <a-input placeholder="杈撳叆鍏抽敭瀛楄繘琛屾悳绱�" allowClear v-model="searchInput" @change="handleSearchInputChange"/> - <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> - <a-menu-item key="2" @click="expandedKeys = ['-1']">鍚堝苟鎵�鏈�</a-menu-item> - <a-menu-item key="3" @click="getTreeDataByApi">鍒锋柊</a-menu-item> - </a-menu> - <a-button> - <a-icon type="bars"/> - </a-button> - </a-dropdown> - <a-button type="primary" v-has="'product_add'" + <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-icon type="plus"></a-icon> - 浜у搧 + 娣诲姞浜у搧 </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>--> + <!-- <a-menu-item key="2" @click="expandedKeys = ['-1']">鍚堝苟鎵�鏈�</a-menu-item>--> + <!-- <a-menu-item key="3" @click="getTreeDataByApi">鍒锋柊</a-menu-item>--> + <!-- </a-menu>--> + <!-- <a-button>--> + <!-- <a-icon type="bars"/>--> + <!-- </a-button>--> + <!-- </a-dropdown>--> </div> <!--浜у搧缁撴瀯鏍�--> @@ -27,9 +29,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="{ label, parentId, entity, key:treeKey,type}"> + <template slot="title" slot-scope="{ label, parentId, key:treeKey,type}"> <ProductStructureTreeContextMenu ref="contextMenuRef" - :treeParams="{label,treeKey,searchValue,type,entity}"/> + :treeParams="{label,treeKey,searchValue,type}"/> </template> <a-icon slot="switcherIcon" type="down"/> @@ -73,10 +75,12 @@ import ProcessModal from './Process/ProcessModal' import ProcessStepModal from './ProcessStep/ProcessStepModal' import AssignPermissionModal from './Permission/AssignPermissionModal' +import DeviceCustomTypeModal from '@views/dnc/base/modules/ProductStructure/DeviceCustomType/DeviceCustomTypeModal.vue' export default { name: 'ProductStructureTree', components: { + DeviceCustomTypeModal, AssignPermissionModal, ProcessStepModal, ProcessModal, @@ -100,7 +104,6 @@ autoExpandParent: true, checkStrictly: true, allTreeKeys: [], - currentSelected: {}, rightClickSelected: {}, url: { delete: '/nc/product/delete' @@ -115,10 +118,10 @@ getTreeDataByApi() { this.loading = true this.cardLoading = true + this.treeDataSource = [] dncApi.getProductStructureTreeApi() .then(res => { if (res.success) { - console.log('res=================', res) this.dataList = [] this.allTreeKeys = [] this.treeDataSource = res.result @@ -140,22 +143,62 @@ * @param {node} node 鑺傜偣瀵硅薄 */ handleTreeSelect(selectedKeys, { node }) { + const that = this let record = node.dataRef - this.currentSelected = Object.assign({}, record) - // 鍚戝彸渚х埗绾х粍浠跺彂閫佸綋鍓嶉�変腑鏍戣妭鐐逛俊鎭� - this.$bus.$emit('sendCurrentTreeNodeInfo', this.currentSelected) + const { id, type } = record + dncApi.getProductStructureTreeNodeEntityApi({ id, type }) + .then(res => { + if (res.success) { + let currentSelectedNodeInfo + if (res.result.length > 0) { + currentSelectedNodeInfo = Object.assign({}, record, { entity: res.result[0] }) + } else { + currentSelectedNodeInfo = {} + that.$notification.warning({ + message: '娑堟伅', + description: '鏆傛棤璇ヨ妭鐐硅缁嗕俊鎭�' + }) + } + // 鍚戝彸渚х埗绾х粍浠跺彂閫佸綋鍓嶉�変腑鏍戣妭鐐逛俊鎭� + this.$bus.$emit('sendCurrentTreeNodeInfo', currentSelectedNodeInfo) + } else { + that.$notification.error({ + message: '娑堟伅', + description: res.message + }) + } + }) if (selectedKeys.length === 0) return this.selectedKeys = selectedKeys }, /** * 鏍戣妭鐐瑰彸閿崟鍑昏妭鐐规椂瑙﹀彂 - * @param event 浜嬩欢瀵硅薄 * @param node 鑺傜偣瀵硅薄 */ - handleTreeRightClick({ event, node }) { + handleTreeRightClick({ node }) { + const that = this const record = node.dataRef - this.rightClickSelected = Object.assign({}, record) + const { id, type } = record + dncApi.getProductStructureTreeNodeEntityApi({ id, type }) + .then(res => { + if (res.success) { + if (res.result.length > 0) { + that.rightClickSelected = Object.assign({}, record, { entity: res.result[0] }) + } else { + that.rightClickSelected = {} + that.$notification.warning({ + message: '娑堟伅', + description: '鏆傛棤璇ヨ妭鐐硅缁嗕俊鎭�' + }) + } + } else { + that.$notification.error({ + message: '娑堟伅', + description: res.message + }) + } + }) }, // 鏍戣妭鐐瑰彸閿崟鍑昏彍鍗曚腑鍒犻櫎鎸夐挳鏃惰Е鍙� @@ -216,8 +259,18 @@ this.autoExpandParent = false }, - /* 杈撳叆鏌ヨ鍐呭鍙樺寲鏃惰Е鍙� */ + // 杈撳叆鏌ヨ鍐呭鍙樺寲鏃惰Е鍙戯紙澧炲姞闃叉姈鏈哄埗锛� handleSearchInputChange() { + const that = this + let timer + if (timer) clearTimeout(timer) + timer = setTimeout(function() { + that.searchAndExpandTreeNode() // 鍔犲皬鎷彿璋冪敤鍑芥暟 + }, 1000) + }, + + // 闃叉姈鍑芥暟涓Е鍙戞悳绱㈠苟灞曞紑鏍戣妭鐐� + searchAndExpandTreeNode() { let search = this.searchInput let expandedKeys let autoExpandParent @@ -237,7 +290,6 @@ expandedKeys = this.beforeSearchExpandedKeys autoExpandParent = false } - Object.assign(this, { expandedKeys, searchValue: search, @@ -292,7 +344,7 @@ * @param treeNode */ setTreeNodeIcon(treeNode) { - switch (treeNode.type) { + switch (+treeNode.type) { case 1: treeNode.slots = { icon: 'product' } break -- Gitblit v1.9.3