2023-09-20 21:33:11 +08:00
|
|
|
|
<template>
|
2024-07-23 20:40:42 +08:00
|
|
|
|
<div class="w-100 h-100 mainBox">
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<!-- 弹出框 -->
|
2024-08-30 21:12:13 +08:00
|
|
|
|
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="320px" top="30vh" @close="closeCallback"
|
|
|
|
|
@open="openCallback">
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<!-- 起飞设置弹出框 -->
|
|
|
|
|
<template v-if="dialogItem == 'takeoffBox'">
|
2024-06-26 20:24:12 +08:00
|
|
|
|
<el-slider class="w-100" v-model="takeoffValue" :show-tooltip="false" show-input :min="1" :max="100">
|
|
|
|
|
</el-slider>
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
|
|
<el-button size="medium" @click="dialogVisible = false">关闭</el-button>
|
|
|
|
|
<el-button size="medium" type="primary"
|
2024-08-30 16:03:58 +08:00
|
|
|
|
@click="publishFun(`{guidedMode:{alt:${takeoffValue}}}`); speakText('确认起飞')">飞至</el-button>
|
2023-10-18 15:58:44 +08:00
|
|
|
|
</span>
|
2023-09-20 21:33:11 +08:00
|
|
|
|
</template>
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<!-- 摄像头弹出框 -->
|
2024-08-30 21:12:13 +08:00
|
|
|
|
<template v-else-if="dialogItem == 'cameraBox'">
|
2024-08-08 14:54:02 +08:00
|
|
|
|
<div class="slider-container w-100 flex mse mac">
|
|
|
|
|
<font>俯</font>
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<el-slider @change="releaseCameraSlider('pitch')" @input="setCamera('pitch')" v-model="pitchValue"
|
|
|
|
|
:show-tooltip="false" class="w-80"></el-slider>
|
2024-08-08 14:54:02 +08:00
|
|
|
|
<font>仰</font>
|
2023-09-20 21:33:11 +08:00
|
|
|
|
</div>
|
2024-08-08 14:54:02 +08:00
|
|
|
|
<div class="slider-container w-100 flex mse mac m-t-10">
|
|
|
|
|
<font>左</font>
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<el-slider @change="releaseCameraSlider('yaw')" @input="setCamera('yaw')" v-model="yawValue"
|
|
|
|
|
:show-tooltip="false" class="w-80"></el-slider>
|
2024-08-08 14:54:02 +08:00
|
|
|
|
<font>右</font>
|
2023-09-20 21:33:11 +08:00
|
|
|
|
</div>
|
2024-08-08 14:54:02 +08:00
|
|
|
|
<div class="slider-container w-100 flex mse mac m-t-10">
|
|
|
|
|
<font>大</font>
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<el-slider @change="releaseCameraSlider('scale')" @input="setCamera('scale')" v-model="scaleValue"
|
|
|
|
|
:show-tooltip="false" class="w-80"></el-slider>
|
2024-08-08 14:54:02 +08:00
|
|
|
|
<font>小</font>
|
2023-09-20 21:33:11 +08:00
|
|
|
|
</div>
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
|
|
<el-button size="medium" @click="dialogVisible = false">关闭</el-button>
|
|
|
|
|
</span>
|
2023-09-20 21:33:11 +08:00
|
|
|
|
</template>
|
2024-08-20 20:53:35 +08:00
|
|
|
|
<!-- 校准磁罗盘 -->
|
2024-08-30 21:12:13 +08:00
|
|
|
|
<template v-else-if="dialogItem === 'compassBox'">
|
2024-08-20 20:53:35 +08:00
|
|
|
|
<div>
|
|
|
|
|
<template v-if="reportCal === null">
|
|
|
|
|
<el-progress :percentage="completionPct"></el-progress>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-else>
|
|
|
|
|
{{ reportCal === 'successful' ? '校准成功,重启飞机即可生效!' : '校准失败!' }}
|
|
|
|
|
</template>
|
|
|
|
|
</div>
|
|
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
|
|
<el-button size="medium" @click="handlerCloseCompassBox">关闭</el-button>
|
|
|
|
|
</span>
|
|
|
|
|
</template>
|
2024-08-30 16:03:58 +08:00
|
|
|
|
<!-- 校准加速度计 -->
|
2024-08-30 21:12:13 +08:00
|
|
|
|
<template v-else-if="dialogItem === 'acceBox'">
|
|
|
|
|
<div v-loading="acceState === null"></div>
|
|
|
|
|
<div v-if="acceState === 'level'">
|
2024-08-30 18:50:58 +08:00
|
|
|
|
水平
|
|
|
|
|
</div>
|
2024-08-30 21:12:13 +08:00
|
|
|
|
<div v-else-if="acceState === 'left'">
|
2024-08-30 18:50:58 +08:00
|
|
|
|
左
|
|
|
|
|
</div>
|
2024-08-30 21:12:13 +08:00
|
|
|
|
<div v-else-if="acceState === 'right'">
|
2024-08-30 18:50:58 +08:00
|
|
|
|
右
|
|
|
|
|
</div>
|
2024-08-30 21:12:13 +08:00
|
|
|
|
<div v-else-if="acceState === 'down'">
|
2024-08-30 18:50:58 +08:00
|
|
|
|
前
|
|
|
|
|
</div>
|
2024-08-30 21:12:13 +08:00
|
|
|
|
<div v-else-if="acceState === 'up'">
|
2024-08-30 18:50:58 +08:00
|
|
|
|
后
|
|
|
|
|
</div>
|
2024-08-30 21:12:13 +08:00
|
|
|
|
<div v-else-if="acceState === 'back'">
|
2024-08-30 18:50:58 +08:00
|
|
|
|
反
|
|
|
|
|
</div>
|
2024-08-30 21:12:13 +08:00
|
|
|
|
<div v-else-if="acceState === 'successful'">
|
2024-08-30 18:50:58 +08:00
|
|
|
|
校准成功,重启飞机即可生效!
|
|
|
|
|
</div>
|
2024-08-30 21:12:13 +08:00
|
|
|
|
<div v-else-if="acceState === 'failed'">
|
2024-08-30 18:50:58 +08:00
|
|
|
|
校准失败
|
2024-08-30 16:03:58 +08:00
|
|
|
|
</div>
|
|
|
|
|
<span slot="footer" class="dialog-footer">
|
2024-08-30 18:50:58 +08:00
|
|
|
|
<el-button size="medium" @click="handlerCloseAcceBox">关闭</el-button>
|
2024-08-30 21:12:13 +08:00
|
|
|
|
<el-button size="medium" v-if="acceState !== 'successful' && acceState !== 'failed' && acceState !== null"
|
|
|
|
|
@click="publishFun('{initAcce:2}')" type="primary">已摆好</el-button>
|
|
|
|
|
</span>
|
|
|
|
|
</template>
|
2025-05-21 16:19:35 +08:00
|
|
|
|
<!-- 喊话参数 -->
|
|
|
|
|
<template v-else-if="dialogItem === 'talkBox'">
|
|
|
|
|
<el-form label-position="left">
|
|
|
|
|
<el-form-item label="喊话内容" label-width="80px">
|
|
|
|
|
<el-input v-model="talkValue" type="textarea" :autosize="{ minRows: 2, maxRows: 4 }"
|
|
|
|
|
placeholder="请输入喊话内容"></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="音量设置" label-width="80px">
|
|
|
|
|
<el-slider class="w-90" v-model="talkVolume" :show-tooltip="false" :min="1" :max="9">
|
|
|
|
|
</el-slider>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
|
|
<el-button size="medium" @click="dialogVisible = false">关闭</el-button>
|
|
|
|
|
<el-button size="medium" type="primary" @click="playText(talkValue, talkVolume);">发送</el-button>
|
|
|
|
|
</span>
|
|
|
|
|
</template>
|
2024-10-12 20:19:59 +08:00
|
|
|
|
<!-- 读写参数 -->
|
2024-08-30 21:12:13 +08:00
|
|
|
|
<template v-else-if="dialogItem === 'paramBox'">
|
|
|
|
|
<el-input v-model="paramItem" placeholder="参数名"></el-input>
|
|
|
|
|
<el-input v-model="paramValue" placeholder="值" class="m-t-20"></el-input>
|
|
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
|
|
<el-button size="medium" @click="dialogVisible = false">关闭</el-button>
|
2024-10-12 20:19:59 +08:00
|
|
|
|
<el-button size="medium" type="primary"
|
2025-05-21 16:19:35 +08:00
|
|
|
|
@click="paramValue = ''; clearPlanePar(); publishFun(`{'getParam':'${paramItem}'}`);">读取</el-button>
|
2024-09-19 11:39:00 +08:00
|
|
|
|
<el-button size="medium" type="primary"
|
|
|
|
|
@click="publishFun(`{'setParam':{'item':'${paramItem}','value':'${paramValue}'}}`)">写入</el-button>
|
2024-08-30 16:03:58 +08:00
|
|
|
|
</span>
|
|
|
|
|
</template>
|
2023-10-18 15:58:44 +08:00
|
|
|
|
</el-dialog>
|
2024-07-23 20:40:42 +08:00
|
|
|
|
<!-- 底边 tab控件组 -->
|
|
|
|
|
<div class="flex column mr mac tabContainer p-l-10 p-r-10">
|
|
|
|
|
<!-- tab控件组 内容组 -->
|
|
|
|
|
<div class="tabContent" :class="{ 'active': activeIndex !== null }">
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<!-- 订单任务 -->
|
2024-07-23 20:40:42 +08:00
|
|
|
|
<div v-if="activeIndex === 0" class="tabContentBox">
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<!-- 标题 -->
|
2024-07-23 20:40:42 +08:00
|
|
|
|
<div class="clearB m-b-15 fb f-s-16 contentTit">
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<i class="iconfont icon-dingdanguanli f-s-22 m-r-5"></i>
|
|
|
|
|
<span>送餐任务</span>
|
|
|
|
|
</div>
|
|
|
|
|
<!-- 内容 -->
|
|
|
|
|
<el-form label-position="left" ref="questForm" :model="questForm" label-width="80px">
|
2024-07-13 22:29:33 +08:00
|
|
|
|
<el-form-item label="订单选择" v-if="!executeOrder">
|
2024-07-20 18:38:44 +08:00
|
|
|
|
<el-select v-model="questForm.id" :filterable="isMobile" placeholder="请选择,也可输入搜索"
|
|
|
|
|
:disabled="executeOrder">
|
2024-06-18 16:24:50 +08:00
|
|
|
|
<el-option v-for="item in questList" :key="item.id" :label="item.id" :value="item.id"
|
2024-07-08 19:42:48 +08:00
|
|
|
|
:class="isWaring(item) ? 'danger-color' : ''">
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<span class="l">{{ item.id }}</span>
|
2024-06-04 18:12:32 +08:00
|
|
|
|
<span class="l m-l-5">{{ item.receiver }}</span>
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<span class="l m-l-5">{{ item.receive_site_name }}</span>
|
|
|
|
|
</el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
2024-07-12 19:37:29 +08:00
|
|
|
|
<template v-else>
|
2024-08-08 17:57:06 +08:00
|
|
|
|
<el-form-item v-if="waringTags.length > 0" label="提示">
|
2024-08-07 18:02:33 +08:00
|
|
|
|
<el-tag v-for="(tag, index) in waringTags" :key="index" class="m-r-5" type="warning">{{ tag }}</el-tag>
|
|
|
|
|
</el-form-item>
|
2024-08-08 17:57:06 +08:00
|
|
|
|
<el-form-item label="订单ID">
|
2024-07-12 19:37:29 +08:00
|
|
|
|
{{ executeOrder.id }}
|
|
|
|
|
</el-form-item>
|
2024-08-08 17:57:06 +08:00
|
|
|
|
<el-form-item label="收货站点">
|
2024-07-12 19:37:29 +08:00
|
|
|
|
{{ executeOrder.receive_site_name }}
|
|
|
|
|
</el-form-item>
|
2024-08-08 17:57:06 +08:00
|
|
|
|
<el-form-item label="联系电话">
|
2024-07-12 19:37:29 +08:00
|
|
|
|
{{ executeOrder.tel }}
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</template>
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<el-form-item label="飞机操作">
|
|
|
|
|
<el-button-group>
|
2024-09-13 16:33:39 +08:00
|
|
|
|
<!-- <el-button size="mini" class="f-s-14" v-if="Number(plane.planeState.questState) === 1" type="primary"
|
2024-06-18 16:24:50 +08:00
|
|
|
|
icon="f-s-14 iconfont icon-chakanzhihangrizhi" @click="checkQuest">
|
2024-07-12 19:37:29 +08:00
|
|
|
|
<font class="m-l-5">上传航点</font>
|
2024-09-13 16:33:39 +08:00
|
|
|
|
</el-button> -->
|
2024-09-19 11:39:00 +08:00
|
|
|
|
<el-button size="mini" class="f-s-14"
|
|
|
|
|
v-if="Number(plane.planeState.questState) === 1 || Number(plane.planeState.questState) === 4"
|
|
|
|
|
type="warning" icon="f-s-14 iconfont icon-chakanzhihangrizhi" @click="checkQuest">
|
2024-09-13 16:33:39 +08:00
|
|
|
|
<font class="m-l-5">准备任务</font>
|
2023-10-18 15:58:44 +08:00
|
|
|
|
</el-button>
|
2024-09-19 11:39:00 +08:00
|
|
|
|
<el-button size="mini" class="f-s-14" v-else-if="Number(plane.planeState.questState) === 2"
|
|
|
|
|
key="wirteBut" type="info" :loading="true" disabled>
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<font class="m-l-5">航点写入中···</font>
|
|
|
|
|
</el-button>
|
2024-09-02 17:50:58 +08:00
|
|
|
|
<el-button size="mini" class="f-s-14" v-else-if="Number(plane.planeState.questState) === 12" type="info"
|
2024-07-29 21:11:31 +08:00
|
|
|
|
:loading="true" disabled>
|
|
|
|
|
<font class="m-l-5">解锁中...</font>
|
|
|
|
|
</el-button>
|
2024-09-19 11:39:00 +08:00
|
|
|
|
<el-button size="mini" class="f-s-14" v-else-if="Number(plane.planeState.questState) === 20"
|
|
|
|
|
type="success" icon="f-s-14 iconfont icon-yangshi_icon_tongyong_departure"
|
2024-09-13 16:33:39 +08:00
|
|
|
|
@click="publishFun('{setQuestState:{bit:5,state:1}}'); speakText('执行送餐任务')">
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<font class="m-l-5">执行任务</font>
|
|
|
|
|
</el-button>
|
2024-08-07 18:02:33 +08:00
|
|
|
|
<el-button size="mini" class="f-s-14" v-else-if="isShipped" type="info" :loading="true" disabled>
|
2024-07-29 21:11:31 +08:00
|
|
|
|
<font class="m-l-5">执行任务中...</font>
|
|
|
|
|
</el-button>
|
2023-10-18 15:58:44 +08:00
|
|
|
|
</el-button-group>
|
|
|
|
|
</el-form-item>
|
2024-08-06 20:32:30 +08:00
|
|
|
|
<el-form-item label="任务确认">
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<el-button-group>
|
2024-08-06 20:32:30 +08:00
|
|
|
|
<el-button size="mini" class="f-s-14" type="danger" icon="iconfont icon-cuowu" key="celBUt"
|
2024-06-17 14:42:40 +08:00
|
|
|
|
@click="reQuest">
|
2024-08-07 18:02:33 +08:00
|
|
|
|
<font class="m-l-5">取消</font>
|
2023-10-18 15:58:44 +08:00
|
|
|
|
</el-button>
|
|
|
|
|
<el-button size="mini" class="f-s-14" type="success" icon="iconfont icon-qiandai" key="bingBut"
|
2024-06-17 14:42:40 +08:00
|
|
|
|
@click="overQuest">
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<font class="m-l-5">已送达</font>
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-button-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
2023-09-20 21:33:11 +08:00
|
|
|
|
</div>
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<!-- 飞机操作 -->
|
2024-07-23 20:40:42 +08:00
|
|
|
|
<div v-else-if="activeIndex === 1" class="tabContentBox">
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<!-- 标题 -->
|
2024-07-23 20:40:42 +08:00
|
|
|
|
<div class="clearB m-b-15 fb f-s-16 contentTit">
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<i class="iconfont icon-youxishoubing f-s-22 m-r-5"></i>
|
|
|
|
|
<span>飞机控制</span>
|
|
|
|
|
</div>
|
2024-07-23 20:40:42 +08:00
|
|
|
|
<div class="butIconBox gap10 flex">
|
2024-07-23 20:44:38 +08:00
|
|
|
|
<el-button size="medium" type="primary" class="flex1 butIcon"
|
2024-08-30 16:03:58 +08:00
|
|
|
|
@click="publishFun('{unlock:1}'); speakText('解锁飞机')">
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<i class="iconfont icon-jiesuo f-s-24"></i>
|
|
|
|
|
<div class="m-t-5">解锁</div>
|
|
|
|
|
</el-button>
|
2024-07-23 20:44:38 +08:00
|
|
|
|
<el-button size="medium" type="primary" class="flex1 butIcon"
|
2024-08-30 16:03:58 +08:00
|
|
|
|
@click="confirmation('飞机加锁,螺旋桨将停转,请谨慎操作!', '加锁操作', '{lock:1}'); speakText('加锁,请注意安全')">
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<i class=" iconfont icon-suoding f-s-24"></i>
|
|
|
|
|
<div class="m-t-5">加锁</div>
|
|
|
|
|
</el-button>
|
2024-07-23 20:44:38 +08:00
|
|
|
|
<el-button size="medium" type="primary" class="flex1 butIcon"
|
2024-08-30 16:03:58 +08:00
|
|
|
|
@click="dialogVisible = true; dialogTitle = '高度设置(米)'; dialogItem = 'takeoffBox'; speakText('设置起飞高度')">
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<i class="iconfont icon-yangshi_icon_tongyong_departure f-s-24"></i>
|
|
|
|
|
<div class="m-t-5">起飞</div>
|
|
|
|
|
</el-button>
|
2024-07-23 20:44:38 +08:00
|
|
|
|
<el-button size="medium" type="primary" class="flex1 butIcon"
|
2024-08-30 16:03:58 +08:00
|
|
|
|
@click="publishFun('{loiterMode:1}'); speakText('悬停')">
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<i class="iconfont icon-fengzheng1 f-s-24"></i>
|
|
|
|
|
<div class="m-t-5">悬停</div>
|
|
|
|
|
</el-button>
|
2024-08-30 16:03:58 +08:00
|
|
|
|
<el-button size="medium" type="primary" class="flex1 butIcon"
|
|
|
|
|
@click="publishFun('{autoMode:1}'); speakText('继续执行航线')">
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<i class="iconfont icon-duandianxufei f-s-24"></i>
|
|
|
|
|
<div class="m-t-5">复航</div>
|
|
|
|
|
</el-button>
|
2024-07-23 20:44:38 +08:00
|
|
|
|
<el-button size="medium" type="primary" class="flex1 butIcon"
|
2024-08-21 19:57:21 +08:00
|
|
|
|
@click="publishFun('{rtlMode:1}'); speakText('返航')">
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<i class="iconfont icon-yijianfanhang f-s-24"></i>
|
|
|
|
|
<div class="m-t-5">返航</div>
|
|
|
|
|
</el-button>
|
2024-07-23 20:44:38 +08:00
|
|
|
|
<el-button size="medium" type="primary" class="flex1 butIcon"
|
2024-08-21 19:57:21 +08:00
|
|
|
|
@click="publishFun('{landMode:1}'); speakText('降落')">
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<i class="iconfont icon-yangshi_icon_tongyong_arriving f-s-24"></i>
|
|
|
|
|
<div class="m-t-5">降落</div>
|
|
|
|
|
</el-button>
|
|
|
|
|
</div>
|
2024-07-23 20:40:42 +08:00
|
|
|
|
</div>
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<!-- 附加模组操作 -->
|
2024-07-23 20:40:42 +08:00
|
|
|
|
<div v-else-if="activeIndex === 2" class="tabContentBox">
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<!-- 标题 -->
|
2024-07-23 20:40:42 +08:00
|
|
|
|
<div class="clearB m-b-15 fb f-s-16 contentTit">
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<i class="iconfont icon-mianxingdiaogou f-s-22 m-r-5"></i>
|
|
|
|
|
<span>挂载仓控制</span>
|
|
|
|
|
</div>
|
2024-07-23 20:40:42 +08:00
|
|
|
|
<div class="butIconBox m-b-15 gap10 flex">
|
2024-07-23 20:44:38 +08:00
|
|
|
|
<el-button size="medium" type="primary" class="flex1 butIcon"
|
2025-05-21 16:19:35 +08:00
|
|
|
|
@click="publishFun('{hookConteroller:4}'); pesoIsZero(); speakText('重置重量传感器')">
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<i class="iconfont icon-zhongliang f-s-24"></i>
|
|
|
|
|
<div class="m-t-5">归零</div>
|
|
|
|
|
</el-button>
|
2024-07-23 20:44:38 +08:00
|
|
|
|
<el-button size="medium" type="primary" class="flex1 butIcon"
|
2024-06-14 20:51:33 +08:00
|
|
|
|
@click="publishFun('{hookConteroller:0}'); speakText('收钩')">
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<i class="iconfont icon-xiangshang f-s-24"></i>
|
|
|
|
|
<div class="m-t-5">收钩</div>
|
|
|
|
|
</el-button>
|
2024-07-23 20:44:38 +08:00
|
|
|
|
<el-button size="medium" type="primary" class="flex1 butIcon"
|
2024-06-14 20:51:33 +08:00
|
|
|
|
@click="publishFun('{hookConteroller:3}'); speakText('继续放钩')">
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<i class="iconfont icon-qiyong f-s-24"></i>
|
|
|
|
|
<div class="m-t-5">继续</div>
|
|
|
|
|
</el-button>
|
2024-07-23 20:44:38 +08:00
|
|
|
|
<el-button size="medium" type="primary" class="flex1 butIcon"
|
2024-06-14 20:51:33 +08:00
|
|
|
|
@click="publishFun('{hookConteroller:2}'); speakText('暂停放钩')">
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<i class="iconfont icon-xuanting-zanting f-s-24"></i>
|
|
|
|
|
<div class="m-t-5">暂停</div>
|
|
|
|
|
</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
<!-- 标题 -->
|
2024-07-23 20:40:42 +08:00
|
|
|
|
<div class="clearB m-b-15 fb f-s-16 contentTit">
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<i class="iconfont icon-shipinjiankong f-s-22 m-r-5"></i>
|
|
|
|
|
<span>摄像头控制</span>
|
|
|
|
|
</div>
|
2024-07-23 20:40:42 +08:00
|
|
|
|
<div class="butIconBox m-b-15 gap10 flex">
|
2024-07-23 20:44:38 +08:00
|
|
|
|
<el-button size="medium" type="primary" class="flex1 butIcon"
|
2024-06-14 20:51:33 +08:00
|
|
|
|
@click="publishFun('{cameraController:{item:0,val:0}}'); speakText('摄像头一键回中')">
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<i class="iconfont icon-icon-rotation f-s-24"></i>
|
|
|
|
|
<div class="m-t-5">回中</div>
|
|
|
|
|
</el-button>
|
2024-07-23 20:44:38 +08:00
|
|
|
|
<el-button size="medium" type="primary" class="flex1 butIcon"
|
2024-06-14 20:51:33 +08:00
|
|
|
|
@click="publishFun('{cameraController:{item:2,val:0,yaw:0,pitch:-50}}'); speakText('摄像头一键俯瞰')">
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<i class="iconfont icon-down f-s-24"></i>
|
2024-06-14 20:51:33 +08:00
|
|
|
|
<div class="m-t-5">俯瞰</div>
|
2023-10-18 15:58:44 +08:00
|
|
|
|
</el-button>
|
2024-07-23 20:44:38 +08:00
|
|
|
|
<el-button size="medium" type="primary" class="flex1 butIcon"
|
2024-06-14 20:51:33 +08:00
|
|
|
|
@click="dialogVisible = true; dialogTitle = '摄像头控制'; dialogItem = 'cameraBox'; speakText('手动调整摄像头')">
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<i class="iconfont icon-chukong f-s-24"></i>
|
|
|
|
|
<div class="m-t-5">手动</div>
|
|
|
|
|
</el-button>
|
2024-07-23 20:44:38 +08:00
|
|
|
|
<el-button size="medium" type="primary" class="flex1 butIcon"
|
2024-06-14 20:51:33 +08:00
|
|
|
|
@click="dialogVisible = true; dialogTitle = '摄像头控制'; dialogItem = 'cameraBox'; speakText('调整镜头焦距')">
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<i class="iconfont icon-fangda f-s-24"></i>
|
|
|
|
|
<div class="m-t-5">焦距</div>
|
|
|
|
|
</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
<!-- 标题 -->
|
2024-07-23 20:40:42 +08:00
|
|
|
|
<div class="clearB m-b-15 fb f-s-16 contentTit">
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<i class="iconfont icon-tongzhi f-s-22 m-r-5"></i>
|
|
|
|
|
<span>喇叭控制</span>
|
|
|
|
|
</div>
|
2024-07-23 20:40:42 +08:00
|
|
|
|
<div class="butIconBox gap10 flex">
|
2025-05-21 16:19:35 +08:00
|
|
|
|
<el-button size="medium" type="primary" class="flex1 butIcon"
|
|
|
|
|
@click="dialogVisible = true; dialogTitle = '喊话参数'; dialogItem = 'talkBox';">
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<i class="iconfont icon-icon-test f-s-24"></i>
|
|
|
|
|
<div class="m-t-5">喊话</div>
|
|
|
|
|
</el-button>
|
|
|
|
|
</div>
|
2024-07-23 20:40:42 +08:00
|
|
|
|
</div>
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<!-- 飞机调试 -->
|
2024-07-23 20:40:42 +08:00
|
|
|
|
<div v-else-if="activeIndex === 3" class="tabContentBox">
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<!-- 标题 -->
|
2024-07-23 20:40:42 +08:00
|
|
|
|
<div class="clearB m-b-15 fb f-s-16 contentTit">
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<i class="iconfont icon-banshou_Line f-s-22 m-r-5"></i>
|
|
|
|
|
<span>飞机调试</span>
|
|
|
|
|
</div>
|
2024-07-23 20:40:42 +08:00
|
|
|
|
<div class="butIconBox m-b-15 gap10 flex">
|
2024-07-23 20:44:38 +08:00
|
|
|
|
<el-button size="medium" type="primary" class="flex1 butIcon"
|
2024-08-21 19:57:21 +08:00
|
|
|
|
@click="publishFun('{resetCompass:1}'); dialogVisible = true; dialogTitle = '校准磁罗盘'; dialogItem = 'compassBox'; speakText('校准磁罗盘')">
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<i class="iconfont icon-zhinanzhen f-s-24"></i>
|
|
|
|
|
<div class="m-t-5">磁罗盘</div>
|
|
|
|
|
</el-button>
|
2024-08-30 16:03:58 +08:00
|
|
|
|
<el-button size="medium" type="primary" class="flex1 butIcon"
|
2024-08-30 21:12:13 +08:00
|
|
|
|
@click="publishFun('{initAcce:1}'); speakText('校准加速度计'); dialogVisible = true; dialogTitle = '校准加速度计'; dialogItem = 'acceBox';">
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<i class="iconfont icon-zuobiaozhoupeizhixiang f-s-24"></i>
|
2024-08-30 18:50:58 +08:00
|
|
|
|
<div class="m-t-5">加速度计</div>
|
2023-10-18 15:58:44 +08:00
|
|
|
|
</el-button>
|
2024-08-30 16:03:58 +08:00
|
|
|
|
<el-button size="medium" type="primary" class="flex1 butIcon"
|
2024-10-12 20:19:59 +08:00
|
|
|
|
@click="speakText('读写参数'); dialogVisible = true; dialogTitle = '读写参数'; dialogItem = 'paramBox';">
|
2023-10-18 15:58:44 +08:00
|
|
|
|
<i class="iconfont icon-canshupeizhi f-s-24"></i>
|
2024-10-12 20:19:59 +08:00
|
|
|
|
<div class="m-t-5">读写参数</div>
|
2023-10-18 15:58:44 +08:00
|
|
|
|
</el-button>
|
|
|
|
|
</div>
|
2024-07-23 20:40:42 +08:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<!-- tab控件组 按钮组 -->
|
|
|
|
|
<div class="flex gap10 m-b-10 taButGroup">
|
2024-07-25 18:04:16 +08:00
|
|
|
|
<div class="flex1 h-100 taBut flex column mac mc animation" :class="activeIndex === index ? 'taButBG' : ''"
|
2024-07-23 20:40:42 +08:00
|
|
|
|
v-for="(item, index) in controlItems" :key="index" @click="toggleContent(index, item.voice)">
|
|
|
|
|
<i :class="item.icon" class="iconfont f-s-35 no-select"></i>
|
|
|
|
|
<div class="m-t-15 fb f-s-18 no-select">{{ item.title }}</div>
|
|
|
|
|
</div>
|
2023-10-18 15:58:44 +08:00
|
|
|
|
</div>
|
2023-09-20 21:33:11 +08:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2024-07-29 03:04:29 +08:00
|
|
|
|
import { lockSite } from '@/utils/api/table'
|
2023-09-20 21:33:11 +08:00
|
|
|
|
import mqtt from '@/utils/mqtt'
|
2024-06-14 20:51:33 +08:00
|
|
|
|
import { speakText } from '@/utils/index'
|
2023-09-20 21:33:11 +08:00
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: 'TabController',
|
|
|
|
|
data () {
|
|
|
|
|
return {
|
2023-10-18 15:58:44 +08:00
|
|
|
|
dialogTitle: '', // 弹出框 标题
|
|
|
|
|
dialogItem: '', // 弹出框 项目类型判断
|
|
|
|
|
dialogVisible: false, // 弹出框 显隐
|
|
|
|
|
pitchValue: 50, // 摄像头控制滑动条 俯仰值
|
|
|
|
|
yawValue: 50, // 摄像头控制滑动条 旋转值
|
|
|
|
|
scaleValue: 50, // 摄像头控制滑动条 焦距值
|
|
|
|
|
takeoffValue: 2, // 起飞高度
|
2023-09-20 21:33:11 +08:00
|
|
|
|
controlItems: [// 菜单
|
2024-06-14 20:51:33 +08:00
|
|
|
|
{ title: '任务', icon: 'icon-songcanfuwu', voice: '设置送餐任务' },
|
|
|
|
|
{ title: '控制', icon: 'icon-youxishoubing', voice: '控制飞机' },
|
|
|
|
|
{ title: '扩展', icon: 'icon-linghuokuozhan', voice: '控制扩展组件' },
|
|
|
|
|
{ title: '调试', icon: 'icon-banshou_Line', voice: '调试飞机' }
|
2023-09-20 21:33:11 +08:00
|
|
|
|
],
|
|
|
|
|
activeIndex: null, // 当前选中的菜单
|
|
|
|
|
tabIsOpen: false, // 判断tab 是否弹出
|
|
|
|
|
questForm: { // 送餐任务表单
|
|
|
|
|
id: ''
|
2024-08-07 18:02:33 +08:00
|
|
|
|
},
|
2024-08-30 21:12:13 +08:00
|
|
|
|
waringTags: [], // 任务栏 提示标签 有退款 超重 等
|
2024-10-12 20:19:59 +08:00
|
|
|
|
paramItem: '', // 参数 键
|
2025-05-21 16:19:35 +08:00
|
|
|
|
paramValue: '', // 参数 值
|
|
|
|
|
talkValue: '', // 喊话参数
|
|
|
|
|
talkVolume: 9// 喊话音量
|
2023-09-20 21:33:11 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
props: {
|
|
|
|
|
plane: {
|
2024-08-20 20:53:35 +08:00
|
|
|
|
type: Object,
|
2023-09-20 21:33:11 +08:00
|
|
|
|
deep: true
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
/**
|
|
|
|
|
* @description: 终端平台是否是pc
|
|
|
|
|
*/
|
|
|
|
|
isMobile () {
|
|
|
|
|
return this.$store.state.app.isMobile
|
|
|
|
|
},
|
|
|
|
|
/**
|
2024-07-08 19:42:48 +08:00
|
|
|
|
* @description: 已付款 已接单 未发起退款 订单列表
|
2023-09-20 21:33:11 +08:00
|
|
|
|
*/
|
|
|
|
|
questList () {
|
|
|
|
|
const plane = this.plane
|
2024-07-08 19:42:48 +08:00
|
|
|
|
return plane ? this.$store.state.paidOrderList.filter((item) => item.shop_id === plane.shop_id && item.shipment_status === '已接单' && item.refund_status !== '申请中') : []
|
2023-09-20 21:33:11 +08:00
|
|
|
|
},
|
|
|
|
|
/**
|
2024-06-04 18:12:32 +08:00
|
|
|
|
* @description: 已发货 订单列表
|
2023-09-20 21:33:11 +08:00
|
|
|
|
*/
|
2024-07-11 20:29:12 +08:00
|
|
|
|
ShippedList () {
|
|
|
|
|
const plane = this.plane
|
|
|
|
|
return plane ? this.$store.state.paidOrderList.filter((item) => item.shop_id === plane.shop_id && item.shipment_status === '已发货') : []
|
2023-09-20 21:33:11 +08:00
|
|
|
|
},
|
2024-06-18 16:24:50 +08:00
|
|
|
|
/**
|
2024-07-12 19:37:29 +08:00
|
|
|
|
* @description: 当前选框 中的订单
|
2024-06-18 16:24:50 +08:00
|
|
|
|
*/
|
|
|
|
|
currentOrder () {
|
|
|
|
|
if (this.questForm && this.questForm.id !== undefined) {
|
|
|
|
|
return this.questList.find((item) => item.id === this.questForm.id) || null
|
|
|
|
|
}
|
|
|
|
|
return null
|
|
|
|
|
},
|
2024-07-12 19:37:29 +08:00
|
|
|
|
/**
|
2024-07-13 22:29:33 +08:00
|
|
|
|
* @description: 正在执行的订单 没有未null 代表飞机空闲
|
2024-07-12 19:37:29 +08:00
|
|
|
|
*/
|
|
|
|
|
executeOrder () {
|
|
|
|
|
const plane = this.plane
|
2024-07-13 22:29:33 +08:00
|
|
|
|
if (plane) {
|
|
|
|
|
const order = this.ShippedList.find((item) => item.by_plane_id === plane.id)
|
|
|
|
|
return order && Object.keys(order).length === 0 ? null : order || null
|
|
|
|
|
}
|
|
|
|
|
return null
|
2024-07-12 19:37:29 +08:00
|
|
|
|
},
|
2024-07-29 21:11:31 +08:00
|
|
|
|
/**
|
|
|
|
|
* @description: 是否已经发货
|
|
|
|
|
*/
|
|
|
|
|
isShipped () {
|
|
|
|
|
if (this.executeOrder) {
|
|
|
|
|
return this.executeOrder.shipment_status === '已发货'
|
|
|
|
|
}
|
|
|
|
|
return false
|
|
|
|
|
},
|
2023-09-20 21:33:11 +08:00
|
|
|
|
/**
|
|
|
|
|
* @description: 航线列表
|
|
|
|
|
*/
|
|
|
|
|
routeList () {
|
|
|
|
|
return this.$store.state.routeList
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* @description: 获取站点列表
|
|
|
|
|
*/
|
|
|
|
|
siteList () {
|
|
|
|
|
return this.$store.state.siteList
|
2024-08-20 20:53:35 +08:00
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* @description: 磁罗盘校准进度
|
|
|
|
|
*/
|
|
|
|
|
completionPct () {
|
2024-08-30 18:50:58 +08:00
|
|
|
|
if (this.plane && this.plane.planeState && this.plane.planeState.completionPct) {
|
2024-08-20 20:53:35 +08:00
|
|
|
|
return Number(this.plane.planeState.completionPct)
|
|
|
|
|
}
|
2024-08-30 18:50:58 +08:00
|
|
|
|
return 0
|
2024-08-20 20:53:35 +08:00
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* @description: 磁罗盘校准结果
|
|
|
|
|
*/
|
|
|
|
|
reportCal () {
|
2024-08-30 18:50:58 +08:00
|
|
|
|
if (this.plane && this.plane.planeState && this.plane.planeState.reportCal) {
|
2024-08-20 20:53:35 +08:00
|
|
|
|
return this.plane.planeState.reportCal
|
|
|
|
|
}
|
|
|
|
|
return null
|
2024-08-30 16:03:58 +08:00
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* @description:加速度计 状态
|
|
|
|
|
*/
|
|
|
|
|
acceState () {
|
|
|
|
|
if (this.plane && this.plane.planeState && this.plane.planeState.acceState) {
|
|
|
|
|
return this.plane.planeState.acceState
|
|
|
|
|
}
|
2024-08-30 18:50:58 +08:00
|
|
|
|
return null
|
2024-10-12 20:19:59 +08:00
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* @description: 从飞控获取的参数键值对
|
|
|
|
|
*/
|
|
|
|
|
parameterValue () {
|
|
|
|
|
if (this.plane && this.plane.planeState && this.plane.planeState.parameterValue) {
|
|
|
|
|
return this.plane.planeState.parameterValue
|
|
|
|
|
}
|
|
|
|
|
return null
|
2023-09-20 21:33:11 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
2024-06-14 20:51:33 +08:00
|
|
|
|
speakText,
|
2024-08-20 20:53:35 +08:00
|
|
|
|
/**
|
|
|
|
|
*关闭磁盘校准弹出窗口
|
|
|
|
|
*/
|
|
|
|
|
handlerCloseCompassBox () {
|
|
|
|
|
this.dialogVisible = false
|
2024-08-30 18:50:58 +08:00
|
|
|
|
// 磁罗盘校准进度 校准结果 重置
|
2024-08-20 20:53:35 +08:00
|
|
|
|
this.plane.planeState.reportCal = null
|
2024-08-30 18:50:58 +08:00
|
|
|
|
this.plane.planeState.completionPct = 0
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
*关闭磁盘校准弹出窗口
|
|
|
|
|
*/
|
|
|
|
|
handlerCloseAcceBox () {
|
|
|
|
|
this.dialogVisible = false
|
|
|
|
|
// 加速度计校准状态 重置
|
|
|
|
|
this.plane.planeState.acceState = null
|
2024-08-20 20:53:35 +08:00
|
|
|
|
},
|
2024-08-30 16:03:58 +08:00
|
|
|
|
/** 弹出框 关闭事件回调 */
|
|
|
|
|
closeCallback () {
|
2024-08-30 18:50:58 +08:00
|
|
|
|
if (this.dialogItem === 'compassBox') { this.handlerCloseCompassBox() } else if (this.dialogItem === 'acceBox') { this.handlerCloseAcceBox() }
|
|
|
|
|
},
|
|
|
|
|
/** 弹出框 打开事件回调 */
|
|
|
|
|
openCallback () {
|
|
|
|
|
if (this.dialogItem === 'compassBox') { this.plane.planeState.reportCal = null }// 如果是校准磁罗盘 先重置校准结果
|
2024-08-30 16:03:58 +08:00
|
|
|
|
},
|
2023-10-18 15:58:44 +08:00
|
|
|
|
/**
|
|
|
|
|
* @description: 摄像头 滑动条松开
|
|
|
|
|
* @param {string} item 项目
|
|
|
|
|
*/
|
|
|
|
|
releaseCameraSlider (item) {
|
|
|
|
|
if (item === 'pitch') {
|
|
|
|
|
this.pitchValue = 50
|
|
|
|
|
this.publishFun('{cameraController:{item:2,val:0,yaw:0,pitch:0}}')
|
|
|
|
|
} else if (item === 'yaw') {
|
|
|
|
|
this.yawValue = 50
|
|
|
|
|
this.publishFun('{cameraController:{item:2,val:0,yaw:0,pitch:0}}')
|
|
|
|
|
} else if (item === 'scale') {
|
|
|
|
|
this.publishFun('{cameraController:{item:1,val:0}}')
|
|
|
|
|
this.scaleValue = 50
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* @description: 摄像头 滑动条滚动 发送设置命令
|
|
|
|
|
* @param {*} item 项目
|
|
|
|
|
*/
|
|
|
|
|
setCamera (item) {
|
|
|
|
|
if (item === 'pitch') { // 设置pitch轴
|
|
|
|
|
const pitchV = (this.pitchValue - 50) * 2
|
|
|
|
|
this.publishFun(`{cameraController:{item:2,yaw:0,pitch:${pitchV}}`)
|
|
|
|
|
} else if (item === 'yaw') { // 设置yaw轴
|
|
|
|
|
const yawV = (this.yawValue - 50) * 2
|
|
|
|
|
this.publishFun(`{cameraController:{item:2,yaw:${yawV},pitch:0}`)
|
|
|
|
|
} else if (item === 'scale') {
|
|
|
|
|
if (this.scaleValue < 50) { // 焦距放大
|
|
|
|
|
this.publishFun('{cameraController:{item:1,val:1}}')
|
|
|
|
|
} else if (this.scaleValue > 50) {
|
|
|
|
|
this.publishFun('{cameraController:{item:1,val:255}}')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2023-09-20 21:33:11 +08:00
|
|
|
|
/**
|
|
|
|
|
* @description: 菜单切换 PS:UI
|
|
|
|
|
* @param {*} index 序号
|
2024-06-17 14:42:40 +08:00
|
|
|
|
* @param {*} voice 播放声音的文本
|
2023-09-20 21:33:11 +08:00
|
|
|
|
*/
|
2024-06-17 14:42:40 +08:00
|
|
|
|
toggleContent (index, voice) {
|
2023-09-20 21:33:11 +08:00
|
|
|
|
this.activeIndex = this.activeIndex === index ? null : index
|
|
|
|
|
if (this.tabIsOpen) {
|
|
|
|
|
if (index !== this.activeIndex) {
|
|
|
|
|
this.tabIsOpen = false
|
2024-07-23 20:40:42 +08:00
|
|
|
|
this.$emit('mapXOffset', 0, -200)
|
2024-06-17 14:42:40 +08:00
|
|
|
|
} else {
|
|
|
|
|
this.speakText(voice)
|
2023-09-20 21:33:11 +08:00
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
this.tabIsOpen = true
|
2024-07-23 20:40:42 +08:00
|
|
|
|
this.$emit('mapXOffset', 0, 200)
|
2024-06-17 14:42:40 +08:00
|
|
|
|
this.speakText(voice)
|
2023-09-20 21:33:11 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* @description: 发布 mqtt 信息
|
2024-09-02 17:50:58 +08:00
|
|
|
|
* @param {*} jsonData {'item':val} // item: questAss飞行航点任务 setQuestState 设置飞机状态 resetQuestState设置飞机初始状态 chan1油门通道1 chan2油门通道2 chan3油门通道3 chan4油门通道4 hookConteroller钩子控制 cameraController云台相机控制
|
2023-09-20 21:33:11 +08:00
|
|
|
|
*/
|
|
|
|
|
publishFun (jsonData) {
|
|
|
|
|
if (this.plane) {
|
2024-07-20 18:38:44 +08:00
|
|
|
|
mqtt.publishFun(`cmd/${this.plane.macadd}`, jsonData)
|
2023-09-20 21:33:11 +08:00
|
|
|
|
} else {
|
|
|
|
|
this.$message.warning('与飞机通信未接通,请稍后')
|
|
|
|
|
}
|
|
|
|
|
},
|
2025-05-21 16:19:35 +08:00
|
|
|
|
/**
|
|
|
|
|
* @description: 控制飞机上的喇叭播放语音
|
|
|
|
|
* @param {*} val 播放文本
|
|
|
|
|
* @param {*} vol 播放音量 默认音量为1声音最小 范围1-9
|
|
|
|
|
*/
|
|
|
|
|
playText (val, vol = 1) {
|
|
|
|
|
const jsonData = {
|
|
|
|
|
playText: {
|
|
|
|
|
val: val,
|
|
|
|
|
vol: parseInt(vol)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.publishFun(JSON.stringify(jsonData))
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* @description: 监听重量传感器是否归零,8秒内 loadweight 进入±60 范围则语音播报
|
|
|
|
|
*/
|
|
|
|
|
pesoIsZero () {
|
|
|
|
|
const timeout = 8000 // 最大监听时间 8 秒
|
|
|
|
|
const interval = 200 // 轮询间隔 200ms
|
|
|
|
|
const threshold = 60 // 正负60以内
|
|
|
|
|
let elapsed = 0
|
|
|
|
|
|
|
|
|
|
const checkInterval = setInterval(() => {
|
|
|
|
|
if (!this.plane || !this.plane.planeState) return
|
|
|
|
|
|
|
|
|
|
const weight = Number(this.plane.planeState.loadweight)
|
|
|
|
|
if (Math.abs(weight) <= threshold) {
|
|
|
|
|
this.playText('重量传感器已归零')
|
|
|
|
|
this.speakText('重量传感器已归零')
|
|
|
|
|
clearInterval(checkInterval) // 停止监听
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
elapsed += interval
|
|
|
|
|
if (elapsed >= timeout) {
|
|
|
|
|
clearInterval(checkInterval) // 超时后停止监听
|
|
|
|
|
}
|
|
|
|
|
}, interval)
|
|
|
|
|
},
|
2024-06-18 16:24:50 +08:00
|
|
|
|
/**
|
2024-08-07 18:02:33 +08:00
|
|
|
|
* @description: 执行任务前 先检测订单是否合法,例如:订单重量会不会超出飞机载重上限
|
|
|
|
|
*/
|
2024-06-18 16:24:50 +08:00
|
|
|
|
checkQuest () {
|
2024-07-29 03:04:29 +08:00
|
|
|
|
let checkOrder // 要检查的订单
|
|
|
|
|
// 如果有正在执行的订单,检查正在执行的;否则检查当前选中的订单
|
2024-07-13 22:29:33 +08:00
|
|
|
|
if (this.executeOrder) {
|
|
|
|
|
checkOrder = this.executeOrder
|
|
|
|
|
} else {
|
|
|
|
|
checkOrder = this.currentOrder
|
|
|
|
|
}
|
2024-07-29 03:04:29 +08:00
|
|
|
|
|
|
|
|
|
// 检查是否选择了订单
|
2024-07-13 22:29:33 +08:00
|
|
|
|
if (this.questForm.id === '' && !checkOrder) {
|
2024-07-12 19:58:51 +08:00
|
|
|
|
this.$message.error('未选择订单任务!')
|
|
|
|
|
return
|
|
|
|
|
}
|
2024-07-29 03:04:29 +08:00
|
|
|
|
|
|
|
|
|
// 检查订单是否在退款状态
|
2024-07-13 22:29:33 +08:00
|
|
|
|
if (checkOrder.refund_status === '申请中') {
|
2024-07-10 14:11:51 +08:00
|
|
|
|
this.$message.error('此订单已被申请退款或者订单已经被取消!')
|
|
|
|
|
return
|
|
|
|
|
}
|
2024-07-29 03:04:29 +08:00
|
|
|
|
|
|
|
|
|
// 检查站点是否已经绑定任务航点
|
2024-07-13 22:29:33 +08:00
|
|
|
|
if (checkOrder.bind_route === null) {
|
2024-07-10 14:11:51 +08:00
|
|
|
|
this.$message.error('此站点,未绑定任务航点')
|
|
|
|
|
return
|
|
|
|
|
}
|
2024-07-13 22:29:33 +08:00
|
|
|
|
|
2024-07-29 03:04:29 +08:00
|
|
|
|
// 如果有正在执行的订单,直接调用重新提交
|
2024-07-13 22:29:33 +08:00
|
|
|
|
if (this.executeOrder) {
|
|
|
|
|
this.continueQuest()
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-29 03:04:29 +08:00
|
|
|
|
/* 综合检查,针对新提交订单 */
|
|
|
|
|
// 飞机载重上限检查
|
2024-07-13 22:29:33 +08:00
|
|
|
|
const weightCheck = new Promise((resolve, reject) => {
|
|
|
|
|
if (Number(checkOrder.total_weight) >= Number(this.plane.weight_max)) {
|
2024-07-29 03:04:29 +08:00
|
|
|
|
// 如果订单总重超出飞机载重上限,显示确认弹窗
|
2024-07-13 22:29:33 +08:00
|
|
|
|
this.$confirm('此订单总重超出本飞机的载重上限', '检测订单', {
|
|
|
|
|
confirmButtonText: '继续',
|
|
|
|
|
cancelButtonText: '放弃',
|
|
|
|
|
type: 'warning'
|
2024-06-18 16:24:50 +08:00
|
|
|
|
})
|
2024-07-13 22:29:33 +08:00
|
|
|
|
.then(() => {
|
2024-07-29 03:04:29 +08:00
|
|
|
|
resolve() // 用户选择继续
|
2024-06-18 16:24:50 +08:00
|
|
|
|
})
|
2024-07-29 03:04:29 +08:00
|
|
|
|
.catch(() => {
|
2024-07-13 22:29:33 +08:00
|
|
|
|
this.$message({
|
|
|
|
|
type: 'info',
|
|
|
|
|
message: '取消提交订单'
|
|
|
|
|
})
|
2024-07-29 03:04:29 +08:00
|
|
|
|
reject(new Error('Weight check failed')) // 用户取消操作
|
2024-07-08 19:42:48 +08:00
|
|
|
|
})
|
2024-07-13 22:29:33 +08:00
|
|
|
|
} else {
|
2024-07-29 03:04:29 +08:00
|
|
|
|
resolve() // 如果重量没有超出限制,直接通过检查
|
2024-07-13 22:29:33 +08:00
|
|
|
|
}
|
|
|
|
|
})
|
2024-07-29 03:04:29 +08:00
|
|
|
|
|
2024-07-13 22:29:33 +08:00
|
|
|
|
// 检查站点是否有飞机正在执行
|
2024-07-29 03:04:29 +08:00
|
|
|
|
const runningCheck = weightCheck.then(() => {
|
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
|
if ((checkOrder.runing ?? '').split(',').some(item => item !== '')) {
|
|
|
|
|
// 如果站点已经有飞机在执行任务,显示确认弹窗
|
|
|
|
|
this.$confirm('此订单的目标站点,已经有飞机正在执行任务。请注意安全!', '检测订单', {
|
|
|
|
|
confirmButtonText: '继续',
|
|
|
|
|
cancelButtonText: '放弃',
|
|
|
|
|
type: 'warning'
|
2024-07-13 22:29:33 +08:00
|
|
|
|
})
|
2024-07-29 03:04:29 +08:00
|
|
|
|
.then(() => {
|
|
|
|
|
resolve() // 用户选择继续
|
2024-07-13 22:29:33 +08:00
|
|
|
|
})
|
2024-07-29 03:04:29 +08:00
|
|
|
|
.catch(() => {
|
|
|
|
|
this.$message({
|
|
|
|
|
type: 'info',
|
|
|
|
|
message: '取消提交订单'
|
|
|
|
|
})
|
|
|
|
|
reject(new Error('Running check failed')) // 用户取消操作
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
resolve() // 如果没有飞机正在执行任务,直接通过检查
|
|
|
|
|
}
|
|
|
|
|
})
|
2024-07-13 22:29:33 +08:00
|
|
|
|
})
|
2024-07-29 03:04:29 +08:00
|
|
|
|
|
|
|
|
|
// 选择订单检查并执行任务
|
|
|
|
|
runningCheck
|
2024-07-13 22:29:33 +08:00
|
|
|
|
.then(() => {
|
2024-07-29 03:04:29 +08:00
|
|
|
|
this.runQuest() // 如果所有检查通过,执行任务
|
2024-07-13 22:29:33 +08:00
|
|
|
|
})
|
|
|
|
|
.catch((error) => {
|
2024-07-29 03:04:29 +08:00
|
|
|
|
console.log(error.message) // 处理检查失败的情况
|
2024-07-13 22:29:33 +08:00
|
|
|
|
})
|
|
|
|
|
},
|
2024-09-19 11:39:00 +08:00
|
|
|
|
/** 等待上传完航点之后 解锁飞机 */
|
|
|
|
|
watchUnlock () {
|
|
|
|
|
// 使用 Vue 的 $watch 方法监听 planeState.questState 的变化
|
|
|
|
|
const unwatch = this.$watch(() => this.plane.planeState.questState, (newVal) => {
|
|
|
|
|
if (Number(newVal) === 4) { // 如果 questState 变为 4
|
|
|
|
|
this.publishFun('{unlock:1}') // 解锁飞机
|
|
|
|
|
unwatch() // 解除监听,防止多次触发
|
|
|
|
|
}
|
|
|
|
|
})
|
2024-09-13 16:33:39 +08:00
|
|
|
|
},
|
2024-07-13 22:29:33 +08:00
|
|
|
|
/**
|
|
|
|
|
* @description: 正在执行的任务 重新上传航线
|
|
|
|
|
*/
|
|
|
|
|
continueQuest () {
|
|
|
|
|
/* 执行写在这里 */
|
|
|
|
|
let routeData // 航线数据内容
|
|
|
|
|
try {
|
|
|
|
|
/* 航线选择 */
|
|
|
|
|
const bindRoute = (this.executeOrder.bind_route ?? '').split(',')
|
|
|
|
|
const runing = (this.executeOrder.runing ?? '').split(',')
|
|
|
|
|
const matchingIndex = runing
|
|
|
|
|
.map((route, index) => route === this.executeOrder.by_plane_id ? index : -1)
|
|
|
|
|
.filter(index => index !== -1)// 找到注册飞机与绑定航线对应索引
|
|
|
|
|
routeData = this.routeList.find(element => element.id === bindRoute[matchingIndex]).route_data
|
|
|
|
|
routeData = JSON.parse(routeData)// 反序列化
|
|
|
|
|
// 处理声音航点 航点里面的表达式 如$food_sn$ 正则替换成订单对应的字段
|
|
|
|
|
this.executeOrder.telTail = this.executeOrder.tel.substr(-4)// 手动加一个手机尾号telTail字段 从 tel字段截取后四位
|
|
|
|
|
routeData.questAss.tasks.forEach((x, index) => {
|
|
|
|
|
if (x.sound) {
|
|
|
|
|
const str = this.voiceRouteParse(this.executeOrder, x.sound)
|
|
|
|
|
routeData.questAss.tasks[index].sound = str// 重新写入声音航点
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
routeData = JSON.stringify(routeData)// 重新序列化
|
2024-09-19 11:39:00 +08:00
|
|
|
|
this.publishFun(routeData) // 发送航点信息主题
|
|
|
|
|
this.watchUnlock()// 等待飞机写完航点 解锁飞机
|
2024-07-13 22:29:33 +08:00
|
|
|
|
} catch (error) {
|
|
|
|
|
this.$message.error('操作失败,航线异常')
|
2024-06-18 16:24:50 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
2023-09-20 21:33:11 +08:00
|
|
|
|
/**
|
2024-07-13 22:29:33 +08:00
|
|
|
|
* @description: 选择订单的 执行订单任务 ps:改变订单状态 站点runing状态 上传航线
|
2023-09-20 21:33:11 +08:00
|
|
|
|
*/
|
2024-07-10 23:41:18 +08:00
|
|
|
|
async runQuest () {
|
2024-07-10 14:11:51 +08:00
|
|
|
|
/* 插入日志 */
|
|
|
|
|
this.$store.dispatch('fetchLog', { content: `${this.plane.name} 开始执行 订单ID:${this.currentOrder.id}、叫餐号:${this.currentOrder.food_sn}号。` })
|
|
|
|
|
/* 执行写在这里 */
|
|
|
|
|
let routeData // 航线数据内容
|
|
|
|
|
let newRuning // 执行飞机注册后的 running字段信息
|
|
|
|
|
try {
|
|
|
|
|
/* 站点正在执行任务runing 注册 */
|
2024-07-12 03:10:50 +08:00
|
|
|
|
const runing = (this.currentOrder.runing ?? '').split(',')
|
2024-07-10 14:11:51 +08:00
|
|
|
|
let foundEmpty = false
|
2024-07-13 22:29:33 +08:00
|
|
|
|
let matchingIndex // 记录执行飞机注册的索引 此索引对应要使用的航线的索引
|
2024-07-12 06:16:26 +08:00
|
|
|
|
|
2024-07-10 14:11:51 +08:00
|
|
|
|
runing.some((item, index, arr) => {
|
|
|
|
|
if (item === '') {
|
2024-07-11 13:52:41 +08:00
|
|
|
|
arr[index] = this.plane.id
|
2024-07-10 14:11:51 +08:00
|
|
|
|
foundEmpty = true
|
2024-07-13 22:29:33 +08:00
|
|
|
|
matchingIndex = index
|
2024-07-10 14:11:51 +08:00
|
|
|
|
return true // 找到空位后退出循环
|
2024-07-09 21:55:00 +08:00
|
|
|
|
}
|
2024-07-10 14:11:51 +08:00
|
|
|
|
})
|
2024-07-12 06:16:26 +08:00
|
|
|
|
|
2024-07-10 14:11:51 +08:00
|
|
|
|
newRuning = runing.join(',')
|
|
|
|
|
if (!foundEmpty) {
|
|
|
|
|
this.$message({
|
|
|
|
|
type: 'warning',
|
2024-07-10 23:41:18 +08:00
|
|
|
|
message: '此站点所有航线均被占用,等航线空闲再试!'
|
2024-06-18 16:24:50 +08:00
|
|
|
|
})
|
2024-07-10 14:11:51 +08:00
|
|
|
|
return // 退出外层函数
|
2024-06-18 16:24:50 +08:00
|
|
|
|
}
|
2024-07-10 14:11:51 +08:00
|
|
|
|
/* 航线选择 */
|
2024-07-12 03:10:50 +08:00
|
|
|
|
const bindRoute = (this.currentOrder.bind_route ?? '').split(',')
|
2024-07-13 22:29:33 +08:00
|
|
|
|
routeData = this.routeList.find(element => element.id === bindRoute[matchingIndex]).route_data
|
2024-07-10 14:11:51 +08:00
|
|
|
|
routeData = JSON.parse(routeData)// 反序列化
|
|
|
|
|
// 处理声音航点 航点里面的表达式 如$food_sn$ 正则替换成订单对应的字段
|
|
|
|
|
this.currentOrder.telTail = this.currentOrder.tel.substr(-4)// 手动加一个手机尾号telTail字段 从 tel字段截取后四位
|
2024-07-10 23:41:18 +08:00
|
|
|
|
routeData.questAss.tasks.forEach((x, index) => {
|
2024-07-10 14:11:51 +08:00
|
|
|
|
if (x.sound) {
|
|
|
|
|
const str = this.voiceRouteParse(this.currentOrder, x.sound)
|
2024-07-10 23:41:18 +08:00
|
|
|
|
routeData.questAss.tasks[index].sound = str// 重新写入声音航点
|
2024-07-10 14:11:51 +08:00
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
routeData = JSON.stringify(routeData)// 重新序列化
|
|
|
|
|
} catch (error) {
|
2024-07-10 23:41:18 +08:00
|
|
|
|
this.$message.error('操作失败,航线异常')
|
|
|
|
|
return
|
|
|
|
|
}
|
2024-07-29 03:04:29 +08:00
|
|
|
|
// 站点表 和 订单表 同时修改 没问题 向飞机提交航点
|
|
|
|
|
const res = await lockSite({
|
|
|
|
|
site_id: this.currentOrder.receive_site_id,
|
|
|
|
|
shop_id: this.plane.shop_id,
|
|
|
|
|
runing: newRuning,
|
|
|
|
|
order_id: this.currentOrder.id,
|
|
|
|
|
shipment_status: '已发货',
|
|
|
|
|
by_plane_id: this.plane.id
|
|
|
|
|
})
|
2024-07-10 23:41:18 +08:00
|
|
|
|
if (res.data.status === 1) {
|
2024-07-29 03:04:29 +08:00
|
|
|
|
this.publishFun(routeData)// 发送航点信息主题
|
2024-09-19 11:39:00 +08:00
|
|
|
|
this.watchUnlock()// 等待飞机写完航点 解锁飞机
|
2024-06-18 16:24:50 +08:00
|
|
|
|
}
|
2023-09-20 21:33:11 +08:00
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* @description: 匹配声音航点字符串 比如$food_sn$ food_sn匹配成 送餐订单里面的对应字段
|
|
|
|
|
* @param {*} questItem 送餐的订单 ps:从数据库里拿的 订单信息对象
|
|
|
|
|
* @param {*} voiceRouteStr 声音航点的字符串
|
|
|
|
|
*/
|
|
|
|
|
voiceRouteParse (questItem, voiceRouteStr) {
|
|
|
|
|
// 定义正则表达式
|
|
|
|
|
const regex = /\$(.*?)\$/g
|
|
|
|
|
// 使用replace()方法进行匹配和替换
|
|
|
|
|
const replacedStr = voiceRouteStr.replace(regex, (match, p1) => {
|
|
|
|
|
// match表示匹配到的字符串,p1表示捕获组中的内容
|
|
|
|
|
return questItem[p1] // 用捕获组的内容替换匹配到的字符串
|
|
|
|
|
})
|
|
|
|
|
// 输出替换后的字符串
|
|
|
|
|
return replacedStr // 输出 "请45号电话为13301115846的先生取餐"
|
|
|
|
|
},
|
2023-10-18 15:58:44 +08:00
|
|
|
|
/**
|
|
|
|
|
* @description: 确认操作
|
|
|
|
|
* @param {*}msg 提示的话语内容
|
|
|
|
|
* @param {*}tit 提示框的标题
|
|
|
|
|
* @param {*}instruct 需要发送的mqtt指令内容
|
|
|
|
|
*/
|
|
|
|
|
confirmation (msg, tit, instruct) {
|
|
|
|
|
this.$confirm(msg, tit, {
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
}).then(() => {
|
|
|
|
|
this.publishFun(instruct)
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
this.$message.info('取消操作!')
|
|
|
|
|
})
|
|
|
|
|
},
|
2023-09-20 21:33:11 +08:00
|
|
|
|
/**
|
|
|
|
|
* @description: 取消任务
|
|
|
|
|
*/
|
2024-07-29 03:04:29 +08:00
|
|
|
|
async reQuest () {
|
2024-07-13 22:29:33 +08:00
|
|
|
|
if (!this.executeOrder) { // 只有飞机锁定状态 才向下执行 "取消"操作
|
2024-07-11 20:29:12 +08:00
|
|
|
|
this.$message.warning('当前没有执行任务')
|
2023-09-20 21:33:11 +08:00
|
|
|
|
return
|
|
|
|
|
}
|
2024-07-29 03:04:29 +08:00
|
|
|
|
try {
|
2024-08-07 18:02:33 +08:00
|
|
|
|
const confirmation = await this.$confirm('确认货物未送达,取消已发货状态,并使飞机复位?', '提示', {
|
2024-07-29 03:04:29 +08:00
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
if (confirmation) {
|
|
|
|
|
// 分割字符串成数组
|
|
|
|
|
const runingArray = this.executeOrder.runing.split(',')
|
|
|
|
|
// 遍历数组并替换相等的值
|
|
|
|
|
for (let i = 0; i < runingArray.length; i++) {
|
|
|
|
|
if (runingArray[i] === this.executeOrder.by_plane_id) {
|
|
|
|
|
runingArray[i] = ''
|
|
|
|
|
}
|
2024-07-13 22:29:33 +08:00
|
|
|
|
}
|
2024-07-29 03:04:29 +08:00
|
|
|
|
// 将数组重新组合成字符串
|
|
|
|
|
const newRuning = runingArray.join(',')
|
|
|
|
|
// 站点表 和 订单表 同时修改 没问题 让飞机状态复位
|
|
|
|
|
const res = await lockSite({
|
|
|
|
|
site_id: this.executeOrder.receive_site_id,
|
|
|
|
|
shop_id: this.plane.shop_id,
|
|
|
|
|
runing: newRuning,
|
|
|
|
|
order_id: this.executeOrder.id,
|
|
|
|
|
shipment_status: '已接单',
|
|
|
|
|
by_plane_id: 'null'
|
|
|
|
|
})
|
|
|
|
|
|
2024-07-13 22:29:33 +08:00
|
|
|
|
if (res.data.status === 1) {
|
2024-09-02 17:50:58 +08:00
|
|
|
|
this.publishFun('{"resetQuestState":1}') // 发送设置飞机状态主题 状态设为闲置
|
2024-07-13 22:29:33 +08:00
|
|
|
|
}
|
2024-07-29 03:04:29 +08:00
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
2023-09-20 21:33:11 +08:00
|
|
|
|
this.$message.info('取消操作!')
|
2024-07-29 03:04:29 +08:00
|
|
|
|
}
|
2023-09-20 21:33:11 +08:00
|
|
|
|
},
|
|
|
|
|
/**
|
2024-07-29 03:04:29 +08:00
|
|
|
|
* @description: 已送达任务
|
|
|
|
|
*/
|
|
|
|
|
async overQuest () {
|
|
|
|
|
if (!this.executeOrder) {
|
2024-07-11 20:29:12 +08:00
|
|
|
|
this.$message.warning('当前没有执行任务')
|
2023-09-20 21:33:11 +08:00
|
|
|
|
return
|
|
|
|
|
}
|
2024-07-29 03:04:29 +08:00
|
|
|
|
|
|
|
|
|
try {
|
2024-08-07 18:02:33 +08:00
|
|
|
|
const confirmation = await this.$confirm('确认货物已送达?', '提示', {
|
2024-07-29 03:04:29 +08:00
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
type: 'warning'
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
if (confirmation) {
|
|
|
|
|
// 分割字符串成数组
|
|
|
|
|
const runingArray = this.executeOrder.runing.split(',')
|
|
|
|
|
// 遍历数组并替换相等的值
|
|
|
|
|
for (let i = 0; i < runingArray.length; i++) {
|
|
|
|
|
if (runingArray[i] === this.executeOrder.by_plane_id) {
|
|
|
|
|
runingArray[i] = ''
|
|
|
|
|
}
|
2024-07-13 22:35:44 +08:00
|
|
|
|
}
|
2024-07-29 03:04:29 +08:00
|
|
|
|
// 将数组重新组合成字符串
|
|
|
|
|
const newRuning = runingArray.join(',')
|
|
|
|
|
|
|
|
|
|
// 站点表 和 订单表 同时修改 没问题 让飞机状态复位
|
|
|
|
|
const res = await lockSite({
|
|
|
|
|
site_id: this.executeOrder.receive_site_id,
|
|
|
|
|
shop_id: this.plane.shop_id,
|
|
|
|
|
runing: newRuning,
|
|
|
|
|
order_id: this.executeOrder.id,
|
|
|
|
|
shipment_status: '已送达',
|
|
|
|
|
by_plane_id: this.plane.id
|
|
|
|
|
})
|
|
|
|
|
|
2024-07-13 22:35:44 +08:00
|
|
|
|
if (res.data.status === 1) {
|
2024-09-02 17:50:58 +08:00
|
|
|
|
this.publishFun('{"resetQuestState":1}') // 发送设置飞机状态主题 状态设为闲置
|
2024-07-13 22:35:44 +08:00
|
|
|
|
}
|
2024-07-29 03:04:29 +08:00
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('Confirmation dialog error:', error)
|
2023-09-20 21:33:11 +08:00
|
|
|
|
this.$message.info('取消操作!')
|
2024-07-29 03:04:29 +08:00
|
|
|
|
}
|
2023-09-20 21:33:11 +08:00
|
|
|
|
},
|
|
|
|
|
/**
|
2024-07-09 22:04:17 +08:00
|
|
|
|
* @description: 在地图上绘制航线
|
|
|
|
|
*/
|
2023-09-20 21:33:11 +08:00
|
|
|
|
makeRouteForMap () {
|
|
|
|
|
let bindRoute
|
|
|
|
|
let routeData
|
2024-07-09 21:55:00 +08:00
|
|
|
|
let found = false
|
|
|
|
|
this.siteList.some(item => {
|
2024-07-12 03:10:50 +08:00
|
|
|
|
const runing = (item.runing ?? '').split(',')
|
2024-07-11 13:52:41 +08:00
|
|
|
|
const index = runing.indexOf(this.plane.id.toString())
|
2024-07-09 22:04:17 +08:00
|
|
|
|
if (index !== -1) {
|
2024-07-09 21:55:00 +08:00
|
|
|
|
found = true
|
2023-09-20 21:33:11 +08:00
|
|
|
|
// 获取航点信息
|
|
|
|
|
if (item.bind_route !== null) { // 判断站点是否已经绑定站点
|
2024-07-12 03:10:50 +08:00
|
|
|
|
bindRoute = (item.bind_route ?? '').split(',')
|
2023-09-20 21:33:11 +08:00
|
|
|
|
this.$store.dispatch('fetchRouteList').then(res => { // 只能异步拿 虽然效率低一些
|
2024-07-09 22:04:17 +08:00
|
|
|
|
routeData = res.find(element => element.id === bindRoute[index]).route_data
|
2023-09-20 21:33:11 +08:00
|
|
|
|
this.$emit('makeRoute', JSON.parse(routeData))
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
this.$message.error('此站点,未绑定任务航点')
|
|
|
|
|
}
|
2024-07-09 21:55:00 +08:00
|
|
|
|
return true // 找到匹配项后退出循环
|
2023-09-20 21:33:11 +08:00
|
|
|
|
}
|
2024-07-09 21:55:00 +08:00
|
|
|
|
return false // 继续循环
|
2023-09-20 21:33:11 +08:00
|
|
|
|
})
|
2024-07-09 21:55:00 +08:00
|
|
|
|
if (!found) {
|
|
|
|
|
this.$message.error('未找到匹配的站点')
|
|
|
|
|
}
|
2024-07-08 19:42:48 +08:00
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* @description: 判断 已接订单下拉框 的任务 有疑问的 坐标集 class样式显示成红色
|
|
|
|
|
* @param {*} item 对应下拉框的任务
|
|
|
|
|
*/
|
|
|
|
|
isWaring (item) {
|
2025-06-19 15:14:48 +08:00
|
|
|
|
console.error('当前飞机ID:', item.total_weight)
|
|
|
|
|
|
2024-07-08 19:42:48 +08:00
|
|
|
|
const isOverWaight = Number(item.total_weight) >= Number(this.plane.weight_max)// 是否超重
|
2024-07-12 03:10:50 +08:00
|
|
|
|
const isQuestIng = (item.runing ?? '').split(',').some(i => i !== '') // 是否有飞机正在执行
|
2024-07-08 19:42:48 +08:00
|
|
|
|
return isOverWaight || isQuestIng
|
2024-08-07 18:02:33 +08:00
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* 设置执行订单 提示标签
|
|
|
|
|
* @param order 执行订单
|
|
|
|
|
*/
|
|
|
|
|
setExecuteOrderTag (order) {
|
|
|
|
|
const aIndex = this.waringTags.indexOf('已申请退款')
|
|
|
|
|
const bIndex = this.waringTags.indexOf('已退款')
|
|
|
|
|
const cIndex = this.waringTags.indexOf('超出飞机载重')
|
|
|
|
|
const dIndex = this.waringTags.indexOf('站点多架执行')
|
|
|
|
|
// 退款提示
|
|
|
|
|
if (order.refund_status === '申请中') {
|
|
|
|
|
if (aIndex === -1) {
|
|
|
|
|
this.waringTags.push('已申请退款')
|
|
|
|
|
}
|
|
|
|
|
} else if (order.refund_status === '已同意') {
|
|
|
|
|
if (bIndex === -1) {
|
|
|
|
|
this.waringTags.push('已退款')
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (aIndex !== -1) {
|
|
|
|
|
this.waringTags.splice(aIndex, 1)
|
|
|
|
|
}
|
|
|
|
|
if (bIndex !== -1) {
|
|
|
|
|
this.waringTags.splice(bIndex, 1)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 超出飞机载重 提示
|
2024-08-08 17:57:06 +08:00
|
|
|
|
if (Number(this.plane.weight_max) < Number(order.total_weight)) {
|
2024-08-07 18:02:33 +08:00
|
|
|
|
if (cIndex === -1) {
|
|
|
|
|
this.waringTags.push('超出飞机载重')
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (cIndex !== -1) {
|
|
|
|
|
this.waringTags.splice(cIndex, 1)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 站点多飞机执行 提示
|
|
|
|
|
const splitArray = order.runing.split(',')// 分割执行任务的飞机s
|
|
|
|
|
const nonEmptyArray = splitArray.filter(item => item.trim() !== '')// 过滤掉空值
|
|
|
|
|
if (nonEmptyArray.length > 1) { // 不止一架
|
|
|
|
|
this.waringTags.push('站点多架执行')
|
|
|
|
|
} else {
|
|
|
|
|
if (dIndex !== -1) {
|
|
|
|
|
this.waringTags.splice(dIndex, 1)
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-10-12 20:19:59 +08:00
|
|
|
|
},
|
|
|
|
|
// 飞机状态参数默认值 复位
|
|
|
|
|
clearPlanePar () {
|
|
|
|
|
// 调用 Vuex 的 mutation 更新对应飞机的 parameterValue
|
|
|
|
|
this.$store.commit('updateParameterValue', { planeId: this.$route.params.id, parameterValue: '{}' })
|
2023-09-20 21:33:11 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
2024-07-20 18:38:44 +08:00
|
|
|
|
mounted () {
|
2024-07-13 22:29:33 +08:00
|
|
|
|
// 初始化
|
|
|
|
|
if (this.executeOrder) { // 有正在执行单点
|
2024-08-07 18:02:33 +08:00
|
|
|
|
// 设置提示标签
|
|
|
|
|
this.setExecuteOrderTag(this.executeOrder)
|
|
|
|
|
// 绘制地图
|
2024-08-08 18:57:11 +08:00
|
|
|
|
if (this.siteList.length > 0) {
|
|
|
|
|
this.makeRouteForMap()
|
|
|
|
|
} else {
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.makeRouteForMap()
|
|
|
|
|
}, 1000)
|
|
|
|
|
}
|
2024-07-13 22:29:33 +08:00
|
|
|
|
} else { // 没有执行订单
|
2024-07-20 18:38:44 +08:00
|
|
|
|
if (this.plane) {
|
2024-09-02 17:50:58 +08:00
|
|
|
|
this.publishFun('{"resetQuestState":1}')// 发送设置飞机状态主题 状态设为闲置
|
2024-07-20 18:38:44 +08:00
|
|
|
|
}
|
2024-07-11 17:49:36 +08:00
|
|
|
|
}
|
2023-09-20 21:33:11 +08:00
|
|
|
|
},
|
|
|
|
|
watch: {
|
2024-07-13 22:29:33 +08:00
|
|
|
|
executeOrder (val) {
|
2024-08-07 18:02:33 +08:00
|
|
|
|
if (val) {
|
|
|
|
|
/* 如果当前飞机正在执行任务 把航线绘制到地图上 */
|
2024-08-08 18:57:11 +08:00
|
|
|
|
if (this.siteList.length > 0) {
|
|
|
|
|
this.makeRouteForMap()
|
|
|
|
|
} else {
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.makeRouteForMap()
|
|
|
|
|
}, 1000)
|
|
|
|
|
}
|
2024-08-07 18:02:33 +08:00
|
|
|
|
/* 检查添加提示标签 */
|
|
|
|
|
this.setExecuteOrderTag(val)
|
|
|
|
|
} else {
|
|
|
|
|
this.$emit('clearRoute')// 如果没有执行任务 把地图上航线清除
|
2024-09-02 17:50:58 +08:00
|
|
|
|
this.publishFun('{"resetQuestState":1}')// 发送设置飞机状态主题 状态设为闲置
|
2023-09-20 21:33:11 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
2024-07-10 14:11:51 +08:00
|
|
|
|
questList (val) {
|
|
|
|
|
/* 任务列表更新时 判断还有没有当前选择的id 没有就清空 */
|
|
|
|
|
const found = val.some(item => item.id === this.questForm.id)
|
|
|
|
|
if (!found) {
|
|
|
|
|
this.questForm.id = ''
|
|
|
|
|
}
|
2024-10-12 20:19:59 +08:00
|
|
|
|
},
|
|
|
|
|
// 监听parameterValue 对比飞控更新的 参数名 和 要读取的参数名一致 把值显示出来
|
|
|
|
|
parameterValue (val) {
|
|
|
|
|
// 反序列化 JSON 字符串
|
|
|
|
|
const parsed = JSON.parse(val)
|
|
|
|
|
|
|
|
|
|
// 假设 JSON 只有一个键值对,提取参数名和值
|
|
|
|
|
const key = Object.keys(parsed)[0] // 获取键名
|
|
|
|
|
const value = parsed[key] // 获取键对应的值
|
|
|
|
|
|
|
|
|
|
// 更新 data 中的 paramName 和 paramValue
|
|
|
|
|
if (key === this.paramItem) {
|
|
|
|
|
this.paramValue = value
|
|
|
|
|
}
|
|
|
|
|
this.paramName = key
|
2023-09-20 21:33:11 +08:00
|
|
|
|
}
|
2024-07-13 22:29:33 +08:00
|
|
|
|
},
|
|
|
|
|
destroyed () {
|
2023-09-20 21:33:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
@import "@/styles/theme.scss";
|
|
|
|
|
|
2024-06-18 16:24:50 +08:00
|
|
|
|
.danger-color {
|
|
|
|
|
color: $danger-color;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-23 20:40:42 +08:00
|
|
|
|
.mainBox {
|
|
|
|
|
position: absolute;
|
2023-09-20 21:33:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-07-23 20:40:42 +08:00
|
|
|
|
.tabContainer {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
2023-09-20 21:33:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-07-23 20:40:42 +08:00
|
|
|
|
.tabContent {
|
|
|
|
|
z-index: 90;
|
|
|
|
|
position: relative;
|
|
|
|
|
width: 100%;
|
|
|
|
|
border-radius: 10px;
|
|
|
|
|
max-width: 470px;
|
|
|
|
|
background-color: rgba(255, 255, 255, 0.8);
|
|
|
|
|
box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.2);
|
|
|
|
|
top: -50px;
|
|
|
|
|
opacity: 0;
|
|
|
|
|
transition: top 0.5s ease, opacity 1s ease;
|
2023-09-20 21:33:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-07-23 20:40:42 +08:00
|
|
|
|
.tabContent.active {
|
|
|
|
|
top: -10px;
|
|
|
|
|
opacity: 1;
|
2023-10-18 15:58:44 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-07-23 20:40:42 +08:00
|
|
|
|
.tabContentBox {
|
2023-09-20 21:33:11 +08:00
|
|
|
|
padding: 20px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.contentTit i {
|
|
|
|
|
vertical-align: middle;
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-23 20:40:42 +08:00
|
|
|
|
.butIconBox {
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
/* 允许换行 */
|
|
|
|
|
justify-content: flex-start;
|
|
|
|
|
/* 主轴对齐方式 */
|
|
|
|
|
align-content: space-around;
|
|
|
|
|
/* 多行在侧轴上的对齐方式 */
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-20 21:33:11 +08:00
|
|
|
|
.butIcon {
|
|
|
|
|
border-radius: 10px;
|
|
|
|
|
text-align: center;
|
|
|
|
|
border: none;
|
2024-07-23 20:40:42 +08:00
|
|
|
|
margin-left: 0px !important;
|
2023-09-20 21:33:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-07-23 20:40:42 +08:00
|
|
|
|
.taButGroup {
|
|
|
|
|
position: relative;
|
|
|
|
|
width: 100%;
|
|
|
|
|
max-width: 470px;
|
|
|
|
|
height: 105px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
z-index: 90;
|
2023-09-20 21:33:11 +08:00
|
|
|
|
}
|
2024-07-11 17:49:36 +08:00
|
|
|
|
|
2024-07-23 20:40:42 +08:00
|
|
|
|
@media (max-width: 480px) {
|
|
|
|
|
.taButGroup {
|
|
|
|
|
height: calc((100vw - 50px)/4);
|
2024-07-11 17:49:36 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-07-26 02:15:40 +08:00
|
|
|
|
.tabContainer {
|
2024-07-23 20:40:42 +08:00
|
|
|
|
width: 100vw;
|
2024-07-11 17:49:36 +08:00
|
|
|
|
}
|
2024-07-23 20:40:42 +08:00
|
|
|
|
}
|
2024-07-11 17:49:36 +08:00
|
|
|
|
|
2024-07-23 20:40:42 +08:00
|
|
|
|
.taBut {
|
|
|
|
|
color: $maintext-color;
|
|
|
|
|
background-color: rgba(255, 255, 255, 0.5);
|
|
|
|
|
border-radius: 10px;
|
|
|
|
|
padding: 5px;
|
|
|
|
|
text-align: center;
|
|
|
|
|
box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.2);
|
|
|
|
|
}
|
2024-07-11 17:49:36 +08:00
|
|
|
|
|
2024-07-23 20:40:42 +08:00
|
|
|
|
.taButBG {
|
|
|
|
|
color: $graylight-color;
|
|
|
|
|
background-color: $brand-color;
|
|
|
|
|
}
|
2024-07-11 17:49:36 +08:00
|
|
|
|
|
2024-07-23 20:40:42 +08:00
|
|
|
|
.gap10 {
|
|
|
|
|
gap: 10px;
|
2024-07-11 17:49:36 +08:00
|
|
|
|
}
|
2023-09-20 21:33:11 +08:00
|
|
|
|
</style>
|