Преглед на файлове

孢子仪不应该展示查看图片中的识别

yf_ldf преди 2 години
родител
ревизия
889cf04deb
променени са 3 файла, в които са добавени 55 реда и са изтрити 36 реда
  1. 1 1
      pages/cb/cbd/equip-set/imgpage.vue
  2. 53 34
      pages/environment/equipment.vue
  3. 1 1
      pages/environment/history.vue

+ 1 - 1
pages/cb/cbd/equip-set/imgpage.vue

@@ -33,7 +33,7 @@
 						<view class="icon_box" @click="delimg(item.id)">
 							<p class="iconfont icon-shanchu">删除</p>
 						</view>
-						<view class="icon_box" @click="shibie(item.id,item.addr)" v-if="myuid == '4' || (disable==1 && device_type!=7)">
+						<view class="icon_box" @click="shibie(item.id,item.addr)" v-if="device_type!=7">
 							<p class="iconfont icon-shibie">识别</p>
 						</view>
 						<view class="icon_box" v-else-if="disable==2 && device_type!=7">

+ 53 - 34
pages/environment/equipment.vue

@@ -43,17 +43,17 @@
 				<p class="realtime_title"><span>实时数据</span></p>
 				<view class="realtime_text">
 					<view class="realtime_text_item">
-						<view class="realtime_text_item_info" v-for="(item,key) in olddata" :key="key"
-							@click="oneday(key)">
+						<view class="realtime_text_item_info" v-for="(item,index) in olddata" :key="index"
+							@click="oneday(index,item)">
 							<view class="item_info_img" :style="{'background-color':olddatas[1]}">
 								<image
-									:src="'http://www.hnyfwlw.com:8006/bigdata_app'+'/image/environment/icon_'+item[1]+'.png'"
+									:src="'http://www.hnyfwlw.com:8006/bigdata_app'+'/image/environment/icon_'+item.value[1]+'.png'"
 									mode=""></image>
 							</view>
 							<view class="item_info_text">
-								<p>{{key=="PM255(ug/m3)"?"PM2.5(ug/m3)":key}}</p>
+								<p>{{item.lable=="PM255(ug/m3)"?"PM2.5(ug/m3)":item.lable}}</p>
 								<p style="margin-top: 20rpx;">
-									{{parseFloat(item[0]) == -99.99 ?'N/A':parseFloat(item[0])}}
+									{{parseFloat(item.value[0]) == -99.99 ?'N/A':parseFloat(item.value[0])}}
 								</p>
 							</view>
 						</view>
@@ -100,7 +100,7 @@
 
 					}
 				},
-				olddata: {},
+				olddata: [],
 				olddatas: ["#fba825", "#53d67c", "#008cf2", "#fb504d", "#d87ffc", "#4ec5f0"],
 				city: "",
 				kongtf: false,
@@ -136,43 +136,47 @@
 					}
 				})
 				this.dataloadingtf = false
-				// this.olddata = res
-				// console.log(res)olddata
-				this.olddata = {}
+				this.olddata = []
 				for (var key in res.conf) {
 					if (res.conf[key]) {
-						console.log(res.conf[key])
 						if (res.conf[key].indexOf("#") != -1) {
-							if(res.conf[key].indexOf(".")!=-1){
-								res.conf[key] = res.conf[key].replace(".", "5")
-							}
-							var str = res.conf[key].replace("#", "(") + ")"
-							this.olddata[str] = res.dat[key].split("#")
+							// let lable = res.conf[key].replace("#", "(") + ")"
+							console.log(res.conf[key])
+							this.olddata.push({
+								lable:res.conf[key].replace("#", "(") + ")",
+								value:res.dat[key].split('#')
+							})
+							// this.olddata[res.conf[key].replace("#", "(") + ")"] = res.dat[key].split("#")
 						} else {
-							this.olddata[res.conf[key]] = res.dat[key].split("#")
+							// this.olddata[res.conf[key]] = res.dat[key].split("#")
 						}
 					}
 				}
-				console.log(this.olddata)
-				this.realtimeTF = true
-				for (var key in this.olddata) {
-					this.realtimeTF = false
-				}
+				// console.clear()
+				// console.log(this.olddata)
+				// this.realtimeTF = true
+				// for (var key in this.olddata) {
+				// 	this.realtimeTF = false
+				// }
+				this.realtimeTF = false
 				// this.realtimeTF = arr.some(function(item){
 				// 	return item!=""
 				// })
