diff --git a/src/views/system/bindingParts/BindingParts.vue b/src/views/system/bindingParts/BindingParts.vue index 8aa70012..12e9e180 100644 --- a/src/views/system/bindingParts/BindingParts.vue +++ b/src/views/system/bindingParts/BindingParts.vue @@ -196,7 +196,8 @@ export default { }, disableMixinCreated: true, isCanAdd: false, // 是否可以新增 - isCanUseBind: false // 是否有使用绑定关系按钮 + isCanUseBind: false, // 是否有使用绑定关系按钮 + isHaveBindResult: {} // 是否有绑定结果 } }, created () { @@ -204,7 +205,9 @@ export default { const partNo = this.$route.query.partNo || '' const partName = this.$route.query.partName || '' const partCategoryNum = this.$route.query.partCategoryNum || '' - this.judgmentTreeIsHaveBind(partNo, partName, partCategoryNum) + if (partNo && partName && partCategoryNum) { + this.judgmentTreeIsHaveBind(partNo, partName, partCategoryNum) + } // 如果路径中有零部件号,设置查询条件零部件号默认值 if (partNo) { this.queryParam.partNo = partNo @@ -223,7 +226,9 @@ export default { this.loading = true isTreeNodeHaveBind({ partNo, partName, partCategoryNum }).then(res => { if (res.success) { + this.isHaveBindResult = res.result if (res.result) { + this.isCanUseBind = true // 已有绑定标准关联关系 // 在零部件分类下,弹框提示【当前零部件分类结构下已有XXXX绑定标准关联关系,是否引入对应关系?】(XXXX指第一次绑定的零部件名称+编号) this.$confirm({ @@ -231,7 +236,7 @@ export default { content: this.$t('system.bindingParts.haveBind') + res.result.partName + res.result.partNo + this.$t('system.bindingParts.isBringInRelation'), onOk: () => { // 确定引入对应关系,调用使用绑定关系 - useBindingRelationship().then(res => { + useBindingRelationship({ id: res.result.id }).then(res => { if (res.success) { // 重新计算分页问题 this.reCalculatePage(this.selectedRowKeys.length) @@ -245,13 +250,12 @@ export default { onCancel: () => { // 不引入对应关系 this.isCanAdd = false - this.isCanUseBind = false } }) } else { - // 还没有绑定标准关联关系,可以新增 + // 可以新增 this.isCanAdd = true - this.isCanUseBind = true + this.isCanUseBind = false } } }).finally(() => { @@ -265,7 +269,9 @@ export default { content: this.$t('system.bindingParts.isUseBindRelationship'), onOk: () => { this.loading = true - useBindingRelationship().then((res) => { + const param = {} + param.id = this.isHaveBindResult ? this.isHaveBindResult.id : '' + useBindingRelationship(param).then((res) => { if (res.success) { // 重新计算分页问题 this.reCalculatePage(this.selectedRowKeys.length)