|
|
@@ -78,13 +78,13 @@
|
|
|
cHeight: '400',
|
|
|
pixelRatio: 1,
|
|
|
canvastishiTF: false,
|
|
|
- pagesum: 1,
|
|
|
- worms:[]
|
|
|
+ pagesum: null,
|
|
|
+ worms: []
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
async history() { //历史数据列表折线图
|
|
|
- this.Chistory()
|
|
|
+ // this.Chistory()
|
|
|
const res = await this.$myRequest({
|
|
|
url: '/api/api_gateway?method=sex_lure_nl.sex_lure.nl_device_line_chart',
|
|
|
data: {
|
|
|
@@ -100,30 +100,22 @@
|
|
|
this.canvastishiTF = false
|
|
|
} else {
|
|
|
this.canvastishiTF = true
|
|
|
- var arr1 = []
|
|
|
- var arr2 = []
|
|
|
+ // var arr1 = []
|
|
|
+ // var arr2 = []
|
|
|
var arr3 = []
|
|
|
var xtitle = []
|
|
|
for (var i = 0; i < res.length; i++) {
|
|
|
var times = new Date(res[i].xy_addtime)
|
|
|
xtitle.unshift(times.getMonth() + 1 + "/" + times.getDate() + "-" + times.getHours() + ":" + times.getMinutes())
|
|
|
- arr1.unshift(res[i].ah == "" ? "0" : res[i].ah)
|
|
|
- arr2.unshift(res[i].at == "" ? "0" : res[i].at)
|
|
|
+ // arr1.unshift(res[i].ah == "" ? "0" : res[i].ah)
|
|
|
+ // arr2.unshift(res[i].at == "" ? "0" : res[i].at)
|
|
|
}
|
|
|
- for(var j = 0; j < this.worms.length; j++){
|
|
|
+ for (var j = 0; j < this.worms.length; j++) {
|
|
|
var times = new Date(res[i].xy_addtime)
|
|
|
arr3.unshift(res[i].pest_num == "" ? "0" : res[i].pest_num)
|
|
|
}
|
|
|
- this.$nextTick(()=>{
|
|
|
+ this.$nextTick(() => {
|
|
|
var obj = [{
|
|
|
- name: '温度',
|
|
|
- data: arr1,
|
|
|
- color: '#00E29D'
|
|
|
- }, {
|
|
|
- name: '湿度',
|
|
|
- data: arr2,
|
|
|
- color: '#6CBBFF'
|
|
|
- },{
|
|
|
name: '诱虫次数',
|
|
|
data: arr3,
|
|
|
color: '#ff0000'
|
|
|
@@ -143,13 +135,40 @@
|
|
|
}
|
|
|
})
|
|
|
this.worms = res
|
|
|
+ console.log(this.worms)
|
|
|
+ if (this.worms.data.length == 0) {
|
|
|
+ this.canvastishiTF = false
|
|
|
+ } else {
|
|
|
+ this.canvastishiTF = true
|
|
|
+ var arr3 = []
|
|
|
+ var xtitle = []
|
|
|
+ for (var i = 0; i < res.data.length; i++) {
|
|
|
+ // var times = new Date(res[i].xy_addtime)
|
|
|
+ // xtitle.unshift(times.getMonth() + 1 + "/" + times.getDate() + "-" + times.getHours() + ":" + times.getMinutes())
|
|
|
+ xtitle.unshift(res.data[i].xy_addtime)
|
|
|
+ // arr1.unshift(res[i].ah == "" ? "0" : res[i].ah)
|
|
|
+ // arr2.unshift(res[i].at == "" ? "0" : res[i].at)
|
|
|
+ }
|
|
|
+ for (var j = 0; j < this.worms.data.length; j++) {
|
|
|
+ // var times = new Date(res[i].xy_addtime)
|
|
|
+ arr3.unshift(this.worms.data[j].pest_num == "" ? "0" : this.worms.data[j].pest_num)
|
|
|
+ }
|
|
|
+ console.log(arr3)
|
|
|
+ this.$nextTick(() => {
|
|
|
+ var obj = [{
|
|
|
+ name: '诱虫次数',
|
|
|
+ data: arr3,
|
|
|
+ color: '#ff0000'
|
|
|
+ }]
|
|
|
+ this.showColumn("canvasColumnA", xtitle, obj)
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
//forecast.worm_lamp.device_history_data历史数据列表
|
|
|
async historylist() { //历史数据列表
|
|
|
const res = await this.$myRequest({
|
|
|
url: '/api/api_gateway?method=sex_lure_nl.sex_lure.nl_device_history',
|
|
|
data: {
|
|
|
- device_type_id: 3,
|
|
|
device_id: this.device_id,
|
|
|
strat_time: parseInt(this.start_time / 1000),
|
|
|
end_time: parseInt(this.end_time / 1000),
|
|
|
@@ -174,7 +193,7 @@
|
|
|
d_id: this.d_id
|
|
|
}
|
|
|
})
|
|
|
- if(res){
|
|
|
+ if (res) {
|
|
|
uni.showToast({
|
|
|
title: '刷新成功',
|
|
|
duration: 2000,
|
|
|
@@ -183,7 +202,7 @@
|
|
|
uni.navigateBack({
|
|
|
delta: 1
|
|
|
})
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
uni.showToast({
|
|
|
title: '刷新失败',
|
|
|
duration: 2000,
|
|
|
@@ -200,22 +219,26 @@
|
|
|
this.$forceUpdate()
|
|
|
if (index == 0) {
|
|
|
this.start_time = this.end_time - 24 * 60 * 60 * 1000
|
|
|
- this.history()
|
|
|
+ // this.history()
|
|
|
+ this.Chistory()
|
|
|
this.historylist()
|
|
|
} else if (index == 1) {
|
|
|
var oldtime = now.setMonth(now.getMonth() - 1)
|
|
|
this.start_time = parseInt(oldtime)
|
|
|
- this.history()
|
|
|
+ // this.history()
|
|
|
+ this.Chistory()
|
|
|
this.historylist()
|
|
|
} else if (index == 2) {
|
|
|
var oldtime = now.setMonth(now.getMonth() - 6)
|
|
|
this.start_time = parseInt(oldtime)
|
|
|
- this.history()
|
|
|
+ // this.history()
|
|
|
+ this.Chistory()
|
|
|
this.historylist()
|
|
|
} else if (index == 3) {
|
|
|
var oldtime = now.setFullYear(now.getFullYear() - 1)
|
|
|
this.start_time = parseInt(oldtime)
|
|
|
- this.history()
|
|
|
+ // this.history()
|
|
|
+ this.Chistory()
|
|
|
this.historylist()
|
|
|
}
|
|
|
},
|
|
|
@@ -260,7 +283,15 @@
|
|
|
scrollBackgroundColor: '#F7F7FF', //默认为 #EFEBEF
|
|
|
scrollColor: '#DEE7F7', //默认为 #A6A6A6
|
|
|
},
|
|
|
- yAxis: {},
|
|
|
+ yAxis: {
|
|
|
+ gridType: 'dash',
|
|
|
+ gridColor: '#CCCCCC',
|
|
|
+ dashLength: 8,
|
|
|
+ splitNumber: 5,
|
|
|
+ format: (val) => {
|
|
|
+ return val.toFixed(1)
|
|
|
+ }
|
|
|
+ },
|
|
|
width: _self.cWidth * 1,
|
|
|
height: _self.cHeight * 1,
|
|
|
extra: {
|
|
|
@@ -294,13 +325,13 @@
|
|
|
this.cWidth = uni.upx2px(650);
|
|
|
this.cHeight = uni.upx2px(500);
|
|
|
},
|
|
|
- onShow(){
|
|
|
- this.end_time = +new Date() + 1000
|
|
|
+ onShow() {
|
|
|
+ this.end_time = +new Date() + 1000
|
|
|
this.start_time = this.end_time - 24 * 60 * 60 * 1000
|
|
|
- setTimeout(()=>{
|
|
|
- this.history()
|
|
|
- this.historylist()
|
|
|
- },1000)
|
|
|
+ console.log(new Date(this.end_time), new Date(this.start_time))
|
|
|
+ // this.history()
|
|
|
+ this.Chistory()
|
|
|
+ this.historylist()
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
@@ -315,7 +346,6 @@
|
|
|
box-shadow: 0 0 10rpx #bcb9ca;
|
|
|
padding-top: 20rpx;
|
|
|
height: 550rpx;
|
|
|
-
|
|
|
.canvastishi {
|
|
|
font-size: 32rpx;
|
|
|
position: absolute;
|
|
|
@@ -377,9 +407,11 @@
|
|
|
.scroll-X {
|
|
|
width: 95%;
|
|
|
margin: 20rpx auto;
|
|
|
- .table{
|
|
|
+
|
|
|
+ .table {
|
|
|
width: 1042px;
|
|
|
}
|
|
|
+
|
|
|
.tr {
|
|
|
display: flex;
|
|
|
overflow: hidden;
|
|
|
@@ -426,4 +458,3 @@
|
|
|
}
|
|
|
}
|
|
|
</style>
|
|
|
-
|