Browse Source

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

master
wangxiang 3 years ago
parent
commit
edff9986d9
  1. 2
      package.json
  2. 23
      src/components/AMap/src/AMapDesigner/index.vue
  3. 6
      src/components/AMap/src/components/MapTaskPresetModal.vue
  4. 30
      yarn.lock

2
package.json

@ -26,7 +26,7 @@
"dependencies": { "dependencies": {
"@amap/amap-jsapi-loader": "1.0.1", "@amap/amap-jsapi-loader": "1.0.1",
"@iconify/iconify": "2.2.1", "@iconify/iconify": "2.2.1",
"@vueuse/core": "6.4.1", "@vueuse/core": "9.1.1",
"@zxcvbn-ts/core": "2.0.1", "@zxcvbn-ts/core": "2.0.1",
"ant-design-vue": "2.2.8", "ant-design-vue": "2.2.8",
"axios": "0.21.3", "axios": "0.21.3",

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

@ -121,6 +121,7 @@
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'; import { useI18n } from '/@/hooks/web/useI18n';
import { watchDebounced } from '@vueuse/core';
/** 类型规范统一声明定义区域 */ /** 类型规范统一声明定义区域 */
interface MapState { interface MapState {
@ -483,10 +484,8 @@
map.on('complete', () => { map.on('complete', () => {
setMapDataJson(mapProps.options); setMapDataJson(mapProps.options);
handleSetCourierUserList(); handleSetCourierUserList();
nextTick(() => { mapState.loading = false;
mapState.loading = false; mapState.first = true;
mapState.first = true;
});
}); });
} }
} }
@ -504,14 +503,14 @@
handleSetCourierUserList(); handleSetCourierUserList();
} }
}, { deep: true }); }, { deep: true });
watch([() => toRefs(mapProps).isEdit, () => mapState.mapData.courierUserId], () => { watch(toRefs(mapProps).isEdit, () => {
if (mapState.first) { if (mapState.first) {
handleSetCourierUserList(); handleSetCourierUserList();
} }
}); });
watch([() => mapState.mapData.sendOrderId, () => mapState.mapData.sendOrderTaskType], watchDebounced([() => mapState.mapData.sendOrderId, () => mapState.mapData.sendOrderTaskType],
([sendOrderIdValue,sendOrderTaskTypeValue], [sendOrderIdOldValue, sendOrderTaskTypeOldValue]) => { ([sendOrderIdValue,sendOrderTaskTypeValue], [sendOrderIdOldValue, sendOrderTaskTypeOldValue]) => {
if (!sendOrderIdValue || !sendOrderTaskTypeValue || !mapState.first) return false; if (!sendOrderIdValue || !sendOrderTaskTypeValue) return false;
if (isEmpty(mapState.mapData.mapTask)) { if (isEmpty(mapState.mapData.mapTask)) {
mapState.mapData.mapTask.push({ mapState.mapData.mapTask.push({
name: '系统创建:发单任务', name: '系统创建:发单任务',
@ -548,7 +547,7 @@
} }
} }
handleMapPointGenerate(); handleMapPointGenerate();
}); }, { debounce: 200 });
/** 处理切换操作面板 */ /** 处理切换操作面板 */
function toggleOperatePanel() { function toggleOperatePanel() {
@ -577,7 +576,7 @@
mapLat: 28.295114, mapLat: 28.295114,
mapLng: 112.913864 mapLng: 112.913864
})); }));
// , // ,
}) : await getCourierUserList().then(res => { }) : await getCourierUserList().then(res => {
mapState.courierUserList = res?.map(item => ({ mapState.courierUserList = res?.map(item => ({
value: item.id, value: item.id,
@ -746,11 +745,7 @@
/** 绘制地图导航路线 */ /** 绘制地图导航路线 */
function drawMapNavigate(points: MapLogisticPoint[] = []) { function drawMapNavigate(points: MapLogisticPoint[] = []) {
if (isEmpty(points) && mapState.mapData.courierUserId && mapState.mapData.courierLng && mapState.mapData.courierLat) return notification.warn({ if (isEmpty(points) && mapState.mapData.courierUserId && mapState.mapData.courierLng && mapState.mapData.courierLat) return false;
message: '检查到当前起点数据为空或标记点集合为空,请先选择起点跟发单!',
duration: 2,
placement: 'topLeft'
});
points = points.filter(item => item.lng && item.lat); points = points.filter(item => item.lng && item.lat);
const lngLats = points.map(item => new AMap.LngLat(item.lng, item.lat)); const lngLats = points.map(item => new AMap.LngLat(item.lng, item.lat));
const destination = lngLats.pop(); const destination = lngLats.pop();

6
src/components/AMap/src/components/MapTaskPresetModal.vue

@ -276,8 +276,10 @@
last.destinationPresetLng = option.mapLng; last.destinationPresetLng = option.mapLng;
last.destinationPresetLat = option.mapLat; last.destinationPresetLat = option.mapLat;
} }
mapTaskPresetData.forEach((item, index)=> item.sort = add(index, 1)); (state.taskPresetRow ?? Object()).mapTaskPreset = mapTaskPresetData.map((item, index)=> {
(state.taskPresetRow ?? Object()).mapTaskPreset = mapTaskPresetData as MapTaskPreset[]; item.sort = add(index, 1);
return omit(item, ['onEdit','onValid','editable','onCancel','onSubmit','submitCbs','cancelCbs','validCbs','editValueRefs']) as MapTaskPreset;
});
// //
closeModal(); closeModal();
emit('success'); emit('success');

30
yarn.lock

@ -1458,6 +1458,11 @@
resolved "https://registry.npmmirror.com/@types/trusted-types/-/trusted-types-2.0.2.tgz#fc25ad9943bcac11cceb8168db4f275e0e72e756" resolved "https://registry.npmmirror.com/@types/trusted-types/-/trusted-types-2.0.2.tgz#fc25ad9943bcac11cceb8168db4f275e0e72e756"
integrity sha512-F5DIZ36YVLE+PN+Zwws4kJogq47hNgX3Nx6WyDJ3kcplxyke3XIzB8uK5n/Lpm1HBsbGzd6nmGehL8cPekP+Tg== integrity sha512-F5DIZ36YVLE+PN+Zwws4kJogq47hNgX3Nx6WyDJ3kcplxyke3XIzB8uK5n/Lpm1HBsbGzd6nmGehL8cPekP+Tg==
"@types/web-bluetooth@^0.0.15":
version "0.0.15"
resolved "https://registry.yarnpkg.com/@types/web-bluetooth/-/web-bluetooth-0.0.15.tgz#d60330046a6ed8a13b4a53df3813c44942ebdf72"
integrity sha512-w7hEHXnPMEZ+4nGKl/KDRVpxkwYxYExuHOYXyzIzCDzEZ9ZCGMAewulr9IqJu2LR4N37fcnb1XVeuZ09qgOxhA==
"@typescript-eslint/eslint-plugin@4.31.1": "@typescript-eslint/eslint-plugin@4.31.1":
version "4.31.1" version "4.31.1"
resolved "https://registry.npmmirror.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.31.1.tgz#e938603a136f01dcabeece069da5fb2e331d4498" resolved "https://registry.npmmirror.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.31.1.tgz#e938603a136f01dcabeece069da5fb2e331d4498"
@ -1779,18 +1784,25 @@
resolved "https://registry.npmmirror.com/@vue/shared/-/shared-3.2.9.tgz#44e44dbd82819997f192fb7dbdb90af5715dbf52" resolved "https://registry.npmmirror.com/@vue/shared/-/shared-3.2.9.tgz#44e44dbd82819997f192fb7dbdb90af5715dbf52"
integrity sha512-+CifxkLVhjKT14g/LMZil8//SdCzkMkS8VfRX0cqNJiFKK4AWvxj0KV1dhbr8czikY0DZUGQew3tRMRRChMGtA== integrity sha512-+CifxkLVhjKT14g/LMZil8//SdCzkMkS8VfRX0cqNJiFKK4AWvxj0KV1dhbr8czikY0DZUGQew3tRMRRChMGtA==
"@vueuse/core@6.4.1": "@vueuse/core@9.1.1":
version "6.4.1" version "9.1.1"
resolved "https://registry.npmmirror.com/@vueuse/core/-/core-6.4.1.tgz#21416997a23bfb4924a5082ed6fa959027f80d04" resolved "https://registry.yarnpkg.com/@vueuse/core/-/core-9.1.1.tgz#a5c09c33ccee58cfd53bc3ec2d5a0d304155529e"
integrity sha512-FRFeEPVq77gcMZP0mCloJY+lyHJaUQmUMaPp5fBds3fs/BbkAt7HTMMizFKHWDVjbmA20vBOjmC9tTnfD+DdEA== integrity sha512-QfuaNWRDMQcCUwXylCyYhPC3ScS9Tiiz4J0chdwr3vOemBwRToSywq8MP+ZegKYFnbETzRY8G/5zC+ca30wrRQ==
dependencies: dependencies:
"@vueuse/shared" "6.4.1" "@types/web-bluetooth" "^0.0.15"
"@vueuse/metadata" "9.1.1"
"@vueuse/shared" "9.1.1"
vue-demi "*" vue-demi "*"
"@vueuse/shared@6.4.1": "@vueuse/metadata@9.1.1":
version "6.4.1" version "9.1.1"
resolved "https://registry.npmmirror.com/@vueuse/shared/-/shared-6.4.1.tgz#5bc84be107cead84e11c21d2c57b1e9f2c376975" resolved "https://registry.yarnpkg.com/@vueuse/metadata/-/metadata-9.1.1.tgz#b3fe4b97e62096f7566cd8eb107c503998b2c9a6"
integrity sha512-zsaYxxZwACQbMmGg+UBjPUVemi325sDdnnB0mn+PNizE0fVC57B+vbLgdj45NBmr6P4nw6a0Y2rMupebwDWsdw== integrity sha512-XZ2KtSW+85LLHB/IdGILPAtbIVHasPsAW7aqz3BRMzJdAQWRiM/FGa1OKBwLbXtUw/AmjKYFlZJo7eOFIBXRog==
"@vueuse/shared@9.1.1":
version "9.1.1"
resolved "https://registry.yarnpkg.com/@vueuse/shared/-/shared-9.1.1.tgz#811f47629e281a19013ae6dcdf11ed3e1e91e023"
integrity sha512-c+IfcOYmHiHqoEa3ED1Tbpue5GHmoUmTp8PtO4YbczthtY155Rt6DmWhjxMLXBF1Bcidagxljmp/7xtAzEHXLw==
dependencies: dependencies:
vue-demi "*" vue-demi "*"

Loading…
Cancel
Save