Browse Source

🚑 交接点没有地图数据也能展示处理

master
wangxiang 3 years ago
parent
commit
25ad235df3
  1. 4
      src/api/platform/common/entity/mapTask.ts
  2. 23
      src/components/AMap/src/AMapDesigner/index.vue
  3. 6
      src/components/AMap/src/components/MapTaskModal.vue
  4. 43
      src/components/AMap/src/components/MapTaskPresetModal.vue
  5. 3
      src/locales/lang/en/component.ts
  6. 3
      src/locales/lang/zh-CN/component.ts

4
src/api/platform/common/entity/mapTask.ts

@ -21,8 +21,8 @@ export interface MapTask extends Partial<CommonEntity> {
hospitalName?: string; hospitalName?: string;
hospitalLng?: number; hospitalLng?: number;
hospitalLat?: number; hospitalLat?: number;
orgId?: string; orgId: string;
orgName?: string; orgName: string;
orgLng?: number; orgLng?: number;
orgLat?: number; orgLat?: number;
courierUserId?: string; courierUserId?: string;

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

@ -120,6 +120,7 @@
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'; import { isArray, isString } from '/@/utils/is';
import { useI18n } from '/@/hooks/web/useI18n';
/** 类型规范统一声明定义区域 */ /** 类型规范统一声明定义区域 */
interface MapState { interface MapState {
@ -167,6 +168,7 @@
let scanCourierUserCircleRange; let scanCourierUserCircleRange;
let driving; let driving;
const { t } = useI18n();
const emit = defineEmits(['success']); const emit = defineEmits(['success']);
const userStore = useUserStore(); const userStore = useUserStore();
const instance = getCurrentInstance(); const instance = getCurrentInstance();
@ -514,7 +516,7 @@
hospitalId: sendOrderIdValue, hospitalId: sendOrderIdValue,
taskType: sendOrderTaskTypeValue, taskType: sendOrderTaskTypeValue,
orgId: '', orgId: '',
orgName: ~~sendOrderTaskTypeValue ? '等待收样员设置!' : '', orgName: t('component.aMapDesigner.taskPositionTip'),
sort: 1, sort: 1,
fileId: [], fileId: [],
key: buildUUID() key: buildUUID()
@ -532,7 +534,7 @@
// //
Object.assign(mapTask, { Object.assign(mapTask, {
orgId: '', orgId: '',
orgName: ~~sendOrderTaskTypeValue ? '等待收样员设置!' : '', orgName: t('component.aMapDesigner.taskPositionTip'),
fileId: [] fileId: []
}); });
// //
@ -729,21 +731,7 @@
}); });
isArray(item.fileId) && (item.fileId = item.fileId.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 => isArray(childItem.fileId) && (childItem.fileId = childItem.fileId.join(',')));
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)); return Promise.resolve(cloneDeep(mapState.mapData));
@ -756,6 +744,7 @@
/** 绘制地图导航路线 */ /** 绘制地图导航路线 */
function drawMapNavigate(points: MapLogisticPoint[] = []) { function drawMapNavigate(points: MapLogisticPoint[] = []) {
debugger;
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));

6
src/components/AMap/src/components/MapTaskModal.vue

@ -69,6 +69,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 { MapTask } from '/@/api/platform/common/entity/mapTask'; import { MapTask } from '/@/api/platform/common/entity/mapTask';
import { useI18n } from '/@/hooks/web/useI18n';
/** 类型规范统一声明定义区域 */ /** 类型规范统一声明定义区域 */
type OptionsType = { type OptionsType = {
@ -92,6 +93,7 @@
orgList: null orgList: null
} }
}); });
const { t } = useI18n();
const emit = defineEmits(['success', 'register']); const emit = defineEmits(['success', 'register']);
const [registerModal, { setModalProps, closeModal }] = useModalInner(async data => { const [registerModal, { setModalProps, closeModal }] = useModalInner(async data => {
// //
@ -227,6 +229,7 @@
hospitalId: '', hospitalId: '',
taskType: '0', taskType: '0',
orgId: '', orgId: '',
orgName: t('component.aMapDesigner.taskPositionTip'),
fileId: [], fileId: [],
key: buildUUID() key: buildUUID()
} as MapTask); } as MapTask);
@ -249,7 +252,8 @@
name: '', name: '',
hospitalId: '', hospitalId: '',
taskType: '1', taskType: '1',
orgName: '等待收样员设置!', orgId: '',
orgName: t('component.aMapDesigner.taskPositionTip'),
fileId: [], fileId: [],
key: buildUUID() key: buildUUID()
} as MapTask); } as MapTask);

43
src/components/AMap/src/components/MapTaskPresetModal.vue

