From 6160ec4d6de2364ca3adcb28acab239ba66e42d9 Mon Sep 17 00:00:00 2001 From: Free-sss <630042479@qq.com> Date: Mon, 8 Sep 2025 17:25:49 +0800 Subject: [PATCH] =?UTF-8?q?refactor(Charts):=20=E9=87=8D=E6=9E=84=E6=8A=A5?= =?UTF-8?q?=E8=AD=A6=E5=88=97=E8=A1=A8=E3=80=81=E8=AE=BE=E5=A4=87=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E5=92=8C=E6=8A=98=E7=BA=BF=E5=9B=BE=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 更新报警列表和设备状态组件的配置结构 - 优化报警列表和设备状态组件的模板和样式 - 重构折线图组件的配置结构 - 更新折线图组件的设置项 --- .../Charts/MyComponents/AlarmList/config.ts | 16 +- .../Charts/MyComponents/AlarmList/index.vue | 91 +-- .../MyComponents/DeviceStatus/config.ts | 12 +- .../MyComponents/DeviceStatus/index.vue | 45 +- .../MyComponents/LineDropdown/config.ts | 37 +- .../MyComponents/LineDropdown/config.vue | 17 +- .../MyComponents/LineDropdown/index.vue | 424 +++++------- .../MyComponents/LineDropdown/mock.json | 104 +++ .../MyComponents/LineDropdown/select.vue | 159 +++++ .../Charts/MyComponents/LineGraph01/config.ts | 33 +- .../MyComponents/LineGraph01/config.vue | 1 - .../Charts/MyComponents/LineGraph01/index.vue | 628 +++++------------- .../Charts/MyComponents/LineGraph01/mock.json | 197 ++++++ .../MyComponents/LineGraph01/mock1.json | 101 +++ .../LineGraph02/assets/icon01.png | Bin 461 -> 0 bytes .../Charts/MyComponents/LineGraph02/config.ts | 123 ---- .../MyComponents/LineGraph02/config.vue | 61 -- .../Charts/MyComponents/LineGraph02/data.json | 96 --- .../Charts/MyComponents/LineGraph02/index.ts | 17 - .../Charts/MyComponents/LineGraph02/index.vue | 430 ------------ .../MyComponents/ParkingScene/config.ts | 4 +- .../MyComponents/ParkingScene/index.vue | 273 +------- .../Charts/MyComponents/PieCenter/config.ts | 48 +- .../Charts/MyComponents/PieCenter/config.vue | 7 + .../Charts/MyComponents/PieCenter/index.vue | 424 ++++-------- .../MyComponents/SceneDistribution/index.vue | 270 +------- .../Charts/MyComponents/TopAlarms/config.ts | 62 +- .../Charts/MyComponents/TopAlarms/config.vue | 29 +- .../Charts/MyComponents/TopAlarms/index.vue | 188 ++++-- .../components/Charts/MyComponents/index.ts | 2 - 30 files changed, 1419 insertions(+), 2480 deletions(-) create mode 100644 src/packages/components/Charts/MyComponents/LineDropdown/mock.json create mode 100644 src/packages/components/Charts/MyComponents/LineDropdown/select.vue create mode 100644 src/packages/components/Charts/MyComponents/LineGraph01/mock.json create mode 100644 src/packages/components/Charts/MyComponents/LineGraph01/mock1.json delete mode 100644 src/packages/components/Charts/MyComponents/LineGraph02/assets/icon01.png delete mode 100644 src/packages/components/Charts/MyComponents/LineGraph02/config.ts delete mode 100644 src/packages/components/Charts/MyComponents/LineGraph02/config.vue delete mode 100644 src/packages/components/Charts/MyComponents/LineGraph02/data.json delete mode 100644 src/packages/components/Charts/MyComponents/LineGraph02/index.ts delete mode 100644 src/packages/components/Charts/MyComponents/LineGraph02/index.vue diff --git a/src/packages/components/Charts/MyComponents/AlarmList/config.ts b/src/packages/components/Charts/MyComponents/AlarmList/config.ts index 02452da..7ba26af 100644 --- a/src/packages/components/Charts/MyComponents/AlarmList/config.ts +++ b/src/packages/components/Charts/MyComponents/AlarmList/config.ts @@ -2,6 +2,8 @@ import { PublicConfigClass } from '@/packages/public' import { CreateComponentType } from '@/packages/index.d' import { AlarmListConfig } from './index' import dataJson from './data.json' +import { cloneDeep } from 'lodash' +import { chartInitConfig } from '@/settings/designSetting' export enum FontWeightEnum { NORMAL = '常规', BOLD = '加粗', @@ -22,7 +24,7 @@ export const FontStyleObject = { [FontStyleEnum.ITALIC]: 'italic', } export const option = { - sceneCode:"", + sceneCode: "", dataset: dataJson, header: ['报警事件', '时间', '所属企业', '状态'], headerTextColor: '#B4B4B4', @@ -37,21 +39,15 @@ export const option = { headerHeight: 28, itemHeight: 28, fontSize: 12, - title: '近60分钟报警信息', - titleSize: 16, - titleColor: '#eee', + titleText: '近60分钟报警信息', fontWeight: 'normal', fontStyle: 'italc', - paddingX: 50, - paddingY: -25, - letterSpacing: 0.5, isShowButton: false } export default class Config extends PublicConfigClass implements CreateComponentType { public key = AlarmListConfig.key public chartConfig = AlarmListConfig - public option = option - - + public option = cloneDeep(option) + public attr = { ...chartInitConfig, x: 0, y: 0, w: 500, h: 325, zIndex: 1 } } diff --git a/src/packages/components/Charts/MyComponents/AlarmList/index.vue b/src/packages/components/Charts/MyComponents/AlarmList/index.vue index 07ebcc6..56942ce 100644 --- a/src/packages/components/Charts/MyComponents/AlarmList/index.vue +++ b/src/packages/components/Charts/MyComponents/AlarmList/index.vue @@ -1,66 +1,46 @@ \ No newline at end of file + diff --git a/src/packages/components/Charts/MyComponents/LineDropdown/mock.json b/src/packages/components/Charts/MyComponents/LineDropdown/mock.json new file mode 100644 index 0000000..4e71645 --- /dev/null +++ b/src/packages/components/Charts/MyComponents/LineDropdown/mock.json @@ -0,0 +1,104 @@ +{ + "day": [ + { + "alarm_count": 1, + "hour": 6 + }, + { + "alarm_count": 1, + "hour": 7 + }, + { + "alarm_count": 59, + "hour": 12 + }, + { + "alarm_count": 71, + "hour": 13 + } + ], + "week": [ + { + "dayOfWeek": 1, + "alarm_count": 14 + }, + { + "dayOfWeek": 2, + "alarm_count": 15 + }, + { + "dayOfWeek": 3, + "alarm_count": 132 + } + ], + "month": [ + { + "alarm_count": 13, + "day": 17 + }, + { + "alarm_count": 75, + "day": 18 + }, + { + "alarm_count": 94, + "day": 19 + }, + { + "alarm_count": 34, + "day": 20 + }, + { + "alarm_count": 23, + "day": 21 + }, + { + "alarm_count": 6, + "day": 22 + }, + { + "alarm_count": 14, + "day": 25 + }, + { + "alarm_count": 15, + "day": 26 + }, + { + "alarm_count": 132, + "day": 27 + } + ], + "quarter": [ + { + "alarm_count": 18, + "month": 7 + }, + { + "alarm_count": 406, + "month": 8 + } + ], + "year": [ + { + "alarm_count": 10, + "month": 4 + }, + { + "alarm_count": 10, + "month": 5 + }, + { + "alarm_count": 10, + "month": 6 + }, + { + "alarm_count": 18, + "month": 7 + }, + { + "alarm_count": 406, + "month": 8 + } + ] +} \ No newline at end of file diff --git a/src/packages/components/Charts/MyComponents/LineDropdown/select.vue b/src/packages/components/Charts/MyComponents/LineDropdown/select.vue new file mode 100644 index 0000000..39e2284 --- /dev/null +++ b/src/packages/components/Charts/MyComponents/LineDropdown/select.vue @@ -0,0 +1,159 @@ + + + + + \ No newline at end of file diff --git a/src/packages/components/Charts/MyComponents/LineGraph01/config.ts b/src/packages/components/Charts/MyComponents/LineGraph01/config.ts index 7edf90b..f5d01c0 100644 --- a/src/packages/components/Charts/MyComponents/LineGraph01/config.ts +++ b/src/packages/components/Charts/MyComponents/LineGraph01/config.ts @@ -4,6 +4,7 @@ import { CreateComponentType } from '@/packages/index.d' import cloneDeep from 'lodash/cloneDeep' import { chartInitConfig } from '@/settings/designSetting' import dataJson from './data.json' + export interface DataSourceItem { dataname: string; values: number[]; @@ -17,7 +18,9 @@ export interface DatasType { dataSource: DataSourceItem[]; } - +const otherOption = { + titleText: '报警处置情况' +} export const includes = ['legend', 'xAxis', 'yAxis', 'grid'] export const seriesItem = { type: 'line', @@ -57,6 +60,34 @@ export const seriesItem = { } } export const option = { + ...otherOption, + sceneCode: 'T04', + dateTime: { + selectValue: 'day', + dataset: [ + { + label: '当天', + value: 'day' + }, + { + label: '本周', + value: 'week' + }, + { + label: '当月', + value: 'month' + }, + { + label: '本季度', + value: 'quarter' + }, + { + label: '当年', + value: 'year' + } + ] + }, + dataset: { source: dataJson.dataSource[0].datavalues }, diff --git a/src/packages/components/Charts/MyComponents/LineGraph01/config.vue b/src/packages/components/Charts/MyComponents/LineGraph01/config.vue index 415af52..bfbbace 100644 --- a/src/packages/components/Charts/MyComponents/LineGraph01/config.vue +++ b/src/packages/components/Charts/MyComponents/LineGraph01/config.vue @@ -1,6 +1,5 @@