This commit is contained in:
zlwu committed 2026-06-29 11:15:39 +08:00
1 parent 493f8d6756
commit d84f4b944c
406 files changed
+58954 -10376

No files matched your search

+18 -3
View File
@@ -40,7 +40,8 @@
<el-button
class="btn-ghost"
type="danger"
:disabled="deletableSelection.length === 0"
:disabled="deletableSelection.length === 0 || !allRowsDeletableByCreator(deletableSelection)"
:title="allRowsDeletableByCreator(deletableSelection) ? '' : CREATOR_DELETE_TIP"
@click="handleBatchDelete"
>
批量删除
@@ -141,7 +142,7 @@
<el-dropdown-item command="edit">
<el-icon><Edit /></el-icon>编辑
</el-dropdown-item>
<el-dropdown-item command="delete" divided :disabled="isDefaultTenantRow(row)">
<el-dropdown-item command="delete" divided :disabled="isDefaultTenantRow(row) || !canDeleteByCreator(row)">
<el-icon><Delete /></el-icon>删除
</el-dropdown-item>
</el-dropdown-menu>
@@ -229,6 +230,7 @@
<script setup lang="ts">
import { ref, reactive, onMounted, computed } from 'vue'
import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
import { ElMessage, ElMessageBox } from 'element-plus'
import {
Plus,
@@ -424,6 +426,10 @@
}
async function handleDelete(row: Api.Tenant.TenantItem) {
if (!canDeleteByCreator(row)) {
ElMessage.warning(CREATOR_DELETE_TIP)
return
}
if (isDefaultTenantRow(row)) {
ElMessage.warning('默认租户不可删除')
return
@@ -434,7 +440,16 @@
}
async function handleBatchDelete() {
const ids = deletableSelection.value.map((r) => r.id)
const rows = filterDeletableByCreator(deletableSelection.value)
if (!rows.length) {
ElMessage.warning(CREATOR_DELETE_TIP)
return
}
if (rows.length < deletableSelection.value.length) {
ElMessage.warning(CREATOR_DELETE_TIP)
return
}
const ids = rows.map((r) => r.id)
if (!ids.length) {
ElMessage.warning('所选中含默认租户或无可删项,请重新选择')
return