|
@@ -43,17 +43,17 @@
|
|
|
<p class="realtime_title"><span>实时数据</span></p>
|
|
<p class="realtime_title"><span>实时数据</span></p>
|
|
|
<view class="realtime_text">
|
|
<view class="realtime_text">
|
|
|
<view class="realtime_text_item">
|
|
<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]}">
|
|
<view class="item_info_img" :style="{'background-color':olddatas[1]}">
|
|
|
<image
|
|
<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>
|
|
mode=""></image>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="item_info_text">
|
|
<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;">
|
|
<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>
|
|
</p>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
@@ -100,7 +100,7 @@
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- olddata: {},
|
|
|
|
|
|
|
+ olddata: [],
|
|
|
olddatas: ["#fba825", "#53d67c", "#008cf2", "#fb504d", "#d87ffc", "#4ec5f0"],
|
|
olddatas: ["#fba825", "#53d67c", "#008cf2", "#fb504d", "#d87ffc", "#4ec5f0"],
|
|
|
city: "",
|
|
city: "",
|
|
|
kongtf: false,
|
|
kongtf: false,
|
|
@@ -136,43 +136,47 @@
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
this.dataloadingtf = false
|
|
this.dataloadingtf = false
|
|
|
- // this.olddata = res
|
|
|
|
|
- // console.log(res)olddata
|
|
|
|
|
- this.olddata = {}
|
|
|
|
|
|
|
+ this.olddata = []
|
|
|
for (var key in res.conf) {
|
|
for (var key in res.conf) {
|
|
|
if (res.conf[key]) {
|
|
if (res.conf[key]) {
|
|
|
- console.log(res.conf[key])
|
|
|
|
|
if (res.conf[key].indexOf("#") != -1) {
|
|
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 {
|
|
} 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){
|
|
// this.realtimeTF = arr.some(function(item){
|
|
|
// return item!=""
|
|
// return item!=""
|
|
|
// })
|
|
// })
|
|
|
- console.log(this.realtimeTF)
|
|
|
|
|
|
|
+ // console.log(this.realtimeTF)
|
|
|
},
|
|
},
|
|
|
// weather.weather.qxz_data_chart 一天的数据
|
|
// 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({
|
|
const res = await this.$myRequest({
|
|
|
url: '/api/api_gateway?method=weather.weather.qxz_data_chart',
|
|
url: '/api/api_gateway?method=weather.weather.qxz_data_chart',
|
|
|
data: {
|
|
data: {
|
|
|
device_id: this.eqinfo.item.equip_id || this.eqinfo.item.device_id,
|
|
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
|
|
this.onedatas = res.data
|
|
@@ -216,26 +220,37 @@
|
|
|
url: "../afterSale/addafter?device_id=" + device_id + "&device_type=" + 5
|
|
url: "../afterSale/addafter?device_id=" + device_id + "&device_type=" + 5
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
- oneday(key) {
|
|
|
|
|
|
|
+ oneday(key,item) {
|
|
|
|
|
+ // console.log(key)
|
|
|
var obj = {
|
|
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: [],
|
|
data: [],
|
|
|
}
|
|
}
|
|
|
var xtitle = []
|
|
var xtitle = []
|
|
|
var linearr = []
|
|
var linearr = []
|
|
|
var arr = []
|
|
var arr = []
|
|
|
var timearr = []
|
|
var timearr = []
|
|
|
|
|
+ // console.log(key)
|
|
|
|
|
+ // console.log(this.olddata)
|
|
|
|
|
+ // console.log(this.onedatas)
|
|
|
|
|
+ // return
|
|
|
for (var i = 0; i < this.onedatas.length; i++) {
|
|
for (var i = 0; i < this.onedatas.length; i++) {
|
|
|
var times = new Date(this.onedatas[i].time * 1000)
|
|
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)
|
|
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) {
|
|
arr.sort(function(a, b) {
|
|
|
return a - b
|
|
return a - b
|
|
|
})
|
|
})
|
|
|
|
|
+ // console.log(arr)
|
|
|
this.onedatasMin = arr[0]
|
|
this.onedatasMin = arr[0]
|
|
|
this.onedatasMax = arr[arr.length - 1]
|
|
this.onedatasMax = arr[arr.length - 1]
|
|
|
for (var i = 0; i < obj.data.length; i++) {
|
|
for (var i = 0; i < obj.data.length; i++) {
|
|
@@ -246,14 +261,18 @@
|
|
|
this.onedatasMintime = timearr[i]
|
|
this.onedatasMintime = timearr[i]
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ console.log(obj)
|
|
|
linearr.push(obj)
|
|
linearr.push(obj)
|
|
|
if (obj.data.length == 0) {
|
|
if (obj.data.length == 0) {
|
|
|
this.tishiTF = true
|
|
this.tishiTF = true
|
|
|
} else {
|
|
} else {
|
|
|
this.tishiTF = false
|
|
this.tishiTF = false
|
|
|
}
|
|
}
|
|
|
- this.show = true
|
|
|
|
|
|
|
+ console.log(xtitle)
|
|
|
|
|
+ // console.log(linearr)
|
|
|
|
|
+ // return
|
|
|
this.showColumn("canvasColumnA", xtitle, linearr)
|
|
this.showColumn("canvasColumnA", xtitle, linearr)
|
|
|
|
|
+ this.show = true
|
|
|
},
|
|
},
|
|
|
showColumn(id, xtitle, xinfo) {
|
|
showColumn(id, xtitle, xinfo) {
|
|
|
var _self = this
|
|
var _self = this
|