|
|
|
@ -69,7 +69,7 @@
@@ -69,7 +69,7 @@
|
|
|
|
|
</template> |
|
|
|
|
<script lang="ts" setup> |
|
|
|
|
import AMapLoader from '@amap/amap-jsapi-loader'; |
|
|
|
|
import { reactive, watchEffect, getCurrentInstance, onBeforeMount, onUnmounted, ref, PropType, watch, toRefs, nextTick } from 'vue'; |
|
|
|
|
import { reactive, watchEffect, getCurrentInstance, onBeforeMount, onUnmounted, ref, PropType, watch, toRefs, nextTick, onMounted } from 'vue'; |
|
|
|
|
import { operatePanelColumns, MapData, MapPointType } from '../amap.data'; |
|
|
|
|
import hospital from '/@/assets/images/hospital.svg'; |
|
|
|
|
import medicalKit from '/@/assets/images/medical-kit.svg'; |
|
|
|
@ -189,12 +189,10 @@
@@ -189,12 +189,10 @@
|
|
|
|
|
const AForm = Form; |
|
|
|
|
const AFormItem = Form.Item; |
|
|
|
|
const ASelect = Select; |
|
|
|
|
const ATooltip = Tooltip; |
|
|
|
|
const formElRef = ref(); |
|
|
|
|
const [registerTable, { setTableData }] = useTable({ |
|
|
|
|
title: '任务列表', |
|
|
|
|
rowKey: 'id', |
|
|
|
|
dataSource: mapState.mapData?.mapTask, |
|
|
|
|
columns: operatePanelColumns, |
|
|
|
|
resizeHeightOffset: 100, |
|
|
|
|
showTableSetting: true, |
|
|
|
@ -428,21 +426,6 @@
@@ -428,21 +426,6 @@
|
|
|
|
|
panel: instance.refs.mapPanel |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// 加载地图数据,并且绘制路线 |
|
|
|
|
if (!isEmpty(mapState.mapData.mapLogisticPoint)) { |
|
|
|
|
const lngLatData = mapState.mapData.mapLogisticPoint.map(item => new AMap.LngLat(item.lng, item.lat)); |
|
|
|
|
const destination = lngLatData.pop(); |
|
|
|
|
destination && driving.search(new AMap.LngLat(mapState.mapData.courierLng, mapState.mapData.courierLat), destination, { |
|
|
|
|
waypoints: lngLatData |
|
|
|
|
}, function(status, result) { |
|
|
|
|
if (status === 'complete') { |
|
|
|
|
console.log('绘制地图路线完成'); |
|
|
|
|
} else { |
|
|
|
|
console.error('获取地图数据失败:' + result); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 加载完毕 |
|
|
|
|
complete(); |
|
|
|
|
}).catch(error => { |
|
|
|
@ -452,6 +435,26 @@
@@ -452,6 +435,26 @@
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
|
// 加载地图设计器默认配置 |
|
|
|
|
mapState.mapData = defaultMapData(); |
|
|
|
|
setTableData(mapState.mapData.mapTask); |
|
|
|
|
// 加载地图数据,并且绘制路线 |
|
|
|
|
if (!isEmpty(mapState.mapData.mapLogisticPoint)) { |
|
|
|
|
const lngLatData = mapState.mapData.mapLogisticPoint.map(item => new AMap.LngLat(item.lng, item.lat)); |
|
|
|
|
const destination = lngLatData.pop(); |
|
|
|
|
destination && driving.search(new AMap.LngLat(mapState.mapData.courierLng, mapState.mapData.courierLat), destination, { |
|
|
|
|
waypoints: lngLatData |
|
|
|
|
}, function(status, result) { |
|
|
|
|
if (status === 'complete') { |
|
|
|
|
console.log('绘制地图路线完成'); |
|
|
|
|
} else { |
|
|
|
|
console.error('获取地图数据失败:' + result); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
onUnmounted(() => { |
|
|
|
|
if (map) { |
|
|
|
|
// 销毁地图实例 |
|
|
|
@ -572,7 +575,10 @@
@@ -572,7 +575,10 @@
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
handleMapReset(); |
|
|
|
|
mapState.mapData = cloneDeep(merge(defaultMapData(), options)); |
|
|
|
|
nextTick(() => { |
|
|
|
|
mapState.mapData = cloneDeep(merge(defaultMapData(), options)); |
|
|
|
|
setTableData(mapState.mapData.mapTask); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** 获取部件表单数据 */ |
|
|
|
|