Newer
Older
KaiFengH5 / src / views / lsxmsb / TemporaryProject.vue
@鲁yixuan 鲁yixuan on 26 Aug 1 KB updata
<template>
  <!-- 地图 -->
  <div class="position-r" id="map"></div>
</template>

<script setup name="TemporaryProject">
import { getProjects } from '@/api/publicApi.js';
const getProjectss = async () => {
  let { data } = await getProjects();
  let features = data;
  console.log(features, 'features');
  // let features = data
  //   .filter((i) => i.projectLocation)
  //   .map((i) => {
  //     if (i.projectLocation.indexOf('POINT') > -1) {
  //       i.feature = {
  //         type: 'Feature',
  //         geometry: WKT.parse(i.projectLocation),
  //         properties: {
  //           ...i,
  //           mapParams: {
  //             icon: ICONS_MAP[i.projectTypeCode],
  //             group: i.projectTypeCode,
  //             name: i.projectName,
  //           },
  //         },
  //       };
  //       return i.feature;
  //     } else {
  //       return turf.point(i.projectLocation.split(',').map(Number), {
  //         ...i,
  //         mapParams: {
  //           icon: ICONS_MAP[i.projectTypeCode],
  //           group: i.projectTypeCode,
  //           name: i.projectName,
  //         },
  //       });
  //     }
  //   });
  // amapUtils.geojsonToMap(turf.featureCollection(features));
};

onMounted(() => {
  getProjectss();
  // 初始化地图
  // let interVal = setInterval(() => {
  //   if (window.AMap) init(), clearInterval(interVal);
  // }, 500);
});
</script>

<style lang="less" scoped>
.position-r {
  position: relative;
  width: 100%;
  height: 100%;
  background: #c6c6c6;
}
</style>