Browse Source

调整地图设计器数据结构

master
wangxiang 3 years ago
parent
commit
6f4c82ab32
  1. 44
      src/components/AMap/src/AMapDesigner/index.vue
  2. 2
      src/views/common/mapLogistic/index.vue

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

@ -69,7 +69,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import AMapLoader from '@amap/amap-jsapi-loader'; 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 { operatePanelColumns, MapData, MapPointType } from '../amap.data';
import hospital from '/@/assets/images/hospital.svg'; import hospital from '/@/assets/images/hospital.svg';
import medicalKit from '/@/assets/images/medical-kit.svg'; import medicalKit from '/@/assets/images/medical-kit.svg';
@ -189,12 +189,10 @@
const AForm = Form; const AForm = Form;
const AFormItem = Form.Item; const AFormItem = Form.Item;
const ASelect = Select; const ASelect = Select;
const ATooltip = Tooltip;
const formElRef = ref(); const formElRef = ref();
const [registerTable, { setTableData }] = useTable({ const [registerTable, { setTableData }] = useTable({
title: '任务列表', title: '任务列表',
rowKey: 'id', rowKey: 'id',
dataSource: mapState.mapData?.mapTask,
columns: operatePanelColumns, columns: operatePanelColumns,
resizeHeightOffset: 100, resizeHeightOffset: 100,
showTableSetting: true, showTableSetting: true,
@ -428,21 +426,6 @@
panel: instance.refs.mapPanel 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(); complete();
}).catch(error => { }).catch(error => {
@ -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(() => { onUnmounted(() => {
if (map) { if (map) {
// //
@ -572,7 +575,10 @@
} }
} }
handleMapReset(); handleMapReset();
mapState.mapData = cloneDeep(merge(defaultMapData(), options)); nextTick(() => {
mapState.mapData = cloneDeep(merge(defaultMapData(), options));
setTableData(mapState.mapData.mapTask);
});
} }
/** 获取部件表单数据 */ /** 获取部件表单数据 */

2
src/views/common/mapLogistic/index.vue

@ -39,7 +39,7 @@
import { columns, searchFormSchema } from './mapLogistic.data'; import { columns, searchFormSchema } from './mapLogistic.data';
import { useMessage } from '/@/hooks/web/useMessage'; import { useMessage } from '/@/hooks/web/useMessage';
import AmapTaskModal from './MapLogisticModal.vue'; import AmapTaskModal from './MapLogisticModal.vue';
import { listMapLogistic, delMapLogistic } from '/@/api/platform/common/controller/mapLogistic' import { listMapLogistic, delMapLogistic } from '/@/api/platform/common/controller/mapLogistic';
const { createConfirm, createMessage } = useMessage(); const { createConfirm, createMessage } = useMessage();
const [registerModal, { openModal }] = useModal(); const [registerModal, { openModal }] = useModal();

Loading…
Cancel
Save