fix: 用户岗位和角色指定只能选一个

This commit is contained in:
TsMask
2024-07-08 11:25:10 +08:00
parent 45bf9fe115
commit bc0e463191

View File

@@ -767,6 +767,16 @@ function fnGetDeptTree() {
});
}
/**选择指定只能一个 */
function fnSelectOne(v: string, type: string) {
if (type === 'postId') {
modalState.from.postIds = [v];
}
if (type === 'roleId') {
modalState.from.roleIds = [v];
}
}
onMounted(() => {
// 初始字典数据
Promise.allSettled([
@@ -1355,6 +1365,7 @@ onMounted(() => {
:options="modalState.options.posts"
:field-names="{ label: 'postName', value: 'postId' }"
:placeholder="t('common.selectPlease')"
@select="(value:any) => fnSelectOne(value, 'postId')"
>
</a-select>
</a-form-item>
@@ -1441,6 +1452,7 @@ onMounted(() => {
:options="modalState.options.roles"
:field-names="{ label: 'roleName', value: 'roleId' }"
:placeholder="t('common.selectPlease')"
@select="(value:any) => fnSelectOne(value, 'roleId')"
>
</a-select>
</a-form-item>