import List from './components/List.vue';
|
import Timestamp from './components/Timestamp.vue';
|
import TimeRange from './components/TimeRange.vue';
|
|
export const enum RecordSetParamsType {
|
List = 'list',
|
/** @description 后端格式 */
|
StartTime = 'start_time',
|
EndTime = 'end_time',
|
/** @description start 和 end 合并为一个 range */
|
TimeRange = 'time_range',
|
}
|
|
export type BaseParam = {
|
id: string;
|
title: string;
|
hide?: boolean;
|
};
|
|
export type ListParamListItem = {
|
title: string;
|
value: string;
|
};
|
export type ListParam = {
|
type: RecordSetParamsType.List;
|
value: string;
|
list: ListParamListItem[];
|
} & BaseParam;
|
|
//#region ====================== 后端数据格式 ======================
|
export type TimeRangeBackEndParamType = RecordSetParamsType.StartTime | RecordSetParamsType.EndTime;
|
export type TimeRangeBackEndParam = {
|
type: TimeRangeBackEndParamType;
|
value: string;
|
// 属于同一个 group 配对
|
group: string;
|
} & BaseParam;
|
//#endregion
|
//#region ====================== 整合 start 和 end,得到前端格式 ======================
|
export type TimeRangeParamValue = [
|
string,
|
string
|
]
|
export type TimeRangeParam = {
|
type: RecordSetParamsType.TimeRange;
|
value: TimeRangeParamValue;
|
// 属于同一个 group 配对
|
group: string;
|
range?: [TimeRangeBackEndParam, TimeRangeBackEndParam];
|
} & BaseParam;
|
//#endregion
|
|
|
export type RecordSetParamsItem = ListParam | TimeRangeParam | TimeRangeBackEndParam;
|
export type RecordSet = {
|
params?: RecordSetParamsItem[];
|
} & Record<string, any>;
|
|
export const recordSetMapCom = {
|
[RecordSetParamsType.List]: List,
|
[RecordSetParamsType.TimeRange]: TimeRange,
|
[RecordSetParamsType.StartTime]:Timestamp,
|
[RecordSetParamsType.EndTime]:Timestamp
|
};
|