feat 【能源场景】:增加时间组件 完善其余组件样式 添加边框

This commit is contained in:
Free-sss 2025-09-05 16:10:26 +08:00
parent 6abd585310
commit 6666928c80
9 changed files with 181 additions and 99 deletions

View File

@ -1,6 +1,6 @@
<template> <template>
<Background :title-text="titleText" :select-option-mode="selectOptionMode" :select-options="selectOptions" <Background :title-text="titleText" :select-option-mode="selectOptionMode" :select-options="selectOptions"
:in-select-options="inSelectOptions" @mode1-2-select="handleHeaderSelectChange"> @mode1-2-select="handleHeaderSelectChange">
<div class="go-energy-box"> <div class="go-energy-box">
<div class="content"> <div class="content">
<v-chart ref="vChartRef" :init-options="initOptions" :theme="themeColor" :option="option" :update-options="{ <v-chart ref="vChartRef" :init-options="initOptions" :theme="themeColor" :option="option" :update-options="{
@ -70,9 +70,7 @@ const selectOptionMode = computed(() => {
const selectOptions = computed(() => { const selectOptions = computed(() => {
return props.chartConfig.option.selectOptions; return props.chartConfig.option.selectOptions;
}); });
const inSelectOptions = computed(() => {
return props.chartConfig.option.inSelectOptions;
});
watch( watch(
() => props.chartConfig.option.dataset, () => props.chartConfig.option.dataset,
(newData: any) => { (newData: any) => {

View File

@ -3,25 +3,37 @@ import { PowerConsumptionRankingSystemConfig } from './index';
import { CreateComponentType } from '@/packages/index.d'; import { CreateComponentType } from '@/packages/index.d';
import cloneDeep from 'lodash/cloneDeep'; import cloneDeep from 'lodash/cloneDeep';
import { chartInitConfig } from '@/settings/designSetting'; import { chartInitConfig } from '@/settings/designSetting';
import dataJson from './data.json' import dataJson from './data.json';
// 下拉菜单配置mode 为 2 表示“下拉菜单”options 是下拉选项列表
const dropdownConfig = {
selectOptionMode: 1,
selectOptions: {
selectedValue: 'electricity', // 默认选中的选项值
dataset: [
{ label: '市电', value: 'electricity' },
{ label: '供水', value: 'water' },
{ label: '燃气', value: 'gas' }
]
}
};
export const option = { export const option = {
// 进行时效果 titleText: '用电量排名',
...dropdownConfig, // 合并下拉配置到 option 中
processing: true, processing: true,
// 渐变颜色 color: '#39ffdc',
color: '#23ffe2', color2: '#39fedb',
color2: '#0f86eb', railColor: '#00000000',
// 轨道颜色
railColor: '#09222e',
railBorderColor: '#0d5f68', railBorderColor: '#0d5f68',
borderRadius: 50, borderRadius: 50,
railWidth: 60, railWidth: 60,
dataset: dataJson dataset: dataJson
} };
export default class Config extends PublicConfigClass implements CreateComponentType { export default class Config extends PublicConfigClass implements CreateComponentType {
public key = PowerConsumptionRankingSystemConfig.key public key = PowerConsumptionRankingSystemConfig.key;
public attr = { ...chartInitConfig, w: 450, h: 320, zIndex: 1 } public attr = { ...chartInitConfig, w: 450, h: 320, zIndex: -1 };
public chartConfig = cloneDeep(PowerConsumptionRankingSystemConfig) public chartConfig = cloneDeep(PowerConsumptionRankingSystemConfig);
public option = cloneDeep(option) public option = cloneDeep(option);
} }

View File

@ -9,6 +9,9 @@
<div class="tab">燃气</div> <div class="tab">燃气</div>
</div> </div>
</div> --> </div> -->
<Background :title-text="chartConfig.option.titleText" :select-option-mode="chartConfig.option.selectOptionMode"
:select-options="chartConfig.option.selectOptions" @mode1-2-select="handleDropdownSelect">
<div class="container">
<div v-for="(item, index) in dataset" :key="index" class="flex_v chart_item"> <div v-for="(item, index) in dataset" :key="index" class="flex_v chart_item">
<!-- 包裹每行的内容序号名称进度条数值 --> <!-- 包裹每行的内容序号名称进度条数值 -->
@ -33,13 +36,18 @@
</div> </div>
</div> </div>
</div> </div>
</Background>
</div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { PropType, toRefs, watch, shallowReactive, onMounted } from 'vue' import { PropType, toRefs, watch, onMounted } from 'vue'
import { useChartDataFetch } from '@/hooks' import { useChartDataFetch } from '@/hooks'
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
import config, { option as configOption } from './config' import config, { option as configOption } from './config'
import Background from '../Background/index.vue'
const props = defineProps({ const props = defineProps({
chartConfig: { chartConfig: {
type: Object as PropType<config>, type: Object as PropType<config>,
@ -52,6 +60,10 @@ const { w, h } = toRefs(props.chartConfig.attr)
const { color, color2, railColor, railBorderColor, borderRadius, railWidth, dataset } = toRefs( const { color, color2, railColor, railBorderColor, borderRadius, railWidth, dataset } = toRefs(
props.chartConfig.option props.chartConfig.option
) )
const handleDropdownSelect = (value: string) => {
console.log('下拉选中值:', value);
};
// //
watch( watch(
@ -80,9 +92,6 @@ useChartDataFetch(props.chartConfig, useChartEditStore, (newData: Array<{ name:
} }
.flex_column { .flex_column {
// background-color: antiquewhite;
width: 100%;
height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
@ -93,65 +102,6 @@ useChartDataFetch(props.chartConfig, useChartEditStore, (newData: Array<{ name:
align-items: center; align-items: center;
} }
// .wrapper {
// width: 450px;
// height: 320px;
// background: url('./images/_03.png') no-repeat center center;
// background-size: cover;
// padding: 10px;
// box-sizing: border-box;
// }
// .title-bar {
// display: flex;
// justify-content: space-between;
// align-items: center;
// margin-bottom: 10px;
// color: #fff;
// }
// .title {
// font-size: 16px;
// font-weight: bold;
// margin-left: 30px;
// width: 100px;
// white-space: nowrap;
// overflow: hidden;
// text-overflow: ellipsis;
// font-family: "", sans-serif;
// letter-spacing: 2px;
// padding-bottom: 2px;
// }
// .tabs {
// display: flex;
// }
// .tab {
// padding-right: 6px;
// margin-left: 6px;
// cursor: pointer;
// font-size: 16px;
// white-space: nowrap;
// overflow: hidden;
// text-overflow: ellipsis;
// font-family: "";
// color: #2A99FF;
// }
// .tab.active {
// // background-color: #007bff;
// }
// .name {
// width: 100px;
// white-space: nowrap;
// overflow: hidden;
// text-overflow: ellipsis;
// padding: 8px;
// color: #fff;
// }
.value { .value {
margin: 0 0 0 10px; margin: 0 0 0 10px;
@ -170,6 +120,7 @@ useChartDataFetch(props.chartConfig, useChartEditStore, (newData: Array<{ name:
.bar_body { .bar_body {
background: linear-gradient(to right, v-bind('color'), v-bind('color2')); background: linear-gradient(to right, v-bind('color'), v-bind('color2'));
box-shadow: 0 0 10px 5px rgba(#39ffdc, 0.5);
} }
.progressClass { .progressClass {
@ -223,6 +174,7 @@ useChartDataFetch(props.chartConfig, useChartEditStore, (newData: Array<{ name:
width: 180px; width: 180px;
// //
margin-left: 10px; margin-left: 10px;
color: #fff;
} }
.right-group { .right-group {
@ -242,4 +194,8 @@ useChartDataFetch(props.chartConfig, useChartEditStore, (newData: Array<{ name:
height: 35px; height: 35px;
box-sizing: border-box; // box-sizing: border-box; //
} }
.container {
// padding: 30px;
}
</style> </style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

View File

@ -0,0 +1,20 @@
import { PublicConfigClass } from '@/packages/public'
import { CreateComponentType } from '@/packages/index.d'
import { TimeSelectConfig } from './index'
import cloneDeep from 'lodash/cloneDeep'
import { chartInitConfig } from '@/settings/designSetting'
const otherOption = {
}
export const option = {
...otherOption,
}
export default class Config extends PublicConfigClass implements CreateComponentType {
public key = TimeSelectConfig.key
public chartConfig = cloneDeep(TimeSelectConfig)
public option = cloneDeep(option)
public attr = { ...chartInitConfig, x: 0, y: 0, w: 310, h: 58, zIndex: 10 }
}

View File

@ -0,0 +1,18 @@
<template>
<div>
你好
</div>
</template>
<script setup lang="ts">
import { PropType } from 'vue'
import { option } from './config'
defineProps({
optionData: {
type: Object as PropType<typeof option>,
required: true
}
})
</script>

View File

@ -0,0 +1,14 @@
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
export const TimeSelectConfig: ConfigType = {
key: 'TimeSelect',
chartKey: 'VTimeSelect',
conKey: 'VCTimeSelect',
title: '时间选择器',
category: ChatCategoryEnum.IntegratedEnergy,
categoryName: ChatCategoryEnumName.IntegratedEnergy,
package: PackagesCategoryEnum.CHARTS,
chartFrame: ChartFrameEnum.ECHARTS,
image: 'TimeSelect.png'
}

View File

@ -0,0 +1,62 @@
<template>
<div class="go-engry-timeBack">
<div class="content" :style="{ backgroundImage: 'url(' + timeBackground + ')' }">
<span class="day item"></span>
<span class="month item"></span>
<span class="year active item"></span>
</div>
</div>
</template>
<script lang="ts" setup>
import timeBackground from './assets/timeBackground.png'
</script>
<style lang="scss" scoped>
.go-engry-timeBack {
.content {
background-size: 100% 100%;
background-repeat: no-repeat;
display: flex;
padding-left: 14px;
span {
// background-color: antiquewhite;
flex: 1;
margin-left: 10px;
}
.item {
display: flex;
justify-content: center;
align-items: center;
color: #b9b9b9;
font-size: 21px;
box-sizing: content-box;
// background-color: antiquewhite;
&.active {
color: #fff;
}
}
.day {
margin-left: 20px;
}
.month {
margin-left: 15px;
}
.year {
flex: 2;
margin-right: 40px;
}
}
}
</style>

View File

@ -8,10 +8,12 @@ import { PowerSupplySystemConfig } from './PowerSupplySystem'
import { GasSystemConfig } from './GasSystem' import { GasSystemConfig } from './GasSystem'
import { ConstructionIndexConfig } from './ConstructionIndex' import { ConstructionIndexConfig } from './ConstructionIndex'
import { CarbonEmissionConfig } from './CarbonEmission' import { CarbonEmissionConfig } from './CarbonEmission'
import { PowerConsumptionRankingSystemConfig } from "./PowerConsumptionRankingSystem"
import { TimeSelectConfig } from './TimeSelect'
export default [ export default [
EnergyOverviewConfig, EnergyConsumptionTrendConfig, EnergyOverviewConfig, EnergyConsumptionTrendConfig,
ConsumptionProportionConfig, ConsumptionProportionConfig,
FeeOverviewConfig, FeeOverviewConfig,
WaterSupplySystemConfig, AirSupplySystemConfig, PowerSupplySystemConfig, WaterSupplySystemConfig, AirSupplySystemConfig, PowerSupplySystemConfig,
GasSystemConfig,CarbonEmissionConfig,ConstructionIndexConfig GasSystemConfig, CarbonEmissionConfig, ConstructionIndexConfig, PowerConsumptionRankingSystemConfig, TimeSelectConfig
] ]