限制新增时没有租户数据时取消租户角色
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -1715,6 +1715,7 @@ export default {
|
||||
lock:'锁定',
|
||||
inactive:'未激活',
|
||||
active:'激活',
|
||||
permissionTip:'若要选择租户角色,需保证起码租户管理中有一个租户',
|
||||
},
|
||||
config: {
|
||||
configName: "参数名称",
|
||||
|
||||
@@ -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;
|
||||
@@ -431,8 +443,8 @@ function fnModalVisibleByEdit(userId?: string | number) {
|
||||
(role: any) => role.roleKey === 'tenant'
|
||||
);
|
||||
|
||||
if(modalState.showTenant) fnGetDeptTree();
|
||||
|
||||
if (modalState.showTenant) fnGetDeptTree();
|
||||
|
||||
modalState.title =
|
||||
t('common.editText') + t('views.system.user.userInfo');
|
||||
modalState.visibleByEdit = true;
|
||||
@@ -779,8 +791,8 @@ let deptTreeData = ref<DataNode[]>([]);
|
||||
|
||||
/**查询部门下拉树结构 */
|
||||
function fnGetDeptTree() {
|
||||
deptTreeData.value=[]; //reSet
|
||||
listTenant({ parentId: 0 }).then(res => {
|
||||
deptTreeData.value = []; //reSet
|
||||
listTenant({ parentId: 0 }).then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) {
|
||||
res.data.forEach((item: any) => {
|
||||
if (item.parentId === '0') {
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user