Browse Source

🅰 地图设计器初步完稿

master
wangxiang 3 years ago
parent
commit
0b4f0223e8
  1. 78
      src/components/AMap/src/AMapDesigner/index.vue

78
src/components/AMap/src/AMapDesigner/index.vue

@ -711,8 +711,44 @@ @@ -711,8 +711,44 @@
}
/** 获取部件表单数据 */
function getMapDataJson() {
return cloneDeep(mapState.mapData);
async function getMapDataJson() {
await formElRef.value.validate();
const mapData = toRaw(mapState.mapData);
isArray(mapData.fileId) && (mapData.fileId = mapData.fileId.join(','));
mapData.mapTask.forEach(item => {
const hospital = item.hospitalId && mapState.hospitalList.find(e => e.value == item.hospitalId),
org = item.orgId && mapState.orgList.find(e => e.value == item.orgId);
item.courierUserId = mapData.courierUserId;
hospital && Object.assign(item,{
hospitalName: hospital.label,
hospitalLng: hospital.mapLng,
hospitalLat: hospital.mapLat
});
org && Object.assign(item,{
orgName: org.label,
orgLng: org.mapLng,
orgLat: org.mapLat
});
isArray(item.fileId) && (item.fileId = item.fileId.join(','));
if (~~item.taskType == 1) {
item?.mapTaskPreset?.forEach(childItem => {
const childHospital = childItem.orginPresetId && mapState.hospitalList.find(e => e.value == childItem.orginPresetId),
childOrg = childItem.destinationPresetId && mapState.orgList.find(e => e.value == childItem.destinationPresetId);
childHospital && Object.assign(childItem,{
orginPresetName: childHospital.label,
orginPresetLat: childHospital.mapLat,
orginPresetLng: childHospital.mapLng
});
childOrg && Object.assign(childItem,{
destinationPresetName: childOrg.label,
destinationPresetLng: childOrg.mapLng,
destinationPresetLat: childOrg.mapLat
});
isArray(childItem.fileId) && (childItem.fileId = childItem.fileId.join(','));
});
}
});
return Promise.resolve(cloneDeep(mapState.mapData));
}
/** 清除表单校验数据 */
@ -809,43 +845,7 @@ @@ -809,43 +845,7 @@
/** 处理地图保存并发布 */
async function handleMapSave() {
await formElRef.value.validate();
const mapData = toRaw(mapState.mapData);
isArray(mapData.fileId) && (mapData.fileId = mapData.fileId.join(','));
mapData.mapTask.forEach(item => {
const hospital = item.hospitalId && mapState.hospitalList.find(e => e.value == item.hospitalId),
org = item.orgId && mapState.orgList.find(e => e.value == item.orgId);
item.courierUserId = mapData.courierUserId;
hospital && Object.assign(item,{
hospitalName: hospital.label,
hospitalLng: hospital.mapLng,
hospitalLat: hospital.mapLat
});
org && Object.assign(item,{
orgName: org.label,
orgLng: org.mapLng,
orgLat: org.mapLat
});
isArray(item.fileId) && (item.fileId = item.fileId.join(','));
if (~~item.taskType == 1) {
item?.mapTaskPreset?.forEach(childItem => {
const childHospital = childItem.orginPresetId && mapState.hospitalList.find(e => e.value == childItem.orginPresetId),
childOrg = childItem.destinationPresetId && mapState.orgList.find(e => e.value == childItem.destinationPresetId);
childHospital && Object.assign(childItem,{
orginPresetName: childHospital.label,
orginPresetLat: childHospital.mapLat,
orginPresetLng: childHospital.mapLng
});
childOrg && Object.assign(childItem,{
destinationPresetName: childOrg.label,
destinationPresetLng: childOrg.mapLng,
destinationPresetLat: childOrg.mapLat
});
isArray(childItem.fileId) && (childItem.fileId = childItem.fileId.join(','));
});
}
});
await saveOrUpdateMapLogistic(toRaw(mapState.mapData));
await saveOrUpdateMapLogistic(await getMapDataJson());
emit('success');
}

Loading…
Cancel
Save