| @@ -967,6 +967,7 @@ | |||
| }, | |||
| mapTownList: null, | |||
| mapVillageList: null, | |||
| coordinate: "", | |||
| //地图使用 --end | |||
| }; | |||
| }, | |||
| @@ -1651,41 +1652,75 @@ | |||
| }); | |||
| //定位当前位置 ------end | |||
| //开始绘制图层- -----start | |||
| $("#htMapAll").on("click", function () { | |||
| console.log("进入绘制图层") | |||
| //删除之前 测距操作添加map中的绘图 --------start | |||
| //map.removeLayer(helpTooltip); | |||
| map.removeLayer(vector); | |||
| map.removeInteraction(draw_cm); | |||
| //map.removeOverlay(helpTooltipElement); | |||
| map.removeLayer(measureTooltipElement); | |||
| //删除之前 测距操作添加map中的绘图 --------end | |||
| //开始绘制图层- -----start | |||
| $("#htMapAll").on("click", function () { | |||
| console.log("进入绘制图层") | |||
| //删除之前 测距操作添加map中的绘图 --------start | |||
| //map.removeLayer(helpTooltip); | |||
| map.removeLayer(vector); | |||
| map.removeInteraction(draw_cm); | |||
| //map.removeOverlay(helpTooltipElement); | |||
| map.removeLayer(measureTooltipElement); | |||
| //删除之前 测距操作添加map中的绘图 --------end | |||
| //that.closeMoule = null; | |||
| map.removeInteraction(draw_map); | |||
| //var source = new ol.source.Vector({wrapX: false}); | |||
| drawing = new ol.layer.Vector({ | |||
| source: new ol.source.Vector(), | |||
| }); | |||
| map.addLayer(drawing); | |||
| //删除之前画图图层,重新绘制图层 | |||
| map.removeInteraction(draw_map); | |||
| map.removeLayer(drawing); | |||
| //var source = new ol.source.Vector({wrapX: false}); | |||
| drawing = new ol.layer.Vector({ | |||
| source: new ol.source.Vector(), | |||
| }); | |||
| map.addLayer(drawing); | |||
| function addInteraction() { | |||
| draw_map = new ol.interaction.Draw({ | |||
| source: drawing.getSource(), | |||
| type: "Polygon" | |||
| }); | |||
| draw_map.on('drawend', function (evt) { | |||
| var feature = evt.feature; | |||
| var geometry = feature.getGeometry(); | |||
| var coordinate = geometry.getCoordinates(); | |||
| that.closeMoule = coordinate; | |||
| }); | |||
| map.addInteraction(draw_map); | |||
| function addInteraction() { | |||
| draw_map = new ol.interaction.Draw({ | |||
| source: drawing.getSource(), | |||
| type: "Polygon", | |||
| }); | |||
| draw_map.on("drawend", function (evt) { | |||
| var feature = evt.feature; | |||
| var geometry = feature.getGeometry(); | |||
| that.coordinate = geometry.getCoordinates(); | |||
| //_this.coordinateList = coordinate.toString(); | |||
| //提示当前坐标是否绘制完成 | |||
| if(that.coordinate != "" && that.coordinate !=null) { | |||
| htMapAllFu(); | |||
| }else { | |||
| console.log("6"); | |||
| $("#htMapAll").trigger("click"); | |||
| } | |||
| addInteraction(); | |||
| }); | |||
| //开始绘制图层- -----end | |||
| map.addInteraction(draw_map); | |||
| } | |||
| function htMapAllFu() { | |||
| //that.drawMapPolygonFun(); | |||
| //绘制多边形地图 | |||
| that.$dialog | |||
| .confirm({ | |||
| title: "提示", | |||
| message: "是否重新绘制画图", | |||
| }) | |||
| .then(() => { | |||
| //$("#drawRemove").trigger("click"); | |||
| map.removeLayer(drawing); | |||
| that.coordinate = ""; | |||
| }) | |||
| .catch(() => { | |||
| //删除画图点 | |||
| map.removeInteraction(draw_map); | |||
| }); | |||
| } | |||
| addInteraction(); | |||
| }); | |||
| //开始绘制图层- -----end | |||
| //清除画图鼠标点击事件 | |||
| // $("#drawRemove").click(function () { | |||
| // map.removeLayer(drawing); | |||
| // }); | |||
| // | |||
| //获取类型开始 侧面-----------------------------------------------------------------start | |||
| $("#area").click(function () { | |||
| @@ -2379,31 +2414,7 @@ | |||
| }, | |||
| //绘制多边形地图 | |||
| drawMapPolygonFun() { | |||
| let drawMapPolygon = this.draw.drawMapPolygon; | |||
| if (drawMapPolygon == false) { | |||
| if (this.coordinateList == "") { | |||
| this.$set(this.draw, "drawMapPolygon", true); | |||
| $("#drawPolygon").trigger("click"); | |||
| } else { | |||
| this.$dialog | |||
| .confirm({ | |||
| title: "提示", | |||
| message: "是否重新绘制画图", | |||
| }) | |||
| .then(() => { | |||
| // on confirm | |||
| this.coordinateList = ""; | |||
| this.$set(this.draw, "drawMapPolygon", true); | |||
| $("#drawPolygon").trigger("click"); | |||
| }) | |||
| .catch(() => { | |||
| // on cancel | |||
| }); | |||
| } | |||
| } else { | |||
| $("#drawRemove").trigger("click"); | |||
| this.$set(this.draw, "drawMapPolygon", false); | |||
| } | |||
| }, | |||
| guidProduct(){ | |||
| return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { | |||