37 lines
1.0 KiB
Smarty
37 lines
1.0 KiB
Smarty
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]]
|
||
]; |