diff --git a/src/api/map.ts b/src/api/map.ts index 220d9f0..f7adcf1 100644 --- a/src/api/map.ts +++ b/src/api/map.ts @@ -7,8 +7,12 @@ return axios.get(`https://restapi.amap.com/v3/geocode/geo?address=${address}&key=${mapStore.key}`) } // 根据经纬度获取详细位置信息 +// export function getLocation(posotion: string) { +// // 例子 posotion = 116.3254,39.1458 +// return axios.get(`https://restapi.amap.com/v3/place/around?location=${posotion}&key=${mapStore.key}&offset=1`) +// } export function getLocation(posotion: string) { // 例子 posotion = 116.3254,39.1458 - return axios.get(`https://restapi.amap.com/v3/place/around?location=${posotion}&key=${mapStore.key}&offset=1`) + return axios.get(`https://restapi.amap.com/v3/geocode/regeo?output=json&location=${posotion}&key=${mapStore.key}`) } diff --git a/src/api/map.ts b/src/api/map.ts index 220d9f0..f7adcf1 100644 --- a/src/api/map.ts +++ b/src/api/map.ts @@ -7,8 +7,12 @@ return axios.get(`https://restapi.amap.com/v3/geocode/geo?address=${address}&key=${mapStore.key}`) } // 根据经纬度获取详细位置信息 +// export function getLocation(posotion: string) { +// // 例子 posotion = 116.3254,39.1458 +// return axios.get(`https://restapi.amap.com/v3/place/around?location=${posotion}&key=${mapStore.key}&offset=1`) +// } export function getLocation(posotion: string) { // 例子 posotion = 116.3254,39.1458 - return axios.get(`https://restapi.amap.com/v3/place/around?location=${posotion}&key=${mapStore.key}&offset=1`) + return axios.get(`https://restapi.amap.com/v3/geocode/regeo?output=json&location=${posotion}&key=${mapStore.key}`) } diff --git a/src/api/page/page.ts b/src/api/page/page.ts index fb105a3..954b15d 100644 --- a/src/api/page/page.ts +++ b/src/api/page/page.ts @@ -26,8 +26,9 @@ } // 巡检轨迹 export function getTaskDetail(params: any) { + console.log(params, 'params') return request({ - url: '/system/busPatrolTrack/listPage?offset=1&limit=20', + url: `/system/busPatrolTrack/listPage?limit=10&offset=${params.offset}`, method: 'post', data: params, }) diff --git a/src/api/map.ts b/src/api/map.ts index 220d9f0..f7adcf1 100644 --- a/src/api/map.ts +++ b/src/api/map.ts @@ -7,8 +7,12 @@ return axios.get(`https://restapi.amap.com/v3/geocode/geo?address=${address}&key=${mapStore.key}`) } // 根据经纬度获取详细位置信息 +// export function getLocation(posotion: string) { +// // 例子 posotion = 116.3254,39.1458 +// return axios.get(`https://restapi.amap.com/v3/place/around?location=${posotion}&key=${mapStore.key}&offset=1`) +// } export function getLocation(posotion: string) { // 例子 posotion = 116.3254,39.1458 - return axios.get(`https://restapi.amap.com/v3/place/around?location=${posotion}&key=${mapStore.key}&offset=1`) + return axios.get(`https://restapi.amap.com/v3/geocode/regeo?output=json&location=${posotion}&key=${mapStore.key}`) } diff --git a/src/api/page/page.ts b/src/api/page/page.ts index fb105a3..954b15d 100644 --- a/src/api/page/page.ts +++ b/src/api/page/page.ts @@ -26,8 +26,9 @@ } // 巡检轨迹 export function getTaskDetail(params: any) { + console.log(params, 'params') return request({ - url: '/system/busPatrolTrack/listPage?offset=1&limit=20', + url: `/system/busPatrolTrack/listPage?limit=10&offset=${params.offset}`, method: 'post', data: params, }) diff --git a/src/components/map/components/analyse.vue b/src/components/map/components/analyse.vue index 1efb87a..135f04d 100644 --- a/src/components/map/components/analyse.vue +++ b/src/components/map/components/analyse.vue @@ -19,12 +19,7 @@ if (newVal.lng && newVal.lat) { getLocation(`${newVal.lng},${newVal.lat}`).then((res) => { if (res.data.info === 'OK') { - if (res.data.pois.length) { - position.value = res.data.pois[0].address - } - else { - position.value = '/' - } + position.value = res.data.regeocode.formatted_address } else { position.value = '/' diff --git a/src/api/map.ts b/src/api/map.ts index 220d9f0..f7adcf1 100644 --- a/src/api/map.ts +++ b/src/api/map.ts @@ -7,8 +7,12 @@ return axios.get(`https://restapi.amap.com/v3/geocode/geo?address=${address}&key=${mapStore.key}`) } // 根据经纬度获取详细位置信息 +// export function getLocation(posotion: string) { +// // 例子 posotion = 116.3254,39.1458 +// return axios.get(`https://restapi.amap.com/v3/place/around?location=${posotion}&key=${mapStore.key}&offset=1`) +// } export function getLocation(posotion: string) { // 例子 posotion = 116.3254,39.1458 - return axios.get(`https://restapi.amap.com/v3/place/around?location=${posotion}&key=${mapStore.key}&offset=1`) + return axios.get(`https://restapi.amap.com/v3/geocode/regeo?output=json&location=${posotion}&key=${mapStore.key}`) } diff --git a/src/api/page/page.ts b/src/api/page/page.ts index fb105a3..954b15d 100644 --- a/src/api/page/page.ts +++ b/src/api/page/page.ts @@ -26,8 +26,9 @@ } // 巡检轨迹 export function getTaskDetail(params: any) { + console.log(params, 'params') return request({ - url: '/system/busPatrolTrack/listPage?offset=1&limit=20', + url: `/system/busPatrolTrack/listPage?limit=10&offset=${params.offset}`, method: 'post', data: params, }) diff --git a/src/components/map/components/analyse.vue b/src/components/map/components/analyse.vue index 1efb87a..135f04d 100644 --- a/src/components/map/components/analyse.vue +++ b/src/components/map/components/analyse.vue @@ -19,12 +19,7 @@ if (newVal.lng && newVal.lat) { getLocation(`${newVal.lng},${newVal.lat}`).then((res) => { if (res.data.info === 'OK') { - if (res.data.pois.length) { - position.value = res.data.pois[0].address - } - else { - position.value = '/' - } + position.value = res.data.regeocode.formatted_address } else { position.value = '/' diff --git a/src/components/map/components/car.vue b/src/components/map/components/car.vue index 5d21839..7d58b24 100644 --- a/src/components/map/components/car.vue +++ b/src/components/map/components/car.vue @@ -19,12 +19,7 @@ if (newVal.lng && newVal.lat) { getLocation(`${newVal.lng},${newVal.lat}`).then((res) => { if (res.data.info === 'OK') { - if (res.data.pois.length) { - position.value = res.data.pois[0].address - } - else { - position.value = '/' - } + position.value = res.data.regeocode.formatted_address } else { position.value = '/' diff --git a/src/api/map.ts b/src/api/map.ts index 220d9f0..f7adcf1 100644 --- a/src/api/map.ts +++ b/src/api/map.ts @@ -7,8 +7,12 @@ return axios.get(`https://restapi.amap.com/v3/geocode/geo?address=${address}&key=${mapStore.key}`) } // 根据经纬度获取详细位置信息 +// export function getLocation(posotion: string) { +// // 例子 posotion = 116.3254,39.1458 +// return axios.get(`https://restapi.amap.com/v3/place/around?location=${posotion}&key=${mapStore.key}&offset=1`) +// } export function getLocation(posotion: string) { // 例子 posotion = 116.3254,39.1458 - return axios.get(`https://restapi.amap.com/v3/place/around?location=${posotion}&key=${mapStore.key}&offset=1`) + return axios.get(`https://restapi.amap.com/v3/geocode/regeo?output=json&location=${posotion}&key=${mapStore.key}`) } diff --git a/src/api/page/page.ts b/src/api/page/page.ts index fb105a3..954b15d 100644 --- a/src/api/page/page.ts +++ b/src/api/page/page.ts @@ -26,8 +26,9 @@ } // 巡检轨迹 export function getTaskDetail(params: any) { + console.log(params, 'params') return request({ - url: '/system/busPatrolTrack/listPage?offset=1&limit=20', + url: `/system/busPatrolTrack/listPage?limit=10&offset=${params.offset}`, method: 'post', data: params, }) diff --git a/src/components/map/components/analyse.vue b/src/components/map/components/analyse.vue index 1efb87a..135f04d 100644 --- a/src/components/map/components/analyse.vue +++ b/src/components/map/components/analyse.vue @@ -19,12 +19,7 @@ if (newVal.lng && newVal.lat) { getLocation(`${newVal.lng},${newVal.lat}`).then((res) => { if (res.data.info === 'OK') { - if (res.data.pois.length) { - position.value = res.data.pois[0].address - } - else { - position.value = '/' - } + position.value = res.data.regeocode.formatted_address } else { position.value = '/' diff --git a/src/components/map/components/car.vue b/src/components/map/components/car.vue index 5d21839..7d58b24 100644 --- a/src/components/map/components/car.vue +++ b/src/components/map/components/car.vue @@ -19,12 +19,7 @@ if (newVal.lng && newVal.lat) { getLocation(`${newVal.lng},${newVal.lat}`).then((res) => { if (res.data.info === 'OK') { - if (res.data.pois.length) { - position.value = res.data.pois[0].address - } - else { - position.value = '/' - } + position.value = res.data.regeocode.formatted_address } else { position.value = '/' diff --git a/src/components/map/components/gas.vue b/src/components/map/components/gas.vue index a85adcd..196de56 100644 --- a/src/components/map/components/gas.vue +++ b/src/components/map/components/gas.vue @@ -19,12 +19,7 @@ if (newVal.lng && newVal.lat) { getLocation(`${newVal.lng},${newVal.lat}`).then((res) => { if (res.data.info === 'OK') { - if (res.data.pois.length) { - position.value = res.data.pois[0].address - } - else { - position.value = '/' - } + position.value = res.data.regeocode.formatted_address } else { position.value = '/' diff --git a/src/api/map.ts b/src/api/map.ts index 220d9f0..f7adcf1 100644 --- a/src/api/map.ts +++ b/src/api/map.ts @@ -7,8 +7,12 @@ return axios.get(`https://restapi.amap.com/v3/geocode/geo?address=${address}&key=${mapStore.key}`) } // 根据经纬度获取详细位置信息 +// export function getLocation(posotion: string) { +// // 例子 posotion = 116.3254,39.1458 +// return axios.get(`https://restapi.amap.com/v3/place/around?location=${posotion}&key=${mapStore.key}&offset=1`) +// } export function getLocation(posotion: string) { // 例子 posotion = 116.3254,39.1458 - return axios.get(`https://restapi.amap.com/v3/place/around?location=${posotion}&key=${mapStore.key}&offset=1`) + return axios.get(`https://restapi.amap.com/v3/geocode/regeo?output=json&location=${posotion}&key=${mapStore.key}`) } diff --git a/src/api/page/page.ts b/src/api/page/page.ts index fb105a3..954b15d 100644 --- a/src/api/page/page.ts +++ b/src/api/page/page.ts @@ -26,8 +26,9 @@ } // 巡检轨迹 export function getTaskDetail(params: any) { + console.log(params, 'params') return request({ - url: '/system/busPatrolTrack/listPage?offset=1&limit=20', + url: `/system/busPatrolTrack/listPage?limit=10&offset=${params.offset}`, method: 'post', data: params, }) diff --git a/src/components/map/components/analyse.vue b/src/components/map/components/analyse.vue index 1efb87a..135f04d 100644 --- a/src/components/map/components/analyse.vue +++ b/src/components/map/components/analyse.vue @@ -19,12 +19,7 @@ if (newVal.lng && newVal.lat) { getLocation(`${newVal.lng},${newVal.lat}`).then((res) => { if (res.data.info === 'OK') { - if (res.data.pois.length) { - position.value = res.data.pois[0].address - } - else { - position.value = '/' - } + position.value = res.data.regeocode.formatted_address } else { position.value = '/' diff --git a/src/components/map/components/car.vue b/src/components/map/components/car.vue index 5d21839..7d58b24 100644 --- a/src/components/map/components/car.vue +++ b/src/components/map/components/car.vue @@ -19,12 +19,7 @@ if (newVal.lng && newVal.lat) { getLocation(`${newVal.lng},${newVal.lat}`).then((res) => { if (res.data.info === 'OK') { - if (res.data.pois.length) { - position.value = res.data.pois[0].address - } - else { - position.value = '/' - } + position.value = res.data.regeocode.formatted_address } else { position.value = '/' diff --git a/src/components/map/components/gas.vue b/src/components/map/components/gas.vue index a85adcd..196de56 100644 --- a/src/components/map/components/gas.vue +++ b/src/components/map/components/gas.vue @@ -19,12 +19,7 @@ if (newVal.lng && newVal.lat) { getLocation(`${newVal.lng},${newVal.lat}`).then((res) => { if (res.data.info === 'OK') { - if (res.data.pois.length) { - position.value = res.data.pois[0].address - } - else { - position.value = '/' - } + position.value = res.data.regeocode.formatted_address } else { position.value = '/' diff --git a/src/components/map/components/recognition.vue b/src/components/map/components/recognition.vue index bf7bda6..5fe3cf9 100644 --- a/src/components/map/components/recognition.vue +++ b/src/components/map/components/recognition.vue @@ -25,12 +25,7 @@ if (newVal.lng && newVal.lat) { getLocation(`${newVal.lng},${newVal.lat}`).then((res) => { if (res.data.info === 'OK') { - if (res.data.pois.length) { - position.value = res.data.pois[0].address - } - else { - position.value = '/' - } + position.value = res.data.regeocode.formatted_address } else { position.value = '/' @@ -128,7 +123,7 @@ width: 44px; height: 44px; font-size: 24px; - color: #fff; + color: #555; // background-color: #606266; border-color: #fff; border-radius: 50%; diff --git a/src/api/map.ts b/src/api/map.ts index 220d9f0..f7adcf1 100644 --- a/src/api/map.ts +++ b/src/api/map.ts @@ -7,8 +7,12 @@ return axios.get(`https://restapi.amap.com/v3/geocode/geo?address=${address}&key=${mapStore.key}`) } // 根据经纬度获取详细位置信息 +// export function getLocation(posotion: string) { +// // 例子 posotion = 116.3254,39.1458 +// return axios.get(`https://restapi.amap.com/v3/place/around?location=${posotion}&key=${mapStore.key}&offset=1`) +// } export function getLocation(posotion: string) { // 例子 posotion = 116.3254,39.1458 - return axios.get(`https://restapi.amap.com/v3/place/around?location=${posotion}&key=${mapStore.key}&offset=1`) + return axios.get(`https://restapi.amap.com/v3/geocode/regeo?output=json&location=${posotion}&key=${mapStore.key}`) } diff --git a/src/api/page/page.ts b/src/api/page/page.ts index fb105a3..954b15d 100644 --- a/src/api/page/page.ts +++ b/src/api/page/page.ts @@ -26,8 +26,9 @@ } // 巡检轨迹 export function getTaskDetail(params: any) { + console.log(params, 'params') return request({ - url: '/system/busPatrolTrack/listPage?offset=1&limit=20', + url: `/system/busPatrolTrack/listPage?limit=10&offset=${params.offset}`, method: 'post', data: params, }) diff --git a/src/components/map/components/analyse.vue b/src/components/map/components/analyse.vue index 1efb87a..135f04d 100644 --- a/src/components/map/components/analyse.vue +++ b/src/components/map/components/analyse.vue @@ -19,12 +19,7 @@ if (newVal.lng && newVal.lat) { getLocation(`${newVal.lng},${newVal.lat}`).then((res) => { if (res.data.info === 'OK') { - if (res.data.pois.length) { - position.value = res.data.pois[0].address - } - else { - position.value = '/' - } + position.value = res.data.regeocode.formatted_address } else { position.value = '/' diff --git a/src/components/map/components/car.vue b/src/components/map/components/car.vue index 5d21839..7d58b24 100644 --- a/src/components/map/components/car.vue +++ b/src/components/map/components/car.vue @@ -19,12 +19,7 @@ if (newVal.lng && newVal.lat) { getLocation(`${newVal.lng},${newVal.lat}`).then((res) => { if (res.data.info === 'OK') { - if (res.data.pois.length) { - position.value = res.data.pois[0].address - } - else { - position.value = '/' - } + position.value = res.data.regeocode.formatted_address } else { position.value = '/' diff --git a/src/components/map/components/gas.vue b/src/components/map/components/gas.vue index a85adcd..196de56 100644 --- a/src/components/map/components/gas.vue +++ b/src/components/map/components/gas.vue @@ -19,12 +19,7 @@ if (newVal.lng && newVal.lat) { getLocation(`${newVal.lng},${newVal.lat}`).then((res) => { if (res.data.info === 'OK') { - if (res.data.pois.length) { - position.value = res.data.pois[0].address - } - else { - position.value = '/' - } + position.value = res.data.regeocode.formatted_address } else { position.value = '/' diff --git a/src/components/map/components/recognition.vue b/src/components/map/components/recognition.vue index bf7bda6..5fe3cf9 100644 --- a/src/components/map/components/recognition.vue +++ b/src/components/map/components/recognition.vue @@ -25,12 +25,7 @@ if (newVal.lng && newVal.lat) { getLocation(`${newVal.lng},${newVal.lat}`).then((res) => { if (res.data.info === 'OK') { - if (res.data.pois.length) { - position.value = res.data.pois[0].address - } - else { - position.value = '/' - } + position.value = res.data.regeocode.formatted_address } else { position.value = '/' @@ -128,7 +123,7 @@ width: 44px; height: 44px; font-size: 24px; - color: #fff; + color: #555; // background-color: #606266; border-color: #fff; border-radius: 50%; diff --git a/src/components/map/components/task.vue b/src/components/map/components/task.vue index 1445ad6..850196d 100644 --- a/src/components/map/components/task.vue +++ b/src/components/map/components/task.vue @@ -16,9 +16,13 @@ }), }, }) +const trajectoryList = ref() +const trajectoryOffset = ref(1) const trackRef = ref() // 轨迹详情弹窗实例 watch(() => $props.info, () => { trackRef.value?.cancel() + trajectoryOffset.value = 1 + trajectoryList.value = [] }, { deep: true, }) @@ -31,7 +35,7 @@ // [116.372105, 39.90651], // [116.428945, 39.89663], // ] - getTaskDetail({ taskId: $props.info.id }).then((res) => { + getTaskDetail({ taskId: $props.info.id, offset: trajectoryOffset.value }).then((res) => { const data = res.data.rows.map((item: any, index: number) => { return { ...item, @@ -48,6 +52,7 @@ dialog: 'taskDetail', } }).filter((item: any) => item.lat && item.lng) + trajectoryList.value = data // 打开详情弹窗 if (data.length) { trackRef.value?.initDialog(data) @@ -57,6 +62,37 @@ } }) } +// 滚动条滚动到底部 +const toBottom = () => { + trajectoryOffset.value += 1 + getTaskDetail({ taskId: $props.info.id, offset: trajectoryOffset.value }).then((res) => { + const data = res.data.rows.map((item: any, index: number) => { + return { + ...item, + + lat: item.lagitude, + lng: item.longitude, + // 数据问题 犯了 + // lat: arr[index][1], + // lng: arr[index][0], + position: item.position, + isAlarm: item.isAlarm === '1' ? '是' : '否', + time: item.ts, + value: item.gas, + dialog: 'taskDetail', + } + }).filter((item: any) => item.lat && item.lng) + trajectoryList.value = [...trajectoryList.value, ...data] + // 打开详情弹窗 + if (data.length) { + trackRef.value?.initDialog(trajectoryList.value) + trackRef.value.isBottom = true + } + else { + trackRef.value.isBottom = false + } + }) +} @@ -113,7 +149,7 @@ .track { position: absolute; top: -35px; - left: 480px; + left: 510px; } .btn { diff --git a/src/api/map.ts b/src/api/map.ts index 220d9f0..f7adcf1 100644 --- a/src/api/map.ts +++ b/src/api/map.ts @@ -7,8 +7,12 @@ return axios.get(`https://restapi.amap.com/v3/geocode/geo?address=${address}&key=${mapStore.key}`) } // 根据经纬度获取详细位置信息 +// export function getLocation(posotion: string) { +// // 例子 posotion = 116.3254,39.1458 +// return axios.get(`https://restapi.amap.com/v3/place/around?location=${posotion}&key=${mapStore.key}&offset=1`) +// } export function getLocation(posotion: string) { // 例子 posotion = 116.3254,39.1458 - return axios.get(`https://restapi.amap.com/v3/place/around?location=${posotion}&key=${mapStore.key}&offset=1`) + return axios.get(`https://restapi.amap.com/v3/geocode/regeo?output=json&location=${posotion}&key=${mapStore.key}`) } diff --git a/src/api/page/page.ts b/src/api/page/page.ts index fb105a3..954b15d 100644 --- a/src/api/page/page.ts +++ b/src/api/page/page.ts @@ -26,8 +26,9 @@ } // 巡检轨迹 export function getTaskDetail(params: any) { + console.log(params, 'params') return request({ - url: '/system/busPatrolTrack/listPage?offset=1&limit=20', + url: `/system/busPatrolTrack/listPage?limit=10&offset=${params.offset}`, method: 'post', data: params, }) diff --git a/src/components/map/components/analyse.vue b/src/components/map/components/analyse.vue index 1efb87a..135f04d 100644 --- a/src/components/map/components/analyse.vue +++ b/src/components/map/components/analyse.vue @@ -19,12 +19,7 @@ if (newVal.lng && newVal.lat) { getLocation(`${newVal.lng},${newVal.lat}`).then((res) => { if (res.data.info === 'OK') { - if (res.data.pois.length) { - position.value = res.data.pois[0].address - } - else { - position.value = '/' - } + position.value = res.data.regeocode.formatted_address } else { position.value = '/' diff --git a/src/components/map/components/car.vue b/src/components/map/components/car.vue index 5d21839..7d58b24 100644 --- a/src/components/map/components/car.vue +++ b/src/components/map/components/car.vue @@ -19,12 +19,7 @@ if (newVal.lng && newVal.lat) { getLocation(`${newVal.lng},${newVal.lat}`).then((res) => { if (res.data.info === 'OK') { - if (res.data.pois.length) { - position.value = res.data.pois[0].address - } - else { - position.value = '/' - } + position.value = res.data.regeocode.formatted_address } else { position.value = '/' diff --git a/src/components/map/components/gas.vue b/src/components/map/components/gas.vue index a85adcd..196de56 100644 --- a/src/components/map/components/gas.vue +++ b/src/components/map/components/gas.vue @@ -19,12 +19,7 @@ if (newVal.lng && newVal.lat) { getLocation(`${newVal.lng},${newVal.lat}`).then((res) => { if (res.data.info === 'OK') { - if (res.data.pois.length) { - position.value = res.data.pois[0].address - } - else { - position.value = '/' - } + position.value = res.data.regeocode.formatted_address } else { position.value = '/' diff --git a/src/components/map/components/recognition.vue b/src/components/map/components/recognition.vue index bf7bda6..5fe3cf9 100644 --- a/src/components/map/components/recognition.vue +++ b/src/components/map/components/recognition.vue @@ -25,12 +25,7 @@ if (newVal.lng && newVal.lat) { getLocation(`${newVal.lng},${newVal.lat}`).then((res) => { if (res.data.info === 'OK') { - if (res.data.pois.length) { - position.value = res.data.pois[0].address - } - else { - position.value = '/' - } + position.value = res.data.regeocode.formatted_address } else { position.value = '/' @@ -128,7 +123,7 @@ width: 44px; height: 44px; font-size: 24px; - color: #fff; + color: #555; // background-color: #606266; border-color: #fff; border-radius: 50%; diff --git a/src/components/map/components/task.vue b/src/components/map/components/task.vue index 1445ad6..850196d 100644 --- a/src/components/map/components/task.vue +++ b/src/components/map/components/task.vue @@ -16,9 +16,13 @@ }), }, }) +const trajectoryList = ref() +const trajectoryOffset = ref(1) const trackRef = ref() // 轨迹详情弹窗实例 watch(() => $props.info, () => { trackRef.value?.cancel() + trajectoryOffset.value = 1 + trajectoryList.value = [] }, { deep: true, }) @@ -31,7 +35,7 @@ // [116.372105, 39.90651], // [116.428945, 39.89663], // ] - getTaskDetail({ taskId: $props.info.id }).then((res) => { + getTaskDetail({ taskId: $props.info.id, offset: trajectoryOffset.value }).then((res) => { const data = res.data.rows.map((item: any, index: number) => { return { ...item, @@ -48,6 +52,7 @@ dialog: 'taskDetail', } }).filter((item: any) => item.lat && item.lng) + trajectoryList.value = data // 打开详情弹窗 if (data.length) { trackRef.value?.initDialog(data) @@ -57,6 +62,37 @@ } }) } +// 滚动条滚动到底部 +const toBottom = () => { + trajectoryOffset.value += 1 + getTaskDetail({ taskId: $props.info.id, offset: trajectoryOffset.value }).then((res) => { + const data = res.data.rows.map((item: any, index: number) => { + return { + ...item, + + lat: item.lagitude, + lng: item.longitude, + // 数据问题 犯了 + // lat: arr[index][1], + // lng: arr[index][0], + position: item.position, + isAlarm: item.isAlarm === '1' ? '是' : '否', + time: item.ts, + value: item.gas, + dialog: 'taskDetail', + } + }).filter((item: any) => item.lat && item.lng) + trajectoryList.value = [...trajectoryList.value, ...data] + // 打开详情弹窗 + if (data.length) { + trackRef.value?.initDialog(trajectoryList.value) + trackRef.value.isBottom = true + } + else { + trackRef.value.isBottom = false + } + }) +} @@ -113,7 +149,7 @@ .track { position: absolute; top: -35px; - left: 480px; + left: 510px; } .btn { diff --git a/src/components/map/components/taskDetail.vue b/src/components/map/components/taskDetail.vue index 904632c..d168910 100644 --- a/src/components/map/components/taskDetail.vue +++ b/src/components/map/components/taskDetail.vue @@ -19,12 +19,7 @@ if (newVal.lng && newVal.lat) { getLocation(`${newVal.lng},${newVal.lat}`).then((res) => { if (res.data.info === 'OK') { - if (res.data.pois.length) { - position.value = res.data.pois[0].address - } - else { - position.value = '/' - } + position.value = res.data.regeocode.formatted_address } else { position.value = '/' diff --git a/src/api/map.ts b/src/api/map.ts index 220d9f0..f7adcf1 100644 --- a/src/api/map.ts +++ b/src/api/map.ts @@ -7,8 +7,12 @@ return axios.get(`https://restapi.amap.com/v3/geocode/geo?address=${address}&key=${mapStore.key}`) } // 根据经纬度获取详细位置信息 +// export function getLocation(posotion: string) { +// // 例子 posotion = 116.3254,39.1458 +// return axios.get(`https://restapi.amap.com/v3/place/around?location=${posotion}&key=${mapStore.key}&offset=1`) +// } export function getLocation(posotion: string) { // 例子 posotion = 116.3254,39.1458 - return axios.get(`https://restapi.amap.com/v3/place/around?location=${posotion}&key=${mapStore.key}&offset=1`) + return axios.get(`https://restapi.amap.com/v3/geocode/regeo?output=json&location=${posotion}&key=${mapStore.key}`) } diff --git a/src/api/page/page.ts b/src/api/page/page.ts index fb105a3..954b15d 100644 --- a/src/api/page/page.ts +++ b/src/api/page/page.ts @@ -26,8 +26,9 @@ } // 巡检轨迹 export function getTaskDetail(params: any) { + console.log(params, 'params') return request({ - url: '/system/busPatrolTrack/listPage?offset=1&limit=20', + url: `/system/busPatrolTrack/listPage?limit=10&offset=${params.offset}`, method: 'post', data: params, }) diff --git a/src/components/map/components/analyse.vue b/src/components/map/components/analyse.vue index 1efb87a..135f04d 100644 --- a/src/components/map/components/analyse.vue +++ b/src/components/map/components/analyse.vue @@ -19,12 +19,7 @@ if (newVal.lng && newVal.lat) { getLocation(`${newVal.lng},${newVal.lat}`).then((res) => { if (res.data.info === 'OK') { - if (res.data.pois.length) { - position.value = res.data.pois[0].address - } - else { - position.value = '/' - } + position.value = res.data.regeocode.formatted_address } else { position.value = '/' diff --git a/src/components/map/components/car.vue b/src/components/map/components/car.vue index 5d21839..7d58b24 100644 --- a/src/components/map/components/car.vue +++ b/src/components/map/components/car.vue @@ -19,12 +19,7 @@ if (newVal.lng && newVal.lat) { getLocation(`${newVal.lng},${newVal.lat}`).then((res) => { if (res.data.info === 'OK') { - if (res.data.pois.length) { - position.value = res.data.pois[0].address - } - else { - position.value = '/' - } + position.value = res.data.regeocode.formatted_address } else { position.value = '/' diff --git a/src/components/map/components/gas.vue b/src/components/map/components/gas.vue index a85adcd..196de56 100644 --- a/src/components/map/components/gas.vue +++ b/src/components/map/components/gas.vue @@ -19,12 +19,7 @@ if (newVal.lng && newVal.lat) { getLocation(`${newVal.lng},${newVal.lat}`).then((res) => { if (res.data.info === 'OK') { - if (res.data.pois.length) { - position.value = res.data.pois[0].address - } - else { - position.value = '/' - } + position.value = res.data.regeocode.formatted_address } else { position.value = '/' diff --git a/src/components/map/components/recognition.vue b/src/components/map/components/recognition.vue index bf7bda6..5fe3cf9 100644 --- a/src/components/map/components/recognition.vue +++ b/src/components/map/components/recognition.vue @@ -25,12 +25,7 @@ if (newVal.lng && newVal.lat) { getLocation(`${newVal.lng},${newVal.lat}`).then((res) => { if (res.data.info === 'OK') { - if (res.data.pois.length) { - position.value = res.data.pois[0].address - } - else { - position.value = '/' - } + position.value = res.data.regeocode.formatted_address } else { position.value = '/' @@ -128,7 +123,7 @@ width: 44px; height: 44px; font-size: 24px; - color: #fff; + color: #555; // background-color: #606266; border-color: #fff; border-radius: 50%; diff --git a/src/components/map/components/task.vue b/src/components/map/components/task.vue index 1445ad6..850196d 100644 --- a/src/components/map/components/task.vue +++ b/src/components/map/components/task.vue @@ -16,9 +16,13 @@ }), }, }) +const trajectoryList = ref() +const trajectoryOffset = ref(1) const trackRef = ref() // 轨迹详情弹窗实例 watch(() => $props.info, () => { trackRef.value?.cancel() + trajectoryOffset.value = 1 + trajectoryList.value = [] }, { deep: true, }) @@ -31,7 +35,7 @@ // [116.372105, 39.90651], // [116.428945, 39.89663], // ] - getTaskDetail({ taskId: $props.info.id }).then((res) => { + getTaskDetail({ taskId: $props.info.id, offset: trajectoryOffset.value }).then((res) => { const data = res.data.rows.map((item: any, index: number) => { return { ...item, @@ -48,6 +52,7 @@ dialog: 'taskDetail', } }).filter((item: any) => item.lat && item.lng) + trajectoryList.value = data // 打开详情弹窗 if (data.length) { trackRef.value?.initDialog(data) @@ -57,6 +62,37 @@ } }) } +// 滚动条滚动到底部 +const toBottom = () => { + trajectoryOffset.value += 1 + getTaskDetail({ taskId: $props.info.id, offset: trajectoryOffset.value }).then((res) => { + const data = res.data.rows.map((item: any, index: number) => { + return { + ...item, + + lat: item.lagitude, + lng: item.longitude, + // 数据问题 犯了 + // lat: arr[index][1], + // lng: arr[index][0], + position: item.position, + isAlarm: item.isAlarm === '1' ? '是' : '否', + time: item.ts, + value: item.gas, + dialog: 'taskDetail', + } + }).filter((item: any) => item.lat && item.lng) + trajectoryList.value = [...trajectoryList.value, ...data] + // 打开详情弹窗 + if (data.length) { + trackRef.value?.initDialog(trajectoryList.value) + trackRef.value.isBottom = true + } + else { + trackRef.value.isBottom = false + } + }) +} @@ -113,7 +149,7 @@ .track { position: absolute; top: -35px; - left: 480px; + left: 510px; } .btn { diff --git a/src/components/map/components/taskDetail.vue b/src/components/map/components/taskDetail.vue index 904632c..d168910 100644 --- a/src/components/map/components/taskDetail.vue +++ b/src/components/map/components/taskDetail.vue @@ -19,12 +19,7 @@ if (newVal.lng && newVal.lat) { getLocation(`${newVal.lng},${newVal.lat}`).then((res) => { if (res.data.info === 'OK') { - if (res.data.pois.length) { - position.value = res.data.pois[0].address - } - else { - position.value = '/' - } + position.value = res.data.regeocode.formatted_address } else { position.value = '/' diff --git a/src/components/map/components/track.vue b/src/components/map/components/track.vue index a8168b4..1b05e0f 100644 --- a/src/components/map/components/track.vue +++ b/src/components/map/components/track.vue @@ -2,6 +2,7 @@