合并分支 'master_dev' 到 'master'
Master dev 查看合并请求 !16
正在显示
4 个修改的文件
包含
117 行增加
和
8 行删除
| @@ -23,3 +23,5 @@ export const DoneTask = params => { return http.post(`${baseServiceURL}/map/loca | @@ -23,3 +23,5 @@ export const DoneTask = params => { return http.post(`${baseServiceURL}/map/loca | ||
| 23 | //根据用户查询所属出勤车辆 | 23 | //根据用户查询所属出勤车辆 |
| 24 | export const selectNameList = params => { return axios.get(`${baseServiceURL}/map/location/selectNameList`, { params: params }); }; | 24 | export const selectNameList = params => { return axios.get(`${baseServiceURL}/map/location/selectNameList`, { params: params }); }; |
| 25 | 25 | ||
| 26 | +//多车定位 | ||
| 27 | +export const queryMulVel = params => { return axios.get(`${baseServiceURL}/map/location/queryMulVel`, { params: params }); }; |
| @@ -4,7 +4,7 @@ let baseUrl = '/cloud-user-center/user' | @@ -4,7 +4,7 @@ let baseUrl = '/cloud-user-center/user' | ||
| 4 | const serviceName = '/cloud-user-center' | 4 | const serviceName = '/cloud-user-center' |
| 5 | // let baseUrl = '/cloud-kako-user-center/user' | 5 | // let baseUrl = '/cloud-kako-user-center/user' |
| 6 | // let baseCode = '/cloud-kako-user-center/randCode' | 6 | // let baseCode = '/cloud-kako-user-center/randCode' |
| 7 | -export const getUserList = params => { return http.get(`${baseUrl}/list`, params); }; | 7 | +export const getUserList = params => { return http.post(`${serviceName}/crm/list`, params) }; |
| 8 | 8 | ||
| 9 | export const getRandCode = params => { return http.get(`/cloud-user-center/anonymous/randCode`, params); }; | 9 | export const getRandCode = params => { return http.get(`/cloud-user-center/anonymous/randCode`, params); }; |
| 10 | 10 |
src/views/deploy/multiple.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div id="mapContainer"></div> | ||
| 3 | +</template> | ||
| 4 | + | ||
| 5 | +<script> | ||
| 6 | + import AMapLoader from '@amap/amap-jsapi-loader'; | ||
| 7 | + import {queryMulVel} from '../../api/consigner/vehicle'; | ||
| 8 | + | ||
| 9 | + export default { | ||
| 10 | + data() { | ||
| 11 | + return { | ||
| 12 | + mapInstance: null, | ||
| 13 | + markers:[] | ||
| 14 | + }; | ||
| 15 | + }, | ||
| 16 | + methods: { | ||
| 17 | + fetchDataAndUpdateMap() { | ||
| 18 | + // 请求后端数据 | ||
| 19 | + queryMulVel().then((response) => { | ||
| 20 | + const res = response.data; | ||
| 21 | + const firstVcl = res.data.data.firstVcl; // 获取首个车辆信息 | ||
| 22 | + const others = res.data.data.others; // 获取其他车辆信息 | ||
| 23 | + | ||
| 24 | + // 清除之前的标记 | ||
| 25 | + this.markers.forEach(marker => { | ||
| 26 | + marker.setMap(null); | ||
| 27 | + }); | ||
| 28 | + this.markers = []; | ||
| 29 | + | ||
| 30 | + // 添加首个车辆标记 | ||
| 31 | + if (firstVcl && firstVcl.lon && firstVcl.lat) { | ||
| 32 | + const marker = new AMap.Marker({ | ||
| 33 | + position: [firstVcl.lon / 600000.0, firstVcl.lat / 600000.0], | ||
| 34 | + map: this.mapInstance, | ||
| 35 | + title: firstVcl.vno, | ||
| 36 | + label: { | ||
| 37 | + content: firstVcl.vno, | ||
| 38 | + offset: new AMap.Pixel(0, -20) // 偏移量,使标题显示在标记的上方 | ||
| 39 | + } | ||
| 40 | + }); | ||
| 41 | + this.markers.push(marker); | ||
| 42 | + } | ||
| 43 | + if (others) { | ||
| 44 | + others.forEach(vehicle => { | ||
| 45 | + if (vehicle.lon && vehicle.lat) { | ||
| 46 | + const marker = new AMap.Marker({ | ||
| 47 | + position: [vehicle.lon / 600000.0, vehicle.lat / 600000.0], | ||
| 48 | + map: this.mapInstance, | ||
| 49 | + title: vehicle.vno, | ||
| 50 | + label: { | ||
| 51 | + content: vehicle.vno, | ||
| 52 | + offset: new AMap.Pixel(0, -20) // 偏移量,使标题显示在标记的上方 | ||
| 53 | + } | ||
| 54 | + }); | ||
| 55 | + this.markers.push(marker); | ||
| 56 | + } | ||
| 57 | + }); | ||
| 58 | + } | ||
| 59 | + // 自动调整地图视野,确保所有标记都可见 | ||
| 60 | + /*if (this.markers.length > 0) { | ||
| 61 | + const bounds = new AMap.Bounds(); | ||
| 62 | + this.markers.forEach(marker => { | ||
| 63 | + bounds.extend(marker.getPosition()); | ||
| 64 | + }); | ||
| 65 | + this.mapInstance.setBounds(bounds); | ||
| 66 | + }*/ | ||
| 67 | + if(firstVcl && firstVcl.lon && firstVcl.lat){ | ||
| 68 | + this.mapInstance.setCenter([firstVcl.lon / 600000.0,firstVcl.lat / 600000.0]) | ||
| 69 | + } | ||
| 70 | + }).catch(error => { | ||
| 71 | + console.error('Failed to fetch data:', error); | ||
| 72 | + }); | ||
| 73 | + } | ||
| 74 | + }, | ||
| 75 | + mounted() { | ||
| 76 | + AMapLoader.load({ | ||
| 77 | + key: 'fdb27c13681d084e85ff8457b5cbe540', | ||
| 78 | + version: '2.0', | ||
| 79 | + plugins: [], | ||
| 80 | + }).then((AMap) => { | ||
| 81 | + this.mapInstance = new AMap.Map('mapContainer', { | ||
| 82 | + zoom: 5, | ||
| 83 | + center: [116.397428, 39.90923], // 默认中心点位置 | ||
| 84 | + //viewMode: '3D', // 使用3D视图 | ||
| 85 | + //showIndoorMap: false, | ||
| 86 | + //showLabel: false, | ||
| 87 | + // mapStyle: 'amap://styles/dark', | ||
| 88 | + //mapStyle: 'amap://styles/fresh', | ||
| 89 | + }); | ||
| 90 | + | ||
| 91 | + // 首次加载数据并更新地图 | ||
| 92 | + this.fetchDataAndUpdateMap(); | ||
| 93 | + | ||
| 94 | + // 启动定时器,每10分钟刷新一次数据并更新地图 | ||
| 95 | + setInterval(() => { | ||
| 96 | + this.fetchDataAndUpdateMap(); | ||
| 97 | + }, 10 * 60 * 1000); | ||
| 98 | + }).catch((err) => { | ||
| 99 | + console.error('Failed to load AMap:', err); | ||
| 100 | + }); | ||
| 101 | + }, | ||
| 102 | + }; | ||
| 103 | +</script> | ||
| 104 | +<style> | ||
| 105 | + #mapContainer { | ||
| 106 | + width: 100%; | ||
| 107 | + height: 100vh; | ||
| 108 | + } | ||
| 109 | +</style> |
| @@ -306,9 +306,9 @@ | @@ -306,9 +306,9 @@ | ||
| 306 | :loading="loading" clearable placeholder="请选择"> | 306 | :loading="loading" clearable placeholder="请选择"> |
| 307 | <el-option | 307 | <el-option |
| 308 | v-for="item in usernames" | 308 | v-for="item in usernames" |
| 309 | - :key="item.username" | ||
| 310 | - :label="item.username" | ||
| 311 | - :value="item.username" | 309 | + :key="item.departmentid" |
| 310 | + :label="item.departmentid" | ||
| 311 | + :value="item.departmentid" | ||
| 312 | :disabled="item.disabled"> | 312 | :disabled="item.disabled"> |
| 313 | </el-option> | 313 | </el-option> |
| 314 | </el-select> | 314 | </el-select> |
| @@ -514,12 +514,10 @@ | @@ -514,12 +514,10 @@ | ||
| 514 | }, | 514 | }, |
| 515 | //获取用户名 | 515 | //获取用户名 |
| 516 | getUsers:function() { | 516 | getUsers:function() { |
| 517 | - let para = {}; | 517 | + let para = {pageSize:1,pageNum:10000}; |
| 518 | this.listLoading = true; | 518 | this.listLoading = true; |
| 519 | getUserList(para).then((res) => { | 519 | getUserList(para).then((res) => { |
| 520 | - let response = res.data.data; | ||
| 521 | - console.log(response) | ||
| 522 | - this.usernames=res.data.data.list; | 520 | + this.usernames = res.data.data.list; |
| 523 | }).catch((error) => { | 521 | }).catch((error) => { |
| 524 | this.$message.error(error.toString()); | 522 | this.$message.error(error.toString()); |
| 525 | }); | 523 | }); |
-
请 注册 或 登录 后发表评论