限制新增时没有租户数据时取消租户角色

This commit is contained in:
lai
2024-09-27 17:56:41 +08:00
parent da3d712e97
commit a77b968a17
3 changed files with 19 additions and 4 deletions

View File

@@ -1715,6 +1715,7 @@ export default {
lock:'Lock',
inactive:'Inactive',
active:'Active',
permissionTip:'If want to select a tenant role, make sure there is at least one tenant in the tenant management.',
},
config: {
configName: "Config Name",

View File

@@ -1715,6 +1715,7 @@ export default {
lock:'锁定',
inactive:'未激活',
active:'激活',
permissionTip:'若要选择租户角色,需保证起码租户管理中有一个租户',
},
config: {
configName: "参数名称",

View File

@@ -369,6 +369,7 @@ function fnModalVisibleByVive(userId: string | number) {
* @param userId 用户编号ID, 不传为新增
*/
function fnModalVisibleByEdit(userId?: string | number) {
fnGetDeptTree(); // 获取部门树
if (!userId) {
modalStateFrom.resetFields();
if (modalState.confirmLoading) return;
@@ -395,6 +396,17 @@ function fnModalVisibleByEdit(userId?: string | number) {
modalState.from = Object.assign(modalState.from, user);
modalState.from.roleIds = roleIds;
modalState.from.postIds = postIds;
//deptTreeData.value=[];
//若长度为0 删除租户选项
if (deptTreeData.value.length === 0) {
const index = modalState.options.roles.findIndex(
(role: any) => role.roleKey === 'tenant'
);
if (index !== -1) {
modalState.options.roles.splice(index, 1);
}
}
modalState.title =
t('common.addText') + t('views.system.user.userInfo');
modalState.visibleByEdit = true;
@@ -1467,6 +1479,7 @@ onMounted(() => {
name="roleIds"
:label-col="{ span: 3 }"
v-perms:has="['system:user:editRole']"
:help="t('views.system.user.permissionTip')"
>
<a-select
v-model:value="modalState.from.roleIds"