|
|
@ -97,7 +97,7 @@ |
|
|
|
import { listUser } from '/@/api/platform/system/controller/user'; |
|
|
|
import { listUser } from '/@/api/platform/system/controller/user'; |
|
|
|
import { listOrg } from '/@/api/platform/common/controller/org'; |
|
|
|
import { listOrg } from '/@/api/platform/common/controller/org'; |
|
|
|
import { useUserStore } from '/@/store/modules/user'; |
|
|
|
import { useUserStore } from '/@/store/modules/user'; |
|
|
|
import { split, divide, subtract, merge, isEmpty, cloneDeep, add } from 'lodash-es'; |
|
|
|
import { split, divide, subtract, merge, isEmpty, cloneDeep, add, omit } from 'lodash-es'; |
|
|
|
import componentSetting from '/@/settings/componentSetting'; |
|
|
|
import componentSetting from '/@/settings/componentSetting'; |
|
|
|
import { BasicUpload } from '/@/components/Upload'; |
|
|
|
import { BasicUpload } from '/@/components/Upload'; |
|
|
|
import { commonUpload } from '/@/api/platform/core/controller/upload'; |
|
|
|
import { commonUpload } from '/@/api/platform/core/controller/upload'; |
|
|
@ -607,16 +607,19 @@ |
|
|
|
|
|
|
|
|
|
|
|
/** 绘制地图导航路线 */ |
|
|
|
/** 绘制地图导航路线 */ |
|
|
|
function drawMapNavigate(points: Recordable[] = []) { |
|
|
|
function drawMapNavigate(points: Recordable[] = []) { |
|
|
|
const lngLats = points.map(item => new AMap.LngLat(item.lng, item.lat)); |
|
|
|
points = points.filter(item => item.lng && item.lat); |
|
|
|
const destination = lngLats.pop(); |
|
|
|
if (points.length > 0 && mapState.mapData.courierLng && mapState.mapData.courierLat) { |
|
|
|
destination && driving.search(new AMap.LngLat(mapState.mapData.courierLng, mapState.mapData.courierLat), destination, { |
|
|
|
const lngLats = points.map(item => new AMap.LngLat(item.lng, item.lat)); |
|
|
|
waypoints: lngLats |
|
|
|
const destination = lngLats.pop(); |
|
|
|
}, function(status, result) { |
|
|
|
destination && driving.search(new AMap.LngLat(mapState.mapData.courierLng, mapState.mapData.courierLat), destination, { |
|
|
|
notification.success({ |
|
|
|
waypoints: lngLats |
|
|
|
message: status === 'complete' ? '绘制地图路线完成!' : `获取地图数据失败:${result}`, |
|
|
|
}, function(status, result) { |
|
|
|
duration: 2 |
|
|
|
notification.success({ |
|
|
|
|
|
|
|
message: status === 'complete' ? '绘制地图路线完成!' : `获取地图数据失败:${result}`, |
|
|
|
|
|
|
|
duration: 2 |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** 处理地图任务数据 */ |
|
|
|
/** 处理地图任务数据 */ |
|
|
@ -625,57 +628,53 @@ |
|
|
|
// 生成标记点数据 |
|
|
|
// 生成标记点数据 |
|
|
|
const pointData:Recordable[] = []; |
|
|
|
const pointData:Recordable[] = []; |
|
|
|
mapState.mapData.mapTask.forEach(item => { |
|
|
|
mapState.mapData.mapTask.forEach(item => { |
|
|
|
const hospital = mapState.hospitalList.find(e => e.value == item.hospitalId); |
|
|
|
const hospital = mapState.hospitalList.find(e => e.value == item.hospitalId), |
|
|
|
const org = mapState.orgList.find(e => e.value == item.orgId); |
|
|
|
org = mapState.orgList.find(e => e.value == item.orgId); |
|
|
|
// 下级医院必选,所以必须查到,没有数据说明数据被更新过了 |
|
|
|
// 下级医院必选,也不能由收样员设置交接位置,所以必须查到,没有数据说明数据被更新过了 |
|
|
|
if (!hospital) { |
|
|
|
if (!hospital) { |
|
|
|
throw notification.error({ |
|
|
|
throw notification.error({ |
|
|
|
message: '当前机构数据或者医院数据已经更新,请重新刷新页面!', |
|
|
|
message: '当前机构数据或者医院数据已经更新,请重新刷新页面!', |
|
|
|
duration: 2 |
|
|
|
duration: 2 |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
pointData.push({ |
|
|
|
pointData.push(omit(merge(item, { |
|
|
|
lng: hospital.mapLng, |
|
|
|
lng: hospital.mapLng, |
|
|
|
lat: hospital.mapLat, |
|
|
|
lat: hospital.mapLat, |
|
|
|
sort: undefined, |
|
|
|
|
|
|
|
type: '0', |
|
|
|
type: '0', |
|
|
|
key: item.key, |
|
|
|
key: item.key, |
|
|
|
taskType: item.taskType, |
|
|
|
taskType: item.taskType, |
|
|
|
hospitalId: hospital.value, |
|
|
|
hospitalId: hospital.value, |
|
|
|
hospitalName: hospital.label |
|
|
|
hospitalName: hospital.label |
|
|
|
}); |
|
|
|
}), 'id'), omit(merge(item, { |
|
|
|
org && pointData.push({ |
|
|
|
lng: org?.mapLng, |
|
|
|
lng: org.mapLng, |
|
|
|
lat: org?.mapLat, |
|
|
|
lat: org.mapLat, |
|
|
|
|
|
|
|
sort: undefined, |
|
|
|
|
|
|
|
type: '1', |
|
|
|
type: '1', |
|
|
|
key: item.key, |
|
|
|
key: item.key, |
|
|
|
taskType: item.taskType, |
|
|
|
taskType: item.taskType, |
|
|
|
hospitalId: org.value, |
|
|
|
hospitalId: org?.value, |
|
|
|
hospitalName: org.label |
|
|
|
hospitalName: org?.label |
|
|
|
}); |
|
|
|
}), 'id')); |
|
|
|
}); |
|
|
|
}); |
|
|
|
// 查找并添加与自己有关的交接预设任务,只能添加设置了位置的标记点 |
|
|
|
// 查找并添加与自己有关的交接预设任务,只能添加设置了位置的标记点 |
|
|
|
await listMapTaskPreset({ size: 40, courierUserId: mapState.mapData.courierUserId }).then(res => { |
|
|
|
await listMapTaskPreset({ size: 40, courierUserId: mapState.mapData.courierUserId }).then(res => { |
|
|
|
res.data?.map(item => { |
|
|
|
res.data?.map(item => { |
|
|
|
(item.orginPresetLng && item.orginPresetLat) && pointData.push({ |
|
|
|
pointData.push(omit(merge(item, { |
|
|
|
lng: item.orginPresetLng, |
|
|
|
lng: item.orginPresetLng, |
|
|
|
lat: item.orginPresetLat, |
|
|
|
lat: item.orginPresetLat, |
|
|
|
sort: undefined, |
|
|
|
|
|
|
|
type: '0', |
|
|
|
type: '0', |
|
|
|
key: item.key, |
|
|
|
taskType: '1', |
|
|
|
|
|
|
|
mapTaskId: item.id, |
|
|
|
hospitalId: item.orginPresetId, |
|
|
|
hospitalId: item.orginPresetId, |
|
|
|
hospitalName: item.orginPresetName |
|
|
|
hospitalName: item.orginPresetName |
|
|
|
}); |
|
|
|
}), 'id'), omit(merge(item, { |
|
|
|
(item.destinationPresetLng && item.destinationPresetLat) && pointData.push({ |
|
|
|
|
|
|
|
lng: item.destinationPresetLng, |
|
|
|
lng: item.destinationPresetLng, |
|
|
|
lat: item.destinationPresetLat, |
|
|
|
lat: item.destinationPresetLat, |
|
|
|
sort: undefined, |
|
|
|
type: '1', |
|
|
|
type: '0', |
|
|
|
taskType: '1', |
|
|
|
key: item.key, |
|
|
|
mapTaskId: item.id, |
|
|
|
hospitalId: item.destinationPresetId, |
|
|
|
hospitalId: item.destinationPresetId, |
|
|
|
hospitalName: item.destinationPresetName |
|
|
|
hospitalName: item.destinationPresetName |
|
|
|
}); |
|
|
|
}), 'id')); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
pointData.forEach((item, index)=> { item.sort = add(index, 1); }); |
|
|
|
pointData.forEach((item, index)=> { item.sort = add(index, 1); }); |
|
|
|