| | |
| | | <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"> |
| | |
| | | </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"> |
| | |
| | | <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"> |
| | |
| | | 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> |
| | |
| | | </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>正在记录搬运车行进路径,完成后点按钮以结束示教。在示教过程中可以添加站点。</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.main_road ==1?'switch-button-checked':''" |
| | | @click="onTeachingModeMainRoad(1)">主路示教</view> |
| | | :class="teachingModeCur.mode_type ==0?'switch-button-checked':''" |
| | | @click="onTeachingModeType(0)">{{translate("default")}}</view> |
| | | <view class="switch-button " |
| | | :class="teachingModeCur.main_road ==0?'switch-button-checked':''" |
| | | @click="onTeachingModeMainRoad(0)">支路示教</view> |
| | | :class="teachingModeCur.mode_type ==1?'switch-button-checked':''" |
| | | @click="onTeachingModeType(1)">{{translate("bidirectional")}}</view> |
| | | <view class="switch-button " |
| | | :class="teachingModeCur.mode_type ==2?'switch-button-checked':''" |
| | | @click="onTeachingModeType(2)">{{translate("intelligent")}}</view> |
| | | </view> |
| | | </view> --> |
| | | </view> |
| | | </view> |
| | | |
| | | <view v-else> |
| | | 正在记录搬运车行进路径,完成后点按钮以结束示教 |
| | | {{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.main_road ==1?'switch-button-checked':''" |
| | | @click="onTeachingModeMainRoad(1)">主路示教</view> |
| | | :class="teachingModeCur.mode_type ==0?'switch-button-checked':''" |
| | | @click="onTeachingModeType(0)">{{translate("default")}}</view> |
| | | <view class="switch-button " |
| | | :class="teachingModeCur.main_road ==0?'switch-button-checked':''" |
| | | @click="onTeachingModeMainRoad(0)">支路示教</view> |
| | | :class="teachingModeCur.mode_type ==1?'switch-button-checked':''" |
| | | @click="onTeachingModeType(1)">{{translate("bidirectional")}}</view> |
| | | <view class="switch-button " |
| | | :class="teachingModeCur.mode_type ==2?'switch-button-checked':''" |
| | | @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> |
| | | |
| | |
| | | <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> |
| | | |
| | |
| | | <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> |
| | |
| | | </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> |
| | |
| | | <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> |
| | |
| | | |
| | | <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> |
| | |
| | | |
| | | </view> |
| | | </uni-popup> |
| | | <uni-popup ref="refPopupTeachingUpdate" type="dialog"> |
| | | <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" /> |
| | | {{translate("main_road")}} |
| | | </label> |
| | | <label class="radio"> |
| | | <radio :value="0" :checked="selectTeachingMode.main_road != 1" /> |
| | | {{translate("branch_road")}} |
| | | </label> |
| | | </radio-group> |
| | | |
| | | |
| | | </view> |
| | | <view class="popup-content-item"> |
| | | <radio-group @change="radioTeachinBidirectionChange"> |
| | | <label class="radio"> |
| | | <radio :value="1" :checked="selectTeachingMode.bidirection == 1" /> |
| | | {{translate("bidirectional")}} |
| | | </label> |
| | | <label class="radio"> |
| | | <radio :value="0" :checked="selectTeachingMode.bidirection != 1" /> |
| | | {{translate("unidirectional")}} |
| | | </label> |
| | | </radio-group> |
| | | |
| | | </view> |
| | | </view> |
| | | </uni-popup-dialog> |
| | | </uni-popup> |
| | | |
| | | |
| | | |
| | | </view> |
| | | </view> |
| | |
| | | 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, |
| | |
| | | delTeachingMode, |
| | | delTeachingModeData, |
| | | checkAgvLocationDistanceError, |
| | | splitTeachingMode, |
| | | updateSplitTeachingData, |
| | | deleteSplitTeachingData |
| | | } from "@/api/vehicle.js" |
| | | export default { |
| | | name: "PagesMap", |
| | | components: { |
| | | 'a-button': Button, |
| | | SceneCreateInfo |
| | | PalletSizeInfo, |
| | | SceneRenameInfo |
| | | }, |
| | | data() { |
| | | return { |
| | |
| | | y: 0, |
| | | angle: 0 |
| | | }, |
| | | sceneInputName: "", |
| | | showClearName: false, |
| | | |
| | | stationList: [], |
| | | angleSvg: "/static/images/angle0.svg", |
| | | windowWidth: 375, |
| | |
| | | unlinked: false, |
| | | showTeachingPathFlag: true, |
| | | curTeachingPathFlag: false, |
| | | curTeachingPathTime: 0, |
| | | curMapInfo: { |
| | | proportion: 1, |
| | | img_proportion: 1, |
| | |
| | | positioningAgv: false, |
| | | isPageVisible: true, |
| | | destroyFlag: false, |
| | | |
| | | |
| | | } |
| | | }, |
| | | computed: { |
| | |
| | | }, |
| | | 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 |
| | |
| | | this.setData({ |
| | | unlinked: true |
| | | }) |
| | | showError(ex) |
| | | showError(ex, this.translate('error')) |
| | | } |
| | | }, |
| | | |
| | |
| | | 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 |
| | | } |
| | |
| | | }, |
| | | |
| | | 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" |
| | |
| | | if (this.mapOperationStatus == "feasible_region" || this.mapOperationStatus == |
| | | "prohibition_region") { |
| | | |
| | | showModal("正在进行区域规划。", "是否要退出区域规划?").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" |
| | |
| | | if (this.mapOperationStatus == "virtual_wall" || |
| | | this.mapOperationStatus == "feasible_region" || |
| | | this.mapOperationStatus == "prohibition_region") { |
| | | showModal("正在进行区域规划。", "是否要退出区域规划?").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" |
| | | } |
| | |
| | | |
| | | 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]) |
| | | listDataStr.push({ |
| | | method: "remove_teaching_path", |
| | | param: { |
| | | name: this.teachingModeCur.name, |
| | | mode: "Public" |
| | | }, |
| | | }) |
| | | } catch (ex) { |
| | | showError(ex) |
| | | 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, 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", |
| | |
| | | } |
| | | |
| | | } else { |
| | | |
| | | |
| | | const eventChannel = this.getOpenerEventChannel(); |
| | | eventChannel.emit('check_connect', !this.unlinked); |
| | | uni.navigateBack({ |
| | |
| | | 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: { |
| | |
| | | }, |
| | | } |
| | | }) |
| | | } 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() |
| | | } |
| | | } |
| | |
| | | const info = await stations(this.vehicleIp) |
| | | return info.station_list || [] |
| | | } catch (ex) { |
| | | showError(ex) |
| | | showError(ex, this.translate('error')) |
| | | return [] |
| | | } |
| | | }, |
| | |
| | | const info = await getMapUrl(this.vehicleIp, id) |
| | | return info |
| | | } catch (ex) { |
| | | showError(ex) |
| | | showError(ex, this.translate('error')) |
| | | return {} |
| | | } |
| | | }, |
| | |
| | | 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 |
| | |
| | | bgProgressPercent: 30, |
| | | bgLoading: infoMap.filedata ? true : false |
| | | }) |
| | | |
| | | this.stationList = stationLst |
| | | this.teachingMode = await this.loadTeachingMode() |
| | | this.ctxDataStr = JSON.stringify([{ |
| | |
| | | bgProgressPercent: 0, |
| | | bgLoading: false |
| | | }) |
| | | showError(ex) |
| | | showError(ex, this.translate('error')) |
| | | } |
| | | }, |
| | | |
| | |
| | | |
| | | } 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, |
| | | } |
| | | const angle = this.getStantardAngle(this.stationEdit.angle * 180 / Math.PI) |
| | | |
| | | |
| | | this.angleSvg = `/static/images/angle${angle}.svg` |
| | | this.mapOperationType = "" |
| | | |
| | |
| | | } 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") { |
| | |
| | | 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) |
| | | |
| | |
| | | } else if (param.type == "public") { |
| | | this.selectTeachingMode = { |
| | | mode: "Public", |
| | | edge_name: param.data?.edge_name || "", |
| | | name: param.data?.name || "", |
| | | point: param.point |
| | | point: param.point, |
| | | main_road: param.data?.main_road || 0, |
| | | bidirection: param.data?.bidirection || 0, |
| | | } |
| | | console.log(this.selectTeachingMode.main_road, this.selectTeachingMode) |
| | | } |
| | | this.$refs.refPopupOperateTeaching.open("bottom") |
| | | } else if (param.method == "cancel_positioning_agv") { |
| | | if (this.mapOperationType == "public_teaching" |
| | | && this.mapOperationStatus == "teaching") { |
| | | if (this.mapOperationType == "public_teaching" && |
| | | this.mapOperationStatus == "teaching") { |
| | | this.positioningAgv = true |
| | | } else |
| | | this.positioningAgv = false |
| | |
| | | |
| | | this.mapOperationType = "edit_map" |
| | | }, |
| | | clickPalletSize() { |
| | | this.mapOperationType = "set_pallet_size" |
| | | }, |
| | | clickExtendMap() { |
| | | const _this = this |
| | | uni.navigateTo({ |
| | |
| | | this.mapOperationStatus = "" |
| | | this.teachingModeCur = { |
| | | mode: "Public", |
| | | main_road: 1, |
| | | mode_type: 0, |
| | | } |
| | | this.positioningAgv = true |
| | | this.mapOperationType = "public_teaching" |
| | |
| | | this.mapOperationType = "regiona_planning" |
| | | }, |
| | | clickRename() { |
| | | this.sceneInputName = this.sceneId |
| | | this.mapOperationType = 'edit_scene_name' |
| | | }, |
| | | async loadSceneList() { |
| | | try { |
| | | |
| | | |
| | | |
| | | const _this = this |
| | | const res = await getAllScene(this.vehicleIp) || [] |
| | | const list = res?.sceneList || [] |
| | |
| | | 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, //返回层数,2则上上页 |
| | | }) |
| | |
| | | } |
| | | |
| | | } 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, //返回层数,2则上上页 |
| | | // }) |
| | | // }, 500) |
| | | |
| | | // } |
| | | } catch (ex) { |
| | | showError(ex) |
| | | showError(ex, this.translate('error')) |
| | | } finally { |
| | | uni.hideLoading() |
| | | } |
| | |
| | | ]) |
| | | } |
| | | } catch (ex) { |
| | | showError(ex) |
| | | showError(ex, this.translate('error')) |
| | | } |
| | | }, |
| | | async clickPlanProhibitionRegion() { |
| | |
| | | ]) |
| | | } |
| | | } catch (ex) { |
| | | showError(ex) |
| | | showError(ex, this.translate('error')) |
| | | } |
| | | }, |
| | | |
| | |
| | | } |
| | | ]) |
| | | } 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 |
| | |
| | | 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() { |
| | | |
| | |
| | | } |
| | | } |
| | | }) |
| | | //this.stationDelete(this.stationEdit) |
| | | // const _this = this |
| | | // showModal("该站点已绑定任务,删除站点后绑定的任务会停止并删除", "是否确认删除?").then((res) => { |
| | | // if (res) { |
| | | |
| | | // } |
| | | // }) |
| | | }, |
| | | async stationAdd(item) { |
| | | try { |
| | | uni.showLoading({ |
| | | title: "正在新建站点" |
| | | title: this.translate("creating_station") |
| | | }) |
| | | await addStation(this.vehicleIp, item) |
| | | await updateStation(this.vehicleIp, item) |
| | |
| | | |
| | | |
| | | } catch (ex) { |
| | | showError(ex) |
| | | showError(ex, this.translate('error')) |
| | | } finally { |
| | | uni.hideLoading() |
| | | } |
| | |
| | | async stationUpdate(item) { |
| | | try { |
| | | uni.showLoading({ |
| | | title: "正在更新站点" |
| | | title: this.translate("updating_station") |
| | | }) |
| | | await updateStation(this.vehicleIp, item) |
| | | const curIndex = this.stationList.findIndex((a) => a.stationID == |
| | |
| | | } |
| | | |
| | | } catch (ex) { |
| | | showError(ex) |
| | | showError(ex, this.translate('error')) |
| | | } finally { |
| | | uni.hideLoading() |
| | | } |
| | |
| | | }]) |
| | | this.mapOperationType = '' |
| | | } catch (ex) { |
| | | showError(ex) |
| | | showError(ex, this.translate('error')) |
| | | } |
| | | }, |
| | | async stationDelete(item) { |
| | | try { |
| | | uni.showLoading({ |
| | | title: "正在删除站点" |
| | | title: this.translate("deleting_station") |
| | | }) |
| | | this.$refs.refPopupOperateStation.close() |
| | | await delStation(this.vehicleIp, [item.stationID]) |
| | |
| | | }]) |
| | | |
| | | } catch (ex) { |
| | | showError(ex) |
| | | showError(ex, this.translate('error')) |
| | | } finally { |
| | | uni.hideLoading() |
| | | } |
| | |
| | | |
| | | const name = this.stationEdit.name.trim() |
| | | if (!name) { |
| | | showToast("站点名称还未输入") |
| | | showToast(this.translate("input_station_name")) |
| | | return |
| | | } |
| | | this.loading = true |
| | |
| | | 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 |
| | |
| | | } |
| | | |
| | | } catch (ex) { |
| | | showError(ex) |
| | | showError(ex, this.translate('error')) |
| | | } finally { |
| | | this.loading = false |
| | | } |
| | |
| | | else |
| | | this.showClearName = false |
| | | }, |
| | | validateNumber(input) { |
| | | // 常用正则模式 |
| | | const patterns = { |
| | | integer: /^-?\d+$/, // 整数,包括负数 [citation:6] |
| | | positiveInt: /^[1-9]\d*$/, // 正整数 [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([{ |
| | |
| | | }, |
| | | |
| | | 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([{ |
| | |
| | | } |
| | | }]) |
| | | }, |
| | | |
| | | |
| | | clickClearStationX() { |
| | | this.stationEdit.x = 0 |
| | | this.ctxDataStr = JSON.stringify([{ |
| | |
| | | } |
| | | }]) |
| | | } 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) |
| | |
| | | |
| | | ]) |
| | | } catch (ex) { |
| | | showError(ex) |
| | | showError(ex, this.translate('error')) |
| | | } |
| | | }, |
| | | async loadTeachingMode() { |
| | | try { |
| | | const { |
| | | data |
| | | } = await getTeachingMode(this.vehicleIp) |
| | | } = await splitTeachingMode(this.vehicleIp) |
| | | return data || { |
| | | Public: [], |
| | | Stations: [] |
| | | } |
| | | |
| | | } catch (ex) { |
| | | showError(ex) |
| | | showError(ex, this.translate('error')) |
| | | return { |
| | | Public: [], |
| | | Stations: [] |
| | |
| | | this.ctxDataStr = JSON.stringify(list) |
| | | |
| | | } catch (ex) { |
| | | showError(ex) |
| | | showError(ex, this.translate('error')) |
| | | |
| | | } |
| | | }, |
| | |
| | | } |
| | | ]) |
| | | } catch (ex) { |
| | | showError(ex) |
| | | showError(ex, this.translate('error')) |
| | | } |
| | | }, |
| | | async refreshAgvPosition() { |
| | |
| | | } |
| | | }) |
| | | if (list.length > 0) { |
| | | this.curTeachingPathTime += 1 |
| | | this.curTeachingPathFlag = true |
| | | if (this.curTeachingPathTime % 5 == 0) { |
| | | const listStationCtxData = await this.getRefreshStationCtxData() || [] |
| | | if (listStationCtxData.length > 0) { |
| | | listCtrData.push(...listStationCtxData) |
| | | } |
| | | } |
| | | } else { |
| | | if (this.curTeachingPathFlag) { |
| | | this.curTeachingPathFlag = false |
| | | this.curTeachingPathTime = 0 |
| | | |
| | | const teaching = await this.loadTeachingMode() |
| | | |
| | | const publicOld = this.teachingMode.Public || [] |
| | |
| | | const stationAdd = [] |
| | | for (let i in publicNew) { |
| | | const item = publicNew[i] |
| | | const curIndex = publicOld.findIndex((a) => a.name == item.name) |
| | | console.log(curIndex, item) |
| | | const curIndex = publicOld.findIndex((a) => a.name == item.name && a.edge_name == |
| | | item.edge_name) |
| | | |
| | | if (curIndex < 0) { |
| | | publicAdd.push(item) |
| | | publicOld.push(item) |
| | |
| | | } |
| | | }) |
| | | } |
| | | const listStationCtxData = await this.getRefreshStationCtxData() || [] |
| | | if (listStationCtxData.length > 0) { |
| | | listCtrData.push(...listStationCtxData) |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | //setTimeout(this.refreshAgvPosition, 1000); |
| | | } catch (ex) { |
| | | // showError(ex).then((res) => { |
| | | // showError(ex,this.translate('error')).then((res) => { |
| | | |
| | | // }) |
| | | showToast(ex) |
| | |
| | | } |
| | | |
| | | }, |
| | | async getRefreshStationCtxData() { |
| | | try { |
| | | const listCtrData = [] |
| | | const listOld = this.stationList |
| | | const listId = listOld.map((a) => a.stationID) |
| | | const stationLst = await this.loadStations() |
| | | const listNew = stationLst.filter((a) => { |
| | | return !listId.includes(a.stationID) |
| | | }) |
| | | // console.log(listId.length,listNew.length,stationLst.length) |
| | | // console.log(listId) |
| | | if (listId.length + listNew.length > stationLst.length) { |
| | | const listId2 = stationLst.map((a) => a.stationID) |
| | | |
| | | askTeachingBiDirection(teachingMode) { |
| | | showModal("选择当前示教路线类型?", "示教结束", true, "双向路线", |
| | | "单向路线").then((res) => { |
| | | if (res) { |
| | | teachingMode.bidirection = "1" |
| | | } else { |
| | | teachingMode.bidirection = "0" |
| | | const listRemove = listOld.filter((a) => { |
| | | return !listId2.includes(a.stationID) |
| | | }) |
| | | if (listRemove.length > 0) { |
| | | listCtrData.push({ |
| | | method: "remove_station", |
| | | param: listRemove |
| | | }) |
| | | this.stationList = stationLst |
| | | } |
| | | } |
| | | teachingMode.teaching_flag = 0 |
| | | this.finishTeaching(teachingMode) |
| | | }) |
| | | if (listNew.length > 0) { |
| | | listCtrData.push({ |
| | | method: "add_station", |
| | | param: listNew |
| | | }) |
| | | this.stationList = stationLst |
| | | } |
| | | return listCtrData |
| | | } catch (ex) { |
| | | |
| | | showToast(ex) |
| | | return [] |
| | | } |
| | | }, |
| | | 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() |
| | | } |
| | |
| | | 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() |
| | |
| | | }, |
| | | 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 { |
| | |
| | | |
| | | |
| | | } catch (ex) { |
| | | showError(ex) |
| | | showError(ex, this.translate('error')) |
| | | } finally { |
| | | this.loading = false |
| | | } |
| | |
| | | |
| | | this.mapOperationStatus = "save" |
| | | try {} catch (ex) { |
| | | showError(ex) |
| | | showError(ex, this.translate('error')) |
| | | } |
| | | |
| | | }, |
| | |
| | | }, |
| | | 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 main_road = this |
| | | const mode_type = this |
| | | .teachingModeCur |
| | | .main_road |
| | | .mode_type |
| | | this.teachingModeCur = { |
| | | mode: "Public", |
| | | src_dst: ``, |
| | | name: "", |
| | | teaching_flag: 1, |
| | | main_road |
| | | mode_type |
| | | } |
| | | const res2 = |
| | | await teachingModeFlag( |
| | |
| | | } |
| | | |
| | | } 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 |
| | | } |
| | | |
| | | }, |
| | | async onTeachingModeMainRoad(val) { |
| | | async onTeachingModeType(val) { |
| | | try { |
| | | if (this.mapOperationStatus) { |
| | | |
| | | if (this.teachingModeCur.main_road == val) { |
| | | if (this.teachingModeCur.mode_type == val) { |
| | | return |
| | | } |
| | | this.teachingModeCur.teaching_flag = 0 |
| | | const oldName = this.teachingModeCur.name |
| | | await teachingModeFlag(this.vehicleIp, this.teachingModeCur) |
| | | this.teachingModeCur.main_road = val |
| | | this.teachingModeCur.mode_type = val |
| | | this.teachingModeCur.teaching_flag = 1 |
| | | this.teachingModeCur.mode = "Public" |
| | | this.teachingModeCur.name = "" |
| | | const res = await teachingModeFlag(this.vehicleIp, this.teachingModeCur) |
| | | if (val == 0) |
| | | const res = await teachingModeFlag(this.vehicleIp, this |
| | | .teachingModeCur) |
| | | if (val == 1) |
| | | showToast(this.translate("teaching_switched_bidirectional_mode")) |
| | | else if (val == 2) |
| | | showToast(this.translate("teaching_switched_intelligent_mode")) |
| | | else |
| | | showToast(this.translate("teaching_switched_default_mode")) |
| | | /*if (val == 0) |
| | | showToast( |
| | | "已将该路段路径保存为主路示教路线" |
| | | ) |
| | |
| | | |
| | | const { |
| | | data |
| | | } = await getTeachingMode(this.vehicleIp) |
| | | } = await splitTeachingMode(this.vehicleIp) |
| | | |
| | | const publicList = data.Public || [] |
| | | const curIndex = publicList.findIndex((a) => a.name == oldName) |
| | |
| | | }]) |
| | | |
| | | } |
| | | |
| | | */ |
| | | |
| | | } else { |
| | | this.teachingModeCur |
| | | .main_road = |
| | | val |
| | | this.teachingModeCur.mode_type = val |
| | | } |
| | | |
| | | } 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() { |
| | | this.$refs |
| | | .refPopupOperateTeaching |
| | | .close() |
| | | this.mapOperationType = |
| | | "edit_teaching" |
| | | this.ctxDataStr = JSON |
| | | .stringify([{ |
| | | method: "edit_teaching", |
| | | param: this.selectTeachingMode, |
| | | }]) |
| | | this.$refs.refPopupOperateTeaching.close() |
| | | this.$refs.refPopupTeachingUpdate.open("") |
| | | |
| | | // this.mapOperationType = |
| | | // "edit_teaching" |
| | | // this.ctxDataStr = JSON |
| | | // .stringify([{ |
| | | // method: "edit_teaching", |
| | | // param: this.selectTeachingMode, |
| | | // }]) |
| | | }, |
| | | radioTeachinMainRoadChange(evt) { |
| | | this.selectTeachingMode.main_road = evt.detail.value |
| | | }, |
| | | radioTeachinBidirectionChange(evt) { |
| | | this.selectTeachingMode.bidirection = evt.detail.value |
| | | }, |
| | | async dialogTeachingUpdateConfirm() { |
| | | try { |
| | | uni.showLoading({ |
| | | title: this.translate("teaching_updating") |
| | | }) |
| | | const item = this.selectTeachingMode |
| | | await updateSplitTeachingData(this.vehicleIp, item) |
| | | this.ctxDataStr = |
| | | JSON.stringify( |
| | | [{ |
| | | method: "update_teaching", |
| | | param: item, |
| | | }]) |
| | | this.selectTeachingMode = {} |
| | | showToast(this.translate("teaching_update_success")) |
| | | } catch (ex) { |
| | | showError(ex, this.translate('error')) |
| | | } finally { |
| | | uni.hideLoading() |
| | | } |
| | | }, |
| | | dialogTeachingUpdateClose() { |
| | | this.$refs.refPopupTeachingUpdate.close() |
| | | |
| | | }, |
| | | |
| | | async removeTeachingMode(item) { |
| | | try { |
| | | uni.showLoading({ |
| | | title: "删除示教中" |
| | | title: this.translate("teaching_deleting") |
| | | }) |
| | | await delTeachingMode(this.vehicleIp, [item]) |
| | | await deleteSplitTeachingData(this.vehicleIp, item |
| | | .edge_name, item.name) |
| | | //await delTeachingMode(this.vehicleIp, [item]) |
| | | this.ctxDataStr = |
| | | JSON.stringify( |
| | | [{ |
| | | method: "remove_teaching_path", |
| | | param: item, |
| | | }]) |
| | | showToast(this.translate("teaching_delete_success")) |
| | | } catch (ex) { |
| | | showError( |
| | | ex) |
| | | showError(ex, this.translate('error')) |
| | | } finally { |
| | | uni.hideLoading() |
| | | } |
| | |
| | | async removeTeachingModeData(data) { |
| | | try { |
| | | uni.showLoading({ |
| | | title: "删除示教数据中" |
| | | title: this.translate("teaching_data_deleting") |
| | | }) |
| | | await delTeachingModeData(this.vehicleIp, data) |
| | | 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; |
| | | }, |
| | | |
| | | } |
| | |
| | | .left { |
| | | display: flex; |
| | | flex-direction: column; |
| | | width: 180rpx; |
| | | width: 240rpx; |
| | | color: #aaa; |
| | | |
| | | .line { |
| | |
| | | |
| | | .text { |
| | | margin: auto; |
| | | white-space: nowrap; |
| | | |
| | | } |
| | | } |
| | |
| | | height: 32px; |
| | | line-height: 32px; |
| | | text-align: center; |
| | | box-shadow: 0px 2px 8px 0px #0000000C; |
| | | } |
| | | |
| | | .switch-button-checked { |
| | | box-shadow: 0px 2px 8px 0px #0000000C; |
| | | background-color: #fff; |
| | | color: #262626; |
| | | color: #1890FF; |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | background-color: transparent; |
| | | } |
| | | |
| | | .popup-dialog-content { |
| | | display: flex; |
| | | flex-direction: column; |
| | | |
| | | .popup-content-item { |
| | | padding: 10rpx; |
| | | } |
| | | } |
| | | |
| | | .popup-content-menu { |
| | | margin-top: 140rpx; |
| | | margin-left: 225rpx; |