diff --git a/src/api/api.js b/src/api/api.js index 9475a37b..e0a9119c 100644 --- a/src/api/api.js +++ b/src/api/api.js @@ -144,6 +144,10 @@ const getSplitStandardList = (params) => getAction('/laws/bindPart/selectStandar const getClauseTree = (params) => getAction('/laws/bindPart/clauseTree', params) // 根据标准拆分id获取条款列表 const getClauseListByStandardInfoId = (params) => postAction('/laws/bindPart/selectClause', params) +// 绑定零部件-判断分类树下有没有绑定关系 +const isTreeNodeHaveBind = (params) => getAction('/laws/bindPart/isShowUseBindRelation', params) +// 绑定零部件-使用绑定关系 +const useBindingRelationship = (params) => postAction('/laws/bindPart/useBindRelation', params) // ASMS接口管理-新增 const addAsmsInterface = (params) => postAction('/docking/asms/api/lawsAsmsOpenApi/add', params) @@ -235,6 +239,8 @@ export { getSplitStandardList, getClauseTree, getClauseListByStandardInfoId, + isTreeNodeHaveBind, + useBindingRelationship, getSSOUserInfo, getTodoSSOUserInfo, diff --git a/src/common/lang/system/zh.js b/src/common/lang/system/zh.js index f059fc95..f26ba493 100644 --- a/src/common/lang/system/zh.js +++ b/src/common/lang/system/zh.js @@ -103,6 +103,9 @@ module.exports = { clauseNumber: '条款号', bindingTime: '绑定时间', confirmUseBindRelationship: '确认使用绑定关系', - isUseBindRelationship: '是否使用绑定关系?' + isUseBindRelationship: '是否使用绑定关系?', + isBringIn: '是否引入', + haveBind: '当前零部件分类结构下已有', + isBringInRelation: '绑定标准关联关系,是否引入对应关系?' } } diff --git a/src/views/system/bindingParts/BindingParts.vue b/src/views/system/bindingParts/BindingParts.vue index f5b36d3c..d91fd114 100644 --- a/src/views/system/bindingParts/BindingParts.vue +++ b/src/views/system/bindingParts/BindingParts.vue @@ -63,11 +63,11 @@
- {{ $t('newlyAdded') }} + {{ $t('newlyAdded') }} {{ $t('batchDelete') }} - + {{ $t('system.bindingParts.useBindingRelationship') }}
@@ -123,7 +123,7 @@ import JTable from '../../../components/jero/JTable' import BingingPartsModal from './modules/BingingPartsModal' import ClauseModal from './modules/ClauseModal' import { isHasPermission } from '../../../utils/hasPermission' -// import { postAction } from '../../../api/manage' +import { isTreeNodeHaveBind, useBindingRelationship } from '../../../api/api' export default { name: 'BindingParts', @@ -192,41 +192,93 @@ export default { url: { list: '/laws/bindPart/page', deleteBatch: '/laws/bindPart/deleteBatch', - delete: '/laws/bindPart/delete', - useBindingRelationship: '' // 使用绑定关系 - } + delete: '/laws/bindPart/delete' + }, + disableMixinCreated: true, + isCanAdd: false, // 是否可以新增 + isCanUseBind: false // 是否有使用绑定关系按钮 } }, + created () { + // 判断分类树下有没有绑定关系 + 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) { + this.queryParam.partNo = partNo + } + this.loadData() + }, methods: { isHasPermission, + /** + * 判断分类树下有没有绑定关系,传入零部件分类内部码 + * @param partCategoryNum 分类内部码 + * @param noBindCallback 没有绑定的callback + * @param bindCallback 绑定过的callback + */ + judgmentTreeIsHaveBind (partNo, partName, partCategoryNum) { + this.loading = true + isTreeNodeHaveBind({ partNo, partName, partCategoryNum }).then(res => { + if (res.success) { + if (res.result) { + // 已有绑定标准关联关系 + // 在零部件分类下,弹框提示【当前零部件分类结构下已有XXXX绑定标准关联关系,是否引入对应关系?】(XXXX指第一次绑定的零部件名称+编号) + this.$confirm({ + title: this.$t('system.bindingParts.isBringIn'), + content: this.$t('system.bindingParts.haveBind') + res.result.bindPartName + res.result.bindPartNumber + this.$t('system.bindingParts.isBringInRelation'), + onOk: () => { + // 确定引入对应关系,调用使用绑定关系 + useBindingRelationship().then(res => { + if (res.success) { + // 重新计算分页问题 + this.reCalculatePage(this.selectedRowKeys.length) + this.$message.success(res.message) + this.loadData() + } else { + this.$message.warning(res.message) + } + }) + }, + onCancel: () => { + // 不引入对应关系 + this.isCanAdd = false + this.isCanUseBind = false + } + }) + } else { + // 还没有绑定标准关联关系,可以新增 + this.isCanAdd = true + this.isCanUseBind = true + } + } + }).finally(() => { + this.loading = false + }) + }, // 使用绑定关系 useBindingRelationship () { - // if (this.selectedRowKeys.length <= 0) { - // this.$message.warning(this.$t('selectARecord')) - // } else { - // const ids = this.selectedRowKeys.join(',') - // const that = this - // this.$confirm({ - // title: this.$t('system.bindingParts.confirmUseBindRelationship'), - // content: this.$t('system.bindingParts.isUseBindRelationship'), - // onOk: () => { - // that.loading = true - // postAction(that.url.useBindingRelationship, { ids: ids }).then((res) => { - // if (res.success) { - // // 重新计算分页问题 - // that.reCalculatePage(that.selectedRowKeys.length) - // that.$message.success(res.message) - // that.loadData() - // that.onClearSelected() - // } else { - // that.$message.warning(res.message) - // } - // }).finally(() => { - // that.loading = false - // }) - // } - // }) - // } + this.$confirm({ + title: this.$t('system.bindingParts.confirmUseBindRelationship'), + content: this.$t('system.bindingParts.isUseBindRelationship'), + onOk: () => { + this.loading = true + useBindingRelationship().then((res) => { + if (res.success) { + // 重新计算分页问题 + this.reCalculatePage(this.selectedRowKeys.length) + this.$message.success(res.message) + this.loadData() + } else { + this.$message.warning(res.message) + } + }).finally(() => { + this.loading = false + }) + } + }) }, // 点击标准编号和标准名称 handleGoDetail (record) {