[fix 87397] 最后一条数据不应该能删掉

This commit is contained in:
danshihao
2024-07-22 18:13:24 +08:00
parent ad444cc28d
commit c4cc5d126e
@@ -481,6 +481,10 @@ export default {
isMainInterpreterDistribute () {
return mainInterpreterDistributeNodes.includes(this.currentNodeId)
},
// 是否重新分发节点(列表数据可以删空代表不分发)
isReDistribute () {
return this.currentNodeId === StandardInterpretationNodes.standardInterpreterReDistribution.value
},
// 显示导出按钮
showExportBtn () {
return [
@@ -762,6 +766,11 @@ export default {
* @param id - 删除数据的id
*/
handleDelete (id) {
// 判断不能删除所有数据(重新分发节点可以删空)
if (!this.isReDistribute && (this.dataSource.length <= 1)) {
this.$message.warning(this.$t('tableDataDisabledClear'))
return
}
const that = this
this.$confirm({
title: this.$t('confirmDeletion'),
@@ -781,6 +790,11 @@ export default {
* 批量删除
*/
handleBatchDelete () {
// 判断不能删除所有数据(重新分发节点可以删空)
if (!this.isReDistribute && (this.selectedRowKeys.length === this.dataSource.length)) {
this.$message.warning(this.$t('tableDataDisabledClear'))
return
}
// 至少勾选一条数据
if (!this.selectedRowKeys.length) {
this.$message.warning(this.$t('pleaseSelectDeleteData'))