修改图表

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.BaseTyre;
import com.ruoyi.basetyre.domain.CollectTyresDetail; import com.ruoyi.basetyre.domain.CollectTyresDetail;
import com.ruoyi.basetyre.domain.vo.CarTyres; 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.SpeedVo;
import com.ruoyi.basetyre.domain.vo.TemperatureAndPressReport; import com.ruoyi.basetyre.domain.vo.TemperatureAndPressReport;
import com.ruoyi.basetyre.mapper.BaseTyreHistoricalRecordsMapper; import com.ruoyi.basetyre.mapper.BaseTyreHistoricalRecordsMapper;

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

@ -32,6 +32,7 @@ export default defineComponent({
} }
}, },
name: 'Histogram', name: 'Histogram',
expose: ['setData'],
setup() { setup() {
const state = reactive({ const state = reactive({
option: { option: {
@ -66,7 +67,7 @@ export default defineComponent({
interval: 0, //X interval: 0, //X
rotate: -40 // 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: [ yAxis: [
{ {
@ -125,7 +126,7 @@ export default defineComponent({
{ {
name: '速度(千米)', name: '速度(千米)',
type: 'line', type: 'line',
data: [0, 0, 0, 18, 21, 36, 44, 45, 58, 66], data: [],
symbol: "none", symbol: "none",
// symbolSize: 10, // symbolSize: 10,
yAxisIndex: 0, yAxisIndex: 0,
@ -141,7 +142,7 @@ export default defineComponent({
{ {
name: '温度(℃)', name: '温度(℃)',
type: 'line', type: 'line',
data: [20, 20, 20, 25, 32, 40, 46, 53, 70, 87], data: [],
yAxisIndex: 1,//y yAxisIndex: 1,//y
symbol: "none", symbol: "none",
itemStyle: { itemStyle: {
@ -156,7 +157,7 @@ export default defineComponent({
{ {
name: '压力(Kpa)', name: '压力(Kpa)',
type: 'line', type: 'line',
data: [600, 600, 600, 615, 616, 617, 620, 622, 622, 622], data: [],
yAxisIndex: 2,//y yAxisIndex: 2,//y
symbol: "none", symbol: "none",
itemStyle: { itemStyle: {
@ -174,8 +175,21 @@ export default defineComponent({
const initeCharts = () => { const initeCharts = () => {
let myChart = echarts.init(document.getElementById('myChart')) let myChart = echarts.init(document.getElementById('myChart'))
// //
console.log(state.option)
myChart.setOption(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(() => { onMounted(() => {
initeCharts() initeCharts()
@ -183,6 +197,7 @@ export default defineComponent({
return { return {
...toRefs(state), ...toRefs(state),
setData
} }
}, },
}) })

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

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

Loading…
Cancel
Save