From bc55e59f49229ffa77d2b32dd9fd0a9b6049b9b8 Mon Sep 17 00:00:00 2001 From: zhaowei <zhaowei> Date: 星期五, 14 三月 2025 09:44:25 +0800 Subject: [PATCH] 1、设备类管理页面完成增删改查功能 2、产品结构树工序及工步层级引入设备类概念由系统参数配置决定是否展示,若设备类存在时则NC文档挂载在设备类下不存在时则按照对应工序或工步层级下 3、产品结构树工序及工步层级的刀具列表实现增删改查功能 4、新增设备类管理页面并完成布局 5、产品结构树接口调整,产品结构树节点实体信息通过点击后调取接口获取 6、产品结构树搜素输入框增加防抖机制,避免每次输入都重新计算消耗性能使页面卡顿 7、新增工序及工步层级的刀具列表并添加系统权限 8、用户管理页面移除新增用户时的密码校验 9、产品结构树各层级属性信息展示由每行3列调整为每行4列 10、产品结构树页面在工序和工步层级实现对设备类的增删改查功能 --- src/views/dnc/base/modules/DeviceStructure/DeviceStructureTree.vue | 137 ++++++++++++++++++++------------------------- 1 files changed, 60 insertions(+), 77 deletions(-) diff --git a/src/views/dnc/base/modules/DeviceStructure/DeviceStructureTree.vue b/src/views/dnc/base/modules/DeviceStructure/DeviceStructureTree.vue index 56c7ec9..a930ddd 100644 --- a/src/views/dnc/base/modules/DeviceStructure/DeviceStructureTree.vue +++ b/src/views/dnc/base/modules/DeviceStructure/DeviceStructureTree.vue @@ -22,9 +22,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="{ title, parentId, entity, key:treeKey,equipmentId}"> + <template slot="title" slot-scope="{ title, parentId, entity, key:treeKey,equipmentId,type}"> <DeviceStructureTreeContextMenu ref="contextMenuRef" - :treeParams="{title,treeKey,searchValue,equipmentId,entity}"/> + :treeParams="{title,treeKey,searchValue,equipmentId,entity,type,param:currentDeviceDocClassCode}"/> </template> <a-icon slot="switcherIcon" type="down"/> @@ -34,17 +34,21 @@ </div> </div> </a-spin> + + <!--鏉冮檺閰嶇疆寮圭獥--> + <AssignPermissionModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="getTreeDataByApi"/> </a-card> </template> <script> - import { mapActions } from 'vuex' - import { deleteAction } from '@/api/manage' + import dncApi from '@/api/dnc' import DeviceStructureTreeContextMenu from './DeviceStructureTreeContextMenu' + import AssignPermissionModal from './Permission/AssignPermissionModal' export default { name: 'DeviceStructureTree', components: { + AssignPermissionModal, DeviceStructureTreeContextMenu }, data() { @@ -55,6 +59,7 @@ treeDataSource: [], selectedKeys: [], expandedKeys: [], + beforeSearchExpandedKeys: [], searchValue: '', dataList: [], autoExpandParent: true, @@ -62,6 +67,7 @@ allTreeKeys: [], currentSelected: {}, rightClickSelected: {}, + currentDeviceDocClassCode: 'SEND', url: { delete: '/nc/product/delete' } @@ -70,28 +76,34 @@ created() { this.getTreeDataByApi() this.$bus.$on('treeMenuItemMethodTrigger', this.triggerCorrespondingMethod) + this.$bus.$on('handleSwitchDeviceDocClassCode', this.setCurrentDeviceDocClassCode) }, methods: { - ...mapActions(['QueryProduction']), - getTreeDataByApi() { this.loading = true this.cardLoading = true - this.QueryProduction('DNC').then(res => { - if (res.success) { - this.dataList = [] - this.allTreeKeys = [] - this.treeDataSource = res.result - this.generateList(this.treeDataSource) - this.expandedKeys = this.allTreeKeys - this.$bus.$emit('sendCurrentTreeNodeInfo', this.treeDataSource[0]) - } else { - this.$message.warn(res.message) - } - }).finally(() => { - this.loading = false - this.cardLoading = false - }) + dncApi.getDeviceTreeDataApi() + .then(res => { + if (res.success) { + this.dataList = [] + this.allTreeKeys = [] + this.treeDataSource = res.result + this.generateList(this.treeDataSource) + this.expandedKeys = this.beforeSearchExpandedKeys = this.allTreeKeys + this.$bus.$emit('sendDeviceTreeNodeInfo', this.treeDataSource[0]) + } else { + this.$message.warn(res.message) + } + }) + .finally(() => { + this.loading = false + this.cardLoading = false + }) + }, + + setCurrentDeviceDocClassCode(documentActiveTabKey) { + if (documentActiveTabKey === 1) this.currentDeviceDocClassCode = 'SEND' + else this.currentDeviceDocClassCode = 'REC' }, /** @@ -102,9 +114,11 @@ handleTreeSelect(selectedKeys, { node }) { let record = node.dataRef this.currentSelected = Object.assign({}, record) - this.selectedKeys = selectedKeys // 鍚戝彸渚х埗绾х粍浠跺彂閫佸綋鍓嶉�変腑鏍戣妭鐐逛俊鎭� - this.$bus.$emit('sendCurrentTreeNodeInfo', this.currentSelected) + this.$bus.$emit('sendDeviceTreeNodeInfo', this.currentSelected) + if (selectedKeys.length === 0) return + this.selectedKeys = selectedKeys + }, /** @@ -114,50 +128,9 @@ */ handleTreeRightClick({ event, node }) { const record = node.dataRef + // 鑻ュ彸閿椂褰撳墠鍙充晶灞曠ず灞傜骇涓鸿澶囧眰绾т笖褰撳墠鍙抽敭鏍戝眰绾у悓涓鸿澶囧眰绾ф椂鍒欏湪瑙﹀彂鍙抽敭鑿滃崟鍔熻兘鏃跺悓鏃惰Е鍙戝乏閿�変腑鍔熻兘 + if (this.currentSelected.type === 2 && record.type === 2) this.handleTreeSelect([record.key], { node }) this.rightClickSelected = Object.assign({}, record) - }, - - // 鏍戣妭鐐瑰彸閿崟鍑昏彍鍗曚腑鍒犻櫎鎸夐挳鏃惰Е鍙� - handleDelete() { - this.$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.getTreeDataByApi() - 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.getTreeDataByApi() }, /** @@ -165,27 +138,37 @@ * @param expandedKeys 灞曞紑椤筴ey */ handleTreeExpand(expandedKeys) { - this.expandedKeys = expandedKeys + this.expandedKeys = this.beforeSearchExpandedKeys = expandedKeys + console.log('beforeSearchExpandedKeys', this.beforeSearchExpandedKeys) this.autoExpandParent = false }, /* 杈撳叆鏌ヨ鍐呭鍙樺寲鏃惰Е鍙� */ handleSearchInputChange() { let search = this.searchInput - let expandedKeys = this.dataList - .map(item => { - if (item.title != null) { - if (item.title.indexOf(search) > -1) { - return this.getParentKey(item.key, this.treeDataSource) + let expandedKeys + let autoExpandParent + if (search !== '') { + expandedKeys = this.dataList + .map(item => { + if (item.title != null) { + if (item.title.indexOf(search) > -1) { + return this.getParentKey(item.key, this.treeDataSource) + } + return null } - return null - } - }) - .filter((item, i, self) => item && self.indexOf(item) === i) + }) + .filter((item, i, self) => item && self.indexOf(item) === i) + autoExpandParent = true + } else { + expandedKeys = this.beforeSearchExpandedKeys + autoExpandParent = false + } + Object.assign(this, { expandedKeys, searchValue: search, - autoExpandParent: true + autoExpandParent }) }, -- Gitblit v1.9.3