| | |
| | | return { |
| | | title: '', |
| | | width: 700, |
| | | visible: false |
| | | visible: false, |
| | | isAddNextLevel: false // 是否为添加下级,作为树节点是否展开的判断 |
| | | } |
| | | }, |
| | | created() { |
| | |
| | | }, |
| | | methods: { |
| | | /** |
| | | * 添加当前部件零件 |
| | | * @param modalTitle |
| | | * 添加部件下级零件 |
| | | */ |
| | | handleComponentAddChild(modalTitle) { |
| | | this.title = modalTitle |
| | | handleComponentAddChild() { |
| | | this.visible = true |
| | | this.isAddNextLevel = true |
| | | this.$nextTick(() => { |
| | | this.$refs.realForm.add() |
| | | this.$refs.realForm.add({ |
| | | productId: this.currentTreeNodeInfo.rfield, |
| | | componentId: this.currentTreeNodeInfo.id |
| | | }) |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | | * 添加零件 |
| | | * @param modalTitle |
| | | * 点击零件层级添加同级零件 |
| | | */ |
| | | handlePartsAdd(modalTitle) { |
| | | this.title = modalTitle |
| | | handlePartsAdd() { |
| | | this.visible = true |
| | | this.isAddNextLevel = false |
| | | this.$nextTick(() => { |
| | | this.$refs.realForm.add() |
| | | this.$refs.realForm.add({ |
| | | productId: this.currentTreeNodeInfo.rfield, |
| | | componentId: this.currentTreeNodeInfo.parentId |
| | | }) |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | | * 编辑零件信息 |
| | | * @param modalTitle |
| | | */ |
| | | handlePartsEdit(modalTitle) { |
| | | this.title = modalTitle |
| | | handlePartsEdit() { |
| | | this.visible = true |
| | | this.isAddNextLevel = false |
| | | this.$nextTick(() => { |
| | | this.$refs.realForm.edit(this.currentTreeNodeInfo.entity) |
| | | this.$refs.realForm.edit({ id: this.currentTreeNodeInfo.id, ...this.currentTreeNodeInfo.entity }) |
| | | }) |
| | | }, |
| | | |
| | |
| | | }, |
| | | |
| | | submitCallback() { |
| | | this.$emit('ok') |
| | | this.$emit('submitSuccess', this.isAddNextLevel) |
| | | this.visible = false |
| | | }, |
| | | |
| | |
| | | }, |
| | | |
| | | triggerCorrespondingMethod({ methodName, modalTitle }) { |
| | | if (this[methodName]) this[methodName](modalTitle) |
| | | if (this[methodName]) { |
| | | this[methodName](modalTitle) |
| | | this.title = modalTitle |
| | | } |
| | | } |
| | | } |
| | | } |