| | |
| | | :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"/> |
| | |
| | | @submitSuccess="modalFormSubmitSuccess"/> |
| | | <!--引用部件--> |
| | | <NcComponentBorrowModal :currentBorrowInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/> |
| | | |
| | | <!--产品结构树右键菜单(树节点触发)--> |
| | | <product-structure-tree-context-menu ref="mainContextmenuRef" :treeParams="rightClickSelected"/> |
| | | |
| | | <!--产品结构树基本右键菜单(空白处触发)--> |
| | | <ProductStructureBaseContextMenu ref="baseContextmenuRef"/> |
| | | |
| | |
| | | |
| | | /** |
| | | * 树节点右键单击节点时触发 |
| | | * @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 |
| | |
| | | message: '消息', |
| | | description: '暂无该节点详细信息' |
| | | }) |
| | | return |
| | | } |
| | | this.openMainContextMenu(event) |
| | | } else { |
| | | that.$notification.error({ |
| | | message: '消息', |
| | |
| | | okType: 'danger', |
| | | cancelText: '取消', |
| | | onOk: () => { |
| | | if (!url.delete) { |
| | | this.$message.error('请设置url.delete属性!') |
| | | return |
| | | } |
| | | that.loading = true |
| | | deleteAction(url.delete + `/${id}/${type}`) |
| | | .then((res) => { |
| | | if (res.success) { |
| | |
| | | }) |
| | | }, |
| | | |
| | | // 树节点右键单击菜单中删除按钮时触发 |
| | | // 发送nc程序至三维工艺 |
| | | handleSendNcToPlm() { |
| | | const that = this |
| | | const { rightClickSelected: { id, type }, $confirm, url, $notification } = that |
| | |
| | | this.$message.error('请设置url.webServiceDNCToPlm!') |
| | | return |
| | | } |
| | | getAction(url.webServiceDNCToPlm, {id: id}) |
| | | getAction(url.webServiceDNCToPlm, { id: id }) |
| | | .then((res) => { |
| | | if (res.success) { |
| | | that.getTreeDataByApi() |
| | |
| | | }, |
| | | |
| | | /** |
| | | * 打开树节点菜单事件 |
| | | * @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 |
| | |
| | | break |
| | | default: |
| | | } |
| | | }, |
| | | |
| | | // 控制主要右键菜单关闭 |
| | | handleMainContextMenuClose() { |
| | | if (this.$refs.mainContextmenuRef) this.$refs.mainContextmenuRef.menuVisible = false |
| | | document.body.removeEventListener('click', this.handleMainContextMenuClose) |
| | | }, |
| | | |
| | | // 控制基础右键菜单关闭 |
| | |
| | | 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; |