Browse Source

👈 编写高德地图组件

master
wangxiang 3 years ago
parent
commit
814935649f
  1. 32
      kicc-ui/src/components/AMap/src/Amap.vue
  2. 2
      kicc-ui/tsconfig.json

32
kicc-ui/src/components/AMap/src/Amap.vue

@ -67,6 +67,7 @@ @@ -67,6 +67,7 @@
let largeHospitalMarkerCluster;
let smallHospitalMarkerCluster;
let takeSpecimenCluster;
let scanTakeSpecimenCircleRange;
const instance = getCurrentInstance();
const mapState = reactive({
loading: false,
@ -124,8 +125,9 @@ @@ -124,8 +125,9 @@
AMapLoader.load({
key: mapConfig.amapKey,
version: '2.0',
plugins: ['AMap.MarkerCluster', 'AMap.RectangleEditor', 'AMap.Driving']
plugins: ['AMap.MarkerCluster', 'AMap.Driving']
}).then(AMap => {
//
map = new AMap.Map(instance.refs.mapview, mapConfig.options);
map.plugin(['AMap.ToolBar', 'AMap.MapType', 'AMap.ControlBar', 'AMap.Scale'], () => {
@ -292,6 +294,21 @@ @@ -292,6 +294,21 @@
map: map,
panel: instance.refs.mapPanel
});
//
scanTakeSpecimenCircleRange = new AMap.Circle({
radius: 2000,
borderWeight: 3,
strokeColor: '#3600ff',
strokeOpacity: 0.2,
strokeWeight: 6,
fillOpacity: 0.4,
strokeStyle: 'dashed',
strokeDasharray: [8, 8],
fillColor: '#1791fc',
zIndex: 50
});
// 线
driving.search(new AMap.LngLat(112.913864, 28.295114), new AMap.LngLat(112.918119, 28.282891), {
waypoints:[new AMap.LngLat(112.919165, 28.289924)]
@ -347,8 +364,17 @@ @@ -347,8 +364,17 @@
//
const smallHospitalMap = smallHospitalMapList.find(item => item.id == value);
if (smallHospitalMap) {
//
map.setZoomAndCenter(18, [smallHospitalMap.lng, smallHospitalMap.lat]);
// 20,,
map.remove(scanTakeSpecimenCircleRange);
scanTakeSpecimenCircleRange.setCenter([smallHospitalMap.lng, smallHospitalMap.lat]);
map.add(scanTakeSpecimenCircleRange);
map.setFitView([ scanTakeSpecimenCircleRange ]);
//
const specimenLngLat = new AMap.LngLat(116.403984,39.907535);
if (scanTakeSpecimenCircleRange.contains()) {
}
} else {
throw '查找不到发单点数据,请检查发单点!';

2
kicc-ui/tsconfig.json

@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
"noImplicitAny": false,
"skipLibCheck": true,
"types": ["vite/client"],
"typeRoots": ["./node_modules/@types/", "./types"],
"typeRoots": ["./node_modules/@types/", "./types", "./node_modules/@amap/amap-jsapi-loader/src"],
"removeComments": true,
"paths": {
"/@/*": ["src/*"],

Loading…
Cancel
Save