|
@@ -10,137 +10,141 @@ import { get } from 'lodash-es';
|
|
|
* @param deviceOptions 用于初始化设备下拉框
|
|
|
* @returns
|
|
|
*/
|
|
|
-export const getDefaultSchemas: (dictOptions: 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: 'gdeviceids',
|
|
|
- component: 'Select',
|
|
|
- required: true,
|
|
|
- defaultValue:
|
|
|
- get(deviceOptions, '[0].stationtype', 'redis') === 'redis' ? get(deviceOptions, '[0].value', '') : [get(deviceOptions, '[0].value', '')],
|
|
|
- componentProps: {
|
|
|
- options: deviceOptions,
|
|
|
- // onChange: (e, option) => {
|
|
|
- mode: get(deviceOptions, '[0].stationtype', 'redis') === 'redis' ? undefined : 'multiple',
|
|
|
- maxTagCount: 'responsive',
|
|
|
- // nextTick(async () => {
|
|
|
- // await getDataSource();
|
|
|
- // });
|
|
|
- // },
|
|
|
- },
|
|
|
- colProps: {
|
|
|
- span: 4,
|
|
|
+export const getDefaultSchemas: (dictOptions: any[], deviceOptions: any[]) => FormSchema[] = (dictOptions: any[], deviceOptions: any[]) => {
|
|
|
+ const device = get(deviceOptions, '[0].value', '');
|
|
|
+ const dictcode = get(dictOptions, '[0].value', '');
|
|
|
+ const isRedis = get(deviceOptions, '[0].stationtype', 'redis') === 'redis';
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ 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,
|
|
|
+ },
|
|
|
},
|
|
|
- },
|
|
|
- {
|
|
|
- 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();
|
|
|
- // });
|
|
|
- // },
|
|
|
+ {
|
|
|
+ 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,
|
|
|
+ },
|
|
|
},
|
|
|
- colProps: {
|
|
|
- span: 4,
|
|
|
+ {
|
|
|
+ label: '查询设备',
|
|
|
+ field: 'gdeviceids',
|
|
|
+ component: 'Select',
|
|
|
+ required: true,
|
|
|
+ defaultValue: isRedis ? device : [device],
|
|
|
+ componentProps: {
|
|
|
+ options: deviceOptions,
|
|
|
+ // onChange: (e, option) => {
|
|
|
+ mode: isRedis ? undefined : 'multiple',
|
|
|
+ maxTagCount: 'responsive',
|
|
|
+ // 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: '1',
|
|
|
- },
|
|
|
- {
|
|
|
- label: '5秒',
|
|
|
- value: '2',
|
|
|
- },
|
|
|
- {
|
|
|
- label: '10秒',
|
|
|
- value: '3',
|
|
|
- },
|
|
|
- {
|
|
|
- label: '30秒',
|
|
|
- value: '4',
|
|
|
- },
|
|
|
- {
|
|
|
- label: '1分钟',
|
|
|
- value: '5',
|
|
|
- },
|
|
|
- {
|
|
|
- label: '10分钟',
|
|
|
- value: '6',
|
|
|
- },
|
|
|
- {
|
|
|
- label: '30分钟',
|
|
|
- value: '7',
|
|
|
- },
|
|
|
- {
|
|
|
- label: '1小时',
|
|
|
- value: '8',
|
|
|
- },
|
|
|
- ],
|
|
|
+ {
|
|
|
+ label: '子设备',
|
|
|
+ field: 'deviceNum',
|
|
|
+ component: 'Select',
|
|
|
+ required: isRedis ? false : Boolean(dictOptions.length),
|
|
|
+ show: isRedis ? false : Boolean(dictOptions.length),
|
|
|
+ defaultValue: isRedis ? '' : dictcode,
|
|
|
+ componentProps: {
|
|
|
+ options: dictOptions,
|
|
|
+ // onChange: (e, option) => {
|
|
|
+ // nextTick(async () => {
|
|
|
+ // await getDataSource();
|
|
|
+ // });
|
|
|
+ // },
|
|
|
+ },
|
|
|
+ colProps: {
|
|
|
+ span: 4,
|
|
|
+ },
|
|
|
},
|
|
|
- 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: '1',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '5秒',
|
|
|
+ value: '2',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '10秒',
|
|
|
+ value: '3',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '30秒',
|
|
|
+ value: '4',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '1分钟',
|
|
|
+ value: '5',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '10分钟',
|
|
|
+ value: '6',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '30分钟',
|
|
|
+ value: '7',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '1小时',
|
|
|
+ value: '8',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ colProps: {
|
|
|
+ span: 4,
|
|
|
+ },
|
|
|
},
|
|
|
- },
|
|
|
-];
|
|
|
+ ];
|
|
|
+};
|
|
|
|
|
|
/** 默认的表格props,参考 BasicTable 组件 */
|
|
|
export const defaultTableProps: BasicTableProps = {
|
|
@@ -165,7 +169,7 @@ export const defaultFormProps: FormProps = {
|
|
|
labelCol: { span: 8 },
|
|
|
showAdvancedButton: false,
|
|
|
showSubmitButton: false,
|
|
|
- showResetButton: true,
|
|
|
+ showResetButton: false,
|
|
|
};
|
|
|
|
|
|
/** 默认的表格分页props,参考 BasicTable 组件 */
|