From 25ad235df33e6cff73df5f6cd49d56ca15186d4c Mon Sep 17 00:00:00 2001 From: wangxiang <1827945911@qq.com> Date: Fri, 9 Sep 2022 04:48:15 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=91=20=E4=BA=A4=E6=8E=A5=E7=82=B9?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E5=9C=B0=E5=9B=BE=E6=95=B0=E6=8D=AE=E4=B9=9F?= =?UTF-8?q?=E8=83=BD=E5=B1=95=E7=A4=BA=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/platform/common/entity/mapTask.ts | 4 +- .../AMap/src/AMapDesigner/index.vue | 23 +++------- .../AMap/src/components/MapTaskModal.vue | 6 ++- .../src/components/MapTaskPresetModal.vue | 43 +++++++++++-------- src/locales/lang/en/component.ts | 3 ++ src/locales/lang/zh-CN/component.ts | 3 ++ 6 files changed, 45 insertions(+), 37 deletions(-) diff --git a/src/api/platform/common/entity/mapTask.ts b/src/api/platform/common/entity/mapTask.ts index 480b7e5..bb39532 100644 --- a/src/api/platform/common/entity/mapTask.ts +++ b/src/api/platform/common/entity/mapTask.ts @@ -21,8 +21,8 @@ export interface MapTask extends Partial { hospitalName?: string; hospitalLng?: number; hospitalLat?: number; - orgId?: string; - orgName?: string; + orgId: string; + orgName: string; orgLng?: number; orgLat?: number; courierUserId?: string; diff --git a/src/components/AMap/src/AMapDesigner/index.vue b/src/components/AMap/src/AMapDesigner/index.vue index 7f7f9bf..c2a8977 100644 --- a/src/components/AMap/src/AMapDesigner/index.vue +++ b/src/components/AMap/src/AMapDesigner/index.vue @@ -120,6 +120,7 @@ import { RuleObject } from 'ant-design-vue/es/form/interface'; import { MapLogisticPoint } from '/@/api/platform/common/entity/mapLogisticPoint'; import { isArray, isString } from '/@/utils/is'; + import { useI18n } from '/@/hooks/web/useI18n'; /** 类型规范统一声明定义区域 */ interface MapState { @@ -167,6 +168,7 @@ let scanCourierUserCircleRange; let driving; + const { t } = useI18n(); const emit = defineEmits(['success']); const userStore = useUserStore(); const instance = getCurrentInstance(); @@ -514,7 +516,7 @@ hospitalId: sendOrderIdValue, taskType: sendOrderTaskTypeValue, orgId: '', - orgName: ~~sendOrderTaskTypeValue ? '等待收样员设置!' : '', + orgName: t('component.aMapDesigner.taskPositionTip'), sort: 1, fileId: [], key: buildUUID() @@ -532,7 +534,7 @@ // 普通任务与交接任务互换清除上级医院 Object.assign(mapTask, { orgId: '', - orgName: ~~sendOrderTaskTypeValue ? '等待收样员设置!' : '', + orgName: t('component.aMapDesigner.taskPositionTip'), fileId: [] }); // 重新在头部添加任务并且重新排序 @@ -729,21 +731,7 @@ }); 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(',')); - }); + item?.mapTaskPreset?.forEach(childItem => isArray(childItem.fileId) && (childItem.fileId = childItem.fileId.join(','))); } }); return Promise.resolve(cloneDeep(mapState.mapData)); @@ -756,6 +744,7 @@ /** 绘制地图导航路线 */ function drawMapNavigate(points: MapLogisticPoint[] = []) { + debugger; 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)); diff --git a/src/components/AMap/src/components/MapTaskModal.vue b/src/components/AMap/src/components/MapTaskModal.vue index d7b9f83..85bc156 100644 --- a/src/components/AMap/src/components/MapTaskModal.vue +++ b/src/components/AMap/src/components/MapTaskModal.vue @@ -69,6 +69,7 @@ import { MapLogistic } from '/@/api/platform/common/entity/mapLogistic'; import { buildUUID } from '/@/utils/uuid'; import { MapTask } from '/@/api/platform/common/entity/mapTask'; + import { useI18n } from '/@/hooks/web/useI18n'; /** 类型规范统一声明定义区域 */ type OptionsType = { @@ -92,6 +93,7 @@ orgList: null } }); + const { t } = useI18n(); const emit = defineEmits(['success', 'register']); const [registerModal, { setModalProps, closeModal }] = useModalInner(async data => { // 处理设置数据 @@ -227,6 +229,7 @@ hospitalId: '', taskType: '0', orgId: '', + orgName: t('component.aMapDesigner.taskPositionTip'), fileId: [], key: buildUUID() } as MapTask); @@ -249,7 +252,8 @@ name: '', hospitalId: '', taskType: '1', - orgName: '等待收样员设置!', + orgId: '', + orgName: t('component.aMapDesigner.taskPositionTip'), fileId: [], key: buildUUID() } as MapTask); diff --git a/src/components/AMap/src/components/MapTaskPresetModal.vue b/src/components/AMap/src/components/MapTaskPresetModal.vue index 1d59e9b..7fb9202 100644 --- a/src/components/AMap/src/components/MapTaskPresetModal.vue +++ b/src/components/AMap/src/components/MapTaskPresetModal.vue @@ -11,7 +11,10 @@ :wrapperCol="{ style: { width: '100%', 'margin-right': '10px' } }" :model="state.modelRef" > - + + + + { @@ -122,11 +128,14 @@ setColumns(taskPresetChildColumns.map(item => columns.find(e => e.dataIndex == item.dataIndex) || item )); - const mapTaskPresetData = cloneDeep(state.taskPresetRow?.mapTaskPreset || []); + setTableData((state.taskPresetRow?.mapTaskPreset || []).map(item => omit(item, 'key'))); + const mapTaskPresetData = getDataSource(); // 提取交接最终到达上级医检医院 - const lastElement = mapTaskPresetData[mapTaskPresetData.length - 1]; - lastElement && (state.modelRef.destinationPresetId = lastElement.destinationPresetId); - setTableData(mapTaskPresetData.map(item => omit(item, 'key'))); + const last = mapTaskPresetData[mapTaskPresetData.length - 1]; + if (last) { + state.modelRef.destinationPresetRowKeyRef = last.key; + state.modelRef.destinationPresetId = last.destinationPresetId; + } // 尾部:设置处理后的最终配置数据 setModalProps(props); }); @@ -155,8 +164,8 @@ getDataSource().push({ name: '', courierUserId: '', - orginPresetName: '等待收样员设置!', - destinationPresetName: '等待收样员设置!', + orginPresetName: t('component.aMapDesigner.taskPositionTip'), + destinationPresetName: t('component.aMapDesigner.taskPositionTip'), fileId: [], key: buildUUID() } as MapTaskPreset); @@ -246,9 +255,9 @@ // 清除旧的上级医检医院 mapTaskPresetData.forEach(item => { validateData.push(item.onValid?.() || Promise.resolve(true)); - if(state.options.orgList?.findIndex(e => e.value == item.destinationPresetId) != -1) { + if(item.key == state.modelRef.destinationPresetRowKeyRef) { item.destinationPresetId = ''; - item.destinationPresetName = '等待收样员设置!'; + item.destinationPresetName = t('component.aMapDesigner.taskPositionTip'); item.destinationPresetLng = ''; item.destinationPresetLat = ''; } @@ -259,13 +268,13 @@ duration: 2 }); // 自动设置交接最终到达上级医检医院 - const lastElement = mapTaskPresetData[mapTaskPresetData.length - 1] as MapTaskPreset; + const last = mapTaskPresetData[mapTaskPresetData.length - 1] as MapTaskPreset; const option = state.options.orgList?.find(item => item.value == formData.destinationPresetId); - if (option && lastElement) { - lastElement.destinationPresetId = option.value; - lastElement.destinationPresetName = option.label; - lastElement.destinationPresetLng = option.mapLng; - lastElement.destinationPresetLat = option.mapLat; + if (option && last) { + last.destinationPresetId = option.value; + last.destinationPresetName = option.label; + last.destinationPresetLng = option.mapLng; + last.destinationPresetLat = option.mapLat; } mapTaskPresetData.forEach((item, index)=> item.sort = add(index, 1)); (state.taskPresetRow ?? Object()).mapTaskPreset = mapTaskPresetData as MapTaskPreset[]; diff --git a/src/locales/lang/en/component.ts b/src/locales/lang/en/component.ts index b93dbd5..9de95e8 100644 --- a/src/locales/lang/en/component.ts +++ b/src/locales/lang/en/component.ts @@ -126,4 +126,7 @@ export default { dragText: 'Hold down the slider and drag', successText: 'Verified', }, + aMapDesigner: { + taskPositionTip: 'location pending' + }, }; diff --git a/src/locales/lang/zh-CN/component.ts b/src/locales/lang/zh-CN/component.ts index d9b54eb..9ad600e 100644 --- a/src/locales/lang/zh-CN/component.ts +++ b/src/locales/lang/zh-CN/component.ts @@ -131,4 +131,7 @@ export default { dragText: '请按住滑块拖动', successText: '验证通过', }, + aMapDesigner: { + taskPositionTip: '位置待设' + }, };