禁止修改、删除默认租户

This commit is contained in:
数据小王子 2024-02-07 14:23:20 +08:00
parent 656a9b58cf
commit 312f727e9a
3 changed files with 25 additions and 6 deletions

View File

@ -1,5 +1,5 @@
export interface TenantVO extends BaseEntity {
tenantId: number | string;
tenantId: number;
username: string;
contactUserName: string;
contactPhone: string;

View File

@ -62,19 +62,25 @@
</el-table-column>
<el-table-column label="租户状态" align="center" prop="status">
<template #default="scope">
<el-switch v-model="scope.row.status" active-value="0" inactive-value="1" @change="handleStatusChange(scope.row)"></el-switch>
<el-switch
v-if="scope.row.tenantId !== 1"
v-model="scope.row.status"
active-value="0"
inactive-value="1"
@change="handleStatusChange(scope.row)"
></el-switch>
</template>
</el-table-column>
<el-table-column width="150" label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
<template #default="scope">
<el-tooltip v-if="scope.row.tenantId != 0" content="修改" placement="top">
<el-tooltip v-if="scope.row.tenantId != 1" content="修改" placement="top">
<el-button v-hasPermi="['system:tenant:edit']" link type="primary" icon="Edit" @click="handleUpdate(scope.row)"></el-button>
</el-tooltip>
<el-tooltip content="同步套餐" placement="top">
<el-tooltip v-if="scope.row.tenantId != 1" content="同步套餐" placement="top">
<el-button v-hasPermi="['system:tenant:edit']" link type="primary" icon="Refresh" @click="handleSyncTenantPackage(scope.row)">
</el-button>
</el-tooltip>
<el-tooltip content="删除" placement="top">
<el-tooltip v-if="scope.row.tenantId != 1" content="删除" placement="top">
<el-button v-hasPermi="['system:tenant:remove']" link type="primary" icon="Delete" @click="handleDelete(scope.row)"></el-button>
</el-tooltip>
</template>
@ -272,6 +278,19 @@ const handleSelectionChange = (selection: TenantVO[]) => {
ids.value = selection.map((item) => item.tenantId);
single.value = selection.length != 1;
multiple.value = !selection.length;
let defaultTenantCheched = false;
for (let id of ids.value) {
if (id === 1) {
defaultTenantCheched = true;
}
}
if (defaultTenantCheched) {
//
single.value = true;
multiple.value = true;
}
};
/** 新增按钮操作 */

View File

@ -558,7 +558,7 @@ const handleSelectionChange = (selection: UserVO[]) => {
single.value = selection.length != 1;
multiple.value = !selection.length;
var superAdminCheched = false;
let superAdminCheched = false;
for (let id of ids.value) {
if (id === 1) {
superAdminCheched = true;