选择角色为tenant才显示框
This commit is contained in:
@@ -18,7 +18,7 @@ import {
|
||||
updateUser,
|
||||
addUser,
|
||||
} from '@/api/system/user';
|
||||
import { listDept } from '@/api/system/tenant';
|
||||
import { listTenant } from '@/api/system/tenant';
|
||||
|
||||
import { saveAs } from 'file-saver';
|
||||
import useI18n from '@/hooks/useI18n';
|
||||
@@ -238,6 +238,8 @@ type ModalStateType = {
|
||||
visibleByResetPwd: boolean;
|
||||
/**标题 */
|
||||
title: string;
|
||||
/**是否展示tenant框 */
|
||||
showTenant: boolean;
|
||||
/**表单数据 */
|
||||
from: Record<string, any>;
|
||||
/**确定按钮 loading */
|
||||
@@ -252,6 +254,7 @@ let modalState: ModalStateType = reactive({
|
||||
visibleByEdit: false,
|
||||
visibleByResetPwd: false,
|
||||
title: '用户',
|
||||
showTenant: false,
|
||||
from: {
|
||||
userId: undefined,
|
||||
userName: '',
|
||||
@@ -673,6 +676,12 @@ let uploadImportState: ModalUploadImportStateType = reactive({
|
||||
templateDownload: false,
|
||||
});
|
||||
|
||||
function showTenant(value: any, option: any) {
|
||||
modalState.showTenant = option.some(
|
||||
(option: any) => option.roleKey === 'tenant'
|
||||
);
|
||||
}
|
||||
|
||||
/**对话框表格信息导入弹出窗口 */
|
||||
function fnModalUploadImportOpen() {
|
||||
uploadImportState.updateSupport = false;
|
||||
@@ -770,7 +779,7 @@ let deptTreeData = ref<DataNode[]>([]);
|
||||
/**查询部门下拉树结构 */
|
||||
function fnGetDeptTree() {
|
||||
if (deptTreeData.value.length > 0) return;
|
||||
listDept({ parentId: 0 }).then(res => {
|
||||
listTenant({ parentId: 0 }).then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) {
|
||||
res.data.forEach((item: any) => {
|
||||
if (item.parentId === '0') {
|
||||
@@ -1462,6 +1471,7 @@ onMounted(() => {
|
||||
:options="modalState.options.roles"
|
||||
:field-names="{ label: 'roleName', value: 'roleId' }"
|
||||
:placeholder="t('common.selectPlease')"
|
||||
@change="showTenant"
|
||||
>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
@@ -1470,6 +1480,7 @@ onMounted(() => {
|
||||
:label="t('views.system.user.fromTenant')"
|
||||
name="tenantId"
|
||||
:label-col="{ span: 3 }"
|
||||
v-show="modalState.showTenant"
|
||||
>
|
||||
<a-tree-select
|
||||
v-model:value="modalState.from.tenantId"
|
||||
|
||||
Reference in New Issue
Block a user