| | |
| | | <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"/> |
| | |
| | | </div> |
| | | |
| | | <!--产品结构树--> |
| | | <div class="" style="flex: 1;overflow:auto;margin-top: 10px"> |
| | | <a-tree ref="tree" show-icon :checkStrictly="checkStrictly" :expandedKeys.sync="expandedKeys" |
| | | <div style="flex: 1;overflow:auto;margin-top: 10px"> |
| | | <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}"> |
| | |
| | | |
| | | <!--产品弹窗--> |
| | | <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 => { |
| | | console.log('res', res) |
| | | if (res.success) { |
| | | this.dataList = [] |
| | | this.allTreeKeys = [] |
| | |
| | | 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]() |
| | | }, |
| | | |
| | | /** |
| | |
| | | |
| | | /deep/ .ant-card-body, /deep/ .ant-spin-nested-loading, /deep/ .ant-spin-container { |
| | | height: 100%; |
| | | } |
| | | |
| | | /deep/ .ant-tree-node-content-wrapper { |
| | | width: calc(100% - 24px); |
| | | } |
| | | |
| | | /deep/ .ant-tree-title, .ant-tree-title .ant-dropdown-trigger { |