|
|
@ -119,9 +119,11 @@ |
|
|
|
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'; |
|
|
|
import { MapLogisticPoint } from '/@/api/platform/common/entity/mapLogisticPoint'; |
|
|
|
|
|
|
|
import { isArray, isString } from '/@/utils/is'; |
|
|
|
|
|
|
|
|
|
|
|
/** 类型规范统一声明定义区域 */ |
|
|
|
/** 类型规范统一声明定义区域 */ |
|
|
|
interface MapState { |
|
|
|
interface MapState { |
|
|
|
|
|
|
|
first: boolean; |
|
|
|
loading: boolean; |
|
|
|
loading: boolean; |
|
|
|
defaultZoom: number; |
|
|
|
defaultZoom: number; |
|
|
|
toggleOperatePanelClass: Recordable; |
|
|
|
toggleOperatePanelClass: Recordable; |
|
|
@ -171,6 +173,8 @@ |
|
|
|
const { notification } = useMessage(); |
|
|
|
const { notification } = useMessage(); |
|
|
|
const { mapDesigner } = componentSetting; |
|
|
|
const { mapDesigner } = componentSetting; |
|
|
|
const mapState = reactive<MapState>({ |
|
|
|
const mapState = reactive<MapState>({ |
|
|
|
|
|
|
|
/** 首次初始化 */ |
|
|
|
|
|
|
|
first: false, |
|
|
|
/** 遮罩层状态 */ |
|
|
|
/** 遮罩层状态 */ |
|
|
|
loading: false, |
|
|
|
loading: false, |
|
|
|
/** 默认缩放大小 */ |
|
|
|
/** 默认缩放大小 */ |
|
|
@ -492,6 +496,8 @@ |
|
|
|
if (map) { |
|
|
|
if (map) { |
|
|
|
map.on('complete', () => { |
|
|
|
map.on('complete', () => { |
|
|
|
mapState.loading = false; |
|
|
|
mapState.loading = false; |
|
|
|
|
|
|
|
mapState.first = true; |
|
|
|
|
|
|
|
setMapDataJson(mapProps.options); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -503,12 +509,11 @@ |
|
|
|
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: MapLogistic) => { |
|
|
|
watch(toRefs(mapProps).options, (newValue) => { |
|
|
|
nextTick(() => setMapDataJson(newValue)); |
|
|
|
if (mapState.first) { |
|
|
|
}, { |
|
|
|
setMapDataJson(newValue); |
|
|
|
immediate: true, |
|
|
|
} |
|
|
|
deep: true |
|
|
|
}, { deep: true }); |
|
|
|
}); |
|
|
|
|
|
|
|
watch([() => mapState.mapData.sendOrderId, () => mapState.mapData.sendOrderTaskType], |
|
|
|
watch([() => mapState.mapData.sendOrderId, () => mapState.mapData.sendOrderTaskType], |
|
|
|
([sendOrderIdValue,sendOrderTaskTypeValue], [sendOrderIdOldValue, sendOrderTaskTypeOldValue]) => { |
|
|
|
([sendOrderIdValue,sendOrderTaskTypeValue], [sendOrderIdOldValue, sendOrderTaskTypeOldValue]) => { |
|
|
|
if (!sendOrderIdValue || !sendOrderTaskTypeValue) return; |
|
|
|
if (!sendOrderIdValue || !sendOrderTaskTypeValue) return; |
|
|
@ -547,7 +552,7 @@ |
|
|
|
mapState.mapData.mapTask = [...taskOrdinaryData, ...taskPresetData]; |
|
|
|
mapState.mapData.mapTask = [...taskOrdinaryData, ...taskPresetData]; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
nextTick(() => handleMapPointGenerate()); |
|
|
|
handleMapPointGenerate(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
/** 处理切换操作面板 */ |
|
|
|
/** 处理切换操作面板 */ |
|
|
@ -651,8 +656,8 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** 设置地图数据json */ |
|
|
|
/** 设置地图数据json */ |
|
|
|
function setMapDataJson(mapData: MapLogistic) { |
|
|
|
function setMapDataJson(mapData: MapLogistic | string) { |
|
|
|
let options: Nullable<MapLogistic> = mapData; |
|
|
|
let options: Nullable<MapLogistic | string> = mapData; |
|
|
|
if (typeof options === 'string') { |
|
|
|
if (typeof options === 'string') { |
|
|
|
try { |
|
|
|
try { |
|
|
|
options = eval('(' + options + ')'); |
|
|
|
options = eval('(' + options + ')'); |
|
|
@ -667,6 +672,16 @@ |
|
|
|
handleMapReset(); |
|
|
|
handleMapReset(); |
|
|
|
nextTick(() => { |
|
|
|
nextTick(() => { |
|
|
|
mapState.mapData = cloneDeep(merge(defaultMapData(), options)); |
|
|
|
mapState.mapData = cloneDeep(merge(defaultMapData(), options)); |
|
|
|
|
|
|
|
// 处理数据格式转换 |
|
|
|
|
|
|
|
isString(mapState.mapData.fileId) && (mapState.mapData.fileId = mapState.mapData.fileId.split(',')); |
|
|
|
|
|
|
|
mapState.mapData.mapTask.forEach(item => { |
|
|
|
|
|
|
|
isString(item.fileId) && (item.fileId = item.fileId.split(',')); |
|
|
|
|
|
|
|
if (~~item.taskType == 1) { |
|
|
|
|
|
|
|
item?.mapTaskPreset?.forEach(childItem => { |
|
|
|
|
|
|
|
isString(childItem.fileId) && (childItem.fileId = childItem.fileId.split(',')); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
setTableData(mapState.mapData.mapTask); |
|
|
|
setTableData(mapState.mapData.mapTask); |
|
|
|
if (!isEmpty(mapState.mapData.mapLogisticPoint)) { |
|
|
|
if (!isEmpty(mapState.mapData.mapLogisticPoint)) { |
|
|
|
drawMapNavigate(mapState.mapData.mapLogisticPoint); |
|
|
|
drawMapNavigate(mapState.mapData.mapLogisticPoint); |
|
|
@ -707,7 +722,7 @@ |
|
|
|
const pointData:MapLogisticPoint[] = []; |
|
|
|
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 = item.orgId ? mapState.orgList.find(e => e.value == item.orgId) : {} as MapPointType; |
|
|
|
// 下级医院必选,也不能由收样员设置交接位置,所以必须查到,没有数据说明数据被更新过了 |
|
|
|
// 下级医院必选,也不能由收样员设置交接位置,所以必须查到,没有数据说明数据被更新过了 |
|
|
|
if (!hospital) { |
|
|
|
if (!hospital) { |
|
|
|
throw notification.error({ |
|
|
|
throw notification.error({ |
|
|
@ -724,35 +739,37 @@ |
|
|
|
taskType: item.taskType, |
|
|
|
taskType: item.taskType, |
|
|
|
hospitalId: hospital.value, |
|
|
|
hospitalId: hospital.value, |
|
|
|
hospitalName: hospital.label |
|
|
|
hospitalName: hospital.label |
|
|
|
}, { |
|
|
|
}, { |
|
|
|
lng: org?.mapLng, |
|
|
|
lng: org?.mapLng, |
|
|
|
lat: org?.mapLat, |
|
|
|
lat: org?.mapLat, |
|
|
|
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 ?? item.orgName |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
// 查找并添加与自己有关的交接预设任务,只能添加设置了位置的标记点 |
|
|
|
// 查找并添加与自己有关的交接预设任务,只能添加设置了位置的标记点 |
|
|
|
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 => { |
|
|
|
|
|
|
|
const taskPresetHospital = item.orginPresetId ? mapState.hospitalList.find(e => e.value == item.orginPresetId) : {} as MapPointType, |
|
|
|
|
|
|
|
taskPresetOrg = item.destinationPresetId ? mapState.orgList.find(e => e.value == item.destinationPresetId) : {} as MapPointType; |
|
|
|
pointData.push({ |
|
|
|
pointData.push({ |
|
|
|
lng: item.orginPresetLng, |
|
|
|
lng: taskPresetHospital?.mapLng ?? item.orginPresetLng, |
|
|
|
lat: item.orginPresetLat, |
|
|
|
lat: taskPresetHospital?.mapLat ?? item.orginPresetLat, |
|
|
|
type: '0', |
|
|
|
type: '0', |
|
|
|
taskType: '1', |
|
|
|
taskType: '1', |
|
|
|
mapTaskId: item.id, |
|
|
|
mapTaskId: item.id, |
|
|
|
hospitalId: item.orginPresetId, |
|
|
|
hospitalId: taskPresetHospital?.value ?? item.orginPresetId, |
|
|
|
hospitalName: item.orginPresetName |
|
|
|
hospitalName: taskPresetHospital?.label ?? item.orginPresetName |
|
|
|
}, { |
|
|
|
}, { |
|
|
|
lng: item.destinationPresetLng, |
|
|
|
lng: taskPresetOrg?.mapLng ?? item.destinationPresetLng, |
|
|
|
lat: item.destinationPresetLat, |
|
|
|
lat: taskPresetOrg?.mapLat ?? item.destinationPresetLat, |
|
|
|
type: '1', |
|
|
|
type: '1', |
|
|
|
taskType: '1', |
|
|
|
taskType: '1', |
|
|
|
mapTaskId: item.id, |
|
|
|
mapTaskId: item.id, |
|
|
|
hospitalId: item.destinationPresetId, |
|
|
|
hospitalId: taskPresetOrg?.value ?? item.destinationPresetId, |
|
|
|
hospitalName: item.destinationPresetName |
|
|
|
hospitalName: taskPresetOrg?.label ?? item.destinationPresetName |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -773,7 +790,7 @@ |
|
|
|
async function handleMapSave() { |
|
|
|
async function handleMapSave() { |
|
|
|
await formElRef.value.validate(); |
|
|
|
await formElRef.value.validate(); |
|
|
|
const mapData = toRaw(mapState.mapData); |
|
|
|
const mapData = toRaw(mapState.mapData); |
|
|
|
mapData.fileId = (mapData.fileId as[])?.join(','); |
|
|
|
isArray(mapData.fileId) && (mapData.fileId = mapData.fileId.join(',')); |
|
|
|
mapData.mapTask.forEach(item => { |
|
|
|
mapData.mapTask.forEach(item => { |
|
|
|
const hospital = item.hospitalId && mapState.hospitalList.find(e => e.value == item.hospitalId), |
|
|
|
const hospital = item.hospitalId && mapState.hospitalList.find(e => e.value == item.hospitalId), |
|
|
|
org = item.orgId && mapState.orgList.find(e => e.value == item.orgId); |
|
|
|
org = item.orgId && mapState.orgList.find(e => e.value == item.orgId); |
|
|
@ -788,7 +805,7 @@ |
|
|
|
orgLng: org.mapLng, |
|
|
|
orgLng: org.mapLng, |
|
|
|
orgLat: org.mapLat |
|
|
|
orgLat: org.mapLat |
|
|
|
}); |
|
|
|
}); |
|
|
|
item.fileId = (item.fileId as [])?.join(','); |
|
|
|
isArray(item.fileId) && (item.fileId = item.fileId.join(',')); |
|
|
|
if (~~item.taskType == 1) { |
|
|
|
if (~~item.taskType == 1) { |
|
|
|
item?.mapTaskPreset?.forEach(childItem => { |
|
|
|
item?.mapTaskPreset?.forEach(childItem => { |
|
|
|
const childHospital = childItem.orginPresetId && mapState.hospitalList.find(e => e.value == childItem.orginPresetId), |
|
|
|
const childHospital = childItem.orginPresetId && mapState.hospitalList.find(e => e.value == childItem.orginPresetId), |
|
|
@ -804,7 +821,7 @@ |
|
|
|
destinationPresetLng: childOrg.mapLng, |
|
|
|
destinationPresetLng: childOrg.mapLng, |
|
|
|
destinationPresetLat: childOrg.mapLat |
|
|
|
destinationPresetLat: childOrg.mapLat |
|
|
|
}); |
|
|
|
}); |
|
|
|
childItem.fileId = (childItem.fileId as [])?.join(','); |
|
|
|
isArray(childItem.fileId) && (childItem.fileId = childItem.fileId.join(',')); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|