From 417d45877588b600311f0581aba418efdf961c79 Mon Sep 17 00:00:00 2001 From: Free-sss <630042479@qq.com> Date: Mon, 8 Sep 2025 15:04:00 +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=E7=BB=84=E4=BB=B6=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=92=8C=E6=95=B0=E6=8D=AE=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 更新配置文件,使用深拷贝初始化配置选项 - 添加默认属性设置,包括位置和尺寸 - 优化模板结构,移除冗余空行 - 修改数据获取 API,添加场景码参数 --- .../AlarmListHazC/config.ts | 14 +- .../AlarmListHazC/index.vue | 9 +- .../LineDropdownHaz/assets/title.svg | 125 -------------- .../LineDropdownHaz/config.ts | 4 +- .../LineDropdownHaz/index.vue | 2 +- .../LineGraph01Haz/assets/title.svg | 125 -------------- .../LineGraph01Haz/config.ts | 52 +++--- .../LineGraph01Haz/index.vue | 100 ++++------- .../LineGraph01Haz/select.vue | 159 ------------------ .../PieCenterHaz/assets/title.svg | 125 -------------- .../PieCenterHaz/config.ts | 6 +- .../PieCenterHaz/index.vue | 75 +-------- .../SmallBorder/assets/title.svg | 125 -------------- .../SmallBorder/config.ts | 17 -- .../SmallBorder/config.vue | 54 ------ .../SmallBorder/index.ts | 17 -- .../SmallBorder/index.vue | 83 --------- .../TopAlarmsHaz/config.ts | 13 +- .../TopAlarmsHaz/index.vue | 87 ++-------- .../yushiVideoHaz/config.ts | 4 +- .../yushiVideoHaz/index.vue | 110 +++--------- 21 files changed, 134 insertions(+), 1172 deletions(-) delete mode 100644 src/packages/components/Charts/HazardousChemicalsSpace/LineDropdownHaz/assets/title.svg delete mode 100644 src/packages/components/Charts/HazardousChemicalsSpace/LineGraph01Haz/assets/title.svg delete mode 100644 src/packages/components/Charts/HazardousChemicalsSpace/LineGraph01Haz/select.vue delete mode 100644 src/packages/components/Charts/HazardousChemicalsSpace/PieCenterHaz/assets/title.svg delete mode 100644 src/packages/components/Charts/HazardousChemicalsSpace/SmallBorder/assets/title.svg delete mode 100644 src/packages/components/Charts/HazardousChemicalsSpace/SmallBorder/config.ts delete mode 100644 src/packages/components/Charts/HazardousChemicalsSpace/SmallBorder/config.vue delete mode 100644 src/packages/components/Charts/HazardousChemicalsSpace/SmallBorder/index.ts delete mode 100644 src/packages/components/Charts/HazardousChemicalsSpace/SmallBorder/index.vue diff --git a/src/packages/components/Charts/HazardousChemicalsSpace/AlarmListHazC/config.ts b/src/packages/components/Charts/HazardousChemicalsSpace/AlarmListHazC/config.ts index 684b4d9..4456d07 100644 --- a/src/packages/components/Charts/HazardousChemicalsSpace/AlarmListHazC/config.ts +++ b/src/packages/components/Charts/HazardousChemicalsSpace/AlarmListHazC/config.ts @@ -2,6 +2,8 @@ import { PublicConfigClass } from '@/packages/public' import { CreateComponentType } from '@/packages/index.d' import { AlarmListHazCConfig } from './index' import dataJson from './data.json' +import { chartInitConfig } from '@/settings/designSetting' +import { cloneDeep } from 'lodash' export enum FontWeightEnum { NORMAL = '常规', BOLD = '加粗', @@ -38,20 +40,12 @@ export const option = { itemHeight: 28, fontSize: 12, titleText: '近60分钟报警信息', - titleSize: 16, - titleColor: '#eee', - fontWeight: 'normal', - fontStyle: 'italic', - paddingX: 45, - paddingY: -25, - letterSpacing: 0.5, - isShowButton: false } export default class Config extends PublicConfigClass implements CreateComponentType { public key = AlarmListHazCConfig.key public chartConfig = AlarmListHazCConfig - public option = option - + public option = cloneDeep(option) + public attr = { ...chartInitConfig, x: 0, y: 0, w: 450, h: 300, zIndex: 1 } } diff --git a/src/packages/components/Charts/HazardousChemicalsSpace/AlarmListHazC/index.vue b/src/packages/components/Charts/HazardousChemicalsSpace/AlarmListHazC/index.vue index c4485d6..879995d 100644 --- a/src/packages/components/Charts/HazardousChemicalsSpace/AlarmListHazC/index.vue +++ b/src/packages/components/Charts/HazardousChemicalsSpace/AlarmListHazC/index.vue @@ -33,18 +33,13 @@ - - - - \ No newline at end of file diff --git a/src/packages/components/Charts/HazardousChemicalsSpace/PieCenterHaz/assets/title.svg b/src/packages/components/Charts/HazardousChemicalsSpace/PieCenterHaz/assets/title.svg deleted file mode 100644 index 873f2e3..0000000 --- a/src/packages/components/Charts/HazardousChemicalsSpace/PieCenterHaz/assets/title.svg +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- -
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/packages/components/Charts/HazardousChemicalsSpace/PieCenterHaz/config.ts b/src/packages/components/Charts/HazardousChemicalsSpace/PieCenterHaz/config.ts index e5d24ef..948fa08 100644 --- a/src/packages/components/Charts/HazardousChemicalsSpace/PieCenterHaz/config.ts +++ b/src/packages/components/Charts/HazardousChemicalsSpace/PieCenterHaz/config.ts @@ -3,12 +3,13 @@ import { PieCenterConfig } from './index' import { CreateComponentType } from '@/packages/index.d' import cloneDeep from 'lodash/cloneDeep' import dataJson from './data.json' - +import { chartInitConfig } from '@/settings/designSetting' export const includes = ['legend'] // 其它配置 const otherConfig = { - sceneCode:'T04', + titleText: "报警统计", + sceneCode: 'T04', dateTime: { selectValue: 'day', dataset: [ @@ -236,4 +237,5 @@ export default class Config extends PublicConfigClass implements CreateComponent public key: string = PieCenterConfig.key public chartConfig = cloneDeep(PieCenterConfig) public option = echartOptionProfixHandle(option, includes) + public attr = { ...chartInitConfig, x: 0, y: 0, w: 450, h: 300, zIndex: 1 } } \ No newline at end of file diff --git a/src/packages/components/Charts/HazardousChemicalsSpace/PieCenterHaz/index.vue b/src/packages/components/Charts/HazardousChemicalsSpace/PieCenterHaz/index.vue index 05d1343..46de2f0 100644 --- a/src/packages/components/Charts/HazardousChemicalsSpace/PieCenterHaz/index.vue +++ b/src/packages/components/Charts/HazardousChemicalsSpace/PieCenterHaz/index.vue @@ -1,11 +1,11 @@ @@ -25,6 +25,7 @@ import { DatasetComponent, GridComponent, TooltipComponent, LegendComponent, Gra import CustomSelect from './select.vue' import dataJson from './data.json' import axiosInstance from '@/api/axios' +import PublicSmallBorder from '../../PublicSmallBorder/index.vue' const props = defineProps({ themeSetting: { @@ -285,64 +286,4 @@ const handleSelectChange = async (value: string) => { }; - + diff --git a/src/packages/components/Charts/HazardousChemicalsSpace/SmallBorder/assets/title.svg b/src/packages/components/Charts/HazardousChemicalsSpace/SmallBorder/assets/title.svg deleted file mode 100644 index 873f2e3..0000000 --- a/src/packages/components/Charts/HazardousChemicalsSpace/SmallBorder/assets/title.svg +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- -
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/packages/components/Charts/HazardousChemicalsSpace/SmallBorder/config.ts b/src/packages/components/Charts/HazardousChemicalsSpace/SmallBorder/config.ts deleted file mode 100644 index 460d165..0000000 --- a/src/packages/components/Charts/HazardousChemicalsSpace/SmallBorder/config.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { PublicConfigClass } from '@/packages/public' -import { CreateComponentType } from '@/packages/index.d' -import { SmallBorderConfig } from './index' -import cloneDeep from 'lodash/cloneDeep' - -export const option = { - colors: ['#1089ff', '#0000ff'], - backgroundColor: '#00000000' -} - -export default class Config extends PublicConfigClass implements CreateComponentType { - public key = SmallBorderConfig.key - public chartConfig = cloneDeep(SmallBorderConfig) - public option = cloneDeep(option) - - -} diff --git a/src/packages/components/Charts/HazardousChemicalsSpace/SmallBorder/config.vue b/src/packages/components/Charts/HazardousChemicalsSpace/SmallBorder/config.vue deleted file mode 100644 index 8c5b2c2..0000000 --- a/src/packages/components/Charts/HazardousChemicalsSpace/SmallBorder/config.vue +++ /dev/null @@ -1,54 +0,0 @@ - - - diff --git a/src/packages/components/Charts/HazardousChemicalsSpace/SmallBorder/index.ts b/src/packages/components/Charts/HazardousChemicalsSpace/SmallBorder/index.ts deleted file mode 100644 index 22e23e3..0000000 --- a/src/packages/components/Charts/HazardousChemicalsSpace/SmallBorder/index.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d' -// import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' -// 曲线图 -export const SmallBorderConfig: ConfigType = { - key: 'SmallBorder', - chartKey: 'VSmallBorder', - conKey: 'VCSmallBorder', - title: '带标题小边框', - category: 'MyComponents', - categoryName: '自定义组件', - package: 'Charts', - chartFrame: ChartFrameEnum.COMMON, - image: "SmallBorder.png", -} - -// 默认导出配置对象 -export default SmallBorderConfig \ No newline at end of file diff --git a/src/packages/components/Charts/HazardousChemicalsSpace/SmallBorder/index.vue b/src/packages/components/Charts/HazardousChemicalsSpace/SmallBorder/index.vue deleted file mode 100644 index 4b04a06..0000000 --- a/src/packages/components/Charts/HazardousChemicalsSpace/SmallBorder/index.vue +++ /dev/null @@ -1,83 +0,0 @@ - - - diff --git a/src/packages/components/Charts/HazardousChemicalsSpace/TopAlarmsHaz/config.ts b/src/packages/components/Charts/HazardousChemicalsSpace/TopAlarmsHaz/config.ts index cbaddb5..f3849b8 100644 --- a/src/packages/components/Charts/HazardousChemicalsSpace/TopAlarmsHaz/config.ts +++ b/src/packages/components/Charts/HazardousChemicalsSpace/TopAlarmsHaz/config.ts @@ -3,8 +3,9 @@ import { CreateComponentType } from '@/packages/index.d' import { TopAlarmsConfig } from './index' import dataJson from './data.json' import { cloneDeep } from 'lodash' +import { chartInitConfig } from '@/settings/designSetting' export const option = { - sceneCode: 'T04', + sceneCode: 'T05', componentIndexKey: "a", dateTime: { selectValue: 'day', @@ -34,24 +35,16 @@ export const option = { dataset: dataJson.source, titleText: '未处置报警数TOP5', - titleColor: '#eee', - titleSize: 16, rankColor: '#5AA1AD', nameColor: '#eeeeee', valueColor: '#eeeeee', barColorStart: '#2f72b5', barColorEnd: '#99C6E6', - dropdownOptions: ['当日', '当月', '当年'], - dropdownDefault: '当日', - iconColor: '#00E5FF', - letterSpacing: 0.5, - paddingX: 45, - paddingY: -5, isShowButton: false } export default class Config extends PublicConfigClass implements CreateComponentType { public key = TopAlarmsConfig.key public chartConfig = TopAlarmsConfig public option = cloneDeep(option) - + public attr = { ...chartInitConfig, x: 0, y: 0, w: 450, h: 300, zIndex: 1 } } diff --git a/src/packages/components/Charts/HazardousChemicalsSpace/TopAlarmsHaz/index.vue b/src/packages/components/Charts/HazardousChemicalsSpace/TopAlarmsHaz/index.vue index d52f0a9..6c5a516 100644 --- a/src/packages/components/Charts/HazardousChemicalsSpace/TopAlarmsHaz/index.vue +++ b/src/packages/components/Charts/HazardousChemicalsSpace/TopAlarmsHaz/index.vue @@ -1,40 +1,8 @@ - \ No newline at end of file