|
|
@@ -2,31 +2,31 @@
|
|
|
<div class="app-container">
|
|
|
<el-row>
|
|
|
<el-col :span="8">
|
|
|
- <div class="cell cell-row1">
|
|
|
+ <div class="cell cell-row1" v-loading="showTotalMoney.loading">
|
|
|
<div class="cell-title">账户余额</div>
|
|
|
- <div class="cell-time">截止时间为2022/06/22 17:20:20</div>
|
|
|
+ <div class="cell-time">截止时间为 {{ showTotalMoney.time }}</div>
|
|
|
<div class="cell-bottom">
|
|
|
- <div class="cell-bottom-amount">5869.00</div>
|
|
|
+ <div class="cell-bottom-amount">{{ showTotalMoney.amount.toFixed(2) }}</div>
|
|
|
<div class="rmb1">¥</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
- <div class="cell cell-row1">
|
|
|
+ <div class="cell cell-row1" v-loading="showThisMonthRecharge.loading">
|
|
|
<div class="cell-title">本月充值</div>
|
|
|
- <div class="cell-time">截止时间为2022/06/22 17:20:20</div>
|
|
|
+ <div class="cell-time">截止时间为 {{ showThisMonthRecharge.time }}</div>
|
|
|
<div class="cell-bottom">
|
|
|
- <div class="cell-bottom-amount">5869.00</div>
|
|
|
+ <div class="cell-bottom-amount">{{ showThisMonthRecharge.amount.toFixed(2) }}</div>
|
|
|
<div class="rmb2">¥</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
- <div class="cell cell-row1">
|
|
|
+ <div class="cell cell-row1" v-loading="showThisMonthConsume.loading">
|
|
|
<div class="cell-title">本月消费</div>
|
|
|
- <div class="cell-time">截止时间为2022/06/22 17:20:20</div>
|
|
|
+ <div class="cell-time">截止时间为 {{ showThisMonthConsume.time }}</div>
|
|
|
<div class="cell-bottom">
|
|
|
- <div class="cell-bottom-amount">5869.00</div>
|
|
|
+ <div class="cell-bottom-amount">{{ showThisMonthConsume.amount.toFixed(2) }}</div>
|
|
|
<div class="rmb3">¥</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -40,11 +40,10 @@
|
|
|
<img src="../../icons/images/index/zoushi.png" alt="">
|
|
|
<span>用电消费走势图</span>
|
|
|
</div>
|
|
|
- <el-select v-model="value" placeholder="请选择" class="select-year">
|
|
|
- <el-option v-for="item in options" :key="item.value" :label="item.label"
|
|
|
- :value="item.value">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
+ <el-date-picker v-model="showEchartsDate" @change="echartsDate_change" class="select-year"
|
|
|
+ type="year" :picker-options="pickerOptions" :clearable="false" :editable="false"
|
|
|
+ value-format="yyyy" placeholder="年份">
|
|
|
+ </el-date-picker>
|
|
|
<div id="main-echart" class="line-echart"></div>
|
|
|
</el-card>
|
|
|
</div>
|
|
|
@@ -57,7 +56,8 @@
|
|
|
<span>超时预警</span>
|
|
|
</div>
|
|
|
<el-table :data="yujing_tableData" height="350" stripe :cell-style="cell_style"
|
|
|
- :header-cell-style="header_cell_style" style="width: 100%">
|
|
|
+ v-loading="airTimeoutWarning_loading" :header-cell-style="header_cell_style"
|
|
|
+ style="width: 100%">
|
|
|
<el-table-column prop="deviceId" label="设备号" align="center">
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="warningTime" label="告警时间" align="center">
|
|
|
@@ -128,6 +128,13 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+ import {
|
|
|
+ totalMoney,
|
|
|
+ thisMonthRecharge,
|
|
|
+ thisMonthConsume,
|
|
|
+ airTimeoutWarning,
|
|
|
+ getChart
|
|
|
+ } from '@/api/index';
|
|
|
import * as echarts from 'echarts/core';
|
|
|
import {
|
|
|
TitleComponent,
|
|
|
@@ -153,6 +160,35 @@
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
+ // 账户总余额
|
|
|
+ showTotalMoney: {
|
|
|
+ time: '0000/00/00 00:00:00',
|
|
|
+ amount: 0.00,
|
|
|
+ loading: false
|
|
|
+ },
|
|
|
+ // 本月充值
|
|
|
+ showThisMonthRecharge: {
|
|
|
+ time: '0000/00/00 00:00:00',
|
|
|
+ amount: 0.00,
|
|
|
+ loading: false
|
|
|
+ },
|
|
|
+ // 本月消费
|
|
|
+ showThisMonthConsume: {
|
|
|
+ time: '0000/00/00 00:00:00',
|
|
|
+ amount: 0.00,
|
|
|
+ loading: false
|
|
|
+ },
|
|
|
+ // 空调超时预警
|
|
|
+ airTimeoutWarning_loading: false,
|
|
|
+ // 选择年份范围
|
|
|
+ pickerOptions: {
|
|
|
+ disabledDate(time) {
|
|
|
+ return (
|
|
|
+ time.getFullYear() < "2021" || time.getFullYear() > new Date().getFullYear()
|
|
|
+ );
|
|
|
+ }
|
|
|
+ },
|
|
|
+ showEchartsDate: new Date().getFullYear() + '',
|
|
|
// 表格单元格样式
|
|
|
cell_style: {
|
|
|
color: '#1A202B',
|
|
|
@@ -166,83 +202,12 @@
|
|
|
'font-size': '18px',
|
|
|
'font-family': 'Microsoft YaHei-3970(82674968)'
|
|
|
},
|
|
|
- options: [{
|
|
|
- value: '0',
|
|
|
- label: '2022年'
|
|
|
- }, {
|
|
|
- value: '1',
|
|
|
- label: '2021年'
|
|
|
- }],
|
|
|
- value: '0', // 下拉列表的值
|
|
|
// 预警表格数据
|
|
|
- yujing_tableData: [{
|
|
|
- deviceId: '1.5P挂机01',
|
|
|
- warningTime: '2022-06-23 17:15:15',
|
|
|
- operator: '朱秀平',
|
|
|
- serviceTime: '05:25:26',
|
|
|
- contact: '13688955689'
|
|
|
- }, {
|
|
|
- deviceId: '1.5P挂机01',
|
|
|
- warningTime: '2022-06-23 17:15:15',
|
|
|
- operator: '朱秀平',
|
|
|
- serviceTime: '05:25:26',
|
|
|
- contact: '13688955689'
|
|
|
- }, {
|
|
|
- deviceId: '1.5P挂机01',
|
|
|
- warningTime: '2022-06-23 17:15:15',
|
|
|
- operator: '朱秀平',
|
|
|
- serviceTime: '05:25:26',
|
|
|
- contact: '13688955689'
|
|
|
- }, {
|
|
|
- deviceId: '1.5P挂机01',
|
|
|
- warningTime: '2022-06-23 17:15:15',
|
|
|
- operator: '朱秀平',
|
|
|
- serviceTime: '05:25:26',
|
|
|
- contact: '13688955689'
|
|
|
- }, {
|
|
|
- deviceId: '1.5P挂机01',
|
|
|
- warningTime: '2022-06-23 17:15:15',
|
|
|
- operator: '朱秀平',
|
|
|
- serviceTime: '05:25:26',
|
|
|
- contact: '13688955689'
|
|
|
- }, {
|
|
|
- deviceId: '1.5P挂机01',
|
|
|
- warningTime: '2022-06-23 17:15:15',
|
|
|
- operator: '朱秀平',
|
|
|
- serviceTime: '05:25:26',
|
|
|
- contact: '13688955689'
|
|
|
- }, {
|
|
|
- deviceId: '1.5P挂机01',
|
|
|
- warningTime: '2022-06-23 17:15:15',
|
|
|
- operator: '朱秀平',
|
|
|
- serviceTime: '05:25:26',
|
|
|
- contact: '13688955689'
|
|
|
- }],
|
|
|
+ yujing_tableData: [],
|
|
|
// 业务表格数据
|
|
|
yewu_tableData: [{
|
|
|
desc: '朱秀平电费充值',
|
|
|
dataTime: '2022-06-23 17:15:15'
|
|
|
- }, {
|
|
|
- desc: '朱秀平电费充值',
|
|
|
- dataTime: '2022-06-23 17:15:15'
|
|
|
- }, {
|
|
|
- desc: '朱秀平电费充值',
|
|
|
- dataTime: '2022-06-23 17:15:15'
|
|
|
- }, {
|
|
|
- desc: '朱秀平电费充值',
|
|
|
- dataTime: '2022-06-23 17:15:15'
|
|
|
- }, {
|
|
|
- desc: '朱秀平电费充值',
|
|
|
- dataTime: '2022-06-23 17:15:15'
|
|
|
- }, {
|
|
|
- desc: '朱秀平电费充值',
|
|
|
- dataTime: '2022-06-23 17:15:15'
|
|
|
- }, {
|
|
|
- desc: '朱秀平电费充值',
|
|
|
- dataTime: '2022-06-23 17:15:15'
|
|
|
- }, {
|
|
|
- desc: '朱秀平电费充值',
|
|
|
- dataTime: '2022-06-23 17:15:15'
|
|
|
}],
|
|
|
// 状态表格数据
|
|
|
zhuangtai_tableData: [{
|
|
|
@@ -252,62 +217,6 @@
|
|
|
adminBuilding: '26/56',
|
|
|
stuCenter: '26/56',
|
|
|
library: '26/56'
|
|
|
- }, {
|
|
|
- floor: '1F',
|
|
|
- scienceBuilding: '26/56',
|
|
|
- teachBuilding: '26/56',
|
|
|
- adminBuilding: '26/56',
|
|
|
- stuCenter: '26/56',
|
|
|
- library: '26/56'
|
|
|
- }, {
|
|
|
- floor: '1F',
|
|
|
- scienceBuilding: '26/56',
|
|
|
- teachBuilding: '26/56',
|
|
|
- adminBuilding: '26/56',
|
|
|
- stuCenter: '26/56',
|
|
|
- library: '26/56'
|
|
|
- }, {
|
|
|
- floor: '1F',
|
|
|
- scienceBuilding: '26/56',
|
|
|
- teachBuilding: '26/56',
|
|
|
- adminBuilding: '26/56',
|
|
|
- stuCenter: '26/56',
|
|
|
- library: '26/56'
|
|
|
- }, {
|
|
|
- floor: '1F',
|
|
|
- scienceBuilding: '26/56',
|
|
|
- teachBuilding: '26/56',
|
|
|
- adminBuilding: '26/56',
|
|
|
- stuCenter: '26/56',
|
|
|
- library: '26/56'
|
|
|
- }, {
|
|
|
- floor: '1F',
|
|
|
- scienceBuilding: '26/56',
|
|
|
- teachBuilding: '26/56',
|
|
|
- adminBuilding: '26/56',
|
|
|
- stuCenter: '26/56',
|
|
|
- library: '26/56'
|
|
|
- }, {
|
|
|
- floor: '1F',
|
|
|
- scienceBuilding: '26/56',
|
|
|
- teachBuilding: '26/56',
|
|
|
- adminBuilding: '26/56',
|
|
|
- stuCenter: '26/56',
|
|
|
- library: '26/56'
|
|
|
- }, {
|
|
|
- floor: '1F',
|
|
|
- scienceBuilding: '26/56',
|
|
|
- teachBuilding: '26/56',
|
|
|
- adminBuilding: '26/56',
|
|
|
- stuCenter: '26/56',
|
|
|
- library: '26/56'
|
|
|
- }, {
|
|
|
- floor: '1F',
|
|
|
- scienceBuilding: '26/56',
|
|
|
- teachBuilding: '26/56',
|
|
|
- adminBuilding: '26/56',
|
|
|
- stuCenter: '26/56',
|
|
|
- library: '26/56'
|
|
|
}],
|
|
|
// 折线图数据
|
|
|
option: {
|
|
|
@@ -317,7 +226,7 @@
|
|
|
legend: {
|
|
|
y: 'bottom',
|
|
|
x: 'center',
|
|
|
- data: ['1.5P', '2P', '3P', '天花机']
|
|
|
+ data: []
|
|
|
},
|
|
|
grid: {
|
|
|
top: '10%',
|
|
|
@@ -337,60 +246,227 @@
|
|
|
xAxis: {
|
|
|
type: 'category',
|
|
|
boundaryGap: false,
|
|
|
- data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
|
|
|
+ data: []
|
|
|
},
|
|
|
yAxis: {
|
|
|
name: '元',
|
|
|
type: 'value'
|
|
|
},
|
|
|
- series: [{
|
|
|
- name: '1.5P',
|
|
|
- type: 'line',
|
|
|
- stack: 'Total',
|
|
|
- data: [120, 132, 101, 134, 90, 230, 210]
|
|
|
- },
|
|
|
- {
|
|
|
- name: '2P',
|
|
|
- type: 'line',
|
|
|
- stack: 'Total',
|
|
|
- data: [220, 182, 191, 234, 290, 330, 310]
|
|
|
- },
|
|
|
- {
|
|
|
- name: '3P',
|
|
|
- type: 'line',
|
|
|
- stack: 'Total',
|
|
|
- data: [150, 232, 201, 154, 190, 330, 410]
|
|
|
- },
|
|
|
- {
|
|
|
- name: '天花机',
|
|
|
- type: 'line',
|
|
|
- stack: 'Total',
|
|
|
- data: [820, 932, 901, 934, 1290, 1330, 1320]
|
|
|
- }
|
|
|
- ]
|
|
|
- },
|
|
|
-
|
|
|
+ series: []
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
- mounted() {
|
|
|
- this.initCharts();
|
|
|
+ created() {
|
|
|
+ // 获取总金额
|
|
|
+ this.getTotalMoney()
|
|
|
+ // 本月充值
|
|
|
+ this.getThisMonthRecharge()
|
|
|
+ // 本月消费
|
|
|
+ this.getThisMonthConsume()
|
|
|
+ // 空调超时预警
|
|
|
+ this.getAirTimeoutWarning()
|
|
|
+ // 用电消费走势图
|
|
|
+ this.getChart()
|
|
|
},
|
|
|
methods: {
|
|
|
/**
|
|
|
+ * 获取折线图数据
|
|
|
+ */
|
|
|
+ getChart() {
|
|
|
+ this.echart_loading = true
|
|
|
+
|
|
|
+ getChart({
|
|
|
+ year: this.showEchartsDate
|
|
|
+ }).then((res) => {
|
|
|
+ // console.log(res);
|
|
|
+ if (typeof res.code == 'undefined' || res.code == '') {
|
|
|
+ this.$message.error('返回数据格式问题,code未获取到!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (res.code == 200) {
|
|
|
+ let tmp = res.monthT.sort((a, b) => {
|
|
|
+ return a.month.localeCompare(b.month)
|
|
|
+ });
|
|
|
+ let legend_data = []
|
|
|
+ let xAxis_data = []
|
|
|
+ let series = []
|
|
|
+ for (var i = 0; i < tmp.length; i++) {
|
|
|
+ if (legend_data.indexOf(tmp[i].air_config) == -1) {
|
|
|
+ legend_data.push(tmp[i].air_config)
|
|
|
+
|
|
|
+ series.push({
|
|
|
+ name: tmp[i].air_config,
|
|
|
+ type: 'line',
|
|
|
+ stack: 'Total',
|
|
|
+ data: []
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ if (xAxis_data.indexOf(tmp[i].month) == -1) {
|
|
|
+ xAxis_data.push(tmp[i].month)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for (var i = 0; i < xAxis_data.length; i++) {
|
|
|
+ for (var j = 0; j < tmp.length; j++) {
|
|
|
+ for (var k = 0; k < series.length; k++) {
|
|
|
+ if (tmp[j].month == xAxis_data[i] && tmp[j].air_config == series[k].name) {
|
|
|
+ series[k].data.push(tmp[j].num)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for (var i = 0; i < xAxis_data.length; i++) {
|
|
|
+ xAxis_data[i] = xAxis_data[i].split('-')[1]
|
|
|
+ }
|
|
|
+ // 初始化图表数据
|
|
|
+ this.option.legend.data = legend_data
|
|
|
+ this.option.xAxis.data = xAxis_data
|
|
|
+ this.option.series = series
|
|
|
+ } else {
|
|
|
+ this.option.legend.data = []
|
|
|
+ this.option.xAxis.data = []
|
|
|
+ this.option.series = []
|
|
|
+ this.$message.error('用电消费走势图返回的数据异常!');
|
|
|
+ }
|
|
|
+ // 初始化图表
|
|
|
+ this.initCharts();
|
|
|
+ }).catch((err) => {
|
|
|
+ // console.log(err);
|
|
|
+ this.$message.error(err.message)
|
|
|
+ });
|
|
|
+
|
|
|
+ this.echart_loading = false
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 选择年份改变了
|
|
|
+ */
|
|
|
+ echartsDate_change() {
|
|
|
+ // console.log(this.showEchartsDate);
|
|
|
+ this.getChart()
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 空调超时预警
|
|
|
+ */
|
|
|
+ getAirTimeoutWarning() {
|
|
|
+ this.airTimeoutWarning_loading = true
|
|
|
+
|
|
|
+ airTimeoutWarning().then((res) => {
|
|
|
+ // console.log(res);
|
|
|
+ if (typeof res.code == 'undefined' || res.code == '') {
|
|
|
+ this.$message.error('返回数据格式问题,code未获取到!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.yujing_tableData = [];
|
|
|
+ for (var i = 0; i < res.monthT.length; i++) {
|
|
|
+ this.yujing_tableData.push({
|
|
|
+ deviceId: res.monthT[i].dom + ' ' + res.monthT[i].air_name + ' ' + res
|
|
|
+ .monthT[i].air_config,
|
|
|
+ warningTime: res.monthT[i].time,
|
|
|
+ operator: res.monthT[i].user_name,
|
|
|
+ serviceTime: res.monthT[i].auto_time,
|
|
|
+ contact: res.monthT[i].phone
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // this.$message.error('空调超时预警返回的数据异常!');
|
|
|
+ }
|
|
|
+ }).catch((err) => {
|
|
|
+ // console.log(err);
|
|
|
+ this.$message.error(err.message)
|
|
|
+ });
|
|
|
+
|
|
|
+ this.airTimeoutWarning_loading = false
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 本月消费
|
|
|
+ */
|
|
|
+ getThisMonthConsume() {
|
|
|
+ this.showThisMonthConsume.loading = true
|
|
|
+
|
|
|
+ thisMonthConsume().then((res) => {
|
|
|
+ // console.log(res);
|
|
|
+ if (typeof res.code == 'undefined' || res.code == '') {
|
|
|
+ this.$message.error('返回数据格式问题,code未获取到!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.showThisMonthConsume.time = res.time
|
|
|
+ this.showThisMonthConsume.amount = res.zongCo.tong
|
|
|
+ } else {
|
|
|
+ this.$message.error('本月消费返回的数据异常!')
|
|
|
+ }
|
|
|
+ }).catch((err) => {
|
|
|
+ // console.log(err);
|
|
|
+ this.$message.error(err.message)
|
|
|
+ });
|
|
|
+
|
|
|
+ this.showThisMonthConsume.loading = false
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 本月充值
|
|
|
+ */
|
|
|
+ getThisMonthRecharge() {
|
|
|
+ this.showThisMonthRecharge.loading = true
|
|
|
+
|
|
|
+ thisMonthConsume().then((res) => {
|
|
|
+ // console.log(res);
|
|
|
+ if (typeof res.code == 'undefined' || res.code == '') {
|
|
|
+ this.$message.error('返回数据格式问题,code未获取到!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.showThisMonthRecharge.time = res.time
|
|
|
+ this.showThisMonthRecharge.amount = res.zongCo.tong
|
|
|
+ } else {
|
|
|
+ this.$message.error('本月充值返回的数据异常!')
|
|
|
+ }
|
|
|
+ }).catch((err) => {
|
|
|
+ // console.log(err);
|
|
|
+ this.$message.error(err.message)
|
|
|
+ });
|
|
|
+
|
|
|
+ this.showThisMonthRecharge.loading = false
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 获取总金额
|
|
|
+ */
|
|
|
+ getTotalMoney() {
|
|
|
+ this.showTotalMoney.loading = true
|
|
|
+
|
|
|
+ totalMoney().then((res) => {
|
|
|
+ // console.log(res);
|
|
|
+ if (typeof res.code == 'undefined' || res.code == '') {
|
|
|
+ this.$message.error('返回数据格式问题,code未获取到!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.showTotalMoney.time = res.time
|
|
|
+ this.showTotalMoney.amount = res.zongYu.tong
|
|
|
+ } else {
|
|
|
+ this.$message.error('获取总金额返回的数据异常!')
|
|
|
+ }
|
|
|
+ }).catch((err) => {
|
|
|
+ // console.log(err);
|
|
|
+ this.$message.error(err.message)
|
|
|
+ });
|
|
|
+
|
|
|
+ this.showTotalMoney.loading = false
|
|
|
+ },
|
|
|
+ /**
|
|
|
* 初始化折线图
|
|
|
*/
|
|
|
initCharts() {
|
|
|
// 基于准备好的dom,初始化echarts实例
|
|
|
var myChart = echarts.init(document.getElementById('main-echart'));
|
|
|
// 绘制图表
|
|
|
- this.setOption(myChart)
|
|
|
- },
|
|
|
- /**
|
|
|
- * 向折线图赋值,开始展示数据
|
|
|
- * @param {Object} myChart
|
|
|
- */
|
|
|
- setOption(myChart) {
|
|
|
- myChart.setOption(this.option);
|
|
|
+ myChart.setOption(this.option, true);
|
|
|
},
|
|
|
// 表格某些列样式改变
|
|
|
handle_cell_style({
|
|
|
@@ -536,7 +612,7 @@
|
|
|
right: 20px;
|
|
|
top: 68px;
|
|
|
width: 100px;
|
|
|
- z-index: 9999;
|
|
|
+ z-index: 1;
|
|
|
}
|
|
|
|
|
|
.line-echart {
|