mirror of
https://gitee.com/dapppp/ruoyi-plus-vben5.git
synced 2026-04-09 19:23:15 +08:00
fix(用户管理): 修复编辑用户时角色字段验证逻辑
编辑用户时角色字段为必填,新增用户时允许为空。通过添加动态验证规则实现此逻辑。
This commit is contained in:
@@ -198,6 +198,13 @@ export const drawerSchema: FormSchemaGetter = () => [
|
|||||||
},
|
},
|
||||||
fieldName: 'roleIds',
|
fieldName: 'roleIds',
|
||||||
label: '角色',
|
label: '角色',
|
||||||
|
dependencies: {
|
||||||
|
// 后端逻辑为新增可以为空 编辑时不能为空
|
||||||
|
rules: (model) => {
|
||||||
|
return model.userId ? 'selectRequired' : null;
|
||||||
|
},
|
||||||
|
triggerFields: ['userId'],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: 'Textarea',
|
component: 'Textarea',
|
||||||
|
|||||||
Reference in New Issue
Block a user