|
|
@ -106,7 +106,7 @@ |
|
|
|
import { getCourierUserList } from '/@/api/platform/system/controller/user'; |
|
|
|
import { getCourierUserList } 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, omit} from 'lodash-es'; |
|
|
|
import { split, divide, subtract, merge, isEmpty, cloneDeep, add } 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'; |
|
|
@ -118,6 +118,7 @@ |
|
|
|
import { MapLogistic } from '/@/api/platform/common/entity/mapLogistic'; |
|
|
|
import { MapLogistic } from '/@/api/platform/common/entity/mapLogistic'; |
|
|
|
import { buildUUID } from '/@/utils/uuid'; |
|
|
|
import { buildUUID } from '/@/utils/uuid'; |
|
|
|
import { RuleObject } from 'ant-design-vue/es/form/interface'; |
|
|
|
import { RuleObject } from 'ant-design-vue/es/form/interface'; |
|
|
|
|
|
|
|
import { MapLogisticPoint } from '/@/api/platform/common/entity/mapLogisticPoint'; |
|
|
|
|
|
|
|
|
|
|
|
/** 类型规范统一声明定义区域 */ |
|
|
|
/** 类型规范统一声明定义区域 */ |
|
|
|
interface MapState { |
|
|
|
interface MapState { |
|
|
@ -351,7 +352,7 @@ |
|
|
|
const { lnglat } = ctx; |
|
|
|
const { lnglat } = ctx; |
|
|
|
map.setZoomAndCenter(18, lnglat); |
|
|
|
map.setZoomAndCenter(18, lnglat); |
|
|
|
}); |
|
|
|
}); |
|
|
|
const orgPoints = mapState.orgList.map((org: any) => ({ |
|
|
|
const orgPoints = mapState.orgList.map(org => ({ |
|
|
|
lnglat: [org.mapLng, org.mapLat], ...org |
|
|
|
lnglat: [org.mapLng, org.mapLat], ...org |
|
|
|
})); |
|
|
|
})); |
|
|
|
orgMarkerCluster?.setData(orgPoints); |
|
|
|
orgMarkerCluster?.setData(orgPoints); |
|
|
@ -401,7 +402,7 @@ |
|
|
|
const { lnglat } = ctx; |
|
|
|
const { lnglat } = ctx; |
|
|
|
map.setZoomAndCenter(18, lnglat); |
|
|
|
map.setZoomAndCenter(18, lnglat); |
|
|
|
}); |
|
|
|
}); |
|
|
|
const hospitalPoints = mapState.hospitalList.map((hospital: any) => ({ |
|
|
|
const hospitalPoints = mapState.hospitalList.map(hospital => ({ |
|
|
|
lnglat: [hospital.mapLng, hospital.mapLat], ...hospital |
|
|
|
lnglat: [hospital.mapLng, hospital.mapLat], ...hospital |
|
|
|
})); |
|
|
|
})); |
|
|
|
hospitalMarkerCluster?.setData(hospitalPoints); |
|
|
|
hospitalMarkerCluster?.setData(hospitalPoints); |
|
|
@ -445,7 +446,7 @@ |
|
|
|
const { lnglat } = ctx; |
|
|
|
const { lnglat } = ctx; |
|
|
|
map.setZoomAndCenter(18, lnglat); |
|
|
|
map.setZoomAndCenter(18, lnglat); |
|
|
|
}); |
|
|
|
}); |
|
|
|
const courierUserPoints = mapState.courierUserList.map((courierUser: any) => ({ |
|
|
|
const courierUserPoints = mapState.courierUserList.map(courierUser => ({ |
|
|
|
lnglat: [courierUser.mapLng, courierUser.mapLat], ...courierUser |
|
|
|
lnglat: [courierUser.mapLng, courierUser.mapLat], ...courierUser |
|
|
|
})); |
|
|
|
})); |
|
|
|
courierUserMarkerCluster?.setData(courierUserPoints); |
|
|
|
courierUserMarkerCluster?.setData(courierUserPoints); |
|
|
@ -502,7 +503,7 @@ |
|
|
|
if (!mapProps.sidebarControl) mapState.toggleOperatePanelClass.siderWidth = 0; |
|
|
|
if (!mapProps.sidebarControl) mapState.toggleOperatePanelClass.siderWidth = 0; |
|
|
|
if (!mapProps.toolbarControl) mapState.toggleOperatePanelClass.toolbarHeight = 0; |
|
|
|
if (!mapProps.toolbarControl) mapState.toggleOperatePanelClass.toolbarHeight = 0; |
|
|
|
}); |
|
|
|
}); |
|
|
|
watch(toRefs(mapProps).options, (newValue) => { |
|
|
|
watch(toRefs(mapProps).options, (newValue: MapLogistic) => { |
|
|
|
setMapDataJson(newValue); |
|
|
|
setMapDataJson(newValue); |
|
|
|
}, { |
|
|
|
}, { |
|
|
|
immediate: true, |
|
|
|
immediate: true, |
|
|
@ -564,9 +565,9 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** 处理收样员搜索 */ |
|
|
|
/** 处理收样员搜索 */ |
|
|
|
function handleCourierUserSearch(value) { |
|
|
|
function handleCourierUserSearch(hospitalId: string) { |
|
|
|
// 查找当前下级医院数据 |
|
|
|
// 查找当前下级医院数据 |
|
|
|
const hospitalMap = mapState.hospitalList.find(item => item.value == value); |
|
|
|
const hospitalMap = mapState.hospitalList.find(item => item.value == hospitalId); |
|
|
|
if (hospitalMap) { |
|
|
|
if (hospitalMap) { |
|
|
|
map.remove(scanCourierUserCircleRange || {}); |
|
|
|
map.remove(scanCourierUserCircleRange || {}); |
|
|
|
scanCourierUserCircleRange.setCenter([hospitalMap.mapLng, hospitalMap.mapLat]); |
|
|
|
scanCourierUserCircleRange.setCenter([hospitalMap.mapLng, hospitalMap.mapLat]); |
|
|
@ -650,8 +651,8 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** 设置地图数据json */ |
|
|
|
/** 设置地图数据json */ |
|
|
|
function setMapDataJson(data) { |
|
|
|
function setMapDataJson(mapData: MapLogistic) { |
|
|
|
let options = data; |
|
|
|
let options: Nullable<MapLogistic> = mapData; |
|
|
|
if (typeof options === 'string') { |
|
|
|
if (typeof options === 'string') { |
|
|
|
try { |
|
|
|
try { |
|
|
|
options = eval('(' + options + ')'); |
|
|
|
options = eval('(' + options + ')'); |
|
|
@ -660,7 +661,7 @@ |
|
|
|
message: '非法配置', |
|
|
|
message: '非法配置', |
|
|
|
duration: 2 |
|
|
|
duration: 2 |
|
|
|
}); |
|
|
|
}); |
|
|
|
options = {}; |
|
|
|
options = null; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
handleMapReset(); |
|
|
|
handleMapReset(); |
|
|
@ -678,13 +679,13 @@ |
|
|
|
return cloneDeep(mapState.mapData); |
|
|
|
return cloneDeep(mapState.mapData); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** 获取部件表单数据 */ |
|
|
|
/** 清除表单校验数据 */ |
|
|
|
function formClearValidate(fields: string[] | string) { |
|
|
|
function formClearValidate(fields: string[] | string) { |
|
|
|
return formElRef.value.clearValidate(fields); |
|
|
|
return formElRef.value.clearValidate(fields); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** 绘制地图导航路线 */ |
|
|
|
/** 绘制地图导航路线 */ |
|
|
|
function drawMapNavigate(points: Recordable[] = []) { |
|
|
|
function drawMapNavigate(points: MapLogisticPoint[] = []) { |
|
|
|
points = points.filter(item => item.lng && item.lat); |
|
|
|
points = points.filter(item => item.lng && item.lat); |
|
|
|
if (points.length > 0 && mapState.mapData.courierLng && mapState.mapData.courierLat) { |
|
|
|
if (points.length > 0 && mapState.mapData.courierLng && mapState.mapData.courierLat) { |
|
|
|
const lngLats = points.map(item => new AMap.LngLat(item.lng, item.lat)); |
|
|
|
const lngLats = points.map(item => new AMap.LngLat(item.lng, item.lat)); |
|
|
@ -703,7 +704,7 @@ |
|
|
|
/** 处理地图标记点生成 */ |
|
|
|
/** 处理地图标记点生成 */ |
|
|
|
async function handleMapPointGenerate() { |
|
|
|
async function handleMapPointGenerate() { |
|
|
|
setTableData(mapState.mapData.mapTask); |
|
|
|
setTableData(mapState.mapData.mapTask); |
|
|
|
const pointData:Recordable[] = []; |
|
|
|
const pointData:MapLogisticPoint[] = []; |
|
|
|
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), |
|
|
|
org = mapState.orgList.find(e => e.value == item.orgId); |
|
|
|
org = mapState.orgList.find(e => e.value == item.orgId); |
|
|
@ -761,7 +762,7 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** 处理地图标记点数据 */ |
|
|
|
/** 处理地图标记点数据 */ |
|
|
|
function handleMapPoint(mapLogisticPoint: Recordable[] = []) { |
|
|
|
function handleMapPoint(mapLogisticPoint: MapLogisticPoint[] = []) { |
|
|
|
if (!isEmpty(mapLogisticPoint)) { |
|
|
|
if (!isEmpty(mapLogisticPoint)) { |
|
|
|
mapState.mapData.mapLogisticPoint = mapLogisticPoint; |
|
|
|
mapState.mapData.mapLogisticPoint = mapLogisticPoint; |
|
|
|
drawMapNavigate(mapLogisticPoint); |
|
|
|
drawMapNavigate(mapLogisticPoint); |
|
|
@ -790,15 +791,15 @@ |
|
|
|
item.fileId = (item.fileId as [])?.join(','); |
|
|
|
item.fileId = (item.fileId as [])?.join(','); |
|
|
|
if (~~item.taskType == 1) { |
|
|
|
if (~~item.taskType == 1) { |
|
|
|
item?.mapTaskPreset?.forEach(childItem => { |
|
|
|
item?.mapTaskPreset?.forEach(childItem => { |
|
|
|
const childHospital = childItem.hospitalId && mapState.hospitalList.find(e => e.value == childItem.hospitalId), |
|
|
|
const childHospital = childItem.orginPresetId && mapState.hospitalList.find(e => e.value == childItem.orginPresetId), |
|
|
|
childOrg = childItem.orgId && mapState.orgList.find(e => e.value == childItem.orgId); |
|
|
|
childOrg = childItem.destinationPresetId && mapState.orgList.find(e => e.value == childItem.destinationPresetId); |
|
|
|
childItem.courierUserId = mapData.courierUserId; |
|
|
|
childItem.courierUserId = mapData.courierUserId; |
|
|
|
childHospital && Object.assign(item,{ |
|
|
|
childHospital && Object.assign(childItem,{ |
|
|
|
orginPresetName: childHospital.label, |
|
|
|
orginPresetName: childHospital.label, |
|
|
|
orginPresetLat: childHospital.mapLat, |
|
|
|
orginPresetLat: childHospital.mapLat, |
|
|
|
orginPresetLng: childHospital.mapLng |
|
|
|
orginPresetLng: childHospital.mapLng |
|
|
|
}); |
|
|
|
}); |
|
|
|
childOrg && Object.assign(item,{ |
|
|
|
childOrg && Object.assign(childItem,{ |
|
|
|
destinationPresetName: childOrg.label, |
|
|
|
destinationPresetName: childOrg.label, |
|
|
|
destinationPresetLng: childOrg.mapLng, |
|
|
|
destinationPresetLng: childOrg.mapLng, |
|
|
|
destinationPresetLat: childOrg.mapLat |
|
|
|
destinationPresetLat: childOrg.mapLat |
|
|
@ -839,7 +840,8 @@ |
|
|
|
defineExpose({ |
|
|
|
defineExpose({ |
|
|
|
drawMapNavigate, |
|
|
|
drawMapNavigate, |
|
|
|
getMapDataJson, |
|
|
|
getMapDataJson, |
|
|
|
setMapDataJson |
|
|
|
setMapDataJson, |
|
|
|
|
|
|
|
formClearValidate |
|
|
|
}); |
|
|
|
}); |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
<style lang="less" scoped> |
|
|
|
<style lang="less" scoped> |
|
|
|