| | |
| | | v-model:opSceneType="opSceneType" @create-ok="onCreateSceneOk"></SceneCreateInfo> --> |
| | | <view class="map-content" v-show="mapOperationType !='scene_create'"> |
| | | <view class="content"> |
| | | <view class="fabric" :message="ctxDataStr" :change:message="ctx.receiveMsg" id="canvasMap"></view> |
| | | <view ref="canvasCtx" class="fabric" id="canvasMap" :message="ctxDataStr" |
| | | :change:message="ctx.receiveMsg"> |
| | | </view> |
| | | <view class="loading-overlay" v-if="bgLoading"> |
| | | <view class="loading-content"> |
| | | <view class="loading-spinner"></view> |
| | |
| | | </view> |
| | | </template> |
| | | <script src="./js/ctx.js" module="ctx" lang="renderjs"></script> |
| | | |
| | | |
| | | <script> |
| | | import { |
| | | ref |
| | | } from "vue"; |
| | | import { |
| | | showToast, |
| | | showModal, |
| | |
| | | list: [] |
| | | }, |
| | | sceneList: [], |
| | | |
| | | ctxDataStr: "[]", |
| | | mapOperationType: "", |
| | | mapOperationStatus: "", |
| | |
| | | img_x: 1, |
| | | img_y: 1 |
| | | }, |
| | | positioningAgv: false |
| | | positioningAgv: false, |
| | | isPageVisible: true, |
| | | destroyFlag: false, |
| | | } |
| | | }, |
| | | computed: { |
| | |
| | | }, |
| | | onHide() { |
| | | this.isPageVisible = false |
| | | |
| | | }, |
| | | onUnload() { |
| | | async onUnload() { |
| | | |
| | | this.isPageVisible = false |
| | | |
| | | console.log("onUnload") |
| | | |
| | | |
| | | }, |
| | | onBackPress() { |
| | | this.isPageVisible = false |
| | | if (this.destroyFlag) |
| | | return false |
| | | else { |
| | | this.ctxDataStr = JSON.stringify([{ |
| | | method: "destroy", |
| | | }]) |
| | | return true |
| | | } |
| | | |
| | | }, |
| | | |
| | | methods: { |
| | | setData(obj) { |
| | | let that = this; |
| | |
| | | }, |
| | | |
| | | clickShowMenu() { |
| | | // const list = [...this.sceneList] |
| | | // for(let i =0; i < 20;i++){ |
| | | // list.push("test" + i) |
| | | // } |
| | | this.menuPopup = { |
| | | type: "scene", |
| | | list: this.sceneList, |
| | |
| | | // this.mapOperationType = 'scene_create' |
| | | // this.opSceneType = 'add_name' |
| | | uni.navigateTo({ |
| | | url: `/pages/map/scene?ip=${this.vehicleIp}`, |
| | | url: `/pages/map/scene?ip=${_this.vehicleIp}`, |
| | | events: { |
| | | // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据 |
| | | create_finish: function(data) { |
| | |
| | | }, |
| | | { |
| | | method: "public_teaching_path", |
| | | param: this.teachingMode.Public || [] |
| | | param: { |
| | | list: this.teachingMode.Public || [], |
| | | show: this.showTeachingPathFlag |
| | | } |
| | | |
| | | }, |
| | | { |
| | | method: "station_teaching_path", |
| | | param: this.teachingMode.Stations || [] |
| | | param: { |
| | | list: this.teachingMode.Stations || [], |
| | | show: this.showTeachingPathFlag |
| | | } |
| | | |
| | | }, |
| | | { |
| | |
| | | |
| | | receiveRenderData(param) { |
| | | console.log('接收到视图层的数据:', param); |
| | | if (param.method == "set_backgroud_progress") { |
| | | if (param.method === "destroy_complete") { |
| | | if (param.param) { |
| | | this.destroyFlag = true |
| | | uni.navigateBack({ |
| | | delta: 1 |
| | | }) |
| | | } |
| | | } else if (param.method == "set_backgroud_progress") { |
| | | if (param.type == "start") { |
| | | this.setData({ |
| | | bgProgressPercent: 50, |
| | |
| | | this.mapOperationType = "edit_map" |
| | | }, |
| | | clickExtendMap() { |
| | | const _this = this |
| | | uni.navigateTo({ |
| | | url: `/pages/map/scene?ip=${this.vehicleIp}&opType=extend&sceneId=${this.sceneId}`, |
| | | events: { |
| | |
| | | }, |
| | | async loadSceneList() { |
| | | try { |
| | | |
| | | uni.showLoading({ |
| | | title: "加载场景中" |
| | | }) |
| | |
| | | } |
| | | } |
| | | }, |
| | | async reloadTeachingMode() { |
| | | async reloadTeachingMode(finish) { |
| | | try { |
| | | this.teachingMode = await this.loadTeachingMode() |
| | | this.ctxDataStr = JSON.stringify([{ |
| | | |
| | | const list = [{ |
| | | method: "clear_teaching_path", |
| | | }, |
| | | { |
| | | method: "public_teaching_path", |
| | | param: this.teachingMode.Public || [] |
| | | param: { |
| | | list: this.teachingMode.Public || [], |
| | | show: this.showTeachingPathFlag |
| | | } |
| | | }, |
| | | { |
| | | method: "station_teaching_path", |
| | | param: this.teachingMode.Stations || [] |
| | | }, { |
| | | method: "show_teaching_path", |
| | | param: { |
| | | list: this.teachingMode.Stations || [], |
| | | show: this.showTeachingPathFlag |
| | | } |
| | | } |
| | | ]) |
| | | // , { |
| | | // method: "show_teaching_path", |
| | | // param: { |
| | | // show: this.showTeachingPathFlag |
| | | // } |
| | | // } |
| | | ] |
| | | if (finish) { |
| | | list.push({ |
| | | method: "teaching_finish", |
| | | }) |
| | | } |
| | | this.ctxDataStr = JSON.stringify(list) |
| | | |
| | | } catch (ex) { |
| | | showError(ex) |
| | |
| | | param: { |
| | | x: agv.x, |
| | | y: agv.y, |
| | | width:80, |
| | | height:80, |
| | | width: 80, |
| | | height: 80, |
| | | } |
| | | }) |
| | | |
| | |
| | | }, |
| | | clickTeachingFinish() { |
| | | this.mapOperationType = "" |
| | | this.ctxDataStr = JSON.stringify([{ |
| | | method: "teaching_finish", |
| | | }]) |
| | | this.reloadTeachingMode() |
| | | |
| | | this.reloadTeachingMode(true) |
| | | |
| | | }, |
| | | async teachingStart(mode) { |
| | |
| | | ) |
| | | if (res?.name) |
| | | this.teachingModeCur.name = res.name |
| | | |
| | | const { |
| | | data |
| | | } = await getTeachingMode(this.vehicleIp) |
| | | |
| | | const publicList = data.Public || [] |
| | | const curIndex = publicList.findIndex((a)=>a.name == oldName) |
| | | |
| | | if(curIndex > -1) |
| | | { |
| | | this.ctxDataStr = JSON.stringify([{ |
| | | method: "public_teaching_path", |
| | | param: [publicList[curIndex]] |
| | | } ]) |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | const { |
| | | data |
| | | } = await getTeachingMode(this.vehicleIp) |
| | | |
| | | const publicList = data.Public || [] |
| | | const curIndex = publicList.findIndex((a) => a.name == oldName) |
| | | |
| | | if (curIndex > -1) { |
| | | this.ctxDataStr = JSON.stringify([{ |
| | | method: "public_teaching_path", |
| | | param: { |
| | | list: [publicList[curIndex]], |
| | | show: true |
| | | } |
| | | }]) |
| | | |
| | | } |
| | | |
| | | |
| | | } else { |
| | | this.teachingModeCur |
| | | .main_road = |
| | |
| | | margin-top: 140rpx; |
| | | margin-left: 225rpx; |
| | | width: 300rpx; |
| | | max-height: 50vh; |
| | | overflow: auto; |
| | | align-items: center; |
| | | justify-content: center; |
| | | flex-direction: column; |