| | |
| | | |
| | | <!--产品结构树--> |
| | | <div style="flex: 1;overflow:auto;margin-top: 10px"> |
| | | <a-tree ref="tree" show-icon :expandedKeys.sync="expandedKeys" |
| | | <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}"> |
| | |
| | | <a-icon slot="product" type="shopping"/> |
| | | <a-icon slot="component" type="camera"/> |
| | | <a-icon slot="part" type="hdd"/> |
| | | <a-icon slot="processSpecVersion" type="tag"/> |
| | | <a-icon slot="process" type="apartment"/> |
| | | <a-icon slot="processStep" type="tool"/> |
| | | </a-tree> |
| | |
| | | <ComponentModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/> |
| | | <!--零件弹窗--> |
| | | <PartModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/> |
| | | <!--工艺规程版本弹窗--> |
| | | <ProcessSpecVersionModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/> |
| | | <!--工序弹窗--> |
| | | <ProcessModal :currentTreeNodeInfo="rightClickSelected" @submitSuccess="modalFormSubmitSuccess"/> |
| | | <!--工步弹窗--> |
| | |
| | | import ProductModal from './Product/ProductModal' |
| | | import ComponentModal from './Component/ComponentModal' |
| | | import PartModal from './Part/PartModal' |
| | | import ProcessSpecVersionModal from './ProcessSpecVersion/ProcessSpecVersionModal' |
| | | import ProcessModal from './Process/ProcessModal' |
| | | import ProcessStepModal from './ProcessStep/ProcessStepModal' |
| | | import AssignPermissionModal from './Permission/AssignPermissionModal' |
| | |
| | | AssignPermissionModal, |
| | | ProcessStepModal, |
| | | ProcessModal, |
| | | ProcessSpecVersionModal, |
| | | PartModal, |
| | | ComponentModal, |
| | | ProductModal, |
| | |
| | | treeDataSource: [], |
| | | selectedKeys: [], |
| | | expandedKeys: [], |
| | | beforeSearchExpandedKeys: [], |
| | | searchValue: '', |
| | | dataList: [], |
| | | autoExpandParent: true, |
| | |
| | | this.treeDataSource = res.list |
| | | this.generateList(this.treeDataSource) |
| | | // this.expandedKeys = this.allTreeKeys |
| | | if (this.expandedKeys.length === 0) this.expandedKeys = [this.treeDataSource[0].id] |
| | | if (this.expandedKeys.length === 0) this.expandedKeys = this.beforeSearchExpandedKeys = [this.treeDataSource[0].id] |
| | | } else { |
| | | this.$message.warn(res.message) |
| | | } |
| | |
| | | |
| | | // 树节点右键单击菜单中删除按钮时触发 |
| | | handleDelete() { |
| | | this.$confirm({ |
| | | const that = this |
| | | const { rightClickSelected: { id, type }, $confirm, url, $notification } = that |
| | | $confirm({ |
| | | title: '提示', |
| | | content: '确认删除此条记录吗?', |
| | | okText: '确认', |
| | | okType: 'danger', |
| | | cancelText: '取消', |
| | | onOk: () => { |
| | | console.log('this.rightClickSelected.id', this.rightClickSelected.id) |
| | | if (!this.url.delete) { |
| | | if (!url.delete) { |
| | | this.$message.error('请设置url.delete属性!') |
| | | return |
| | | } |
| | | const that = this |
| | | deleteAction(that.url.delete, { id: this.rightClickSelected.id }) |
| | | deleteAction(url.delete + `/${id}/${type}`) |
| | | .then((res) => { |
| | | if (res.success) { |
| | | that.getTreeDataByApi() |
| | | that.$notification.success({ |
| | | $notification.success({ |
| | | message: '消息', |
| | | description: res.message |
| | | }) |
| | | } else { |
| | | that.$notification.warning({ |
| | | $notification.warning({ |
| | | message: '消息', |
| | | description: res.message |
| | | }) |
| | | } |
| | | }) |
| | | .finally(() => { |
| | | that.$destroyAll() |
| | | }) |
| | | }, |
| | | onCancel: () => { |
| | | that.$destroyAll() |
| | | } |
| | | }) |
| | | }, |
| | |
| | | * @param expandedKeys 展开项key |
| | | */ |
| | | handleTreeExpand(expandedKeys) { |
| | | this.expandedKeys = expandedKeys |
| | | this.expandedKeys = this.beforeSearchExpandedKeys = expandedKeys |
| | | 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 |
| | | }) |
| | | }, |
| | | |
| | |
| | | case 3: |
| | | treeNode.slots = { icon: 'part' } |
| | | break |
| | | case 4: |
| | | treeNode.slots = { icon: 'processSpecVersion' } |
| | | break |
| | | case 5: |
| | | treeNode.slots = { icon: 'process' } |
| | | break |
| | |
| | | |
| | | /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 { |