’代码提交‘

This commit is contained in:
luoshiwen 2023-12-12 14:36:48 +08:00
commit e9ea23aa15
4 changed files with 438 additions and 3 deletions

View File

@ -8,7 +8,6 @@ import mainHeader from '@/components/mainHeader/index.vue'
<mainHeader></mainHeader>
<!-- <calendar></calendar>-->
</template>

View File

@ -9,7 +9,11 @@ import lighting from '@/views/lighting/index.vue' //照明
import carbonEmission from '@/views/carbonEmission/index.vue' //
import screen from '@/views/screen/index.vue' //
<<<<<<< HEAD
=======
import energyMonitoring from '@/views/energyMonitoring/index.vue'
>>>>>>> af48436e2178f27ff7772684e807f1fea9516ede
const nowDate = ref('')
const nowWeek = ref('')
const nowMin = ref('')
@ -26,7 +30,11 @@ timer.value = setInterval(()=>{
},1000)
const menuList = ref([
{name:shallowRef(overview),default:'../../assets/images/menu/overview.png',select:'../../assets/images/menu/overview-select.png'},
<<<<<<< HEAD
{ //name:shallowRef(energyMonitoring),
=======
{name:shallowRef(energyMonitoring),
>>>>>>> af48436e2178f27ff7772684e807f1fea9516ede
default:'../../assets/images/menu/energy.png',select:'../../assets/images/menu/energy-select.png'},
{name:shallowRef(energyEfficiency),default:'../../assets/images/menu/energy-efficiency.png',select:'../../assets/images/menu/energy-efficiency-select.png'},
{name:shallowRef(drainage),default:'../../assets/images/menu/drainage.png',select:'../../assets/images/menu/drainage-select.png'},

View File

@ -1,6 +1,6 @@
import { createRouter, createWebHashHistory } from 'vue-router'
import Overview from '../views/overview/index.vue'
import energyMonitoring from '../views/energyMonitoring/index.vue'
const routes = [
{
@ -12,7 +12,11 @@ const routes = [
name: 'overview',
component: Overview
},
{
path: '/energyMonitoring',
name: 'energyMonitoring',
component: energyMonitoring
},
]
const router = createRouter({

View File

@ -0,0 +1,424 @@
<template>
<div class="overview m100">
<div class="overview-left-box">
<!-- 实时负荷-->
<div class="title">
<span>实时负荷</span>
</div>
<div class="margin10 box-bg" id="realTimeLoad"></div>
<!-- 当日累计用电量-->
<div class="title margin10">
<span>当日累计用电量</span>
</div>
<div class="margin10 box-bg" id="dailyElectricityConsumption"></div>
<!-- 负荷分类-->
<div class="title margin10">
<span>负荷分类</span>
</div>
<div class="margin10 box-bg"></div>
</div>
<div class="overview-right-box">
<!-- 空调负荷 -->
<div class="title">
<span>空调负荷</span>
</div>
<div class="margin10 box-bg"></div>
<!-- 展陈负荷-->
<div class="title margin10">
<span>展陈负荷</span>
</div>
<div class="margin10 box-bg"></div>
<!-- 配电回路排名-->
<div class="title margin10">
<span>配电回路排名</span>
</div>
<div class="margin10 box-bg"></div>
</div>
</div>
</template>
<script setup>
import { ref, onMounted } from "vue";
import * as echarts from "echarts";
//
function getRealTimeLoad() {
let myChart = echarts.init(document.getElementById("realTimeLoad"));
const option = {
// backgroundColor: "#05224d",
tooltip: {},
grid: {
top: "18%",
left: "4%",
right: "4%",
bottom: "4%",
containLabel: true,
},
xAxis: [
{
type: "category",
boundaryGap: false,
axisLine: {
//线x
show: true,
lineStyle: {
// type:'dashed',
color: "rgba(1, 39, 37, .3)",
// color: "#233e64",
},
},
axisLabel: {
//
textStyle: {
color: "#DDFFFD",
margin: 40,
},
},
axisTick: { show: false },
boundaryGap: true,
data: ["08:00", "09:00", "10:00", "11:00", "12:00", "13:00", "14:00"],
},
],
yAxis: [
{
type: "value",
name: "单位:kW/h",
nameTextStyle: {
color: "#DDFFFD",
},
splitNumber: 5,
splitLine: {
show: true,
lineStyle: {
type: "dashed",
color: "rgba(1, 39, 37, 0.30)",
},
},
axisLine: { show: false },
axisLabel: {
textStyle: {
color: "#DDFFFD",
},
},
axisTick: { show: false },
},
],
series: [
{
name: "实时负荷",
type: "line",
symbol: "circle",
symbolSize: 6,
// yAxisIndex: 1, // y
itemStyle: {
color: "#44C558",
},
lineStyle: {
width: 2,
},
data: [90, 70, 40, 70, 80, 65, 73], // 线
},
],
};
myChart.setOption(option);
}
//
function getDailyElectricityConsumption() {
const offsetX = 10; //bar
const offsetY = 5; //
//
const CubeLeft = echarts.graphic.extendShape({
shape: {
x: 0,
y: 0,
},
buildPath: function (ctx, shape) {
const xAxisPoint = shape.xAxisPoint;
const c0 = [shape.x, shape.y]; //
const c1 = [shape.x - offsetX, shape.y - offsetY + 5]; //
const c2 = [xAxisPoint[0] - offsetX, xAxisPoint[1] - offsetY + 5]; //
const c3 = [xAxisPoint[0], xAxisPoint[1] + 5]; //
ctx
.moveTo(c0[0], c0[1])
.lineTo(c1[0], c1[1])
.lineTo(c2[0], c2[1])
.lineTo(c3[0], c3[1])
.closePath();
},
});
//
const CubeRight = echarts.graphic.extendShape({
shape: {
x: 0,
y: 0,
},
buildPath: function (ctx, shape) {
const xAxisPoint = shape.xAxisPoint;
const c1 = [shape.x, shape.y]; //
const c2 = [xAxisPoint[0], xAxisPoint[1] + 5]; //
const c3 = [xAxisPoint[0] + offsetX, xAxisPoint[1] - offsetY + 5]; //
const c4 = [shape.x + offsetX, shape.y - offsetY + 5]; //
ctx
.moveTo(c1[0], c1[1])
.lineTo(c2[0], c2[1])
.lineTo(c3[0], c3[1])
.lineTo(c4[0], c4[1])
.closePath();
},
});
//
const CubeTop = echarts.graphic.extendShape({
shape: {
x: 0,
y: 0,
},
buildPath: function (ctx, shape) {
const c1 = [shape.x, shape.y + 5]; //
const c2 = [shape.x + offsetX, shape.y - offsetY + 5]; //
const c3 = [shape.x, shape.y - offsetX + 5]; //
const c4 = [shape.x - offsetX, shape.y - offsetY + 5]; //
ctx
.moveTo(c1[0], c1[1])
.lineTo(c2[0], c2[1])
.lineTo(c3[0], c3[1])
.lineTo(c4[0], c4[1])
.closePath();
},
});
//
echarts.graphic.registerShape("CubeLeft", CubeLeft);
echarts.graphic.registerShape("CubeRight", CubeRight);
echarts.graphic.registerShape("CubeTop", CubeTop);
let xAxisData = [
"北京",
"上海",
"天津",
"南京",
"深圳",
"重庆",
"青岛",
"大连",
"沈阳",
"哈尔滨",
];
let seriesData = [100, 200, 300, 400, 200, 250, 360, 250, 340, 280];
// 绿
// let colorArr = [["#12D5AF"], ["#0BC19D", "rgba(13,8,16,0)"], ["#68EFD4", "rgba(14,185,151,0)"]]
//
let colorArr = [
["#71ddff"],
["rgba(12, 149, 198, 1)", "rgba(13,8,16,0)"],
["rgba(34, 188, 255, 1)", "rgba(14,156,185,0)"],
];
let myChart = echarts.init(
document.getElementById("dailyElectricityConsumption")
);
const option = {
tooltip: {
trigger: "axis",
axisPointer: {
type: "shadow",
},
formatter: function (params, ticket, callback) {
const item = params[1];
return item.name + " : " + item.value;
},
},
grid: {
left: "5%",
right: "10%",
top: "15%",
bottom: "5%",
containLabel: true,
},
xAxis: {
type: "category",
data: xAxisData,
axisLine: {
show: true,
lineStyle: {
width: 1,
color: "rgba(255, 255, 255, 0.60)",
},
},
axisTick: {
show: false,
},
axisLabel: {
fontSize: 14,
interval: 0,
// 使
formatter: function (value) {
const length = value.length;
if (length > 3) {
const start = Math.floor(length / 2);
const str =
value.slice(0, start) + "\n" + value.slice(start, length);
return str;
}
return value;
},
},
},
yAxis: {
type: "value",
minInterval: 1,
// y线
axisLine: {
show: false,
},
// y 线
splitLine: {
show: true,
lineStyle: {
color: "rgba(255,255,255,0.16)",
},
},
// y线
axisTick: {
show: false,
},
// y
axisLabel: {
fontSize: 14,
color: "rgba(255, 255, 255, 0.60)",
},
},
series: [
{
type: "custom",
renderItem: (params, api) => {
const location = api.coord([api.value(0), api.value(1)]);
return {
type: "group",
children: [
//
{
type: "CubeLeft",
shape: {
api,
xValue: api.value(0),
yValue: api.value(1),
x: location[0],
y: location[1],
xAxisPoint: api.coord([api.value(0), 0]),
},
style: {
fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: colorArr[1][0],
},
{
offset: 1,
color: colorArr[1][1],
},
]),
},
},
//
{
type: "CubeRight",
shape: {
api,
xValue: api.value(0),
yValue: api.value(1),
x: location[0],
y: location[1],
xAxisPoint: api.coord([api.value(0), 0]),
},
style: {
fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: colorArr[2][0],
},
{
offset: 1,
color: colorArr[2][1],
},
]),
},
},
//
{
type: "CubeTop",
shape: {
api,
xValue: api.value(0),
yValue: api.value(1),
x: location[0],
y: location[1],
xAxisPoint: api.coord([api.value(0), 0]),
},
style: {
fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: colorArr[0][0],
},
{
offset: 1,
color: colorArr[0][0],
},
]),
},
},
],
};
},
data: seriesData,
},
{
type: "bar",
label: {
normal: {
show: true,
position: "top",
formatter: (e) => {
return e.value;
},
fontSize: 16,
color: "#43C4F1",
offset: [0, -5],
},
},
itemStyle: {
color: "transparent",
},
tooltip: {},
data: seriesData,
},
],
};
myChart.setOption(option);
}
//dom
onMounted(() => {
//
getRealTimeLoad();
//
getDailyElectricityConsumption()
});
</script>
<style lang="scss" scoped>
.overview {
width: 100%;
height: 100%;
box-sizing: border-box;
display: flex;
justify-content: space-between;
&-right-box,
&-left-box {
height: 100%;
width: vw(450);
}
&-right-box {
padding-right: 2.375rem;
}
&-left-box {
padding-left: 2.375rem;
}
}
</style>