Commit f3deae193b5c6c697280cf26b1abcc676ed728e7
1 parent
bc3c60e8
fix: 查询历史数据,如果是历史数据聚合,添加limit50000限制传入后端进行查询
Showing
4 changed files
with
14 additions
and
2 deletions
| @@ -56,6 +56,7 @@ export interface ChartOptionType { | @@ -56,6 +56,7 @@ export interface ChartOptionType { | ||
| 56 | queryType?: SocketSubscriberEnum | 56 | queryType?: SocketSubscriberEnum |
| 57 | agg?: AggregateTypeEnum | 57 | agg?: AggregateTypeEnum |
| 58 | unit?: string | 58 | unit?: string |
| 59 | + limit?: number | ||
| 59 | } | 60 | } |
| 60 | 61 | ||
| 61 | export interface FlowMeterColorItemType { | 62 | export interface FlowMeterColorItemType { |
| @@ -32,7 +32,7 @@ export default class Config implements CreateComponentType { | @@ -32,7 +32,7 @@ export default class Config implements CreateComponentType { | ||
| 32 | export const dataSubscribers: ComponentConfigModuleType['dataSubscribers'] = (telemetryService, nodeData) => { | 32 | export const dataSubscribers: ComponentConfigModuleType['dataSubscribers'] = (telemetryService, nodeData) => { |
| 33 | const { dataSourceJson, configurationNodeId } = nodeData | 33 | const { dataSourceJson, configurationNodeId } = nodeData |
| 34 | const { deviceId, attr, chartOption } = dataSourceJson | 34 | const { deviceId, attr, chartOption } = dataSourceJson |
| 35 | - const { agg, interval, effectScope = 0 } = chartOption! | 35 | + const { agg, interval, effectScope = 0, limit = 50000 } = chartOption! |
| 36 | const subscribe = TelemetrySubscriber.createHistorySubscription(telemetryService, { id: deviceId, entityType: EntityType.DEVICE }, attr, telemetryService.getCommandSource(configurationNodeId, DataSourceTypeEnum.DATASOURCE, dataSourceJson)) | 36 | const subscribe = TelemetrySubscriber.createHistorySubscription(telemetryService, { id: deviceId, entityType: EntityType.DEVICE }, attr, telemetryService.getCommandSource(configurationNodeId, DataSourceTypeEnum.DATASOURCE, dataSourceJson)) |
| 37 | 37 | ||
| 38 | const subscriptionCommand = subscribe.subscriptionCommand as HistorySubscriptionCmd | 38 | const subscriptionCommand = subscribe.subscriptionCommand as HistorySubscriptionCmd |
| @@ -40,6 +40,7 @@ export const dataSubscribers: ComponentConfigModuleType['dataSubscribers'] = (te | @@ -40,6 +40,7 @@ export const dataSubscribers: ComponentConfigModuleType['dataSubscribers'] = (te | ||
| 40 | subscriptionCommand.interval = interval | 40 | subscriptionCommand.interval = interval |
| 41 | subscriptionCommand.startTs = Date.now() - effectScope | 41 | subscriptionCommand.startTs = Date.now() - effectScope |
| 42 | subscriptionCommand.endTs = Date.now() | 42 | subscriptionCommand.endTs = Date.now() |
| 43 | + subscriptionCommand.limit = limit | ||
| 43 | 44 | ||
| 44 | return [subscribe] | 45 | return [subscribe] |
| 45 | } | 46 | } |
| @@ -32,7 +32,7 @@ export default class Config implements CreateComponentType { | @@ -32,7 +32,7 @@ export default class Config implements CreateComponentType { | ||
| 32 | export const dataSubscribers: ComponentConfigModuleType['dataSubscribers'] = (telemetryService, nodeData) => { | 32 | export const dataSubscribers: ComponentConfigModuleType['dataSubscribers'] = (telemetryService, nodeData) => { |
| 33 | const { dataSourceJson, configurationNodeId } = nodeData | 33 | const { dataSourceJson, configurationNodeId } = nodeData |
| 34 | const { deviceId, attr, chartOption } = dataSourceJson | 34 | const { deviceId, attr, chartOption } = dataSourceJson |
| 35 | - const { agg, interval, effectScope = 0, queryType } = chartOption! | 35 | + const { agg, interval, effectScope = 0, queryType, limit = 50000 } = chartOption! |
| 36 | 36 | ||
| 37 | let subscribe | 37 | let subscribe |
| 38 | if (queryType === SocketSubscriberEnum.HISTORY_CMDS) | 38 | if (queryType === SocketSubscriberEnum.HISTORY_CMDS) |
| @@ -47,6 +47,7 @@ export const dataSubscribers: ComponentConfigModuleType['dataSubscribers'] = (te | @@ -47,6 +47,7 @@ export const dataSubscribers: ComponentConfigModuleType['dataSubscribers'] = (te | ||
| 47 | if (queryType === SocketSubscriberEnum.HISTORY_CMDS) { | 47 | if (queryType === SocketSubscriberEnum.HISTORY_CMDS) { |
| 48 | subscriptionCommand.startTs = Date.now() - effectScope | 48 | subscriptionCommand.startTs = Date.now() - effectScope |
| 49 | subscriptionCommand.endTs = Date.now() | 49 | subscriptionCommand.endTs = Date.now() |
| 50 | + subscriptionCommand.limit = limit | ||
| 50 | } | 51 | } |
| 51 | 52 | ||
| 52 | return [subscribe] | 53 | return [subscribe] |
| @@ -234,6 +234,7 @@ export enum FormFieldEnum { | @@ -234,6 +234,7 @@ export enum FormFieldEnum { | ||
| 234 | QUERY_TYPE = 'queryType', | 234 | QUERY_TYPE = 'queryType', |
| 235 | AGG = 'agg', | 235 | AGG = 'agg', |
| 236 | UNIT = 'unit', | 236 | UNIT = 'unit', |
| 237 | + LIMIT = 'limit', | ||
| 237 | } | 238 | } |
| 238 | 239 | ||
| 239 | export function getPacketIntervalByValue(value: number) { | 240 | export function getPacketIntervalByValue(value: number) { |
| @@ -255,6 +256,7 @@ export const formSchemas = (chartType?: ChartComponentEnum): FormSchema[] => { | @@ -255,6 +256,7 @@ export const formSchemas = (chartType?: ChartComponentEnum): FormSchema[] => { | ||
| 255 | 256 | ||
| 256 | return item | 257 | return item |
| 257 | }) | 258 | }) |
| 259 | + | ||
| 258 | return [ | 260 | return [ |
| 259 | { | 261 | { |
| 260 | label: t('dataType'), | 262 | label: t('dataType'), |
| @@ -320,6 +322,13 @@ export const formSchemas = (chartType?: ChartComponentEnum): FormSchema[] => { | @@ -320,6 +322,13 @@ export const formSchemas = (chartType?: ChartComponentEnum): FormSchema[] => { | ||
| 320 | 322 | ||
| 321 | }, | 323 | }, |
| 322 | }, | 324 | }, |
| 325 | + { | ||
| 326 | + label: '数据聚合', | ||
| 327 | + field: FormFieldEnum.LIMIT, | ||
| 328 | + component: ComponentEnum.INPUT, | ||
| 329 | + ifShow: false, | ||
| 330 | + defaultValue: (chartType === ChartComponentEnum.HISTOGRAM || chartType === ChartComponentEnum.LINE) ? 50000 : null, | ||
| 331 | + }, | ||
| 323 | 332 | ||
| 324 | ] | 333 | ] |
| 325 | } | 334 | } |