From 44f99b06b7ebcea41e83467635b5937030a7d186 Mon Sep 17 00:00:00 2001 From: huanghao1412 Date: Sat, 27 Jan 2024 18:29:32 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E7=8E=AF=E5=BD=A2?= =?UTF-8?q?=E7=8E=AB=E7=91=B0=E5=9B=BE=20=E6=B0=B4=E6=BB=B4=E5=9B=BE=20?= =?UTF-8?q?=E4=B8=A4=E4=B8=AA=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../useMonthAlarmClassRes.ts | 23 ++++++ .../commonDataComponents/useNoParamRes.ts | 25 ++++++ src/hooks/useChartCommonData.hook.ts | 6 ++ src/layout/components/LayoutHeader/index.vue | 5 +- .../Charts/Mores/WaterPolo/config.ts | 36 ++++++++- .../Charts/Mores/WaterPolo/config.vue | 53 ++++++++++--- .../Charts/Mores/WaterPolo/index.ts | 2 +- .../Charts/Mores/WaterPolo/index.vue | 77 +++++++++++++++---- .../Charts/Pies/PieCircle/config.ts | 3 +- .../Charts/Pies/PieCircle/index.vue | 29 ++++++- .../Charts/Pies/PieCommon/config.ts | 2 +- .../Charts/Pies/PieCommon/index.vue | 8 ++ .../Charts/Pies/PieCommon1/config.ts | 2 +- .../Charts/Pies/PieCommon1/index.vue | 8 ++ .../Charts/Pies/PieCommon2/config.ts | 8 +- .../Charts/Pies/PieCommon2/config.vue | 30 ++++---- .../Charts/Pies/PieCommon2/index.vue | 13 +++- .../Informations/Texts/TextGradient/config.ts | 1 + .../Texts/TextGradient/config.vue | 9 +++ .../Informations/Texts/TextGradient/index.ts | 2 +- .../Informations/Texts/TextGradient/index.vue | 50 +++++++++--- src/packages/components/Photos/index.ts | 4 +- src/packages/public/publicConfig.ts | 10 +++ .../chartEditStore/chartEditStore.d.ts | 25 +++++- .../components/MonthAlarmClass.vue | 61 +++++++++++++++ .../ChartDataV2/components/NoParam.vue | 24 ++++++ .../components/ChartDataV2/index.d.ts | 10 +++ .../components/ChartDataV2/index.vue | 6 ++ 28 files changed, 465 insertions(+), 67 deletions(-) create mode 100644 src/hooks/commonDataComponents/useMonthAlarmClassRes.ts create mode 100644 src/hooks/commonDataComponents/useNoParamRes.ts create mode 100644 src/views/chart/ContentConfigurations/components/ChartDataV2/components/MonthAlarmClass.vue create mode 100644 src/views/chart/ContentConfigurations/components/ChartDataV2/components/NoParam.vue 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 @@ + +