diff --git a/src/api/platform/common/controller/mapTaskPreset.ts b/src/api/platform/common/controller/mapTaskPreset.ts index c012340..4d56c3d 100644 --- a/src/api/platform/common/controller/mapTaskPreset.ts +++ b/src/api/platform/common/controller/mapTaskPreset.ts @@ -14,7 +14,7 @@ enum Api { del = '/common_proxy/common/mapTaskPreset/remove' } -export const listMapTaskPreset = (params?: Partial) => defHttp.get({ url: Api.list, params }, { isReturnResultResponse: true }); +export const listMapTaskPreset = (params?: Partial) => defHttp.get({ url: Api.list, params }, { isReturnResultResponse: true }); export const addMapTaskPreset = (params: Partial) => defHttp.post({ url: Api.add, data: params }); diff --git a/src/api/platform/common/entity/mapLogisticPoint.ts b/src/api/platform/common/entity/mapLogisticPoint.ts index 8dfcc71..2af16b9 100644 --- a/src/api/platform/common/entity/mapLogisticPoint.ts +++ b/src/api/platform/common/entity/mapLogisticPoint.ts @@ -11,20 +11,20 @@ import type { CommonEntity, Page } from '/@/api/common/data/entity'; export type MapLogisticPointParams = Page & MapLogisticPoint; -export interface MapLogisticPoint extends CommonEntity { - id: string; - hospitalId: string; - hospitalName: string; - lng: number; - lat: number; - sort: number; +export interface MapLogisticPoint extends Partial { + id?: string; + lng?: number; + lat?: number; + sort?: number; type: string; taskType: string; - batchCode: string; - mapLogisticId: string; - mapTaskId: string; - key: string; - version: number; + hospitalId?: string; + hospitalName?: string; + batchCode?: string; + mapLogisticId?: string; + mapTaskId?: string; + key?: string; + version?: number; } export type MapLogisticPointResult = R; diff --git a/src/api/platform/common/entity/mapTask.ts b/src/api/platform/common/entity/mapTask.ts index aca95d0..480b7e5 100644 --- a/src/api/platform/common/entity/mapTask.ts +++ b/src/api/platform/common/entity/mapTask.ts @@ -12,28 +12,28 @@ import type { MapTaskPreset } from './mapTaskPreset'; export type MapTaskParams = Page & MapTask; -export interface MapTask extends CommonEntity { - id: string; +export interface MapTask extends Partial { + id?: string; name: string; - sort: number; + sort?: number; taskType: string; hospitalId: string; - hospitalName: string; - hospitalLng: number; - hospitalLat: number; - orgId: string; - orgName: string; - orgLng: number; - orgLat: number; - courierUserId: string; - fileId: string; - estimateTime: string; - requireTime: string; - batchCode: string; - mapLogisticId: string; - key: string; - version: number; - mapTaskPreset: MapTaskPreset[] + hospitalName?: string; + hospitalLng?: number; + hospitalLat?: number; + orgId?: string; + orgName?: string; + orgLng?: number; + orgLat?: number; + courierUserId?: string; + fileId: string | string[]; + estimateTime?: string; + requireTime?: string; + batchCode?: string; + mapLogisticId?: string; + key?: string; + version?: number; + mapTaskPreset?: MapTaskPreset[] } export type MapTaskResult = R; diff --git a/src/api/platform/common/entity/mapTaskPreset.ts b/src/api/platform/common/entity/mapTaskPreset.ts index c304a1e..ce69f37 100644 --- a/src/api/platform/common/entity/mapTaskPreset.ts +++ b/src/api/platform/common/entity/mapTaskPreset.ts @@ -11,27 +11,27 @@ import type { CommonEntity, Page } from '/@/api/common/data/entity'; export type MapTaskPresetParams = Page & MapTaskPreset; -export interface MapTaskPreset extends CommonEntity { - id: string; +export interface MapTaskPreset extends Partial { + id?: string; name: string; - sort: number; - orginPresetId: string; - orginPresetName: string; - orginPresetLng: number; - orginPresetLat: number; - destinationPresetId: string; - destinationPresetName: string; - destinationPresetLng: number; - destinationPresetLat: number; - courierUserId: string; - key: string; - fileId: string; - estimateTime: string; - requireTime: string; - batchCode: string; - mapLogisticId: string; - taskId: string; - version: number; + sort?: number; + orginPresetId?: string; + orginPresetName?: string; + orginPresetLng?: number; + orginPresetLat?: number; + destinationPresetId?: string; + destinationPresetName?: string; + destinationPresetLng?: number; + destinationPresetLat?: number; + courierUserId?: string; + key?: string; + fileId: string | string[]; + estimateTime?: string; + requireTime?: string; + batchCode?: string; + mapLogisticId?: string; + taskId?: string; + version?: number; } export type MapTaskPresetResult = R; diff --git a/src/components/AMap/src/AMapDesigner/index.vue b/src/components/AMap/src/AMapDesigner/index.vue index 45d9a60..3930f8f 100644 --- a/src/components/AMap/src/AMapDesigner/index.vue +++ b/src/components/AMap/src/AMapDesigner/index.vue @@ -106,7 +106,7 @@ import { getCourierUserList } from '/@/api/platform/system/controller/user'; import { listOrg } from '/@/api/platform/common/controller/org'; 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 { BasicUpload } from '/@/components/Upload'; import { commonUpload } from '/@/api/platform/core/controller/upload'; @@ -118,6 +118,7 @@ import { MapLogistic } from '/@/api/platform/common/entity/mapLogistic'; import { buildUUID } from '/@/utils/uuid'; import { RuleObject } from 'ant-design-vue/es/form/interface'; + import { MapLogisticPoint } from '/@/api/platform/common/entity/mapLogisticPoint'; /** 类型规范统一声明定义区域 */ interface MapState { @@ -351,7 +352,7 @@ const { lnglat } = ctx; map.setZoomAndCenter(18, lnglat); }); - const orgPoints = mapState.orgList.map((org: any) => ({ + const orgPoints = mapState.orgList.map(org => ({ lnglat: [org.mapLng, org.mapLat], ...org })); orgMarkerCluster?.setData(orgPoints); @@ -401,7 +402,7 @@ const { lnglat } = ctx; map.setZoomAndCenter(18, lnglat); }); - const hospitalPoints = mapState.hospitalList.map((hospital: any) => ({ + const hospitalPoints = mapState.hospitalList.map(hospital => ({ lnglat: [hospital.mapLng, hospital.mapLat], ...hospital })); hospitalMarkerCluster?.setData(hospitalPoints); @@ -445,7 +446,7 @@ const { lnglat } = ctx; map.setZoomAndCenter(18, lnglat); }); - const courierUserPoints = mapState.courierUserList.map((courierUser: any) => ({ + const courierUserPoints = mapState.courierUserList.map(courierUser => ({ lnglat: [courierUser.mapLng, courierUser.mapLat], ...courierUser })); courierUserMarkerCluster?.setData(courierUserPoints); @@ -502,7 +503,7 @@ if (!mapProps.sidebarControl) mapState.toggleOperatePanelClass.siderWidth = 0; if (!mapProps.toolbarControl) mapState.toggleOperatePanelClass.toolbarHeight = 0; }); - watch(toRefs(mapProps).options, (newValue) => { + watch(toRefs(mapProps).options, (newValue: MapLogistic) => { setMapDataJson(newValue); }, { 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) { map.remove(scanCourierUserCircleRange || {}); scanCourierUserCircleRange.setCenter([hospitalMap.mapLng, hospitalMap.mapLat]); @@ -650,8 +651,8 @@ } /** 设置地图数据json */ - function setMapDataJson(data) { - let options = data; + function setMapDataJson(mapData: MapLogistic) { + let options: Nullable = mapData; if (typeof options === 'string') { try { options = eval('(' + options + ')'); @@ -660,7 +661,7 @@ message: '非法配置', duration: 2 }); - options = {}; + options = null; } } handleMapReset(); @@ -678,13 +679,13 @@ return cloneDeep(mapState.mapData); } - /** 获取部件表单数据 */ + /** 清除表单校验数据 */ function formClearValidate(fields: string[] | string) { return formElRef.value.clearValidate(fields); } /** 绘制地图导航路线 */ - function drawMapNavigate(points: Recordable[] = []) { + function drawMapNavigate(points: MapLogisticPoint[] = []) { points = points.filter(item => item.lng && item.lat); if (points.length > 0 && mapState.mapData.courierLng && mapState.mapData.courierLat) { const lngLats = points.map(item => new AMap.LngLat(item.lng, item.lat)); @@ -703,7 +704,7 @@ /** 处理地图标记点生成 */ async function handleMapPointGenerate() { setTableData(mapState.mapData.mapTask); - const pointData:Recordable[] = []; + const pointData:MapLogisticPoint[] = []; mapState.mapData.mapTask.forEach(item => { const hospital = mapState.hospitalList.find(e => e.value == item.hospitalId), org = mapState.orgList.find(e => e.value == item.orgId); @@ -761,7 +762,7 @@ } /** 处理地图标记点数据 */ - function handleMapPoint(mapLogisticPoint: Recordable[] = []) { + function handleMapPoint(mapLogisticPoint: MapLogisticPoint[] = []) { if (!isEmpty(mapLogisticPoint)) { mapState.mapData.mapLogisticPoint = mapLogisticPoint; drawMapNavigate(mapLogisticPoint); @@ -790,15 +791,15 @@ item.fileId = (item.fileId as [])?.join(','); if (~~item.taskType == 1) { item?.mapTaskPreset?.forEach(childItem => { - const childHospital = childItem.hospitalId && mapState.hospitalList.find(e => e.value == childItem.hospitalId), - childOrg = childItem.orgId && mapState.orgList.find(e => e.value == childItem.orgId); + const childHospital = childItem.orginPresetId && mapState.hospitalList.find(e => e.value == childItem.orginPresetId), + childOrg = childItem.destinationPresetId && mapState.orgList.find(e => e.value == childItem.destinationPresetId); childItem.courierUserId = mapData.courierUserId; - childHospital && Object.assign(item,{ + childHospital && Object.assign(childItem,{ orginPresetName: childHospital.label, orginPresetLat: childHospital.mapLat, orginPresetLng: childHospital.mapLng }); - childOrg && Object.assign(item,{ + childOrg && Object.assign(childItem,{ destinationPresetName: childOrg.label, destinationPresetLng: childOrg.mapLng, destinationPresetLat: childOrg.mapLat @@ -839,7 +840,8 @@ defineExpose({ drawMapNavigate, getMapDataJson, - setMapDataJson + setMapDataJson, + formClearValidate });