Pārlūkot izejas kodu

吸虫塔虫情分析

zhangsijie 2 gadi atpakaļ
vecāks
revīzija
8c5194d1a5
1 mainītis faili ar 266 papildinājumiem un 28 dzēšanām
  1. 266 28
      pages/cb/xctdetail/analyse.vue

+ 266 - 28
pages/cb/xctdetail/analyse.vue

@@ -41,18 +41,20 @@
 			</view>
 			<view class="selecttimes" @click="tiemshow=!tiemshow">
 				<view class="" style="line-height: 28px;">
-					时间选择器
+					日期
 				</view>
 				<view class="timesbox">
 					<!-- <image
-						:src="'http://www.hnyfwlw.com:8006/bigdata_app'+'/image/prevention/1acfe2751c01d3786cdc49b83d7e505.png'"
-						mode=""></image> -->
-					<p>{{timetab(oldtime)}}</p>
+					:src="'http://www.hnyfwlw.com:8006/bigdata_app'+'/image/prevention/1acfe2751c01d3786cdc49b83d7e505.png'"
+					mode=""></image> -->
+					<p>{{oldtime}}</p>
 					<p class="or">至</p>
-					<p>{{timetab(newtime)}}</p>
+					<p>{{newtime}}</p>
 					<!-- <u-icon name="rili" custom-prefix="custom-icon" class="icon"></u-icon> -->
 				</view>
 				<u-calendar v-model="tiemshow" mode="range" @change="tiemchange"></u-calendar>
+				<u-button type="primary" text="归档时间" size="mini" @click="timeshow = true">归档时间</u-button>
+				<u-select v-model="timeshow" mode="mutil-column" :list="list" @confirm="Hourchange" :default-value="defaultValue"></u-select>
 			</view>
 			<view class="tendency">
 				<canvas canvas-id="canvasColumnA" id="canvasColumnA" class="charts" @touchstart="touchLineA($event)"
@@ -141,6 +143,206 @@
 				d_id: "",
 				oldtime: "",
 				newtime: "",
+				sp_hour_st: '00:00', // 归档开始时间
+				sp_hour_ed: '00:00', // 归档结束时间
+				timeshow: false, // 归档时间设置弹框
+				defaultValue:[0,0],
+				list: [
+					[{
+							value: '00:00',
+							label: '00时'
+						},
+						{
+							value: '01:00',
+							label: '01时'
+						},
+						{
+							value: '02:00',
+							label: '02时'
+						},
+						{
+							value: '03:00',
+							label: '03时'
+						},
+						{
+							value: '04:00',
+							label: '04时'
+						},
+						{
+							value: '05:00',
+							label: '05时'
+						},
+						{
+							value: '06:00',
+							label: '06时'
+						},
+						{
+							value: '07:00',
+							label: '07时'
+						},
+						{
+							value: '08:00',
+							label: '08时'
+						},
+						{
+							value: '09:00',
+							label: '09时'
+						},
+						{
+							value: '10:00',
+							label: '10时'
+						},
+						{
+							value: '11:00',
+							label: '11时'
+						},
+						{
+							value: '12:00',
+							label: '12时'
+						},
+						{
+							value: '13:00',
+							label: '13时'
+						},
+						{
+							value: '14:00',
+							label: '14时'
+						},
+						{
+							value: '15:00',
+							label: '15时'
+						},
+						{
+							value: '16:00',
+							label: '16时'
+						},
+						{
+							value: '17:00',
+							label: '17时'
+						},
+						{
+							value: '18:00',
+							label: '18时'
+						},
+						{
+							value: '19:00',
+							label: '19时'
+						},
+						{
+							value: '20:00',
+							label: '20时'
+						},
+						{
+							value: '21:00',
+							label: '21时'
+						},
+						{
+							value: '22:00',
+							label: '22时'
+						},
+						{
+							value: '23:00',
+							label: '23时'
+						},
+					],
+					[{
+							value: '00:00',
+							label: '00时'
+						},
+						{
+							value: '01:00',
+							label: '01时'
+						},
+						{
+							value: '02:00',
+							label: '02时'
+						},
+						{
+							value: '03:00',
+							label: '03时'
+						},
+						{
+							value: '04:00',
+							label: '04时'
+						},
+						{
+							value: '05:00',
+							label: '05时'
+						},
+						{
+							value: '06:00',
+							label: '06时'
+						},
+						{
+							value: '07:00',
+							label: '07时'
+						},
+						{
+							value: '08:00',
+							label: '08时'
+						},
+						{
+							value: '09:00',
+							label: '09时'
+						},
+						{
+							value: '10:00',
+							label: '10时'
+						},
+						{
+							value: '11:00',
+							label: '11时'
+						},
+						{
+							value: '12:00',
+							label: '12时'
+						},
+						{
+							value: '13:00',
+							label: '13时'
+						},
+						{
+							value: '14:00',
+							label: '14时'
+						},
+						{
+							value: '15:00',
+							label: '15时'
+						},
+						{
+							value: '16:00',
+							label: '16时'
+						},
+						{
+							value: '17:00',
+							label: '17时'
+						},
+						{
+							value: '18:00',
+							label: '18时'
+						},
+						{
+							value: '19:00',
+							label: '19时'
+						},
+						{
+							value: '20:00',
+							label: '20时'
+						},
+						{
+							value: '21:00',
+							label: '21时'
+						},
+						{
+							value: '22:00',
+							label: '22时'
+						},
+						{
+							value: '23:00',
+							label: '23时'
+						},
+					],
+				],
 				tiemshow: false,
 				cWidth: '350',
 				cHeight: '350',
