新增站点地图静态页面,项目新增ems router文件、components文件、mixin文件、scss文件和view文件

This commit is contained in:
白菜
2025-06-16 15:54:10 +08:00
parent 598c16da9c
commit b2fdb2d6b8
10 changed files with 436 additions and 1 deletions

View File

@ -0,0 +1,76 @@
<!--站点地图页面柱状图组件-->
<template>
<div class="bar-chart-container"></div>
</template>
<script>
import * as echarts from 'echarts'
require('echarts/theme/macarons') // echarts theme
import resize from '@/mixins/ems/resize'
// todo
// 数据获取、数据格式处理、日期在前端处理还是后端返回
export default {
mixins: [resize],
data() {
return {
chart: null
}
},
mounted() {
this.$nextTick(() => {
this.initChart()
})
},
beforeDestroy() {
if (!this.chart) {
return
}
this.chart.dispose()
this.chart = null
},
methods: {
initChart() {
this.chart = echarts.init(this.$el, 'macarons')
this.chart.setOption({
legend: {
left: 'right',
bottom: '10',
},
tooltip: {},
xAxis: { type: 'category' },
yAxis: { },
dataset:{
source:[
['product','充电量','放电量'],
['第一天',10,20],
['第二天',20,30],
['第三天',20,30],
['第四天',20,10],
['第五天',200,80],
['第六天',210,300],
['第七天',200,30],
]
},
series: [
{
type: 'bar',//柱状图
color:'#A796FF',//柱的颜色
},
{
type: 'bar',//柱状图
color:'#FFBE01',//柱的颜色
}
]
})
}
}
}
</script>
<style scoped lang="scss">
.bar-chart-container{
width:100%;
height: 260px;
}
</style>