Browse Source

【增加】“日”能耗,AD等。
【修改】部分显示不够理想的问题。

程志平 4 years ago
parent
commit
d7329ce163
4 changed files with 85 additions and 34 deletions
  1. 1 1
      pages/jiaofei/ad_dianfei.vue
  2. 1 1
      pages/reshui/ad_reshui.vue
  3. 10 4
      pages/show/show.css
  4. 73 28
      pages/show/show.vue

+ 1 - 1
pages/jiaofei/ad_dianfei.vue

@@ -6,7 +6,7 @@
 	export default {
 		data() {
 			return {
-				url: 'http://www.baidu.com'
+				url: 'https://www.chuanghai-tech.com/'
 			}
 		},
 		methods: {

+ 1 - 1
pages/reshui/ad_reshui.vue

@@ -6,7 +6,7 @@
 	export default {
 		data() {
 			return {
-				url: 'http://www.taobao.com'
+				url: 'https://www.chuanghai-tech.com/'
 			}
 		},
 		methods: {

+ 10 - 4
pages/show/show.css

@@ -8,11 +8,12 @@ page {
 	display: flex;
 	flex-direction: column;
 	color: #333333;
+	height: 100%;
 }
 
 .show-item {
 	margin: 18upx 0;
-	height: 625upx;
+	height: 588upx;
 	background-color: #ffffff;
 }
 
@@ -51,13 +52,13 @@ page {
 
 .select-show {
 	/* padding-bottom: 40upx; */
-	height: 160upx;
+	height: 100upx;
 	display: flex;
 	justify-content: space-around;
 	align-items: center;
 }
 
-.first-button {
+.first-button, .first-button-bg {
 	width: 200upx;
 	height: 80upx;
 	display: flex;
@@ -70,6 +71,11 @@ page {
 	background-color: #FFFFFF;
 }
 
+.first-button-bg {
+	background-color: #1296DB;
+	color: #FFFFFF;
+}
+
 /* .first-button:hover {
 	background-color: #e4faff;
 	color: #1296DB;
@@ -78,7 +84,7 @@ page {
 
 
 .show-item-date {
-	height: 1158upx;
+	/* height: 1158upx; */
 	margin: 2upx 0;
 	background-color: #ffffff;
 }

+ 73 - 28
pages/show/show.vue

@@ -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: '宿舍号为空',