|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<div style="width:100%;height: calc( 100vh - 80px);" >
|
|
|
|
|
<Map :airRoute="airRoute" @exitDraw="exitDraw" @flyToThere="flyToThere" :wayline="wayline" :waylineInfo="waylineInfo"></Map>
|
|
|
|
|
<Map :workPlanFormShow="workPlanFormShow" :airRoute="airRoute" @exitDraw="exitDraw" @flyToThere="flyToThere" :wayline="wayline" :waylineInfo="waylineInfo"></Map>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- 工作计划列表 -->
|
|
|
|
@ -32,7 +32,7 @@
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
|
import {ref} from 'vue';
|
|
|
|
|
import {ref,watch} from 'vue';
|
|
|
|
|
import planList from './components/planList.vue';
|
|
|
|
|
import airLineList from './components/airLineList.vue';
|
|
|
|
|
import aircraft from './components/aircraft.vue';
|
|
|
|
@ -40,6 +40,12 @@ import createWorkPlan from './components/createWorkPlan.vue';
|
|
|
|
|
import createAirLine from './components/createAirLine.vue'
|
|
|
|
|
import Map from './components/map.vue'
|
|
|
|
|
import AirPolygon from './components/airPolygon.vue';
|
|
|
|
|
import {getAirLine} from '@/api/sys/workplan';
|
|
|
|
|
|
|
|
|
|
import JSZip from 'jszip';
|
|
|
|
|
import axios from 'axios';
|
|
|
|
|
|
|
|
|
|
import { XMLParser, XMLBuilder } from 'fast-xml-parser';
|
|
|
|
|
|
|
|
|
|
const airRoute = ref({})
|
|
|
|
|
|
|
|
|
@ -49,6 +55,7 @@ const flyToTherePosition = ref({
|
|
|
|
|
alt:null,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const flyToThere = (e)=>{
|
|
|
|
|
console.log(e);
|
|
|
|
|
}
|
|
|
|
@ -129,6 +136,7 @@ const successCreatePlan = ()=>{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 保存航线后退出
|
|
|
|
|
const exitDraw = ()=>{
|
|
|
|
|
planListShow.value = false;
|
|
|
|
@ -137,18 +145,75 @@ const exitDraw = ()=>{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 预览航线
|
|
|
|
|
const wayline = ref({});
|
|
|
|
|
const waylineInfo = ref(null)
|
|
|
|
|
const previewAirLine =async (line,type) => {
|
|
|
|
|
let info =await getAirLine({airLineId:type.value?.id});
|
|
|
|
|
if(info){
|
|
|
|
|
wayline.value = line;
|
|
|
|
|
waylineInfo.value = info;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 查看航线详情
|
|
|
|
|
const planDetail = (item) => {
|
|
|
|
|
const planDetail =async (item) => {
|
|
|
|
|
formData.value = item;
|
|
|
|
|
console.log("formData",formData.value?.airLineId);
|
|
|
|
|
|
|
|
|
|
let info =await getAirLine({airLineId : formData.value?.airLineId});
|
|
|
|
|
if(info){
|
|
|
|
|
// wayline.value = line;
|
|
|
|
|
waylineInfo.value = info;
|
|
|
|
|
wayline.value = await airLineDetail(info);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
workPlanFormShow.value = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 预览航线
|
|
|
|
|
const wayline = ref({});
|
|
|
|
|
const waylineInfo = ref(null)
|
|
|
|
|
const previewAirLine = (line,type) => {
|
|
|
|
|
|
|
|
|
|
// 获取wpml文件
|
|
|
|
|
|
|
|
|
|
const currentPreviewWayLine = ref(null);
|
|
|
|
|
|
|
|
|
|
const airLineDetail =async (item) => {
|
|
|
|
|
|
|
|
|
|
currentPreviewWayLine.value = item;
|
|
|
|
|
|
|
|
|
|
try{
|
|
|
|
|
let response = await axios.get(item.wpml,{responseType: 'arraybuffer'});
|
|
|
|
|
// 解压kmz文件
|
|
|
|
|
let xmlStr =await extractKmz(response.data);
|
|
|
|
|
let xmlData = xmlStr.replace(/wpml:/g,"");
|
|
|
|
|
const parser = new XMLParser();
|
|
|
|
|
const jsonObj = parser.parse(xmlData);
|
|
|
|
|
return jsonObj.kml.Document;
|
|
|
|
|
|
|
|
|
|
}catch(e){
|
|
|
|
|
console.error(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wayline.value = line;
|
|
|
|
|
waylineInfo.value = type;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 解压航线文件
|
|
|
|
|
const extractKmz = async (kmzBlob)=>{
|
|
|
|
|
|
|
|
|
|
const zip = new JSZip();
|
|
|
|
|
|
|
|
|
|
const contents = await zip.loadAsync(kmzBlob);
|
|
|
|
|
|
|
|
|
|
// 查找.wmpl文件
|
|
|
|
|
for (const [filename, file] of Object.entries(contents.files)) {
|
|
|
|
|
if (filename.toLowerCase().endsWith('.wpml')) {
|
|
|
|
|
return await file.async('text');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
throw new Error('KMZ文件中未找到WMPL文件');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|