|
@@ -112,7 +112,6 @@
|
|
width: "100%",
|
|
width: "100%",
|
|
height: "400px"
|
|
height: "400px"
|
|
}, //图表样式
|
|
}, //图表样式
|
|
- position: [],
|
|
|
|
//运输信息表单数据
|
|
//运输信息表单数据
|
|
tableData1: [],
|
|
tableData1: [],
|
|
//运输信息表单数据准备
|
|
//运输信息表单数据准备
|
|
@@ -136,7 +135,6 @@
|
|
startTime: "",
|
|
startTime: "",
|
|
endTime: ""
|
|
endTime: ""
|
|
},
|
|
},
|
|
- //线
|
|
|
|
option: {},
|
|
option: {},
|
|
//表单各值
|
|
//表单各值
|
|
maxT: 0,
|
|
maxT: 0,
|
|
@@ -152,13 +150,13 @@
|
|
mounted() {
|
|
mounted() {
|
|
//DOM初始化完成进行地图初始化
|
|
//DOM初始化完成进行地图初始化
|
|
this.initMap();
|
|
this.initMap();
|
|
- // this.initEcharts();
|
|
|
|
- // this.windowSize();
|
|
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
//把传参中的保温箱转换成数组
|
|
//把传参中的保温箱转换成数组
|
|
this.carMessage = this.$route.query;
|
|
this.carMessage = this.$route.query;
|
|
- this.carMessage.boxCode = this.$route.query.boxCode.split(',');
|
|
|
|
|
|
+ if (this.carMessage.boxCode != null) {
|
|
|
|
+ this.carMessage.boxCode = this.$route.query.boxCode.split(',');
|
|
|
|
+ }
|
|
//当结束时间为空时,默认为当前时间
|
|
//当结束时间为空时,默认为当前时间
|
|
if (this.carMessage.endTime == '' || this.carMessage.endTime == null) {
|
|
if (this.carMessage.endTime == '' || this.carMessage.endTime == null) {
|
|
this.carMessage.endTime = this.formatDateTime(this.getCurrentTime(), 'yyyy-MM-dd HH:mm:ss');
|
|
this.carMessage.endTime = this.formatDateTime(this.getCurrentTime(), 'yyyy-MM-dd HH:mm:ss');
|
|
@@ -167,10 +165,6 @@
|
|
this.handleGeocodeRepo(this.carMessage);
|
|
this.handleGeocodeRepo(this.carMessage);
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- handleClick(tab, event) {
|
|
|
|
- console.log(tab, event);
|
|
|
|
- this.handleGeocodeRepo(this.carMessage);
|
|
|
|
- },
|
|
|
|
//通过传参查询数据
|
|
//通过传参查询数据
|
|
handleGeocodeRepo(data) {
|
|
handleGeocodeRepo(data) {
|
|
historyApi.queryAddress(data).then(res => {
|
|
historyApi.queryAddress(data).then(res => {
|
|
@@ -198,18 +192,24 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
console.log(latitudeLongitude, 'latitudeLongitude')
|
|
console.log(latitudeLongitude, 'latitudeLongitude')
|
|
- //车辆温度数组
|
|
|
|
|
|
+ //计算各值
|
|
|
|
+ this.calculate(res.data);
|
|
|
|
+ //对订单温湿度列表进行赋值
|
|
|
|
+ this.assignmentTable1(res.data);
|
|
|
|
+ //提取探头种类数量
|
|
|
|
+ let probeSum = [];
|
|
|
|
+ let probe = [];
|
|
for (let i = 0; i < latitudeLongitude.length; i++) {
|
|
for (let i = 0; i < latitudeLongitude.length; i++) {
|
|
- this.temperatureData.push(latitudeLongitude[i].temperature);
|
|
|
|
|
|
+ probeSum[i] = latitudeLongitude[i].measuringPointAddr;
|
|
}
|
|
}
|
|
- // console.log(path, 'path')
|
|
|
|
- // console.log(this.temperatureData, 'temperatureData')
|
|
|
|
|
|
+ probe = Array.from(new Set(probeSum));
|
|
|
|
+ console.log(probe, 'probe');
|
|
|
|
+ //车辆温度数组
|
|
|
|
+ let c, d;
|
|
this.initEcharts();
|
|
this.initEcharts();
|
|
- //筛选保温箱的数组
|
|
|
|
- console.log(this.carMessage.boxCode, 'this.carMessage.boxCode')
|
|
|
|
- for (let i = 0; i < this.carMessage.boxCode.length; i++) {
|
|
|
|
- let boxForm = {
|
|
|
|
- name: this.carMessage.boxCode[i],
|
|
|
|
|
|
+ for (let i = 0; i < probe.length; i++) {
|
|
|
|
+ let carForm = {
|
|
|
|
+ name: this.carMessage.plateNumber + '/' + probe[i],
|
|
data: [],
|
|
data: [],
|
|
type: "line",
|
|
type: "line",
|
|
smooth: true,
|
|
smooth: true,
|
|
@@ -222,36 +222,80 @@
|
|
},
|
|
},
|
|
}
|
|
}
|
|
// count = 0;
|
|
// count = 0;
|
|
- for (let j = 0; j < res.data.length; j++) {
|
|
|
|
- if (boxForm.name == res.data[j].measuringPointName) {
|
|
|
|
- boxForm.data[j] = res.data[j].temperature;
|
|
|
|
|
|
+ for (let j = 0; j < latitudeLongitude.length; j++) {
|
|
|
|
+ if (carForm.name.indexOf(latitudeLongitude[j].measuringPointAddr) != -1) {
|
|
|
|
+ c = latitudeLongitude[j].hisDate;
|
|
|
|
+ d = latitudeLongitude[j].temperature;
|
|
|
|
+ carForm.data.push([c, d]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- this.option.series.push(boxForm);
|
|
|
|
- this.option.legend.data.push(boxForm.name);
|
|
|
|
|
|
+ this.option.series.push(carForm);
|
|
|
|
+ this.option.legend.data.push(carForm.name);
|
|
|
|
+ console.log(this.option.series, 'this.option.series');
|
|
}
|
|
}
|
|
- //计算各值
|
|
|
|
- this.calculate(res.data);
|
|
|
|
- //对订单温湿度列表进行赋值
|
|
|
|
- this.assignmentTable1(res.data);
|
|
|
|
|
|
+ // console.log(path, 'path')
|
|
|
|
+ console.log(this.temperatureData, 'temperatureData')
|
|
|
|
+ //筛选保温箱的数组
|
|
|
|
+ console.log(this.carMessage.boxCode, 'this.carMessage.boxCode')
|
|
|
|
+ if (this.carMessage.boxCode != null) {
|
|
|
|
+ let e, f;
|
|
|
|
+ for (let i = 0; i < this.carMessage.boxCode.length; i++) {
|
|
|
|
+ let boxForm = {
|
|
|
|
+ name: this.carMessage.boxCode[i],
|
|
|
|
+ data: [],
|
|
|
|
+ type: "line",
|
|
|
|
+ smooth: true,
|
|
|
|
+ label: {
|
|
|
|
+ show: true,
|
|
|
|
+ position: "top",
|
|
|
|
+ textStyle: {
|
|
|
|
+ fontSize: 12
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ }
|
|
|
|
+ // count = 0;
|
|
|
|
+ for (let j = 0; j < res.data.length; j++) {
|
|
|
|
+ if (boxForm.name == res.data[j].measuringPointName) {
|
|
|
|
+ e = res.data[j].hisDate;
|
|
|
|
+ f = res.data[j].temperature;
|
|
|
|
+ boxForm.data.push([e, f]);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.option.series.push(boxForm);
|
|
|
|
+ this.option.legend.data.push(boxForm.name);
|
|
|
|
+ console.log(this.option.series, 'this.option.series');
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 如果车辆温度数组为空,则其它数组前移一位
|
|
|
|
+ for (;;) {
|
|
|
|
+ if (this.option.series[0].data.length == 0) {
|
|
|
|
+ for (let i = 0; i < this.option.series.length - 1; i++) {
|
|
|
|
+ this.option.series[i] = this.option.series[i + 1];
|
|
|
|
+ this.option.legend.data[i] = this.option.legend.data[i + 1];
|
|
|
|
+ }
|
|
|
|
+ this.option.series[this.option.series.length - 1] = '';
|
|
|
|
+ this.option.legend.data[this.option.series.length - 1] = '';
|
|
|
|
+ }
|
|
|
|
+ if (this.option.series[0].data.length != 0) {
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ console.log(this.option, 'this.option');
|
|
|
|
+ this.windowSize();
|
|
//对基础数据进行赋值
|
|
//对基础数据进行赋值
|
|
this.basicData.billCode = this.carMessage.billCode;
|
|
this.basicData.billCode = this.carMessage.billCode;
|
|
this.basicData.plateNumber = this.carMessage.plateNumber;
|
|
this.basicData.plateNumber = this.carMessage.plateNumber;
|
|
this.basicData.startTime = res.data[0].hisDate;
|
|
this.basicData.startTime = res.data[0].hisDate;
|
|
this.basicData.endTime = res.data[res.data.length - 1].hisDate;
|
|
this.basicData.endTime = res.data[res.data.length - 1].hisDate;
|
|
//基本地图加载
|
|
//基本地图加载
|
|
- var map, route;
|
|
|
|
- map = new AMap.Map("container", {
|
|
|
|
- resizeEnable: true
|
|
|
|
- });
|
|
|
|
- map.plugin("AMap.DragRoute", function () {
|
|
|
|
- route = new AMap.DragRoute(map, path, AMap.DrivingPolicy.LEAST_FEE); //构造拖拽导航类
|
|
|
|
- route.search(); //查询导航路径并开启拖拽导航
|
|
|
|
- });
|
|
|
|
- this.windowSize();
|
|
|
|
|
|
+ this.loadMap(path);
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+ handleClick(tab, event) {
|
|
|
|
+ console.log(tab, event);
|
|
|
|
+ this.handleGeocodeRepo(this.carMessage);
|
|
|
|
+ },
|
|
//地图初始化
|
|
//地图初始化
|
|
initMap() {
|
|
initMap() {
|
|
AMapLoader.load({
|
|
AMapLoader.load({
|
|
@@ -271,6 +315,17 @@
|
|
console.log(e)
|
|
console.log(e)
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+ //基本地图加载
|
|
|
|
+ loadMap(path) {
|
|
|
|
+ var map, route;
|
|
|
|
+ map = new AMap.Map("container", {
|
|
|
|
+ resizeEnable: true
|
|
|
|
+ });
|
|
|
|
+ map.plugin("AMap.DragRoute", function () {
|
|
|
|
+ route = new AMap.DragRoute(map, path, AMap.DrivingPolicy.LEAST_FEE); //构造拖拽导航类
|
|
|
|
+ route.search(); //查询导航路径并开启拖拽导航
|
|
|
|
+ });
|
|
|
|
+ },
|
|
//图表属性赋值
|
|
//图表属性赋值
|
|
initEcharts() {
|
|
initEcharts() {
|
|
this.option = {
|
|
this.option = {
|
|
@@ -288,7 +343,7 @@
|
|
data: this.xData
|
|
data: this.xData
|
|
},
|
|
},
|
|
legend: { // 图例
|
|
legend: { // 图例
|
|
- data: ["车辆温度"],
|
|
|
|
|
|
+ data: [],
|
|
// bottom: "0%"
|
|
// bottom: "0%"
|
|
},
|
|
},
|
|
yAxis: {},
|
|
yAxis: {},
|
|
@@ -304,20 +359,8 @@
|
|
zoomOnMouseWheel: 'true', //如何触发缩放。可选值为:true:表示不按任何功能键,鼠标滚轮能触发缩放。false:表示鼠标滚轮不能触发缩放。'shift':表示按住 shift 和鼠标滚轮能触发缩放。'ctrl':表示按住 ctrl 和鼠标滚轮能触发缩放。'alt':表示按住 alt 和鼠标滚轮能触发缩放。
|
|
zoomOnMouseWheel: 'true', //如何触发缩放。可选值为:true:表示不按任何功能键,鼠标滚轮能触发缩放。false:表示鼠标滚轮不能触发缩放。'shift':表示按住 shift 和鼠标滚轮能触发缩放。'ctrl':表示按住 ctrl 和鼠标滚轮能触发缩放。'alt':表示按住 alt 和鼠标滚轮能触发缩放。
|
|
},
|
|
},
|
|
],
|
|
],
|
|
- series: [{
|
|
|
|
- name: "车辆温度",
|
|
|
|
- data: this.temperatureData,
|
|
|
|
- type: "line",
|
|
|
|
- smooth: true,
|
|
|
|
- label: {
|
|
|
|
- show: true,
|
|
|
|
- position: "top",
|
|
|
|
- textStyle: {
|
|
|
|
- fontSize: 12
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- }],
|
|
|
|
- };
|
|
|
|
|
|
+ series: [],
|
|
|
|
+ }
|
|
},
|
|
},
|
|
//渲染图表
|
|
//渲染图表
|
|
windowSize() {
|
|
windowSize() {
|
|
@@ -336,9 +379,10 @@
|
|
this.minH = array[0].humidity;
|
|
this.minH = array[0].humidity;
|
|
this.aggT = 0;
|
|
this.aggT = 0;
|
|
this.aggH = 0;
|
|
this.aggH = 0;
|
|
|
|
+ let x = [];
|
|
for (let i = 0; i < array.length; i++) {
|
|
for (let i = 0; i < array.length; i++) {
|
|
//对X轴的时间进行赋值
|
|
//对X轴的时间进行赋值
|
|
- this.xData[i] = array[i].hisDate;
|
|
|
|
|
|
+ x[i] = array[i].hisDate;
|
|
//对Y轴的温度进行赋值
|
|
//对Y轴的温度进行赋值
|
|
// this.temperatureData[i] = array[i].temperature;
|
|
// this.temperatureData[i] = array[i].temperature;
|
|
//温度最大值
|
|
//温度最大值
|
|
@@ -361,6 +405,9 @@
|
|
this.aggT += parseFloat(array[i].temperature);
|
|
this.aggT += parseFloat(array[i].temperature);
|
|
this.aggH += parseFloat(array[i].humidity);
|
|
this.aggH += parseFloat(array[i].humidity);
|
|
}
|
|
}
|
|
|
|
+ //x轴时间去重
|
|
|
|
+ this.xData = Array.from(new Set(x));
|
|
|
|
+ // console.log(this.xData, 'this.xData')
|
|
//温湿度平均值
|
|
//温湿度平均值
|
|
this.avgT = this.aggT / array.length;
|
|
this.avgT = this.aggT / array.length;
|
|
this.avgH = this.aggH / array.length;
|
|
this.avgH = this.aggH / array.length;
|