feat(form-create): 【antd/ele】表单选择器支持默认选中当前用户/部门
- UserSelect 组件新增 defaultCurrentUser 配置,支持默认选中当前登录用户 - DeptSelect 组件重构为独立的树形选择器,支持 defaultCurrentDept 配置 - DeptSelect 支持 returnType 配置,可返回部门 ID 或部门名称 - 修复 useSelectRule 未将自定义 props 默认值传递给组件的问题 - 修复 DeptSelect 数据加载完成前回显失败的问题 - 同时支持 web-antd 和 web-ele 两个应用
This commit is contained in:
@@ -23,13 +23,24 @@ export function useSelectRule(option: SelectRuleOption) {
|
||||
name,
|
||||
event: option.event,
|
||||
rule() {
|
||||
return {
|
||||
// 构建基础规则
|
||||
const baseRule: any = {
|
||||
type: name,
|
||||
field: buildUUID(),
|
||||
title: label,
|
||||
info: '',
|
||||
$required: false,
|
||||
};
|
||||
// 将自定义 props 的默认值添加到 rule 的 props 中
|
||||
if (option.props && option.props.length > 0) {
|
||||
baseRule.props = {};
|
||||
option.props.forEach((prop: any) => {
|
||||
if (prop.field && prop.value !== undefined) {
|
||||
baseRule.props[prop.field] = prop.value;
|
||||
}
|
||||
});
|
||||
}
|
||||
return baseRule;
|
||||
},
|
||||
props(_: any, { t }: any) {
|
||||
if (!option.props) {
|
||||
|
||||
Reference in New Issue
Block a user