2025-06-18 11:03:42 +08:00
|
|
|
import type { FormSchemaGetter } from '#/adapter/form';
|
|
|
|
import type { VxeGridProps } from '#/adapter/vxe-table';
|
|
|
|
|
2025-06-18 16:50:58 +08:00
|
|
|
import { getDictOptions } from '#/utils/dict';
|
|
|
|
import { renderDict } from '#/utils/render';
|
2025-06-18 11:03:42 +08:00
|
|
|
|
|
|
|
export const querySchema: FormSchemaGetter = () => [
|
|
|
|
{
|
|
|
|
component: 'Input',
|
|
|
|
fieldName: 'classificationId',
|
|
|
|
label: '分类id',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
component: 'Input',
|
|
|
|
fieldName: 'roomBookId',
|
|
|
|
label: '预订id',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
component: 'Input',
|
|
|
|
fieldName: 'serveNum',
|
|
|
|
label: '服务数量',
|
|
|
|
},
|
|
|
|
{
|
2025-06-18 16:50:58 +08:00
|
|
|
component: 'Input',
|
2025-06-18 11:03:42 +08:00
|
|
|
fieldName: 'serveType',
|
|
|
|
label: '服务分类',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
component: 'Input',
|
|
|
|
fieldName: 'serveName',
|
|
|
|
label: '产品名称',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
component: 'RadioGroup',
|
|
|
|
componentProps: {
|
2025-06-18 16:50:58 +08:00
|
|
|
// 可选从DictEnum中获取 DictEnum.WY_QRZT 便于维护
|
|
|
|
options: getDictOptions('wy_qrzt'),
|
2025-06-18 11:03:42 +08:00
|
|
|
buttonStyle: 'solid',
|
|
|
|
optionType: 'button',
|
|
|
|
},
|
|
|
|
fieldName: 'serveStatus',
|
|
|
|
label: '预订状态',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
component: 'DatePicker',
|
|
|
|
componentProps: {
|
|
|
|
showTime: true,
|
|
|
|
format: 'YYYY-MM-DD HH:mm:ss',
|
|
|
|
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
|
|
},
|
|
|
|
fieldName: 'beginTime',
|
|
|
|
label: '服务开始时间',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
component: 'DatePicker',
|
|
|
|
componentProps: {
|
|
|
|
showTime: true,
|
|
|
|
format: 'YYYY-MM-DD HH:mm:ss',
|
|
|
|
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
|
|
},
|
|
|
|
fieldName: 'endTime',
|
|
|
|
label: '服务结束时间',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
component: 'Input',
|
|
|
|
fieldName: 'servePrice',
|
|
|
|
label: '服务总价格',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
component: 'Input',
|
|
|
|
fieldName: 'serveImage',
|
|
|
|
label: '产品图片',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
component: 'Input',
|
|
|
|
fieldName: 'sort',
|
|
|
|
label: '排序',
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
|
|
|
// export const columns: () => VxeGridProps['columns'] = () => [
|
|
|
|
export const columns: VxeGridProps['columns'] = [
|
|
|
|
{ type: 'checkbox', width: 60 },
|
|
|
|
{
|
|
|
|
title: '分类id',
|
|
|
|
field: 'classificationId',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '预订id',
|
|
|
|
field: 'roomBookId',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '服务数量',
|
|
|
|
field: 'serveNum',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '服务分类',
|
|
|
|
field: 'serveType',
|
2025-06-18 16:50:58 +08:00
|
|
|
slots: {
|
|
|
|
default: ({ row }) => {
|
|
|
|
// 可选从DictEnum中获取 DictEnum.WY_FWFL 便于维护
|
|
|
|
return renderDict(row.serveType, 'wy_fwfl');
|
|
|
|
},
|
|
|
|
},
|
2025-06-18 11:03:42 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '产品名称',
|
|
|
|
field: 'serveName',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '预订状态',
|
|
|
|
field: 'serveStatus',
|
2025-06-18 16:50:58 +08:00
|
|
|
slots: {
|
|
|
|
default: ({ row }) => {
|
|
|
|
// 可选从DictEnum中获取 DictEnum.WY_QRZT 便于维护
|
|
|
|
return renderDict(row.serveStatus, 'wy_qrzt');
|
|
|
|
},
|
|
|
|
},
|
2025-06-18 11:03:42 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '服务开始时间',
|
|
|
|
field: 'beginTime',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '服务结束时间',
|
|
|
|
field: 'endTime',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '服务总价格',
|
|
|
|
field: 'servePrice',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '产品图片',
|
|
|
|
field: 'serveImage',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '排序',
|
|
|
|
field: 'sort',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'action',
|
|
|
|
fixed: 'right',
|
|
|
|
slots: { default: 'action' },
|
|
|
|
title: '操作',
|
|
|
|
width: 180,
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
export const modalSchema: FormSchemaGetter = () => [
|
|
|
|
{
|
|
|
|
label: 'id',
|
|
|
|
fieldName: 'id',
|
|
|
|
component: 'Input',
|
|
|
|
dependencies: {
|
|
|
|
show: () => false,
|
|
|
|
triggerFields: [''],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '分类id',
|
|
|
|
fieldName: 'classificationId',
|
|
|
|
component: 'Input',
|
2025-06-18 16:50:58 +08:00
|
|
|
rules: 'required',
|
2025-06-18 11:03:42 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '预订id',
|
|
|
|
fieldName: 'roomBookId',
|
|
|
|
component: 'Input',
|
2025-06-18 16:50:58 +08:00
|
|
|
rules: 'required',
|
2025-06-18 11:03:42 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '服务数量',
|
|
|
|
fieldName: 'serveNum',
|
|
|
|
component: 'Input',
|
2025-06-18 16:50:58 +08:00
|
|
|
rules: 'required',
|
2025-06-18 11:03:42 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '服务分类',
|
|
|
|
fieldName: 'serveType',
|
2025-06-18 16:50:58 +08:00
|
|
|
component: 'Input',
|
|
|
|
rules: 'required',
|
2025-06-18 11:03:42 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '产品名称',
|
|
|
|
fieldName: 'serveName',
|
|
|
|
component: 'Input',
|
2025-06-18 16:50:58 +08:00
|
|
|
rules: 'required',
|
2025-06-18 11:03:42 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '预订状态',
|
|
|
|
fieldName: 'serveStatus',
|
|
|
|
component: 'RadioGroup',
|
|
|
|
componentProps: {
|
2025-06-18 16:50:58 +08:00
|
|
|
// 可选从DictEnum中获取 DictEnum.WY_QRZT 便于维护
|
|
|
|
options: getDictOptions('wy_qrzt'),
|
2025-06-18 11:03:42 +08:00
|
|
|
buttonStyle: 'solid',
|
|
|
|
optionType: 'button',
|
|
|
|
},
|
2025-06-18 16:50:58 +08:00
|
|
|
rules: 'selectRequired',
|
2025-06-18 11:03:42 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '服务开始时间',
|
|
|
|
fieldName: 'beginTime',
|
|
|
|
component: 'DatePicker',
|
|
|
|
componentProps: {
|
|
|
|
showTime: true,
|
|
|
|
format: 'YYYY-MM-DD HH:mm:ss',
|
|
|
|
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
|
|
},
|
2025-06-18 16:50:58 +08:00
|
|
|
rules: 'required',
|
2025-06-18 11:03:42 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '服务结束时间',
|
|
|
|
fieldName: 'endTime',
|
|
|
|
component: 'DatePicker',
|
|
|
|
componentProps: {
|
|
|
|
showTime: true,
|
|
|
|
format: 'YYYY-MM-DD HH:mm:ss',
|
|
|
|
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
|
|
},
|
2025-06-18 16:50:58 +08:00
|
|
|
rules: 'required',
|
2025-06-18 11:03:42 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '服务总价格',
|
|
|
|
fieldName: 'servePrice',
|
|
|
|
component: 'Input',
|
2025-06-18 16:50:58 +08:00
|
|
|
rules: 'required',
|
2025-06-18 11:03:42 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '产品图片',
|
|
|
|
fieldName: 'serveImage',
|
|
|
|
component: 'ImageUpload',
|
|
|
|
componentProps: {
|
|
|
|
// accept: 'image/*', // 可选拓展名或者mime类型 ,拼接
|
|
|
|
// maxCount: 1, // 最大上传文件数 默认为1 为1会绑定为string而非string[]类型
|
|
|
|
},
|
2025-06-18 16:50:58 +08:00
|
|
|
rules: 'required',
|
2025-06-18 11:03:42 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '排序',
|
|
|
|
fieldName: 'sort',
|
|
|
|
component: 'Input',
|
2025-06-18 16:50:58 +08:00
|
|
|
rules: 'required',
|
2025-06-18 11:03:42 +08:00
|
|
|
},
|
|
|
|
];
|