@@ -238,6 +440,8 @@
 						identify_model: 'A',
 						start_time: this.oldtime,
 						end_time: this.newtime,
+						sp_hour_st: this.sp_hour_st,
+						sp_hour_ed: this.sp_hour_ed,
 						device_type: 'xct'
 					}
 				})
@@ -287,13 +491,40 @@
 				if (res.at_ah_info.length != 0) {
 					var aharr = []
 					var atarr = []
+					var pestArr = []
+					let indentText = 0;
 					for (var i = 0; i < res.at_ah_info.length; i++) {
 						var times = new Date(res.at_ah_info[i].addtime * 1000)
-						xtitle.push(times.getMonth() + 1 + "/" + times.getDate() + "-" + times.getHours() + ":" +
-							times.getSeconds())
+						xtitle.push(times.getMonth() + 1 + "/" + times.getDate())
 						atarr.push(res.at_ah_info[i].at == "" ? "0" : res.at_ah_info[i].at)
 						aharr.push(res.at_ah_info[i].ah == "" ? "0" : res.at_ah_info[i].ah)
+						if (this.checkObj(res.char_data) && res.char_data[this.wormvalue]) {
+							if (res.char_data[this.wormvalue][i - indentText] && (res.char_data[this.wormvalue][i -
+									indentText
+								].addtime == res.at_ah_info[i].addtime)) {
+								pestArr.push(res.char_data[this.wormvalue][i - indentText].sum)
+							} else {
+								indentText++
+								pestArr.push(null)
+							}
+						}
 					}
+					// console.log(this.wormvalue)
+					// if (this.checkObj(res.char_data)) {
+					// 	for (var key in res.char_data) {
+					// 		if (this.wormvalue == key) {
+					// 			var wormobj = {
+					// 				name: key,
+					// 				data: [],
+					// 			}
+					// 			for (var i = 0; i < res.char_data[key].length; i++) {
+					// 				wormobj.data.push(res.char_data[key][i].ah == "" ? "0" : res.char_data[key][i].sum)
+					// 			}
+					// 			obj.push(wormobj)
+					// 		}
+					// 	}
+				
+					// }
 					var atobj = {
 						name: '温度',
 						data: atarr,
@@ -304,24 +535,13 @@
 						data: aharr,
 						color: '#6CBBFF'
 					}
+					var pestObj = {
+						name: this.wormvalue,
+						data: pestArr,
+					}
 					obj.push(atobj)
 					obj.push(ahobj)
-				}
-				// console.log(this.wormvalue)
-				if (this.checkObj(res.char_data)) {
-					for (var key in res.char_data) {
-						if (this.wormvalue == key) {
-							var wormobj = {
-								name: key,
-								data: [],
-							}
-							for (var i = 0; i < res.char_data[key].length; i++) {
-								wormobj.data.push(res.char_data[key][i].ah == "" ? "0" : res.char_data[key][i].sum)
-							}
-							obj.push(wormobj)
-						}
-					}
-
+					obj.push(pestObj)
 				}
 				this.showColumn("canvasColumnA", xtitle, obj)
 			},
