提交 de716a61 作者: 翁进城

feat: 增加使用非标准航线库的支持

上级 a361e2e6
......@@ -6,7 +6,7 @@
:devMode="devMode"
:uavTaskList="uavTaskList"
:hangarTaskList="hangarTaskList"
:scene="scene ? 0 : 1"
:scene="scene"
:useSTLAirway="useSTLAirway"
@uavChange="dispatchEvent('uavChange', $event)"
@uavTaskStart="dispatchEvent('uavTaskStart', $event)"
......@@ -17,6 +17,7 @@
@hangarTaskAdd="dispatchEvent('hangarTaskAdd', $event)"
@hangarTaskDel="dispatchEvent('hangarTaskDel', $event)"
@airwayPageChange="dispatchEvent('airwayPageChange', $event)"
@airwayGet="dispatchEvent('airwayGet', $event)"
></MMCFlightControlCenter>
</template>
......@@ -27,7 +28,7 @@ export default {
return {
baseUrl: "https://test.tmj.mmcuav.cn",
devMode: false,
scene: false, // 场景类型 true: 无人机 false: 机库
scene: 0, // 场景类型 1: 无人机 2: 机库
account: "mmctest@admin",
password: "test@Admin001",
userInfo: null,
......@@ -130,6 +131,7 @@ export default {
hangarTaskAddCB: null, //机库创建任务回调
uavTaskAddCB: null, //机库创建任务回调
airwayPageChangeCB: null, //航线翻页时回调
airwayGetCB: null, //获取航线数据回调
};
},
computed: {},
......@@ -257,6 +259,11 @@ export default {
this.airwayPageChangeCB = data.callback;
delete data.callback;
break;
case "airwayGet":
this.airwayGetCB = data.callback;
delete data.callback;
break;
}
this.postTop({
type: "event",
......
......@@ -133,25 +133,25 @@ export default {
* 更改任务事件
*/
async onChangeTask() {
if (this.useSTLAirway) {
if (!this.selectedTask?.airwayId) {
let res = await AirLine.routeDetail({
id: this.selectedTask?.airwayId,
});
if (res.code === 200) {
this.selectedAirway = res.data;
}
} else {
this.selectedAirway = {
name: "",
id: -1,
};
}
} else {
this.selectedAirway = this.selectedTask?.airway || {
if (!this.selectedTask?.airwayId) {
this.selectedAirway = {
name: "",
id: -1,
};
} else if (this.useSTLAirway) {
let res = await AirLine.routeDetail({
id: this.selectedTask?.airwayId,
});
if (res.code === 200) {
this.selectedAirway = res.data;
}
} else {
this.rootNode.$emit('airwayGet', {
airwayId: this.selectedTask?.airwayId,
callback: (airway) => {
this.selectedAirway = airway;
}
})
}
},
/**
......
......@@ -85,7 +85,7 @@ export default {
};
},
computed: {
...mapState("MMCFlightControlCenter", ["cesiumViewer"]),
...mapState("MMCFlightControlCenter", ["cesiumViewer", "useSTLAirway"]),
...mapState("MMCFlightControlCenter/uav", ["taskList", "uav"]),
taskListAll() {
return [{ name: "选择航线自动生成任务", id: -1 }, ...this.taskList];
......@@ -185,7 +185,12 @@ export default {
* 更改任务事件
*/
async onChangeTask() {
if (this.selectedTask?.airwayId) {
if (!this.selectedTask?.airwayId) {
this.selectedAirway = {
name: "",
id: -1,
};
} else if (this.useSTLAirway) {
let res = await AirLine.routeDetail({
id: this.selectedTask?.airwayId,
});
......@@ -193,10 +198,12 @@ export default {
this.selectedAirway = res.data;
}
} else {
this.selectedAirway = {
name: "",
id: -1,
};
this.rootNode.$emit('airwayGet', {
airwayId: this.selectedTask?.airwayId,
callback: (airway) => {
this.selectedAirway = airway;
}
})
}
},
// 两点距离
......
......@@ -6,9 +6,9 @@
<MapImageSwitch></MapImageSwitch>
<MapSearch class="map-search"></MapSearch>
<!-- 无人机应用 -->
<UavApplications v-if="scene === 0"></UavApplications>
<UavApplications v-if="scene == 1"></UavApplications>
<!-- 机库 -->
<Hangar v-else></Hangar>
<Hangar v-else-if="scene == 2"></Hangar>
</div>
</template>
......@@ -105,7 +105,7 @@ export default {
};
},
},
// 场景 0: 无人机 1: 机库
// 场景 1: 无人机 2: 机库
scene: {
type: Number,
default: 0,
......
......@@ -56,7 +56,7 @@ export default {
useSTLAirway: null,
baseUrl: "https://test.tmj.mmcuav.cn",
devMode: false,
scene: false, // 场景类型 true: 无人机 false: 机库
_scene: false, // 场景类型 true: 无人机 false: 机库
account: "mmctest@admin",
password: "test@Admin001",
userInfo: null,
......@@ -157,7 +157,11 @@ export default {
],
};
},
computed: {},
computed: {
scene(){
return _this.scene ? 1 : 2;
}
},
watch: {
devMode: {
immediate: true,
......
......@@ -41,7 +41,7 @@ export default {
isIframeReady: false, //是否接收到iframe里的ready事件
baseUrl: "https://test.tmj.mmcuav.cn",
devMode: false,
scene: null, // 场景类型 true: 无人机 false: 机库
_scene: null, // 场景类型 true: 无人机 false: 机库
useSTLAirway: null, // 使用标准航线库
account: "mmctest@admin",
password: "test@Admin001",
......@@ -119,32 +119,19 @@ export default {
} */
],
},
airwayList: [
/* {
name: "航线名称1",
id: 1,
organizationName: "所属单位1",
status: 1, //空域状态 1: 可用 2: 待申请 3: 待审批 4: 通过 5: 驳回
isSafe: 1, //空域状态 1: 安全 2: 待确定
labelName: "航线标签1",
content:
'{"filename":"肇庆航线20240318","line":{"baseSpeed":3},"content":[{"uuid":"1nmI-Fo18IagbcVJsia7Q","latitude":23.178153411812204,"longitude":112.57807281336807,"alt":100,"yawAngle":0,"pitchAngle":0,"speed":3,"actions":[]},{"uuid":"9pTbBPlF8iIwbUNqusyHK","latitude":23.17783116525969,"longitude":112.57797543441967,"alt":100,"yawAngle":0,"pitchAngle":0,"speed":3,"actions":[]},{"uuid":"s91IhN22wuaeyG-UQs0XR","latitude":23.17786413506686,"longitude":112.57824336604547,"alt":100,"yawAngle":0,"pitchAngle":0,"speed":3,"actions":[]},{"uuid":"xS_JIl3wxQrhMPdpcjcSn","latitude":23.17820934975604,"longitude":112.5781357731637,"alt":100,"yawAngle":0,"pitchAngle":0,"speed":3,"actions":[]}],"baseSpeed":3,"gimbalYaw":0,"gimbalPitch":0,"alt":100}',
},
{
name: "航线名称2",
id: 2,
organizationName: "所属单位2",
status: 2, //空域状态 1: 可用 2: 待申请 3: 待审批 4: 通过 5: 驳回
isSafe: 2, //空域状态 1: 安全 2: 待确定
labelName: "航线标签2",
content:
'{"filename":"肇庆航线20240318","line":{"baseSpeed":3},"content":[{"uuid":"1nmI-Fo18IagbcVJsia7Q","latitude":23.178153411812204,"longitude":112.57807281336807,"alt":100,"yawAngle":0,"pitchAngle":0,"speed":3,"actions":[]},{"uuid":"9pTbBPlF8iIwbUNqusyHK","latitude":23.17783116525969,"longitude":112.57797543441967,"alt":100,"yawAngle":0,"pitchAngle":0,"speed":3,"actions":[]},{"uuid":"s91IhN22wuaeyG-UQs0XR","latitude":23.17786413506686,"longitude":112.57824336604547,"alt":100,"yawAngle":0,"pitchAngle":0,"speed":3,"actions":[]},{"uuid":"xS_JIl3wxQrhMPdpcjcSn","latitude":23.17820934975604,"longitude":112.5781357731637,"alt":100,"yawAngle":0,"pitchAngle":0,"speed":3,"actions":[]}],"baseSpeed":3,"gimbalYaw":0,"gimbalPitch":0,"alt":100}',
}, */
],
};
},
computed: {},
computed: {
scene() {
return _this.scene ? 1 : 2;
},
},
watch: {
/* isIframeReady(){
if(this.isIframeReady){
this.login();
}
}, */
devMode: {
immediate: true,
handler() {
......@@ -183,14 +170,6 @@ export default {
});
},
},
// 航线列表
airwayList() {
this.postIframe({
type: "param",
param: "airwayList",
data: this.airwayList,
});
},
// 场景
scene() {
this.postIframe({
......@@ -296,9 +275,27 @@ export default {
case "airwayPageChange":
this.onAirwayPageChange(data);
break;
case "airwayGet":
this.onAirwayGet(data);
}
},
/**
* 获取航线事件
*/
async onAirwayGet({ airwayId }) {
this.postIframe({
type: "callback",
event: "airwayGet",
data: {
name: "获取航线" + airwayId,
id: airwayId,
content:
'{"filename":"肇庆航线20240318","line":{"baseSpeed":3},"content":[{"uuid":"1nmI-Fo18IagbcVJsia7Q","latitude":23.178153411812204,"longitude":112.57807281336807,"alt":100,"yawAngle":0,"pitchAngle":0,"speed":3,"actions":[]},{"uuid":"9pTbBPlF8iIwbUNqusyHK","latitude":23.17783116525969,"longitude":112.57797543441967,"alt":100,"yawAngle":0,"pitchAngle":0,"speed":3,"actions":[]},{"uuid":"s91IhN22wuaeyG-UQs0XR","latitude":23.17786413506686,"longitude":112.57824336604547,"alt":100,"yawAngle":0,"pitchAngle":0,"speed":3,"actions":[]},{"uuid":"xS_JIl3wxQrhMPdpcjcSn","latitude":23.17820934975604,"longitude":112.5781357731637,"alt":100,"yawAngle":0,"pitchAngle":0,"speed":3,"actions":[]}],"baseSpeed":3,"gimbalYaw":0,"gimbalPitch":0,"alt":100}',
},
});
},
/**
* 航线分页更改
*/
onAirwayPageChange({ page, pageSize }) {
......@@ -316,7 +313,8 @@ export default {
status: "可用", //空域状态
isSafe: 1, // 安全状态1: 安全 , 0: 待确定,
labelName: "航线标签",
content: //航线数据
//航线数据
content:
'{"filename":"盐城基地拍照录像","line":{"baseSpeed":6},"content":[{"uuid":"1uamoBnUN8je_2s5O7LAI","latitude":33.326034986025924,"longitude":120.2855868204341,"alt":100,"yawAngle":0,"pitchAngle":0,"speed":3,"actions":[{"id":2,"label":"拍照","key":"photo","checked":true,"value":1,"unit":"张"}]},{"uuid":"0V_BPu2m3u-zsCIVKRR7v","latitude":33.32572118330467,"longitude":120.28452270932941,"alt":100,"yawAngle":0,"pitchAngle":0,"speed":3,"actions":[{"id":2,"label":"拍照","key":"photo","checked":true,"value":1,"unit":"张"}]},{"uuid":"vXX0IkeE-z0BjMcQEG3f1","latitude":33.32483291531692,"longitude":120.28544172335158,"alt":100,"yawAngle":0,"pitchAngle":0,"speed":3,"actions":[{"id":3,"label":"录像","key":"video","checked":true,"value":0,"unit":"s"}]},{"uuid":"L32qDDlAiMtyKjoaySxHW","latitude":33.32576947678917,"longitude":120.28641994886797,"alt":100,"yawAngle":0,"pitchAngle":0,"speed":3,"actions":[{"id":3,"label":"录像","key":"video","checked":true,"value":0,"unit":"s"}]},{"uuid":"FYnNBx-i3bHkbEgt3QCWF","latitude":33.326686239734364,"longitude":120.28572577154279,"alt":100,"yawAngle":0,"pitchAngle":0,"speed":3,"actions":[{"id":3,"label":"录像","key":"video","checked":true,"value":0,"unit":"s"}]}],"baseSpeed":6,"gimbalYaw":0,"gimbalPitch":0,"alt":100}',
},
],
......@@ -348,7 +346,7 @@ export default {
name: "任务1",
id: id,
airwayId: airway.id,
airway
airway,
});
this.$nextTick(() => {
this.postIframe({
......@@ -426,7 +424,7 @@ export default {
name: "任务" + id,
id: id,
airwayId: airway.id,
airway
airway,
});
this.$nextTick(() => {
// 回调,参数为更新后新增的任务id, 仅日常任务有用
......@@ -575,28 +573,6 @@ export default {
},
],
};
this.airwayList = [
{
name: "航线名称1",
id: 1,
organizationName: "所属单位1",
status: 1, //空域状态 1: 可用 2: 待申请 3: 待审批 4: 通过 5: 驳回
isSafe: 1, //空域状态 1: 安全 2: 待确定
labelName: "航线标签1",
content:
'{"filename":"肇庆航线20240318","line":{"baseSpeed":3},"content":[{"uuid":"1nmI-Fo18IagbcVJsia7Q","latitude":23.178153411812204,"longitude":112.57807281336807,"alt":100,"yawAngle":0,"pitchAngle":0,"speed":3,"actions":[]},{"uuid":"9pTbBPlF8iIwbUNqusyHK","latitude":23.17783116525969,"longitude":112.57797543441967,"alt":100,"yawAngle":0,"pitchAngle":0,"speed":3,"actions":[]},{"uuid":"s91IhN22wuaeyG-UQs0XR","latitude":23.17786413506686,"longitude":112.57824336604547,"alt":100,"yawAngle":0,"pitchAngle":0,"speed":3,"actions":[]},{"uuid":"xS_JIl3wxQrhMPdpcjcSn","latitude":23.17820934975604,"longitude":112.5781357731637,"alt":100,"yawAngle":0,"pitchAngle":0,"speed":3,"actions":[]}],"baseSpeed":3,"gimbalYaw":0,"gimbalPitch":0,"alt":100}',
},
{
name: "航线名称2",
id: 2,
organizationName: "所属单位2",
status: 2, //空域状态 1: 可用 2: 待申请 3: 待审批 4: 通过 5: 驳回
isSafe: 2, //空域状态 1: 安全 2: 待确定
labelName: "航线标签2",
content:
'{"filename":"肇庆航线20240318","line":{"baseSpeed":3},"content":[{"uuid":"1nmI-Fo18IagbcVJsia7Q","latitude":23.178153411812204,"longitude":112.57807281336807,"alt":100,"yawAngle":0,"pitchAngle":0,"speed":3,"actions":[]},{"uuid":"9pTbBPlF8iIwbUNqusyHK","latitude":23.17783116525969,"longitude":112.57797543441967,"alt":100,"yawAngle":0,"pitchAngle":0,"speed":3,"actions":[]},{"uuid":"s91IhN22wuaeyG-UQs0XR","latitude":23.17786413506686,"longitude":112.57824336604547,"alt":100,"yawAngle":0,"pitchAngle":0,"speed":3,"actions":[]},{"uuid":"xS_JIl3wxQrhMPdpcjcSn","latitude":23.17820934975604,"longitude":112.5781357731637,"alt":100,"yawAngle":0,"pitchAngle":0,"speed":3,"actions":[]}],"baseSpeed":3,"gimbalYaw":0,"gimbalPitch":0,"alt":100}',
},
];
},
async login() {
let formData = new FormData();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论