82 lines
1.8 KiB
TypeScript
82 lines
1.8 KiB
TypeScript
import type { FormSchemaGetter } from '#/adapter/form';
|
|
import type { VxeGridProps } from '#/adapter/vxe-table';
|
|
import {getDictOptions} from "#/utils/dict";
|
|
import dayjs from 'dayjs';
|
|
|
|
export const querySchema: FormSchemaGetter = () => [
|
|
{
|
|
component: 'Select',
|
|
componentProps: {
|
|
options: getDictOptions('pro_qoq_type'),
|
|
},
|
|
fieldName: 'date',
|
|
label: '日期',
|
|
defaultValue: '0',
|
|
},
|
|
{
|
|
component: 'DatePicker',
|
|
componentProps: (formData) => {
|
|
const type: 0 | 1 | 2 | 3 = formData.date ?? 0;
|
|
const today = dayjs();
|
|
const propsMap = {
|
|
0: {
|
|
picker: 'date',
|
|
format: 'YYYY-MM-DD',
|
|
valueFormat: 'YYYY-MM-DD',
|
|
showTime: false,
|
|
defaultValue: today.format('YYYY-MM-DD'),
|
|
},
|
|
1: {
|
|
picker: 'week',
|
|
format: 'YYYY-MM-DD',
|
|
valueFormat: 'YYYY-MM-DD',
|
|
showTime: false,
|
|
defaultValue: today.startOf('week').format('YYYY-MM-DD'),
|
|
},
|
|
2: {
|
|
picker: 'month',
|
|
format: 'YYYY-MM',
|
|
valueFormat: 'YYYY-MM',
|
|
showTime: false,
|
|
defaultValue: today.format('YYYY-MM'),
|
|
},
|
|
3: {
|
|
picker: 'year',
|
|
format: 'YYYY',
|
|
valueFormat: 'YYYY',
|
|
showTime: false,
|
|
defaultValue: today.format('YYYY'),
|
|
},
|
|
};
|
|
return propsMap[type];
|
|
},
|
|
fieldName: 'chioceDate',
|
|
dependencies: {
|
|
triggerFields: ['date'],
|
|
},
|
|
},
|
|
];
|
|
|
|
export const columns: VxeGridProps['columns'] = [
|
|
{
|
|
title: '能源节点',
|
|
field: 'roomNumber',
|
|
},
|
|
{
|
|
title: '当月用能(kw.h)',
|
|
field: 'chargeItem',
|
|
},
|
|
{
|
|
title: '上月用能(kw.h)',
|
|
field: 'chargeCycle',
|
|
},
|
|
{
|
|
title: '增加值(kw.h)',
|
|
field: 'startTime',
|
|
},
|
|
{
|
|
title: '环比(%)',
|
|
field: 'endTime',
|
|
},
|
|
];
|