147 lines
2.9 KiB
TypeScript
147 lines
2.9 KiB
TypeScript
import type { FormSchemaGetter } from '#/adapter/form';
|
|
import type { VxeGridProps } from '#/adapter/vxe-table';
|
|
|
|
import { getDictOptions } from '#/utils/dict';
|
|
import { renderDict } from '#/utils/render';
|
|
|
|
export const querySchema: FormSchemaGetter = () => [
|
|
{
|
|
component: 'Input',
|
|
fieldName: 'planName',
|
|
label: '方案名称',
|
|
},
|
|
{
|
|
component: 'Select',
|
|
fieldName: 'rentalPeriod',
|
|
label: '租赁周期',
|
|
componentProps: {
|
|
options:[
|
|
{ label: '月', value: 0 },
|
|
{ label: '季度', value: 1 },
|
|
{ label: '年', value: 2 },
|
|
]
|
|
},
|
|
},
|
|
{
|
|
component: 'Select',
|
|
componentProps: {
|
|
// 可选从DictEnum中获取 DictEnum.WY_KG 便于维护
|
|
options: getDictOptions('wy_kg'),
|
|
},
|
|
fieldName: 'state',
|
|
label: '状态',
|
|
},
|
|
];
|
|
|
|
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
|
// export const columns: () => VxeGridProps['columns'] = () => [
|
|
export const columns: VxeGridProps['columns'] = [
|
|
{
|
|
title: '序号',
|
|
field: 'id',
|
|
},
|
|
{
|
|
title: '方案名称',
|
|
field: 'planName',
|
|
},
|
|
{
|
|
title: '租赁周期',
|
|
field: 'rentalPeriod',
|
|
},
|
|
{
|
|
title: '适用场景',
|
|
field: 'scene',
|
|
},
|
|
{
|
|
title: '植物组合包',
|
|
field: 'scene',
|
|
},
|
|
{
|
|
title: '基础服务项',
|
|
field: 'scene',
|
|
},
|
|
{
|
|
title: '价格',
|
|
field: 'price',
|
|
},
|
|
{
|
|
title: '状态',
|
|
field: 'state',
|
|
slots: {
|
|
default: ({ row }) => {
|
|
// 可选从DictEnum中获取 DictEnum.WY_KG 便于维护
|
|
return renderDict(row.state, 'wy_kg');
|
|
},
|
|
},
|
|
},
|
|
{
|
|
title: '备注',
|
|
field: 'remarks',
|
|
},
|
|
{
|
|
field: 'action',
|
|
fixed: 'right',
|
|
slots: { default: 'action' },
|
|
title: '操作',
|
|
width: 180,
|
|
},
|
|
];
|
|
|
|
export const modalSchema: FormSchemaGetter = () => [
|
|
{
|
|
label: '方案名称',
|
|
fieldName: 'planName',
|
|
component: 'Input',
|
|
rules: 'required',
|
|
},
|
|
{
|
|
label: '租赁周期',
|
|
fieldName: 'rentalPeriod',
|
|
component: 'Select',
|
|
rules: 'required',
|
|
componentProps: {
|
|
options:[
|
|
{ label: '月', value: 0 },
|
|
{ label: '季度', value: 1 },
|
|
{ label: '年', value: 2 },
|
|
]
|
|
},
|
|
},
|
|
{
|
|
label: '适用场景',
|
|
fieldName: 'scene',
|
|
component: 'Input',
|
|
rules: 'required',
|
|
},
|
|
{
|
|
label: '价格体系',
|
|
fieldName: 'price',
|
|
component: 'Input',
|
|
},
|
|
{
|
|
label: '基础服务项',
|
|
fieldName: 'price',
|
|
component: 'Select',
|
|
},
|
|
{
|
|
label: '优惠活动',
|
|
fieldName: 'price',
|
|
component: 'Input',
|
|
},
|
|
{
|
|
label: '状态',
|
|
fieldName: 'state',
|
|
component: 'Select',
|
|
componentProps: {
|
|
// 可选从DictEnum中获取 DictEnum.WY_KG 便于维护
|
|
options: getDictOptions('wy_kg'),
|
|
},
|
|
rules: 'selectRequired',
|
|
},
|
|
{
|
|
label: '备注',
|
|
fieldName: 'remarks',
|
|
component: 'Input',
|
|
},
|
|
];
|