From 2af5f043b60c1f7ac38ecccc8f5bf44743134325 Mon Sep 17 00:00:00 2001
From: cuiqian2004 <cuiqian2004@163.com>
Date: 星期五, 12 十二月 2025 18:08:00 +0800
Subject: [PATCH] test
---
pages/map/index.vue | 712 ++++++++++++++++++++++++++---------------------------------
1 files changed, 316 insertions(+), 396 deletions(-)
diff --git a/pages/map/index.vue b/pages/map/index.vue
index 7c03354..899a0db 100644
--- a/pages/map/index.vue
+++ b/pages/map/index.vue
@@ -7,7 +7,7 @@
<view class="uni-navbar-container-inner">
<text class="uni-nav-bar-text">{{navigationBarTitle }}</text>
<image class="icon" v-if="sceneList.length > 1 && !mapOperationType" src="/images/Vector.svg"
- alt="SVG 鍥剧墖" @click="clickShowMenu" />
+ alt="SVG" @click="clickShowMenu" />
</view>
<template v-slot:left>
<view @click="clickBack">
@@ -25,13 +25,11 @@
</template> -->
</uni-nav-bar>
<view class="no-content" v-if="unlinked">
- <image class="img" src="/images/image_25.png" alt=" 鍥剧墖" mode="aspectFit" />
- <view class="title">杞﹁締杩炴帴澶辫触</view>
- <view class="space">璇锋鏌ヤ綘鐨勭綉缁滆缃垨閲嶆柊鍔犺浇</view>
+ <image class="img" src="/images/image_25.png" alt=" picture" mode="aspectFit" />
+ <view class="title">{{translate('failed_vehicle_connection')}}</view>
+ <view class="space">{{translate('check_network_or_reload')}}</view>
</view>
- <!-- <SceneCreateInfo v-else-if="mapOperationType =='scene_create'" class="map-content" :ip="vehicleIp"
- v-model:opSceneType="opSceneType" @create-ok="onCreateSceneOk"></SceneCreateInfo> -->
- <view class="map-content" v-show="mapOperationType !='scene_create'">
+ <view class="map-content">
<view class="content">
<view ref="canvasCtx" class="fabric" id="canvasMap" :message="ctxDataStr"
:change:message="ctx.receiveMsg">
@@ -39,17 +37,16 @@
<view class="loading-overlay" v-if="bgLoading">
<view class="loading-content">
<view class="loading-spinner"></view>
- <text>鍔犺浇涓�.. {{ bgProgressPercent }}%</text>
+ <text>{{translate('loading')}}... {{ bgProgressPercent }}%</text>
</view>
</view>
<view class="position-site" v-if="mapOperationStatus =='pos' " @click="clickPositionStation">
<text class="ico my-location-rounded"></text>
-
- 鑾峰彇鎼繍杞︿綅缃拰鏈濆悜
+ {{translate('obtain_positon_and_orientation_of_vehicle')}}
</view>
<view class="position" v-else @click="clickVehiclePosition">
<text class="ico my-location-rounded"></text>
- <!-- <image class="img" src="/images/material-symbols_my-location-rounded.svg" alt="SVG 鍥剧墖" /> -->
+ <!-- <image class="img" src="/images/material-symbols_my-location-rounded.svg" alt="SVG picture" /> -->
</view>
<view v-if="this.mapOperationType ==''" class="teaching-path-show"
:class="showTeachingPathFlag?'selected':''" @click="clickShowTeachingPath">
@@ -61,11 +58,11 @@
v-if="mapOperationType =='edit_station'">
<view class=" left">
- <view class="line">绔欑偣鍚嶇О锛�+ <view class="line">{{translate('station_name')}}锛� </view>
- <view class="line"> 鍧愭爣(x,y)锛�+ <view class="line"> {{translate('coordinates')}}(x,y)锛� </view>
- <view class="line">鏈濆悜锛�+ <view class="line">{{translate('angle')}}锛� </view>
</view>
@@ -85,201 +82,193 @@
</view>
</view>
<view class="bottom">
- <view class="bottom-content" v-if="mapOperationType =='edit_scene_name'">
- <view class="tip">璇疯緭鍏ュ満鏅悕绉�/view>
- <view class="name-input">
- <input ref="refInputName" :focus="true" placeholder="璇疯緭鍏ュ満鏅悕绉� :value="sceneInputName"
- @input="onInputName" />
- <uni-icons class="clear" color="#ccc" type="clear" size="20" v-if="sceneInputName"
- @click="clickClearName"></uni-icons>
- </view>
- <view class="text-button-group">
- <a-button type="primary" class="button" :disabled="loading || sceneInputName.trim() == ''"
- @click="clickNameOK">纭</a-button>
- <a-button type="ghost" class="button" :disabled="loading" @click="clickNameCancel">鍙栨秷</a-button>
- </view>
- </view>
+ <SceneRenameInfo class="bottom-content" :ip="vehicleIp" :sceneName="sceneId"
+ v-if="mapOperationType =='edit_scene_name'" @finish="onFinishRenameScene" />
+ <PalletSizeInfo class="bottom-content" v-else-if="mapOperationType =='set_pallet_size'" :ip="vehicleIp">
+ </PalletSizeInfo>
<template
v-else-if="mapOperationType =='teaching_add_station' || mapOperationType =='add_station' || mapOperationType =='edit_station'">
<view class="bottom-content" v-if="mapOperationStatus =='pos' ">
- <view class="tip">璋冭妭浣嶇疆</view>
+ <view class="tip">{{translate("adjust_position")}}</view>
<view class="row-group">
<view class="coordinate">
- <text class="name">妯潗鏍�</text>
+ <text class="name">{{translate("x_axis")}}:</text>
<input ref="refInputX" class="number-input" type="number" :value="stationEdit.x"
- @input="onInputStationX" :maxlength="4" />
+ @blur="onInputStationX" :maxlength="8" />
<uni-icons class="clear" color="#ccc" type="clear" size="20"
v-if="stationEdit.x && stationEdit.x!='0'" @click="clickClearStationX"></uni-icons>
</view>
<view class="coordinate">
- <text class="name">绔栧潗鏍�</text>
- <input ref="refInputX" class="number-input" type="number" :value="stationEdit.y"
- @input="onInputStationY" :maxlength="4" />
+ <text class="name">{{translate("y_axis")}}:</text>
+ <input ref="refInputY" class="number-input" type="number" :value="stationEdit.y"
+ @blur="onInputStationY" :maxlength="8" />
<uni-icons class="clear" color="#ccc" type="clear" size="20"
v-if="stationEdit.y&& stationEdit.y!='0'" @click="clickClearStationY"></uni-icons>
</view>
</view>
- <view class="tip">璋冭妭鏈濆悜</view>
+ <view class="tip">{{translate('adjust_orientation')}}</view>
<view class="angle-group">
- <image class="img-angle" :src="angleSvg" alt="SVG 鍥剧墖" />
- <image class="img-angle-pos" src="/images/Frame_153.svg" alt="SVG 鍥剧墖"
+ <image class="img-angle" :src="angleSvg" alt="SVG picture" />
+ <image class="img-angle-pos" src="/images/Frame_153.svg" alt="SVG picture"
@touchstart="handleAngleTouchStart" @touchmove="handleAngleTouchMove" />
</view>
</view>
<view class="bottom-content" v-else>
- <view class="tip">璇疯緭鍏ョ珯鐐瑰悕绉�/view>
+ <view class="tip">{{translate("input_station_name")}}</view>
<view class="name-input">
- <input ref="refInputName" :focus="true" placeholder="杈撳叆绔欑偣鍚嶇О" :value="stationEdit.name"
- @input="onInputStationName" />
+ <input ref="refInputName" :focus="true" :placeholder="translate('input_station_name')"
+ :value="stationEdit.name" @input="onInputStationName" />
<uni-icons class="clear" color="#ccc" type="clear" size="20" v-if="stationEdit.name"
@click="clickClearStationName"></uni-icons>
</view>
<view class="text-button-group">
- <a-button class="button" :disabled="loading" @click="clickStationNameCancel">鍙栨秷</a-button>
+ <a-button class="button" :disabled="loading"
+ @click="clickStationNameCancel">{{translate('cancel')}}</a-button>
<a-button type="primary" class="button" :disabled="loading || stationEdit.name.trim() == ''"
- @click="clickStationNameOK">纭畾</a-button>
+ @click="clickStationNameOK">{{translate('confirm')}}</a-button>
</view>
</view>
</template>
+
<view class="bottom-content" v-else-if="mapOperationType =='regiona_planning'">
<view class="img-button-group">
<view fill="none" class="button" @click="clickManualPlan">
<text class="ico conversion-path"></text>
- <view class="text">浜哄伐瑙勫垝</view>
+ <view class="text">{{translate('manual_plan')}}</view>
</view>
<view type="text" class="button " @click="clickVehicleTrajectoryPlan">
<text class="ico conversion-path"></text>
- <view class="text ">杞﹁締杞ㄨ抗瑙勫垝</view>
+ <view class="text ">{{translate('vehicle_trajectory_plan')}}</view>
</view>
</view>
</view>
<view class="bottom-content" v-else-if="mapOperationType =='vehicle_trajectory_planning'">
<template v-if="mapOperationStatus=='feasible_region' || mapOperationStatus=='prohibition_region'">
- <view class="tip">鍖哄煙瑙勫垝</view>
- <view>鍙寜浣忓悇绔偣璋冩暣铏氭嫙澧欎綅缃紝鎸夈�+銆戞寜閽彲娣诲姞椤剁偣锛屽尯鍩熼渶涓洪棴鍚堝浘褰�/view>
+ <view class="tip">{{translate("regiona_plan")}}</view>
+ <view>{{translate("endpoint_adjust_position_to_closed_shape")}}</view>
</template>
<view class="img-button-group" v-else>
<view fill="none" class="button" @click="clickPlanFeasibleRegion">
<!-- <text class="ico conversion-path"></text> -->
<uni-icons class="img" type="checkmarkempty" size="36" color="#1890FF"></uni-icons>
- <view class="text">鍙鍖�/view>
+ <view class="text">{{translate("feasible_region")}}</view>
</view>
<view type="text" class="button " @click="clickPlanProhibitionRegion">
<text class="ico placeholder-bold"></text>
- <view class="text ">绂佽鍖�/view>
+ <view class="text ">{{translate("prohibition_region")}}</view>
</view>
</view>
</view>
<view class="bottom-content" v-else-if="mapOperationType =='manual_planning'">
<template v-if="mapOperationStatus=='feasible_region' || mapOperationStatus=='prohibition_region'">
- <view class="tip">鍖哄煙瑙勫垝</view>
- <view>鍙寜浣忓悇绔偣璋冩暣铏氭嫙澧欎綅缃紝鎸夈�+銆戞寜閽彲娣诲姞椤剁偣锛屽尯鍩熼渶涓洪棴鍚堝浘褰�/view>
+ <view class="tip">{{translate("regiona_plan")}}</view>
+ <view>{{translate("endpoint_adjust_position_to_closed_shape")}}</view>
</template>
<template v-else-if="mapOperationStatus=='virtual_wall'">
- <view class="tip">鍖哄煙瑙勫垝</view>
- <view>鍙寜浣忎袱绔偣璋冩暣铏氭嫙澧欎綅缃�/view>
+ <view class="tip">{{translate("regiona_plan")}}</view>
+ <view>{{translate("endpoint_adjust_virtual_wall_position")}}</view>
</template>
<view class="img-button-group" v-else>
<view fill="none" class="button" @click="clickPlanFeasibleRegion">
<!-- <text class="ico conversion-path"></text> -->
<uni-icons class="img" type="checkmarkempty" size="36" color="#1890FF"></uni-icons>
- <view class="text">鍙鍖�/view>
+ <view class="text">{{translate("feasible_region")}}</view>
</view>
<view type="text" class="button " @click="clickPlanProhibitionRegion">
<text class="ico placeholder-bold"></text>
- <view class="text ">绂佽鍖�/view>
+ <view class="text ">{{translate("prohibition_region")}}</view>
</view>
<view type="text" class="button " @click="clickPlanVirtualWall">
<text class="dashed-line"></text>
- <view class="text ">铏氭嫙澧�/view>
+ <view class="text ">{{translate("virtual_wall")}}</view>
</view>
</view>
</view>
- <view class="bottom-content" v-else-if="mapOperationType =='scene_create'"></view>
+
<template v-else-if="mapOperationType =='public_teaching' ">
<view class="bottom-content" v-if="mapOperationStatus =='teaching'">
- <view class="tip">璺緞璁板綍涓�..</view>
+ <view class="tip">{{translate("in_path_record")}}...</view>
<view v-if="mapOperationType =='public_teaching'">
<!-- 涓昏矾/鏀矾 -->
- <view>姝e湪璁板綍鎼繍杞﹁杩涜矾寰勶紝瀹屾垚鍚庣偣鎸夐挳浠ョ粨鏉熺ず鏁欍�鍦ㄧず鏁欒繃绋嬩腑鍙互娣诲姞绔欑偣銆�/view>
- <view class="switch-type">鍙殢鏃跺垏鎹㈢ず鏁欐ā寮�+ <view>{{translate("recording_path_of_vehicle_can_add_station")}}</view>
+ <view class="switch-type">{{translate("any_time_switch_teaching_modes")}}
<view class="switch-button-group">
<view class="switch-button"
:class="teachingModeCur.mode_type ==0?'switch-button-checked':''"
- @click="onTeachingModeType(0)">榛樿</view>
+ @click="onTeachingModeType(0)">{{translate("default")}}</view>
<view class="switch-button "
:class="teachingModeCur.mode_type ==1?'switch-button-checked':''"
- @click="onTeachingModeType(1)">鍙屽悜</view>
+ @click="onTeachingModeType(1)">{{translate("bidirectional")}}</view>
<view class="switch-button "
:class="teachingModeCur.mode_type ==2?'switch-button-checked':''"
- @click="onTeachingModeType(2)">鏅鸿兘</view>
+ @click="onTeachingModeType(2)">{{translate("intelligent")}}</view>
</view>
</view>
</view>
<view v-else>
- 姝e湪璁板綍鎼繍杞﹁杩涜矾寰勶紝瀹屾垚鍚庣偣鎸夐挳浠ョ粨鏉熺ず鏁�+ {{translate("recording_path_of_vehicle_click_btn_to_finish")}}
</view>
<view class="text-button-group">
<a-button v-if="mapOperationType =='public_teaching'" type="ghost" class="button"
- @click="clickAddStation">娣诲姞绔欑偣</a-button>
- <a-button type="primary" class="button" @click="clickTeachingEnd">缁撴潫璁板綍</a-button>
+ @click="clickAddStation">{{translate("add_station")}}</a-button>
+ <a-button type="primary" class="button" @click="clickTeachingEnd">{{translate("end_teaching")}}</a-button>
</view>
</view>
<view class="bottom-content" v-else-if="mapOperationStatus =='end'">
- <view class="tip">璺緞璁板綍瀹屾垚</view>
+ <view class="tip">{{translate("path_recording_completed")}}</view>
<view>
- 瑕佸皢璇ユ璺緞淇濆瓨涓虹ず鏁欒矾寰勫悧锛�+ {{translate("ask_save_this_path")}}
</view>
<view class="text-button-group">
<a-button type="primary" class="button" :disabled="loading"
- @click="clickTeachingSave">淇濆瓨涓虹ず鏁欒矾寰�/a-button>
+ @click="clickTeachingSave">{{translate("save_as_teaching_path")}}</a-button>
<a-button type="ghost" class="button" :disabled="loading"
- @click="clickTeachingReset">閲嶆柊璁板綍</a-button>
+ @click="clickTeachingReset">{{translate("re_record")}}</a-button>
</view>
</view>
<view class="bottom-content" v-else-if="mapOperationStatus =='save'">
- <view class="tip">绀烘暀瀹屾垚</view>
+ <view class="tip">{{translate("teaching_completed")}}</view>
<view>
- 宸插皢璺緞淇濆瓨涓虹ず鏁欒矾寰�+ {{translate("path_saved_as_teaching_path")}}
</view>
<view class="text-button-group">
<a-button type="primary" class="button" :disabled="loading"
- @click="clickTeachingFinish">瀹屾垚</a-button>
+ @click="clickTeachingFinish">{{translate("complete")}}</a-button>
</view>
</view>
<view class="bottom-content" v-else>
- <view class="tip">鍗冲皢寮�鍏叡绀烘暀</view>
+ <view class="tip">{{translate("public_teaching_to_begin")}}</view>
<view>
- 璇烽�鎷╄杩涜涓昏矾杩樻槸鏀矾绀烘暀锛岀偣銆愬紑濮嬭褰曘�鍚庡皢璁板綍鎼繍杞︾殑琛岃繘璺嚎浣滀负鍏叡绀烘暀璺嚎銆傚紑濮嬭褰曞悗鍙殢鏃跺垏鎹㈢ず鏁欐ā寮忋�
+ {{translate("public_teaching_start_tip_select_teaching_mode")}}
</view>
<view class="text-button-group">
<view class="switch-type">
<view class="switch-button-group">
<view class="switch-button"
:class="teachingModeCur.mode_type ==0?'switch-button-checked':''"
- @click="onTeachingModeType(0)">榛樿</view>
+ @click="onTeachingModeType(0)">{{translate("default")}}</view>
<view class="switch-button "
:class="teachingModeCur.mode_type ==1?'switch-button-checked':''"
- @click="onTeachingModeType(1)">鍙屽悜</view>
+ @click="onTeachingModeType(1)">{{translate("bidirectional")}}</view>
<view class="switch-button "
:class="teachingModeCur.mode_type ==2?'switch-button-checked':''"
- @click="onTeachingModeType(2)">鏅鸿兘</view>
+ @click="onTeachingModeType(2)">{{translate("intelligent")}}</view>
</view>
</view>
<a-button type="primary" class="button" :disabled="loading"
- @click="clickTeachingStart">寮�璁板綍</a-button>
+ @click="clickTeachingStart">{{translate("start_teaching")}}</a-button>
</view>
</view>
@@ -288,24 +277,28 @@
<view class="img-button-group">
<view fill="none" class="button" @click="clickRename">
<text class="ico rename"></text>
- <view class="text">閲嶅懡鍚�/view>
+ <view class="text">{{translate("rename")}}</view>
</view>
- <view type="text" class="button " @click="clickRegionaPlan">
+ <!-- <view type="text" class="button " @click="clickRegionaPlan">
<text class="ico zone"></text>
- <view class="text">鍖哄煙瑙勫垝</view>
+ <view class="text">{{translate("regiona_plan")}}</view>
+ </view> -->
+ <view type="text" class="button " @click="clickPalletSize">
+ <text class="ico dimensions"></text>
+ <view class="text">{{translate('pallet_size')}}</view>
</view>
<view fill="none" class="button" @click="clickExtendMap">
<text class="ico expand"></text>
- <view class="text">鎵╁睍鍦板浘</view>
+ <view class="text">{{translate("extend_map")}}</view>
</view>
<!-- <view type="text" class="button" @click="clickMapEdit">
<text class="ico edit-line"></text>
<view class="text"> 缂栬緫鍦板浘</view>
</view> -->
<view type="text" class="button" @click="clickDelete">
- <text class="ico delete-outline"></text>
- <view class="text">鍒犻櫎鍦烘櫙</view>
+ <text class="ico red delete-outline"></text>
+ <view class="text">{{translate('delete_scene')}}</view>
</view>
</view>
@@ -314,11 +307,11 @@
<view class="img-button-group">
<view fill="none" class="button" @click="clickMapStation">
<text class="ico location1"></text>
- <view class="text">娣诲姞绔欑偣</view>
+ <view class="text">{{translate("add_station")}}</view>
</view>
<view fill="none" class="button" @click="clickTeaching">
<text class="ico teach"></text>
- <view class="text">璺緞绀烘暀</view>
+ <view class="text">{{translate("path_teaching")}}</view>
</view>
<!-- <view type="text" class="button " @click="clickRegionaPlan">
<text class="ico layer"></text>
@@ -326,11 +319,11 @@
</view> -->
<view type="text" class="button" @click="clickMapEdit">
<text class="ico edit-line"></text>
- <view class="text"> 缂栬緫鍦板浘</view>
+ <view class="text"> {{translate("edit_map")}}</view>
</view>
<view type="text" class="button" @click="clickMapTask">
<text class="ico task-list"></text>
- <view class="text">浠诲姟璁剧疆</view>
+ <view class="text">{{translate("task_set")}}</view>
</view>
</view>
</view>
@@ -354,15 +347,15 @@
<view class="img-button-group">
<view fill="none" class="button" @click.stop="clickStationDelete">
<text class="ico delete-outline"></text>
- <view class="text"> 鎵归噺鍒犻櫎</view>
+ <view class="text"> {{translate("batch_delete")}}</view>
</view>
<view type="text" class="button" @click.stop="clickStationPostion">
<text class="ico edit-line"></text>
- <view class="text">璋冩暣浣嶇疆鏈濆悜</view>
+ <view class="text">{{translate("adjust_position")}}</view>
</view>
<view type="text" class="button" @click.stop="clickStationRename">
<text class="ico rename"></text>
- <view class="text">閲嶅懡鍚�/view>
+ <view class="text">{{translate("rename")}}</view>
</view>
</view>
@@ -378,11 +371,11 @@
<view fill="none" class="button" @click.stop="clickTeachingEdit">
<text class="ico edit-line"></text>
- <view class="text">缂栬緫</view>
+ <view class="text">{{translate('edit_path')}}</view>
</view>
<view fill="none" class="button" @click.stop="clickTeachingDelete">
<text class="ico red delete-outline "></text>
- <view class="text">鍒犻櫎</view>
+ <view class="text">{{translate('delete_path')}}</view>
</view>
</view>
@@ -391,17 +384,20 @@
</view>
</uni-popup>
<uni-popup ref="refPopupTeachingUpdate" type="dialog">
- <uni-popup-dialog type="info" cancelText="鍙栨秷" confirmText="纭畾" title="绀烘暀鏇存柊"
- @confirm="dialogTeachingUpdateConfirm" @close="dialogTeachingUpdateClose">
+ <uni-popup-dialog type="info" :cancelText="translate('cancel')" :confirmText="translate('ok')"
+ :title="translate('teaching_update')" @confirm="dialogTeachingUpdateConfirm"
+ @close="dialogTeachingUpdateClose">
<view class="popup-dialog-content">
<view class="popup-content-item">
<radio-group @change="radioTeachinMainRoadChange">
<label class="radio">
- <radio :value="1" :checked="selectTeachingMode.main_road == 1" />涓昏矾
+ <radio :value="1" :checked="selectTeachingMode.main_road == 1" />
+ {{translate("main_road")}}
</label>
<label class="radio">
- <radio :value="0" :checked="selectTeachingMode.main_road != 1" />鏀矾
+ <radio :value="0" :checked="selectTeachingMode.main_road != 1" />
+ {{translate("branch_road")}}
</label>
</radio-group>
@@ -410,10 +406,12 @@
<view class="popup-content-item">
<radio-group @change="radioTeachinBidirectionChange">
<label class="radio">
- <radio :value="1" :checked="selectTeachingMode.bidirection == 1" />鍙屽悜
+ <radio :value="1" :checked="selectTeachingMode.bidirection == 1" />
+ {{translate("bidirectional")}}
</label>
<label class="radio">
- <radio :value="0" :checked="selectTeachingMode.bidirection != 1" />鍗曞悜
+ <radio :value="0" :checked="selectTeachingMode.bidirection != 1" />
+ {{translate("unidirectional")}}
</label>
</radio-group>
@@ -433,18 +431,22 @@
ref
} from "vue";
import {
+ Base64
+ } from '@/comm/Base64.js';
+ import {
showToast,
showModal,
session,
showError,
- showInfo
+ showInfo,
+
} from "@/comm/utils.js"
// import OIFabric from "@/components/oi-fabric/index.vue"
import {
Button
} from 'antd-mobile-vue-next'
- import SceneCreateInfo from './infos/scene-create.vue'
-
+ import PalletSizeInfo from './infos/pallet-size.vue'
+ import SceneRenameInfo from './infos/scene-rename.vue'
import {
getAllScene,
@@ -471,7 +473,8 @@
name: "PagesMap",
components: {
'a-button': Button,
- SceneCreateInfo
+ PalletSizeInfo,
+ SceneRenameInfo
},
data() {
return {
@@ -507,8 +510,7 @@
y: 0,
angle: 0
},
- sceneInputName: "",
- showClearName: false,
+
stationList: [],
angleSvg: "/static/images/angle0.svg",
windowWidth: 375,
@@ -534,6 +536,8 @@
positioningAgv: false,
isPageVisible: true,
destroyFlag: false,
+
+
}
},
computed: {
@@ -550,21 +554,21 @@
},
watch: {
mapOperationType(val) {
- let name = this.sceneId || "鍦板浘"
+ let name = this.sceneId || this.translate("map")
if (val == "add_station" || val == "teaching_add_station") {
- name = "娣诲姞绔欑偣"
+ name = this.translate("add_station")
} else if (val == "edit_station") {
- name = "缂栬緫绔欑偣"
- } else if (val == "scene_create") {
- name = "鏋勫缓鍦烘櫙"
+ name = this.translate("edit_station")
} else if (val == "edit_map") {
- name = "缂栬緫鍦板浘"
+ name = this.translate("edit_map")
} else if (val == "manual_planning") {
- name = "浜哄伐瑙勫垝"
+ name = this.translate("manual_plan")
} else if (val == "vehicle_trajectory_planning") {
- name = "杞﹁締杞ㄨ抗瑙勫垝"
+ name = this.translate("vehicle_trajectory_plan")
} else if (val == "public_teaching") {
- name = "璺緞绀烘暀"
+ name = this.translate("path_teaching")
+ } else if (val == "set_pallet_size") {
+ name = this.translate("pallet_size")
}
this.setData({
navigationBarTitle: name
@@ -652,7 +656,7 @@
this.setData({
unlinked: true
})
- showError(ex)
+ showError(ex, this.translate('error'))
}
},
@@ -672,7 +676,9 @@
clickMore() {
this.menuPopup = {
type: "menu",
- list: ["鏋勫缓鍦烘櫙", "鍦板浘鎵╁睍", "閲嶅懡鍚�, "鍒犻櫎"],
+ list: [this.translate("build_scene"), this.translate("extend_map"), this.translate("rename"), this
+ .translate("delete")
+ ],
left: 450,
top: 140
}
@@ -680,43 +686,7 @@
},
async clickBack() {
- if (this.mapOperationType == "scene_create") {
- if (this.opSceneType == "scan") {
- showModal("宸叉瀯寤哄満鏅皢浼氳鍒犻櫎", "鏄惁涓柇鍦烘櫙鏋勫缓锛�).then((res) => {
- if (res) {
- if (this.sceneList.length == 0) {
- const eventChannel = this.getOpenerEventChannel();
- eventChannel.emit('check_connect', !this.unlinked);
- uni.navigateBack({
- delta: 1
- })
- } else {
- this.opSceneType = ""
- this.mapOperationType = ""
- }
-
- }
- })
- } else {
- if (this.opSceneType != "") {
- await this.loadSceneList()
- if (this.sceneList.length == 0) {
-
- const eventChannel = this.getOpenerEventChannel();
- eventChannel.emit('check_connect', !this.unlinked);
- uni.navigateBack({
- delta: 1
- })
- }
- } else {
- const eventChannel = this.getOpenerEventChannel();
- eventChannel.emit('check_connect', !this.unlinked);
- uni.navigateBack({
- delta: 1
- })
- }
- }
- } else if (this.mapOperationType == "edit_map") {
+ if (this.mapOperationType == "edit_map") {
this.mapOperationType = ""
} else if (this.mapOperationType == "regiona_planning") {
this.mapOperationType = "edit_map"
@@ -724,11 +694,18 @@
if (this.mapOperationStatus == "feasible_region" || this.mapOperationStatus ==
"prohibition_region") {
- showModal("姝e湪杩涜鍖哄煙瑙勫垝銆�, "鏄惁瑕侀�鍑哄尯鍩熻鍒掞紵").then((res) => {
- if (res) {
- this.mapOperationStatus = ""
- }
- })
+ showModal({
+ title: this.translate("ask_exit_regional_planning"),
+ content: `${this.translate('regional_planning')}`,
+ confirmText: this.translate('yes'),
+ cancelText: this.translate("no"),
+
+ })
+ .then((res) => {
+ if (res) {
+ this.mapOperationStatus = ""
+ }
+ })
} else {
this.mapOperationType = "regiona_planning"
@@ -738,24 +715,30 @@
if (this.mapOperationStatus == "virtual_wall" ||
this.mapOperationStatus == "feasible_region" ||
this.mapOperationStatus == "prohibition_region") {
- showModal("姝e湪杩涜鍖哄煙瑙勫垝銆�, "鏄惁瑕侀�鍑哄尯鍩熻鍒掞紵").then((res) => {
- if (res) {
- if (this.mapOperationStatus == "virtual_wall") {
- this.ctxDataStr = JSON.stringify([{
- method: "remove_wall",
- param: [this.wallEdit]
- }])
- this.wallEdit = {}
- } else {
- this.ctxDataStr = JSON.stringify([{
- method: "remove_region",
- param: [this.regionEdit]
- }])
- this.regionEdit = {}
+ showModal({
+ title: this.translate("ask_exit_regional_planning"),
+ content: `${this.translate('regional_planning')}`,
+ confirmText: this.translate('yes'),
+ cancelText: this.translate("no"),
+ })
+ .then((res) => {
+ if (res) {
+ if (this.mapOperationStatus == "virtual_wall") {
+ this.ctxDataStr = JSON.stringify([{
+ method: "remove_wall",
+ param: [this.wallEdit]
+ }])
+ this.wallEdit = {}
+ } else {
+ this.ctxDataStr = JSON.stringify([{
+ method: "remove_region",
+ param: [this.regionEdit]
+ }])
+ this.regionEdit = {}
+ }
+ this.mapOperationStatus = ""
}
- this.mapOperationStatus = ""
- }
- })
+ })
} else {
this.mapOperationType = "regiona_planning"
}
@@ -798,32 +781,38 @@
if (this.mapOperationStatus) {
- showModal("宸茶褰曠殑璺緞灏嗕細琚垹闄ゃ�", "鏄惁瑕侀�鍑虹ず鏁欙紵").then(async (res) => {
- if (res) {
- const listDataStr = []
- if (this.mapOperationStatus == 'end' || this.mapOperationStatus ==
- 'save') {
- try {
- await delTeachingMode(this.vehicleIp, [this.teachingModeCur])
+ showModal({
+ title: this.translate("ask_exit_teaching"),
+ content: `${this.translate('recorded_path_will_be_deleted')}`,
+ confirmText: this.translate('yes'),
+ cancelText: this.translate("no"),
+ })
+ .then(async (res) => {
+ if (res) {
+ const listDataStr = []
+ if (this.mapOperationStatus == 'end' || this.mapOperationStatus ==
+ 'save') {
+ try {
+ await delTeachingMode(this.vehicleIp, [this.teachingModeCur])
- listDataStr.push({
- method: "remove_teaching_path",
- param: {
- name: this.teachingModeCur.name,
- mode: "Public"
- },
- })
- } catch (ex) {
- showError(ex)
+ listDataStr.push({
+ method: "remove_teaching_path",
+ param: {
+ name: this.teachingModeCur.name,
+ mode: "Public"
+ },
+ })
+ } catch (ex) {
+ showError(ex, this.translate('error'))
+ }
}
+ listDataStr.push({
+ method: "teaching_finish",
+ })
+ this.ctxDataStr = JSON.stringify(listDataStr)
+ this.mapOperationType = ""
}
- listDataStr.push({
- method: "teaching_finish",
- })
- this.ctxDataStr = JSON.stringify(listDataStr)
- this.mapOperationType = ""
- }
- })
+ })
} else {
this.ctxDataStr = JSON.stringify([{
method: "teaching_finish",
@@ -864,9 +853,7 @@
if (type == "scene") {
this.changeMap(item)
} else if (type == "menu") {
- if (item == "鏋勫缓鍦烘櫙") {
- // this.mapOperationType = 'scene_create'
- // this.opSceneType = 'add_name'
+ if (item == this.translate("build_scene")) {
uni.navigateTo({
url: `/pages/map/scene?ip=${_this.vehicleIp}&opType=create`,
events: {
@@ -876,11 +863,11 @@
},
}
})
- } else if (item == "鍦板浘鎵╁睍") {
+ } else if (item == this.translate("extend_map")) {
this.clickExtendMap()
- } else if (item == "閲嶅懡鍚�) {
+ } else if (item == this.translate('rename')) {
this.clickRename()
- } else if (item == "鍒犻櫎") {
+ } else if (item == this.translate('delete')) {
this.clickDelete()
}
}
@@ -909,7 +896,7 @@
const info = await stations(this.vehicleIp)
return info.station_list || []
} catch (ex) {
- showError(ex)
+ showError(ex, this.translate('error'))
return []
}
},
@@ -918,7 +905,7 @@
const info = await getMapUrl(this.vehicleIp, id)
return info
} catch (ex) {
- showError(ex)
+ showError(ex, this.translate('error'))
return {}
}
},
@@ -927,11 +914,11 @@
this.mapShowAgv = false
this.setData({
sceneId: id,
- navigationBarTitle: id || "鍦板浘"
+ navigationBarTitle: id || this.translate("map")
})
try {
uni.showLoading({
- title: "鍒囨崲鍦烘櫙涓�
+ title: this.translate("switching_scene")
})
this.setData({
unlinked: false
@@ -968,6 +955,7 @@
bgProgressPercent: 30,
bgLoading: infoMap.filedata ? true : false
})
+
this.stationList = stationLst
this.teachingMode = await this.loadTeachingMode()
this.ctxDataStr = JSON.stringify([{
@@ -1024,7 +1012,7 @@
bgProgressPercent: 0,
bgLoading: false
})
- showError(ex)
+ showError(ex, this.translate('error'))
}
},
@@ -1067,9 +1055,11 @@
} else if (param.method == "edit_station") {
this.stationEdit = param.station
+ this.stationEdit.x = Math.round(Number(param.station.x || 0) * 1000) / 1000
+ this.stationEdit.y = Math.round(Number(param.station.y || 0) * 1000) / 1000
this.stationViewPos = {
- x: param.view?.x || 0,
- y: param.view?.y || 0,
+ x: Math.round(Number(param.view?.x || 0) * 1000) / 1000,
+ y: Math.round(Number(param.view?.y || 0) * 1000) / 1000,
width: param.view?.width || 0,
height: param.view?.height || 0,
}
@@ -1083,8 +1073,8 @@
} else if (param.method == "update_station") {
this.stationEdit.stationID = param.station?.stationID
this.stationEdit.angle = param.station.angle
- this.stationEdit.x = param.station.x
- this.stationEdit.y = param.station.y
+ this.stationEdit.x = Math.round(Number(param.station.x || 0) * 1000) / 1000
+ this.stationEdit.y = Math.round(Number(param.station.y || 0) * 1000) / 1000
this.stationViewPos.x = param.view?.x || 0
this.stationViewPos.y = param.view?.y || 0
} else if (param.method == "edit_finish") {
@@ -1096,8 +1086,8 @@
this.stationEdit.stationID = param.data?.stationID
this.stationEdit.name = param.data?.name
this.stationEdit.angle = param.data?.angle
- this.stationEdit.x = param.data?.x
- this.stationEdit.y = param.data?.y
+ this.stationEdit.x = Math.round(Number(param.data?.x || 0) * 1000) / 1000
+ this.stationEdit.y = Math.round(Number(param.data?.y || 0) * 1000) / 1000
const angle = this.getStantardAngle(this.stationEdit.angle * 180 / Math.PI)
@@ -1235,6 +1225,9 @@
this.mapOperationType = "edit_map"
},
+ clickPalletSize() {
+ this.mapOperationType = "set_pallet_size"
+ },
clickExtendMap() {
const _this = this
uni.navigateTo({
@@ -1273,7 +1266,6 @@
this.mapOperationType = "regiona_planning"
},
clickRename() {
- this.sceneInputName = this.sceneId
this.mapOperationType = 'edit_scene_name'
},
async loadSceneList() {
@@ -1290,20 +1282,7 @@
this.sceneList = list
if (list.length === 0) {
this.opSceneType = ''
- // this.mapOperationType = 'scene_create'
- // this.setData({
- // sceneId: "",
- // navigationBarTitle: "鍦板浘"
- // })
- // uni.navigateTo({
- // url: `/pages/map/scene?ip=${this.vehicleIp}`,
- // events: {
- // // 涓烘寚瀹氫簨浠舵坊鍔犱竴涓洃鍚櫒锛岃幏鍙栬鎵撳紑椤甸潰浼犻�鍒板綋鍓嶉〉闈㈢殑鏁版嵁
- // create_finish: function(data) {
- // _this.onCreateSceneOk(data)
- // },
- // }
- // })
+
uni.navigateBack({
delta: 1, //杩斿洖灞傛暟锛�鍒欎笂涓婇〉
})
@@ -1311,33 +1290,32 @@
}
} catch (ex) {
- showError(ex)
+ showError(ex, this.translate('error'))
}
},
clickDelete() {
const _this = this
- showModal(`鍒犻櫎鍦烘櫙[${this.sceneId}]浼氭妸鍦烘櫙瀵瑰簲鐨勫湴鍥句换鍔′俊鎭兘浼氬垹闄わ紝鏄惁纭鍒犻櫎锛焋, "鍒犻櫎鍦烘櫙").then(async (res) => {
+
+
+ showModal({
+ title: this.translate("ask_deleting_scene"),
+ content: `${this.translate('delete_scene_will_be_deleted_map_and_tasks')}`,
+ confirmText: this.translate('yes'),
+ cancelText: this.translate("no"),
+ }).then(async (res) => {
if (res) {
try {
uni.showLoading({
- title: "鍒犻櫎鍦烘櫙涓�
+ title: this.translate("deleting_scene")
})
this.mapShowAgv = false
await delScene(this.vehicleIp, this.sceneId)
await this.loadSceneList()
if (this.sceneList.length > 0)
this.changeMap(this.sceneList[0])
- // else {
- // _this.mapOperationType = ""
- // setTimeout(() => {
- // uni.navigateBack({
- // delta: 1, //杩斿洖灞傛暟锛�鍒欎笂涓婇〉
- // })
- // }, 500)
- // }
} catch (ex) {
- showError(ex)
+ showError(ex, this.translate('error'))
} finally {
uni.hideLoading()
}
@@ -1401,7 +1379,7 @@
])
}
} catch (ex) {
- showError(ex)
+ showError(ex, this.translate('error'))
}
},
async clickPlanProhibitionRegion() {
@@ -1447,7 +1425,7 @@
])
}
} catch (ex) {
- showError(ex)
+ showError(ex, this.translate('error'))
}
},
@@ -1487,34 +1465,14 @@
}
])
} catch (ex) {
- showError(ex)
+ showError(ex, this.translate('error'))
}
},
- clickNameCancel() {
- this.mapOperationType = ''
- },
- async clickNameOK() {
- try {
- uni.showLoading({
- title: "鏇存柊鍦烘櫙鍚嶇О"
- })
- this.loading = true
- const name = this.sceneInputName.trim()
- if (!name) {
- showToast("鍦烘櫙鍚嶇О涓嶈兘涓虹┖锛�)
- return
- }
- // console.log(name, this.sceneId)
- if (name == this.sceneId) {
- showToast("鍦烘櫙鍚嶇О鏈彉鍖栵紒")
- return
- }
+ onFinishRenameScene(name) {
+
+ if (name) {
const curIndex = this.sceneList.findIndex((param) => param == this.sceneId)
- this.mapOperationType = ""
- await updateScene(this.vehicleIp, this.sceneId, name)
-
-
this.sceneId = name
if (curIndex > -1) {
this.sceneList[curIndex] = name
@@ -1522,28 +1480,10 @@
this.setData({
navigationBarTitle: name
})
- showToast("鍦烘櫙閲嶅懡鍚嶆垚鍔燂紒")
- } catch (ex) {
- this.mapOperationType = "edit_scene_name"
- showError(ex)
- } finally {
- uni.hideLoading()
- this.loading = false
}
-
+ this.mapOperationType = ""
},
- clickClearName() {
- this.showClearName = false
- this.sceneInputName = ""
- },
- onInputName(event) {
- this.sceneInputName = event.detail.value.trim();
- if (this.sceneInputName)
- this.showClearName = true
- else
- this.showClearName = false
- },
closePopuBtn() {
@@ -1574,18 +1514,12 @@
}
}
})
- //this.stationDelete(this.stationEdit)
- // const _this = this
- // showModal("璇ョ珯鐐瑰凡缁戝畾浠诲姟锛屽垹闄ょ珯鐐瑰悗缁戝畾鐨勪换鍔′細鍋滄骞跺垹闄�, "鏄惁纭鍒犻櫎锛�).then((res) => {
- // if (res) {
- // }
- // })
},
async stationAdd(item) {
try {
uni.showLoading({
- title: "姝e湪鏂板缓绔欑偣"
+ title: this.translate("creating_station")
})
await addStation(this.vehicleIp, item)
await updateStation(this.vehicleIp, item)
@@ -1599,7 +1533,7 @@
} catch (ex) {
- showError(ex)
+ showError(ex, this.translate('error'))
} finally {
uni.hideLoading()
}
@@ -1607,7 +1541,7 @@
async stationUpdate(item) {
try {
uni.showLoading({
- title: "姝e湪鏇存柊绔欑偣"
+ title: this.translate("updating_station")
})
await updateStation(this.vehicleIp, item)
const curIndex = this.stationList.findIndex((a) => a.stationID ==
@@ -1622,7 +1556,7 @@
}
} catch (ex) {
- showError(ex)
+ showError(ex, this.translate('error'))
} finally {
uni.hideLoading()
}
@@ -1647,13 +1581,13 @@
}])
this.mapOperationType = ''
} catch (ex) {
- showError(ex)
+ showError(ex, this.translate('error'))
}
},
async stationDelete(item) {
try {
uni.showLoading({
- title: "姝e湪鍒犻櫎绔欑偣"
+ title: this.translate("deleting_station")
})
this.$refs.refPopupOperateStation.close()
await delStation(this.vehicleIp, [item.stationID])
@@ -1674,7 +1608,7 @@
}])
} catch (ex) {
- showError(ex)
+ showError(ex, this.translate('error'))
} finally {
uni.hideLoading()
}
@@ -1722,7 +1656,7 @@
const name = this.stationEdit.name.trim()
if (!name) {
- showToast("绔欑偣鍚嶇О杩樻湭杈撳叆")
+ showToast(this.translate("input_station_name"))
return
}
this.loading = true
@@ -1731,8 +1665,8 @@
this.stationEdit = {
stationID: this.getMaxStationNo + 1,
name: name,
- x: agv.x || 0,
- y: agv.y || 0,
+ x: Math.round(Number(agv.x || 0) * 1000) / 1000,
+ y: Math.round(Number(agv.y || 0) * 1000) / 1000,
angle: agv.angle || 0,
}
const angle = this.getStantardAngle(this
@@ -1773,7 +1707,7 @@
}
} catch (ex) {
- showError(ex)
+ showError(ex, this.translate('error'))
} finally {
this.loading = false
}
@@ -1791,8 +1725,22 @@
else
this.showClearName = false
},
+ validateNumber(input) {
+ // 甯哥敤姝e垯妯″紡
+ const patterns = {
+ integer: /^-?\d+$/, // 鏁存暟锛屽寘鎷礋鏁�[citation:6]
+ positiveInt: /^[1-9]\d*$/, // 姝f暣鏁�[citation:7]
+ decimal: /^-?\d*\.?\d+$/, // 灏忔暟 (鏀寔鍍�".1" 杩欐牱鐨勬牸寮�
+ decimalFixed: /^-?\d*\.?\d{0,3}$/, // 鏈�涓や綅灏忔暟 [citation:5][citation:8]
+ };
+ // 閫夋嫨闇�鐨勬ā寮忚繘琛屾祴璇曪紝渚嬪浣跨敤 decimal
+ return patterns.decimalFixed.test(input);
+ },
onInputStationX(event) {
- console.log(event)
+ if (!this.validateNumber(event.detail.value)) {
+ showToast(this.translate("input_content_only_numbers_and_signs_and_decimal"))
+ return
+ }
this.stationEdit.x = Number(event.detail.value);
console.log(this.stationEdit.x)
this.ctxDataStr = JSON.stringify([{
@@ -1808,6 +1756,10 @@
},
onInputStationY(event) {
+ if (!this.validateNumber(event.detail.value)) {
+ showToast(this.translate("input_content_only_numbers_and_signs_and_decimal"))
+ return
+ }
this.stationEdit.y = Number(event.detail.value);
console.log(this.stationEdit.y)
this.ctxDataStr = JSON.stringify([{
@@ -1821,6 +1773,8 @@
}
}])
},
+
+
clickClearStationX() {
this.stationEdit.x = 0
this.ctxDataStr = JSON.stringify([{
@@ -1937,14 +1891,14 @@
}
}])
} catch (ex) {
- showError(ex)
+ showError(ex, this.translate('error'))
}
},
async clickPositionStation() {
try {
const infoAgv = await this.loadAgvState()
- this.stationEdit.x = infoAgv.x
- this.stationEdit.y = infoAgv.y
+ this.stationEdit.x = Math.round(Number(infoAgv.x) * 1000) / 1000;
+ this.stationEdit.y = Math.round(Number(infoAgv.y) * 1000) / 1000;
this.stationEdit.angle = infoAgv.angle
const angle = this.getStantardAngle(this
.stationEdit.angle * 180 / Math.PI)
@@ -1970,7 +1924,7 @@
])
} catch (ex) {
- showError(ex)
+ showError(ex, this.translate('error'))
}
},
async loadTeachingMode() {
@@ -1984,7 +1938,7 @@
}
} catch (ex) {
- showError(ex)
+ showError(ex, this.translate('error'))
return {
Public: [],
Stations: []
@@ -2022,7 +1976,7 @@
this.ctxDataStr = JSON.stringify(list)
} catch (ex) {
- showError(ex)
+ showError(ex, this.translate('error'))
}
},
@@ -2064,7 +2018,7 @@
}
])
} catch (ex) {
- showError(ex)
+ showError(ex, this.translate('error'))
}
},
async refreshAgvPosition() {
@@ -2110,8 +2064,9 @@
const stationAdd = []
for (let i in publicNew) {
const item = publicNew[i]
- const curIndex = publicOld.findIndex((a) => a.name == item.name && a.edge_name == item.edge_name )
-
+ const curIndex = publicOld.findIndex((a) => a.name == item.name && a.edge_name ==
+ item.edge_name)
+
if (curIndex < 0) {
publicAdd.push(item)
publicOld.push(item)
@@ -2185,7 +2140,7 @@
}
//setTimeout(this.refreshAgvPosition, 1000);
} catch (ex) {
- // showError(ex).then((res) => {
+ // showError(ex,this.translate('error')).then((res) => {
// })
showToast(ex)
@@ -2234,29 +2189,16 @@
return []
}
},
- askTeachingBiDirection(teachingMode) {
- showModal("閫夋嫨褰撳墠绀烘暀璺嚎绫诲瀷?", "绀烘暀缁撴潫", true, "鍙屽悜璺嚎",
- "鍗曞悜璺嚎").then((res) => {
- if (res) {
- teachingMode.bidirection = "1"
- } else {
- teachingMode.bidirection = "0"
- }
- teachingMode.teaching_flag = 0
- this.finishTeaching(teachingMode)
- })
-
- },
async finishTeaching(teachingMode) {
try {
uni.showLoading({
- title: "绀烘暀缁撴潫"
+ title: this.translate("teaching_end")
})
await teachingModeFlag(this.vehicleIp, teachingMode)
this.mapOperationStatus = "end"
} catch (ex) {
- showError(ex)
+ showError(ex, this.translate('error'))
} finally {
uni.hideLoading()
}
@@ -2266,14 +2208,14 @@
const _this = this
try {
uni.showLoading({
- title: "绀烘暀寮�"
+ title: this.translate("teaching_start")
})
this.loading = false
this.mapOperationStatus = "teaching"
await _this.teachingStart("Public")
} catch (ex) {
- showError(ex)
+ showError(ex, this.translate('error'))
} finally {
this.loading = false
uni.hideLoading()
@@ -2291,7 +2233,12 @@
},
clickTeachingReset() {
const _this = this
- showModal("宸茶褰曠殑璺緞灏嗕細琚垹闄ゃ�", "鏄惁瑕侀噸鏂拌褰曪紵")
+ showModal({
+ title: this.translate("ask_re_recording"),
+ content: `${this.translate('recorded_path_will_be_deleted')}`,
+ confirmText: this.translate('yes'),
+ cancelText: this.translate("no"),
+ })
.then(async (res) => {
if (res) {
try {
@@ -2310,7 +2257,7 @@
} catch (ex) {
- showError(ex)
+ showError(ex, this.translate('error'))
} finally {
this.loading = false
}
@@ -2326,7 +2273,7 @@
this.mapOperationStatus = "save"
try {} catch (ex) {
- showError(ex)
+ showError(ex, this.translate('error'))
}
},
@@ -2338,30 +2285,6 @@
},
async teachingStart(mode) {
try {
- /*if (mode == "Stations") {
- const res = await checkAgvLocationDistanceError(this.vehicleIp, this.startStationID)
- if (res?.error) {
- this.calibratioStationType = "start"
- this.$refs.refPopupCalibration.open()
- } else {
- // const name =
- // `${ this.stationName(this.startStationID)}_${ this.stationName(this.endStationID)}`
-
- this.teachingModeCur = {
- mode: "Stations",
- src_dst: `${this.startStationID}_${this.endStationID}`,
- name: "",
- teaching_flag: 1,
- }
- this.ctxDataStr = JSON.stringify([{
- method: "set_selectable",
- param: false,
- }])
- const res2 = await teachingModeFlag(this.vehicleIp, this.teachingModeCur)
- if (res2?.name)
- this.teachingModeCur.name = res2.name
- }
- } else {*/
const mode_type = this
.teachingModeCur
@@ -2382,32 +2305,17 @@
}
} catch (ex) {
- showError(ex)
+ showError(ex, this.translate('error'))
}
},
async teachingEnd(mode) {
try {
this.loading = true
- // if (mode == "Stations") {
- // const res = await checkAgvLocationDistanceError(this.vehicleIp, this.endStationID)
- // if (res.error) {
- // this.calibratioStationType = "end"
- // this.$refs.refPopupCalibration.open()
- // } else {
- // this.askTeachingBiDirection(this.teachingModeCur)
- // }
- // } else {
- // this.askTeachingBiDirection(this.teachingModeCur)
- // }
- // this.askTeachingBiDirection(
- // this
- // .teachingModeCur
- // )
this.teachingModeCur.teaching_flag = 0
await this.finishTeaching(this.teachingModeCur)
} catch (ex) {
- showError(ex)
+ showError(ex, this.translate('error'))
} finally {
this.loading = false
}
@@ -2430,11 +2338,11 @@
const res = await teachingModeFlag(this.vehicleIp, this
.teachingModeCur)
if (val == 1)
- showToast("宸插皢绀烘暀鍒囨崲鎴愬弻鍚戞ā寮�)
+ showToast(this.translate("teaching_switched_bidirectional_mode"))
else if (val == 2)
- showToast("宸插皢绀烘暀鍒囨崲鎴愭櫤鑳芥ā寮�)
+ showToast(this.translate("teaching_switched_intelligent_mode"))
else
- showToast("宸插皢绀烘暀鍒囨崲鎴愰粯璁ゆā寮�)
+ showToast(this.translate("teaching_switched_default_mode"))
/*if (val == 0)
showToast(
"宸插皢璇ヨ矾娈佃矾寰勪繚瀛樹负涓昏矾绀烘暀璺嚎"
@@ -2470,17 +2378,26 @@
}
} catch (ex) {
- showError(ex)
+ showError(ex, this.translate('error'))
}
},
clickTeachingDelete() {
this.$refs
.refPopupOperateTeaching
.close()
- this.removeTeachingMode(
- this
- .selectTeachingMode
- )
+ const _this = this
+ showModal({
+ title: this.translate("ask_deleting_teaching"),
+ content: `${this.translate('deleted_teaching_cannot_recovered')}`,
+ confirmText: this.translate('delete'),
+ cancelText: this.translate("cancel"),
+
+ })
+ .then((res) => {
+ if (res) {
+ _this.removeTeachingMode(_this.selectTeachingMode)
+ }
+ })
},
clickTeachingEdit() {
@@ -2504,7 +2421,7 @@
async dialogTeachingUpdateConfirm() {
try {
uni.showLoading({
- title: "鏇存柊绀烘暀涓�
+ title: this.translate("teaching_updating")
})
const item = this.selectTeachingMode
await updateSplitTeachingData(this.vehicleIp, item)
@@ -2515,10 +2432,9 @@
param: item,
}])
this.selectTeachingMode = {}
- showToast("鏇存柊绀烘暀鎴愬姛")
+ showToast(this.translate("teaching_update_success"))
} catch (ex) {
- showError(
- ex)
+ showError(ex, this.translate('error'))
} finally {
uni.hideLoading()
}
@@ -2531,7 +2447,7 @@
async removeTeachingMode(item) {
try {
uni.showLoading({
- title: "鍒犻櫎绀烘暀涓�
+ title: this.translate("teaching_deleting")
})
await deleteSplitTeachingData(this.vehicleIp, item
.edge_name, item.name)
@@ -2542,10 +2458,9 @@
method: "remove_teaching_path",
param: item,
}])
- showToast("鍒犻櫎绀烘暀鎴愬姛")
+ showToast(this.translate("teaching_delete_success"))
} catch (ex) {
- showError(
- ex)
+ showError(ex, this.translate('error'))
} finally {
uni.hideLoading()
}
@@ -2553,16 +2468,20 @@
async removeTeachingModeData(data) {
try {
uni.showLoading({
- title: "鍒犻櫎绀烘暀鏁版嵁涓�
+ title: this.translate("teaching_data_deleting")
})
await delTeachingModeData(this.vehicleIp, data)
- showToast("鍒犻櫎绀烘暀鎴愬姛")
+ showToast(this.translate("teaching_delete_success"))
this.reloadTeachingMode()
} catch (ex) {
- showError(ex)
+ showError(ex, this.translate('error'))
} finally {
uni.hideLoading()
}
+ },
+ translate(t) {
+ if (typeof this.$t == "function") return this.$t(`page.${t}`)
+ else return t;
},
}
@@ -2733,7 +2652,7 @@
.left {
display: flex;
flex-direction: column;
- width: 180rpx;
+ width: 240rpx;
color: #aaa;
.line {
@@ -2958,6 +2877,7 @@
.text {
margin: auto;
+ white-space: nowrap;
}
}
--
Gitblit v1.9.1