Commit b055b398478b510ee604b82c317c7cd929c72852
1 parent
6cc0ab0e
地图导航
Showing
1 changed file
with
30 additions
and
2 deletions
pages-sub/problem/work-order-manage/index.vue
| ... | ... | @@ -74,7 +74,7 @@ |
| 74 | 74 | <view class="u-body-item-title">工单编号:</view> |
| 75 | 75 | <view class="u-line-1 u-body-value">{{ item.orderNo || '-' }}</view> |
| 76 | 76 | </view> |
| 77 | - <view class="u-body-item u-flex"> | |
| 77 | + <view class="u-body-item u-flex" @click="openMapNav(item)"> | |
| 78 | 78 | <view class="u-body-item-title">工单位置:</view> |
| 79 | 79 | <view class="u-line-1 u-body-value">{{ item.lonLatAddress || '-' }}</view> |
| 80 | 80 | </view> |
| ... | ... | @@ -144,7 +144,7 @@ |
| 144 | 144 | <view class="u-body-item-title">工单编号:</view> |
| 145 | 145 | <view class="u-line-1 u-body-value">{{ item.orderNo || '-' }}</view> |
| 146 | 146 | </view> |
| 147 | - <view class="u-body-item u-flex"> | |
| 147 | + <view class="u-body-item u-flex" @click="openMapNav(item)"> | |
| 148 | 148 | <view class="u-body-item-title">工单位置:</view> |
| 149 | 149 | <view class="u-line-1 u-body-value">{{ item.lonLatAddress || '-' }}</view> |
| 150 | 150 | </view> |
| ... | ... | @@ -351,6 +351,34 @@ const acceptImgs = useUploadImgs({ |
| 351 | 351 | fieldName: 'acceptImgs' // 自定义字段名,区分回退图片 |
| 352 | 352 | }) |
| 353 | 353 | |
| 354 | +// 打开地图导航 | |
| 355 | +const openMapNav = (item) => { | |
| 356 | + // 校验经纬度 | |
| 357 | + // if (!item.lat || !item.lon) { | |
| 358 | + // uni.showToast({ title: "该工单无经纬度,无法导航", icon: "none" }); | |
| 359 | + // return; | |
| 360 | + // } | |
| 361 | + // const latitude = Number(item.lat); | |
| 362 | + // const longitude = Number(item.lon); | |
| 363 | + // const addressName = item.lonLatAddress || "工单位置"; | |
| 364 | + | |
| 365 | + // uni.openLocation({ | |
| 366 | + // latitude, | |
| 367 | + // longitude, | |
| 368 | + // name: addressName, // 终点名称 | |
| 369 | + // address: addressName, // 地址描述 | |
| 370 | + // scale: 16, // 地图缩放级别 | |
| 371 | + // success: () => { | |
| 372 | + // // 唤起地图选择弹窗成功,用户可以选择高德/百度地图进行导航 | |
| 373 | + // }, | |
| 374 | + // fail: (err) => { | |
| 375 | + // console.error("打开地图失败", err); | |
| 376 | + // uni.showToast({ title: "打开地图失败", icon: "none" }); | |
| 377 | + // } | |
| 378 | + // }); | |
| 379 | +}; | |
| 380 | + | |
| 381 | + | |
| 354 | 382 | // 分页查询列表 |
| 355 | 383 | const queryList = async (pageNo, pageSize) => { |
| 356 | 384 | try { | ... | ... |