@ -11,7 +11,10 @@
:wrapperCol="{ style: { width: '100%', 'margin-right': '10px' } }" :wrapperCol="{ style: { width: '100%', 'margin-right': '10px' } }"
:model="state.modelRef" :model="state.modelRef"
> >
<AFormItem label="医检" name="destinationPresetId" :rules="{ required: true, whitespace: true, message: '医检不能为空', validateTrigger: 'blur' }"> <AFormItem v-show="false" label="终点行key" name="destinationPresetRowKeyRef">
<Input v-model:value="state.modelRef.destinationPresetRowKeyRef" :disabled="true"/>
</AFormItem>
<AFormItem label="终点" name="destinationPresetId" :rules="{ required: true, whitespace: true, message: '医检不能为空', validateTrigger: 'blur' }">
<ASelect v-model:value="state.modelRef.destinationPresetId" <ASelect v-model:value="state.modelRef.destinationPresetId"
:options="state.options.orgList" :options="state.options.orgList"
:style="{ width:'30%' }" :style="{ width:'30%' }"
@ -53,6 +56,7 @@
import { buildUUID } from '/@/utils/uuid'; import { buildUUID } from '/@/utils/uuid';
import { MapTask } from '/@/api/platform/common/entity/mapTask'; import { MapTask } from '/@/api/platform/common/entity/mapTask';
import { MapTaskPreset } from '/@/api/platform/common/entity/mapTaskPreset'; import { MapTaskPreset } from '/@/api/platform/common/entity/mapTaskPreset';
import { useI18n } from '/@/hooks/web/useI18n';
/** 类型规范统一声明定义区域 */ /** 类型规范统一声明定义区域 */
type OptionsType = { type OptionsType = {
@ -71,17 +75,19 @@
currentEditRowRef: null, currentEditRowRef: null,
taskPresetRow: null, taskPresetRow: null,
modelRef: { modelRef: {
destinationPresetId: '' destinationPresetRowKeyRef: '',
destinationPresetId: '',
}, },
options: { options: {
courierUserId: '', courierUserId: '',
orgList: null orgList: null
} },
}); });
const AForm = Form; const AForm = Form;
const AFormItem = Form.Item; const AFormItem = Form.Item;
const ASelect = Select; const ASelect = Select;
const formElRef = ref(); const formElRef = ref();
const { t } = useI18n();
const emit = defineEmits(['success', 'register']); const emit = defineEmits(['success', 'register']);
const { notification } = useMessage(); const { notification } = useMessage();
const [registerModal, { setModalProps, closeModal }] = useModalInner(async data => { const [registerModal, { setModalProps, closeModal }] = useModalInner(async data => {
@ -122,11 +128,14 @@
setColumns(taskPresetChildColumns.map(item => setColumns(taskPresetChildColumns.map(item =>
columns.find(e => e.dataIndex == item.dataIndex) || 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]; const last = mapTaskPresetData[mapTaskPresetData.length - 1];
lastElement && (state.modelRef.destinationPresetId = lastElement.destinationPresetId); if (last) {
setTableData(mapTaskPresetData.map(item => omit(item, 'key'))); state.modelRef.destinationPresetRowKeyRef = last.key;
state.modelRef.destinationPresetId = last.destinationPresetId;
}
// : // :
setModalProps(props); setModalProps(props);
}); });
@ -155,8 +164,8 @@
getDataSource().push({ getDataSource().push({
name: '', name: '',
courierUserId: '', courierUserId: '',
orginPresetName: '等待收样员设置!', orginPresetName: t('component.aMapDesigner.taskPositionTip'),
destinationPresetName: '等待收样员设置!', destinationPresetName: t('component.aMapDesigner.taskPositionTip'),
fileId: [], fileId: [],
key: buildUUID() key: buildUUID()
} as MapTaskPreset); } as MapTaskPreset);
@ -246,9 +255,9 @@
// //
mapTaskPresetData.forEach(item => { mapTaskPresetData.forEach(item => {
validateData.push(item.onValid?.() || Promise.resolve(true)); 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.destinationPresetId = '';
item.destinationPresetName = '等待收样员设置!'; item.destinationPresetName = t('component.aMapDesigner.taskPositionTip');
item.destinationPresetLng = ''; item.destinationPresetLng = '';
item.destinationPresetLat = ''; item.destinationPresetLat = '';
} }
@ -259,13 +268,13 @@
duration: 2 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); const option = state.options.orgList?.find(item => item.value == formData.destinationPresetId);
if (option && lastElement) { if (option && last) {
lastElement.destinationPresetId = option.value; last.destinationPresetId = option.value;
lastElement.destinationPresetName = option.label; last.destinationPresetName = option.label;
lastElement.destinationPresetLng = option.mapLng; last.destinationPresetLng = option.mapLng;
lastElement.destinationPresetLat = option.mapLat; last.destinationPresetLat = option.mapLat;
} }
mapTaskPresetData.forEach((item, index)=> item.sort = add(index, 1)); mapTaskPresetData.forEach((item, index)=> item.sort = add(index, 1));
(state.taskPresetRow ?? Object()).mapTaskPreset = mapTaskPresetData as MapTaskPreset[]; (state.taskPresetRow ?? Object()).mapTaskPreset = mapTaskPresetData as MapTaskPreset[];

3
src/locales/lang/en/component.ts

@ -126,4 +126,7 @@ export default {
dragText: 'Hold down the slider and drag', dragText: 'Hold down the slider and drag',
successText: 'Verified', successText: 'Verified',
}, },
aMapDesigner: {
taskPositionTip: 'location pending'
},
}; };

3
src/locales/lang/zh-CN/component.ts

@ -131,4 +131,7 @@ export default {
dragText: '请按住滑块拖动', dragText: '请按住滑块拖动',
successText: '验证通过', successText: '验证通过',
}, },
aMapDesigner: {
taskPositionTip: '位置待设'
},
}; };

Loading…
Cancel
Save