Files
DjangoAdmin_Django_NaiveVue/public/templates/ui/querySchemas.ts.tpl
T
2026-09-12 12:07:15 +08:00

30 lines
893 B
Smarty

import { FormSchema } from '@/components/Form/index';
/**
* 查询表单配置
* 定义搜索区域的表单项
*/
export const schemas: FormSchema[] = [
{% for field in filter_fields %}
{
field: '{{ field.name }}',
component: '{% if field.type == 'CharField' %}NInput{% elif field.choices %}NSelect{% elif field.type == 'IntegerField' and not field.choices %}NInputNumber{% elif field.type == 'DateField' %}NDatePicker{% else %}NInput{% endif %}',
label: '{{ field.label }}',
componentProps: {
placeholder: '请输入{{ field.label }}',
clearable: true,
filterable: {% if field.choices %}true{% else %}false{% endif %},
{% if field.choices %}
options: [
{% for choice in field.choices %}
{
label: '{{ choice.label }}',
value: {{ choice.value }},
},
{% endfor %}
],
{% endif %}
},
},
{% endfor %}
];