1068 lines
48 KiB
HTML
1068 lines
48 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
|
|
|
|
<script type="text/javascript" src="./libs/vue.minV2.5.17.js"></script>
|
|
<script type="text/javascript" src="./libs/axios.minV0.18.0.js"></script>
|
|
<script type="text/javascript" src="./libs/element-uiV2.15.13.js"></script>
|
|
<script type="text/javascript" src="./libs/iview.minV2.0.js"></script>
|
|
<script type="text/javascript" src="./libs/crypto-jsv4.0.0.js"></script>
|
|
<script type="text/javascript" src="./libs/jquery.minV3.5.1.js"></script>
|
|
<script type="text/javascript" src="./libs/moment.minV2.24.0.js"></script>
|
|
<script type="text/javascript" src="./libs/echarts-enV2.0.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="./styles/iviewV2.0.css" />
|
|
<link rel="stylesheet" href="./styles/element-uiV2.15.13.css" />
|
|
<title id="titname">demo</title>
|
|
<style type="text/css" media="screen">
|
|
html,
|
|
body {
|
|
margin: 0;
|
|
height: 100%;
|
|
font: 14px Microsoft YaHei;
|
|
}
|
|
|
|
body {
|
|
margin: 0;
|
|
padding: 0;
|
|
overflow: hidden;
|
|
/* background: url(./assets/images/login.png) no-repeat; */
|
|
/* background: url(./assets/login/bg.jpg) no-repeat; */
|
|
background-size: 100% 100%;
|
|
-webkit-user-select: none;
|
|
}
|
|
|
|
.content {
|
|
width: 95%;
|
|
margin: 0 auto;
|
|
margin-top: 1%;
|
|
height: 100%;
|
|
}
|
|
</style>
|
|
<style lang="less" scoped>
|
|
.content .list-echarts {
|
|
height: calc(100% - 60px);
|
|
margin-top: 0px;
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
overflow-y: auto;
|
|
}
|
|
|
|
.el-form-item {
|
|
/* margin-bottom: 22px; */
|
|
margin-bottom: 0px;
|
|
}
|
|
|
|
.preDealtail .label {
|
|
margin: 40px 0;
|
|
font-size: 14px;
|
|
}
|
|
|
|
.el-table--scrollable-x .el-table__body-wrapper {
|
|
overflow-x: auto;
|
|
}
|
|
|
|
.el-table__fixed-right {
|
|
right: 5px !important;
|
|
/* 竖向滚动条宽度 */
|
|
height: 100%;
|
|
}
|
|
|
|
.el-table__fixed-right {
|
|
right: 0px !important;
|
|
height: 100%;
|
|
}
|
|
|
|
.el-table__fixed-right .el-table__fixed-body-wrapper {
|
|
height: auto !important;
|
|
bottom: 4px !important;
|
|
max-height: 100% !important
|
|
}
|
|
|
|
.el-table__fixed-right-patch {
|
|
width: 5px !important;
|
|
}
|
|
|
|
.el-table__fixed {
|
|
height: auto !important;
|
|
bottom: 0px !important;
|
|
}
|
|
|
|
.el-table__fixed .el-table__fixed-body-wrapper {
|
|
height: auto !important;
|
|
bottom: 0px !important;
|
|
max-height: 100% !important
|
|
}
|
|
|
|
.el-table--scrollable-x .el-table__fixed {
|
|
height: auto !important;
|
|
bottom: 0px !important;
|
|
}
|
|
|
|
.el-table--scrollable-x .el-table__fixed-right {
|
|
bottom: 0px !important;
|
|
}
|
|
|
|
.el-table--scrollable-y .el-table__fixed-right {
|
|
right: 5px !important;
|
|
height: auto !important;
|
|
}
|
|
|
|
.el-table--scrollable-x .el-table__body-wrapper::-webkit-scrollbar {
|
|
height: 7px !important;
|
|
}
|
|
|
|
.el-table--fluid-height .el-table__fixed {
|
|
bottom: 0px !important;
|
|
}
|
|
|
|
.el-button {
|
|
border-radius: 0px !important;
|
|
}
|
|
|
|
.el-table__body-wrapper::-webkit-scrollbar {
|
|
width: 0px;
|
|
height: 6px;
|
|
}
|
|
|
|
/* //注意:hover */
|
|
.el-table__body-wrapper:hover::-webkit-scrollbar {
|
|
width: 6px;
|
|
height: 6px;
|
|
}
|
|
|
|
|
|
/* // 滚动条的滑块 */
|
|
.el-table__body-wrapper::-webkit-scrollbar-thumb {
|
|
background-color: #ddd;
|
|
border-radius: 3px;
|
|
}
|
|
|
|
.el-tag.el-tag--info {
|
|
background-color: rgb(239, 243, 246);
|
|
border-color: rgb(64, 158, 255);
|
|
color: rgb(64, 158, 255);
|
|
}
|
|
|
|
#energyConsumptionTrends {
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
|
|
#energyConsumptionTrends div:first-child {
|
|
width: 100%;
|
|
height: 100% !important;
|
|
}
|
|
|
|
#energyConsumptionTrends div:first-child canvas {
|
|
width: 100%;
|
|
height: 85% !important;
|
|
}
|
|
|
|
.el-descriptions__body {
|
|
color: #606266;
|
|
background-color: #FFF;
|
|
height: 100% !important;
|
|
width: 100%;
|
|
}
|
|
|
|
.el-descriptions__body .el-descriptions__table {
|
|
border-collapse: collapse;
|
|
width: 100%;
|
|
table-layout: fixed;
|
|
height: 100%;
|
|
}
|
|
|
|
.el-descriptions-item__container {
|
|
display: -webkit-box;
|
|
display: -ms-flexbox;
|
|
display: flex;
|
|
height: 100%;
|
|
width: 100%;
|
|
}
|
|
|
|
.echartsOne {
|
|
width: 60%;
|
|
margin-top: 2%
|
|
}
|
|
|
|
.echartsTwo {
|
|
width: 40%;
|
|
margin-top: 2%;
|
|
}
|
|
|
|
.echartsThree {
|
|
width: 50%;
|
|
margin-top: 2%;
|
|
}
|
|
|
|
.echartsFour {
|
|
width: 100%;
|
|
margin-top: 2%;
|
|
}
|
|
.echartsFour1 {
|
|
width: 50%;
|
|
margin-top: 2%;
|
|
}
|
|
.el-table__row>td {
|
|
border: none !important;
|
|
}
|
|
|
|
.el-table::before {
|
|
height: 0px !important;
|
|
}
|
|
|
|
.el-table--border::after,
|
|
.el-table--group::after,
|
|
.el-table::before {
|
|
background-color: transparent !important;
|
|
}
|
|
|
|
.el-table thead {
|
|
color: #000;
|
|
border-bottom: none !important;
|
|
}
|
|
|
|
.el-table td.el-table__cell,
|
|
.el-table th.el-table__cell.is-leaf {
|
|
border-bottom: none !important;
|
|
}
|
|
|
|
.el-descriptions-item__container .el-descriptions-item__content {
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: flex-end;
|
|
margin-right: 4%;
|
|
}
|
|
|
|
.el-descriptions :not(.is-bordered) .el-descriptions-item__cell {
|
|
padding-bottom: 0;
|
|
}
|
|
|
|
.el-table .el-table__cell {
|
|
padding: 5px 0
|
|
}
|
|
|
|
/* .echartsFour .el-descriptions__table tbody {
|
|
height: 20px !important;
|
|
}
|
|
.echartsFour .el-descriptions-item__content {
|
|
height: 20px !important;
|
|
} */
|
|
.echartsFour1 .el-descriptions-row {
|
|
margin-bottom: 10px !important;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<div class="content" id="app">
|
|
<div style="height:100%;width: 100%;">
|
|
<el-form :inline="true" :model="formInfo" class="demo-form-inline">
|
|
<el-form-item label="表:">
|
|
<el-select v-model="selectValue" multiple collapse-tags style="margin-left: 20px;"
|
|
placeholder="请选择表">
|
|
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"
|
|
:style="{color:'rgb(64,158,255)'}">
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="时间">
|
|
<el-select v-model="time" placeholder="选择日期" @change="selectChange">
|
|
<el-option :label="item.label" :value="item.value" v-for="(item,index) in timeOption"
|
|
:key="index"></el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<div v-show="time=='年'">
|
|
<el-date-picker v-model="addForm.date_range_start" :picker-options="pickerOptionsYearStart"
|
|
value-format="yyyy" type="year" placeholder="请选择时间" ref="datePicker" key="year">
|
|
</el-date-picker>
|
|
<!-- <el-date-picker v-model="addForm.date_range_end" value-format="yyyy"
|
|
:picker-options="pickerOptionsYearEnd" type="year" placeholder="结束时间" ref="datePicker"
|
|
key="year">
|
|
</el-date-picker> -->
|
|
</div>
|
|
<div v-show="time=='月'">
|
|
<el-date-picker v-model="addForm.date_range_start" type="month" placeholder="请选择时间"
|
|
:picker-options="pickerOptionsMonthStart" key="month">
|
|
</el-date-picker>
|
|
<!-- <el-date-picker v-model="addForm.date_range_end" type="month" placeholder="结束日期"
|
|
:picker-options="pickerOptionsMonthEnd" key="month">
|
|
</el-date-picker> -->
|
|
</div>
|
|
<div v-show="time=='周'">
|
|
<el-date-picker v-model="addForm.date_range_start" type="week" placeholder="请选择时间" key="week"
|
|
:format="'yyyy 第 WW 周'" @change="changeWeek">
|
|
</el-date-picker>
|
|
<!-- <el-date-picker v-model="weekEnd" type="week" placeholder="结束日期"
|
|
:picker-options="pickerOptionsWeekEnd" key="week" :format="'yyyy 第 WW 周'">
|
|
</el-date-picker> -->
|
|
</div>
|
|
<div v-show="time=='日'">
|
|
<el-date-picker v-model="addForm.date_range_start" type="date" placeholder="请选择时间" key="day">
|
|
</el-date-picker>
|
|
<!-- <el-date-picker v-model="addForm.date_range_end" type="date" placeholder="结束日期"
|
|
:picker-options="pickerOptionsDayEnd" key="day">
|
|
</el-date-picker> -->
|
|
</div>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-button type="primary" @click="onSubmit">查询</el-button>
|
|
<!-- <el-button type="primary" @click="onSubmit">重置</el-button> -->
|
|
</el-form-item>
|
|
</el-form>
|
|
<div class="list-echarts">
|
|
<el-descriptions title="能耗趋势" :colon="false" class="echartsOne">
|
|
<el-descriptions-item>
|
|
<div id="energyConsumptionTrends"></div>
|
|
</el-descriptions-item>
|
|
</el-descriptions>
|
|
<el-descriptions title="能耗排名(只显示前十)" :colon="false" class="echartsTwo">
|
|
<el-descriptions-item>
|
|
<el-table :data="tableData" :header-cell-style="{textAlign:'center'}"
|
|
:cell-style="{textAlign:'center'}">
|
|
<el-table-column prop="name" label="名称">
|
|
</el-table-column>
|
|
<el-table-column>
|
|
<template slot-scope="scope">
|
|
<el-progress type="line" :text-inside="true" :show-text="false" :stroke-width="20"
|
|
:percentage="scope.row.progress" :color="scope.row.customColor"></el-progress>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="value" label="用电量kW·h">
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-descriptions-item>
|
|
</el-descriptions>
|
|
<el-descriptions title="能耗同环比(只显示前十)" :colon="false" class="echartsThree">
|
|
<el-descriptions-item>
|
|
<el-table :data="yoyqoqTable"
|
|
:header-cell-style="{background:'rgb(239,243,246)',textAlign:'center',color:'rgb(95,99,104)'}"
|
|
:cell-style="{textAlign:'center'}">
|
|
<el-table-column prop="name" label="名称">
|
|
</el-table-column>
|
|
<el-table-column prop="value" label="用电量kW·h">
|
|
</el-table-column>
|
|
<el-table-column label="同比">
|
|
<template slot-scope="scope">
|
|
<div style="display: flex;align-items: center;justify-content: center;">
|
|
<span>{{scope.row.qoq}}</span>
|
|
<img src="./styles/image/up.png" v-show="scope.row.qoqStatus"
|
|
style="width: 15px;height: 15px;" />
|
|
<img src="./styles/image/down.png" v-show="!scope.row.qoqStatus"
|
|
style="width: 15px;height: 15px;" />
|
|
</div>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="环比">
|
|
<template slot-scope="scope">
|
|
<div style="display: flex;align-items: center;justify-content: center;">
|
|
<span>{{scope.row.yoy}}</span>
|
|
<img src="./styles/image/up.png" v-show="scope.row.yoyStatus"
|
|
style="width: 15px;height: 15px;" />
|
|
<img src="./styles/image/down.png" v-show="!scope.row.yoyStatus"
|
|
style="width: 15px;height: 15px;" />
|
|
</div>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-descriptions-item>
|
|
</el-descriptions>
|
|
<div class="echartsFour1">
|
|
<el-descriptions title="能耗增量排名(只显示前十)" :colon="false" class="echartsFour" :column="1">
|
|
<el-descriptions-item :span="2">
|
|
<el-radio-group v-model="radio" @change="radioChange" class="radio-group" size="mini">
|
|
<el-radio-button label="同比"></el-radio-button>
|
|
<el-radio-button label="环比"></el-radio-button>
|
|
</el-radio-group>
|
|
</el-descriptions-item>
|
|
<el-descriptions-item>
|
|
<el-table :data="incrementTable" :header-cell-style="{textAlign:'center'}"
|
|
:cell-style="{textAlign:'center'}">
|
|
<el-table-column prop="name" label="名称">
|
|
</el-table-column>
|
|
<el-table-column>
|
|
<template slot-scope="scope">
|
|
<el-progress type="line" :text-inside="true" :show-text="false"
|
|
:stroke-width="20" :percentage="scope.row.progress"
|
|
:color="scope.row.customColor"></el-progress>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="value" label="用电量kW·h">
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-descriptions-item>
|
|
</el-descriptions>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
var app = new Vue({
|
|
el: "#app",
|
|
data() {
|
|
return {
|
|
formInfo: {
|
|
tableName: '', //用户名
|
|
billType: '', //账单类型
|
|
year: moment().format('YYYY'), //年单选
|
|
month: '', //月单选
|
|
time: '年'
|
|
},
|
|
selectValue: [], //选择值
|
|
options: [],
|
|
time: '月',
|
|
timeOption: [
|
|
{
|
|
value: '日',
|
|
label: '日',
|
|
},
|
|
{
|
|
value: '周',
|
|
label: '周',
|
|
},
|
|
{
|
|
value: '月',
|
|
label: '月',
|
|
},
|
|
{
|
|
value: '年',
|
|
label: '年',
|
|
},
|
|
],
|
|
addForm: {
|
|
date_range_end: '',
|
|
date_range_start: moment().format('YYYY') + '-' + moment().format('MM'),
|
|
}, // 时间范围限制默认月
|
|
pickerOptionsYearStart: {
|
|
disabledDate: (time) => {
|
|
let fixedTime = new Date(time)
|
|
if (app.addForm.date_range_end != '') {
|
|
return fixedTime.getFullYear() > app.addForm.date_range_end
|
|
}
|
|
}
|
|
}, //年开始时间
|
|
pickerOptionsYearEnd: {
|
|
disabledDate(time) {
|
|
let fixedTime = new Date(time)
|
|
return fixedTime.getFullYear() < app.addForm.date_range_start
|
|
}
|
|
}, //年结束时间
|
|
|
|
pickerOptionsMonthStart: {
|
|
disabledDate(time) {
|
|
return false
|
|
}
|
|
}, // 月开始时间
|
|
pickerOptionsMonthEnd: {
|
|
disabledDate(time) {
|
|
if (!app.addForm.date_range_start) {
|
|
return false;
|
|
}
|
|
return time.getTime() < new Date(app.addForm.date_range_start).getTime();
|
|
}
|
|
},// 月结束时间
|
|
weekStart: '', //周开始时间
|
|
weekEnd: '', //周结束时间
|
|
pickerOptionsWeekEnd: {
|
|
disabledDate: (time) => {
|
|
// 禁用第二个日期选择器中第一个日期之前的所有周
|
|
const firstWeek = app.weekStart;
|
|
if (!firstWeek) {
|
|
return false; // 如果第一个日期未选择,则不禁用任何周
|
|
}
|
|
return time < firstWeek;
|
|
}
|
|
}, //周结束时间
|
|
|
|
pickerOptionsDayEnd: {
|
|
disabledDate: (time) => {
|
|
// 禁用第二个日期选择器中第一个日期之前的所有日期
|
|
const firstDate = app.addForm.date_range_start;
|
|
if (!firstDate) {
|
|
return false; // 如果第一个日期未选择,则不禁用任何日期
|
|
}
|
|
return time.getTime() < firstDate.getTime();
|
|
}
|
|
}, //结束日期
|
|
tableData: [
|
|
// {
|
|
// name: '通设部',
|
|
// value: '18070.00',
|
|
// progress: 80,
|
|
// customColor: '#52A8FF'
|
|
// },
|
|
// {
|
|
// name: '航站区管理部',
|
|
// value: '7512.00',
|
|
// progress: 30,
|
|
// customColor: '#00B389'
|
|
// },
|
|
// {
|
|
// name: '信息技术部',
|
|
// value: '7512.00',
|
|
// progress: 30,
|
|
// customColor: '#FFA940'
|
|
// },
|
|
// {
|
|
// name: '飞行区管理部',
|
|
// value: '7512.00',
|
|
// progress: 30,
|
|
// customColor: '#FF5A57'
|
|
// },
|
|
// {
|
|
// name: '空管设施部',
|
|
// value: '7512.00',
|
|
// progress: 30,
|
|
// customColor: '#29EFC4'
|
|
// },
|
|
// {
|
|
// name: '消防救援部',
|
|
// value: '7512.00',
|
|
// progress: 30,
|
|
// customColor: '#FFC53D'
|
|
// },
|
|
// {
|
|
// name: '综合部',
|
|
// value: '7512.00',
|
|
// progress: 30,
|
|
// customColor: '#009982'
|
|
// },
|
|
],
|
|
yoyqoqTable: [
|
|
// {
|
|
// name: '通设部',
|
|
// value: '7512.00',
|
|
// qoq: '51.89%',
|
|
// yoy: '100.00%',
|
|
// qoqStatus: true,
|
|
// yoyStatus: true,
|
|
// },
|
|
// {
|
|
// name: '通设部',
|
|
// value: '7512.00',
|
|
// qoq: '51.89%',
|
|
// yoy: '100.00%',
|
|
// qoqStatus: true,
|
|
// yoyStatus: false,
|
|
// },
|
|
// {
|
|
// name: '通设部',
|
|
// value: '7512.00',
|
|
// qoq: '51.89%',
|
|
// yoy: '100.00%',
|
|
// qoqStatus: true,
|
|
// yoyStatus: false,
|
|
// },
|
|
// {
|
|
// name: '通设部',
|
|
// value: '7512.00',
|
|
// qoq: '51.89%',
|
|
// yoy: '100.00%',
|
|
// qoqStatus: true,
|
|
// yoyStatus: false,
|
|
// },
|
|
// {
|
|
// name: '通设部',
|
|
// value: '7512.00',
|
|
// qoq: '51.89%',
|
|
// yoy: '100.00%',
|
|
// qoqStatus: true,
|
|
// yoyStatus: false,
|
|
// },
|
|
// {
|
|
// name: '通设部',
|
|
// value: '7512.00',
|
|
// qoq: '51.89%',
|
|
// yoy: '100.00%',
|
|
// qoqStatus: true,
|
|
// yoyStatus: false,
|
|
// },
|
|
// {
|
|
// name: '通设部',
|
|
// value: '7512.00',
|
|
// qoq: '51.89%',
|
|
// yoy: '100.00%',
|
|
// qoqStatus: true,
|
|
// yoyStatus: false,
|
|
// },
|
|
],
|
|
radio: '同比',//同比环比单选选择
|
|
incrementTable: [
|
|
// {
|
|
// name: '通设部',
|
|
// value: '18070.00',
|
|
// progress: 80,
|
|
// customColor: '#52A8FF'
|
|
// },
|
|
// {
|
|
// name: '航站区管理部',
|
|
// value: '7512.00',
|
|
// progress: 30,
|
|
// customColor: '#00B389'
|
|
// },
|
|
// {
|
|
// name: '信息技术部',
|
|
// value: '7512.00',
|
|
// progress: 30,
|
|
// customColor: '#FFA940'
|
|
// },
|
|
// {
|
|
// name: '飞行区管理部',
|
|
// value: '7512.00',
|
|
// progress: 30,
|
|
// customColor: '#FF5A57'
|
|
// },
|
|
// {
|
|
// name: '空管设施部',
|
|
// value: '7512.00',
|
|
// progress: 30,
|
|
// customColor: '#29EFC4'
|
|
// },
|
|
// {
|
|
// name: '消防救援部',
|
|
// value: '7512.00',
|
|
// progress: 30,
|
|
// customColor: '#FFC53D'
|
|
// },
|
|
// {
|
|
// name: '综合部',
|
|
// value: '7512.00',
|
|
// progress: 30,
|
|
// customColor: '#009982'
|
|
// },
|
|
],
|
|
|
|
//接口地址
|
|
apiURL: 'http://172.16.1.253:8084/',
|
|
}
|
|
},
|
|
created() {
|
|
},
|
|
mounted() {
|
|
this.getOptionData()
|
|
},
|
|
|
|
methods: {
|
|
getOptionData() {
|
|
this.selectValue = []
|
|
let dataList = {
|
|
test: ''
|
|
}
|
|
axios({
|
|
method: "POST",
|
|
url: this.apiURL + "Vue/ElectricityMeterStatistics.aspx/getDeviceList",
|
|
data: dataList,
|
|
headers: {
|
|
"Content-Type": "application/json; charset=utf-8",
|
|
},
|
|
}).then((res) => {
|
|
this.options = Object.keys(res.data.d).map((item, index) => {
|
|
this.selectValue.push(res.data.d[item].bianhao)
|
|
this.onSubmit()
|
|
return { label: res.data.d[item].place, value: res.data.d[item].bianhao }
|
|
})
|
|
})
|
|
},
|
|
selectChange() {
|
|
this.addForm.date_range_start = ''
|
|
this.addForm.date_range_end = ''
|
|
},
|
|
//选择周
|
|
changeWeek(date) {
|
|
const startDate = new Date(date.getFullYear(), date.getMonth(), date.getDate() - date.getDay());
|
|
const endDate = new Date(date.getFullYear(), date.getMonth(), date.getDate() + (6 - date.getDay()));
|
|
this.addForm = { date_range_start: startDate, date_range_end: endDate };
|
|
},
|
|
getWeekStartDate(week) {
|
|
return week;
|
|
},
|
|
getWeekEndDate(week) {
|
|
return week;
|
|
},
|
|
//查询
|
|
onSubmit() {
|
|
if (this.time == '日') {
|
|
this.addForm.date_range_start = moment(this.addForm.date_range_start).format(
|
|
"YYYY-MM-DD")
|
|
this.addForm.date_range_end = ''
|
|
} else if (this.time == '月') {
|
|
this.addForm.date_range_start = moment(this.addForm.date_range_start).format(
|
|
"YYYY-MM")
|
|
this.addForm.date_range_end = ''
|
|
} else if (this.time == '年') {
|
|
this.addForm.date_range_start = moment(this.addForm.date_range_start).format(
|
|
"YYYY")
|
|
this.addForm.date_range_end = ''
|
|
} else if (this.time = '周') {
|
|
this.addForm.date_range_start = this.getWeekStartDate(moment(this.addForm.date_range_start).format(
|
|
"YYYY-MM-DD"))
|
|
this.addForm.date_range_end = this.getWeekEndDate(moment(this.addForm.date_range_end).format(
|
|
"YYYY-MM-DD"))
|
|
}
|
|
let dataList = {
|
|
bianhao: this.selectValue,
|
|
type: this.time,
|
|
start_date: this.addForm.date_range_start,
|
|
end_date: this.addForm.date_range_end
|
|
}
|
|
axios({
|
|
method: "POST",
|
|
url: this.apiURL + "Vue/ElectricityMeterStatistics.aspx/getEnergyConsumptionList",
|
|
data: dataList,
|
|
headers: {
|
|
"Content-Type": "application/json; charset=utf-8",
|
|
},
|
|
}).then((res) => {
|
|
let color = ['rgb(81,109,244)', 'rgb(114,243,166)', 'rgb(89,201,254)', 'rgb(254,143,115)', 'rgb(164,129,245)', 'rgb(115,164,242)', 'rgb(254,207,94)', 'rgb(153, 50, 204)',
|
|
"rgb(255, 105, 180)", "rgb(255, 192, 203)", "rgb(255, 160, 122)", 'rgb(255, 255, 240)', 'rgb(135, 206, 250)'
|
|
]
|
|
let numbers = []
|
|
let qoqStatus = null
|
|
let yoyStatus = null
|
|
let rankNUmber = []
|
|
this.energyConsumptionTrends(res.data.d.trend)
|
|
this.tableData = Object.keys(res.data.d.energy_consumption_ranking).map((item, index) => {
|
|
numbers.push(res.data.d.energy_consumption_ranking[item].value)
|
|
const total = numbers.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
|
|
const per = (parseInt(res.data.d.energy_consumption_ranking[item].value) / total) * 100
|
|
return {
|
|
name: res.data.d.energy_consumption_ranking[item].place,
|
|
value: res.data.d.energy_consumption_ranking[item].value,
|
|
progress: per.toFixed(2),
|
|
customColor: color[item]
|
|
}
|
|
})
|
|
this.yoyqoqTable = Object.keys(res.data.d.same_month_ratio).map((item, index) => {
|
|
if (res.data.d.same_month_ratio[item].yoy > 0) {
|
|
yoyStatus = true
|
|
} else {
|
|
res.data.d.same_month_ratio[item].yoy = Math.abs(res.data.d.same_month_ratio[item].yoy)
|
|
yoyStatus = false
|
|
}
|
|
if (res.data.d.same_month_ratio[item].qoq > 0) {
|
|
qoqStatus = true
|
|
} else {
|
|
res.data.d.same_month_ratio[item].qoq = Math.abs(res.data.d.same_month_ratio[item].qoq)
|
|
qoqStatus = false
|
|
}
|
|
return {
|
|
name: res.data.d.same_month_ratio[item].place,
|
|
value: res.data.d.same_month_ratio[item].value,
|
|
qoq: res.data.d.same_month_ratio[item].qoq + '%',
|
|
yoy: res.data.d.same_month_ratio[item].yoy + '%',
|
|
qoqStatus: qoqStatus,
|
|
yoyStatus: yoyStatus,
|
|
}
|
|
})
|
|
this.incrementTable = Object.keys(res.data.d.incremental_ranking).map((item, index) => {
|
|
// res.data.d.incremental_ranking[item].yoy_value = 0
|
|
// res.data.d.incremental_ranking[item].qoq_value = 0
|
|
if (this.radio == '同比') {
|
|
rankNUmber.push(res.data.d.incremental_ranking[item].yoy_value)
|
|
const rankTotal = rankNUmber.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
|
|
const rankPer = (parseInt(res.data.d.incremental_ranking[item].yoy_value) / rankTotal) * 100
|
|
return {
|
|
name: res.data.d.incremental_ranking[item].place,
|
|
value: res.data.d.incremental_ranking[item].yoy_value,
|
|
progress: rankPer,
|
|
customColor: color[item]
|
|
}
|
|
} else {
|
|
rankNUmber.push(res.data.d.incremental_ranking[item].qoq_value)
|
|
const rankTotal = rankNUmber.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
|
|
const rankPer = (parseInt(res.data.d.incremental_ranking[item].qoq_value) / rankTotal) * 100
|
|
return {
|
|
name: res.data.d.incremental_ranking[item].place,
|
|
value: res.data.d.incremental_ranking[item].qoq_value,
|
|
progress: rankPer,
|
|
customColor: color[item]
|
|
}
|
|
}
|
|
})
|
|
console.log(this.incrementTable,'this.incrementTable');
|
|
})
|
|
},
|
|
radioChange(val) {
|
|
if (this.time == '日') {
|
|
this.addForm.date_range_start = moment(this.addForm.date_range_start).format(
|
|
"YYYY-MM-DD")
|
|
this.addForm.date_range_end = ''
|
|
} else if (this.time == '月') {
|
|
this.addForm.date_range_start = moment(this.addForm.date_range_start).format(
|
|
"YYYY-MM")
|
|
this.addForm.date_range_end = ''
|
|
} else if (this.time == '年') {
|
|
this.addForm.date_range_start = moment(this.addForm.date_range_start).format(
|
|
"YYYY")
|
|
this.addForm.date_range_end = ''
|
|
} else if (this.time = '周') {
|
|
this.addForm.date_range_start = this.getWeekStartDate(moment(this.addForm.date_range_start).format(
|
|
"YYYY-MM-DD"))
|
|
this.addForm.date_range_end = this.getWeekEndDate(moment(this.addForm.date_range_end).format(
|
|
"YYYY-MM-DD"))
|
|
}
|
|
let dataList = {
|
|
bianhao: this.selectValue,
|
|
type: this.time,
|
|
start_date: this.addForm.date_range_start,
|
|
end_date: this.addForm.date_range_end
|
|
}
|
|
axios({
|
|
method: "POST",
|
|
url: this.apiURL + "Vue/ElectricityMeterStatistics.aspx/getEnergyConsumptionList",
|
|
data: dataList,
|
|
headers: {
|
|
"Content-Type": "application/json; charset=utf-8",
|
|
},
|
|
}).then((res) => {
|
|
let color = ['rgb(81,109,244)', 'rgb(114,243,166)', 'rgb(89,201,254)', 'rgb(254,143,115)', 'rgb(164,129,245)', 'rgb(115,164,242)', 'rgb(254,207,94)', 'rgb(153, 50, 204)',
|
|
"rgb(255, 105, 180)", "rgb(255, 192, 203)", "rgb(255, 160, 122)", 'rgb(255, 255, 240)', 'rgb(135, 206, 250)'
|
|
]
|
|
let qoqStatus = null
|
|
let yoyStatus = null
|
|
let rankNUmber = []
|
|
let rankTotal = null
|
|
this.incrementTable = Object.keys(res.data.d.incremental_ranking_qoq).map((item, index) => {
|
|
// res.data.d.incremental_ranking[item].yoy_value = 0
|
|
// res.data.d.incremental_ranking[item].qoq_value = 0
|
|
if (val == '同比') {
|
|
rankNUmber.push(res.data.d.incremental_ranking_qoq[item].yoy_value)
|
|
rankTotal = rankNUmber.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
|
|
const rankPer = (parseInt(res.data.d.incremental_ranking_qoq[item].yoy_value) / rankTotal) * 100
|
|
return {
|
|
name: res.data.d.incremental_ranking_qoq[item].place,
|
|
value: res.data.d.incremental_ranking_qoq[item].yoy_value,
|
|
progress: rankPer,
|
|
customColor: color[item]
|
|
}
|
|
} else {
|
|
rankNUmber.push(res.data.d.incremental_ranking_qoq[item].qoq_value)
|
|
rankTotal = rankNUmber.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
|
|
const rankPer = (parseInt(res.data.d.incremental_ranking_qoq[item].qoq_value) / rankTotal) * 100
|
|
return {
|
|
name: res.data.d.incremental_ranking_qoq[item].place,
|
|
value: res.data.d.incremental_ranking_qoq[item].qoq_value,
|
|
progress: rankPer,
|
|
customColor: color[item]
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
energyConsumptionTrends(val) {
|
|
let dataX = []
|
|
let seriesList = []
|
|
let dataName = []
|
|
let dataY = []
|
|
let dataList = []
|
|
let uniqueArr = []
|
|
val.forEach((item, index) => {
|
|
dataX.push(item.time)
|
|
item.data.forEach((each, key) => {
|
|
dataName.push(each.place)
|
|
uniqueArr = [...new Set(dataName)]
|
|
for (let i = 0; i < uniqueArr.length; i++) {
|
|
if (uniqueArr[i] == each.place) {
|
|
dataY.push({ name: uniqueArr[i], value: each.value })
|
|
}
|
|
}
|
|
|
|
});
|
|
});
|
|
const result = dataY.reduce((accumulator, currentValue) => {
|
|
const existingObject = accumulator.find(obj => obj.name === currentValue.name);
|
|
if (existingObject) {
|
|
existingObject.values.push(currentValue.value);
|
|
} else {
|
|
accumulator.push({ name: currentValue.name, values: [currentValue.value] });
|
|
}
|
|
return accumulator;
|
|
}, []);
|
|
for (let i = 0; i < result.length; i++) {
|
|
seriesList.push({
|
|
name: result[i].name,
|
|
type: 'bar',
|
|
stack: 'machine',
|
|
barWidth: 20,
|
|
label: {
|
|
show: false
|
|
},
|
|
data: result[i].values
|
|
})
|
|
|
|
}
|
|
var myChart = echarts.init(document.getElementById('energyConsumptionTrends'));
|
|
var option = {
|
|
tooltip: {
|
|
trigger: 'axis',
|
|
axisPointer: { // 坐标轴指示器,坐标轴触发有效
|
|
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
|
|
},
|
|
},
|
|
color: ['rgb(81,109,244)', 'rgb(114,243,166)', 'rgb(89,201,254)', 'rgb(254,143,115)', 'rgb(164,129,245)', 'rgb(115,164,242)', 'rgb(254,207,94)', 'rgb(153, 50, 204)',
|
|
"rgb(255, 105, 180)", "rgb(255, 192, 203)", "rgb(255, 160, 122)", 'rgb(255, 255, 240)', 'rgb(135, 206, 250)'
|
|
],
|
|
legend: {
|
|
show: true,
|
|
top: '2%',
|
|
// icon: "rect",
|
|
itemWidth: 30, // 图例标记的图形宽度。
|
|
itemHeight: 15, // 图例标记的图形高度。
|
|
textStyle: {
|
|
color: 'rgb(78,81,78)',
|
|
fontSize: 14,
|
|
padding: [0, 8, 0, 8]
|
|
}
|
|
},
|
|
grid: {
|
|
left: '3%',
|
|
top: '20%',
|
|
right: '4%',
|
|
bottom: '3%',
|
|
containLabel: true
|
|
},
|
|
xAxis: [{
|
|
type: 'category',
|
|
axisLine: {
|
|
//坐标轴轴线相关设置。数学上的x轴
|
|
show: true,
|
|
lineStyle: {
|
|
color: 'rgb(78,81,78)',
|
|
},
|
|
},
|
|
axisLabel: {
|
|
//坐标轴刻度标签的相关设置
|
|
textStyle: {
|
|
color: 'rgb(78,81,78)',
|
|
fontSize: 12,
|
|
},
|
|
// interval:0
|
|
},
|
|
splitLine: {
|
|
show: false,
|
|
lineStyle: {
|
|
color: '#233653',
|
|
},
|
|
},
|
|
axisTick: {
|
|
show: false,
|
|
},
|
|
data: dataX
|
|
}],
|
|
yAxis: [{
|
|
name: 'kW·h',
|
|
nameTextStyle: {
|
|
color: "rgb(78,81,78)",
|
|
fontSize: 12,
|
|
padding: [0, 0, 10, 0]
|
|
},
|
|
// minInterval: 1,
|
|
type: 'value',
|
|
axisLine: {
|
|
show: false,
|
|
lineStyle: {
|
|
color: 'rgb(78,81,78)',
|
|
},
|
|
},
|
|
axisLabel: {
|
|
show: true,
|
|
textStyle: {
|
|
color: 'rgb(78,81,78)',
|
|
fontSize: 14
|
|
}
|
|
},
|
|
axisTick: {
|
|
show: false,
|
|
},
|
|
splitLine: {
|
|
show: true,
|
|
lineStyle: {
|
|
type: 'dashed',
|
|
},
|
|
},
|
|
},
|
|
|
|
],
|
|
series: seriesList
|
|
// series: [
|
|
// {
|
|
// name: '信息技术部',
|
|
// type: 'bar',
|
|
// stack: 'machine',
|
|
// barWidth: 40,
|
|
// label: {
|
|
// show: false
|
|
// },
|
|
// data: [540, 520, 560, 400, 480, 500, 600]
|
|
// },
|
|
// {
|
|
// name: '空管设施部',
|
|
// type: 'bar',
|
|
// label: {
|
|
// show: false
|
|
// },
|
|
// stack: 'machine',
|
|
// data: [60, 80, 80, 300, 200, 120, 160]
|
|
// },
|
|
// {
|
|
// name: '消防救援部',
|
|
// type: 'bar',
|
|
|
|
// label: {
|
|
// show: false
|
|
// },
|
|
// stack: 'machine',
|
|
// data: [840, 840, 800, 740, 760, 820, 680]
|
|
// },
|
|
// {
|
|
// name: '飞行区管理部',
|
|
// type: 'bar',
|
|
|
|
// label: {
|
|
// show: false
|
|
// },
|
|
// stack: 'machine',
|
|
// data: [840, 840, 800, 740, 760, 820, 680]
|
|
// },
|
|
// {
|
|
// name: '通设部',
|
|
// type: 'bar',
|
|
|
|
// label: {
|
|
// show: false
|
|
// },
|
|
// stack: 'machine',
|
|
// data: [840, 840, 800, 740, 760, 820, 680]
|
|
// },
|
|
// {
|
|
// name: '综合部',
|
|
// type: 'bar',
|
|
|
|
// label: {
|
|
// show: false
|
|
// },
|
|
// stack: 'machine',
|
|
// data: [840, 840, 800, 740, 760, 820, 680]
|
|
// },
|
|
// ]
|
|
};
|
|
myChart.setOption(option);
|
|
window.addEventListener("resize", () => {
|
|
myChart.resize();
|
|
});
|
|
},
|
|
}
|
|
});
|
|
</script>
|
|
|
|
|
|
</body>
|
|
|
|
</html> |