diff --git a/src/common/lang/zh-cn.js b/src/common/lang/zh-cn.js index 18b1d484..396eb917 100644 --- a/src/common/lang/zh-cn.js +++ b/src/common/lang/zh-cn.js @@ -510,7 +510,8 @@ module.exports = { exitEdit: '退出编辑', specialty: '特点', comparisonItem: '比对项', - relatedAccessory: '相关附件' + relatedAccessory: '相关附件', + reserveAnItem: '至少需要保留一项' }, // 标准预警 standardWarning: { diff --git a/src/views/documentTool/customComparison/modules/CustomComparisonDrawer.vue b/src/views/documentTool/customComparison/modules/CustomComparisonDrawer.vue index a281586a..f81f4b28 100644 --- a/src/views/documentTool/customComparison/modules/CustomComparisonDrawer.vue +++ b/src/views/documentTool/customComparison/modules/CustomComparisonDrawer.vue @@ -9,7 +9,7 @@ :maskClosable="false" class="custom-drawer-style"> -
+
@@ -126,7 +126,7 @@
-
+
{{ $t('preservation') }} @@ -217,7 +217,8 @@ export default { standardList: [], // 标准的列表 specialtyItemList: [], // 特点的列表(三级表头) isFirstOpenComparison: true, // 第一次打开在线比对 - countryTreeData: [] // 涉及国家数据 + countryTreeData: [], // 涉及国家数据 + maintainItemList: [] // 维护项列表 } }, watch: { @@ -326,7 +327,6 @@ export default { */ reloadData () { this.getFormData() - this.initTableData() }, async reloadTableHasResult () { await this.initTableData() @@ -402,6 +402,7 @@ export default { // 处理表格数据 // 把比对项的数据放在里面,对比项取proertyVal为显示字段,其余属性用数据本身的 + this.maintainItemList = result.ranksMap.对比项 || [] const maintainItemList = result.ranksMap.对比项 || [] // 有多少对比项决定了有多少行数据 this.dataSource = maintainItemList.map(maintainData => { @@ -428,6 +429,10 @@ export default { * @param id */ handleDeleteSpecialty ({ id }) { + if (this.specialtyItemList.length <= `1`) { + this.$message.warning(this.$t('docTool.customComparison.reserveAnItem')) + return + } this.confirmLoading = true deleteSpecialtyItem({ id }).then(res => { if (res.success) { @@ -445,6 +450,10 @@ export default { * @param record */ handleDeleteMaintainItem (record) { + if (this.maintainItemList.length <= `1`) { + this.$message.warning(this.$t('docTool.customComparison.reserveAnItem')) + return + } this.confirmLoading = true const parmas = { id: record.maintainData.id } deleteMaintainItem(parmas).then(res => { @@ -532,7 +541,7 @@ export default { */ getFormData () { this.confirmLoading = true - getFormDataById({ id: this.modal.id }).then(res => { + getFormDataById({ id: this.modal.id }).then(async res => { if (res.success) { this.modal = Object.assign(this.modal, res.result || {}) // 处理关联国家的回显 @@ -549,6 +558,7 @@ export default { this.$nextTick(() => { this.form.setFieldsValue(this.modal) }) + await this.initTableData() } else { this.$message.warning(res.message) } @@ -584,7 +594,6 @@ export default { */ initTableData () { return new Promise(resolve => { - this.confirmLoading = true getTableData({ infoId: this.modal.id }).then(res => { if (res.success) { // 平铺一些数据 @@ -595,7 +604,6 @@ export default { this.$message.warning(res.message) } }).finally(() => { - this.confirmLoading = false resolve() }) }) @@ -698,4 +706,8 @@ export default { float: right; margin-top: 4px; } + +.no-btn-body { + height: 100%; +} \ No newline at end of file