fix: 用户新增即时获取用户角色数据
This commit is contained in:
@@ -11,7 +11,7 @@ VITE_APP_NAME = "核心网管理系统"
|
||||
VITE_APP_CODE = "CoreNet"
|
||||
|
||||
# 应用版本
|
||||
VITE_APP_VERSION = "1.23.1018"
|
||||
VITE_APP_VERSION = "1.23.1021"
|
||||
|
||||
# 接口基础URL地址-不带/后缀
|
||||
VITE_API_BASE_URL = "/omc-api"
|
||||
|
||||
@@ -218,12 +218,6 @@ type OptionsType = {
|
||||
roles: Record<string, any>[];
|
||||
};
|
||||
|
||||
/**初始用户选择列表 */
|
||||
let options: OptionsType = {
|
||||
posts: [],
|
||||
roles: [],
|
||||
};
|
||||
|
||||
/**对话框对象信息状态类型 */
|
||||
type ModalStateType = {
|
||||
/**详情框是否显示 */
|
||||
@@ -363,45 +357,36 @@ function fnModalVisibleByVive(userId: string | number) {
|
||||
function fnModalVisibleByEdit(userId?: string | number) {
|
||||
if (!userId) {
|
||||
modalStateFrom.resetFields();
|
||||
if (options.roles.length > 0) {
|
||||
modalState.options.roles = options.roles;
|
||||
modalState.options.posts = options.posts;
|
||||
modalState.title = '添加用户信息';
|
||||
modalState.visibleByEdit = true;
|
||||
} else {
|
||||
if (modalState.confirmLoading) return;
|
||||
const hide = message.loading('正在打开...', 0);
|
||||
modalState.confirmLoading = true;
|
||||
// 查询用户详细获取岗位和角色列表
|
||||
getUser().then(res => {
|
||||
modalState.confirmLoading = false;
|
||||
hide();
|
||||
if (res.code === RESULT_CODE_SUCCESS && res.data) {
|
||||
const roles = res.data.roles.map((m: Record<string, any>) => {
|
||||
const disabled = m.status === '0';
|
||||
Reflect.set(m, 'disabled', disabled);
|
||||
return m;
|
||||
});
|
||||
const posts = res.data.posts.map((m: Record<string, any>) => {
|
||||
const disabled = m.status === '0';
|
||||
Reflect.set(m, 'disabled', disabled);
|
||||
return m;
|
||||
});
|
||||
options.roles = roles;
|
||||
options.posts = posts;
|
||||
modalState.options.roles = roles;
|
||||
modalState.options.posts = posts;
|
||||
const { user, roleIds, postIds } = res.data;
|
||||
modalState.from = Object.assign(modalState.from, user);
|
||||
modalState.from.roleIds = roleIds;
|
||||
modalState.from.postIds = postIds;
|
||||
modalState.title = '添加用户信息';
|
||||
modalState.visibleByEdit = true;
|
||||
} else {
|
||||
message.error('获取用户信息失败', 2);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (modalState.confirmLoading) return;
|
||||
const hide = message.loading('正在打开...', 0);
|
||||
modalState.confirmLoading = true;
|
||||
// 查询用户详细获取岗位和角色列表
|
||||
getUser().then(res => {
|
||||
modalState.confirmLoading = false;
|
||||
hide();
|
||||
if (res.code === RESULT_CODE_SUCCESS && res.data) {
|
||||
const roles = res.data.roles.map((m: Record<string, any>) => {
|
||||
const disabled = m.status === '0';
|
||||
Reflect.set(m, 'disabled', disabled);
|
||||
return m;
|
||||
});
|
||||
const posts = res.data.posts.map((m: Record<string, any>) => {
|
||||
const disabled = m.status === '0';
|
||||
Reflect.set(m, 'disabled', disabled);
|
||||
return m;
|
||||
});
|
||||
modalState.options.roles = roles;
|
||||
modalState.options.posts = posts;
|
||||
const { user, roleIds, postIds } = res.data;
|
||||
modalState.from = Object.assign(modalState.from, user);
|
||||
modalState.from.roleIds = roleIds;
|
||||
modalState.from.postIds = postIds;
|
||||
modalState.title = '添加用户信息';
|
||||
modalState.visibleByEdit = true;
|
||||
} else {
|
||||
message.error('获取用户信息失败', 2);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (modalState.confirmLoading) return;
|
||||
const hide = message.loading('正在打开...', 0);
|
||||
|
||||
Reference in New Issue
Block a user