|
@@ -37,7 +37,7 @@
|
|
|
end-placeholder="结束时间"
|
|
end-placeholder="结束时间"
|
|
|
:shortcuts="shortcuts"
|
|
:shortcuts="shortcuts"
|
|
|
/>
|
|
/>
|
|
|
- <div style="height: 100%" ref="homeLineRef"></div>
|
|
|
|
|
|
|
+ <div style="height: 100%;padding: 20px;" ref="homeLineRef"></div>
|
|
|
</div>
|
|
</div>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :xs="24" :sm="10" :md="10" :lg="8" :xl="8" class="home-media">
|
|
<el-col :xs="24" :sm="10" :md="10" :lg="8" :xl="8" class="home-media">
|
|
@@ -83,6 +83,8 @@ import * as echarts from 'echarts';
|
|
|
import {storeToRefs} from 'pinia';
|
|
import {storeToRefs} from 'pinia';
|
|
|
import {useThemeConfig} from '/@/stores/themeConfig';
|
|
import {useThemeConfig} from '/@/stores/themeConfig';
|
|
|
import {useTagsViewRoutes} from '/@/stores/tagsViewRoutes';
|
|
import {useTagsViewRoutes} from '/@/stores/tagsViewRoutes';
|
|
|
|
|
+import {$get} from "/@/utils/request";
|
|
|
|
|
+import u from "/@/utils/u";
|
|
|
|
|
|
|
|
// 定义变量内容
|
|
// 定义变量内容
|
|
|
const homeLineRef = ref();
|
|
const homeLineRef = ref();
|
|
@@ -98,6 +100,7 @@ const start = new Date()
|
|
|
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
|
|
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
|
|
|
|
|
|
|
|
const state = reactive({
|
|
const state = reactive({
|
|
|
|
|
+
|
|
|
dateRange:[start,end],
|
|
dateRange:[start,end],
|
|
|
global: {
|
|
global: {
|
|
|
homeChartOne: null,
|
|
homeChartOne: null,
|
|
@@ -256,9 +259,13 @@ const shortcuts = [
|
|
|
]
|
|
]
|
|
|
|
|
|
|
|
// 折线图
|
|
// 折线图
|
|
|
-const initLineChart = () => {
|
|
|
|
|
|
|
+const initLineChart = (dataList:Array<any>) => {
|
|
|
if (!state.global.dispose.some((b: any) => b === state.global.homeChartOne)) state.global.homeChartOne.dispose();
|
|
if (!state.global.dispose.some((b: any) => b === state.global.homeChartOne)) state.global.homeChartOne.dispose();
|
|
|
state.global.homeChartOne = markRaw(echarts.init(homeLineRef.value, state.charts.theme));
|
|
state.global.homeChartOne = markRaw(echarts.init(homeLineRef.value, state.charts.theme));
|
|
|
|
|
+
|
|
|
|
|
+ u.sort(dataList,"statTime")
|
|
|
|
|
+
|
|
|
|
|
+ let xAxis = dataList.map(k=>k.statTime)
|
|
|
const option = {
|
|
const option = {
|
|
|
backgroundColor: state.charts.bgColor,
|
|
backgroundColor: state.charts.bgColor,
|
|
|
title: {
|
|
title: {
|
|
@@ -270,7 +277,8 @@ const initLineChart = () => {
|
|
|
tooltip: {trigger: 'axis'},
|
|
tooltip: {trigger: 'axis'},
|
|
|
legend: {data: ['充电量', '总金额','电费','服务费',], right: 0},
|
|
legend: {data: ['充电量', '总金额','电费','服务费',], right: 0},
|
|
|
xAxis: {
|
|
xAxis: {
|
|
|
- data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
|
|
|
|
|
|
|
+ data: xAxis,
|
|
|
|
|
+ // data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
|
|
|
},
|
|
},
|
|
|
yAxis: [
|
|
yAxis: [
|
|
|
{
|
|
{
|
|
@@ -286,7 +294,8 @@ const initLineChart = () => {
|
|
|
symbolSize: 6,
|
|
symbolSize: 6,
|
|
|
symbol: 'circle',
|
|
symbol: 'circle',
|
|
|
smooth: true,
|
|
smooth: true,
|
|
|
- data: [0, 41.1, 30.4, 65.1, 53.3, 53.3, 53.3, 41.1, 30.4, 65.1, 53.3, 10],
|
|
|
|
|
|
|
+ data: dataList.map(k=>k.totalPower),
|
|
|
|
|
+ // data: [0, 41.1, 30.4, 65.1, 53.3, 53.3, 53.3, 41.1, 30.4, 65.1, 53.3, 10],
|
|
|
lineStyle: {color: '#25b8d2'},
|
|
lineStyle: {color: '#25b8d2'},
|
|
|
itemStyle: {color: '#25b8d2', borderColor: '#25b8d2'},
|
|
itemStyle: {color: '#25b8d2', borderColor: '#25b8d2'},
|
|
|
areaStyle: {
|
|
areaStyle: {
|
|
@@ -302,7 +311,7 @@ const initLineChart = () => {
|
|
|
symbolSize: 6,
|
|
symbolSize: 6,
|
|
|
symbol: 'circle',
|
|
symbol: 'circle',
|
|
|
smooth: true,
|
|
smooth: true,
|
|
|
- data: [0, 31.1, 32.4, 45.1, 43.3, 43.3, 43.3, 31.1, 20.4, 45.1, 73.3, 40],
|
|
|
|
|
|
|
+ data: dataList.map(k=>u.fmt.fmtMoney(k.totalPower)),
|
|
|
lineStyle: {color: '#fe9a8b'},
|
|
lineStyle: {color: '#fe9a8b'},
|
|
|
itemStyle: {color: '#fe9a8b', borderColor: '#fe9a8b'},
|
|
itemStyle: {color: '#fe9a8b', borderColor: '#fe9a8b'},
|
|
|
areaStyle: {
|
|
areaStyle: {
|
|
@@ -318,7 +327,7 @@ const initLineChart = () => {
|
|
|
symbolSize: 6,
|
|
symbolSize: 6,
|
|
|
symbol: 'circle',
|
|
symbol: 'circle',
|
|
|
smooth: true,
|
|
smooth: true,
|
|
|
- data: [0, 21.1, 30.4, 35.1, 53.3, 33.3, 53.3, 41.1, 20.4, 55.1, 43.3, 40],
|
|
|
|
|
|
|
+ data: dataList.map(k=>u.fmt.fmtMoney(k.elecMoney)),
|
|
|
lineStyle: {color: '#b5fe8b'},
|
|
lineStyle: {color: '#b5fe8b'},
|
|
|
itemStyle: {color: '#b5fe8b', borderColor: '#b5fe8b'},
|
|
itemStyle: {color: '#b5fe8b', borderColor: '#b5fe8b'},
|
|
|
areaStyle: {
|
|
areaStyle: {
|
|
@@ -334,7 +343,7 @@ const initLineChart = () => {
|
|
|
symbolSize: 6,
|
|
symbolSize: 6,
|
|
|
symbol: 'circle',
|
|
symbol: 'circle',
|
|
|
smooth: true,
|
|
smooth: true,
|
|
|
- data: [0, 24.1, 7.2, 15.5, 42.4, 42.4, 42.4, 24.1, 7.2, 15.5, 42.4, 0],
|
|
|
|
|
|
|
+ data: dataList.map(k=>u.fmt.fmtMoney(k.serviceMoney)),
|
|
|
lineStyle: {color: '#9E87FF'},
|
|
lineStyle: {color: '#9E87FF'},
|
|
|
itemStyle: {color: '#9E87FF', borderColor: '#9E87FF'},
|
|
itemStyle: {color: '#9E87FF', borderColor: '#9E87FF'},
|
|
|
areaStyle: {
|
|
areaStyle: {
|
|
@@ -370,15 +379,17 @@ const initLineChart = () => {
|
|
|
state.myCharts.push(state.global.homeChartOne);
|
|
state.myCharts.push(state.global.homeChartOne);
|
|
|
};
|
|
};
|
|
|
// 饼图
|
|
// 饼图
|
|
|
-const initPieChart = () => {
|
|
|
|
|
|
|
+const initPieChart = (dataMap:any) => {
|
|
|
if (!state.global.dispose.some((b: any) => b === state.global.homeChartTwo)) state.global.homeChartTwo.dispose();
|
|
if (!state.global.dispose.some((b: any) => b === state.global.homeChartTwo)) state.global.homeChartTwo.dispose();
|
|
|
state.global.homeChartTwo = markRaw(echarts.init(homePieRef.value, state.charts.theme));
|
|
state.global.homeChartTwo = markRaw(echarts.init(homePieRef.value, state.charts.theme));
|
|
|
var getname = ['空闲', '已连接', '充电中'];
|
|
var getname = ['空闲', '已连接', '充电中'];
|
|
|
- var getvalue = [34.2, 38.87, 17.88];
|
|
|
|
|
|
|
+ // var getvalue = [34.2, 38.87, 17.88];
|
|
|
|
|
+ // var data = [dataMap["0"]||0,dataMap["1"]||0,dataMap["2"]||0];
|
|
|
var data = [];
|
|
var data = [];
|
|
|
for (var i = 0; i < getname.length; i++) {
|
|
for (var i = 0; i < getname.length; i++) {
|
|
|
- data.push({name: getname[i], value: getvalue[i]});
|
|
|
|
|
|
|
+ data.push({name: getname[i], value: dataMap[`${i}`]||0});
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
const colorList = ['#51A3FC', '#36C78B', '#FEC279', '#968AF5', '#E790E8'];
|
|
const colorList = ['#51A3FC', '#36C78B', '#FEC279', '#968AF5', '#E790E8'];
|
|
|
const option = {
|
|
const option = {
|
|
|
backgroundColor: state.charts.bgColor,
|
|
backgroundColor: state.charts.bgColor,
|
|
@@ -387,7 +398,7 @@ const initPieChart = () => {
|
|
|
x: 'left',
|
|
x: 'left',
|
|
|
textStyle: {fontSize: '15', color: state.charts.color},
|
|
textStyle: {fontSize: '15', color: state.charts.color},
|
|
|
},
|
|
},
|
|
|
- tooltip: {trigger: 'item', formatter: '{b} <br/> {c}%'},
|
|
|
|
|
|
|
+ tooltip: {trigger: 'item', formatter: '{b} <br/> {c}'},
|
|
|
graphic: {
|
|
graphic: {
|
|
|
elements: [
|
|
elements: [
|
|
|
{
|
|
{
|
|
@@ -455,136 +466,6 @@ const initPieChart = () => {
|
|
|
state.myCharts.push(state.global.homeChartTwo);
|
|
state.myCharts.push(state.global.homeChartTwo);
|
|
|
};
|
|
};
|
|
|
// 柱状图
|
|
// 柱状图
|
|
|
-const initBarChart = () => {
|
|
|
|
|
- if (!state.global.dispose.some((b: any) => b === state.global.homeCharThree)) state.global.homeCharThree.dispose();
|
|
|
|
|
- state.global.homeCharThree = markRaw(echarts.init(homeBarRef.value, state.charts.theme));
|
|
|
|
|
- const option = {
|
|
|
|
|
- backgroundColor: state.charts.bgColor,
|
|
|
|
|
- title: {
|
|
|
|
|
- text: '地热开发利用',
|
|
|
|
|
- x: 'left',
|
|
|
|
|
- textStyle: {fontSize: '15', color: state.charts.color},
|
|
|
|
|
- },
|
|
|
|
|
- tooltip: {trigger: 'axis'},
|
|
|
|
|
- legend: {data: ['供温', '回温', '压力值(Mpa)'], right: 0},
|
|
|
|
|
- grid: {top: 70, right: 80, bottom: 30, left: 80},
|
|
|
|
|
- xAxis: [
|
|
|
|
|
- {
|
|
|
|
|
- type: 'category',
|
|
|
|
|
- data: ['1km', '2km', '3km', '4km', '5km', '6km'],
|
|
|
|
|
- boundaryGap: true,
|
|
|
|
|
- axisTick: {show: false},
|
|
|
|
|
- },
|
|
|
|
|
- ],
|
|
|
|
|
- yAxis: [
|
|
|
|
|
- {
|
|
|
|
|
- name: '供回温度(℃)',
|
|
|
|
|
- nameLocation: 'middle',
|
|
|
|
|
- nameTextStyle: {padding: [3, 4, 50, 6]},
|
|
|
|
|
- splitLine: {show: true, lineStyle: {type: 'dashed', color: '#f5f5f5'}},
|
|
|
|
|
- axisLine: {show: false},
|
|
|
|
|
- axisTick: {show: false},
|
|
|
|
|
- axisLabel: {color: state.charts.color, formatter: '{value} '},
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- name: '压力值(Mpa)',
|
|
|
|
|
- nameLocation: 'middle',
|
|
|
|
|
- nameTextStyle: {padding: [50, 4, 5, 6]},
|
|
|
|
|
- splitLine: {show: false},
|
|
|
|
|
- axisLine: {show: false},
|
|
|
|
|
- axisTick: {show: false},
|
|
|
|
|
- axisLabel: {color: state.charts.color, formatter: '{value} '},
|
|
|
|
|
- },
|
|
|
|
|
- ],
|
|
|
|
|
- series: [
|
|
|
|
|
- {
|
|
|
|
|
- name: '供温',
|
|
|
|
|
- type: 'line',
|
|
|
|
|
- smooth: true,
|
|
|
|
|
- showSymbol: true,
|
|
|
|
|
- // 矢量画五角星
|
|
|
|
|
- symbol: 'path://M150 0 L80 175 L250 75 L50 75 L220 175 Z',
|
|
|
|
|
- symbolSize: 12,
|
|
|
|
|
- yAxisIndex: 0,
|
|
|
|
|
- areaStyle: {
|
|
|
|
|
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
|
|
- {offset: 0, color: 'rgba(250,180,101,0.3)'},
|
|
|
|
|
- {offset: 1, color: 'rgba(250,180,101,0)'},
|
|
|
|
|
- ]),
|
|
|
|
|
- shadowColor: 'rgba(250,180,101,0.2)',
|
|
|
|
|
- shadowBlur: 20,
|
|
|
|
|
- },
|
|
|
|
|
- itemStyle: {color: '#FF8000'},
|
|
|
|
|
- // data中可以使用对象,value代表相应的值,另外可加入自定义的属性
|
|
|
|
|
- data: [
|
|
|
|
|
- {value: 1, stationName: 's1'},
|
|
|
|
|
- {value: 3, stationName: 's2'},
|
|
|
|
|
- {value: 4, stationName: 's3'},
|
|
|
|
|
- {value: 9, stationName: 's4'},
|
|
|
|
|
- {value: 3, stationName: 's5'},
|
|
|
|
|
- {value: 2, stationName: 's6'},
|
|
|
|
|
- ],
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- name: '回温',
|
|
|
|
|
- type: 'line',
|
|
|
|
|
- smooth: true,
|
|
|
|
|
- showSymbol: true,
|
|
|
|
|
- symbol: 'emptyCircle',
|
|
|
|
|
- symbolSize: 12,
|
|
|
|
|
- yAxisIndex: 0,
|
|
|
|
|
- areaStyle: {
|
|
|
|
|
- color: new echarts.graphic.LinearGradient(
|
|
|
|
|
- 0,
|
|
|
|
|
- 0,
|
|
|
|
|
- 0,
|
|
|
|
|
- 1,
|
|
|
|
|
- [
|
|
|
|
|
- {offset: 0, color: 'rgba(199, 237, 250,0.5)'},
|
|
|
|
|
- {offset: 1, color: 'rgba(199, 237, 250,0.2)'},
|
|
|
|
|
- ],
|
|
|
|
|
- false
|
|
|
|
|
- ),
|
|
|
|
|
- },
|
|
|
|
|
- itemStyle: {
|
|
|
|
|
- color: '#3bbc86',
|
|
|
|
|
- },
|
|
|
|
|
- data: [
|
|
|
|
|
- {value: 31, stationName: 's1'},
|
|
|
|
|
- {value: 36, stationName: 's2'},
|
|
|
|
|
- {value: 54, stationName: 's3'},
|
|
|
|
|
- {value: 24, stationName: 's4'},
|
|
|
|
|
- {value: 73, stationName: 's5'},
|
|
|
|
|
- {value: 22, stationName: 's6'},
|
|
|
|
|
- ],
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- name: '压力值(Mpa)',
|
|
|
|
|
- type: 'bar',
|
|
|
|
|
- barWidth: 30,
|
|
|
|
|
- yAxisIndex: 1,
|
|
|
|
|
- itemStyle: {
|
|
|
|
|
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
|
|
- {offset: 0, color: 'rgba(108,80,243,0.3)'},
|
|
|
|
|
- {offset: 1, color: 'rgba(108,80,243,0)'},
|
|
|
|
|
- ]),
|
|
|
|
|
- //柱状图圆角
|
|
|
|
|
- borderRadius: [30, 30, 0, 0],
|
|
|
|
|
- },
|
|
|
|
|
- data: [
|
|
|
|
|
- {value: 11, stationName: 's1'},
|
|
|
|
|
- {value: 34, stationName: 's2'},
|
|
|
|
|
- {value: 54, stationName: 's3'},
|
|
|
|
|
- {value: 39, stationName: 's4'},
|
|
|
|
|
- {value: 63, stationName: 's5'},
|
|
|
|
|
- {value: 24, stationName: 's6'},
|
|
|
|
|
- ],
|
|
|
|
|
- },
|
|
|
|
|
- ],
|
|
|
|
|
- };
|
|
|
|
|
- state.global.homeCharThree.setOption(option);
|
|
|
|
|
- state.myCharts.push(state.global.homeCharThree);
|
|
|
|
|
-};
|
|
|
|
|
// 批量设置 echarts resize
|
|
// 批量设置 echarts resize
|
|
|
const initEchartsResizeFun = () => {
|
|
const initEchartsResizeFun = () => {
|
|
|
nextTick(() => {
|
|
nextTick(() => {
|
|
@@ -599,11 +480,49 @@ const initEchartsResizeFun = () => {
|
|
|
const initEchartsResize = () => {
|
|
const initEchartsResize = () => {
|
|
|
window.addEventListener('resize', initEchartsResizeFun);
|
|
window.addEventListener('resize', initEchartsResizeFun);
|
|
|
};
|
|
};
|
|
|
|
|
+
|
|
|
|
|
+const loadCurrentEquipmentStatus = ()=>{
|
|
|
|
|
+ $get(`equipment/statEquipmentStatus`).then((res:any)=>{
|
|
|
|
|
+ console.log(res)
|
|
|
|
|
+ initPieChart(res||{});
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+const loadStationStat = ()=>{
|
|
|
|
|
+ $get(`stat/stationStat`,{startTime:state.dateRange[0],endTime:state.dateRange[1],type:'day'}).then((res:any)=>{
|
|
|
|
|
+ console.log(res)
|
|
|
|
|
+ initLineChart(res.list);
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const loadStationStatToday = ()=>{
|
|
|
|
|
+ $get(`stat/stationTodayStat`).then((res:any)=>{
|
|
|
|
|
+ console.log(res)
|
|
|
|
|
+ if(!u.isEmptyOrNull(res.list)){
|
|
|
|
|
+ let {chargeUsers,totalOrders,totalPower,totalMoney,elecMoney,serviceMoney} = res.list[0]
|
|
|
|
|
+ state.homeOne[0].num1 = totalPower;
|
|
|
|
|
+ state.homeOne[1].num1 = u.fmt.fmtMoney(totalMoney);
|
|
|
|
|
+ state.homeOne[2].num1 = u.fmt.fmtMoney(elecMoney);
|
|
|
|
|
+ state.homeOne[3].num1 = u.fmt.fmtMoney(serviceMoney);
|
|
|
|
|
+ state.homeOne[4].num1 = chargeUsers;
|
|
|
|
|
+ state.homeOne[5].num1 = totalOrders;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
// 页面加载时
|
|
// 页面加载时
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
console.error("home onMounted")
|
|
console.error("home onMounted")
|
|
|
NProgress.done();
|
|
NProgress.done();
|
|
|
initEchartsResize();
|
|
initEchartsResize();
|
|
|
|
|
+ //加载充电走势数据
|
|
|
|
|
+ loadStationStat()
|
|
|
|
|
+ //今日统计数据
|
|
|
|
|
+ loadStationStatToday();
|
|
|
|
|
+
|
|
|
|
|
+ //加载充电桩状态
|
|
|
|
|
+ loadCurrentEquipmentStatus();
|
|
|
});
|
|
});
|
|
|
// 由于页面缓存原因,keep-alive
|
|
// 由于页面缓存原因,keep-alive
|
|
|
onActivated(() => {
|
|
onActivated(() => {
|
|
@@ -625,14 +544,14 @@ watch(
|
|
|
state.charts.bgColor = isIsDark ? 'transparent' : '';
|
|
state.charts.bgColor = isIsDark ? 'transparent' : '';
|
|
|
state.charts.color = isIsDark ? '#dadada' : '#303133';
|
|
state.charts.color = isIsDark ? '#dadada' : '#303133';
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
- initLineChart();
|
|
|
|
|
|
|
+ loadStationStat()
|
|
|
}, 500);
|
|
}, 500);
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
- initPieChart();
|
|
|
|
|
|
|
+ loadCurrentEquipmentStatus();
|
|
|
}, 700);
|
|
}, 700);
|
|
|
- setTimeout(() => {
|
|
|
|
|
- initBarChart();
|
|
|
|
|
- }, 1000);
|
|
|
|
|
|
|
+ // setTimeout(() => {
|
|
|
|
|
+ // initBarChart();
|
|
|
|
|
+ // }, 1000);
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
@@ -700,7 +619,7 @@ $homeNavLengh: 8;
|
|
|
.home-card-two,
|
|
.home-card-two,
|
|
|
.home-card-three {
|
|
.home-card-three {
|
|
|
.home-card-item {
|
|
.home-card-item {
|
|
|
- height: 580px;
|
|
|
|
|
|
|
+ height: 780px;
|
|
|
width: 100%;
|
|
width: 100%;
|
|
|
overflow: hidden;
|
|
overflow: hidden;
|
|
|
|
|
|