import moment from 'moment' import type { BasicColumn, FormSchema } from '@/components/Table' import { DICT_TYPE, getDictOptions } from '@/utils/dict' export const columns: BasicColumn[] = [ { title: '编号', dataIndex: 'serialNumber', width: 50, }, { title: '测点编码', dataIndex: 'itemName', width: 150, }, { title: '测点名称', dataIndex: 'descriptor', width: 170, }, { title: '实时值', dataIndex: 'value', width: 55, className: 'value', slots: { customRender: 'value' }, }, { title: '单位', dataIndex: 'engUnits', width: 35, }, { title: '组别', dataIndex: 'groupName', width: 50, }, ] export const searchFormSchema: FormSchema[] = [ { label: '测点名称或测点描述', field: 'condition', component: 'Input', defaultValue: '', required: true, colProps: { span: 8 }, }, ] export const formSchema: FormSchema[] = [ { label: '测点编码', field: 'ItemName', required: true, component: 'Input', }, { label: '测点描述', field: 'Descriptor', required: true, component: 'Input', }, { label: '单位', field: 'EngUnits', required: true, component: 'Input', }, { label: '组名', field: 'GroupName', component: 'Select', componentProps: { options: getDictOptions(DICT_TYPE.COMMON_STATUS), }, required: true, }, { label: '类型', field: 'ItemType', component: 'Select', componentProps: { options: [{ value: 1, label: 1 }, { value: 2, label: 2 }, { value: 3, label: 3 }, { value: 4, label: 4 }, { value: 5, label: 5 }], }, required: true, }, { label: '自动保存', field: 'AutoSave', component: 'Select', componentProps: { options: [{ value: 1, label: '是' }, { value: 2, label: '否' }], }, required: true, }, { label: '数据来源', field: 'Source', component: 'Input', }, ] export const formHistory: FormSchema[] = [ { label: '时间', field: 'time', show: true, component: 'RangePicker', componentProps: { placeholder: ['开始时间', '结束时间'], defaultValue: [moment().subtract(1, 'day').format('YYYY-MM-DD HH:mm:ss'), moment().format('YYYY-MM-DD HH:mm:ss')], valueFormat: 'YYYY-MM-DD HH:mm:ss', showTime: { defaultValue: [moment().subtract(1, 'day').format('YYYY-MM-DD HH:mm:ss'), moment().format('YYYY-MM-DD HH:mm:ss')], }, onChange: (e: any) => { console.log(e) }, }, }, ]