| | |
| | | <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="queryTreeData">刷新</a-menu-item> |
| | | <a-menu-item key="3" @click="getTreeDataByApi">刷新</a-menu-item> |
| | | </a-menu> |
| | | <a-button> |
| | | <a-icon type="bars"/> |
| | |
| | | |
| | | <!--产品弹窗--> |
| | | <ProductModal ref="productModalFormRef" :currentTreeNodeInfo="rightClickSelected" |
| | | @submitSuccess="queryTreeData"/> |
| | | @submitSuccess="getTreeDataByApi"/> |
| | | <!--部件弹窗--> |
| | | <ComponentModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/> |
| | | <!--零件弹窗--> |
| | |
| | | <ProcessModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/> |
| | | <!--工步弹窗--> |
| | | <ProcessStepModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/> |
| | | <!--权限配置弹窗--> |
| | | <AssignPermissionModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/> |
| | | </a-card> |
| | | </template> |
| | | |
| | |
| | | import PartModal from './Part/PartModal' |
| | | import ProcessModal from './Process/ProcessModal' |
| | | import ProcessStepModal from './ProcessStep/ProcessStepModal' |
| | | import AssignPermissionModal from './Permission/AssignPermissionModal' |
| | | |
| | | export default { |
| | | name: 'ProductStructureTree', |
| | | components: { |
| | | AssignPermissionModal, |
| | | ProcessStepModal, |
| | | ProcessModal, |
| | | PartModal, |
| | |
| | | } |
| | | }, |
| | | created() { |
| | | this.queryTreeData() |
| | | this.getTreeDataByApi() |
| | | this.$bus.$on('treeMenuItemMethodTrigger', this.triggerCorrespondingMethod) |
| | | }, |
| | | methods: { |
| | | queryTreeData() { |
| | | getTreeDataByApi() { |
| | | this.loading = true |
| | | this.cardLoading = true |
| | | dncApi.getProductStructureTreeApi().then(res => { |
| | |
| | | this.rightClickSelected = Object.assign({}, record) |
| | | }, |
| | | |
| | | /** |
| | | * 树节点右键单击菜单中删除按钮时触发 |
| | | */ |
| | | // 树节点右键单击菜单中删除按钮时触发 |
| | | handleDelete() { |
| | | this.$confirm({ |
| | | title: '提示', |
| | |
| | | deleteAction(that.url.delete, { id: this.rightClickSelected.id }) |
| | | .then((res) => { |
| | | if (res.success) { |
| | | that.queryTreeData() |
| | | that.getTreeDataByApi() |
| | | that.$notification.success({ |
| | | message: '消息', |
| | | description: res.message |
| | |
| | | modalFormSubmitSuccess(isAddNextLevel) { |
| | | // 判断是否为添加下级并且判断父节点是否展开 |
| | | if (isAddNextLevel && !this.expandedKeys.includes(this.rightClickSelected.id)) this.expandedKeys.push(this.rightClickSelected.id) |
| | | this.queryTreeData() |
| | | this.getTreeDataByApi() |
| | | }, |
| | | |
| | | /** |
| | |
| | | } |
| | | }, |
| | | |
| | | triggerCorrespondingMethod({ methodName, modalTitle }) { |
| | | if (this[methodName]) this[methodName](modalTitle) |
| | | triggerCorrespondingMethod({ methodName }) { |
| | | if (this[methodName]) this[methodName]() |
| | | }, |
| | | |
| | | /** |