上饶市警务平台后台管理前端
guoshilong
2023-02-14 f6ca44fd34e71b9d5ae9a52ac6b7781a13b8ed7b
src/components/map/mapBox.vue
@@ -32,7 +32,7 @@
export default {
    name: 'mapBox',
    props: ['routeRange', 'isDetail'],
  props: ['routeRange', 'isDetail', "searchMap"],
    data () {
        return {
            map: null,
@@ -73,7 +73,7 @@
                ],
                view: new View({
                    // 设置中心点,默认南昌,用于规划南昌市的路线
                    center: [115.9032747077233, 28.67433116990186],
          center: [117.951478782, 28.447896798],
                    projection: 'EPSG:4326',
                    // 设置缩放倍数
                    zoom: 13,
@@ -81,6 +81,7 @@
                    maxZoom: 19
                })
            })
            _this.lineVector = new VectorLayer({
                //layer所对应的source
                source: new VectorSource({
@@ -184,10 +185,6 @@
                })
            }
        },
        //回显多边形区域
        addPolygon(area){
        },
        // 将点坐标集合转换为数据库数据
        doData (val) {
            let str = "LINESTRING("
@@ -213,16 +210,20 @@
                _this.showTip = true
            }
            _this.tipTitle = "单击左键或者右键开始绘画"
            //提示器
            function mapMousemove (e) {
                _this.setTipPosition(e.offsetX, e.offsetY, 5, 5)
            }
            this.$refs.MapContent.addEventListener('mousemove', mapMousemove)
          // this.$refs.MapContent.removeEventListener('mousemove', mapMousemove)
            function mapMousedown () {
                _this.tipTitle = "可继续,或选择最终位置双击结束绘画"
            }
            this.$refs.MapContent.addEventListener('mousedown', mapMousedown)
            // this.$refs.MapContent.removeEventListener('mousedown', mapMousedown)
@@ -420,12 +421,12 @@
            _this.tipPosition.h = y + m
        },
        startAdd (routeRange) {
      if (routeRange) {
            if (routeRange.startsWith("LINESTRING")) {
                this.addLineDraw(routeRange)
            } else if (routeRange.startsWith("POINT")) {
                this.addPoint(routeRange)
            } else if (routeRange.startsWith("POLYGON")){
              this.addPolygon(routeRange)
        }
            }
        }
    },