diff --git a/src/hooks/commonDataComponents/useMonthAlarmClassRes.ts b/src/hooks/commonDataComponents/useMonthAlarmClassRes.ts new file mode 100644 index 00000000..9774855a --- /dev/null +++ b/src/hooks/commonDataComponents/useMonthAlarmClassRes.ts @@ -0,0 +1,23 @@ +import { publicInterface } from "@/api/path"; +import { MonthAlarmClassType } from '@/store/modules/chartEditStore/chartEditStore.d' +import { CreateComponentType } from '@/packages/index.d' +import { ResultErrcode } from "@/enums/httpEnum"; +import dataJson from "./data.json"; + +export const handleMonthAlarmClass = (targetComponent: CreateComponentType) => { + const obj = targetComponent.commonData[targetComponent.commonData.currentSource] + let { enable, confirm_statuses, recovery_statuses, levels, space_complete_id } = obj as MonthAlarmClassType + if(!enable) return { + errcode: ResultErrcode.SUCCESS, + data: { ...dataJson }, + errmsg: '' + } + + const query = { + confirm_statuses, + recovery_statuses, + levels, + space_complete_id, + } + return publicInterface('/dcim/system/custom_large_screen', 'count_by_asset_type', query) +} diff --git a/src/hooks/commonDataComponents/useNoParamRes.ts b/src/hooks/commonDataComponents/useNoParamRes.ts new file mode 100644 index 00000000..14c2f2a5 --- /dev/null +++ b/src/hooks/commonDataComponents/useNoParamRes.ts @@ -0,0 +1,25 @@ +import { publicInterface } from "@/api/path"; +import { CreateComponentType } from '@/packages/index.d' +import { ResultErrcode } from "@/enums/httpEnum"; +import { CurrentSourceEnum } from '@/store/modules/chartEditStore/chartEditStore.d' +import dataJson from "./data.json"; + +export const handleNoParam = (targetComponent: CreateComponentType) => { + const obj = targetComponent.commonData[targetComponent.commonData.currentSource] + const list = [ + { + name: CurrentSourceEnum.DEVICECLASS, + apiPrefix: '/dcim/system/custom_large_screen', + apiSuffix: 'count_device_by_device_type_active' + } + ] + let target = list.find(_ => _.name === targetComponent.commonData.currentSource) || { name: '', apiPrefix: '', apiSuffix: '' } + let { enable } = obj + if(!enable) return { + errcode: ResultErrcode.SUCCESS, + data: { ...dataJson }, + errmsg: '' + } + + return publicInterface(target.apiPrefix, target.apiSuffix, {}) +} diff --git a/src/hooks/useChartCommonData.hook.ts b/src/hooks/useChartCommonData.hook.ts index 8fc28c9f..b1fa0cec 100644 --- a/src/hooks/useChartCommonData.hook.ts +++ b/src/hooks/useChartCommonData.hook.ts @@ -11,6 +11,8 @@ import { handleEnergyUseHistory } from './commonDataComponents/useEnergyUseHisto import { handleRecordValueHistory } from './commonDataComponents/useRecordValueHistoryRes' import { handlePointRealTime } from './commonDataComponents/usePointRealTimeRes' import { handleSinglePoint } from './commonDataComponents/useSinglePointRes' +import { handleMonthAlarmClass } from './commonDataComponents/useMonthAlarmClassRes' +import { handleNoParam } from './commonDataComponents/useNoParamRes' import { ResultErrcode } from '@/enums/httpEnum' // 获取类型 @@ -112,7 +114,11 @@ export const useChartCommonData = ( case CurrentSourceEnum.SINGLEPOINT: res = await handleSinglePoint(targetComponent) break; + case CurrentSourceEnum.MONTHALARMCLASS: + res = await handleMonthAlarmClass(targetComponent) + break; default: + res = await handleNoParam(targetComponent) break; } if (res && res.errcode === ResultErrcode.SUCCESS) { diff --git a/src/layout/components/LayoutHeader/index.vue b/src/layout/components/LayoutHeader/index.vue index fa6b7e9b..8a54d6c2 100644 --- a/src/layout/components/LayoutHeader/index.vue +++ b/src/layout/components/LayoutHeader/index.vue @@ -38,12 +38,12 @@ const isProject = computed(() => { diff --git a/src/views/chart/ContentConfigurations/components/ChartDataV2/components/NoParam.vue b/src/views/chart/ContentConfigurations/components/ChartDataV2/components/NoParam.vue new file mode 100644 index 00000000..fc42732a --- /dev/null +++ b/src/views/chart/ContentConfigurations/components/ChartDataV2/components/NoParam.vue @@ -0,0 +1,24 @@ + + + + + diff --git a/src/views/chart/ContentConfigurations/components/ChartDataV2/index.d.ts b/src/views/chart/ContentConfigurations/components/ChartDataV2/index.d.ts index eea09135..f734400a 100644 --- a/src/views/chart/ContentConfigurations/components/ChartDataV2/index.d.ts +++ b/src/views/chart/ContentConfigurations/components/ChartDataV2/index.d.ts @@ -145,6 +145,16 @@ export const sourceOptions: sourceOptionsItemType[] = [ value: CurrentSourceEnum.POINTREALTIME, type: optionTypeEnum.MULTIPLE, }, + { + label: '设备分类统计', + value: CurrentSourceEnum.DEVICECLASS, + type: optionTypeEnum.MULTIPLE, + }, + { + label: '当月告警分类统计', + value: CurrentSourceEnum.MONTHALARMCLASS, + type: optionTypeEnum.MULTIPLE, + }, { label: '单测点实时值', value: CurrentSourceEnum.SINGLEPOINT, diff --git a/src/views/chart/ContentConfigurations/components/ChartDataV2/index.vue b/src/views/chart/ContentConfigurations/components/ChartDataV2/index.vue index 10ee002d..128b1062 100644 --- a/src/views/chart/ContentConfigurations/components/ChartDataV2/index.vue +++ b/src/views/chart/ContentConfigurations/components/ChartDataV2/index.vue @@ -8,6 +8,8 @@ + +