From ecc43e335a1c4e9095f534b32a120a66500d1f39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=9C=E7=AC=99=E6=AD=8C?= <2277317060@qq.com> Date: Thu, 30 Mar 2023 14:25:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=9B=BE=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BaseTyreHistoricalRecordsServiceImpl.java | 2 +- .../src/views/carManagement/type/index.vue | 3 +- ruoyi-ui/src/views/dashboard/Temp.vue | 23 +++++- ruoyi-ui/src/views/index.vue | 5 +- .../historicalRoute/index.vue | 73 ++++++++++--------- 5 files changed, 65 insertions(+), 41 deletions(-) diff --git a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/service/impl/BaseTyreHistoricalRecordsServiceImpl.java b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/service/impl/BaseTyreHistoricalRecordsServiceImpl.java index 8c420f8..39b7d69 100644 --- a/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/service/impl/BaseTyreHistoricalRecordsServiceImpl.java +++ b/ruoyi-basetyre/src/main/java/com/ruoyi/basetyre/service/impl/BaseTyreHistoricalRecordsServiceImpl.java @@ -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; diff --git a/ruoyi-ui/src/views/carManagement/type/index.vue b/ruoyi-ui/src/views/carManagement/type/index.vue index 811859a..ecb525e 100644 --- a/ruoyi-ui/src/views/carManagement/type/index.vue +++ b/ruoyi-ui/src/views/carManagement/type/index.vue @@ -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; }); diff --git a/ruoyi-ui/src/views/dashboard/Temp.vue b/ruoyi-ui/src/views/dashboard/Temp.vue index 7f868bc..cc4a1fa 100644 --- a/ruoyi-ui/src/views/dashboard/Temp.vue +++ b/ruoyi-ui/src/views/dashboard/Temp.vue @@ -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 } }, }) diff --git a/ruoyi-ui/src/views/index.vue b/ruoyi-ui/src/views/index.vue index 615a902..5d18e1a 100644 --- a/ruoyi-ui/src/views/index.vue +++ b/ruoyi-ui/src/views/index.vue @@ -32,7 +32,7 @@ - + @@ -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; }); diff --git a/ruoyi-ui/src/views/realTimeMonitoring/historicalRoute/index.vue b/ruoyi-ui/src/views/realTimeMonitoring/historicalRoute/index.vue index 309b5b9..99851d1 100644 --- a/ruoyi-ui/src/views/realTimeMonitoring/historicalRoute/index.vue +++ b/ruoyi-ui/src/views/realTimeMonitoring/historicalRoute/index.vue @@ -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 }) }