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

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

@ -120,6 +120,7 @@ @@ -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 @@ @@ -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 @@ @@ -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 @@ @@ -532,7 +534,7 @@
//
Object.assign(mapTask, {
orgId: '',
orgName: ~~sendOrderTaskTypeValue ? '等待收样员设置!' : '',
orgName: t('component.aMapDesigner.taskPositionTip'),
fileId: []
});
//
@ -729,21 +731,7 @@ @@ -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 @@ @@ -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));

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

@ -69,6 +69,7 @@ @@ -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 @@ @@ -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 @@ @@ -227,6 +229,7 @@
hospitalId: '',
taskType: '0',
orgId: '',
orgName: t('component.aMapDesigner.taskPositionTip'),
fileId: [],
key: buildUUID()
} as MapTask);
@ -249,7 +252,8 @@ @@ -249,7 +252,8 @@
name: '',
hospitalId: '',
taskType: '1',
orgName: '等待收样员设置!',
orgId: '',
orgName: t('component.aMapDesigner.taskPositionTip'),
fileId: [],
key: buildUUID()
} as MapTask);

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

@ -11,7 +11,10 @@ @@ -11,7 +11,10 @@
:wrapperCol="{ style: { width: '100%', 'margin-right': '10px' } }"
: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"
:options="state.options.orgList"
:style="{ width:'30%' }"
@ -53,6 +56,7 @@ @@ -53,6 +56,7 @@
import { buildUUID } from '/@/utils/uuid';
import { MapTask } from '/@/api/platform/common/entity/mapTask';
import { MapTaskPreset } from '/@/api/platform/common/entity/mapTaskPreset';
import { useI18n } from '/@/hooks/web/useI18n';
/** 类型规范统一声明定义区域 */
type OptionsType = {
@ -71,17 +75,19 @@ @@ -71,17 +75,19 @@
currentEditRowRef: null,
taskPresetRow: null,
modelRef: {
destinationPresetId: ''
destinationPresetRowKeyRef: '',
destinationPresetId: '',
},
options: {
courierUserId: '',
orgList: null
}
},
});
const AForm = Form;
const AFormItem = Form.Item;
const ASelect = Select;
const formElRef = ref();
const { t } = useI18n();
const emit = defineEmits(['success', 'register']);
const { notification } = useMessage();
const [registerModal, { setModalProps, closeModal }] = useModalInner(async data => {
@ -122,11 +128,14 @@ @@ -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 @@ @@ -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 @@ @@ -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 @@ @@ -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[];

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

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

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

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

Loading…
Cancel
Save