|
|
|
@ -59,6 +59,19 @@
|
|
|
|
|
<div class="item-name">{{submitForm.taskAirLineName}}</div>
|
|
|
|
|
<div class="item-operate" @click="selectAriLine">
|
|
|
|
|
<MoreOutlined />
|
|
|
|
|
<a-dropdown v-if="false">
|
|
|
|
|
<MoreOutlined />
|
|
|
|
|
<template #overlay>
|
|
|
|
|
<a-menu>
|
|
|
|
|
<a-menu-item >
|
|
|
|
|
<a href="javascript:;" @click="previewAirLine(submitForm.airLineId)">预览航线</a>
|
|
|
|
|
</a-menu-item>
|
|
|
|
|
<a-menu-item >
|
|
|
|
|
<a href="javascript:;" @click="selectAriLine">选择航线</a>
|
|
|
|
|
</a-menu-item>
|
|
|
|
|
</a-menu>
|
|
|
|
|
</template>
|
|
|
|
|
</a-dropdown>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</a-form-item>
|
|
|
|
@ -225,8 +238,10 @@
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
|
import { ref, defineEmits, defineProps, watch } from "vue";
|
|
|
|
|
import { PlusOutlined,LeftOutlined,DeleteOutlined,MoreOutlined } from '@ant-design/icons-vue';
|
|
|
|
|
import { addTask,editTask,getWorkspaceList } from "@/api/sys/workplan";
|
|
|
|
|
|
|
|
|
|
import { addTask,editTask,getWorkspaceList,getAirLine } from "@/api/sys/workplan";
|
|
|
|
|
import axios from 'axios';
|
|
|
|
|
import JSZip from 'jszip';
|
|
|
|
|
import { XMLParser, XMLBuilder } from 'fast-xml-parser';
|
|
|
|
|
import { Modal, message } from 'ant-design-vue';
|
|
|
|
|
import { useRoute,useRouter } from 'vue-router'
|
|
|
|
|
const router = useRoute()
|
|
|
|
@ -490,7 +505,7 @@ watch(
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const emit = defineEmits(['selectAriLine','cancleCraete',"selectAircraft","successCreatePlan","intelligentPatrol"]);
|
|
|
|
|
const emit = defineEmits(['selectAriLine','cancleCraete',"selectAircraft","successCreatePlan","intelligentPatrol","startEditAirLine"]);
|
|
|
|
|
|
|
|
|
|
const removeAirLine = ()=>{
|
|
|
|
|
props.checkedAriLine.value = {};
|
|
|
|
@ -725,6 +740,53 @@ const changeAiInspection = (val)=>{
|
|
|
|
|
emit('intelligentPatrol')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 预览航线
|
|
|
|
|
const previewAirLine = async (id) => {
|
|
|
|
|
let airLine = await getAirLine({airLineId:id});
|
|
|
|
|
try{
|
|
|
|
|
let response = await axios.get(airLine.wpml,{responseType: 'arraybuffer'});
|
|
|
|
|
// 解压kmz文件
|
|
|
|
|
let xmlStr =await extractKmz(response.data);
|
|
|
|
|
// 去除 wpml 前缀
|
|
|
|
|
let removeWpmlXmlStr = {
|
|
|
|
|
template:xmlStr.template.replace(/wpml:/g,""),
|
|
|
|
|
wayline:xmlStr.wayline.replace(/wpml:/g,"")
|
|
|
|
|
}
|
|
|
|
|
// 转换成josn数据
|
|
|
|
|
const parser = new XMLParser();
|
|
|
|
|
let xmlObj = {
|
|
|
|
|
template:parser.parse(removeWpmlXmlStr.template),
|
|
|
|
|
wayline:parser.parse(removeWpmlXmlStr.wayline),
|
|
|
|
|
}
|
|
|
|
|
emit("startEditAirLine",xmlObj,airLine,"detail")
|
|
|
|
|
}catch(e){
|
|
|
|
|
console.error(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const extractKmz = async (kmzBlob)=>{
|
|
|
|
|
|
|
|
|
|
const zip = new JSZip();
|
|
|
|
|
const contents = await zip.loadAsync(kmzBlob);
|
|
|
|
|
let xmlData = {
|
|
|
|
|
wayline:null,
|
|
|
|
|
template:null
|
|
|
|
|
}
|
|
|
|
|
// 查找.wpml文件 和 .kmz文件
|
|
|
|
|
for (const [filename, file] of Object.entries(contents.files)) {
|
|
|
|
|
// wpml
|
|
|
|
|
if (filename.toLowerCase().endsWith('.wpml')) {
|
|
|
|
|
xmlData.wayline = await file.async('text');
|
|
|
|
|
}
|
|
|
|
|
// kmz
|
|
|
|
|
if (filename.toLowerCase().endsWith('.kml')) {
|
|
|
|
|
xmlData.template = await file.async('text');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return xmlData;
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|