@@ -333,8 +553,10 @@
 			},
 			tiemchange(e) {
 				console.log(e)
-				this.oldtime = +new Date(e.startDate) / 1000 - 8 * 60 * 60
-				this.newtime = +new Date(e.endDate) / 1000 + 16 * 60 * 60 - 1
+				// this.oldtime = +new Date(e.startDate) / 1000 - 8 * 60 * 60
+				// this.newtime = +new Date(e.endDate) / 1000 + 16 * 60 * 60 - 1
+				this.newtime = e.endDate;
+				this.oldtime = e.startDate;
 				// newtime: "",
 				console.log(this.oldtime, this.newtime)
 				this.page = 1
@@ -345,6 +567,15 @@
 					this.gettabledata2()
 				}
 			}, 
+			Hourchange(e) {
+				this.sp_hour_st = e[0].value;
+				this.sp_hour_ed = e[1].value;
+				// 本地缓存
+				uni.setStorageSync('sp_hour_st', this.sp_hour_st);
+				uni.setStorageSync('sp_hour_ed', this.sp_hour_ed);
+				this.getyear();
+				console.log(e)
+			},
 			timetab(e) {
 				e = new Date(e * 1000)
 				var year = e.getFullYear()
@@ -450,6 +681,8 @@
 						identify_model: 'A',
 						start_time: this.oldtime,
 						end_time: this.newtime,
+						sp_hour_st: this.sp_hour_st,
+						sp_hour_ed: this.sp_hour_ed,
 						page: this.page,
 						device_type: 'xct'
 					}
@@ -471,6 +704,8 @@
 						identify_model: 'A',
 						start_time: this.oldtime,
 						end_time: this.newtime,
+						sp_hour_st: this.sp_hour_st,
+						sp_hour_ed: this.sp_hour_ed,
 						page: this.page
 					}
 				})
@@ -523,9 +758,12 @@
 		},
 		onLoad(option) {
 			this.d_id = option.d_id
-			var date = +new Date() / 1000
-			this.oldtime = Math.floor(date - 24 * 60 * 60)
-			this.newtime = Math.floor(date)
+			var date = +new Date()
+			this.oldtime = this.formatTime(date, 'yyyy-MM-dd');
+			this.newtime = this.formatTime(date, 'yyyy-MM-dd');
+			this.sp_hour_st = uni.getStorageSync('sp_hour_st') == '' ?  '00:00' : uni.getStorageSync('sp_hour_st');
+			this.sp_hour_ed = uni.getStorageSync('sp_hour_ed') == '' ?  '00:00' : uni.getStorageSync('sp_hour_ed');
+			this.defaultValue=[this.sp_hour_st.substring(0, 1) == '0' ? this.sp_hour_st.substring(1, 2): this.sp_hour_st.substring(0, 2), this.sp_hour_ed.substring(0, 1) == '0' ? this.sp_hour_ed.substring(1, 2): this.sp_hour_ed.substring(0, 2)]
 			this.cWidth = uni.upx2px(650);
 			this.cHeight = uni.upx2px(500);
 			this.getyear()