From edff9986d9329cbb987332fe4c7241e000cc545d Mon Sep 17 00:00:00 2001 From: wangxiang <1827945911@qq.com> Date: Fri, 9 Sep 2022 18:54: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 --- package.json | 2 +- .../AMap/src/AMapDesigner/index.vue | 23 ++++++-------- .../src/components/MapTaskPresetModal.vue | 6 ++-- yarn.lock | 30 +++++++++++++------ 4 files changed, 35 insertions(+), 26 deletions(-) diff --git a/package.json b/package.json index 1c023bf..450bb01 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "dependencies": { "@amap/amap-jsapi-loader": "1.0.1", "@iconify/iconify": "2.2.1", - "@vueuse/core": "6.4.1", + "@vueuse/core": "9.1.1", "@zxcvbn-ts/core": "2.0.1", "ant-design-vue": "2.2.8", "axios": "0.21.3", diff --git a/src/components/AMap/src/AMapDesigner/index.vue b/src/components/AMap/src/AMapDesigner/index.vue index a55d4e9..7cdebb5 100644 --- a/src/components/AMap/src/AMapDesigner/index.vue +++ b/src/components/AMap/src/AMapDesigner/index.vue @@ -121,6 +121,7 @@ import { MapLogisticPoint } from '/@/api/platform/common/entity/mapLogisticPoint'; import { isArray, isString } from '/@/utils/is'; import { useI18n } from '/@/hooks/web/useI18n'; + import { watchDebounced } from '@vueuse/core'; /** 类型规范统一声明定义区域 */ interface MapState { @@ -483,10 +484,8 @@ map.on('complete', () => { setMapDataJson(mapProps.options); handleSetCourierUserList(); - nextTick(() => { - mapState.loading = false; - mapState.first = true; - }); + mapState.loading = false; + mapState.first = true; }); } } @@ -504,14 +503,14 @@ handleSetCourierUserList(); } }, { deep: true }); - watch([() => toRefs(mapProps).isEdit, () => mapState.mapData.courierUserId], () => { + watch(toRefs(mapProps).isEdit, () => { if (mapState.first) { handleSetCourierUserList(); } }); - watch([() => mapState.mapData.sendOrderId, () => mapState.mapData.sendOrderTaskType], + watchDebounced([() => mapState.mapData.sendOrderId, () => mapState.mapData.sendOrderTaskType], ([sendOrderIdValue,sendOrderTaskTypeValue], [sendOrderIdOldValue, sendOrderTaskTypeOldValue]) => { - if (!sendOrderIdValue || !sendOrderTaskTypeValue || !mapState.first) return false; + if (!sendOrderIdValue || !sendOrderTaskTypeValue) return false; if (isEmpty(mapState.mapData.mapTask)) { mapState.mapData.mapTask.push({ name: '系统创建:发单任务', @@ -548,7 +547,7 @@ } } handleMapPointGenerate(); - }); + }, { debounce: 200 }); /** 处理切换操作面板 */ function toggleOperatePanel() { @@ -577,7 +576,7 @@ mapLat: 28.295114, mapLng: 112.913864 })); - // 新增时查询没有地图任务的快递员,渲染能创建地图的快递员收样图标 + // 新增时查询没有地图任务的快递员,渲染能创建地图的快递员收样图标 }) : await getCourierUserList().then(res => { mapState.courierUserList = res?.map(item => ({ value: item.id, @@ -746,11 +745,7 @@ /** 绘制地图导航路线 */ function drawMapNavigate(points: MapLogisticPoint[] = []) { - if (isEmpty(points) && mapState.mapData.courierUserId && mapState.mapData.courierLng && mapState.mapData.courierLat) return notification.warn({ - message: '检查到当前起点数据为空或标记点集合为空,请先选择起点跟发单!', - duration: 2, - placement: 'topLeft' - }); + if (isEmpty(points) && mapState.mapData.courierUserId && mapState.mapData.courierLng && mapState.mapData.courierLat) return false; points = points.filter(item => item.lng && item.lat); const lngLats = points.map(item => new AMap.LngLat(item.lng, item.lat)); const destination = lngLats.pop(); diff --git a/src/components/AMap/src/components/MapTaskPresetModal.vue b/src/components/AMap/src/components/MapTaskPresetModal.vue index 7fb9202..cb22d59 100644 --- a/src/components/AMap/src/components/MapTaskPresetModal.vue +++ b/src/components/AMap/src/components/MapTaskPresetModal.vue @@ -276,8 +276,10 @@ last.destinationPresetLng = option.mapLng; last.destinationPresetLat = option.mapLat; } - mapTaskPresetData.forEach((item, index)=> item.sort = add(index, 1)); - (state.taskPresetRow ?? Object()).mapTaskPreset = mapTaskPresetData as MapTaskPreset[]; + (state.taskPresetRow ?? Object()).mapTaskPreset = mapTaskPresetData.map((item, index)=> { + item.sort = add(index, 1); + return omit(item, ['onEdit','onValid','editable','onCancel','onSubmit','submitCbs','cancelCbs','validCbs','editValueRefs']) as MapTaskPreset; + }); // 处理提交完成之后逻辑 closeModal(); emit('success'); diff --git a/yarn.lock b/yarn.lock index 379dcdd..8623682 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1458,6 +1458,11 @@ resolved "https://registry.npmmirror.com/@types/trusted-types/-/trusted-types-2.0.2.tgz#fc25ad9943bcac11cceb8168db4f275e0e72e756" 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": version "4.31.1" 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" integrity sha512-+CifxkLVhjKT14g/LMZil8//SdCzkMkS8VfRX0cqNJiFKK4AWvxj0KV1dhbr8czikY0DZUGQew3tRMRRChMGtA== -"@vueuse/core@6.4.1": - version "6.4.1" - resolved "https://registry.npmmirror.com/@vueuse/core/-/core-6.4.1.tgz#21416997a23bfb4924a5082ed6fa959027f80d04" - integrity sha512-FRFeEPVq77gcMZP0mCloJY+lyHJaUQmUMaPp5fBds3fs/BbkAt7HTMMizFKHWDVjbmA20vBOjmC9tTnfD+DdEA== +"@vueuse/core@9.1.1": + version "9.1.1" + resolved "https://registry.yarnpkg.com/@vueuse/core/-/core-9.1.1.tgz#a5c09c33ccee58cfd53bc3ec2d5a0d304155529e" + integrity sha512-QfuaNWRDMQcCUwXylCyYhPC3ScS9Tiiz4J0chdwr3vOemBwRToSywq8MP+ZegKYFnbETzRY8G/5zC+ca30wrRQ== dependencies: - "@vueuse/shared" "6.4.1" + "@types/web-bluetooth" "^0.0.15" + "@vueuse/metadata" "9.1.1" + "@vueuse/shared" "9.1.1" vue-demi "*" -"@vueuse/shared@6.4.1": - version "6.4.1" - resolved "https://registry.npmmirror.com/@vueuse/shared/-/shared-6.4.1.tgz#5bc84be107cead84e11c21d2c57b1e9f2c376975" - integrity sha512-zsaYxxZwACQbMmGg+UBjPUVemi325sDdnnB0mn+PNizE0fVC57B+vbLgdj45NBmr6P4nw6a0Y2rMupebwDWsdw== +"@vueuse/metadata@9.1.1": + version "9.1.1" + resolved "https://registry.yarnpkg.com/@vueuse/metadata/-/metadata-9.1.1.tgz#b3fe4b97e62096f7566cd8eb107c503998b2c9a6" + 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: vue-demi "*"