|
|
@ -121,6 +121,7 @@ |
|
|
|
import { MapLogisticPoint } from '/@/api/platform/common/entity/mapLogisticPoint'; |
|
|
|
import { MapLogisticPoint } from '/@/api/platform/common/entity/mapLogisticPoint'; |
|
|
|
import { isArray, isString } from '/@/utils/is'; |
|
|
|
import { isArray, isString } from '/@/utils/is'; |
|
|
|
import { useI18n } from '/@/hooks/web/useI18n'; |
|
|
|
import { useI18n } from '/@/hooks/web/useI18n'; |
|
|
|
|
|
|
|
import { watchDebounced } from '@vueuse/core'; |
|
|
|
|
|
|
|
|
|
|
|
/** 类型规范统一声明定义区域 */ |
|
|
|
/** 类型规范统一声明定义区域 */ |
|
|
|
interface MapState { |
|
|
|
interface MapState { |
|
|
@ -483,10 +484,8 @@ |
|
|
|
map.on('complete', () => { |
|
|
|
map.on('complete', () => { |
|
|
|
setMapDataJson(mapProps.options); |
|
|
|
setMapDataJson(mapProps.options); |
|
|
|
handleSetCourierUserList(); |
|
|
|
handleSetCourierUserList(); |
|
|
|
nextTick(() => { |
|
|
|
mapState.loading = false; |
|
|
|
mapState.loading = false; |
|
|
|
mapState.first = true; |
|
|
|
mapState.first = true; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -504,14 +503,14 @@ |
|
|
|
handleSetCourierUserList(); |
|
|
|
handleSetCourierUserList(); |
|
|
|
} |
|
|
|
} |
|
|
|
}, { deep: true }); |
|
|
|
}, { deep: true }); |
|
|
|
watch([() => toRefs(mapProps).isEdit, () => mapState.mapData.courierUserId], () => { |
|
|
|
watch(toRefs(mapProps).isEdit, () => { |
|
|
|
if (mapState.first) { |
|
|
|
if (mapState.first) { |
|
|
|
handleSetCourierUserList(); |
|
|
|
handleSetCourierUserList(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
watch([() => mapState.mapData.sendOrderId, () => mapState.mapData.sendOrderTaskType], |
|
|
|
watchDebounced([() => mapState.mapData.sendOrderId, () => mapState.mapData.sendOrderTaskType], |
|
|
|
([sendOrderIdValue,sendOrderTaskTypeValue], [sendOrderIdOldValue, sendOrderTaskTypeOldValue]) => { |
|
|
|
([sendOrderIdValue,sendOrderTaskTypeValue], [sendOrderIdOldValue, sendOrderTaskTypeOldValue]) => { |
|
|
|
if (!sendOrderIdValue || !sendOrderTaskTypeValue || !mapState.first) return false; |
|
|
|
if (!sendOrderIdValue || !sendOrderTaskTypeValue) return false; |
|
|
|
if (isEmpty(mapState.mapData.mapTask)) { |
|
|
|
if (isEmpty(mapState.mapData.mapTask)) { |
|
|
|
mapState.mapData.mapTask.push({ |
|
|
|
mapState.mapData.mapTask.push({ |
|
|
|
name: '系统创建:发单任务', |
|
|
|
name: '系统创建:发单任务', |
|
|
@ -548,7 +547,7 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
handleMapPointGenerate(); |
|
|
|
handleMapPointGenerate(); |
|
|
|
}); |
|
|
|
}, { debounce: 200 }); |
|
|
|
|
|
|
|
|
|
|
|
/** 处理切换操作面板 */ |
|
|
|
/** 处理切换操作面板 */ |
|
|
|
function toggleOperatePanel() { |
|
|
|
function toggleOperatePanel() { |
|
|
@ -577,7 +576,7 @@ |
|
|
|
mapLat: 28.295114, |
|
|
|
mapLat: 28.295114, |
|
|
|
mapLng: 112.913864 |
|
|
|
mapLng: 112.913864 |
|
|
|
})); |
|
|
|
})); |
|
|
|
// 新增时查询没有地图任务的快递员,渲染能创建地图的快递员收样图标 |
|
|
|
// 新增时查询没有地图任务的快递员,渲染能创建地图的快递员收样图标 |
|
|
|
}) : await getCourierUserList().then(res => { |
|
|
|
}) : await getCourierUserList().then(res => { |
|
|
|
mapState.courierUserList = res?.map(item => ({ |
|
|
|
mapState.courierUserList = res?.map(item => ({ |
|
|
|
value: item.id, |
|
|
|
value: item.id, |
|
|
@ -746,11 +745,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
/** 绘制地图导航路线 */ |
|
|
|
/** 绘制地图导航路线 */ |
|
|
|
function drawMapNavigate(points: MapLogisticPoint[] = []) { |
|
|
|
function drawMapNavigate(points: MapLogisticPoint[] = []) { |
|
|
|
if (isEmpty(points) && mapState.mapData.courierUserId && mapState.mapData.courierLng && mapState.mapData.courierLat) return notification.warn({ |
|
|
|
if (isEmpty(points) && mapState.mapData.courierUserId && mapState.mapData.courierLng && mapState.mapData.courierLat) return false; |
|
|
|
message: '检查到当前起点数据为空或标记点集合为空,请先选择起点跟发单!', |
|
|
|
|
|
|
|
duration: 2, |
|
|
|
|
|
|
|
placement: 'topLeft' |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
points = points.filter(item => item.lng && item.lat); |
|
|
|
points = points.filter(item => item.lng && item.lat); |
|
|
|
const lngLats = points.map(item => new AMap.LngLat(item.lng, item.lat)); |
|
|
|
const lngLats = points.map(item => new AMap.LngLat(item.lng, item.lat)); |
|
|
|
const destination = lngLats.pop(); |
|
|
|
const destination = lngLats.pop(); |
|
|
|