timeConfig.ts 2.14 KB
interface IOptionConfig {
  label: string;
  value: string;
}

export const optionsConfig: IOptionConfig[] = [
  {
    label: '1秒',
    value: '1000',
  },
  {
    label: '5秒',
    value: '5000',
  },
  {
    label: '10秒',
    value: '10000',
  },
  {
    label: '15秒',
    value: '15000',
  },
  {
    label: '30秒',
    value: '30000',
  },
  {
    label: '1分钟',
    value: '60000',
  },
  {
    label: '2分钟',
    value: '120000',
  },
  {
    label: '5分钟',
    value: '300000',
  },
  {
    label: '10分钟',
    value: '600000',
  },
  {
    label: '15分钟',
    value: '900000',
  },
  {
    label: '30分钟',
    value: '1800000',
  },
  {
    label: '1小时',
    value: '3600000',
  },
  {
    label: '2小时',
    value: '7200000',
  },
  {
    label: '5小时',
    value: '18000000',
  },
  {
    label: '10小时',
    value: '36000000',
  },
  {
    label: '12小时',
    value: '43200000',
  },
  {
    label: '1天',
    value: '86400000',
  },
];

export enum TypeEnum {
  IS_TIMING = 0,
  IS_WEEK = 'week',
  IS_MONTH = 'month',
  IS_EMPTY = 'NONE',
  IS_DEFAULT_WEEK = 'defaultIsWeek',
  IS_MIN = 'MIN',
  IS_MAX = 'MAX',
  IS_AVG = 'AVG',
  IS_SUM = 'SUM',
  COUNT = 'COUNT',
}

export enum AggregateDataEnum {
  MIN = 'MIN',
  MAX = 'MAX',
  AVG = 'AVG',
  SUM = 'SUM',
  COUNT = 'COUNT',
  NONE = 'NONE',
}

export const isTiming = (type: string) => {
  return type === TypeEnum.IS_TIMING;
};

export const isWeek = (type: string) => {
  return type === TypeEnum.IS_WEEK;
};

export const isMonth = (type: string) => {
  return type === TypeEnum.IS_MONTH;
};

export const isEmpty = (type: string) => {
  return type === TypeEnum.IS_EMPTY;
};

export const isDefultWeek = (type: string) => {
  return type === TypeEnum.IS_DEFAULT_WEEK;
};

export const isMin = (type: string) => {
  return type === TypeEnum.IS_MIN;
};

export const isMax = (type: string) => {
  return type === TypeEnum.IS_MAX;
};

export const isAvg = (type: string) => {
  return type === TypeEnum.IS_AVG;
};
export const isSum = (type: string) => {
  return type === TypeEnum.IS_SUM;
};

export const isCountAll = (type: string) => {
  return type === TypeEnum.COUNT;
};