import dayjs from 'dayjs'; import { BasicTableProps, PaginationProps, FormProps, FormSchema } from '/@/components/Table'; // import { getAutoScrollContainer } from '/@/utils/common/compUtils'; /** * 默认的查询表单项props * * @param dictCode 字典编码,用于初始化子设备下拉框 * @param deviceOptions 设备编码,用于初始化设备下拉框 * @returns */ export const getDefaultSchemas: (dictCode: any[], deviceOptions: any[]) => FormSchema[] = (dictOptions: any[], deviceOptions: any[]) => [ { field: 'ttime_begin', label: '开始时间', component: 'DatePicker', defaultValue: dayjs().startOf('date'), required: true, componentProps: { showTime: true, valueFormat: 'YYYY-MM-DD HH:mm:ss', // getPopupContainer: getAutoScrollContainer, }, colProps: { span: 4, }, }, { field: 'ttime_end', label: '结束时间', component: 'DatePicker', defaultValue: dayjs(), required: true, componentProps: { showTime: true, valueFormat: 'YYYY-MM-DD HH:mm:ss', // getPopupContainer: getAutoScrollContainer, }, colProps: { span: 4, }, }, { label: '查询设备', field: 'gdeviceid', component: 'Select', required: true, defaultValue: deviceOptions[0].value, componentProps: { options: deviceOptions, // onChange: (e, option) => { // nextTick(async () => { // await getDataSource(); // }); // }, }, colProps: { span: 4, }, }, { label: '子设备', field: 'deviceNum', component: 'Select', required: Boolean(dictOptions.length), show: Boolean(dictOptions.length), defaultValue: dictOptions[0] ? dictOptions[0].value : '', componentProps: { options: dictOptions, // onChange: (e, option) => { // nextTick(async () => { // await getDataSource(); // }); // }, }, colProps: { span: 4, }, }, // { // label: '子设备', // field: 'deviceNum', // // component: 'JDictSelectTag', // // show: Boolean(dictCode), // componentProps: { // dictCode, // showChooseOption: false, // placeholder: '请选择', // }, // colProps: { // span: 4, // }, // }, { label: '间隔时间', field: 'skip', component: 'Select', defaultValue: '8', componentProps: { options: [ { label: '1秒', value: '1s', }, { label: '5秒', value: '5s', }, { label: '10秒', value: '10s', }, { label: '30秒', value: '30s', }, { label: '1分钟', value: '1m', }, { label: '10分钟', value: '10m', }, { label: '30分钟', value: '30m', }, { label: '1小时', value: '1h', }, ], }, colProps: { span: 4, }, }, ]; /** 默认的表格props,参考 BasicTable 组件 */ export const defaultTableProps: BasicTableProps = { columns: [ { align: 'center', dataIndex: 'strinstallpos', defaultHidden: false, title: '安装位置', width: 80, }, ], bordered: false, size: 'small', showIndexColumn: true, showActionColumn: false, }; /** 默认的查询表单props,参考 BasicForm 组件 */ export const defaultFormProps: FormProps = { labelAlign: 'left', labelCol: { span: 8 }, showAdvancedButton: false, showSubmitButton: false, showResetButton: true, }; /** 默认的表格分页props,参考 BasicTable 组件 */ export const defaultPaginationProps: PaginationProps = { current: 1, pageSize: 10, pageSizeOptions: ['10', '30', '50', '100'], showQuickJumper: false, };