MrShi
6 天以前 4fabfe4dbd2eb28d07a4350597d314958cc1c281
admin/src/views/operation/components/AMap.vue
@@ -1,6 +1,6 @@
<template>
  <GlobalWindow title="绘制运营区域" :visible.sync="isShowModal" :confirm-working="isWorking" @close="close"
    @confirm="confirm" width="1000px">
    @confirm="confirm" width="100%">
    <div class="map_title">绘制:鼠标左键点击及移动即可绘制图形,绘制过程中按下esc键可中断该过程</div>
    <div class="map_title">鼠标左键双击即可结束当前多边形绘制,多边形会自动闭合;</div>
    <div class="map_wrap">
@@ -10,7 +10,7 @@
        <!-- <el-button plain @click="reset">重新绘制</el-button> -->
        <!-- <el-button plain  type="danger" @click="deleteObj">删除</el-button> -->
      </div>
      <div id="container" style="width: 100%; height: 100%"></div>
      <div id="containera" style="width: 100%; height: 100%"></div>
    </div>
  </GlobalWindow>
</template>
@@ -38,9 +38,25 @@
  },
  methods: {
    initMap() {
      map = new TMap.Map("container", {
        zoom: 15, // 设置地图缩放级别
        center: new TMap.LatLng(31.722763, 117.385480) // 设置地图中心点坐标
      // navigator.geolocation.getCurrentPosition(
      //   (position) => {
      //     const { latitude, longitude } = position.coords
      //     console.log(`当前定位: 纬度 ${latitude}, 经度 ${longitude}`)
      //   },
      //   (error) => {
      //     console.error("定位失败:", error.message)
      //   },
      //   {
      //     enableHighAccuracy: true, // 提高定位精度
      //     timeout: 5000, // 超时时间
      //     maximumAge: 0 // 禁用缓存
      //   }
      // )
      console.log('-----', this.row)
      map = new TMap.Map("containera", {
        zoom: this.polygons.length > 0 ? 20 : 16, // 设置地图缩放级别
        center: this.polygons.length > 0 ? new TMap.LatLng(this.polygons[0].lat, this.polygons[0].lng) : new TMap.LatLng(31.722763, 117.385480) // 设置地图中心点坐标
      })
      var tempList = []
      if (this.polygons.length > 0) {
@@ -141,4 +157,4 @@
    z-index: 99999999999;
  }
}
</style>
</style>