Files
EasyGoAdmin_GoFrame_EleVue/templates/ui/querySchemas.ts.tpl
T
2026-10-20 11:37:25 +08:00

37 lines
1.0 KiB
Smarty
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { FormSchema } from '@/components/Form/index';
/**
* [[$.ModuleComment]]查询表单配置
*
* 定义列表页搜索区域的表单项,字段来自 filter_fields,
* 按字段类型自动选择组件:
* - 字符型用 Input;
* - 带选项的字段用 Select;
* - 纯数字字段用 InputNumber;
* - 日期字段用 DatePicker。
*/
export const schemas: FormSchema[] = [
[[- range .FilterFields]]
{
// [[.Label]]
field: '[[.Name]]',
component: '[[if eq .Type "CharField"]]Input[[else if .Choices]]Select[[else if and (eq .Type "IntegerField") (not .Choices)]]InputNumber[[else if eq .Type "DateField"]]DatePicker[[else]]Input[[end]]',
label: '[[.Label]]',
componentProps: {
placeholder: '请输入[[.Label]]',
clearable: true,
[[- if .Choices]]
// 选项列表:值用于查询,标签用于展示
options: [
[[- range .Choices]]
{
label: '[[.Label]]',
value: [[.Value]],
},
[[- end]]
],
[[- end]]
},
},
[[- end]]
];