.hbuilderx/launch.json
@@ -9,6 +9,13 @@ "openVueDevtools" : false, "playground" : "standard", "type" : "uni-app:app-android" } }, { "app-plus" : { "launchtype" : "local" }, "type" : "uniCloud" } ] } api/request.js
@@ -14,6 +14,7 @@ apiCount: { agv_state: 0, laser_data: 0, current_teaching:0 }, addLog(item) { if (!getApp().globalData.withLog) { @@ -30,18 +31,27 @@ } this.apiCount.agv_state = 1; } if (item.url.indexOf("laser_data") > 0) { if (ret.data?.base_map?.image_base64) { this.apiCount.laser_data++; } else { if (this.apiCount.laser_data % 20 != 0) { this.apiCount.laser_data++; return } this.apiCount.laser_data = 1; if (item.url.indexOf("get_current_teaching_data") > 0) { if (this.apiCount.current_teaching % 20 != 0) { this.apiCount.current_teaching++; return } this.apiCount.current_teaching = 1; } // if (item.url.indexOf("laser_data") > 0) { // if (ret.data?.base_map?.image_base64) { // this.apiCount.laser_data++; // } else { // if (this.apiCount.laser_data % 20 != 0) { // this.apiCount.laser_data++; // return // } // this.apiCount.laser_data = 1; // } // } const res = ret.data if (res) { if (item.url.indexOf("getMapUrl") > 0) { @@ -95,8 +105,8 @@ options.method = options.method || this.common.method; options.dataType = options.dataType || this.common.dataType; if (options.url.indexOf("get_agv_state") < 0 && options.url.indexOf("laser_data") < 0 && options.url.indexOf( "taskGroupStatus") < 0) { if (options.url.indexOf("get_agv_state") < 0 && options.url.indexOf("laser_data") < 0 && options.url.indexOf("taskGroupStatus") < 0 &&options.url.indexOf("get_current_teaching_data") < 0) { console.log("url", options.url, options.data) } return new Promise((resolve, reject) => { @@ -108,8 +118,8 @@ method: options.method, dataType: options.dataType, success: (result) => { if (options.url.indexOf("get_agv_state") < 0 && options.url.indexOf( "laser_data") < 0) { // if (options.url.indexOf("get_agv_state") < 0 && options.url.indexOf("laser_data") < 0 && options.url.indexOf("taskGroupStatus") < 0 &&options.url.indexOf("get_current_teaching_data") < 0) { // console.log("result", result) } api/vehicle.js
@@ -89,6 +89,7 @@ method: "GET", url, header, }) @@ -109,6 +110,8 @@ method: "GET", url, header, timeout: 5000, }) } comm/utils.js
@@ -66,7 +66,6 @@ if (!ex) return let tip = ex console.log(ex); if (typeof ex !== "string") { let exStr = JSON.stringify(ex) if (exStr == "{}") @@ -74,6 +73,7 @@ tip = typeof ex.errMsg == "string" ? ex.errMsg : typeof ex.msg == "string" ? ex.msg : typeof ex.message == "string" ? ex.message : exStr } console.log(ex,tip) //plus.nativeUI.alert(tip,title); return uni.showModal({ title: title || "", images/Frame_139.svg
images/Frame_153.svg
images/Frame_174.svg
images/Frame_178.svg
images/Frame_179.svg
images/Frame_180.svg
images/Frame_5.pngimages/image_15.pngimages/image_25.pngmanifest.json
@@ -2,8 +2,8 @@ "name" : "ES-GO", "appid" : "__UNI__C988375", "description" : "", "versionName" : "1.3.2", "versionCode" : 132, "versionName" : "1.3.6", "versionCode" : 136, "transformPx" : false, /* 5+App特有相关 */ "app-plus" : { @@ -47,7 +47,9 @@ "dSYMs" : false }, /* SDK配置 */ "sdkConfigs" : {} "sdkConfigs" : { "ad" : {} } } }, /* 快应用特有相关 */ package-lock.json
@@ -1,5 +1,5 @@ { "name": "地牛App", "name": "diniu", "lockfileVersion": 3, "requires": true, "packages": { pages.json
@@ -165,6 +165,12 @@ } }, { "path": "pages/station/delete", "style": { "navigationBarTitleText": "批量删除站点" } }, { "path": "pages/teaching/index", "style": { "navigationBarTitleText": "示教路线列表" pages/index/connect.vue
@@ -11,14 +11,14 @@ <view class="content" v-else-if="connectState == 2"> <view class="title">连接成功</view> <view class="content2"> <image class="img" src="/images/Frame 178.svg" alt=" 图片" /> <image class="img" src="/images/Frame_178.svg" alt=" 图片" /> <view>【{{connectedDevice}}】连接成功</view> </view> </view> <view class="content" v-else-if="connectState == 3"> <view class="title">连接失败</view> <view class="content2"> <image class="img" src="/images/Frame 179.svg" alt=" 图片" /> <image class="img" src="/images/Frame_179.svg" alt=" 图片" /> <view class="title">无法连接设备</view> <view>请确保车辆开机且未与其他终端配对</view> </view> @@ -29,7 +29,7 @@ <view>1、请将手机连接到‘{{ip}}’的Wifi网络</view> <view>2、连接后回到本应用</view> <image class="img-2" src="/images/Frame 180.svg" alt=" 图片" /> <image class="img-2" src="/images/Frame_180.svg" alt=" 图片" /> </view> </view> <view class="content" v-else> pages/index/detail.vue
@@ -6,16 +6,16 @@ <text class="uni-nav-bar-text">{{navigationBarTitle }}</text> </view> <template v-slot:right> <view class="uni-navbar-btn-text"> <a @click="clickSave" class="uni-nav-bar-right-text"> <view class="uni-navbar-btn-text" @click="clickSave"> <a class="uni-nav-bar-right-text"> 保存 </a> </view> </template> <template v-slot:left> <view class="uni-navbar-btn-text"> <a @click="clickCancel" class="uni-nav-bar-left-text"> <view class="uni-navbar-btn-text" @click="clickCancel"> <a class="uni-nav-bar-left-text"> 取消 </a> </view> @@ -26,7 +26,7 @@ <view class="group"> <view class="item line"> <view>名称:</view> <input class="input" v-model="vehicleName"> </input> <input class="input" v-model="vehicleName"/> </view> <view class="item line"> <view>ip地址:</view> pages/index/index.vue
@@ -20,63 +20,63 @@ <swiper v-if="pageList.length > 0" circular indicator-dots class="swiper" :current="currentPage" @change="changeSwiper"> <swiper-item v-for="(page,index) in pageList" class="swiper-item"> <view class="vehicle-header"> <view class="link-view"> <view v-if="page.link_status"> <!-- <image class="img-battery-charging" src="/images/bx_battery3.svg" alt="SVG 图片" /> --> <image class="img-battery-charging" src="/images/bx_battery2.svg" alt="SVG 图片" /> <image class="img-battery-soc" :style="{width:(page.soc*0.4)+'rpx'}" src="/images/bx_battery4.svg" alt="SVG 图片" /> <view class="vehicle-header"> <view class="link-view"> <view v-if="page.link_status"> <!-- <image class="img-battery-charging" src="/images/bx_battery3.svg" alt="SVG 图片" /> --> <image class="img-battery-charging" src="/images/bx_battery2.svg" alt="SVG 图片" /> <image class="img-battery-soc" :style="{width:(page.soc*0.4)+'rpx'}" src="/images/bx_battery4.svg" alt="SVG 图片" /> </view> <view v-else> <image class="img-battery" src="/images/bx_battery1.svg" alt="SVG 图片" /> </view> <template v-if="page.link_status"> <view class="soc-text">{{page.soc}}%</view> <view class="status-text">{{getAgvStateText(page)}}</view> </template> <view v-else class="gray-text">已离线</view> </view> </view> <image class="vehicle-img " :class="page.link_status ?'':'gray-image'" mode="aspectFit" src="/images/che.png" alt="图片" /> <view v-if="page.link_status" class="img-button-group"> <view type="primary" plain="true" class="img-text-button" @click="clickToMap(index,page)"> <a-button class="img-button" color='primary'> <text class="ico map" /> </a-button> <text>场景构建</text> </view> <view v-else> <image class="img-battery" src="/images/bx_battery1.svg" alt="SVG 图片" /> <view type="primary" class="img-text-button" @click="clickToTask(page)"> <a-button class="img-button" color='primary'> <text class="ico task-list" /> </a-button> <text>任务记录</text> </view> <template v-if="page.link_status"> <view class="soc-text">{{page.soc}}%</view> <view class="status-text">{{getAgvStateText(page)}}</view> </template> <view v-else class="gray-text">已离线</view> </view> </view> <image class="vehicle-img " :class="page.link_status ?'':'gray-image'" mode="aspectFit" src="/images/che.png" alt="图片" /> <view v-if="page.link_status" class="img-button-group"> <view type="primary" plain="true" class="img-text-button" @click="clickToMap(index,page)"> <a-button class="img-button" color='primary'> <text class="ico map" /> </a-button> <text>场景构建</text> <view v-else class="unlink-content"> <view class="content2" v-if="page.conntecting"> <view class="auto-circle"></view> <view class="text">连接中...</view> </view> <view class="content2" v-else> <view class="text"> 车辆已离线,请重新连接</view> <a-button type="primary" class="button" @click="clickRelink">重新连接 </a-button> </view> </view> <view type="primary" class="img-text-button" @click="clickToTask(page)"> <a-button class="img-button" color='primary'> <text class="ico task-list" /> </a-button> <text>任务记录</text> </view> </view> <view v-else class="unlink-content"> <view class="content2" v-if="page.conntecting"> <view class="auto-circle"></view> <view class="text">连接中...</view> </view> <view class="content2" v-else> <view class="text"> 车辆已离线,请重新连接</view> <a-button type="primary" class="button" @click="clickRelink">重新连接 </a-button> </view> </view> </swiper-item> <swiper-item class="swiper-item"> <swiper-item class="swiper-item"> <image class="title-img gray-image" src="/images/image 15.png" alt="图片" /> <image class="title-img gray-image" src="/images/image_15.png" alt="图片" /> <view class="button-group"> <a-button type="primary" class="button" @click="clickScanCode">扫描添加设备</a-button> <a-button type="ghost" class="button" @click="clickManualAdd">手动添加设备</a-button> @@ -85,7 +85,7 @@ </swiper> <view v-else class="no-page items-center"> <view class="content "> <image class="title-img gray-image" src="/images/image 15.png" alt="图片" /> <image class="title-img gray-image" src="/images/image_15.png" alt="图片" /> <view class="button-group"> <a-button type="primary" class="button" @click="clickScanCode">扫描添加设备</a-button> <a-button type="ghost" class="button" @click="clickManualAdd">手动添加设备</a-button> @@ -204,8 +204,13 @@ console.log("hide") }, computed: { tabList() { return [...this.pageList, { ip: "" }] } }, methods: { setData(obj) { let that = this; @@ -261,8 +266,10 @@ break } } this.pageList = [...list] this.setData({ pageList: list }) //this.pageList = [...list] } else { this.setData({ currentPage: curIndex @@ -302,11 +309,14 @@ page.soc = 0 page.link_status = false } this.pageList = [...list] } this.pageList = [...list] // this.pageList = [...list] } catch (ex) { showError(ex) // showError(ex) showToast(ex) } }, @@ -378,6 +388,7 @@ this.navigationBarTitle = "添加设备" else this.navigationBarTitle = this.pageList[this.currentPage].name this.loadVehicleBattery() }, async clickRelink() { try { @@ -484,10 +495,13 @@ pageList: list }) session.setValue("vehicles", list) if (list.length > 0) that.navigationBarTitle = that.pageList[that.currentPage].name else that.navigationBarTitle = "添加设备" // if (list.length > 0) // that.navigationBarTitle = that.pageList[that.currentPage].name // else // that.navigationBarTitle = "添加设备" uni.reLaunch({ url:"/pages/indde/index" }) }, update_vehicle: function(data) { console.log("update_vehicle", data) @@ -504,23 +518,26 @@ }, async clickToMap(index, page) { try { console.log("clicktomap") const _this = this // const res = await getAllScene(page.ip) || [] // const list = res?.sceneList || [] // if (list.length === 0) { // uni.navigateTo({ // url: `/pages/scene/index?ip=${page.ip}`, // events: { // // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据 // finish: function() { // _this.clickToMap(index, page) // }, // } // }) // return // } // getApp().globalData.sceneList = list const res = await getAllScene(page.ip) || [] const list = res?.sceneList || [] if (list.length === 0) { uni.navigateTo({ url: `/pages/map/scene?ip=${page.ip}`, events: { // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据 create_finish: function() { setTimeout(() => { _this.clickToMap(index, page) }, 500); }, } }) return } // getApp().globalData.sceneList = list uni.navigateTo({ url: `/pages/map/index?ip=${page.ip}`, @@ -538,7 +555,7 @@ } }, clickToTask( page) { clickToTask(page) { uni.navigateTo({ url: `/pages/task/log-list?ip=${page.ip}` @@ -599,24 +616,29 @@ showModal(`确定要删除设备“${ page.name}”吗`, "警告", true, "确定", "取消").then((res) => { if (res) { const list = this.pageList const curPage = this.currentPage let curPage = this.currentPage list.splice(this.currentPage, 1) this.setData({ currentPage: curPage, pageList: list }) // this.setData({ // currentPage: 0, // pageList: list // }) console.log(curPage, this.currentPage, this.pageList) session.setValue("vehicles", list) if (list.length > 0) this.navigationBarTitle = this.pageList[this.currentPage].name else this.navigationBarTitle = "添加设备" // if (list.length > 0) // this.navigationBarTitle = this.pageList[this.currentPage].name // else // this.navigationBarTitle = "添加设备" uni.reLaunch({ url: "/pages/index/index" }) } }) } else if (item.text == "备份") { const page = this.pageList[this.currentPage] uni.navigateTo({ url: `/pages/index/backup?ip=${page.ip}` }) } pages/map/index.vue
@@ -10,22 +10,22 @@ alt="SVG 图片" @click="clickShowMenu" /> </view> <template v-slot:left> <view> <uni-icons type="left" size="24" @click="clickBack"></uni-icons> <view @click="clickBack"> <uni-icons type="left" size="24"></uni-icons> </view> </template> <template v-slot:right> <!-- <template v-slot:right> <view v-if="sceneList.length > 0 && !mapOperationType"> <a @click="clickMore"> <uni-icons class="uni-panel-bar-icon" type="more-filled" size="24"></uni-icons> </a> </view> </template> </template> --> </uni-nav-bar> <view class="no-content" v-if="unlinked"> <image class="img" src="/images/image 25.png" alt=" 图片" mode="aspectFit" /> <image class="img" src="/images/image_25.png" alt=" 图片" mode="aspectFit" /> <view class="title">车辆连接失败</view> <view class="space">请检查你的网络设置或重新加载</view> </view> @@ -89,7 +89,7 @@ <view class="tip">请输入场景名称</view> <view class="name-input"> <input ref="refInputName" :focus="true" placeholder="请输入场景名称" :value="sceneInputName" @input="onInputName"></input> @input="onInputName" /> <uni-icons class="clear" color="#ccc" type="clear" size="20" v-if="sceneInputName" @click="clickClearName"></uni-icons> </view> @@ -108,14 +108,14 @@ <view class="coordinate"> <text class="name">横坐标:</text> <input ref="refInputX" class="number-input" type="number" :value="stationEdit.x" @input="onInputStationX" :maxlength="4"></input> @input="onInputStationX" :maxlength="4" /> <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"></input> @input="onInputStationY" :maxlength="4" /> <uni-icons class="clear" color="#ccc" type="clear" size="20" v-if="stationEdit.y&& stationEdit.y!='0'" @click="clickClearStationY"></uni-icons> </view> @@ -124,7 +124,7 @@ <view class="tip">调节朝向</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-pos" src="/images/Frame_153.svg" alt="SVG 图片" @touchstart="handleAngleTouchStart" @touchmove="handleAngleTouchMove" /> </view> </view> @@ -132,7 +132,7 @@ <view class="tip">请输入站点名称</view> <view class="name-input"> <input ref="refInputName" :focus="true" placeholder="输入站点名称" :value="stationEdit.name" @input="onInputStationName"></input> @input="onInputStationName" /> <uni-icons class="clear" color="#ccc" type="clear" size="20" v-if="stationEdit.name" @click="clickClearStationName"></uni-icons> </view> @@ -211,8 +211,8 @@ <view class="bottom-content" v-if="mapOperationStatus =='teaching'"> <view class="tip">路径记录中...</view> <view v-if="mapOperationType =='public_teaching'"> <view>正在记录搬运车行进路径,可随时切换主路/支路示教,完成后点按钮以结束示教。在示教过程中可以添加站点。</view> <view class="switch-type"> <view>正在记录搬运车行进路径,完成后点按钮以结束示教。在示教过程中可以添加站点。</view> <!-- <view class="switch-type">可随时切换主路/支路示教, <view class="switch-button-group"> <view class="switch-button" :class="teachingModeCur.main_road ==1?'switch-button-checked':''" @@ -221,7 +221,7 @@ :class="teachingModeCur.main_road ==0?'switch-button-checked':''" @click="onTeachingModeMainRoad(0)">支路示教</view> </view> </view> </view> --> </view> <view v-else> @@ -347,7 +347,7 @@ <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"> 批量删除</view> </view> <view type="text" class="button" @click.stop="clickStationPostion"> <text class="ico edit-line"></text> @@ -475,7 +475,8 @@ wallList: [], regionList: [], unlinked: false, showTeachingPathFlag: false, showTeachingPathFlag: true, curTeachingPathFlag: false, curMapInfo: { proportion: 1, img_proportion: 1, @@ -556,7 +557,7 @@ }, onBackPress() { this.isPageVisible = false this.isPageVisible = false if (this.destroyFlag) return false else { @@ -597,6 +598,10 @@ this.mapOperationType = '' const scene = this.sceneList[0] this.changeMap(scene) } else { uni.navigateBack({ delta: 1, //返回层数,2则上上页 }) } this.refreshAgvPosition() } catch (ex) { @@ -751,19 +756,26 @@ 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) } } this.ctxDataStr = JSON.stringify([{ listDataStr.push({ method: "teaching_finish", }]) }) this.ctxDataStr = JSON.stringify(listDataStr) this.mapOperationType = "" } }) @@ -776,11 +788,7 @@ } } else { // const eventChannel = this.getOpenerEventChannel(); // eventChannel.emit('udapte_station', this.unlinked); // uni.navigateBack({ // delta: 1 // }) const eventChannel = this.getOpenerEventChannel(); eventChannel.emit('check_connect', !this.unlinked); uni.navigateBack({ @@ -815,7 +823,7 @@ // this.mapOperationType = 'scene_create' // this.opSceneType = 'add_name' uni.navigateTo({ url: `/pages/map/scene?ip=${_this.vehicleIp}`, url: `/pages/map/scene?ip=${_this.vehicleIp}&opType=create`, events: { // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据 create_finish: function(data) { @@ -831,15 +839,13 @@ this.clickDelete() } } }, async loadAgvState() { try { const info = await getAgvState(this.vehicleIp) return info } catch (ex) { showError(ex) showToast(ex) return {} } }, @@ -848,7 +854,7 @@ const paths = await getCurrentTeachingData(this.vehicleIp) || [] return paths } catch (ex) { showError(ex) showToast(ex) return [] } }, @@ -913,7 +919,6 @@ img_x: parseInt(infoMap.img_x) || 1, img_y: parseInt(infoMap.img_y) || 1 } // getApp().globalData.curScene = infoMap this.setData({ bgProgressPercent: 30, bgLoading: infoMap.filedata ? true : false @@ -936,6 +941,12 @@ { method: "add_station", param: stationLst }, { method: "show_teaching_path", param: { show: this.showTeachingPathFlag } }, { method: "public_teaching_path", @@ -1017,6 +1028,9 @@ 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 = "" this.$refs.refPopupOperateStation.open("bottom") @@ -1043,6 +1057,9 @@ const angle = this.getStantardAngle(this.stationEdit.angle * 180 / Math.PI) this.angleSvg = `/static/images/angle${angle}.svg` if (this.mapOperationType == "teaching_add_station") { this.positioningAgv = true } this.clickStationPositonOk() } else if (param.type == "edit_teaching") { // console.log(param.type,JSON.stringify(param.data)) @@ -1090,7 +1107,7 @@ this.stationEdit.stationID = "" this.mapOperationType = "public_teaching" this.mapOperationStatus = "teaching" this.positioningAgv = true } else if (this.mapOperationType == "edit_station") { this.mapOperationType = "" this.mapOperationStatus = "" @@ -1112,12 +1129,10 @@ param: true }]) } } } else if (param.method == "select_teaching_path") { console.log("point", param.point) if (param.type == "station") { this.selectTeachingMode = { mode: "Stations", name: param.data?.name || "", @@ -1132,17 +1147,18 @@ point: param.point } } this.$refs.refPopupOperateTeaching.open("bottom") } else if (param.method == "cancel_positioning_agv") { this.positioningAgv = false if (this.mapOperationType == "public_teaching" && this.mapOperationStatus == "teaching") { this.positioningAgv = true } else this.positioningAgv = false } else if (param.method == "show_log") { const listLog = session.getValue("request_log") || [] listLog.unshift(param.data) session.setValue("request_log", listLog) } }, clickMapStation() { this.stationEdit = { @@ -1214,9 +1230,7 @@ async loadSceneList() { try { uni.showLoading({ title: "加载场景中" }) const _this = this const res = await getAllScene(this.vehicleIp) || [] const list = res?.sceneList || [] @@ -1232,25 +1246,27 @@ // sceneId: "", // navigationBarTitle: "地图" // }) uni.navigateTo({ url: `/pages/map/scene?ip=${this.vehicleIp}&opType=create`, events: { // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据 create_finish: function(data) { _this.onCreateSceneOk(data) }, } // uni.navigateTo({ // url: `/pages/map/scene?ip=${this.vehicleIp}`, // events: { // // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据 // create_finish: function(data) { // _this.onCreateSceneOk(data) // }, // } // }) uni.navigateBack({ delta: 1, //返回层数,2则上上页 }) return } } catch (ex) { showError(ex) } finally { uni.hideLoading() } } }, clickDelete() { const _this = this showModal(`删除场景[${this.sceneId}]会把场景对应的地图任务信息都会删除,是否确认删除?`, "删除场景").then(async (res) => { if (res) { try { @@ -1262,6 +1278,15 @@ 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) } finally { @@ -1431,14 +1456,23 @@ showToast("场景名称不能为空!") return } console.log(name, this.sceneId) // console.log(name, this.sceneId) if (name == this.sceneId) { showToast("场景名称未变化!") return } 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" @@ -1471,7 +1505,27 @@ this.mapOperationType = "" }, clickStationDelete() { this.stationDelete(this.stationEdit) const _this = this uni.navigateTo({ url: `/pages/station/delete?ip=${ this.vehicleIp}`, events: { // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据 delete_finish: function(data) { console.log(data) const list = data.map((a) => { return { stationID: a } }) _this.ctxDataStr = JSON.stringify([{ method: "remove_station", param: list }]) } } }) //this.stationDelete(this.stationEdit) // const _this = this // showModal("该站点已绑定任务,删除站点后绑定的任务会停止并删除", "是否确认删除?").then((res) => { // if (res) { @@ -1770,10 +1824,8 @@ return resAngle }, touchAngleChange(e) { let angle = 0 const ptX = e.touches[0].clientX const offX = ptX // ptX - e.target.offsetLeft @@ -1911,12 +1963,7 @@ show: this.showTeachingPathFlag } } // , { // method: "show_teaching_path", // param: { // show: this.showTeachingPathFlag // } // } ] if (finish) { list.push({ @@ -1979,40 +2026,110 @@ method: "update_agv_state", param: agv }] // if (this.mapOperationType === "public_teaching" && this.mapOperationStatus === // "teaching") { const list = await this.loadCurrentTeachingData() if (this.mapOperationType === "public_teaching" && this.mapOperationStatus === "teaching") { const list = await this.loadCurrentTeachingData() listCtrData.push({ method: "update_current_teaching", param: { main_road: this.teachingModeCur.main_road, pos_list: list listCtrData.push({ method: "update_current_teaching", param: { main_road: 1, //this.teachingModeCur.main_road, pos_list: list } }) if (list.length > 0) { this.curTeachingPathFlag = true } else { if (this.curTeachingPathFlag) { this.curTeachingPathFlag = false const teaching = await this.loadTeachingMode() const publicOld = this.teachingMode.Public || [] const stationOld = this.teachingMode.Stations || [] const publicNew = teaching.Public || [] const stationNew = teaching.Stations || [] const publicAdd = [] const stationAdd = [] for (let i in publicNew) { const item = publicNew[i] const curIndex = publicOld.findIndex((a) => a.name == item.name) console.log(curIndex, item) if (curIndex < 0) { publicAdd.push(item) publicOld.push(item) } } }) for (let i in stationNew) { const item = stationNew[i] const curIndex = stationOld.findIndex((a) => a.name == item.name) if (curIndex < 0) { stationAdd.push(item) stationOld.push(item) } } this.teachingMode.Public = publicOld this.teachingMode.Stations = stationOld if (publicAdd.length > 0) { listCtrData.push({ method: "public_teaching_path", param: { list: publicAdd, show: this.showTeachingPathFlag } }) } if (stationAdd.length > 0) { listCtrData.push({ method: "station_teaching_path", param: { list: stationAdd, show: this.showTeachingPathFlag } }) } } } // } if (this.positioningAgv) { listCtrData.push({ method: "move_pt_visible", param: { x: agv.x, y: agv.y, width: 80, height: 80, } }) if (this.curTeachingPathFlag) { listCtrData.push({ method: "move_pt_center", param: { x: agv.x, y: agv.y, } }) } else { listCtrData.push({ method: "move_pt_visible", param: { x: agv.x, y: agv.y, width: 80, height: 80, } }) } } this.ctxDataStr = JSON.stringify(listCtrData) } setTimeout(this.refreshAgvPosition, 1000); //setTimeout(this.refreshAgvPosition, 1000); } catch (ex) { showError(ex).then((res) => { setTimeout(this.refreshAgvPosition, 1000); }) // showError(ex).then((res) => { // }) showToast(ex) } finally { // 无论成功失败,1 秒后再来 setTimeout(this.refreshAgvPosition, 1000); } }, @@ -2044,7 +2161,6 @@ uni.hideLoading() } }, async clickTeachingStart() { const _this = this @@ -2082,6 +2198,16 @@ this.loading = true await delTeachingMode(_this.vehicleIp, [_this.teachingModeCur]) _this.mapOperationStatus = "" const listDataStr = [] listDataStr.push({ method: "remove_teaching_path", param: { name: _this.teachingModeCur.name, mode: "Public" }, }) _this.ctxDataStr = JSON.stringify(listDataStr) } catch (ex) { showError(ex) @@ -2090,8 +2216,7 @@ } } else { _this.mapOperationStatus = "save" _this.mapOperationStatus = "save" } }) @@ -2108,7 +2233,7 @@ clickTeachingFinish() { this.mapOperationType = "" this.reloadTeachingMode(true) //this.reloadTeachingMode(true) }, async teachingStart(mode) { @@ -2267,7 +2392,7 @@ async removeTeachingMode(item) { try { uni.showLoading({ title: "删除场景中" title: "删除示教中" }) await delTeachingMode(this.vehicleIp, [item]) this.ctxDataStr = @@ -2286,7 +2411,7 @@ async removeTeachingModeData(data) { try { uni.showLoading({ title: "删除场景数据中" title: "删除示教数据中" }) await delTeachingModeData(this.vehicleIp, data) this.reloadTeachingMode() pages/map/infos/scene-create.vue
@@ -1,7 +1,7 @@ <template> <view class="pages-map-scene-create"> <view class="scene-content" v-if="opSceneType =='' "> <image class="img" src="/images/image 25.png" alt=" 图片" mode="aspectFit" /> <image class="img" src="/images/image_25.png" alt=" 图片" mode="aspectFit" /> <view class="space">没有找到符合条件的地图</view> <view class="text-button-group"> <a-button type="primary" class="button" @click="clickStartConstructScene"> @@ -18,7 +18,7 @@ <view class="tip">请输入场景名称</view> <view class="name-input"> <input ref="refInputName" :focus="true" placeholder="请输入场景名称" :value="sceneName" @input="onInputName"></input> @input="onInputName"/> <uni-icons class="clear" color="#ccc" type="clear" size="20" v-if="showClearName" @click="clickClearName"></uni-icons> </view> pages/map/js/ctx.js
@@ -468,12 +468,18 @@ cantainerEl.addEventListener('touchend', function(e) { // _this.canvas._onMouseUp(e); // console.log('touchend:'); e.preventDefault(); // 阻止默认行为 _this.touchPoint = { x: 0, y: 0 }; if (_this.pressObjTimer) { clearTimeout(_this.pressObjTimer); _this.pressObjTimer = null } const activeObj = _this.canvas.getActiveObject() if (!activeObj) { // 处理结束事件 @@ -488,16 +494,13 @@ // _this.canvas.discardActiveObject(); // } } if (this.pressObjTimer) { clearTimeout(this.pressObjTimer); this.pressObjTimer = null } }); cantainerEl.addEventListener('touchcancel', function(e) { // console.log('touchcancel:'); if (this.pressObjTimer) { clearTimeout(this.pressObjTimer); this.pressObjTimer = null if (_this.pressObjTimer) { clearTimeout(_this.pressObjTimer); _this.pressObjTimer = null } }) @@ -522,6 +525,7 @@ const list = _this.canvas.getActiveObjects() if (list.length === 1) { if (!_this.objEditing) { this.pressObjTimer = setTimeout(function() { const zoom = _this.canvas.getZoom(); @@ -569,6 +573,7 @@ }); } }, 1000); // } let activeObj = list[0] if (activeObj.eleType == "region_pt_add") { @@ -812,7 +817,10 @@ if (obj instanceof fabric.Path || obj instanceof fabric.Line) { if (this.isPointOnStroke(obj, pointer, 1)) { if (objActive != obj) { if (this.pressObjTimer) { clearTimeout(this.pressObjTimer); this.pressObjTimer = null } this.canvas.discardActiveObject() this.canvas.setActiveObject(obj); this.canvas.requestRenderAll(); @@ -822,7 +830,10 @@ pointerList2.unshift(obj) } else { if (objActive != obj) { if (this.pressObjTimer) { clearTimeout(this.pressObjTimer); this.pressObjTimer = null } this.canvas.discardActiveObject() this.canvas.setActiveObject(obj); this.canvas.requestRenderAll(); @@ -835,7 +846,10 @@ if (pointerList2.length == 1) { const obj = pointerList2[0]; if (objActive != obj) { if (this.pressObjTimer) { clearTimeout(this.pressObjTimer); this.pressObjTimer = null } this.canvas.discardActiveObject() this.canvas.setActiveObject(obj); this.canvas.requestRenderAll(); @@ -848,7 +862,10 @@ const obj = pointerList[i]; if (this.isPointOnStroke(obj, pointer, 2)) { if (objActive != obj) { if (this.pressObjTimer) { clearTimeout(this.pressObjTimer); this.pressObjTimer = null } this.canvas.discardActiveObject() this.canvas.setActiveObject(obj); this.canvas.requestRenderAll(); @@ -862,7 +879,10 @@ if (pointerList2.length == 1) { const obj = pointerList2[0]; if (objActive != obj) { if (this.pressObjTimer) { clearTimeout(this.pressObjTimer); this.pressObjTimer = null } this.canvas.discardActiveObject() this.canvas.setActiveObject(obj); this.canvas.requestRenderAll(); @@ -875,7 +895,10 @@ const obj = pointerList[i]; if (this.isPointOnStroke(obj, pointer, 3)) { if (objActive != obj) { if (this.pressObjTimer) { clearTimeout(this.pressObjTimer); this.pressObjTimer = null } this.canvas.discardActiveObject() this.canvas.setActiveObject(obj); this.canvas.requestRenderAll(); @@ -889,7 +912,10 @@ if (pointerList2.length == 1) { const obj = pointerList2[0]; if (objActive != obj) { if (this.pressObjTimer) { clearTimeout(this.pressObjTimer); this.pressObjTimer = null } this.canvas.discardActiveObject() this.canvas.setActiveObject(obj); this.canvas.requestRenderAll(); @@ -902,7 +928,10 @@ const obj = pointerList[i]; if (this.isPointOnStroke(obj, pointer, 4)) { if (objActive != obj) { if (this.pressObjTimer) { clearTimeout(this.pressObjTimer); this.pressObjTimer = null } this.canvas.discardActiveObject() this.canvas.setActiveObject(obj); this.canvas.requestRenderAll(); @@ -916,7 +945,10 @@ const obj = pointerList2[pointerList2.length - 1]; if (objActive != obj) { if (this.pressObjTimer) { clearTimeout(this.pressObjTimer); this.pressObjTimer = null } this.canvas.discardActiveObject() this.canvas.setActiveObject(obj); this.canvas.requestRenderAll(); @@ -1202,7 +1234,7 @@ _this.$ownerInstance.callMethod('receiveRenderData', { method: "set_backgroud_progress", type: "error", msg:err msg: err }); console.error("图片加载失败", err) reject(new Error('图片加载失败')); @@ -1370,6 +1402,8 @@ // _this.canvas.renderAll() _this.workSpace = wsGroup const scale = _this.eleWidth / (4 * 84) _this.setZoomAuto(scale); // } //_this.checkMemoryUsage() resolve() @@ -1391,7 +1425,7 @@ strokeLineCap: 'butt', fill: "rgba(255,255,255,0)", }) let wsGroup = new fabric.Group([ rect], { let wsGroup = new fabric.Group([rect], { id: "workspace", eleType: "workspace", selectable: false, @@ -1400,11 +1434,13 @@ top: 0, width: _this.mapInfo.img_x, height: _this.mapInfo.img_y, }); _this.clearObjects() _this.canvas.add(wsGroup) _this.workSpace = wsGroup const scale = _this.eleWidth / (4 * 84) _this.setZoomAuto(scale); // resolve() }) @@ -1539,11 +1575,13 @@ clearTimeout(this.pressObjTimer); this.pressObjTimer = null } } if (Math.abs(deltaX) > 20 || Math.abs(deltaY) > 20) { this.$ownerInstance.callMethod('receiveRenderData', { method: "cancel_positioning_agv", }); } // 移动视口 const vpt = this.canvas.viewportTransform; this.canvas.relativePan(new fabric.Point(deltaX, deltaY)); @@ -1773,9 +1811,7 @@ } //console.log(scale, scaleAuto) this.setZoomAuto(scale, center) this.$ownerInstance.callMethod('receiveRenderData', { method: "cancel_positioning_agv", }); // console.log('多点移动 - 距离:', distance, '角度:', angle); // 多点移动逻辑 }, @@ -1886,7 +1922,7 @@ const left = _this.getXOnImg(info.x) // * scale const top = _this.getYOnImg(info.y) //* scale const angle = info.angle * 180 / Math.PI const angle = -(info.angle * 180 / Math.PI) fabric.loadSVGFromURL(svg).then( ({ objects, @@ -2018,7 +2054,8 @@ this.canvas.remove(this.curTeachingObj) this.curTeachingObj = null } if (teachingData.lenght === 0) return posArr.forEach((item) => { const curIndex = pos_list.findIndex((item2) => item2.x === item.x && item2.y === item.y) if (curIndex < 0) { @@ -2042,40 +2079,41 @@ y: this.getYOnImg(pt.y) } if (index > 0) { if ((index % 50 == 0 || index == len - 1 || index % 50 == 1)) { if (index % 50 == 0 || index == len - 1) { toX = pt2.x toY = pt2.y path2 += ` L${pt2.x} ${pt2.y}` // if ((index % 50 == 0 || index == len - 1 || index % 50 == 1)) { // if (index % 50 == 0 || index == len - 1) { // toX = pt2.x // toY = pt2.y // path2 += ` L${pt2.x} ${pt2.y}` // 计算各角度和对应的P2,P3坐标 let angle = (Math.atan2(fromY - toY, fromX - toX) * 180) / Math.PI, angle1 = ((angle + theta) * Math.PI) / 180, angle2 = ((angle - theta) * Math.PI) / 180, topX = headlen * Math.cos(angle1), topY = headlen * Math.sin(angle1), botX = headlen * Math.cos(angle2), botY = headlen * Math.sin(angle2); let arrowX = fromX - topX, arrowY = fromY - topY; arrowX = toX + topX; arrowY = toY + topY; path2 += " L " + arrowX + " " + arrowY; arrowX = toX + botX; arrowY = toY + botY; path2 += " M " + arrowX + " " + arrowY; path2 += " L " + toX + " " + toY; } } else { path2 += ` L${pt2.x} ${pt2.y}` } // // 计算各角度和对应的P2,P3坐标 // let angle = (Math.atan2(fromY - toY, fromX - toX) * 180) / Math.PI, // angle1 = ((angle + theta) * Math.PI) / 180, // angle2 = ((angle - theta) * Math.PI) / 180, // topX = headlen * Math.cos(angle1), // topY = headlen * Math.sin(angle1), // botX = headlen * Math.cos(angle2), // botY = headlen * Math.sin(angle2); // let arrowX = fromX - topX, // arrowY = fromY - topY; // arrowX = toX + topX; // arrowY = toY + topY; // path2 += " L " + arrowX + " " + arrowY; // arrowX = toX + botX; // arrowY = toY + botY; // path2 += " M " + arrowX + " " + arrowY; // path2 += " L " + toX + " " + toY; // } // } else { // path2 += ` L${pt2.x} ${pt2.y}` // } path2 += ` L${pt2.x} ${pt2.y}` } else { path2 = `M${pt2.x} ${pt2.y}` } fromX = pt2.x fromY = pt2.y } let strokeWidth = 1 let strokeWidth = 5 let stroke = "#95DE64" if (main_road == 1) { @@ -2132,72 +2170,73 @@ y: this.getYOnImg(pt.y) } if (index > 0) { if ((type == "public_teaching") && (index % 50 == 0 || index == len - 1 || index % 50 == 1)) { if (index % 50 == 1 || index == len - 1) { if (teachingData.bidirection == 1 && index < len - 1) { //- 1 toY = fromY toX = fromX fromX = pt2.x fromY = pt2.y let angle = (Math.atan2(fromY - toY, fromX - toX) * 180) / Math.PI, angle1 = ((angle + theta) * Math.PI) / 180, angle2 = ((angle - theta) * Math.PI) / 180, topX = headlen * Math.cos(angle1), topY = headlen * Math.sin(angle1), botX = headlen * Math.cos(angle2), botY = headlen * Math.sin(angle2); let arrowX = fromX - topX, arrowY = fromY - topY; arrowX = toX + topX; arrowY = toY + topY; let path3 = " L " + arrowX + " " + arrowY; arrowX = toX + botX; arrowY = toY + botY; path3 += " M " + arrowX + " " + arrowY; path3 += " L " + toX + " " + toY; // if ((type == "public_teaching") && (index % 50 == 0 || index == len - 1 || index % 50 == 1)) { // if (index % 50 == 1 || index == len - 1) { // if (teachingData.bidirection == 1 && index < len - 1) { //- 1 // toY = fromY // toX = fromX // fromX = pt2.x // fromY = pt2.y // let angle = (Math.atan2(fromY - toY, fromX - toX) * 180) / Math.PI, // angle1 = ((angle + theta) * Math.PI) / 180, // angle2 = ((angle - theta) * Math.PI) / 180, // topX = headlen * Math.cos(angle1), // topY = headlen * Math.sin(angle1), // botX = headlen * Math.cos(angle2), // botY = headlen * Math.sin(angle2); // let arrowX = fromX - topX, // arrowY = fromY - topY; // arrowX = toX + topX; // arrowY = toY + topY; // let path3 = " L " + arrowX + " " + arrowY; // arrowX = toX + botX; // arrowY = toY + botY; // path3 += " M " + arrowX + " " + arrowY; // path3 += " L " + toX + " " + toY; path2 += path3 fromY = toY fromX = toX } } if (index % 50 == 0 || index == len - 1) { toX = pt2.x toY = pt2.y // if (fromX == toX && fromY == toY) { // if (index - 2 >= 0) { // const pt3 = pos_list[index - 2] // fromX = this.getXOnImg(pt3.x), // fromY = this.getYOnImg(pt3.y) // } else { // continue; // } // } path2 += ` L${pt2.x} ${pt2.y}` // path2 += path3 // fromY = toY // fromX = toX // } // } // if (index % 50 == 0 || index == len - 1) { // toX = pt2.x // toY = pt2.y // // if (fromX == toX && fromY == toY) { // // if (index - 2 >= 0) { // // const pt3 = pos_list[index - 2] // // fromX = this.getXOnImg(pt3.x), // // fromY = this.getYOnImg(pt3.y) // // } else { // // continue; // // } // // } // path2 += ` L${pt2.x} ${pt2.y}` // 计算各角度和对应的P2,P3坐标 let angle = (Math.atan2(fromY - toY, fromX - toX) * 180) / Math.PI, angle1 = ((angle + theta) * Math.PI) / 180, angle2 = ((angle - theta) * Math.PI) / 180, topX = headlen * Math.cos(angle1), topY = headlen * Math.sin(angle1), botX = headlen * Math.cos(angle2), botY = headlen * Math.sin(angle2); let arrowX = fromX - topX, arrowY = fromY - topY; arrowX = toX + topX; arrowY = toY + topY; path2 += " L " + arrowX + " " + arrowY; arrowX = toX + botX; arrowY = toY + botY; path2 += " M " + arrowX + " " + arrowY; path2 += " L " + toX + " " + toY; } // console.log(`箭头 L${pt2.x} ${pt2.y}`) } else { // console.log(`点 L${pt2.x} ${pt2.y} ${index} == ${len-1}`) path2 += ` L${pt2.x} ${pt2.y}` } // // 计算各角度和对应的P2,P3坐标 // let angle = (Math.atan2(fromY - toY, fromX - toX) * 180) / Math.PI, // angle1 = ((angle + theta) * Math.PI) / 180, // angle2 = ((angle - theta) * Math.PI) / 180, // topX = headlen * Math.cos(angle1), // topY = headlen * Math.sin(angle1), // botX = headlen * Math.cos(angle2), // botY = headlen * Math.sin(angle2); // let arrowX = fromX - topX, // arrowY = fromY - topY; // arrowX = toX + topX; // arrowY = toY + topY; // path2 += " L " + arrowX + " " + arrowY; // arrowX = toX + botX; // arrowY = toY + botY; // path2 += " M " + arrowX + " " + arrowY; // path2 += " L " + toX + " " + toY; // } // // console.log(`箭头 L${pt2.x} ${pt2.y}`) // } else { // // console.log(`点 L${pt2.x} ${pt2.y} ${index} == ${len-1}`) // path2 += ` L${pt2.x} ${pt2.y}` // } path2 += ` L${pt2.x} ${pt2.y}` } else { main_road = pt.main_road if (main_road == 1) { @@ -2213,13 +2252,20 @@ // console.log("addTeachingPath",path2) // path2 += " Z" let strokeWidth = 1 let strokeWidth = 2 let stroke = "#95DE64" if (type == "station_teaching") { stroke = "#69C0FF" } else { if (main_road == 1) { stroke = "#69C0FF" if (teachingData.bidirection == 1) { stroke = "#FF00FF" } } else { if (teachingData.bidirection == 1) { stroke = "#ffaa00" } } } let list = this.canvas.getObjects() || [] @@ -2461,7 +2507,7 @@ // const scale = this.getAutoScale() const left = _this.getXOnImg(info.x) // * scale const top = _this.getYOnImg(info.y) //* scale const angle = info.angle * 180 / Math.PI const angle = -(info.angle * 180 / Math.PI) + 90 if (obj) { obj.set({ left, @@ -3028,7 +3074,7 @@ this.canvas.remove(obj) }, updateAgvLaser(param) { const angle = param.angle - Math.PI / 2 // * 180 / Math.PI const angle = -param.angle //- Math.PI / 2 // * 180 / Math.PI const pt = { x: this.getXOnImg(param.x), y: this.getYOnImg(param.y) @@ -3066,7 +3112,7 @@ id: "agv_laser_angle", eleType: "agv_laser_angle", stroke: "#00aa00", strokeWidth: 2, strokeWidth: 1, lockRotation: true, lockScalingX: true, lockScalingY: true, @@ -3325,7 +3371,7 @@ } else { // _this.canvas.remove(list[curIndex]) const curStationObj = list[curIndex] const angle = station.angle * 180 / Math.PI const angle = -station.angle * 180 / Math.PI //const scale = this.getAutoScale() const left = this.getXOnImg(station.x) //* scale const top = this.getYOnImg(station.y) //* scale @@ -3360,6 +3406,7 @@ } else if (item.method == "remove_station") { const stationList = item.param || [] this.canvas.discardActiveObject() let list = _this.canvas.getObjects() || [] list = list.filter((a) => a.eleType == "station") @@ -3536,6 +3583,7 @@ _this.showTeachingPath(_this.showTeachPathFlag ? true : false) } else if (item.method == "clear_teaching_path") { this.canvas.discardActiveObject() let list = _this.canvas.getObjects() || [] list = list.filter((a) => a.eleType == "public_teaching" || a.eleType == "station_teaching") @@ -3575,6 +3623,7 @@ _this.showTeachingPath(item.param.show) } else if (item.method == "remove_teaching_path") { this.canvas.discardActiveObject() let list = _this.canvas.getObjects() || [] if (item.param.mode == "Public") { list = list.filter((a) => a.eleType == "public_teaching") @@ -3648,6 +3697,7 @@ } } else if (item.method == "remove_wall") { const wallList = item.param || [] this.canvas.discardActiveObject() let list = _this.canvas.getObjects() || [] list = list.filter((a) => a.eleType == "virtual_wall") for (let i2 in wallList) { @@ -3659,6 +3709,7 @@ } } else if (item.method == "remove_region") { const regionList = item.param || [] this.canvas.discardActiveObject() let list = _this.canvas.getObjects() || [] list = list.filter((a) => a.eleType == "region") for (let i2 in regionList) { pages/map/scene.vue
@@ -1,7 +1,7 @@ <template> <view class="pages-scene"> <view class="map-content" v-if="opSceneType =='' "> <image v-if="opType != 'extend'" class="img" src="/images/image 25.png" alt=" 图片" mode="aspectFit" /> <image v-if="opType != 'extend'" class="img" src="/images/image_25.png" alt=" 图片" mode="aspectFit" /> <image v-else class="img" :src="extendBase64Img" alt=" 图片" mode="aspectFit" /> <view v-if="opType != 'extend'" class="space">没有找到符合条件的地图</view> <!-- <view class="loading-view">{{mapserverIsOk?"构图程序准备就绪":"等待构图程序就绪..."}} @@ -29,7 +29,7 @@ <view class="tip">请输入场景名称</view> <view class="name-input"> <input ref="refInputName" :focus="true" placeholder="请输入场景名称" :value="sceneName" @input="onInputName"></input> @input="onInputName" /> <uni-icons class="clear" color="#ccc" type="clear" size="20" v-if="showClearName" @click="clickClearName"></uni-icons> </view> @@ -51,13 +51,13 @@ </view> </view> <view class="bottom-content" v-else-if="opSceneType =='finish'"> <view class="tip">场景构建完成</view> <view>已成功构建“{{sceneName}}”</view> <!-- <view class="loading-view">{{saveMapIsOk?"构图保存完成":"等待构图保存完成..."}} <view class="tip"> “{{sceneName}}”{{opType == "extend"?"场景扩展完成"+"":"场景构建完成"}}</view> <!-- <view> 已成功构建“{{sceneName}}”</view> --> <view class="loading-view">{{saveMapIsOk?"构图保存完成":"等待构图保存完成..."}} <view v-if="!saveMapIsOk" class="auto-circle"></view> </view> !saveMapIsOk ||--> </view> <view class="text-button-group"> <a-button type="primary" class="button" :disabled=" loading" @click="clickFinish">构建完成</a-button> <a-button type="primary" class="button" :disabled=" !saveMapIsOk || loading" @click="clickFinish">{{opType == "extend"?"扩展完成":"构建完成"}}</a-button> </view> </view> </view> @@ -124,6 +124,7 @@ }, onLoad(option) { console.log("scene load") const _this = this this.ip = option.ip || "" uni.getSystemInfo({ @@ -139,7 +140,7 @@ }, onUnload() { console.log("scene unload") }, onBackPress() { @@ -360,7 +361,7 @@ } } else if (param.method == "cancel_positioning_agv") { this.positioningAgv = false //this.positioningAgv = false } else if (param.method == "show_log") { const listLog = session.getValue("request_log") || [] listLog.unshift(param.data) @@ -474,15 +475,16 @@ await stopMap(this.ip, this.sceneName) // await startOrStopMapServer(this.ip, 2) // this.checkSaveMapState(); if (this.opType == "extend") { this.opSceneType = "" const eventChannel = this.getOpenerEventChannel(); eventChannel.emit('create_finish', this.sceneName); uni.navigateBack({ delta: 1, //返回层数,2则上上页 }) } // if (this.opType == "extend") { // this.opSceneType = "" // const eventChannel = this.getOpenerEventChannel(); // eventChannel.emit('create_finish', this.sceneName); // uni.navigateBack({ // delta: 1, //返回层数,2则上上页 // }) // } setTimeout(() => {this.saveMapIsOk = true}, 5000); } catch (ex) { console.log(ex) showModal("请检查车辆连接,并重新开始构建场景", "场景构建失败", false, "确定").then((res) => { @@ -522,7 +524,7 @@ const info = await getMapLaserData(this.ip, this.mapId) return info } catch (ex) { showError(ex) showToast(ex) return {} } }, @@ -531,15 +533,15 @@ if (this.opSceneType === "scan") { const data = await this.loadMapLaserData() const listCtrData = [] let newMap = false if (data.base_map?.image_base64) { this.robotPos = {} newMap = true const mapData = data.base_map.image_base64 //this.mapId ?"terdy": const mapData = data.base_map.image_base64 //this.mapId ?"terdy": this.mapId = data.base_map.map_id listCtrData.push({ method: "background", param: { pages/map/task.vue
@@ -1,7 +1,7 @@ <template> <view class="pages-map-task"> <view class="no-content" v-if="unlinked"> <image class="img" src="/images/image 25.png" alt=" 图片" mode="aspectFit" /> <image class="img" src="/images/image_25.png" alt=" 图片" mode="aspectFit" /> <view class="title">车辆连接失败</view> <view class="space">请检查你的网络设置或重新加载</view> </view> pages/map/teaching.vue
@@ -122,7 +122,7 @@ <view class="tip">请输入站点名称</view> <view class="name-input"> <input ref="refInputName" :focus="true" placeholder="输入站点名称" :value="stationEdit.name" @input="onInputStationName"></input> @input="onInputStationName"/> <uni-icons class="clear" color="#ccc" type="clear" size="20" v-if="stationEdit.name" @click="clickClearStationName"></uni-icons> </view> @@ -138,14 +138,14 @@ <view class="coordinate"> <text class="name">横坐标:</text> <input ref="refInputX" class="number-input" type="number" :value="stationEdit.x" @input="onInputStationX" :maxlength="4"></input> @input="onInputStationX" :maxlength="4"/> <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"></input> @input="onInputStationY" :maxlength="4"/> <uni-icons class="clear" color="#ccc" type="clear" size="20" v-if="stationEdit.y&& stationEdit.y!='0'" @click="clickClearStationY"></uni-icons> </view> @@ -154,7 +154,7 @@ <view class="tip">调节朝向</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-pos" src="/images/Frame_153.svg" alt="SVG 图片" @touchstart="handleAngleTouchStart" @touchmove="handleAngleTouchMove" /> </view> </view> pages/my/log.vue
@@ -2,7 +2,7 @@ <view class="pages-my-log"> <view class="top"> <view class="input"> <input placeholder="请输入查找接口URL" v-model="keyMethod"></input> <input placeholder="请输入查找接口URL" v-model="keyMethod"/> <uni-icons class="clear" color="#ccc" type="clear" size="20" v-if="keyMethod" @click="clickClearKey"></uni-icons> </view> pages/station/delete.vue
New file @@ -0,0 +1,241 @@ <template> <view class="pages-station-delete"> <view class="uni-list"> <checkbox-group @change="checkboxChange"> <label class="list-item" v-for="item in stationList" :key="item.stationID"> <view> <checkbox :value="item.stationID" :checked="item.checked" /> </view> <view> <view class="item-title">{{item.name}}</view> <view class="item-text"> 角度:{{Math.round(item.angle *180/3.14)}},坐标({{Math.round(Number(item.x)*100)/100}},{{Math.round(Number(item.y)*100)/100}}) </view> </view> </label> </checkbox-group> </view> <view class="bottom"> <checkbox :checked="checkedAll" @click="onSelectAll">全选</checkbox> <view class="button-group"> <a-button type="primary" class="button" @click="clickDelelte">删除</a-button> </view> </view> </view> </template> <script> import { showToast, showModal, session, showError, showInfo } from "@/comm/utils.js" import { Button } from 'antd-mobile-vue-next' import { stations, delStation } from "@/api/vehicle.js" export default { name: "PagesStationDelete", components: { 'a-button': Button }, data() { return { ip: "", checkedAll: false, stationList: [], keyMethod: "", listDel: [] } }, onLoad(option) { this.ip = option.ip || "" this.loadData() }, onBackPress() { const eventChannel = this.getOpenerEventChannel(); eventChannel.emit('delete_finish', this.listDel); }, methods: { async loadData() { try { this.stationList = await this.loadStations() || [] } catch (ex) { showError(ex) } }, async loadStations() { try { const info = await stations(this.ip) return info.station_list || [] } catch (ex) { showError(ex) return [] } }, checkboxChange(e) { var items = this.stationList const values = e.detail.value; for (var i = 0, lenI = items.length; i < lenI; ++i) { const item = items[i] if (values.includes(item.stationID)) { this.$set(item, 'checked', true) } else { this.$set(item, 'checked', false) } } }, onSelectAll() { this.checkedAll = !this.checkedAll var items = this.stationList console.log(this.checkedAll) for (let i in items) { const item = items[i] this.$set(item, 'checked', this.checkedAll) } }, clickDelelte() { const _this = this var items = this.stationList const list = [] for (var i = 0; i < items.length; ++i) { const item = items[i] if (item.checked) { list.push(item.stationID) } } if (list.length === 0) { showInfo("未选择站点!") return } showModal("删除选择的站点", "是否确认删除?").then((res) => { if (res) { _this.stationDelete(list) } }) }, async stationDelete(list) { try { uni.showLoading({ title: "正在删除站点" }) await delStation(this.ip, list) this.stationList = await this.loadStations() || [] this.listDel.push(...list) showToast("删除站点成功") } catch (ex) { showError(ex) } finally { uni.hideLoading() } }, } } </script> <style lang="scss"> .pages-station-delete { display: flex; width: 750rpx; height: 100vh; flex-direction: column; background-color: #F5F5F5; .uni-list { flex: 1; overflow-y: auto; width: 730rpx; margin: 10rpx; border-radius: 10px; background-color: #fff; .list-item { display: flex; flex-direction: row; padding: 10rpx; border-bottom: 1px solid #ddd; // justify-content: center; align-items: center; .item-title { font-size: 32rpx; padding: 10rpx 20rpx; } .item-text { font-size: 28rpx; color: #888; padding: 10rpx 20rpx; } } .list-item:first-child { /* 右下角 */ border-top-right-radius: 10px; } .list-item:last-child { border-bottom: 0; border-bottom-right-radius: 10px; /* 右下角 */ } } .bottom { margin: 10rpx; width: 730rpx; display: flex; flex-direction: row; align-items: center; .button-group { flex: 1; display: flex; justify-content: center; align-items: center; flex-direction: column; font-size: 30rpx !important; .am-button { border-radius: 30px; } .button { width: 300rpx; } } } } </style> pages/station/index.vue
@@ -45,7 +45,7 @@ <view class="tip">请输入站点名称</view> <view class="name-input"> <input ref="refInputName" :focus="true" placeholder="输入站点名称" :value="stationEdit.name" @input="onInputName"></input> @input="onInputName"/> <uni-icons class="clear" color="#ccc" type="clear" size="20" v-if="showClearName" @click="clickClearName"></uni-icons> </view> @@ -60,19 +60,19 @@ <view class="coordinate"> <text class="name">横坐标:</text> <input ref="refInputX" class="number-input" type="number" :value="stationEdit.x" @input="onInputX"></input> @input="onInputX"/> </view> <view class="coordinate"> <text class="name">竖坐标:</text> <input ref="refInputX" class="number-input" type="number" :value="stationEdit.y" @input="onInputY"></input> @input="onInputY"/> </view> </view> <view class="tip">调节朝向</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-pos" src="/images/Frame_153.svg" alt="SVG 图片" @touchstart="handleAngleTouchStart" @touchmove="handleAngleTouchMove" /> </view> <a-button type="primary" class="button" @click="clickPosOK">完成</a-button> @@ -113,7 +113,7 @@ showError, showInfo } from "@/comm/utils.js" // import OIFabric from "@/components/oi-fabric/index.vue" import { Button } from 'antd-mobile-vue-next' pages/task/add.vue
@@ -65,13 +65,15 @@ <a @click.stop="(e)=>{ clickPathwayPoint(e,index,'actionType')}"> {{actionTypeText(item.actionType)}} </a> <view v-if="item.actionType === 3"> <template class="time" v-if="item.actionType === 3"> <a @click.stop="()=>{item.wait = 0}" v-if="item.wait===undefined"> 等待时间 </a> <view v-else class="time"> <input class="input" type="number" v-model="item.wait" :maxlength="4" />秒</view> </view> <input v-else class="input" type="number" v-model="item.wait" :maxlength="4" /> </template> <span v-if="item.actionType === 3 && item.wait!==undefined"> 秒 </span> </view> <template v-slot:right> <view class="btn-del" @click="clickDelPathWay(index)">删除</view> @@ -133,7 +135,7 @@ taskGroupName: "", cycleTime: 1, taskButton: 0, tasktype:1 tasktype: 1 }, pathwayList: [{}], pickerView: { @@ -220,8 +222,12 @@ showToast("未选择任务属性!") return } if (!this.info.taskButton) { showToast("未选择按钮号!") return } uni.showLoading({ title:"任务新增中" title: "任务新增中" }) const taskList = [] const task = { @@ -234,8 +240,13 @@ } const taskStartTimeStamp = `${new Date().getTime()}` this.pathwayList.forEach((item) => { for (let i in this.pathwayList) { const item = this.pathwayList[i] if (item.stationID) { if (!item.actionType) { showToast("目标点未选择操作类型!") return } task.taskList.push({ stationID: item.stationID, actionType: item.actionType || 0, @@ -251,13 +262,15 @@ }) } }) } if (taskList.length == 0) { showToast("目标点未选择站台!") showToast("必须添加至少一个目标点!") return } await addTask(this.ip, task) task.taskList = taskList const eventChannel = this.getOpenerEventChannel(); eventChannel.emit('add_task', task); @@ -266,8 +279,7 @@ }) } catch (ex) { showError(ex) } finally { } finally { uni.hideLoading() } }, @@ -290,7 +302,7 @@ } if (flag) { showModal(`当前编辑的内容将不会被保存`, "确定要退出编辑吗?",true,"确定","取消").then((res) => { showModal(`当前编辑的内容将不会被保存`, "确定要退出编辑吗?", true, "确定", "取消").then((res) => { if (res) { uni.navigateBack({ delta: 1, //返回层数,2则上上页 @@ -519,6 +531,7 @@ padding: 20rpx 10rpx; display: flex; flex-direction: row; align-items: center; .right { flex: 1; @@ -549,15 +562,12 @@ margin-left: 20rpx; } .time { display: flex; flex-direction: row; .input { margin-left: 20rpx; .input { width: 75rpx; } margin-right: 10rpx; width: 75rpx; } } .btn-del { pages/task/infos/task-item.vue
@@ -106,7 +106,7 @@ taskCycleTime() { if (this.taskIsRun) return `第${this.taskStatus?.curCycleNumber || 0}/${this.taskStatus?.cycleTotleNumber || 0}次` return `第${this.taskStatus?.curCycleNumber || 0}/${this.taskStatus?.cycleTotalNumber || 0}次` else return `重复${this.taskData.cycleTime || 0}次` pages/task/list.vue
@@ -184,13 +184,14 @@ try { if (this.isPageVisible) await this.checkTaskGroupStatus() setTimeout(this.timerCheckTaskGroupStatus, 1000); // setTimeout(this.timerCheckTaskGroupStatus, 1000); } catch (ex) { showError(ex).then((res)=>{ setTimeout(this.timerCheckTaskGroupStatus, 1000); }) showToast(ex) // showError(ex).then((res)=>{ // setTimeout(this.timerCheckTaskGroupStatus, 1000); // }) } finally { setTimeout(this.timerCheckTaskGroupStatus, 1000); } }, async checkTaskGroupStatus() { @@ -220,7 +221,7 @@ } catch (ex) { this.taskStatus = {} showError(ex) showToast(ex) } }, setTaskGroupStatus(cmdID) { pages/task/update.vue
@@ -6,8 +6,8 @@ <text class="uni-nav-bar-text">{{navigationBarTitle }}</text> </view> <template v-slot:right> <view class="uni-navbar-btn-text"> <a @click="clickSave" class="uni-nav-bar-right-text"> <view class="uni-navbar-btn-text" @click="clickSave"> <a class="uni-nav-bar-right-text"> 保存 </a> </view> @@ -64,13 +64,15 @@ <a @click.stop="(e)=>{ clickPathwayPoint(e,index,'actionType')}"> {{actionTypeText(item.actionType)}} </a> <view v-if="item.actionType === 3"> <template class="time" v-if="item.actionType === 3"> <a @click.stop="()=>{item.wait = 0}" v-if="item.wait===undefined"> 等待时间 </a> <view v-else class="time"> <input class="input" type="number" v-model="item.wait" :maxlength="4" />秒</view> </view> <input v-else class="input" type="number" v-model="item.wait" :maxlength="4" /> </template> <span v-if="item.actionType === 3 && item.wait!==undefined"> 秒 </span> </view> </view> </view> @@ -179,13 +181,12 @@ } this.info = info let list = info.taskList || [] for (let i = 0; i < list.length; i++) { const item = list[i] this.pathwayList.push({ actionType: item.actionType, dest: item.dest || {}, wait: parseInt(item.wait) || 0, wait: parseInt(item.wait) || 0, taskID: item.taskID, taskStartTimeStamp: item.taskStartTimeStamp, }) @@ -246,7 +247,7 @@ return } uni.showLoading({ title:"任务更新中" title: "任务更新中" }) const task = { taskGroupID: this.form.taskGroupID, @@ -262,12 +263,13 @@ const item2 = this.info.taskList[i] const item = this.pathwayList[i] let flag = false if (item?.actionType != item2.actionType) { flag = true } else if (item?.dest?.stationID != item2.dest?.stationID) { flag = true } else { if (item?.actionType == 1) { if (item?.actionType == 3) { if (item?.wait != item2.wait) { flag = true } @@ -304,8 +306,7 @@ }) } catch (ex) { showError(ex) } finally { } finally { uni.hideLoading() } }, @@ -342,7 +343,7 @@ if (flag) { showModal(`当前编辑的内容将不会被保存`, "确定要退出编辑吗?",true,"确定","取消").then((res) => { showModal(`当前编辑的内容将不会被保存`, "确定要退出编辑吗?", true, "确定", "取消").then((res) => { if (res) { uni.navigateBack({ delta: 1, //返回层数,2则上上页 @@ -599,6 +600,7 @@ padding: 20rpx 10rpx; display: flex; flex-direction: row; align-items: center; .right { flex: 1; @@ -607,9 +609,6 @@ padding-right: 5px; } .right-input { text-align: right; flex: 1; @@ -629,15 +628,11 @@ margin-left: 20rpx; } .time { display: flex; flex-direction: row; margin-left: 20rpx; .input { width: 75rpx; } } margin-left: 20rpx; width: 75rpx; margin-right: 10rpx; } } .btn-del { static/images/station.svg
@@ -1,11 +1,6 @@ <svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg"> <rect width="36" height="36" rx="18" fill="#90D3FF"/> <g clip-path="url(#clip0_647_7172)"> <path d="M11.7515 17.0488C11.5265 16.8238 11.4001 16.5186 11.4001 16.2004C11.4001 15.8822 11.5265 15.577 11.7515 15.352L17.1515 9.95199C17.3765 9.72702 17.6817 9.60065 17.9999 9.60065C18.3181 9.60065 18.6233 9.72702 18.8483 9.95199L24.2483 15.352C24.4669 15.5783 24.5878 15.8814 24.5851 16.1961C24.5824 16.5107 24.4562 16.8117 24.2337 17.0342C24.0112 17.2567 23.7102 17.3829 23.3956 17.3856C23.0809 17.3883 22.7778 17.2674 22.5515 17.0488L19.1999 13.8004L19.1999 25.2004C19.1999 25.5187 19.0735 25.8239 18.8484 26.0489C18.6234 26.274 18.3181 26.4004 17.9999 26.4004C17.6816 26.4004 17.3764 26.274 17.1514 26.0489C16.9263 25.8239 16.7999 25.5187 16.7999 25.2004L16.7999 13.8004L13.4483 17.0488C13.2233 17.2738 12.9181 17.4001 12.5999 17.4001C12.2817 17.4001 11.9765 17.2738 11.7515 17.0488Z" fill="#0050B2"/> </g> <defs> <clipPath id="clip0_647_7172"> <rect width="18" height="18" fill="white" transform="translate(9 27) rotate(-90)"/> </clipPath> </defs> <path d="M18.9517 11.7517C19.1767 11.5268 19.4819 11.4004 19.8001 11.4004C20.1183 11.4004 20.4235 11.5268 20.6485 11.7517L26.0485 17.1517C26.2735 17.3768 26.3998 17.6819 26.3998 18.0001C26.3998 18.3183 26.2735 18.6235 26.0485 18.8485L20.6485 24.2485C20.4222 24.4671 20.1191 24.5881 19.8044 24.5853C19.4898 24.5826 19.1888 24.4564 18.9663 24.2339C18.7438 24.0114 18.6176 23.7105 18.6149 23.3958C18.6122 23.0812 18.7331 22.7781 18.9517 22.5517L22.2001 19.2001H10.8001C10.4818 19.2001 10.1766 19.0737 9.95157 18.8487C9.72653 18.6236 9.6001 18.3184 9.6001 18.0001C9.6001 17.6819 9.72653 17.3766 9.95157 17.1516C10.1766 16.9266 10.4818 16.8001 10.8001 16.8001H22.2001L18.9517 13.4485C18.7267 13.2235 18.6004 12.9183 18.6004 12.6001C18.6004 12.2819 18.7267 11.9768 18.9517 11.7517Z" fill="#0050B2"/> </svg> static/map.pngBinary files differ