限制新增时没有租户数据时取消租户角色
This commit is contained in:
@@ -1715,6 +1715,7 @@ export default {
|
|||||||
lock:'Lock',
|
lock:'Lock',
|
||||||
inactive:'Inactive',
|
inactive:'Inactive',
|
||||||
active:'Active',
|
active:'Active',
|
||||||
|
permissionTip:'If want to select a tenant role, make sure there is at least one tenant in the tenant management.',
|
||||||
},
|
},
|
||||||
config: {
|
config: {
|
||||||
configName: "Config Name",
|
configName: "Config Name",
|
||||||
|
|||||||
@@ -1715,6 +1715,7 @@ export default {
|
|||||||
lock:'锁定',
|
lock:'锁定',
|
||||||
inactive:'未激活',
|
inactive:'未激活',
|
||||||
active:'激活',
|
active:'激活',
|
||||||
|
permissionTip:'若要选择租户角色,需保证起码租户管理中有一个租户',
|
||||||
},
|
},
|
||||||
config: {
|
config: {
|
||||||
configName: "参数名称",
|
configName: "参数名称",
|
||||||
|
|||||||
@@ -369,6 +369,7 @@ function fnModalVisibleByVive(userId: string | number) {
|
|||||||
* @param userId 用户编号ID, 不传为新增
|
* @param userId 用户编号ID, 不传为新增
|
||||||
*/
|
*/
|
||||||
function fnModalVisibleByEdit(userId?: string | number) {
|
function fnModalVisibleByEdit(userId?: string | number) {
|
||||||
|
fnGetDeptTree(); // 获取部门树
|
||||||
if (!userId) {
|
if (!userId) {
|
||||||
modalStateFrom.resetFields();
|
modalStateFrom.resetFields();
|
||||||
if (modalState.confirmLoading) return;
|
if (modalState.confirmLoading) return;
|
||||||
@@ -395,6 +396,17 @@ function fnModalVisibleByEdit(userId?: string | number) {
|
|||||||
modalState.from = Object.assign(modalState.from, user);
|
modalState.from = Object.assign(modalState.from, user);
|
||||||
modalState.from.roleIds = roleIds;
|
modalState.from.roleIds = roleIds;
|
||||||
modalState.from.postIds = postIds;
|
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 =
|
modalState.title =
|
||||||
t('common.addText') + t('views.system.user.userInfo');
|
t('common.addText') + t('views.system.user.userInfo');
|
||||||
modalState.visibleByEdit = true;
|
modalState.visibleByEdit = true;
|
||||||
@@ -431,7 +443,7 @@ function fnModalVisibleByEdit(userId?: string | number) {
|
|||||||
(role: any) => role.roleKey === 'tenant'
|
(role: any) => role.roleKey === 'tenant'
|
||||||
);
|
);
|
||||||
|
|
||||||
if(modalState.showTenant) fnGetDeptTree();
|
if (modalState.showTenant) fnGetDeptTree();
|
||||||
|
|
||||||
modalState.title =
|
modalState.title =
|
||||||
t('common.editText') + t('views.system.user.userInfo');
|
t('common.editText') + t('views.system.user.userInfo');
|
||||||
@@ -779,8 +791,8 @@ let deptTreeData = ref<DataNode[]>([]);
|
|||||||
|
|
||||||
/**查询部门下拉树结构 */
|
/**查询部门下拉树结构 */
|
||||||
function fnGetDeptTree() {
|
function fnGetDeptTree() {
|
||||||
deptTreeData.value=[]; //reSet
|
deptTreeData.value = []; //reSet
|
||||||
listTenant({ parentId: 0 }).then(res => {
|
listTenant({ parentId: 0 }).then(res => {
|
||||||
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) {
|
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) {
|
||||||
res.data.forEach((item: any) => {
|
res.data.forEach((item: any) => {
|
||||||
if (item.parentId === '0') {
|
if (item.parentId === '0') {
|
||||||
@@ -1467,6 +1479,7 @@ onMounted(() => {
|
|||||||
name="roleIds"
|
name="roleIds"
|
||||||
:label-col="{ span: 3 }"
|
:label-col="{ span: 3 }"
|
||||||
v-perms:has="['system:user:editRole']"
|
v-perms:has="['system:user:editRole']"
|
||||||
|
:help="t('views.system.user.permissionTip')"
|
||||||
>
|
>
|
||||||
<a-select
|
<a-select
|
||||||
v-model:value="modalState.from.roleIds"
|
v-model:value="modalState.from.roleIds"
|
||||||
|
|||||||
Reference in New Issue
Block a user