|  |  |  | 
|---|
|  |  |  | import { get, post } from "@/util/request"; | 
|---|
|  |  |  | import org from "@/util/org"; | 
|---|
|  |  |  | import axios from "axios"; | 
|---|
|  |  |  | import { jsonp }  from 'vue-jsonp' | 
|---|
|  |  |  | import { jsonp } from "vue-jsonp"; | 
|---|
|  |  |  | import any = jasmine.any; | 
|---|
|  |  |  | import { da } from "date-fns/locale"; | 
|---|
|  |  |  | import {Moment} from 'moment'; | 
|---|
|  |  |  | import { Moment } from "moment"; | 
|---|
|  |  |  | @Component({ | 
|---|
|  |  |  | components: { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | components: {}, | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | export default class road extends Vue { | 
|---|
|  |  |  | private timevalue:any=[] | 
|---|
|  |  |  | private timevalue: any = []; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private change1(dates: Moment[]) { | 
|---|
|  |  |  | this.timevalue=[] | 
|---|
|  |  |  | this.timevalue=[dates[0].format("YYYY-MM-DD HH:mm"),dates[1].format("YYYY-MM-DD HH:mm")] | 
|---|
|  |  |  |  | 
|---|
|  |  |  | this.timevalue = []; | 
|---|
|  |  |  | this.timevalue = [ | 
|---|
|  |  |  | dates[0].format("YYYY-MM-DD HH:mm"), | 
|---|
|  |  |  | dates[1].format("YYYY-MM-DD HH:mm"), | 
|---|
|  |  |  | ]; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | private  mounted() { | 
|---|
|  |  |  | this.roadmap(); | 
|---|
|  |  |  | 
|---|
|  |  |  | "m+": date.getMinutes(),                 //分 | 
|---|
|  |  |  | "s+": date.getSeconds(),                 //秒 | 
|---|
|  |  |  | "q+": Math.floor((date.getMonth() + 3) / 3), //季度 | 
|---|
|  |  |  | "S": date.getMilliseconds()             //毫秒 | 
|---|
|  |  |  | } | 
|---|
|  |  |  | S: date.getMilliseconds(), //毫秒 | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | if (/(y+)/.test(fmt)) | 
|---|
|  |  |  | fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length)); | 
|---|
|  |  |  | fmt = fmt.replace( | 
|---|
|  |  |  | RegExp.$1, | 
|---|
|  |  |  | (date.getFullYear() + "").substr(4 - RegExp.$1.length) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | for (var k in o) | 
|---|
|  |  |  | if (new RegExp("(" + k + ")").test(fmt)) | 
|---|
|  |  |  | fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length))) | 
|---|
|  |  |  | return fmt | 
|---|
|  |  |  | fmt = fmt.replace( | 
|---|
|  |  |  | RegExp.$1, | 
|---|
|  |  |  | RegExp.$1.length == 1 | 
|---|
|  |  |  | ? o[k] | 
|---|
|  |  |  | : ("00" + o[k]).substr(("" + o[k]).length) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | return fmt; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | private map:any | 
|---|
|  |  |  | private map: any; | 
|---|
|  |  |  | private roadmap(){ | 
|---|
|  |  |  | this.map = new BMapGL.Map('roadmap') | 
|---|
|  |  |  | this.map = new BMapGL.Map("roadmap"); | 
|---|
|  |  |  | // 设置地图中心点和缩放级别 | 
|---|
|  |  |  | var point = new BMapGL.Point(116.404, 39.915); | 
|---|
|  |  |  | this.map.centerAndZoom('苏州市', 15); | 
|---|
|  |  |  | this.map.enableScrollWheelZoom(true) // 开启鼠标滚轮,地图可以进行放大、缩小s | 
|---|
|  |  |  | this.map.centerAndZoom("苏州市", 15); | 
|---|
|  |  |  | this.map.enableScrollWheelZoom(true); // 开启鼠标滚轮,地图可以进行放大、缩小s | 
|---|
|  |  |  | } | 
|---|
|  |  |  | private dataSource: any[] = []; | 
|---|
|  |  |  | private visibleCreateModal1: boolean = false; | 
|---|
|  |  |  | 
|---|
|  |  |  | title: "操作", | 
|---|
|  |  |  | customRender: this.opRender, | 
|---|
|  |  |  | align: "center", | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | ]; | 
|---|
|  |  |  | private openIn(){ | 
|---|
|  |  |  | this.visibleCreateModal1=true; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | private startLu:any='' | 
|---|
|  |  |  | private endLu:any='' | 
|---|
|  |  |  | private startLu: any = ""; | 
|---|
|  |  |  | private endLu: any = ""; | 
|---|
|  |  |  | private insertCarLu(){ | 
|---|
|  |  |  | if(this.carvalue==='请选择走航车'){ | 
|---|
|  |  |  | this.$message.warning('添加请先选择走航车!') | 
|---|
|  |  |  | return | 
|---|
|  |  |  | if (this.carvalue === "请选择走航车") { | 
|---|
|  |  |  | this.$message.warning("添加请先选择走航车!"); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | post('coordinate/interCruiserRoad',{ | 
|---|
|  |  |  | post("coordinate/interCruiserRoad", { | 
|---|
|  |  |  | startPoint:this.startLu, | 
|---|
|  |  |  | mac:this.carvalue | 
|---|
|  |  |  |  | 
|---|
|  |  |  | mac: this.carvalue, | 
|---|
|  |  |  | }).then((res)=>{ | 
|---|
|  |  |  | console.log(res); | 
|---|
|  |  |  | this.$message.success(res.data.message) | 
|---|
|  |  |  | this.$message.success(res.data.message); | 
|---|
|  |  |  | this.visibleCreateModal1=false; | 
|---|
|  |  |  | this.startLu='' | 
|---|
|  |  |  | this.endLu='' | 
|---|
|  |  |  | this.selectLu() | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | this.startLu = ""; | 
|---|
|  |  |  | this.endLu = ""; | 
|---|
|  |  |  | this.selectLu(); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private opRender(text: string, record: any, index: number) { | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | <div style="width:180px"> | 
|---|
|  |  |  | <a onClick={() => this.handleEditModalVisible(record)}> | 
|---|
|  |  |  | {" "} | 
|---|
|  |  |  | 编辑{" "} | 
|---|
|  |  |  | </a> | 
|---|
|  |  |  | <a onClick={() => this.handleEditModalVisible(record)}> 编辑 </a> | 
|---|
|  |  |  | <a-divider type="vertical"/> | 
|---|
|  |  |  | <a onClick={() => this.handleEditbatch(record)}> | 
|---|
|  |  |  | {" "} | 
|---|
|  |  |  | 批量添加{" "} | 
|---|
|  |  |  | </a> | 
|---|
|  |  |  | <a onClick={() => this.handleEditbatch(record)}> 批量添加 </a> | 
|---|
|  |  |  | <a-divider type="vertical"/> | 
|---|
|  |  |  | <a-popconfirm | 
|---|
|  |  |  | title="确认删除吗?" | 
|---|
|  |  |  | 
|---|
|  |  |  | <a href="#">删除</a> | 
|---|
|  |  |  | </a-popconfirm> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | private deleteDevice(record){ | 
|---|
|  |  |  | get('coordinate/deleteCruiserRoad',{ | 
|---|
|  |  |  | id:record.coordinateId | 
|---|
|  |  |  | get("coordinate/deleteCruiserRoad", { | 
|---|
|  |  |  | id: record.coordinateId, | 
|---|
|  |  |  | }).then((res)=>{ | 
|---|
|  |  |  | console.log(res); | 
|---|
|  |  |  | this.$message.success(res.data.message) | 
|---|
|  |  |  | this.selectLu() | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | this.$message.success(res.data.message); | 
|---|
|  |  |  | this.selectLu(); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | private pointshow:boolean=false | 
|---|
|  |  |  | private batchid:any=0 | 
|---|
|  |  |  | private batchshow:boolean=false | 
|---|
|  |  |  | private pointshow: boolean = false; | 
|---|
|  |  |  | private batchid: any = 0; | 
|---|
|  |  |  | private batchshow: boolean = false; | 
|---|
|  |  |  | private handleEditbatch(record){ | 
|---|
|  |  |  | this.check=false | 
|---|
|  |  |  | this.startstate='batch' | 
|---|
|  |  |  | this.batchshow=true | 
|---|
|  |  |  | this.check = false; | 
|---|
|  |  |  | this.startstate = "batch"; | 
|---|
|  |  |  | this.batchshow = true; | 
|---|
|  |  |  | // this.selectCar(); | 
|---|
|  |  |  | this.batchid=record.coordinateId | 
|---|
|  |  |  | this.batchid = record.coordinateId; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | private handlebatch(){ | 
|---|
|  |  |  | // this.selectCar() | 
|---|
|  |  |  | this.batchshow=false | 
|---|
|  |  |  | this.batchshow = false; | 
|---|
|  |  |  | this.handlenull(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | private handlenull(){ | 
|---|
|  |  |  | this.starttime='' | 
|---|
|  |  |  | this.endtime='' | 
|---|
|  |  |  | this.starttime = ""; | 
|---|
|  |  |  | this.endtime = ""; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | private insertbatch(){ | 
|---|
|  |  |  | post('coordinateDetail/batch',{ | 
|---|
|  |  |  | post("coordinateDetail/batch", { | 
|---|
|  |  |  | coordinateId:this.batchid, | 
|---|
|  |  |  | time1:this.starttime, | 
|---|
|  |  |  | time2:this.endtime, | 
|---|
|  |  |  | mac:this.carvalue, | 
|---|
|  |  |  | }).then((res=>{ | 
|---|
|  |  |  | }).then((res) => { | 
|---|
|  |  |  | console.log(res); | 
|---|
|  |  |  | this.$message.success(res.data.message) | 
|---|
|  |  |  | this.starttime='' | 
|---|
|  |  |  | this.endtime='' | 
|---|
|  |  |  | this.$message.success(res.data.message); | 
|---|
|  |  |  | this.starttime = ""; | 
|---|
|  |  |  | this.endtime = ""; | 
|---|
|  |  |  | // this.selectCar() | 
|---|
|  |  |  | })) | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | private upa='' | 
|---|
|  |  |  | private recordid:any=0 | 
|---|
|  |  |  | private upa = ""; | 
|---|
|  |  |  | private recordid: any = 0; | 
|---|
|  |  |  | private handleEditModalVisible(record) { | 
|---|
|  |  |  | console.log('dataList',this.dataList) | 
|---|
|  |  |  | this.check=false | 
|---|
|  |  |  | this.handlebatch() | 
|---|
|  |  |  | this.startstate = 'none' | 
|---|
|  |  |  | this.dataList=[] | 
|---|
|  |  |  | this.upa='upa' | 
|---|
|  |  |  | this.recordid=record.coordinateId | 
|---|
|  |  |  | if(this.carvalue==='请选择走航车'){ | 
|---|
|  |  |  | this.$message.warning('请选择走航车') | 
|---|
|  |  |  | return | 
|---|
|  |  |  | console.log("dataList", this.dataList); | 
|---|
|  |  |  | this.check = false; | 
|---|
|  |  |  | this.handlebatch(); | 
|---|
|  |  |  | this.startstate = "none"; | 
|---|
|  |  |  | this.dataList = []; | 
|---|
|  |  |  | this.upa = "upa"; | 
|---|
|  |  |  | this.recordid = record.coordinateId; | 
|---|
|  |  |  | if (this.carvalue === "请选择走航车") { | 
|---|
|  |  |  | this.$message.warning("请选择走航车"); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(this.timevalue.length===0){ | 
|---|
|  |  |  | this.$message.warning('请选择时间') | 
|---|
|  |  |  | return | 
|---|
|  |  |  | this.$message.warning("请选择时间"); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | post('coordinateDetail/select',{ | 
|---|
|  |  |  | post("coordinateDetail/select", { | 
|---|
|  |  |  | coordinateId:record.coordinateId, | 
|---|
|  |  |  | // time1:'2023-08-05 00:00:00', | 
|---|
|  |  |  | // time2:'2023-08-06 00:00:00', | 
|---|
|  |  |  | 
|---|
|  |  |  | time2:this.timevalue[1], | 
|---|
|  |  |  | mac:this.carvalue, | 
|---|
|  |  |  | }).then((res)=>{ | 
|---|
|  |  |  | this.carDate=[] | 
|---|
|  |  |  | this.pointshow=true | 
|---|
|  |  |  | this.setMarker(res) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | this.carDate = []; | 
|---|
|  |  |  | this.pointshow = true; | 
|---|
|  |  |  | this.setMarker(res); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | private openupa(){ | 
|---|
|  |  |  | post('coordinateDetail/insert',{ | 
|---|
|  |  |  | post("coordinateDetail/insert", { | 
|---|
|  |  |  | coordinateId:this.recordid, | 
|---|
|  |  |  | data:this.dataList | 
|---|
|  |  |  | data: this.dataList, | 
|---|
|  |  |  | }).then((res)=>{ | 
|---|
|  |  |  | this.$message.success(res.data.message) | 
|---|
|  |  |  | this.upa='' | 
|---|
|  |  |  | this.dataList=[] | 
|---|
|  |  |  | this.carDate=[] | 
|---|
|  |  |  | this.selectCar() | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | this.$message.success(res.data.message); | 
|---|
|  |  |  | this.upa = ""; | 
|---|
|  |  |  | this.dataList = []; | 
|---|
|  |  |  | this.carDate = []; | 
|---|
|  |  |  | // this.selectCar() | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | private inupa(){ | 
|---|
|  |  |  | this.upa='' | 
|---|
|  |  |  | this.upa = ""; | 
|---|
|  |  |  | // this.selectCar() | 
|---|
|  |  |  | } | 
|---|
|  |  |  | private carvalue:any='请选择走航车' | 
|---|
|  |  |  | private carIndex:any=[] | 
|---|
|  |  |  | private carvalue: any = "请选择走航车"; | 
|---|
|  |  |  | private carIndex: any = []; | 
|---|
|  |  |  | private car(){ | 
|---|
|  |  |  | get('cruiserInfo/selectCruisers',{ | 
|---|
|  |  |  | }).then((res)=>{ | 
|---|
|  |  |  | get("cruiserInfo/selectCruisers", {}).then((res) => { | 
|---|
|  |  |  | this.carIndex=res.data.data; | 
|---|
|  |  |  | console.log(this.carIndex); | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | private check:boolean=false | 
|---|
|  |  |  | private showfix:boolean=false | 
|---|
|  |  |  | private messageshow:any='' | 
|---|
|  |  |  | private check: boolean = false; | 
|---|
|  |  |  | private showfix: boolean = false; | 
|---|
|  |  |  | private messageshow: any = ""; | 
|---|
|  |  |  | private selectCheck(){ | 
|---|
|  |  |  | if(this.carvalue==='请选择走航车'){ | 
|---|
|  |  |  | this.$message.warning('请选择走航车') | 
|---|
|  |  |  | return | 
|---|
|  |  |  | if (this.carvalue === "请选择走航车") { | 
|---|
|  |  |  | this.$message.warning("请选择走航车"); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(this.timevalue.length===0){ | 
|---|
|  |  |  | this.$message.warning('请选择时间') | 
|---|
|  |  |  | return | 
|---|
|  |  |  | this.$message.warning("请选择时间"); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | get('cruiserInfo/getCruiserCompare',{ | 
|---|
|  |  |  | get("cruiserInfo/getCruiserCompare", { | 
|---|
|  |  |  | mac:this.carvalue, | 
|---|
|  |  |  | // time1:'2023-08-05 00:00:00', | 
|---|
|  |  |  | // time2:'2023-08-06 00:00:00' | 
|---|
|  |  |  | time1:this.timevalue[0], | 
|---|
|  |  |  | time2:this.timevalue[1] | 
|---|
|  |  |  | time2: this.timevalue[1], | 
|---|
|  |  |  | }).then((res)=>{ | 
|---|
|  |  |  | console.log(res.data.data,'res'); | 
|---|
|  |  |  | this.messageshow=res.data.data.message | 
|---|
|  |  |  | this.showfix=true | 
|---|
|  |  |  | console.log(res.data.data, "res"); | 
|---|
|  |  |  | this.messageshow = res.data.data.message; | 
|---|
|  |  |  | this.showfix = true; | 
|---|
|  |  |  | // this.check=true | 
|---|
|  |  |  | this.carDate=[] | 
|---|
|  |  |  | this.pointshow=false | 
|---|
|  |  |  | this.setMarker(res) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | this.carDate = []; | 
|---|
|  |  |  | this.pointshow = false; | 
|---|
|  |  |  | this.setMarker(res); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | private closemess(){ | 
|---|
|  |  |  | this.showfix=false | 
|---|
|  |  |  | this.showfix = false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | private carDate:any=[] | 
|---|
|  |  |  | private carDate: any = []; | 
|---|
|  |  |  | private selectCar(){ | 
|---|
|  |  |  | console.log(this.timevalue); | 
|---|
|  |  |  | if(this.carvalue==='请选择走航车'){ | 
|---|
|  |  |  | this.$message.warning('请选择走航车') | 
|---|
|  |  |  | return | 
|---|
|  |  |  | if (this.carvalue === "请选择走航车") { | 
|---|
|  |  |  | this.$message.warning("请选择走航车"); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(this.timevalue.length===0){ | 
|---|
|  |  |  | this.$message.warning('请选择时间') | 
|---|
|  |  |  | return | 
|---|
|  |  |  | this.$message.warning("请选择时间"); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | console.log("this.timevalue",this.timevalue); | 
|---|
|  |  |  | get('cruiserInfo/getCruiserInFo',{ | 
|---|
|  |  |  | get("cruiserInfo/getCruiserInFo", { | 
|---|
|  |  |  | mac:this.carvalue, | 
|---|
|  |  |  | // time1:'2023-08-05 00:00:00', | 
|---|
|  |  |  | // time2:'2023-08-06 00:00:00' | 
|---|
|  |  |  | time1:this.timevalue[0], | 
|---|
|  |  |  | time2:this.timevalue[1] | 
|---|
|  |  |  | time2: this.timevalue[1], | 
|---|
|  |  |  | }).then((res)=>{ | 
|---|
|  |  |  | console.log(res.data.data,'res'); | 
|---|
|  |  |  | console.log(res.data.data, "res"); | 
|---|
|  |  |  | // console.log(this.carDate,'this.carDate'); | 
|---|
|  |  |  | this.carDate=[] | 
|---|
|  |  |  | this.pointshow=false | 
|---|
|  |  |  | this.setMarker(res) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | this.carDate = []; | 
|---|
|  |  |  | this.pointshow = false; | 
|---|
|  |  |  | this.setMarker(res); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | private markerdata:any=[] | 
|---|
|  |  |  | private marker:any=[] | 
|---|
|  |  |  | private dataList:any=[] | 
|---|
|  |  |  | private indataList:any=[] | 
|---|
|  |  |  | private LudataList:any=[] | 
|---|
|  |  |  | private carDataList:any=[] | 
|---|
|  |  |  | private starttime:any='' | 
|---|
|  |  |  | private endtime:any='' | 
|---|
|  |  |  | private InfoWindow = null | 
|---|
|  |  |  | private startstate:any='none' | 
|---|
|  |  |  | private markerdata: any = []; | 
|---|
|  |  |  | private marker: any = []; | 
|---|
|  |  |  | private dataList: any = []; | 
|---|
|  |  |  | private indataList: any = []; | 
|---|
|  |  |  | private LudataList: any = []; | 
|---|
|  |  |  | private carDataList: any = []; | 
|---|
|  |  |  | private starttime: any = ""; | 
|---|
|  |  |  | private endtime: any = ""; | 
|---|
|  |  |  | private InfoWindow = null; | 
|---|
|  |  |  | private startstate: any = "none"; | 
|---|
|  |  |  | private setMarker(res) { | 
|---|
|  |  |  | const that=this | 
|---|
|  |  |  | that.carDate=[] | 
|---|
|  |  |  | that.carDataList=[] | 
|---|
|  |  |  | const that = this; | 
|---|
|  |  |  | that.carDate = []; | 
|---|
|  |  |  | that.carDataList = []; | 
|---|
|  |  |  | for(var i=0;i<res.data.data.rsData.length;i++){ | 
|---|
|  |  |  | that.carDate.push(res.data.data.rsData[i]) | 
|---|
|  |  |  | that.carDate.push(res.data.data.rsData[i]); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | for(var i=0;i<res.data.data.data.length;i++){ | 
|---|
|  |  |  | that.carDataList.push(res.data.data.data[i]) | 
|---|
|  |  |  | that.carDataList.push(res.data.data.data[i]); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | that.map.clearOverlays() | 
|---|
|  |  |  | let bPoints = [] | 
|---|
|  |  |  | let aPoints = [] | 
|---|
|  |  |  | that.map.clearOverlays(); | 
|---|
|  |  |  | let bPoints = []; | 
|---|
|  |  |  | let aPoints = []; | 
|---|
|  |  |  | if (res.status ===200) { | 
|---|
|  |  |  | for (let i = 0; i < that.carDate.length; i++) { | 
|---|
|  |  |  | //创建单个point | 
|---|
|  |  |  | var myIcon = new BMapGL.Icon(require("@/assets/723cd95f31481a502d495b2d814d658.png"), new BMapGL.Size(50, 50), { | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | var startIcon = new BMapGL.Icon(require("@/assets/start.png"), new BMapGL.Size(50, 50), { | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | var endIcon = new BMapGL.Icon(require("@/assets/end.png"), new BMapGL.Size(50, 50), { | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | const statePoint = new BMapGL.Point(that.carDate[i].flylon,that.carDate[i].flylat); | 
|---|
|  |  |  | bPoints.push(statePoint) | 
|---|
|  |  |  | var myIcon = new BMapGL.Icon( | 
|---|
|  |  |  | require("@/assets/723cd95f31481a502d495b2d814d658.png"), | 
|---|
|  |  |  | new BMapGL.Size(50, 50), | 
|---|
|  |  |  | {} | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | var startIcon = new BMapGL.Icon( | 
|---|
|  |  |  | require("@/assets/start.png"), | 
|---|
|  |  |  | new BMapGL.Size(50, 50), | 
|---|
|  |  |  | {} | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | var endIcon = new BMapGL.Icon( | 
|---|
|  |  |  | require("@/assets/end.png"), | 
|---|
|  |  |  | new BMapGL.Size(50, 50), | 
|---|
|  |  |  | {} | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | const statePoint = new BMapGL.Point( | 
|---|
|  |  |  | that.carDate[i].flylon, | 
|---|
|  |  |  | that.carDate[i].flylat | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | bPoints.push(statePoint); | 
|---|
|  |  |  | if (i === 0) { | 
|---|
|  |  |  | that.marker[i] = new BMapGL.Marker(statePoint, { icon: startIcon }); | 
|---|
|  |  |  | that.marker[i].customData = { data: that.carDate[i].data, state: that.carDate[i].state }; | 
|---|
|  |  |  | that.marker[i].iconPng='startIcon' | 
|---|
|  |  |  | that.marker[i].customData = { | 
|---|
|  |  |  | data: that.carDate[i].data, | 
|---|
|  |  |  | state: that.carDate[i].state, | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | that.marker[i].iconPng = "startIcon"; | 
|---|
|  |  |  | } else if (i === that.carDate.length - 1) { | 
|---|
|  |  |  | that.marker[i] = new BMapGL.Marker(statePoint, { icon: endIcon }); | 
|---|
|  |  |  | that.marker[i].customData = { data: that.carDate[i].data, state: that.carDate[i].state }; | 
|---|
|  |  |  | that.marker[i].iconPng='endIcon' | 
|---|
|  |  |  | that.marker[i].customData = { | 
|---|
|  |  |  | data: that.carDate[i].data, | 
|---|
|  |  |  | state: that.carDate[i].state, | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | that.marker[i].iconPng = "endIcon"; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | that.marker[i] = new BMapGL.Marker(statePoint,{icon:myIcon}); | 
|---|
|  |  |  | that.marker[i].customData = { data: that.carDate[i].data, state: that.carDate[i].state }; | 
|---|
|  |  |  | that.marker[i].iconPng='myIcon' | 
|---|
|  |  |  | that.marker[i].customData = { | 
|---|
|  |  |  | data: that.carDate[i].data, | 
|---|
|  |  |  | state: that.carDate[i].state, | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | that.marker[i].iconPng = "myIcon"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | var infoWindow =''; | 
|---|
|  |  |  | var infoWindow = ""; | 
|---|
|  |  |  | //that.marker[i].name = that.carDate[i].time; | 
|---|
|  |  |  | that.marker[i].on('mouseover', function (e) { | 
|---|
|  |  |  | infoWindow = new BMapGL.InfoWindow("当前时间:"+that.carDate[i].time); | 
|---|
|  |  |  | that.marker[i].on("mouseover", function(e) { | 
|---|
|  |  |  | infoWindow = new BMapGL.InfoWindow( | 
|---|
|  |  |  | "当前时间:" + that.carDate[i].time | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | that.map.openInfoWindow(infoWindow, statePoint); | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | that.marker[i].on('mouseout', function (e) { | 
|---|
|  |  |  | that.marker[i].on("mouseout", function(e) { | 
|---|
|  |  |  | that.map.closeInfoWindow(infoWindow, statePoint); | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | // that.marker.setTitle(that.carDate[i].time); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //在地图中添加marker | 
|---|
|  |  |  | 
|---|
|  |  |  | // if(that.check===false){ | 
|---|
|  |  |  | that.marker[i].addEventListener("click",function(){ | 
|---|
|  |  |  | switch(that.carDate[i].state){ | 
|---|
|  |  |  | case '1': | 
|---|
|  |  |  | console.log('that.marker',that.marker[i]) | 
|---|
|  |  |  | that.marker[i].setIcon(new BMapGL.Icon(require("@/assets/fb259ce2e368f6853a58b91d6f6b293.png"), new BMapGL.Size(50, 50) | 
|---|
|  |  |  | )); | 
|---|
|  |  |  | that.carDate[i].state='2' | 
|---|
|  |  |  | case "1": | 
|---|
|  |  |  | console.log("that.marker", that.marker[i]); | 
|---|
|  |  |  | that.marker[i].setIcon( | 
|---|
|  |  |  | new BMapGL.Icon( | 
|---|
|  |  |  | require("@/assets/fb259ce2e368f6853a58b91d6f6b293.png"), | 
|---|
|  |  |  | new BMapGL.Size(50, 50) | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | that.carDate[i].state = "2"; | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case '2': | 
|---|
|  |  |  | that.marker[i].setIcon(new BMapGL.Icon(require("@/assets/723cd95f31481a502d495b2d814d658.png"), new BMapGL.Size(50, 50) | 
|---|
|  |  |  | )); | 
|---|
|  |  |  | that.carDate[i].state='1' | 
|---|
|  |  |  | case "2": | 
|---|
|  |  |  | that.marker[i].setIcon( | 
|---|
|  |  |  | new BMapGL.Icon( | 
|---|
|  |  |  | require("@/assets/723cd95f31481a502d495b2d814d658.png"), | 
|---|
|  |  |  | new BMapGL.Size(50, 50) | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | that.carDate[i].state = "1"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | that.dataList.push({code:that.carDate[i].data,state:that.carDate[i].state}); | 
|---|
|  |  |  | if(that.startstate==='batch'){ | 
|---|
|  |  |  | if(that.starttime!==''&&that.endtime!==''){ | 
|---|
|  |  |  | that.$message.warning('请先清空') | 
|---|
|  |  |  | return | 
|---|
|  |  |  | that.dataList.push({ | 
|---|
|  |  |  | code: that.carDate[i].data, | 
|---|
|  |  |  | state: that.carDate[i].state, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | if (that.startstate === "batch") { | 
|---|
|  |  |  | if (that.starttime !== "" && that.endtime !== "") { | 
|---|
|  |  |  | that.$message.warning("请先清空"); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(that.starttime===''){ | 
|---|
|  |  |  | that.starttime=that.carDate[i].time | 
|---|
|  |  |  | if (that.starttime === "") { | 
|---|
|  |  |  | that.starttime = that.carDate[i].time; | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | that.endtime=that.carDate[i].time | 
|---|
|  |  |  | that.endtime = that.carDate[i].time; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for (let i = 0; i < that.dataList.length; i++) { | 
|---|
|  |  |  | for (let j = i + 1; j < that.dataList.length; j++) { | 
|---|
|  |  |  | if (that.dataList[i].code == that.dataList[j].code) { | 
|---|
|  |  |  | that.dataList.splice(j, 1); | 
|---|
|  |  |  | if(that.dataList[i].state==='1'){ | 
|---|
|  |  |  | that.dataList[i].state='2' | 
|---|
|  |  |  | if (that.dataList[i].state === "1") { | 
|---|
|  |  |  | that.dataList[i].state = "2"; | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | that.dataList[i].state='1' | 
|---|
|  |  |  | that.dataList[i].state = "1"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | // } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for (let i = 0; i < that.carDataList.length; i++) { | 
|---|
|  |  |  | // console.log(that.carDataList[i],'that.carDataList[i]'); | 
|---|
|  |  |  | //创建单个point | 
|---|
|  |  |  | var myIcon = new BMapGL.Icon(require("@/assets/fb259ce2e368f6853a58b91d6f6b293.png"), new BMapGL.Size(50, 50)); | 
|---|
|  |  |  | const statePoint = new BMapGL.Point(that.carDataList[i].longitude,that.carDataList[i].latitude); | 
|---|
|  |  |  | var myIcon = new BMapGL.Icon( | 
|---|
|  |  |  | require("@/assets/fb259ce2e368f6853a58b91d6f6b293.png"), | 
|---|
|  |  |  | new BMapGL.Size(50, 50) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | const statePoint = new BMapGL.Point( | 
|---|
|  |  |  | that.carDataList[i].longitude, | 
|---|
|  |  |  | that.carDataList[i].latitude | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | // console.log(statePoint,'statePoint'); | 
|---|
|  |  |  | aPoints.push(statePoint) | 
|---|
|  |  |  | aPoints.push(statePoint); | 
|---|
|  |  |  | //将marker保存在data函数中 后续需要使用 | 
|---|
|  |  |  | that.markerdata[i] = new BMapGL.Marker(statePoint,{icon:myIcon}); | 
|---|
|  |  |  | that.markerdata[i].customData = {data: that.carDataList[i].code,state: that.carDataList[i].state,id:that.carDataList[i].id}; | 
|---|
|  |  |  | that.markerdata[i].customData = { | 
|---|
|  |  |  | data: that.carDataList[i].code, | 
|---|
|  |  |  | state: that.carDataList[i].state, | 
|---|
|  |  |  | id: that.carDataList[i].id, | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | //在地图中添加marker | 
|---|
|  |  |  | that.map.addOverlay(that.markerdata[i]); | 
|---|
|  |  |  | // if(that.check===false){ | 
|---|
|  |  |  | that.markerdata[i].addEventListener("click",function(){ | 
|---|
|  |  |  | switch(that.carDataList[i].state){ | 
|---|
|  |  |  | case '1': | 
|---|
|  |  |  | that.markerdata[i].setIcon(new BMapGL.Icon(require("@/assets/fb259ce2e368f6853a58b91d6f6b293.png"), new BMapGL.Size(50, 50) | 
|---|
|  |  |  | )); | 
|---|
|  |  |  | that.carDataList[i].state='2'; | 
|---|
|  |  |  | case "1": | 
|---|
|  |  |  | that.markerdata[i].setIcon( | 
|---|
|  |  |  | new BMapGL.Icon( | 
|---|
|  |  |  | require("@/assets/fb259ce2e368f6853a58b91d6f6b293.png"), | 
|---|
|  |  |  | new BMapGL.Size(50, 50) | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | that.carDataList[i].state = "2"; | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case '2': | 
|---|
|  |  |  | case "2": | 
|---|
|  |  |  | console.log(123); | 
|---|
|  |  |  | that.markerdata[i].setIcon(new BMapGL.Icon(require("@/assets/723cd95f31481a502d495b2d814d658.png"), new BMapGL.Size(50, 50) | 
|---|
|  |  |  | )); | 
|---|
|  |  |  | that.carDataList[i].state='1'; | 
|---|
|  |  |  | that.markerdata[i].setIcon( | 
|---|
|  |  |  | new BMapGL.Icon( | 
|---|
|  |  |  | require("@/assets/723cd95f31481a502d495b2d814d658.png"), | 
|---|
|  |  |  | new BMapGL.Size(50, 50) | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | that.carDataList[i].state = "1"; | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | that.dataList.push({code:that.carDataList[i].code,state:that.carDataList[i].state,id:that.carDataList[i].id}); | 
|---|
|  |  |  | that.dataList.push({ | 
|---|
|  |  |  | code: that.carDataList[i].code, | 
|---|
|  |  |  | state: that.carDataList[i].state, | 
|---|
|  |  |  | id: that.carDataList[i].id, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | // console.log(that.dataList); | 
|---|
|  |  |  | for (let i = 0; i < that.dataList.length; i++) { | 
|---|
|  |  |  | for (let j = i + 1; j < that.dataList.length; j++) { | 
|---|
|  |  |  | if (that.dataList[i].code == that.dataList[j].code) { | 
|---|
|  |  |  | that.dataList.splice(j, 1); | 
|---|
|  |  |  | if(that.dataList[i].state==='1'){ | 
|---|
|  |  |  | that.dataList[i].state='2' | 
|---|
|  |  |  | if (that.dataList[i].state === "1") { | 
|---|
|  |  |  | that.dataList[i].state = "2"; | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | that.dataList[i].state='1' | 
|---|
|  |  |  | that.dataList[i].state = "1"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //重新定义地图的缩放和中心点 | 
|---|
|  |  |  | if(that.pointshow===false){ | 
|---|
|  |  |  | that.setZoom(bPoints) | 
|---|
|  |  |  | that.setZoom(bPoints); | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | that.setZoom(aPoints) | 
|---|
|  |  |  | that.setZoom(aPoints); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | var centerPoint = view.center; | 
|---|
|  |  |  | this.map.centerAndZoom(centerPoint, mapZoom); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | private selectLuName:any=null | 
|---|
|  |  |  | private selectLuName: any = null; | 
|---|
|  |  |  | private selectLu(){ | 
|---|
|  |  |  | var macType = null | 
|---|
|  |  |  | if(this.carvalue!=='请选择走航车'){ | 
|---|
|  |  |  | var macType = null; | 
|---|
|  |  |  | if (this.carvalue !== "请选择走航车") { | 
|---|
|  |  |  | macType = this.carvalue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | get('coordinate/selectCruiserRoad',{ | 
|---|
|  |  |  | get("coordinate/selectCruiserRoad", { | 
|---|
|  |  |  | name:this.selectLuName, | 
|---|
|  |  |  | mac:macType | 
|---|
|  |  |  | mac: macType, | 
|---|
|  |  |  | }).then((res)=>{ | 
|---|
|  |  |  | this.dataSource=res.data.data | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | this.dataSource = res.data.data; | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | private created () { | 
|---|
|  |  |  | this.car() | 
|---|
|  |  |  | this.selectLu() | 
|---|
|  |  |  | this.car(); | 
|---|
|  |  |  | this.selectLu(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  |  | 
|---|