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