|
|
@ -82,7 +82,10 @@ |
|
|
|
/> |
|
|
|
/> |
|
|
|
</AFormItem> |
|
|
|
</AFormItem> |
|
|
|
<AFormItem label="起点" name="courierUserId"> |
|
|
|
<AFormItem label="起点" name="courierUserId"> |
|
|
|
<ASelect v-model:value="mapState.mapData.courierUserId" :options="mapState.courierUserList"/> |
|
|
|
<ASelect v-model:value="mapState.mapData.courierUserId" |
|
|
|
|
|
|
|
:options="mapState.courierUserList" |
|
|
|
|
|
|
|
@select="handleCourierUserData" |
|
|
|
|
|
|
|
/> |
|
|
|
</AFormItem> |
|
|
|
</AFormItem> |
|
|
|
<AFormItem label="文件" name="fileId"> |
|
|
|
<AFormItem label="文件" name="fileId"> |
|
|
|
<BasicUpload v-model:value="mapState.mapData.fileId" |
|
|
|
<BasicUpload v-model:value="mapState.mapData.fileId" |
|
|
@ -130,6 +133,8 @@ |
|
|
|
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'; |
|
|
|
|
|
|
|
import { useMessage } from '/@/hooks/web/useMessage'; |
|
|
|
|
|
|
|
import { listMapTaskPreset } from '/@/api/platform/common/controller/mapTaskPreset'; |
|
|
|
|
|
|
|
|
|
|
|
/** 类型规范统一声明定义区域 */ |
|
|
|
/** 类型规范统一声明定义区域 */ |
|
|
|
interface MapState { |
|
|
|
interface MapState { |
|
|
@ -159,8 +164,10 @@ |
|
|
|
let courierUserMarkerCluster; |
|
|
|
let courierUserMarkerCluster; |
|
|
|
let scanCourierUserCircleRange; |
|
|
|
let scanCourierUserCircleRange; |
|
|
|
let driving; |
|
|
|
let driving; |
|
|
|
|
|
|
|
|
|
|
|
const userStore = useUserStore(); |
|
|
|
const userStore = useUserStore(); |
|
|
|
const instance = getCurrentInstance(); |
|
|
|
const instance = getCurrentInstance(); |
|
|
|
|
|
|
|
const { createMessage } = useMessage(); |
|
|
|
const { mapDesigner } = componentSetting; |
|
|
|
const { mapDesigner } = componentSetting; |
|
|
|
const mapState = reactive<MapState>({ |
|
|
|
const mapState = reactive<MapState>({ |
|
|
|
/** 遮罩层状态 */ |
|
|
|
/** 遮罩层状态 */ |
|
|
@ -236,7 +243,7 @@ |
|
|
|
const ASelect = Select; |
|
|
|
const ASelect = Select; |
|
|
|
const ATooltip = Tooltip; |
|
|
|
const ATooltip = Tooltip; |
|
|
|
const formElRef = ref(); |
|
|
|
const formElRef = ref(); |
|
|
|
const [registerTable, { reload }] = useTable({ |
|
|
|
const [registerTable, { setTableData }] = useTable({ |
|
|
|
title: '任务列表', |
|
|
|
title: '任务列表', |
|
|
|
rowKey: 'id', |
|
|
|
rowKey: 'id', |
|
|
|
dataSource: mapState.mapData?.mapTask, |
|
|
|
dataSource: mapState.mapData?.mapTask, |
|
|
@ -273,8 +280,8 @@ |
|
|
|
label: item.nickName, |
|
|
|
label: item.nickName, |
|
|
|
mapOrientation: item.mapOrientation, |
|
|
|
mapOrientation: item.mapOrientation, |
|
|
|
// todo: 采用SSE服务器发生事件技术刷新安卓GPS位置 |
|
|
|
// todo: 采用SSE服务器发生事件技术刷新安卓GPS位置 |
|
|
|
mapLat: 0, |
|
|
|
mapLat: 28.295114, |
|
|
|
mapLng: 0 |
|
|
|
mapLng: 112.913864 |
|
|
|
})); |
|
|
|
})); |
|
|
|
}); |
|
|
|
}); |
|
|
|
listOrg({ size: 40 }).then(res => { |
|
|
|
listOrg({ size: 40 }).then(res => { |
|
|
@ -557,19 +564,33 @@ |
|
|
|
destinationPosition = destinationMarker.getPosition(); |
|
|
|
destinationPosition = destinationMarker.getPosition(); |
|
|
|
return Math.round(hospitalPosition.distance(originPosition)) - Math.round(hospitalPosition.distance(destinationPosition)); |
|
|
|
return Math.round(hospitalPosition.distance(originPosition)) - Math.round(hospitalPosition.distance(destinationPosition)); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
mapState.mapData.sendOrderName = hospitalMap.label; |
|
|
|
console.warn('查找不到发单点数据,请检查发单点!'); |
|
|
|
mapState.mapData.sendOrderLng = hospitalMap.mapLng; |
|
|
|
|
|
|
|
mapState.mapData.sendOrderLat = hospitalMap.mapLat; |
|
|
|
|
|
|
|
} else console.warn('查找不到发单点数据,请检查发单点!'); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 处理起点收样员数据 */ |
|
|
|
|
|
|
|
function handleCourierUserData(value) { |
|
|
|
|
|
|
|
const courierUserMap = mapState.courierUserList.find(item => item.value == value); |
|
|
|
|
|
|
|
if (courierUserMap) { |
|
|
|
|
|
|
|
mapState.mapData.courierUserName = courierUserMap.label; |
|
|
|
|
|
|
|
mapState.mapData.courierLng = courierUserMap.mapLng; |
|
|
|
|
|
|
|
mapState.mapData.courierLat = courierUserMap.mapLat; |
|
|
|
|
|
|
|
} else console.warn('查找不到起点数据,请检查起点!'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** 处理打开任务配置 */ |
|
|
|
/** 处理打开任务配置 */ |
|
|
|
function handleOpenTask() { |
|
|
|
async function handleOpenTask() { |
|
|
|
|
|
|
|
await formElRef.value.validate(); |
|
|
|
openModal(true, { mapData: mapState.mapData }); |
|
|
|
openModal(true, { mapData: mapState.mapData }); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** 处理打开地图标记点配置 */ |
|
|
|
/** 处理打开地图标记点配置 */ |
|
|
|
function handleOpenMapPoint() { |
|
|
|
async function handleOpenMapPoint() { |
|
|
|
mapPointOpenModal(true, { }); |
|
|
|
await formElRef.value.validate(); |
|
|
|
|
|
|
|
mapPointOpenModal(true, { mapData: mapState.mapData }); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** 处理地图放大 */ |
|
|
|
/** 处理地图放大 */ |
|
|
@ -582,14 +603,70 @@ |
|
|
|
map.zoomOut(); |
|
|
|
map.zoomOut(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** 处理地图保存并发布 */ |
|
|
|
|
|
|
|
function handleMapSave() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 处理地图任务数据 */ |
|
|
|
/** 处理地图任务数据 */ |
|
|
|
function handleMapTask() { |
|
|
|
async function handleMapTask() { |
|
|
|
|
|
|
|
setTableData(mapState.mapData.mapTask); |
|
|
|
|
|
|
|
// 生成标记点数据 |
|
|
|
|
|
|
|
const pointData:Recordable[] = []; |
|
|
|
|
|
|
|
mapState.mapData.mapTask.forEach(item => { |
|
|
|
|
|
|
|
const hospital = mapState.hospitalList.find(e => e.value == item.hospitalId); |
|
|
|
|
|
|
|
const org = mapState.orgList.find(e => e.value == item.orgId); |
|
|
|
|
|
|
|
// 下级医院必选,没有数据说明数据被更新过了 |
|
|
|
|
|
|
|
if (!hospital) { |
|
|
|
|
|
|
|
createMessage.error('当前机构数据或者医院数据已经更新,请重新刷新页面!'); |
|
|
|
|
|
|
|
throw Error('当前机构数据或者医院数据已经更新,请重新刷新页面!'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
pointData.push({ |
|
|
|
|
|
|
|
lng: hospital.mapLng, |
|
|
|
|
|
|
|
lat: hospital.mapLat, |
|
|
|
|
|
|
|
sort: undefined, |
|
|
|
|
|
|
|
type: '0', |
|
|
|
|
|
|
|
hospitalId: hospital.value, |
|
|
|
|
|
|
|
hospitalName: hospital.label |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
org && pointData.push({ |
|
|
|
|
|
|
|
lng: org.mapLng, |
|
|
|
|
|
|
|
lat: org.mapLat, |
|
|
|
|
|
|
|
sort: undefined, |
|
|
|
|
|
|
|
type: '1', |
|
|
|
|
|
|
|
hospitalId: org.value, |
|
|
|
|
|
|
|
hospitalName: org.label |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
// 查找并添加与自己有关的交接预设任务,只能添加设置了位置的标记点 |
|
|
|
|
|
|
|
await listMapTaskPreset({ size: 40, courierUserId: mapState.mapData.courierUserId }).then(res => { |
|
|
|
|
|
|
|
res.data?.map(item => { |
|
|
|
|
|
|
|
(item.orginPresetLng && item.orginPresetLat) && pointData.push({ |
|
|
|
|
|
|
|
lng: item.orginPresetLng, |
|
|
|
|
|
|
|
lat: item.orginPresetLat, |
|
|
|
|
|
|
|
sort: undefined, |
|
|
|
|
|
|
|
type: '0', |
|
|
|
|
|
|
|
hospitalId: item.orginPresetId, |
|
|
|
|
|
|
|
hospitalName: item.orginPresetName |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
(item.destinationPresetLng && item.destinationPresetLat) && pointData.push({ |
|
|
|
|
|
|
|
lng: item.destinationPresetLng, |
|
|
|
|
|
|
|
lat: item.destinationPresetLat, |
|
|
|
|
|
|
|
sort: undefined, |
|
|
|
|
|
|
|
type: '0', |
|
|
|
|
|
|
|
hospitalId: item.destinationPresetId, |
|
|
|
|
|
|
|
hospitalName: item.destinationPresetName |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
mapState.mapData.mapLogisticPoint = pointData; |
|
|
|
|
|
|
|
const lngLatData = pointData.map(item => new AMap.LngLat(item.lng, item.lat)); |
|
|
|
|
|
|
|
const last = lngLatData.pop(); |
|
|
|
|
|
|
|
// 重新导航路线 |
|
|
|
|
|
|
|
driving.search(new AMap.LngLat(mapState.mapData.courierLng, mapState.mapData.courierLat), last, { |
|
|
|
|
|
|
|
waypoints: lngLatData |
|
|
|
|
|
|
|
}, function(status, result) { |
|
|
|
|
|
|
|
if (status === 'complete') { |
|
|
|
|
|
|
|
console.log('绘制驾车路线完成'); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
console.error('获取驾车数据失败:' + result); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** 处理地图标记点数据 */ |
|
|
|
/** 处理地图标记点数据 */ |
|
|
@ -597,6 +674,11 @@ |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 处理地图保存并发布 */ |
|
|
|
|
|
|
|
function handleMapSave() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** 处理地图重置 */ |
|
|
|
/** 处理地图重置 */ |
|
|
|
function handleMapReset() { |
|
|
|
function handleMapReset() { |
|
|
|
// 清除地图 |
|
|
|
// 清除地图 |
|
|
@ -605,9 +687,16 @@ |
|
|
|
// 清除表单数据 |
|
|
|
// 清除表单数据 |
|
|
|
formElRef.value.resetFields(); |
|
|
|
formElRef.value.resetFields(); |
|
|
|
formElRef.value.clearValidate(); |
|
|
|
formElRef.value.clearValidate(); |
|
|
|
// 清除任务数据 |
|
|
|
// 清除地图数据 |
|
|
|
|
|
|
|
mapState.mapData.courierUserName = ''; |
|
|
|
|
|
|
|
mapState.mapData.courierLng = undefined; |
|
|
|
|
|
|
|
mapState.mapData.courierLat = undefined; |
|
|
|
|
|
|
|
mapState.mapData.sendOrderName = ''; |
|
|
|
|
|
|
|
mapState.mapData.sendOrderLng = undefined; |
|
|
|
|
|
|
|
mapState.mapData.sendOrderLat = undefined; |
|
|
|
mapState.mapData.mapTask = []; |
|
|
|
mapState.mapData.mapTask = []; |
|
|
|
mapState.mapData.mapLogisticPoint = []; |
|
|
|
mapState.mapData.mapLogisticPoint = []; |
|
|
|
|
|
|
|
setTableData([]); |
|
|
|
// 重置地图画布 |
|
|
|
// 重置地图画布 |
|
|
|
map.setZoomAndCenter(mapState.mapConfig.options.zoom, mapState.mapConfig.options.center); |
|
|
|
map.setZoomAndCenter(mapState.mapConfig.options.zoom, mapState.mapConfig.options.center); |
|
|
|
mapState.defaultZoom = mapState.mapConfig.options.zoom; |
|
|
|
mapState.defaultZoom = mapState.mapConfig.options.zoom; |
|
|
|