fix: 用户管理 更新用户时打开drawer需要加载该部门下的岗位信息
This commit is contained in:
parent
938ccd85f8
commit
fb79029765
@ -20,6 +20,7 @@
|
|||||||
- 岗位管理 部门参数错误
|
- 岗位管理 部门参数错误
|
||||||
- 角色管理 菜单分配 节点独立下的回显及提交问题
|
- 角色管理 菜单分配 节点独立下的回显及提交问题
|
||||||
- 租户管理 套餐管理 回显时候`已选中节点`数量为0
|
- 租户管理 套餐管理 回显时候`已选中节点`数量为0
|
||||||
|
- 用户管理 更新用户时打开drawer需要加载该部门下的岗位信息
|
||||||
|
|
||||||
**OTHERS**
|
**OTHERS**
|
||||||
|
|
||||||
|
@ -60,6 +60,24 @@ function genRoleOptionlabel(role: Role) {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 岗位的加载
|
||||||
|
*/
|
||||||
|
async function setupPostOptions(deptId: number | string) {
|
||||||
|
const postListResp = await postOptionSelect(deptId);
|
||||||
|
const options = postListResp.map((item) => ({
|
||||||
|
label: item.postName,
|
||||||
|
value: item.postId,
|
||||||
|
}));
|
||||||
|
const placeholder = options.length > 0 ? '请选择' : '该部门下暂无岗位';
|
||||||
|
formApi.updateSchema([
|
||||||
|
{
|
||||||
|
componentProps: { options, placeholder },
|
||||||
|
fieldName: 'postIds',
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化部门选择
|
* 初始化部门选择
|
||||||
*/
|
*/
|
||||||
@ -80,22 +98,7 @@ async function setupDeptSelect() {
|
|||||||
getPopupContainer,
|
getPopupContainer,
|
||||||
async onSelect(deptId: number | string) {
|
async onSelect(deptId: number | string) {
|
||||||
/** 根据部门ID加载岗位 */
|
/** 根据部门ID加载岗位 */
|
||||||
const postListResp = await postOptionSelect(deptId);
|
await setupPostOptions(deptId);
|
||||||
const options = postListResp.map((item) => ({
|
|
||||||
label: item.postName,
|
|
||||||
value: item.postId,
|
|
||||||
}));
|
|
||||||
const placeholder =
|
|
||||||
options.length > 0 ? '请选择' : '该部门下暂无岗位';
|
|
||||||
/**
|
|
||||||
* TODO: 可以考虑加上post编码
|
|
||||||
*/
|
|
||||||
formApi.updateSchema([
|
|
||||||
{
|
|
||||||
componentProps: { options, placeholder },
|
|
||||||
fieldName: 'postIds',
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
/** 变化后需要重新选择岗位 */
|
/** 变化后需要重新选择岗位 */
|
||||||
formModel.postIds = [];
|
formModel.postIds = [];
|
||||||
},
|
},
|
||||||
@ -185,6 +188,8 @@ const [BasicDrawer, drawerApi] = useVbenDrawer({
|
|||||||
// 添加角色和岗位
|
// 添加角色和岗位
|
||||||
formApi.setFieldValue('postIds', postIds),
|
formApi.setFieldValue('postIds', postIds),
|
||||||
formApi.setFieldValue('roleIds', roleIds),
|
formApi.setFieldValue('roleIds', roleIds),
|
||||||
|
// 更新时不会触发onSelect 需要手动调用
|
||||||
|
setupPostOptions(user.deptId),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
drawerApi.drawerLoading(false);
|
drawerApi.drawerLoading(false);
|
||||||
|
Loading…
Reference in New Issue
Block a user