Browse Source

🚑 交接点没有地图数据也能展示处理

master
wangxiang 3 years ago
parent
commit
0d755823ed
  1. 11
      src/components/AMap/src/AMapDesigner/index.vue

11
src/components/AMap/src/AMapDesigner/index.vue

@ -633,7 +633,7 @@ @@ -633,7 +633,7 @@
mapState.mapData.courierUserName = courierUserMap.label;
mapState.mapData.courierLng = courierUserMap.mapLng;
mapState.mapData.courierLat = courierUserMap.mapLat;
drawMapNavigate(concat(mapState.mapData.mapLogisticPoint, mapState.mapData.mapTaskPresetLogisticPoint));
handleMapPointGenerate();
} else notification.warn({
message: '查找不到起点数据,请检查起点!',
duration: 2
@ -744,9 +744,9 @@ @@ -744,9 +744,9 @@
/** 绘制地图导航路线 */
function drawMapNavigate(points: MapLogisticPoint[] = []) {
debugger
if (isEmpty(points) && mapState.mapData.courierUserId && mapState.mapData.courierLng && mapState.mapData.courierLat)
throw console.warn('检查到当前起点数据为空或标记点集合为空,请选择起点!');
points = points.filter(item => item.lng && item.lat);
if (points.length > 0 && mapState.mapData.courierLng && mapState.mapData.courierLat) {
const lngLats = points.map(item => new AMap.LngLat(item.lng, item.lat));
const destination = lngLats.pop();
destination && driving.search(new AMap.LngLat(mapState.mapData.courierLng, mapState.mapData.courierLat), destination, {
@ -758,11 +758,11 @@ @@ -758,11 +758,11 @@
});
});
}
}
/** 处理地图标记点生成 */
async function handleMapPointGenerate() {
setTableData(mapState.mapData.mapTask);
if (mapState.mapData.courierUserId) {
const pointData:MapLogisticPoint[] = [];
mapState.mapData.mapTask.forEach(item => {
const hospital = mapState.hospitalList.find(e => e.value == item.hospitalId),
@ -796,11 +796,12 @@ @@ -796,11 +796,12 @@
});
});
// ,
mapState.mapData.mapTaskPresetLogisticPoint = await getTaskPresetPointByCourierUserId(mapState.mapData.courierUserId);
pointData.forEach((item, index)=> item.sort = add(index, 1));
mapState.mapData.mapLogisticPoint = pointData;
mapState.mapData.courierUserId && (mapState.mapData.mapTaskPresetLogisticPoint = await getTaskPresetPointByCourierUserId(mapState.mapData.courierUserId));
drawMapNavigate(concat(mapState.mapData.mapLogisticPoint, mapState.mapData.mapTaskPresetLogisticPoint));
}
}
/** 处理地图标记点数据 */
function handleMapPoint(mapLogisticPoint: MapLogisticPoint[] = []) {

Loading…
Cancel
Save