57 lines
1.3 KiB
TypeScript
57 lines
1.3 KiB
TypeScript
import type { VbenFormProps } from '#/adapter/form';
|
|
|
|
import { getRoleOption } from '#/views/system/role/api';
|
|
|
|
export const formOptions: VbenFormProps = {
|
|
// 默认展开
|
|
collapsed: false,
|
|
schema: [
|
|
{
|
|
component: 'VbenInput',
|
|
componentProps: {
|
|
placeholder: '输入名称',
|
|
},
|
|
defaultValue: '',
|
|
fieldName: 'nick_name',
|
|
label: '管理员名称',
|
|
},
|
|
{
|
|
component: 'VbenInput',
|
|
componentProps: {
|
|
placeholder: '输入手机号码',
|
|
},
|
|
defaultValue: '',
|
|
fieldName: 'phone',
|
|
label: '手机号码',
|
|
},
|
|
{
|
|
component: 'ApiSelect',
|
|
componentProps: {
|
|
allowClear: true,
|
|
filterOption: true,
|
|
showSearch: true,
|
|
// 菜单接口转options格式
|
|
afterFetch: (data: { id: number; name: string }[]) => {
|
|
return data.map((item: any) => ({
|
|
label: item.name,
|
|
value: item.id,
|
|
}));
|
|
},
|
|
api: getRoleOption,
|
|
placeholder: '请选择',
|
|
},
|
|
fieldName: 'role_id',
|
|
label: '角色',
|
|
},
|
|
],
|
|
// 控制表单是否显示折叠按钮
|
|
showCollapseButton: true,
|
|
submitButtonOptions: {
|
|
content: '查询',
|
|
},
|
|
// 是否在字段值改变时提交表单
|
|
submitOnChange: true,
|
|
// 按下回车时是否提交表单
|
|
submitOnEnter: false,
|
|
};
|