|
|
@@ -12,8 +12,10 @@
|
|
|
tooltipFormat="tooltipDemo1" />
|
|
|
</view>
|
|
|
<view class="select-show">
|
|
|
- <button class="first-button" @tap="getEnergyConsumption('day')">日</button>
|
|
|
- <button class="first-button" @tap="getEnergyConsumption('month')">月</button>
|
|
|
+ <button :class="[btn ? 'first-button-bg' : 'first-button']"
|
|
|
+ @tap="getEnergyConsumption('day')">日</button>
|
|
|
+ <button :class="[btn ? 'first-button' : 'first-button-bg']"
|
|
|
+ @tap="getEnergyConsumption('month')">月</button>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="show-item-date">
|
|
|
@@ -49,6 +51,7 @@
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
+ btn: false,
|
|
|
chartData: {
|
|
|
categories: [],
|
|
|
series: [{
|
|
|
@@ -159,6 +162,8 @@
|
|
|
this.changeDate = false
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+ this.list = []
|
|
|
}
|
|
|
} else {
|
|
|
// 充值绑定显示到界面
|
|
|
@@ -178,21 +183,61 @@
|
|
|
*/
|
|
|
async get_nenghaojilu(dayOrMonth) {
|
|
|
// console.log(this.roomSelect);
|
|
|
- if (this.roomSelect != '' && typeof(this.roomSelect) != 'undefined') {
|
|
|
+ var reg = /[\u4e00-\u9fa5]/g;
|
|
|
+ var str = this.roomSelect;
|
|
|
+ var dom = str.replace(reg, "");
|
|
|
+ if (dom != '' && typeof(dom) != 'undefined') {
|
|
|
let res = null;
|
|
|
if (dayOrMonth == 'day') {
|
|
|
+ this.btn = true
|
|
|
res = await this.$myRequest({
|
|
|
host: this.ceshi,
|
|
|
- url: '/HotWaters/buildgetDayBill.action',
|
|
|
+ url: '/HotWaters/elqueryDayPower.action',
|
|
|
method: 'POST',
|
|
|
header: {
|
|
|
'content-type': 'application/x-www-form-urlencoded'
|
|
|
},
|
|
|
data: {
|
|
|
- 'roomSelect': this.roomSelect
|
|
|
+ 'dom': dom
|
|
|
}
|
|
|
})
|
|
|
+
|
|
|
+ // console.log(res.data.data);
|
|
|
+ if (res.data.code != 200) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ let chrt_data = {
|
|
|
+ categories: [],
|
|
|
+ series: [{
|
|
|
+ data: [],
|
|
|
+ }],
|
|
|
+ }
|
|
|
+ let elc_max = -1.0
|
|
|
+ let dt = ''
|
|
|
+ for (var i = 0; i < res.data.data.length; i++) {
|
|
|
+ dt = res.data.data[i].dataTime
|
|
|
+ chrt_data.categories.push(dt.substr(dt.indexOf('-') + 1, dt.length))
|
|
|
+ chrt_data.series[0].data.push(res.data.data[i].use_elc)
|
|
|
+ if (parseFloat(res.data.data[i].use_elc) > parseFloat(elc_max)) {
|
|
|
+ elc_max = res.data.data[i].use_elc
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let m = parseFloat(Math.abs(elc_max))
|
|
|
+ // console.log(chrt_data);
|
|
|
+ if (elc_max == 0.0) {
|
|
|
+ setTimeout(() => {
|
|
|
+ this.chartOpts.yAxis.data[0].max = parseInt(10)
|
|
|
+ this.chartData = chrt_data;
|
|
|
+ }, 1000);
|
|
|
+ } else {
|
|
|
+ setTimeout(() => {
|
|
|
+ this.chartOpts.yAxis.data[0].max = parseInt(m + 5)
|
|
|
+ this.chartData = chrt_data;
|
|
|
+ }, 1000);
|
|
|
+ }
|
|
|
} else {
|
|
|
+ this.btn = false
|
|
|
res = await this.$myRequest({
|
|
|
host: this.ceshi,
|
|
|
url: '/HotWaters/buildgetMonthBill.action',
|
|
|
@@ -204,32 +249,32 @@
|
|
|
'roomSelect': this.roomSelect
|
|
|
}
|
|
|
})
|
|
|
- }
|
|
|
|
|
|
- // console.log(res);
|
|
|
- if (res.data.mess == '未查询到数据') {
|
|
|
- return
|
|
|
- }
|
|
|
- let chrt_data = {
|
|
|
- categories: [],
|
|
|
- series: [{
|
|
|
- data: [],
|
|
|
- }],
|
|
|
- }
|
|
|
- let elc_max = 0.0
|
|
|
- for (var i = 0; i < res.data.date_time.length; i++) {
|
|
|
- chrt_data.categories.push(res.data.date_time[i])
|
|
|
- chrt_data.series[0].data.push(res.data.use_elc[i])
|
|
|
- if (parseFloat(res.data.use_elc[i]) > parseFloat(elc_max)) {
|
|
|
- elc_max = res.data.use_elc[i]
|
|
|
+ // console.log(res);
|
|
|
+ if (res.data.mess == '未查询到数据') {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let chrt_data = {
|
|
|
+ categories: [],
|
|
|
+ series: [{
|
|
|
+ data: [],
|
|
|
+ }],
|
|
|
+ }
|
|
|
+ let elc_max = 0.0
|
|
|
+ for (var i = 0; i < res.data.date_time.length; i++) {
|
|
|
+ chrt_data.categories.push(res.data.date_time[i])
|
|
|
+ chrt_data.series[0].data.push(res.data.use_elc[i])
|
|
|
+ if (parseFloat(res.data.use_elc[i]) > parseFloat(elc_max)) {
|
|
|
+ elc_max = res.data.use_elc[i]
|
|
|
+ }
|
|
|
}
|
|
|
+ let m = parseFloat(Math.abs(elc_max))
|
|
|
+ // console.log(chrt_data);
|
|
|
+ setTimeout(() => {
|
|
|
+ this.chartOpts.yAxis.data[0].max = parseInt(m + (m / 4.0))
|
|
|
+ this.chartData = chrt_data;
|
|
|
+ }, 1000);
|
|
|
}
|
|
|
- let m = parseFloat(Math.abs(elc_max))
|
|
|
- // console.log(chrt_data);
|
|
|
- setTimeout(() => {
|
|
|
- this.chartOpts.yAxis.data[0].max = parseInt(m + (m / 4.0))
|
|
|
- this.chartData = chrt_data;
|
|
|
- }, 1000);
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
title: '宿舍号为空',
|