From f257aad52ee4b8a7c59ab0c093fe3290c480580a Mon Sep 17 00:00:00 2001 From: Free-sss <630042479@qq.com> Date: Wed, 3 Sep 2025 11:00:44 +0800 Subject: [PATCH 1/2] =?UTF-8?q?style=EF=BC=9A=E4=BF=AE=E6=94=B9=E8=83=BD?= =?UTF-8?q?=E6=BA=90=E8=B6=8B=E5=8A=BF=E6=A0=B7=E5=BC=8F=E4=BB=A5=E9=80=82?= =?UTF-8?q?=E9=85=8D=E8=A6=81=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EnergyConsumptionTrend/config.ts | 68 ++++++++++--------- .../EnergyConsumptionTrend/data.json | 3 +- .../EnergyConsumptionTrend/index.vue | 19 +++++- 3 files changed, 54 insertions(+), 36 deletions(-) diff --git a/src/packages/components/Charts/IntegratedEnergy/EnergyConsumptionTrend/config.ts b/src/packages/components/Charts/IntegratedEnergy/EnergyConsumptionTrend/config.ts index c2ddc53..fe70cfa 100644 --- a/src/packages/components/Charts/IntegratedEnergy/EnergyConsumptionTrend/config.ts +++ b/src/packages/components/Charts/IntegratedEnergy/EnergyConsumptionTrend/config.ts @@ -5,12 +5,25 @@ import cloneDeep from 'lodash/cloneDeep' import dataJson from './data.json' import * as echarts from 'echarts' -export const includes = ['title'] -// 基于准备好的dom,初始化echarts实例 -// var myChart = echarts.init(document.getElementById('main')); - +export const includes = [] +const otherOption = { + unit: '万kwh', +} const option = { + ...otherOption, + dataset: dataJson, + // 添加标题配置 + title: { + text: '单位:' + otherOption.unit, + left: '3%', + top: '3%', + textStyle: { + fontSize: 12, + color: 'rgba(255, 255, 255, 0.7)', + fontWeight: 'normal' + } + }, // 提示框配置 tooltip: { trigger: 'axis', @@ -23,7 +36,6 @@ const option = { color: '#ffffff' } }, - dataset: dataJson, // 网格配置 grid: { left: '3%', @@ -38,7 +50,7 @@ const option = { type: 'category', axisLine: { lineStyle: { - color: '#eee' + color: 'rgba(255, 255, 255, 0.1)', } }, axisTick: { @@ -46,7 +58,7 @@ const option = { }, // axisLabel: { - color: '#80b0c4', + color: '#eee', interval: 0, fontSize: 9, margin: 20 @@ -60,8 +72,10 @@ const option = { min: 0, interval: 25, axisLine: { - show: false, - + show: true, + lineStyle: { + color: 'rgba(255, 255, 255, 0.1)', + } }, axisTick: { show: false @@ -83,22 +97,21 @@ const option = { name: '能源消耗', type: 'bar', - // data: values.map((value, index) => ({ - // value: value, itemStyle: { color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [ - { offset: 0, color: '#1d7b7b' }, // 更暗的左侧颜色,增强阴影效果 - { offset: 0.2, color: '#196b6b' }, // 左侧过渡色 - { offset: 0.7, color: '#00cccc' }, // 中间主色 - { offset: 0.8, color: '#33dddd' }, // 右侧过渡色 - { offset: 1, color: '#66ffff' } // 右侧亮色,增强高光效果 + { offset: 0, color: '#82ffff' }, // 更暗的左侧颜色,增强阴影效果 + { offset: 0.2, color: '#00bfbf' }, // 左侧过渡色 + { offset: 0.5, color: '#008f8f' }, // 中间主色 + { offset: 0.8, color: '#00bfbf' }, // 右侧过渡色 + { offset: 1, color: '#82ffff' } // 右侧亮色,增强高光效果 ]), + opacity: 0.60, // 添加更强的3D效果 shadowBlur: 20, shadowColor: 'rgba(0, 0, 0, 0.7)', shadowOffsetX: -5, shadowOffsetY: 5, - borderRadius: [0, 0, 6, 6], + borderRadius: [0, 0, 4, 4], borderWidth: 0, }, @@ -112,20 +125,21 @@ const option = { }, // })), - barWidth: '40%', + barWidth: '45%', // 3D圆柱体效果 - roundCap: true + roundCap: false }, { name: '顶部圆', type: 'pictorialBar', z: 3, - symbolSize: ['57%', '10'], - symbolOffset: [0.1, -5], + symbolSize: ['62%', '6'], + symbolOffset: [0.1, -3], symbolPosition: "end", itemStyle: { - color: "#40ECEC", + color: "rgba(51, 221, 221, 0.8)", }, + // opacity: 0.1, emphasis: { itemStyle: { shadowColor: 'rgba(0, 255, 255, 0.8)', @@ -137,16 +151,6 @@ const option = { // 图形元素配置 graphic: [{ - // 单位标注 - type: 'text', - left: '3%', - top: '3%', - style: { - text: '单位:' + dataJson.unit, - fontSize: 12, - fill: 'rgba(255, 255, 255, 0.7)', - } - }, { // 左侧阴影效果 type: 'rect', left: 0, diff --git a/src/packages/components/Charts/IntegratedEnergy/EnergyConsumptionTrend/data.json b/src/packages/components/Charts/IntegratedEnergy/EnergyConsumptionTrend/data.json index d85cca9..e5174a7 100644 --- a/src/packages/components/Charts/IntegratedEnergy/EnergyConsumptionTrend/data.json +++ b/src/packages/components/Charts/IntegratedEnergy/EnergyConsumptionTrend/data.json @@ -52,6 +52,5 @@ "month": "12月", "value": 67 } - ], - "unit": "万kwh" + ] } \ No newline at end of file diff --git a/src/packages/components/Charts/IntegratedEnergy/EnergyConsumptionTrend/index.vue b/src/packages/components/Charts/IntegratedEnergy/EnergyConsumptionTrend/index.vue index fbb614e..021058e 100644 --- a/src/packages/components/Charts/IntegratedEnergy/EnergyConsumptionTrend/index.vue +++ b/src/packages/components/Charts/IntegratedEnergy/EnergyConsumptionTrend/index.vue @@ -11,7 +11,7 @@ From c11e5ded59129b3105595a989f227a95e32f2475 Mon Sep 17 00:00:00 2001 From: Free-sss <630042479@qq.com> Date: Wed, 3 Sep 2025 11:27:20 +0800 Subject: [PATCH 2/2] =?UTF-8?q?style=EF=BC=9A=E4=BF=AE=E6=94=B9=EF=BC=88?= =?UTF-8?q?=E8=B4=B9=E7=94=A8=E6=80=BB=E8=A7=88=EF=BC=89=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E5=8C=B9=E9=85=8D=E8=A6=81=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IntegratedEnergy/EnergyOverview/config.ts | 37 +++- .../IntegratedEnergy/EnergyOverview/data.json | 8 +- .../IntegratedEnergy/EnergyOverview/index.vue | 174 ++++++++++-------- 3 files changed, 139 insertions(+), 80 deletions(-) diff --git a/src/packages/components/Charts/IntegratedEnergy/EnergyOverview/config.ts b/src/packages/components/Charts/IntegratedEnergy/EnergyOverview/config.ts index bd7b419..045e252 100644 --- a/src/packages/components/Charts/IntegratedEnergy/EnergyOverview/config.ts +++ b/src/packages/components/Charts/IntegratedEnergy/EnergyOverview/config.ts @@ -3,9 +3,44 @@ import { CreateComponentType } from '@/packages/index.d' import { EnergyOverviewConfig } from './index' import cloneDeep from 'lodash/cloneDeep' import { chartInitConfig } from '@/settings/designSetting' + //导入数据 +import costIcon from './assets/cost.svg' import dataJson from './data.json' +const otherOption = { + gridItems: [ + { + icon: costIcon, + label: '费用', + field: 'cost', + unit: '单位', + valueClass: 'value-cost' + }, + { + icon: costIcon, + label: '市电', + field: 'mainsElectricity', + unit: '单位', + valueClass: 'value-electricity' + }, + { + icon: costIcon, + label: '供水', + field: 'waterSupply', + unit: '单位', + valueClass: 'value-water' + }, + { + icon: costIcon, + label: '燃气', + field: 'gasSupply', + unit: '单位', + valueClass: 'value-gas' + } + ] +} export const option = { + ...otherOption, dataset: dataJson } @@ -13,5 +48,5 @@ export default class Config extends PublicConfigClass implements CreateComponent public key = EnergyOverviewConfig.key public chartConfig = cloneDeep(EnergyOverviewConfig) public option = cloneDeep(option) - public attr = { ...chartInitConfig, x: 0, y: 0, w: 1000, h: 240, zIndex: 1 } + public attr = { ...chartInitConfig, x: 0, y: 0, w: 889, h: 267, zIndex: 1 } } diff --git a/src/packages/components/Charts/IntegratedEnergy/EnergyOverview/data.json b/src/packages/components/Charts/IntegratedEnergy/EnergyOverview/data.json index 855d1a2..f2aa49a 100644 --- a/src/packages/components/Charts/IntegratedEnergy/EnergyOverview/data.json +++ b/src/packages/components/Charts/IntegratedEnergy/EnergyOverview/data.json @@ -1,6 +1,6 @@ { - "cost":1000, - "mainsElectricity":1000, - "waterSupply":1000, - "gasSupply":1000 + "cost": 1000, + "mainsElectricity": 1000, + "waterSupply": 1000, + "gasSupply": 1000 } \ No newline at end of file diff --git a/src/packages/components/Charts/IntegratedEnergy/EnergyOverview/index.vue b/src/packages/components/Charts/IntegratedEnergy/EnergyOverview/index.vue index 5abf40f..4aaf997 100644 --- a/src/packages/components/Charts/IntegratedEnergy/EnergyOverview/index.vue +++ b/src/packages/components/Charts/IntegratedEnergy/EnergyOverview/index.vue @@ -1,59 +1,48 @@ - + - + - 费用 - {{ option.dataset.cost.toFixed(2) }} - 单位 - - - - - - - 市电 - {{ option.dataset.mainsElectricity.toFixed(2) }} - 单位 - - - - - - 供水 - {{ option.dataset.waterSupply.toFixed(2) }} - 单位 - - - - - - 燃气 - {{ option.dataset.gasSupply.toFixed(2) }} - 单位 + + {{ item.label }} + + + {{ getDataValue(item.field).toFixed(2) }} + + {{ item.unit }} + + - -