2022-10-17 10:13:22 +08:00
|
|
|
|
<template>
|
2022-10-20 09:09:17 +08:00
|
|
|
|
<Card title="用电用水">
|
2022-10-17 10:13:22 +08:00
|
|
|
|
<div class="contentBox">
|
2022-10-20 09:09:17 +08:00
|
|
|
|
<!-- 上结构 -->
|
|
|
|
|
|
<div class="topWater">
|
2022-10-23 18:12:21 +08:00
|
|
|
|
<div @click="select(1)" :class="index ==1?'electricDiv':'waterDiv'">用水</div>
|
|
|
|
|
|
<div @click="select(2)" :class="index ==2?'electricDiv':'waterDiv'">用电</div>
|
2022-10-20 09:09:17 +08:00
|
|
|
|
<div class="DateTime">
|
|
|
|
|
|
<el-date-picker
|
2022-10-23 18:12:21 +08:00
|
|
|
|
v-model="time1"
|
2022-10-20 09:09:17 +08:00
|
|
|
|
type="daterange"
|
|
|
|
|
|
range-separator="-"
|
|
|
|
|
|
start-placeholder="开始日期"
|
|
|
|
|
|
end-placeholder="结束日期"
|
|
|
|
|
|
value-format="yyyy-MM-dd"
|
|
|
|
|
|
size="mini"
|
|
|
|
|
|
></el-date-picker>
|
|
|
|
|
|
</div>
|
2022-10-17 10:13:22 +08:00
|
|
|
|
</div>
|
2022-10-23 18:12:21 +08:00
|
|
|
|
<!-- 暂无数据结构 -->
|
|
|
|
|
|
<div id="waterMain" v-if="show"></div>
|
|
|
|
|
|
<div style="margin-top: 50px;" v-else>
|
|
|
|
|
|
<img style="margin: auto 190px;" src="@/assets/images/noData.png" alt="" />
|
|
|
|
|
|
<p style="text-align: center;">暂无数据</p>
|
|
|
|
|
|
</div>
|
2022-10-20 09:09:17 +08:00
|
|
|
|
</div>
|
2022-10-17 10:13:22 +08:00
|
|
|
|
</Card>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
import Card from '../components/Card.vue'
|
2022-10-20 09:09:17 +08:00
|
|
|
|
import echarts from 'echarts4'
|
2022-10-23 18:12:21 +08:00
|
|
|
|
import { getwaterMeterListApi, selectWaterMeterStatisticsApi, getCurrentMonthMeterRecordApi } from '@/assets/js/api/waterManage'
|
2022-10-17 10:13:22 +08:00
|
|
|
|
export default {
|
|
|
|
|
|
components: { Card },
|
2022-10-20 09:09:17 +08:00
|
|
|
|
data() {
|
2022-10-23 18:12:21 +08:00
|
|
|
|
return {
|
|
|
|
|
|
index: 1,
|
|
|
|
|
|
time1:'',
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
monthWaterList: '',
|
|
|
|
|
|
count: '',
|
|
|
|
|
|
waterMeter: '',
|
|
|
|
|
|
formInline: {
|
|
|
|
|
|
yearTime: '',
|
|
|
|
|
|
waterMeterNo: '',
|
|
|
|
|
|
projectSn: this.$store.state.projectSn
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-10-17 10:13:22 +08:00
|
|
|
|
},
|
2022-10-20 09:09:17 +08:00
|
|
|
|
mounted() {
|
|
|
|
|
|
this.wEacharts()
|
2022-10-17 10:13:22 +08:00
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
2022-10-23 18:12:21 +08:00
|
|
|
|
//用水/用电按钮切换
|
|
|
|
|
|
select(i) {
|
|
|
|
|
|
this.index = i;
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//echart图表
|
|
|
|
|
|
async wEacharts() {
|
|
|
|
|
|
const res = await getCurrentMonthMeterRecordApi(this.formInline)
|
|
|
|
|
|
this.waterMeter = res.result.waterMeter
|
|
|
|
|
|
if (this.waterMeter === null) {
|
|
|
|
|
|
this.show = false
|
|
|
|
|
|
}
|
|
|
|
|
|
this.count = res.result.count
|
|
|
|
|
|
const res2 = await selectWaterMeterStatisticsApi(this.formInline)
|
|
|
|
|
|
this.monthWaterList = res2.result.monthWaterList
|
|
|
|
|
|
const res3 = await getwaterMeterListApi({ projectSn: this.$store.state.projectSn })
|
|
|
|
|
|
console.log('res3', res3)
|
|
|
|
|
|
|
2022-10-20 09:09:17 +08:00
|
|
|
|
// 基于准备好的dom,初始化echarts实例
|
|
|
|
|
|
let waterEch = echarts.init(document.getElementById('waterMain'))
|
|
|
|
|
|
let xData = (function() {
|
|
|
|
|
|
let data = []
|
|
|
|
|
|
for (let i = 1; i < 13; i++) {
|
|
|
|
|
|
data.push(i + '月')
|
2022-10-17 10:13:22 +08:00
|
|
|
|
}
|
2022-10-20 09:09:17 +08:00
|
|
|
|
return data
|
|
|
|
|
|
})()
|
|
|
|
|
|
|
|
|
|
|
|
let option = {
|
|
|
|
|
|
title: {
|
|
|
|
|
|
x: '4%',
|
|
|
|
|
|
|
|
|
|
|
|
textStyle: {
|
|
|
|
|
|
color: '#fff',
|
|
|
|
|
|
fontSize: '8'
|
|
|
|
|
|
},
|
|
|
|
|
|
subtextStyle: {
|
|
|
|
|
|
color: '#90979c',
|
|
|
|
|
|
fontSize: '8'
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
tooltip: {
|
|
|
|
|
|
trigger: 'axis',
|
|
|
|
|
|
axisPointer: {
|
|
|
|
|
|
type: 'shadow',
|
|
|
|
|
|
textStyle: {
|
|
|
|
|
|
color: '#fff'
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
grid: {
|
|
|
|
|
|
// 图表距离边框的距离,可用百分比和数字(px)配置
|
|
|
|
|
|
top: '5%',
|
2022-10-20 13:59:11 +08:00
|
|
|
|
left: '4%',
|
2022-10-20 09:09:17 +08:00
|
|
|
|
right: '4%',
|
|
|
|
|
|
bottom: '25%',
|
|
|
|
|
|
containLabel: true
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
legend: {
|
|
|
|
|
|
x: '4%',
|
|
|
|
|
|
top: '5%',
|
|
|
|
|
|
bottom: '0%',
|
|
|
|
|
|
textStyle: {
|
|
|
|
|
|
color: '#90979c'
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
calculable: true,
|
|
|
|
|
|
xAxis: [
|
|
|
|
|
|
{
|
|
|
|
|
|
type: 'category',
|
|
|
|
|
|
|
|
|
|
|
|
axisLine: {
|
|
|
|
|
|
lineStyle: {
|
|
|
|
|
|
color: '#fff'
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
splitLine: {
|
|
|
|
|
|
show: false
|
|
|
|
|
|
},
|
|
|
|
|
|
axisTick: {
|
|
|
|
|
|
show: false
|
|
|
|
|
|
},
|
|
|
|
|
|
splitArea: {
|
|
|
|
|
|
show: false
|
|
|
|
|
|
},
|
|
|
|
|
|
axisLabel: {
|
|
|
|
|
|
interval: 0
|
|
|
|
|
|
},
|
|
|
|
|
|
data: xData
|
|
|
|
|
|
}
|
|
|
|
|
|
],
|
|
|
|
|
|
yAxis: [
|
|
|
|
|
|
{
|
|
|
|
|
|
type: 'value',
|
|
|
|
|
|
splitLine: {
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
lineStyle: {
|
|
|
|
|
|
color: 'rgba(255, 255, 255,0.3)',
|
|
|
|
|
|
type: 'dashed'
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
axisLine: {
|
2022-10-23 18:12:21 +08:00
|
|
|
|
show: true,
|
2022-10-20 09:09:17 +08:00
|
|
|
|
lineStyle: {
|
2022-10-23 18:12:21 +08:00
|
|
|
|
type: 'dashed'
|
2022-10-20 09:09:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
axisTick: {
|
|
|
|
|
|
show: false
|
|
|
|
|
|
},
|
|
|
|
|
|
axisLabel: {
|
|
|
|
|
|
show: false
|
|
|
|
|
|
},
|
|
|
|
|
|
splitArea: {
|
|
|
|
|
|
show: false
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
],
|
|
|
|
|
|
// "dataZoom": [{
|
|
|
|
|
|
// "show": true,
|
|
|
|
|
|
// "height": 30,
|
|
|
|
|
|
// "xAxisIndex": [
|
|
|
|
|
|
// 0
|
|
|
|
|
|
// ],
|
|
|
|
|
|
// bottom: 30,
|
|
|
|
|
|
// "start": 10,
|
|
|
|
|
|
// "end": 80,
|
|
|
|
|
|
// // handleIcon: 'path://M306.1,413c0,2.2-1.8,4-4,4h-59.8c-2.2,0-4-1.8-4-4V200.8c0-2.2,1.8-4,4-4h59.8c2.2,0,4,1.8,4,4V413z',
|
|
|
|
|
|
// handleSize: '110%',
|
|
|
|
|
|
// handleStyle:{
|
|
|
|
|
|
// color:"#d3dee5",
|
|
|
|
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
// textStyle:{
|
|
|
|
|
|
// color:"#fff"},
|
|
|
|
|
|
// borderColor:"#90979c"
|
|
|
|
|
|
|
|
|
|
|
|
// }, {
|
|
|
|
|
|
// "type": "inside",
|
|
|
|
|
|
// "show": true,
|
|
|
|
|
|
// "height": 15,
|
|
|
|
|
|
// "start": 1,
|
|
|
|
|
|
// "end": 35
|
|
|
|
|
|
// }],
|
|
|
|
|
|
series: [
|
|
|
|
|
|
{
|
|
|
|
|
|
type: 'bar',
|
|
|
|
|
|
stack: '总量',
|
|
|
|
|
|
barMaxWidth: 25,
|
|
|
|
|
|
barGap: '10%',
|
2022-10-23 18:12:21 +08:00
|
|
|
|
symbol: 'circle',
|
2022-10-20 09:09:17 +08:00
|
|
|
|
itemStyle: {
|
|
|
|
|
|
normal: {
|
|
|
|
|
|
color: '#6EE4F0',
|
2022-10-23 18:12:21 +08:00
|
|
|
|
lineStyle: {
|
|
|
|
|
|
color: '#fff'
|
2022-10-20 09:09:17 +08:00
|
|
|
|
},
|
|
|
|
|
|
label: {
|
|
|
|
|
|
show: false,
|
|
|
|
|
|
textStyle: {
|
|
|
|
|
|
color: '#fff'
|
|
|
|
|
|
},
|
|
|
|
|
|
position: 'inside',
|
|
|
|
|
|
formatter: function(p) {
|
|
|
|
|
|
return p.value > 0 ? p.value : ''
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2022-10-23 18:12:21 +08:00
|
|
|
|
data: this.waterMeter
|
2022-10-20 09:09:17 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
type: 'bar',
|
|
|
|
|
|
stack: '总量',
|
|
|
|
|
|
itemStyle: {
|
|
|
|
|
|
normal: {
|
|
|
|
|
|
color: '#E7622A',
|
|
|
|
|
|
barBorderRadius: 0,
|
|
|
|
|
|
label: {
|
|
|
|
|
|
show: false,
|
|
|
|
|
|
position: 'inside',
|
|
|
|
|
|
formatter: function(p) {
|
|
|
|
|
|
return p.value > 0 ? p.value : ''
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2022-10-23 18:12:21 +08:00
|
|
|
|
data: this.count
|
2022-10-20 09:09:17 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
type: 'line',
|
|
|
|
|
|
symbolSize: 8,
|
|
|
|
|
|
symbol: 'circle',
|
|
|
|
|
|
smooth: true,
|
|
|
|
|
|
itemStyle: {
|
|
|
|
|
|
normal: {
|
|
|
|
|
|
color: '#fff',
|
|
|
|
|
|
barBorderRadius: 2,
|
2022-10-23 18:12:21 +08:00
|
|
|
|
lineStyle: {
|
|
|
|
|
|
color: '#FFC303'
|
2022-10-20 09:09:17 +08:00
|
|
|
|
},
|
|
|
|
|
|
label: {
|
|
|
|
|
|
show: false,
|
|
|
|
|
|
position: 'bottom',
|
|
|
|
|
|
formatter: function(p) {
|
|
|
|
|
|
return p.value > 0 ? p.value : ''
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
data: [1036, 3693, 2962, 3810, 2519, 1915, 1748, 4675, 6209, 4323, 2865, 4298]
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
waterEch.setOption(option)
|
2022-10-17 10:13:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
|
|
.contentBox {
|
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
padding-top: 20px;
|
|
|
|
|
|
width: 100%;
|
2022-10-20 09:09:17 +08:00
|
|
|
|
height: 100%;
|
|
|
|
|
|
.topWater {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 20%;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
.waterDiv {
|
2022-10-23 18:12:21 +08:00
|
|
|
|
cursor:pointer;
|
2022-10-20 09:09:17 +08:00
|
|
|
|
display: inline-block;
|
|
|
|
|
|
// margin-top: 5px;
|
|
|
|
|
|
// padding-top: 15px;
|
|
|
|
|
|
width: 80px;
|
|
|
|
|
|
height: 35px;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
background-image: url(../assets/images/common/bg_water.png);
|
|
|
|
|
|
background-repeat: no-repeat;
|
|
|
|
|
|
background-size: 100%;
|
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
|
line-height: 38px;
|
|
|
|
|
|
margin: 0 10px 0 0;
|
|
|
|
|
|
color: #fff;
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.electricDiv {
|
2022-10-23 18:12:21 +08:00
|
|
|
|
cursor:pointer;
|
2022-10-20 09:09:17 +08:00
|
|
|
|
display: inline-block;
|
|
|
|
|
|
// margin-top: 5px;
|
|
|
|
|
|
// padding-top: 15px;
|
|
|
|
|
|
width: 80px;
|
|
|
|
|
|
height: 35px;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
background-image: url(../assets/images/common/num_bg.png);
|
|
|
|
|
|
background-repeat: no-repeat;
|
|
|
|
|
|
background-size: 100%;
|
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
|
line-height: 38px;
|
|
|
|
|
|
margin: 0 10px 0 0;
|
|
|
|
|
|
color: #fff;
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.DateTime {
|
2022-10-23 18:12:21 +08:00
|
|
|
|
cursor:pointer;
|
2022-10-20 09:09:17 +08:00
|
|
|
|
flex: 1;
|
2022-10-23 18:12:21 +08:00
|
|
|
|
// margin-left: 80px;
|
2022-10-20 09:09:17 +08:00
|
|
|
|
margin-top: 4px;
|
|
|
|
|
|
::v-deep .el-date-editor--daterange.el-input__inner {
|
2022-10-23 18:12:21 +08:00
|
|
|
|
width: 230px;
|
2022-10-20 09:09:17 +08:00
|
|
|
|
height: 30px;
|
|
|
|
|
|
background-color: #182337;
|
|
|
|
|
|
border: 1px solid #264b5e;
|
2022-10-23 18:12:21 +08:00
|
|
|
|
margin-left: 50px;
|
2022-10-20 09:09:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
::v-deep .el-range-input {
|
2022-10-23 18:12:21 +08:00
|
|
|
|
cursor:pointer;
|
|
|
|
|
|
margin-left: 13px;
|
2022-10-20 09:09:17 +08:00
|
|
|
|
background-color: #182337;
|
|
|
|
|
|
color: #6ee4f0;
|
|
|
|
|
|
}
|
|
|
|
|
|
::v-deep .el-date-editor {
|
2022-10-23 18:12:21 +08:00
|
|
|
|
cursor:pointer;
|
2022-10-20 09:09:17 +08:00
|
|
|
|
.el-range__icon {
|
2022-10-23 18:12:21 +08:00
|
|
|
|
|
2022-10-20 09:09:17 +08:00
|
|
|
|
line-height: 20px;
|
|
|
|
|
|
color: #6ee4f0;
|
|
|
|
|
|
}
|
|
|
|
|
|
.el-range-separator {
|
2022-10-23 18:12:21 +08:00
|
|
|
|
cursor:pointer;
|
2022-10-20 09:09:17 +08:00
|
|
|
|
line-height: 20px;
|
|
|
|
|
|
color: #757d88;
|
2022-10-17 10:13:22 +08:00
|
|
|
|
}
|
2022-10-20 09:09:17 +08:00
|
|
|
|
.el-range__close-icon {
|
2022-10-23 18:12:21 +08:00
|
|
|
|
cursor:pointer;
|
2022-10-20 09:09:17 +08:00
|
|
|
|
color: #757d88;
|
|
|
|
|
|
line-height: 20px;
|
2022-10-17 10:13:22 +08:00
|
|
|
|
}
|
2022-10-23 18:12:21 +08:00
|
|
|
|
.el-range-separator{
|
|
|
|
|
|
margin-left: 10px;
|
|
|
|
|
|
}
|
2022-10-20 09:09:17 +08:00
|
|
|
|
}
|
2022-10-17 10:13:22 +08:00
|
|
|
|
}
|
2022-10-20 09:09:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
#waterMain {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
}
|
2022-10-17 10:13:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
</style>
|