提交 ae79d09c 作者: 温凯
...@@ -66,7 +66,12 @@ Vue.use(MMCSTL); ...@@ -66,7 +66,12 @@ Vue.use(MMCSTL);
* 修正机库指令 * 修正机库指令
* 增加是否定支持定时任务的判断 * 增加是否定支持定时任务的判断
* 修正多个缺陷 * 修正多个缺陷
## v1.6.0
* MQTT新增账号密码
## v1.6.1
* fix: 文件名大小写错误
## v2.0.0
* 合并V4分支更新到v2.0.0版本
## 项目结构 ## 项目结构
``` ```
......
This source diff could not be displayed because it is too large. You can view the blob instead.
{ {
"name": "mmc-stl-vue2", "name": "mmc-stl-vue2",
"version": "1.5.0", "version": "2.0.0",
"description": "科比特前端标准化组件", "description": "科比特前端标准化组件",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
......
...@@ -29,4 +29,17 @@ export default class TaskInfo { ...@@ -29,4 +29,17 @@ export default class TaskInfo {
data data
}); });
} }
}
/**
* 全部单位
* @param {*} params
* @returns
*/
static listAll(params) {
return request({
url: '/admin-api/system/dept/simple-list',
method: 'get',
params,
});
}
}
\ No newline at end of file
...@@ -15,28 +15,30 @@ ...@@ -15,28 +15,30 @@
<el-form-item label="航线名称" required> <el-form-item label="航线名称" required>
<el-input clearable v-model="name"></el-input> <el-input clearable v-model="name"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="所属单位:" required>
<el-cascader ref="CascaderRef" v-model="departmentId" :options="orgList" clearable :show-all-levels="false"
placeholder="请选择所属单位" :props="{
children: 'children',
label: 'name',
value: 'id',
checkStrictly: true,
emitPath: false,
}" @change="changeNode"></el-cascader>
</el-form-item>
<el-form-item label="航线速度" prop="speed"> <el-form-item label="航线速度" prop="speed">
<el-input clearable v-model="curForm.speed"></el-input> <el-input clearable v-model="curForm.speed"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="目标位置" prop="address"> <el-form-item label="目标位置" prop="address">
<el-autocomplete <el-autocomplete :popper-append-to-body="false" v-model="curForm.address" :fetch-suggestions="onAddressInput"
:popper-append-to-body="false" placeholder="请输入目标位置" :trigger-on-focus="false" @select="(item) => {
v-model="curForm.address" onAddressChange(item, 'end');
:fetch-suggestions="onAddressInput" }
placeholder="请输入目标位置" " clearable>
:trigger-on-focus="false"
@select="
(item) => {
onAddressChange(item, 'end');
}
"
clearable
>
<template slot-scope="{ item }"> <template slot-scope="{ item }">
<div> <div>
<span style="font-size: 14px; color: #9e9e9e"> <span style="font-size: 14px; color: #9e9e9e">
{{ {{
item.name item.name
}} }}
</span> </span>
<span style="font-size: 12px; color: #999; margin-left: 12px">{{ item.address }}</span> <span style="font-size: 12px; color: #999; margin-left: 12px">{{ item.address }}</span>
...@@ -58,27 +60,23 @@ ...@@ -58,27 +60,23 @@
<el-input clearable v-model="curForm.label"></el-input> <el-input clearable v-model="curForm.label"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="航点动作"> <el-form-item label="航点动作">
<el-button type="text" @click="showActions = true">{{curForm.actions.length}}个动作</el-button> <el-button type="text" @click="showActions = true">{{ curForm.actions.length }}个动作</el-button>
</el-form-item> </el-form-item>
<el-form-item label="航线总里程">{{distance}}m</el-form-item> <el-form-item label="航线总里程">{{ distance }}m</el-form-item>
<el-form-item label="预计飞行时间">{{time}}</el-form-item> <el-form-item label="预计飞行时间">{{ time }}</el-form-item>
</el-form> </el-form>
<div class="ae-btns"> <div class="ae-btns">
<el-button type="primary" @click="onSave" :loading="saveLoading">保存</el-button> <el-button type="primary" @click="onSave" :loading="saveLoading">保存</el-button>
<el-button type="danger" @click="onDel">删除航点</el-button> <el-button type="danger" @click="onDel">删除航点</el-button>
</div> </div>
</div> </div>
<Actions <Actions v-if="showActions" @close="showActions = false" @save="onActionsSave" :selectActions="curForm.actions">
v-if="showActions" </Actions>
@close="showActions = false"
@save="onActionsSave"
:selectActions="curForm.actions"
></Actions>
</div> </div>
</template> </template>
<script> <script>
import { Map, AirLine } from "../../../../../../../../../../../../api"; import { Map, AirLine, TaskInfo } from "../../../../../../../../../../../../api";
import { mapState } from "vuex"; import { mapState } from "vuex";
import Utils from "../../../../../../../../../../../../components/cesiumLayer/lib/cesium/utils"; import Utils from "../../../../../../../../../../../../components/cesiumLayer/lib/cesium/utils";
import { nanoid } from "nanoid"; import { nanoid } from "nanoid";
...@@ -115,7 +113,9 @@ export default { ...@@ -115,7 +113,9 @@ export default {
inject: ["rootNode"], inject: ["rootNode"],
data() { data() {
return { return {
orgList: [],
name: "", //航线名 name: "", //航线名
departmentId: "", //部门id
form: [], //表单集合 form: [], //表单集合
pageIndex: 0, //当前页码 pageIndex: 0, //当前页码
locationIcon: null, //定位图标 locationIcon: null, //定位图标
...@@ -158,6 +158,7 @@ export default { ...@@ -158,6 +158,7 @@ export default {
}, },
mounted() { mounted() {
let viewer = this.cesiumViewer; let viewer = this.cesiumViewer;
this.getOrgList()
this.dataSource = new Cesium.CustomDataSource("airway_edit"); this.dataSource = new Cesium.CustomDataSource("airway_edit");
viewer.dataSources.add(this.dataSource); viewer.dataSources.add(this.dataSource);
this.handler = new Cesium.ScreenSpaceEventHandler(viewer.canvas); //获取事件对象 this.handler = new Cesium.ScreenSpaceEventHandler(viewer.canvas); //获取事件对象
...@@ -184,6 +185,7 @@ export default { ...@@ -184,6 +185,7 @@ export default {
Cesium.ScreenSpaceEventType.LEFT_CLICK Cesium.ScreenSpaceEventType.LEFT_CLICK
); );
this.pickerPointInit(); this.pickerPointInit();
}, },
beforeDestroy() { beforeDestroy() {
this.handler.removeInputAction( this.handler.removeInputAction(
...@@ -201,12 +203,87 @@ export default { ...@@ -201,12 +203,87 @@ export default {
this.dataSource.show = false; this.dataSource.show = false;
}, },
methods: { methods: {
async getOrgList() {
let data = await TaskInfo.listAll();
let res = data.data;
const config = {
id: "id",
parentId: "parentId",
childrenList: "children",
};
const childrenListMap = {};
const nodeIds = {};
const tree = [];
for (const d of res) {
const parentId = d[config.parentId];
if (childrenListMap[parentId] == null) {
childrenListMap[parentId] = [];
}
nodeIds[d[config.id]] = d;
childrenListMap[parentId].push(d);
}
for (const d of res) {
const parentId = d[config.parentId];
if (nodeIds[parentId] == null) {
tree.push(d);
}
}
for (const t of tree) {
adaptToChildrenList(t);
}
function adaptToChildrenList(o) {
if (childrenListMap[o[config.id]] !== null) {
o[config.childrenList] = childrenListMap[o[config.id]];
}
if (o[config.childrenList]) {
for (const c of o[config.childrenList]) {
adaptToChildrenList(c);
}
}
}
this.orgList = tree;
},
convertToSeconds(timeString) {
const regex = /(\d+)\s*(小时|分钟|秒)/g;
let totalSeconds = 0;
let match;
while ((match = regex.exec(timeString)) !== null) {
const value = parseInt(match[1], 10);
const unit = match[2];
switch (unit) {
case '小时':
totalSeconds += value * 3600; // 1小时 = 3600秒
break;
case '分钟':
totalSeconds += value * 60; // 1分钟 = 60秒
break;
case '秒':
totalSeconds += value; // 直接加秒
break;
}
}
return totalSeconds;
},
changeNode() {
this.$refs.CascaderRef.dropDownVisible = false;
},
// 保存航线 // 保存航线
async onSave() { async onSave() {
if (!this.name) { if (!this.name) {
this.$message.warning("请输入航线名称"); this.$message.warning("请输入航线名称");
return; return;
} }
if (!this.departmentId) {
this.$message.warning("请选择所属机构");
return;
}
if (this.form.length === 0) { if (this.form.length === 0) {
this.$message.warning("请点击地图选择航点"); this.$message.warning("请点击地图选择航点");
return; return;
...@@ -248,15 +325,19 @@ export default { ...@@ -248,15 +325,19 @@ export default {
content: waypoints, content: waypoints,
distance: this.distance, distance: this.distance,
dutyOrganizationId: "", dutyOrganizationId: "",
departmentId: this.departmentId,
name: this.name, name: this.name,
speed: this.form[0].speed, speed: this.form[0].speed,
flyTime: this.convertToSeconds(this.time)
}; };
try { try {
let res = await AirLine.add({ let res = await AirLine.add({
flightName: airway.name || `${this.userInfo.username}-巡查}`, flightName: airway.name || `${this.userInfo.username}-巡查}`,
pointCount: airway.content.length, pointCount: airway.content.length,
distance: airway.distance, distance: airway.distance,
departmentId: airway.departmentId,
sourceType: 1, sourceType: 1,
flyTime:airway.flyTime,
linePointSaveReqVOS: airway.content.map((point) => ({ linePointSaveReqVOS: airway.content.map((point) => ({
latitude: point.coordinate.latitude, latitude: point.coordinate.latitude,
longitude: point.coordinate.longitude, longitude: point.coordinate.longitude,
...@@ -279,7 +360,7 @@ export default { ...@@ -279,7 +360,7 @@ export default {
this.$message.success("创建航线成功"); this.$message.success("创建航线成功");
this.$emit("addDone", res.data); this.$emit("addDone", res.data);
this.$emit("close"); this.$emit("close");
} catch (e) {} } catch (e) { }
this.saveLoading = false; this.saveLoading = false;
// 通过事件创建会出现重复创建的情况, 改为标准化里创建 // 通过事件创建会出现重复创建的情况, 改为标准化里创建
...@@ -302,7 +383,6 @@ export default { ...@@ -302,7 +383,6 @@ export default {
* 动作保存 * 动作保存
*/ */
onActionsSave(actions) { onActionsSave(actions) {
console.log("动作", actions);
this.curForm.actions = actions; this.curForm.actions = actions;
this.showActions = false; this.showActions = false;
}, },
...@@ -606,8 +686,8 @@ export default { ...@@ -606,8 +686,8 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.airway-edit { .airway-edit {
position: absolute; position: absolute;
top: -50px; top: 0px;
width: 450px; width: 351px;
z-index: 2; z-index: 2;
.dialog-content { .dialog-content {
......
...@@ -143,6 +143,7 @@ export default { ...@@ -143,6 +143,7 @@ export default {
} }
}, },
beforeDestroy() { beforeDestroy() {
this.showAirwayEdit = false;
this.bus.$off("startTask", this.onStartTask); this.bus.$off("startTask", this.onStartTask);
this.clearAirwayEntities(); this.clearAirwayEntities();
}, },
...@@ -223,7 +224,7 @@ export default { ...@@ -223,7 +224,7 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.taskListBox { .taskListBox {
height: 100%; height: 100%;
width: 416px; width: 100%;
background: #222222; background: #222222;
border-radius: 12px; border-radius: 12px;
transition: 0.3s; transition: 0.3s;
......
...@@ -193,7 +193,7 @@ export default { ...@@ -193,7 +193,7 @@ export default {
background: rgba(9, 32, 87, 0.7); background: rgba(9, 32, 87, 0.7);
// border: 1px solid #70daf9; // border: 1px solid #70daf9;
position: absolute; position: absolute;
top: -5px; top: 50px;
left: 550px; left: 550px;
width: 512x; width: 512x;
z-index: 1; z-index: 1;
......
...@@ -176,7 +176,7 @@ export default { ...@@ -176,7 +176,7 @@ export default {
.task-add { .task-add {
height: 250px; height: 250px;
position: absolute; position: absolute;
top: -5px; top: 50px;
left: 550px; left: 550px;
width: 520px; width: 520px;
z-index: 1; z-index: 1;
......
...@@ -63,7 +63,7 @@ export default { ...@@ -63,7 +63,7 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.task-list { .task-list {
width: 416px; width: 350px;
height: 254px; height: 254px;
background: #222222; background: #222222;
border-radius: 10px 10px 0 0; border-radius: 10px 10px 0 0;
......
...@@ -63,7 +63,7 @@ export default { ...@@ -63,7 +63,7 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.task-list { .task-list {
width: 416px; width: 350px;
height: 254px; height: 254px;
background: #222222; background: #222222;
border-radius: 10px 10px 0 0; border-radius: 10px 10px 0 0;
......
...@@ -200,6 +200,7 @@ export default { ...@@ -200,6 +200,7 @@ export default {
width: 48px; width: 48px;
height: 48px; height: 48px;
cursor: pointer; cursor: pointer;
z-index: 1;
&::before { &::before {
font-size: 24px; font-size: 24px;
......
...@@ -15,6 +15,16 @@ ...@@ -15,6 +15,16 @@
<el-form-item label="航线名称" required> <el-form-item label="航线名称" required>
<el-input clearable v-model="name"></el-input> <el-input clearable v-model="name"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="所属单位:" required>
<el-cascader ref="CascaderRef" v-model="departmentId" :options="orgList" clearable :show-all-levels="false"
placeholder="请选择所属单位" :props="{
children: 'children',
label: 'name',
value: 'id',
checkStrictly: true,
emitPath: false,
}" @change="changeNode"></el-cascader>
</el-form-item>
<el-form-item label="航线速度" prop="speed"> <el-form-item label="航线速度" prop="speed">
<el-input clearable v-model="curForm.speed"></el-input> <el-input clearable v-model="curForm.speed"></el-input>
</el-form-item> </el-form-item>
...@@ -86,7 +96,7 @@ ...@@ -86,7 +96,7 @@
</template> </template>
<script> <script>
import { Map, AirLine } from "../../../../../../../../../../api"; import { Map, AirLine,TaskInfo } from "../../../../../../../../../../api";
import { mapState } from "vuex"; import { mapState } from "vuex";
import Utils from "../../../../../../../../../../components/cesiumLayer/lib/cesium/utils"; import Utils from "../../../../../../../../../../components/cesiumLayer/lib/cesium/utils";
import { nanoid } from "nanoid"; import { nanoid } from "nanoid";
...@@ -123,7 +133,9 @@ export default { ...@@ -123,7 +133,9 @@ export default {
inject: ["rootNode"], inject: ["rootNode"],
data() { data() {
return { return {
orgList: [],
name: "", //航线名 name: "", //航线名
departmentId:'',//部门id
flightLabel:"",//航线标签 flightLabel:"",//航线标签
form: [], //表单集合 form: [], //表单集合
pageIndex: 0, //当前页码 pageIndex: 0, //当前页码
...@@ -168,6 +180,7 @@ export default { ...@@ -168,6 +180,7 @@ export default {
}, },
mounted() { mounted() {
let viewer = this.cesiumViewer; let viewer = this.cesiumViewer;
this.getOrgList();
this.dataSource = new Cesium.CustomDataSource(this.dataSourceName); this.dataSource = new Cesium.CustomDataSource(this.dataSourceName);
viewer.dataSources.add(this.dataSource); viewer.dataSources.add(this.dataSource);
this.handler = new Cesium.ScreenSpaceEventHandler(viewer.canvas); //获取事件对象 this.handler = new Cesium.ScreenSpaceEventHandler(viewer.canvas); //获取事件对象
...@@ -212,6 +225,77 @@ export default { ...@@ -212,6 +225,77 @@ export default {
this.dataSource.show = false; this.dataSource.show = false;
}, },
methods: { methods: {
changeNode() {
this.$refs.CascaderRef.dropDownVisible = false;
},
async getOrgList() {
let data = await TaskInfo.listAll();
let res = data.data;
const config = {
id: "id",
parentId: "parentId",
childrenList: "children",
};
const childrenListMap = {};
const nodeIds = {};
const tree = [];
for (const d of res) {
const parentId = d[config.parentId];
if (childrenListMap[parentId] == null) {
childrenListMap[parentId] = [];
}
nodeIds[d[config.id]] = d;
childrenListMap[parentId].push(d);
}
for (const d of res) {
const parentId = d[config.parentId];
if (nodeIds[parentId] == null) {
tree.push(d);
}
}
for (const t of tree) {
adaptToChildrenList(t);
}
function adaptToChildrenList(o) {
if (childrenListMap[o[config.id]] !== null) {
o[config.childrenList] = childrenListMap[o[config.id]];
}
if (o[config.childrenList]) {
for (const c of o[config.childrenList]) {
adaptToChildrenList(c);
}
}
}
this.orgList = tree;
},
convertToSeconds(timeString) {
const regex = /(\d+)\s*(小时|分钟|秒)/g;
let totalSeconds = 0;
let match;
while ((match = regex.exec(timeString)) !== null) {
const value = parseInt(match[1], 10);
const unit = match[2];
switch (unit) {
case '小时':
totalSeconds += value * 3600; // 1小时 = 3600秒
break;
case '分钟':
totalSeconds += value * 60; // 1分钟 = 60秒
break;
case '秒':
totalSeconds += value; // 直接加秒
break;
}
}
return totalSeconds;
},
async getLabel() { async getLabel() {
this.rootNode.$emit("getLabelList", { this.rootNode.$emit("getLabelList", {
callback: (data) => { callback: (data) => {
...@@ -225,6 +309,10 @@ export default { ...@@ -225,6 +309,10 @@ export default {
this.$message.warning("请输入航线名称"); this.$message.warning("请输入航线名称");
return; return;
} }
if (!this.departmentId) {
this.$message.warning("请选择所属机构");
return;
}
if (this.form.length === 0) { if (this.form.length === 0) {
this.$message.warning("请点击地图选择航点"); this.$message.warning("请点击地图选择航点");
return; return;
...@@ -269,15 +357,19 @@ export default { ...@@ -269,15 +357,19 @@ export default {
content: waypoints, content: waypoints,
distance: this.distance, distance: this.distance,
dutyOrganizationId: "", dutyOrganizationId: "",
departmentId: this.departmentId, //部门id
name: this.name, name: this.name,
speed: this.form[0].speed, speed: this.form[0].speed,
flyTime: this.convertToSeconds(this.time)
}; };
try { try {
let res = await AirLine.add({ let res = await AirLine.add({
flightName: airway.name || `${this.userInfo.username}-巡查}`, flightName: airway.name || `${this.userInfo.username}-巡查}`,
pointCount: airway.content.length, pointCount: airway.content.length,
distance: airway.distance, distance: airway.distance,
departmentId: airway.departmentId,
sourceType: 1, sourceType: 1,
flyTime:airway.flyTime,
linePointSaveReqVOS: airway.content.map((point) => ({ linePointSaveReqVOS: airway.content.map((point) => ({
latitude: point.coordinate.latitude, latitude: point.coordinate.latitude,
longitude: point.coordinate.longitude, longitude: point.coordinate.longitude,
...@@ -629,9 +721,8 @@ export default { ...@@ -629,9 +721,8 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.airway-edit { .airway-edit {
position: absolute; position: absolute;
top: -50px; top: 0px;
width: 450px; width: 352px;
.dialog-content { .dialog-content {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
......
...@@ -210,7 +210,7 @@ export default { ...@@ -210,7 +210,7 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.taskListBox { .taskListBox {
height: 200px; height: 200px;
width: 416px; width: 350px;
background: #222222; background: #222222;
border-radius: 12px; border-radius: 12px;
transition: 0.3s; transition: 0.3s;
......
...@@ -543,9 +543,8 @@ export default { ...@@ -543,9 +543,8 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.airway-edit { .airway-edit {
position: absolute; position: absolute;
top: -50px; top: 0px;
width: 450px; width: 352px;
.dialog-content { .dialog-content {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
......
...@@ -234,7 +234,7 @@ export default { ...@@ -234,7 +234,7 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.taskListBox { .taskListBox {
min-height: 254px; min-height: 254px;
width: 416px; width:350px;
background: #222222; background: #222222;
border-radius: 12px; border-radius: 12px;
transition: 0.3s; transition: 0.3s;
......
...@@ -139,6 +139,7 @@ export default { ...@@ -139,6 +139,7 @@ export default {
height: 48px; height: 48px;
background: #ffffff; background: #ffffff;
border-radius: 2px; border-radius: 2px;
top: -29px;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
......
...@@ -2,15 +2,10 @@ ...@@ -2,15 +2,10 @@
<div class="mountBox"> <div class="mountBox">
<div class="main" v-if="show"> <div class="main" v-if="show">
<div v-if="mountList.length > 0" class="list"> <div v-if="mountList.length > 0" class="list">
<div <div class="mount-item pr mt6" :class="{
class="mount-item pr mt6" active:
:class="{ (selectMount && selectMount.gimbalName) === item.gimbalName,
active: }" v-for="(item, index) in mountList" :key="index">
(selectMount && selectMount.gimbalName) === item.gimbalName,
}"
v-for="(item, index) in mountList"
:key="index"
>
<div class="icon-box" @click="onSelectMount(item)"> <div class="icon-box" @click="onSelectMount(item)">
<img class :src="item.icon" /> <img class :src="item.icon" />
</div> </div>
...@@ -18,17 +13,9 @@ ...@@ -18,17 +13,9 @@
</div> </div>
</div> </div>
<template v-if="selectMount"> <template v-if="selectMount">
<component <component :is="selectMount.gimbalName" v-if="selectMount" class="mount-panel" :keyFlag="nxNormal"
:is="selectMount.gimbalName" :payload_data="selectMountPayload" @directive="mountDirective" @take_photo="mountTakePhoto"
v-if="selectMount" @record="mountRecord" @close="mountClose" />
class="mount-panel"
:keyFlag="nxNormal"
:payload_data="selectMountPayload"
@directive="mountDirective"
@take_photo="mountTakePhoto"
@record="mountRecord"
@close="mountClose"
/>
</template> </template>
</div> </div>
</template> </template>
...@@ -48,6 +35,11 @@ export default { ...@@ -48,6 +35,11 @@ export default {
...mountComponents, ...mountComponents,
}, },
props: { props: {
// 是否机库页面使用
isHangar: {
type: Boolean,
default: false,
},
show: { show: {
type: Boolean, type: Boolean,
default: false, default: false,
...@@ -78,11 +70,30 @@ export default { ...@@ -78,11 +70,30 @@ export default {
return this.uavRealTimeData?.healthData?.NX?.warningLevel === "NORMAL"; return this.uavRealTimeData?.healthData?.NX?.warningLevel === "NORMAL";
}, },
}, },
created() {}, created() { },
mounted() {}, mounted() { },
beforeDestroy() {}, beforeDestroy() { },
methods: { methods: {
onSelectMount(item) { /**
* 接管判断, 机库模块中不需要判断接管
*/
async isTakeOver() {
if (this.isHangar) {
return await this.$store.dispatch(
"MMCFlightControlCenter/hangar/isTakeOver"
);
} else {
return await this.$store.dispatch(
"MMCFlightControlCenter/uav/isTakeOver"
);
}
},
async onSelectMount(item) {
// 判断是否已接管
if (!(await this.isTakeOver())) {
this.$message.warning("请先接管设备");
return;
}
this.$store.commit("MMCFlightControlCenter/uav/setState", { this.$store.commit("MMCFlightControlCenter/uav/setState", {
key: "selectMount", key: "selectMount",
value: item, value: item,
......
...@@ -2,72 +2,38 @@ ...@@ -2,72 +2,38 @@
<div class="control-right"> <div class="control-right">
<!-- 挂载-警灯-无人机 --> <!-- 挂载-警灯-无人机 -->
<div class="control-list" style="top: 13%"> <div class="control-list" style="top: 13%">
<div <div class="control-item" :class="showHealth ? 'active' : ''" @click="onSwitchShow('showHealth')">
class="control-item" <img :class="{ active: showHealth }" src="./assets/images/health.svg" />
:class="showHealth ? 'active' : ''"
@click="onSwitchShow('showHealth')"
>
<img :class="{active:showHealth}" src="./assets/images/health.svg" />
<span class="">健康管理</span> <span class="">健康管理</span>
</div> </div>
<!-- 机库信息 --> <!-- 机库信息 -->
<slot name="hangar"></slot> <slot name="hangar"></slot>
<div <div class="control-item" :class="showMount ? 'active' : ''" @click="onSwitchShow('showMount')">
class="control-item" <img :class="{ active: showMount }" src="./assets/images/mount.svg" />
:class="showMount ? 'active' : ''"
@click="onSwitchShow('showMount')"
>
<img :class="{active:showMount}" src="./assets/images/mount.svg" />
<span class="">挂载</span> <span class="">挂载</span>
</div> </div>
<div <div class="control-item" :class="showControlList ? 'active' : ''" @click="onSwitchShow('showControlList')">
class="control-item" <img :class="{ active: showControlList }" src="./assets/images/uav.svg" />
:class="showControlList ? 'active' : ''"
@click="onSwitchShow('showControlList')"
>
<img :class="{active:showControlList}" src="./assets/images/uav.svg" />
<span class="">无人机</span> <span class="">无人机</span>
</div> </div>
<div <div v-if="!isHangar && uav.network === 2" class="control-item" :class="showAlarmLamp ? 'active' : ''"
v-if="!isHangar && uav.network === 2" @click="onSwitchShow('showAlarmLamp')">
class="control-item" <img :class="{ active: showAlarmLamp }" src="./assets/images/lamp.svg" />
:class="showAlarmLamp ? 'active' : ''"
@click="onSwitchShow('showAlarmLamp')"
>
<img :class="{active:showAlarmLamp}" src="./assets/images/lamp.svg" />
<span class="">警灯</span> <span class="">警灯</span>
</div> </div>
<div <div class="control-item" :class="showViewLib ? 'active' : ''" @click="onSwitchShow('showViewLib')">
class="control-item" <img :class="{ active: showViewLib }" src="./assets/images/files.svg" />
:class="showViewLib ? 'active' : ''"
@click="onSwitchShow('showViewLib')"
>
<img :class="{active:showViewLib}" src="./assets/images/files.svg" />
<span class="">视图库</span> <span class="">视图库</span>
</div> </div>
<ViewLib v-if="showViewLib"></ViewLib> <ViewLib v-if="showViewLib"></ViewLib>
</div> </div>
<ControlList <ControlList @clearId="$emit('clearId')" @closeIconShow="iconShow = false" @exit="showControlList = false"
@clearId="$emit('clearId')" :show="showControlList" :isHangar="isHangar"></ControlList>
@closeIconShow="iconShow = false"
@exit="showControlList = false"
:show="showControlList"
:isHangar="isHangar"
></ControlList>
<Health v-if="showHealth" @exit="showHealth = false"></Health> <Health v-if="showHealth" @exit="showHealth = false"></Health>
<Mount v-if="showMount" :show="showMount"></Mount> <Mount v-if="showMount" :isHangar="isHangar" :show="showMount"></Mount>
<!-- 喊话器 --> <!-- 喊话器 -->
<MMCGimbalP1 <MMCGimbalP1 class="PagerP1" v-show="showMMCGimbalP1" ref="MMCGimbalP1" @close="showMMCGimbalP1 = false" />
class="PagerP1" <MountController @webscoketFn="(data) => fun(data)" v-if="uav && uav.deviceId" ref="MountControllerRef" />
v-show="showMMCGimbalP1"
ref="MMCGimbalP1"
@close="showMMCGimbalP1 = false"
/>
<MountController
@webscoketFn="(data) => fun(data)"
v-if="uav && uav.deviceId"
ref="MountControllerRef"
/>
<AlarmLamp v-if="showAlarmLamp" :uav="uav" @close="showAlarmLamp = false" /> <AlarmLamp v-if="showAlarmLamp" :uav="uav" @close="showAlarmLamp = false" />
<slot name="dialog"></slot> <slot name="dialog"></slot>
</div> </div>
...@@ -118,8 +84,8 @@ export default { ...@@ -118,8 +84,8 @@ export default {
}, },
watch: { watch: {
// 打开航线编辑时关闭所有窗口 // 打开航线编辑时关闭所有窗口
showAirwayEdit(newVal){ showAirwayEdit(newVal) {
if(newVal){ if (newVal) {
this.showAlarmLamp = false; this.showAlarmLamp = false;
this.showHealth = false; this.showHealth = false;
this.showMMCGimbalP1 = false; this.showMMCGimbalP1 = false;
...@@ -130,6 +96,20 @@ export default { ...@@ -130,6 +96,20 @@ export default {
} }
}, },
methods: { methods: {
/**
* 接管判断, 机库模块中不需要判断接管
*/
async isTakeOver() {
if (this.isHangar) {
return await this.$store.dispatch(
"MMCFlightControlCenter/hangar/isTakeOver"
);
} else {
return await this.$store.dispatch(
"MMCFlightControlCenter/uav/isTakeOver"
);
}
},
hideAll(key) { hideAll(key) {
let arr = [ let arr = [
"showAlarmLamp", "showAlarmLamp",
...@@ -148,7 +128,15 @@ export default { ...@@ -148,7 +128,15 @@ export default {
/** /**
* 切换展示 * 切换展示
*/ */
onSwitchShow(key) { async onSwitchShow(key) {
if (key == 'showHealth' && !this?.uav?.isOnline) {
return this.$message.info('无人机不在线!');
}
// 判断是否已接管
if (!(await this.isTakeOver())) {
this.$message.warning("请先接管设备");
return;
}
this.$emit("switchCallback"); this.$emit("switchCallback");
this.hideAll(key); this.hideAll(key);
this[key] = !this[key]; this[key] = !this[key];
...@@ -185,7 +173,7 @@ export default { ...@@ -185,7 +173,7 @@ export default {
box-sizing: border-box; box-sizing: border-box;
overflow: hidden; overflow: hidden;
> img { >img {
width: 24px; width: 24px;
} }
...@@ -197,6 +185,7 @@ export default { ...@@ -197,6 +185,7 @@ export default {
border: 1px solid #3C3C3C; border: 1px solid #3C3C3C;
color: #3388ff; color: #3388ff;
} }
.active { .active {
filter: drop-shadow(#3388ff 100px 0); filter: drop-shadow(#3388ff 100px 0);
transform: translateX(-100px); transform: translateX(-100px);
......
...@@ -481,6 +481,7 @@ export default { ...@@ -481,6 +481,7 @@ export default {
align-items: center; align-items: center;
font-family: MicrosoftYaHei; font-family: MicrosoftYaHei;
font-size: 16px; font-size: 16px;
z-index: 2;
color: #ffffff; color: #ffffff;
line-height: 21px; line-height: 21px;
padding: 0 4px; padding: 0 4px;
......
# vue2 # vue2
# node版本 >= 18.12.0
## Project setup ## Project setup
``` ```
yarn install yarn install
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论