|
|
@ -24,6 +24,7 @@ export default { |
|
|
|
height: '', |
|
|
|
timer: null, |
|
|
|
dateTiem: [], |
|
|
|
dateTiem1: [], |
|
|
|
weightDate: [], |
|
|
|
weight1: [], |
|
|
|
weight2: [], |
|
|
@ -82,7 +83,7 @@ export default { |
|
|
|
}, |
|
|
|
xAxis: { |
|
|
|
type: 'category', |
|
|
|
data: this.dateTiem, |
|
|
|
data: this.dateTiem1, |
|
|
|
}, |
|
|
|
yAxis: { |
|
|
|
type: 'value', |
|
|
@ -148,17 +149,24 @@ export default { |
|
|
|
// 处理数组 |
|
|
|
forList(list) { |
|
|
|
this.dateTiem = []; |
|
|
|
this.dateTiem1 = []; |
|
|
|
this.weightDate = []; |
|
|
|
this.weight1 = []; |
|
|
|
this.weight2 = []; |
|
|
|
// 获取横坐标 |
|
|
|
for (let i = 0; i < list.length; i++) { |
|
|
|
this.dateTiem.push(this.format(parseInt(list[i].time))); |
|
|
|
this.weight2.push(0); |
|
|
|
if (list[i].type === 1) { |
|
|
|
this.dateTiem.push(this.format(parseInt(list[i].time))); |
|
|
|
} else { |
|
|
|
this.dateTiem1.push(this.format(parseInt(list[i].time))); |
|
|
|
this.weight2.push(0); |
|
|
|
} |
|
|
|
} |
|
|
|
// 体重数据数组 |
|
|
|
for (let i = 0; i < list.length; i++) { |
|
|
|
this.weightDate.push(parseInt(list[i].value) / 1000); |
|
|
|
if (list[i].type === 1) { |
|
|
|
this.weightDate.push(parseInt(list[i].value) / 1000); |
|
|
|
} |
|
|
|
} |
|
|
|
// 处理rfid横线 |
|
|
|
for (let i = 0; i < list.length; i++) { |
|
|
@ -172,10 +180,14 @@ export default { |
|
|
|
this.weight1.push(obj); |
|
|
|
} |
|
|
|
} |
|
|
|
console.log(this.weight1); |
|
|
|
}, |
|
|
|
add0(m) { |
|
|
|
return m < 10 ? '0' + m : m; |
|
|
|
}, |
|
|
|
add1(s) { |
|
|
|
return s < 10 ? '0' + s : s; |
|
|
|
}, |
|
|
|
format(shijianchuo) { |
|
|
|
//shijianchuo是整数,否则要parseInt转换 |
|
|
|
var time = new Date(shijianchuo); |
|
|
@ -185,7 +197,7 @@ export default { |
|
|
|
var h = time.getHours(); |
|
|
|
var mm = time.getMinutes(); |
|
|
|
var s = time.getSeconds(); |
|
|
|
return y + '-' + this.add0(m) + '-' + this.add0(d) + ' ' + this.add0(h) + ':' + this.add0(mm); |
|
|
|
return y + '-' + this.add0(m) + '-' + this.add0(d) + ' ' + this.add0(h) + ':' + this.add0(mm) + ':' + this.add1(s); |
|
|
|
}, |
|
|
|
}, |
|
|
|
}; |
|
|
|