-				console.log(this.realtimeTF)
+				// console.log(this.realtimeTF)
 			},
 			// weather.weather.qxz_data_chart 一天的数据
-			async onehistory() {
-				var newtime = +new Date() / 1000
-				var oldtime = newtime - 24 * 60 * 60
+			async onehistory() { //设备列表
+				
+				var date = new Date()
+				var newtime = +date / 1000
+				// var oldtime = newtime - 24 * 60 * 60
+				var oldtime = Number(new Date(date.toLocaleDateString()).getTime()) / 1000;
 				const res = await this.$myRequest({
 					url: '/api/api_gateway?method=weather.weather.qxz_data_chart',
 					data: {
 						device_id: this.eqinfo.item.equip_id || this.eqinfo.item.device_id,
-						begin: parseInt(oldtime),
-						end: parseInt(newtime)
+						begin: parseInt(oldtime - 24 * 60 * 60),
+						end: parseInt(newtime - 24 * 60 * 60)
 					}
 				})
 				this.onedatas = res.data
@@ -216,26 +220,37 @@
 					url: "../afterSale/addafter?device_id=" + device_id + "&device_type=" + 5
 				})
 			},
-			oneday(key) {
+			oneday(key,item) {
+				// console.log(key)
 				var obj = {
-					name: key=="PM255(ug/m3)"?"PM2.5(ug/m3)":key,
+					name: item.lable=="PM255(ug/m3)"?"PM2.5(ug/m3)":item.lable,
 					data: [],
 				}
 				var xtitle = []
 				var linearr = []
 				var arr = []
 				var timearr = []
+				// console.log(key)
+				// console.log(this.olddata)
+				// console.log(this.onedatas)
+				// return
 				for (var i = 0; i < this.onedatas.length; i++) {
 					var times = new Date(this.onedatas[i].time * 1000)
-					arr.unshift(Number(this.onedatas[i].dat[this.olddata[key][2]].split("#")[0]))
-					xtitle.unshift(times.getMonth() + 1 + "/" + times.getDate() + "-" + times.getHours() + ":" + times
-						.getMinutes())
+					// console.log(this.onedatas[i].dat[this.olddata[key].value[2]].split("#")[0])
+					arr.unshift(Number(this.onedatas[i].dat[this.olddata[key].value[2]].split("#")[0]))
+					if(times.getMinutes().toString().length>=2){
+						xtitle.unshift(times.getMonth() + 1 + "/" + times.getDate() + "-" + times.getHours() + ":" + times.getMinutes())
+					} else{
+						xtitle.unshift(times.getMonth() + 1 + "/" + times.getDate() + "-" + times.getHours() + ":0" + times.getMinutes())
+					}
+					
 					timearr.unshift(+new Date(times) / 1000)
-					obj.data.unshift(Number(this.onedatas[i].dat[this.olddata[key][2]].split("#")[0]))
+					obj.data.unshift(Number(this.onedatas[i].dat[this.olddata[key].value[2]].split("#")[0]))
 				}
 				arr.sort(function(a, b) {
 					return a - b
 				})
+				// console.log(arr)
 				this.onedatasMin = arr[0]
 				this.onedatasMax = arr[arr.length - 1]
 				for (var i = 0; i < obj.data.length; i++) {
@@ -246,14 +261,18 @@
 						this.onedatasMintime = timearr[i]
 					}
 				}
+				console.log(obj)
 				linearr.push(obj)
 				if (obj.data.length == 0) {
 					this.tishiTF = true
 				} else {
 					this.tishiTF = false
 				}
-				this.show = true
+				console.log(xtitle)
+				// console.log(linearr)
+				// return
 				this.showColumn("canvasColumnA", xtitle, linearr)
+				this.show = true
 			},
 			showColumn(id, xtitle, xinfo) {
 				var _self = this

+ 1 - 1
pages/environment/history.vue

@@ -156,7 +156,7 @@
 				} else {
 					this.canvastishiTF = true
 					for (var key in res.conf) {
-						if (res.conf[key] != "") {
+						if (res.conf[key]) {
 							this.titletext.push(res.conf[key])
 						}
 					}