|  |  |  | 
|---|
|  |  |  | RegExp.$1, | 
|---|
|  |  |  | (date.getFullYear() + "").substr(4 - RegExp.$1.length) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | for (var k in o) | 
|---|
|  |  |  | for (let k in o) | 
|---|
|  |  |  | if (new RegExp("(" + k + ")").test(fmt)) | 
|---|
|  |  |  | fmt = fmt.replace( | 
|---|
|  |  |  | RegExp.$1, | 
|---|
|  |  |  | 
|---|
|  |  |  | enableMapClick: false, //取消默认窗口 | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | // 设置地图中心点和缩放级别 | 
|---|
|  |  |  | var point = new BMapGL.Point(116.404, 39.915); | 
|---|
|  |  |  | let point = new BMapGL.Point(116.404, 39.915); | 
|---|
|  |  |  | this.map.centerAndZoom("苏州市", 15); | 
|---|
|  |  |  | this.map.enableScrollWheelZoom(true); // 开启鼠标滚轮,地图可以进行放大、缩小s | 
|---|
|  |  |  | this.drawingManager = new BMapGLLib.DrawingManager(this.map, { | 
|---|
|  |  |  | 
|---|
|  |  |  | <a-divider type="vertical" /> | 
|---|
|  |  |  | <a onClick={() => this.handleEditbatch(record)}> 批量添加 </a> | 
|---|
|  |  |  | <a-divider type="vertical" /> | 
|---|
|  |  |  | <a onClick={() => this.canvasbatch(record)}> 绘制批量添加 </a> | 
|---|
|  |  |  | <a-divider type="vertical" /> | 
|---|
|  |  |  | <a-popconfirm | 
|---|
|  |  |  | title="确认删除吗?" | 
|---|
|  |  |  | ok-text="确定" | 
|---|
|  |  |  | 
|---|
|  |  |  | private batchid: any = 0; | 
|---|
|  |  |  | private batchshow: boolean = false; | 
|---|
|  |  |  | private handleEditbatch(record: any) { | 
|---|
|  |  |  | let ptsWithin = turf.pointsWithinPolygon(this.multiPt, this.turfPolygon); | 
|---|
|  |  |  | console.log("ptsWithin", ptsWithin); | 
|---|
|  |  |  | let data: { flylon: number; flylat: number }[] = []; | 
|---|
|  |  |  | turf.coordEach(ptsWithin, (currentCoord) => { | 
|---|
|  |  |  | data.push({ | 
|---|
|  |  |  | flylon: currentCoord[0], | 
|---|
|  |  |  | flylat: currentCoord[1], | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | console.log("data", data); | 
|---|
|  |  |  | this.check = false; | 
|---|
|  |  |  | this.startstate = "batch"; | 
|---|
|  |  |  | post("coordinateDetail/batch", { | 
|---|
|  |  |  | coordinateId: record.coordinateId, | 
|---|
|  |  |  | list: data, | 
|---|
|  |  |  | mac: this.carvalue, | 
|---|
|  |  |  | }).then((res) => { | 
|---|
|  |  |  | console.log(res); | 
|---|
|  |  |  | this.$message.success(res.data.message); | 
|---|
|  |  |  | // this.selectCar() | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | this.batchshow = true; | 
|---|
|  |  |  | // this.selectCar(); | 
|---|
|  |  |  | this.batchid = record.coordinateId; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | private handlebatch() { | 
|---|
|  |  |  | // this.selectCar() | 
|---|
|  |  |  | 
|---|
|  |  |  | console.log("this.starttime", this.starttime); | 
|---|
|  |  |  | console.log("this.starttime", this.endtime); | 
|---|
|  |  |  | post("coordinateDetail/batch", { | 
|---|
|  |  |  | type: "0", | 
|---|
|  |  |  | time1: this.starttime, | 
|---|
|  |  |  | time2: this.endtime, | 
|---|
|  |  |  | coordinateId: this.batchid, | 
|---|
|  |  |  | mac: this.carvalue, | 
|---|
|  |  |  | }).then((res) => { | 
|---|
|  |  |  | 
|---|
|  |  |  | this.$message.success(res.data.message); | 
|---|
|  |  |  | this.starttime = ""; | 
|---|
|  |  |  | this.endtime = ""; | 
|---|
|  |  |  | // this.selectCar() | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | private canvasbatch(record: any) { | 
|---|
|  |  |  | let ptsWithin = turf.pointsWithinPolygon(this.multiPt, this.turfPolygon); | 
|---|
|  |  |  | console.log("ptsWithin", ptsWithin); | 
|---|
|  |  |  | let data: { flylon: number; flylat: number }[] = []; | 
|---|
|  |  |  | turf.coordEach(ptsWithin, (currentCoord) => { | 
|---|
|  |  |  | data.push({ | 
|---|
|  |  |  | flylon: currentCoord[0], | 
|---|
|  |  |  | flylat: currentCoord[1], | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | console.log("data", data); | 
|---|
|  |  |  | this.check = false; | 
|---|
|  |  |  | this.startstate = "batch"; | 
|---|
|  |  |  | post("coordinateDetail/batch", { | 
|---|
|  |  |  | type: "1", | 
|---|
|  |  |  | coordinateId: record.coordinateId, | 
|---|
|  |  |  | list: data, | 
|---|
|  |  |  | mac: this.carvalue, | 
|---|
|  |  |  | }).then((res) => { | 
|---|
|  |  |  | console.log(res); | 
|---|
|  |  |  | this.$message.success(res.data.message); | 
|---|
|  |  |  | // this.selectCar() | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | that.carDataList = []; | 
|---|
|  |  |  | let pointSlint = []; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for (var i = 0; i < res.data.data.rsData.length; i++) { | 
|---|
|  |  |  | for (let i = 0; i < res.data.data.rsData.length; i++) { | 
|---|
|  |  |  | that.carDate.push(res.data.data.rsData[i]); | 
|---|
|  |  |  | pointSlint.push(res.data.data.rsData[i].data.split("_").map(Number)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.multiPt = turf.points([...pointSlint]); | 
|---|
|  |  |  | for (var i = 0; i < res.data.data.data.length; i++) { | 
|---|
|  |  |  | for (let i = 0; i < res.data.data.data.length; i++) { | 
|---|
|  |  |  | that.carDataList.push(res.data.data.data[i]); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | that.map.clearOverlays(); | 
|---|
|  |  |  | 
|---|
|  |  |  | if (res.status === 200) { | 
|---|
|  |  |  | for (let i = 0; i < that.carDate.length; i++) { | 
|---|
|  |  |  | //创建单个point | 
|---|
|  |  |  | var myIcon = new BMapGL.Icon( | 
|---|
|  |  |  | let myIcon = new BMapGL.Icon( | 
|---|
|  |  |  | require("@/assets/723cd95f31481a502d495b2d814d658.png"), | 
|---|
|  |  |  | new BMapGL.Size(50, 50), | 
|---|
|  |  |  | {} | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | var startIcon = new BMapGL.Icon( | 
|---|
|  |  |  | let startIcon = new BMapGL.Icon( | 
|---|
|  |  |  | require("@/assets/start.png"), | 
|---|
|  |  |  | new BMapGL.Size(50, 50), | 
|---|
|  |  |  | {} | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | var endIcon = new BMapGL.Icon( | 
|---|
|  |  |  | let endIcon = new BMapGL.Icon( | 
|---|
|  |  |  | require("@/assets/end.png"), | 
|---|
|  |  |  | new BMapGL.Size(50, 50), | 
|---|
|  |  |  | {} | 
|---|
|  |  |  | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | that.marker[i].iconPng = "myIcon"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | var infoWindow = ""; | 
|---|
|  |  |  | let infoWindow = ""; | 
|---|
|  |  |  | //that.marker[i].name = that.carDate[i].time; | 
|---|
|  |  |  | that.marker[i].on("mouseover", function(e) { | 
|---|
|  |  |  | infoWindow = new BMapGL.InfoWindow( | 
|---|
|  |  |  | 
|---|
|  |  |  | for (let i = 0; i < that.carDataList.length; i++) { | 
|---|
|  |  |  | // console.log(that.carDataList[i],'that.carDataList[i]'); | 
|---|
|  |  |  | //创建单个point | 
|---|
|  |  |  | var myIcon = new BMapGL.Icon( | 
|---|
|  |  |  | let myIcon = new BMapGL.Icon( | 
|---|
|  |  |  | require("@/assets/fb259ce2e368f6853a58b91d6f6b293.png"), | 
|---|
|  |  |  | new BMapGL.Size(50, 50) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private setZoom(bPoints: any) { | 
|---|
|  |  |  | var view = this.map.getViewport(eval(bPoints)); | 
|---|
|  |  |  | var mapZoom = view.zoom; | 
|---|
|  |  |  | var centerPoint = view.center; | 
|---|
|  |  |  | let view = this.map.getViewport(eval(bPoints)); | 
|---|
|  |  |  | let mapZoom = view.zoom; | 
|---|
|  |  |  | let centerPoint = view.center; | 
|---|
|  |  |  | this.map.centerAndZoom(centerPoint, mapZoom); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | private selectLuName: any = null; | 
|---|
|  |  |  | private selectLu() { | 
|---|
|  |  |  | var macType = null; | 
|---|
|  |  |  | let macType = null; | 
|---|
|  |  |  | if (this.carvalue !== "请选择走航车") { | 
|---|
|  |  |  | macType = this.carvalue; | 
|---|
|  |  |  | } | 
|---|