|
@@ -71,29 +71,17 @@ export default {
|
|
|
watch: {
|
|
|
data: {
|
|
|
handler(newValue, oldValue){
|
|
|
- console.log(newValue, oldValue)
|
|
|
+ console.log('预制曲线', newValue, oldValue)
|
|
|
+ this.refreshData(newValue)
|
|
|
},
|
|
|
- immediate: true,
|
|
|
+ // immediate: true,
|
|
|
deep: true
|
|
|
},
|
|
|
'chooseXunhuan.circname': {
|
|
|
handler(newValue, oldValue){
|
|
|
if(newValue){
|
|
|
- console.log(newValue, oldValue)
|
|
|
- var value = newValue.find(item => item.circname === newValue)
|
|
|
- console.log(value)
|
|
|
- if(value){
|
|
|
- this.chooseXunhuan.circname = value.circname
|
|
|
- this.chooseXunhuan.begintime = value.begintime
|
|
|
- this.chooseXunhuan.endtime = value.endtime
|
|
|
- } else {
|
|
|
- this.chooseXunhuan.circname = ''
|
|
|
- this.chooseXunhuan.begintime = ''
|
|
|
- this.chooseXunhuan.endtime = ''
|
|
|
- }
|
|
|
+ this.changeXunhuan(newValue)
|
|
|
}
|
|
|
- console.log(this.chooseXunhuan)
|
|
|
- this.changeData(this.data)
|
|
|
},
|
|
|
// immediate: true,
|
|
|
deep: true
|
|
@@ -254,7 +242,7 @@ export default {
|
|
|
color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [ // 颜色渐变
|
|
|
{
|
|
|
offset: 0,
|
|
|
- color: 'rgba(207, 168, 9, .8)'
|
|
|
+ color: 'rgba(207, 168, 9, .1)'
|
|
|
},
|
|
|
{
|
|
|
offset: 0.5,
|
|
@@ -262,7 +250,7 @@ export default {
|
|
|
},
|
|
|
{
|
|
|
offset: 1,
|
|
|
- color: 'rgba(207, 168, 9, .8)'
|
|
|
+ color: 'rgba(207, 168, 9, .1)'
|
|
|
}
|
|
|
])
|
|
|
}
|
|
@@ -296,7 +284,7 @@ export default {
|
|
|
color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [ // 颜色渐变
|
|
|
{
|
|
|
offset: 0,
|
|
|
- color: 'rgba(73, 228, 233, .8)'
|
|
|
+ color: 'rgba(73, 228, 233, .1)'
|
|
|
},
|
|
|
{
|
|
|
offset: 0.5,
|
|
@@ -304,7 +292,7 @@ export default {
|
|
|
},
|
|
|
{
|
|
|
offset: 1,
|
|
|
- color: 'rgba(73, 228, 233, .8)'
|
|
|
+ color: 'rgba(73, 228, 233, .1)'
|
|
|
}
|
|
|
])
|
|
|
}
|
|
@@ -318,36 +306,86 @@ export default {
|
|
|
this.uEcharts.resize();
|
|
|
});
|
|
|
},
|
|
|
- // 改变获取数据为所需格式
|
|
|
- changeData(data){
|
|
|
+ // 数据刷新时
|
|
|
+ refreshData(data){
|
|
|
console.log('预制曲线数据', data)
|
|
|
+ this.wenduData = []
|
|
|
+ this.shiduData = []
|
|
|
+ this.timeData = []
|
|
|
data.forEach(element => {
|
|
|
- var wenduArr = element.sections.map(item => {
|
|
|
+ var itemWenduArr = element.sections.map(item => {
|
|
|
return item.temperature
|
|
|
})
|
|
|
- var shiduArr = element.sections.map(item => {
|
|
|
+ var itemShiduArr = element.sections.map(item => {
|
|
|
return item.humidity
|
|
|
})
|
|
|
- var timeArr = element.sections.map(item => {
|
|
|
+ var itemTimeArr = element.sections.map(item => {
|
|
|
return item.time
|
|
|
})
|
|
|
- this.wenduData = [...this.wenduData, ...wenduArr]
|
|
|
- this.shiduData = [...this.shiduData, ...shiduArr]
|
|
|
- this.timeData = [...this.timeData, ...timeArr]
|
|
|
- console.log(this.wenduData)
|
|
|
- console.log(this.shiduData)
|
|
|
+ this.wenduData = [...this.wenduData, ...itemWenduArr]
|
|
|
+ this.shiduData = [...this.shiduData, ...itemShiduArr]
|
|
|
+ this.timeData = [...this.timeData, ...itemTimeArr]
|
|
|
+ // console.log(this.wenduData)
|
|
|
+ // console.log(this.shiduData)
|
|
|
});
|
|
|
var _this = this
|
|
|
+ this.uOption.xAxis.data = this.timeData
|
|
|
+ this.uOption.series.forEach(item => {
|
|
|
+ switch (item.name) {
|
|
|
+ case '辐射强度值':
|
|
|
+ item.data = _this.fusheData
|
|
|
+ break;
|
|
|
+ case '温度实值':
|
|
|
+ item.data = _this.wenduData
|
|
|
+ break;
|
|
|
+ case '湿度实值':
|
|
|
+ item.data = _this.shiduData
|
|
|
+ break;
|
|
|
+
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // this.uEcharts.clear()
|
|
|
+ this.uEcharts.setOption(this.uOption, true);
|
|
|
+ // this.uEcharts.setOption({
|
|
|
+ // xAxis: {
|
|
|
+ // data: _this.timeData
|
|
|
+ // },
|
|
|
+ // series: [
|
|
|
+ // {
|
|
|
+ // name: '辐射强度值',
|
|
|
+ // data: _this.fusheData
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // name: '温度实值',
|
|
|
+ // data: _this.wenduData
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // name: '湿度实值',
|
|
|
+ // data: _this.shiduData
|
|
|
+ // },
|
|
|
+ // ]
|
|
|
+ // });
|
|
|
+ },
|
|
|
+ // 点击循环改变高亮
|
|
|
+ changeXunhuan(data){
|
|
|
+ var value = this.data.find(item => item.circname === data)
|
|
|
+ console.log(value)
|
|
|
+ if(value){
|
|
|
+ this.chooseXunhuan.circname = value.circname
|
|
|
+ this.chooseXunhuan.begintime = value.begintime
|
|
|
+ this.chooseXunhuan.endtime = value.endtime
|
|
|
+ } else {
|
|
|
+ this.chooseXunhuan.circname = ''
|
|
|
+ this.chooseXunhuan.begintime = ''
|
|
|
+ this.chooseXunhuan.endtime = ''
|
|
|
+ }
|
|
|
+ console.log(this.chooseXunhuan)
|
|
|
+ var _this = this
|
|
|
this.uEcharts.setOption({
|
|
|
- xAxis: {
|
|
|
- data: this.timeData
|
|
|
- },
|
|
|
series: [
|
|
|
{
|
|
|
- name: '辐射强度值',
|
|
|
- data: _this.fusheData
|
|
|
- },
|
|
|
- {
|
|
|
name: '温度实值',
|
|
|
markArea: {
|
|
|
itemStyle: {
|
|
@@ -366,11 +404,6 @@ export default {
|
|
|
],
|
|
|
]
|
|
|
},
|
|
|
- data: _this.wenduData
|
|
|
- },
|
|
|
- {
|
|
|
- name: '湿度实值',
|
|
|
- data: _this.shiduData
|
|
|
},
|
|
|
]
|
|
|
});
|