修改图表

master
夜笙歌 2 years ago
parent 4b34491c1c
commit ecc43e335a

@ -6,7 +6,7 @@ import com.ruoyi.basetyre.domain.BaseCar;
import com.ruoyi.basetyre.domain.BaseTyre;
import com.ruoyi.basetyre.domain.CollectTyresDetail;
import com.ruoyi.basetyre.domain.vo.CarTyres;
import com.ruoyi.basetyre.domain.vo.QueryParams;
//import com.ruoyi.basetyre.domain.vo.QueryParams;
import com.ruoyi.basetyre.domain.vo.SpeedVo;
import com.ruoyi.basetyre.domain.vo.TemperatureAndPressReport;
import com.ruoyi.basetyre.mapper.BaseTyreHistoricalRecordsMapper;

@ -265,7 +265,7 @@ const queryParams = ref({
companyCode: undefined,
code: undefined,
title: undefined,
state: 0,
state: null,
axleTotal: undefined,
tyreTotal: undefined,
isDelete: undefined,
@ -301,6 +301,7 @@ function getList() {
listCartype(queryParams.value).then(response => {
postList.value = response.rows;
total.value = response.total;
console.log(postList.value)
}).finally(() => {
loading.value = false;
});

@ -32,6 +32,7 @@ export default defineComponent({
}
},
name: 'Histogram',
expose: ['setData'],
setup() {
const state = reactive({
option: {
@ -66,7 +67,7 @@ export default defineComponent({
interval: 0, //X
rotate: -40 //
},
data: ['2023-03-15 08:31', '2023-03-15 08:32', '2023-03-15 08:33', '2023-03-15 08:34', '2023-03-15 08:35', '2023-03-15 08:36', '2023-03-15 08:37', '2023-03-15 08:38', '2023-03-15 08:39']
data: []
},
yAxis: [
{
@ -125,7 +126,7 @@ export default defineComponent({
{
name: '速度(千米)',
type: 'line',
data: [0, 0, 0, 18, 21, 36, 44, 45, 58, 66],
data: [],
symbol: "none",
// symbolSize: 10,
yAxisIndex: 0,
@ -141,7 +142,7 @@ export default defineComponent({
{
name: '温度(℃)',
type: 'line',
data: [20, 20, 20, 25, 32, 40, 46, 53, 70, 87],
data: [],
yAxisIndex: 1,//y
symbol: "none",
itemStyle: {
@ -156,7 +157,7 @@ export default defineComponent({
{
name: '压力(Kpa)',
type: 'line',
data: [600, 600, 600, 615, 616, 617, 620, 622, 622, 622],
data: [],
yAxisIndex: 2,//y
symbol: "none",
itemStyle: {
@ -174,8 +175,21 @@ export default defineComponent({
const initeCharts = () => {
let myChart = echarts.init(document.getElementById('myChart'))
//
console.log(state.option)
myChart.setOption(state.option)
}
const setData = (e) => {
let X = e.SpeedList.map(v => v.time)
let Y1 = e.SpeedList.map(v => v.speed)
let Y2 = e.TPList.map(v => v.temperature)
let Y3 = e.TPList.map(v => v.press)
const {option} = toRefs(state)
option.value.xAxis.data = X
option.value.series[0].data = Y1
option.value.series[1].data = Y2
option.value.series[2].data = Y3
initeCharts()
}
onMounted(() => {
initeCharts()
@ -183,6 +197,7 @@ export default defineComponent({
return {
...toRefs(state),
setData
}
},
})

@ -32,7 +32,7 @@
</el-form>
<el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;">
<temp />
<temp ref="tempRef"/>
</el-row>
<el-row :gutter="32">
<el-col :xs="24" :sm="24" :lg="8" @click="handleTyreMileage">
@ -70,6 +70,7 @@
//
const showSearch = ref(true);
const dateRange = ref([]);
const tempRef = ref();
//
const queryParams = ref({
@ -94,7 +95,7 @@
/** 搜索按钮操作 */
function handleQuery() {
getTempdata(proxy.addDateRange(queryParams.value, dateRange.value)).then(response => {
console.log(response)
tempRef.value.setData(response.data);
}).finally(() => {
//loading.value = false;
});

@ -91,42 +91,49 @@ const handleQuery = () => {
let grasp = new AMap.GraspRoad();
AMap.convertFrom(pathRow, 'gps', function (status, result) {
if (result.info === 'ok') {
let lnglats = result.locations.map(e=>[e.lng,e.lat]);
let GraspRoadPath = lnglats.map((res, i) => {
if (i === 0) {
return {
'x': res[0],
'y': res[1],
'sp': 10,
'ag': 0,
'tm': 1478031031,
}
}
return {
'x': res[0],
'y': res[1],
'sp': 10,
'ag': 0,
'tm': i,
}
let lnglats = result.locations.map(e => [e.lng, e.lat]);
//
// let GraspRoadPath = lnglats.map((res, i) => {
// if (i === 0) {
// return {
// 'x': res[0],
// 'y': res[1],
// 'sp': 10,
// 'ag': 0,
// 'tm': 1478031031,
// }
// }
// return {
// 'x': res[0],
// 'y': res[1],
// 'sp': 10,
// 'ag': 0,
// 'tm': i,
// }
// })
// grasp.driving(GraspRoadPath, function (error, result) {
// if (!error) {
// var newPath = result.data.points;//
// var distance = result.data.distance;//
// let newPolylinePath = newPath.map(e => [e.x, e.y])
polyline = new AMap.Polyline({
strokeColor: '#00BBFF', // 线-
path: lnglats,
strokeWeight: 6 // 线
})
grasp.driving(GraspRoadPath, function (error, result) {
if (!error) {
var newPath = result.data.points;//
var distance = result.data.distance;//
let newPolylinePath = newPath.map(e => [e.x, e.y])
polyline = new AMap.Polyline({
strokeColor: '#00BBFF', // 线-
path: newPolylinePath,
strokeWeight: 6 // 线
})
map.add(polyline);
map.setFitView()
}
map.add(polyline);
let distance = Math.round(AMap.GeometryUtil.distanceOfLine(lnglats));
let text = new AMap.Text({
position: lnglats.at(-1),
text: '行驶路径' + distance + '米',
offset: new AMap.Pixel(-20, -20)
})
map.add(text);
map.setFitView()
}
});
})
// }
// });
polylinePath.value = pathRow
})
}

Loading…
Cancel
Save