| | |
| | | // "Content-Type": "application/json;charset=UTF-8" |
| | | // }, |
| | | method: "GET", |
| | | dataType: "json" |
| | | dataType: "json", |
| | | |
| | | }, |
| | | addLog(item) { |
| | | const list = session.getValue("request_log") || [] |
| | |
| | | return |
| | | } |
| | | list.unshift(item) |
| | | if (list.length > 1000) { |
| | | if (list.length > 512) { |
| | | const oldItem = list.pop() |
| | | if (oldItem.data_key) { |
| | | const maxData = session.getValue("request_log_max_data") || {} |
| | |
| | | options.method = options.method || this.common.method; |
| | | options.dataType = options.dataType || this.common.dataType; |
| | | |
| | | if(options.url.indexOf("get_agv_state") < 0) |
| | | if(options.url.indexOf("get_agv_state") < 0 && options.url.indexOf("laser_data") < 0) |
| | | { |
| | | console.log("url", options.url, options.data) |
| | | } |
| | |
| | | method: options.method, |
| | | dataType: options.dataType, |
| | | success: (result) => { |
| | | if(options.url.indexOf("get_agv_state") < 0) |
| | | if(options.url.indexOf("get_agv_state") < 0 && options.url.indexOf("laser_data") < 0) |
| | | { |
| | | console.log("result", result) |
| | | } |
| | |
| | | } else { |
| | | |
| | | reject({ |
| | | msg: ret.msg || "" |
| | | msg: ret.msg || ret.message|| "" |
| | | }); |
| | | } |
| | | }, |
| | |
| | | }) |
| | | } |
| | | |
| | | export function showToast(title, icon) { |
| | | uni.showToast({ |
| | | title: title, |
| | | icon: icon ? icon : 'none' |
| | | }) |
| | | export function showToast(ex) { |
| | | if (!ex) |
| | | return |
| | | let tip = ex |
| | | // console.log(ex); |
| | | if (typeof ex !== "string") { |
| | | let exStr = JSON.stringify(ex) |
| | | if (exStr == "{}") |
| | | exStr = ex |
| | | tip = typeof ex.errMsg == "string" ? ex.errMsg : typeof ex.msg == "string" ? ex.msg : typeof ex.message == |
| | | "string" ? ex.message : exStr |
| | | } |
| | | plus.nativeUI.toast(tip, { |
| | | duration: "short", |
| | | verticalAlign: "center" |
| | | }); |
| | | // uni.showToast({ |
| | | // title: title, |
| | | // icon: icon ? icon : 'none' |
| | | // }) |
| | | } |
| | | export function showInfo(ex){ |
| | | if( !ex) |
| | | return |
| | | let tip =ex |
| | | console.log(ex); |
| | | if( typeof ex !== "string" ) |
| | | { |
| | | // console.log(ex); |
| | | if (typeof ex !== "string") { |
| | | let exStr = JSON.stringify(ex) |
| | | if (exStr == "{}") |
| | | exStr = ex |
| | | tip = typeof ex.errMsg == "string" ? ex.errMsg :typeof ex.message == "string" ? ex.message: exStr |
| | | tip = typeof ex.errMsg == "string" ? ex.errMsg : typeof ex.msg == "string" ? ex.msg : typeof ex.message == |
| | | "string" ? ex.message : exStr |
| | | } |
| | | plus.nativeUI.toast(tip , {duration:"short"}); |
| | | // plus.nativeUI.toast(tip, { |
| | | // duration: "short", |
| | | // verticalAlign:"center" |
| | | // }); |
| | | return uni.showModal({ |
| | | title: "提示", |
| | | content: tip, |
| | | showCancel: false |
| | | }); |
| | | } |
| | | |
| | | export function showError(ex, title = "错误") { |
| | | if (!ex) |
| | | return |
| | | let tip = ex |
| | | console.log(ex); |
| | | if (typeof ex !== "string") { |
| | | let exStr = JSON.stringify(ex) |
| | | if (exStr == "{}") |
| | | exStr = ex |
| | | tip = typeof ex.errMsg == "string" ? ex.errMsg : typeof ex.msg == "string" ? ex.msg : typeof ex.message == |
| | | "string" ? ex.message : exStr |
| | | } |
| | | //plus.nativeUI.alert(tip,title); |
| | | return uni.showModal({ |
| | | title: title || "", |
| | | content: tip, |
| | | showCancel: false |
| | | }); |
| | | } |
| | | export function showLoading(title) { |
| | | |
| | | |
| | | uni.showLoading({ |
| | | title: title, |
| | | mask: true |
| | | }) |
| | | |
| | | } |
| | | |
| | | |
| | | export function hexToRGBA(hex, alpha) { |
| | | const r = parseInt(hex.slice(1, 3), 16); |
| | | const g = parseInt(hex.slice(3, 5), 16); |
| | |
| | | "name" : "ES-GO", |
| | | "appid" : "__UNI__C988375", |
| | | "description" : "", |
| | | "versionName" : "1.2.6", |
| | | "versionCode" : 126, |
| | | "versionName" : "1.2.9", |
| | | "versionCode" : 129, |
| | | "transformPx" : false, |
| | | /* 5+App特有相关 */ |
| | | "app-plus" : { |
| | |
| | | "dependencies": { |
| | | "ant-design-vue": "^4.0.0-rc.6", |
| | | "antd-mobile-vue-next": "^0.1.0-16", |
| | | "dayjs": "^1.11.13", |
| | | "fabric": "^6.6.7", |
| | | "rxjs": "^7.8.2", |
| | | "uuid": "^11.1.0" |
| | |
| | | } |
| | | }, |
| | | "node_modules/dayjs": { |
| | | "version": "1.11.13", |
| | | "resolved": "https://registry.npmmirror.com/dayjs/-/dayjs-1.11.13.tgz", |
| | | "integrity": "sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg==", |
| | | "version": "1.11.18", |
| | | "resolved": "https://registry.npmmirror.com/dayjs/-/dayjs-1.11.18.tgz", |
| | | "integrity": "sha512-zFBQ7WFRvVRhKcWoUh+ZA1g2HVgUbsZm9sbddh8EC5iv93sui8DVVz1Npvz+r6meo9VKfa8NyLWBsQK1VvIKPA==", |
| | | "license": "MIT" |
| | | }, |
| | | "node_modules/debounce": { |
| | |
| | | "dependencies": { |
| | | "ant-design-vue": "^4.0.0-rc.6", |
| | | "antd-mobile-vue-next": "^0.1.0-16", |
| | | "dayjs": "^1.11.13", |
| | | "fabric": "^6.6.7", |
| | | "rxjs": "^7.8.2", |
| | | "uuid": "^11.1.0" |
| | |
| | | "navigationBarTitleText": "地图" |
| | | } |
| | | }, |
| | | { |
| | | "path": "pages/map/edit", |
| | | "style": { |
| | | "navigationBarTitleText": "编辑地图" |
| | | } |
| | | }, |
| | | |
| | | { |
| | | "path": "pages/map/teaching", |
| | | "style": { |
| | |
| | | session, |
| | | showToast, |
| | | showModal, |
| | | showInfo |
| | | showInfo, |
| | | showError |
| | | } from "@/comm/utils.js" |
| | | import { |
| | | getAllScene, |
| | |
| | | |
| | | console.log(this.pageList[1].list) |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | async loadScene() { |
| | |
| | | const list = res?.sceneList || [] |
| | | return list |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | return [] |
| | | } |
| | | }, |
| | |
| | | const list = session.getValue("scene_db") || [] |
| | | return list |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | return [] |
| | | } |
| | | }, |
| | |
| | | this.setData({ |
| | | loading: true |
| | | }) |
| | | uni.showLoading({ |
| | | title:"正在上传场景" |
| | | }) |
| | | const scene = this.pageList[0].list[index] |
| | | await handoffScene(this.ip, "", scene) |
| | | session.setValue("scene_db", []) |
| | |
| | | session.setValue("scene_db", list) |
| | | this.pageList[1].list = list |
| | | this.sceneIndex2 = -1 |
| | | this.setData({ |
| | | loading: false |
| | | }) |
| | | showToast(`上传场景[${scene}]成功`) |
| | | } catch (ex) { |
| | | showInfo(ex) |
| | | showError(ex) |
| | | |
| | | } |
| | | finally { |
| | | this.setData({ |
| | | loading: false |
| | | }) |
| | | |
| | | uni.hideLoading() |
| | | } |
| | | |
| | | }, |
| | |
| | | this.setData({ |
| | | loading: true |
| | | }) |
| | | console.log(this.pageList[1].list[index]) |
| | | uni.showLoading({ |
| | | title:"正在下载场景" |
| | | }) |
| | | |
| | | const data = this.pageList[1].list[index].data |
| | | const scene = this.pageList[1].list[index].name |
| | | await saveDBData(this.ip, data) |
| | | this.pageList[0].list.push(scene) |
| | | this.setData({ |
| | | loading: false |
| | | }) |
| | | showToast(`下载场景[${scene}]成功`) |
| | | |
| | | } catch (ex) { |
| | | showInfo(ex) |
| | | showError(ex) |
| | | } |
| | | finally { |
| | | this.setData({ |
| | | loading: false |
| | | }) |
| | | uni.hideLoading() |
| | | } |
| | | |
| | | }, |
| | | |
| | | showError(ex) { |
| | | let exStr = JSON.stringify(ex) |
| | | if (exStr == "{}") |
| | | exStr = ex |
| | | let tip = typeof ex.msg == "string" ? ex.msg : exStr |
| | | showModal(tip, "错误", false, "确定") |
| | | }, |
| | | |
| | | } |
| | | } |
| | | </script> |
| | |
| | | import { |
| | | session, |
| | | showToast, |
| | | showModal |
| | | showModal, |
| | | showError, |
| | | showInfo |
| | | } from "@/comm/utils.js" |
| | | import { |
| | | Button |
| | |
| | | |
| | | |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | checkConnectStatus() { |
| | |
| | | const result = res.result || "" |
| | | const arCode = result.split(";") |
| | | if (arCode.length != 3) { |
| | | this.showError("无效的二维码!") |
| | | showInfo("无效的二维码!") |
| | | return |
| | | } |
| | | if (!arCode[0].trim() || !arCode[0].trim()) { |
| | | this.showError("无效的二维码!") |
| | | showInfo("无效的二维码!") |
| | | return |
| | | } |
| | | that.ip = arCode[0] |
| | |
| | | } catch (ex) { |
| | | console.log("connectVehicle faile",this.ip,ex) |
| | | this.connectState = 3 |
| | | // this.showError(ex) |
| | | // showError(ex) |
| | | } |
| | | }, |
| | | |
| | |
| | | }, 2000) |
| | | }) |
| | | }, |
| | | showError(ex) { |
| | | let exStr = JSON.stringify(ex) |
| | | if (exStr == "{}") |
| | | exStr = ex |
| | | let tip = typeof ex.msg == "string" ? ex.msg : exStr |
| | | showModal(tip, "错误", false,"确定") |
| | | }, |
| | | |
| | | } |
| | | } |
| | | </script> |
| | |
| | | <script> |
| | | import { |
| | | showToast, |
| | | showModal |
| | | showModal, |
| | | showError, |
| | | showInfo |
| | | } from "@/comm/utils.js" |
| | | import { |
| | | Button |
| | |
| | | const info = await shellVersion(this.vehicleIp) |
| | | this.car_version = info.software_version |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | clickDelete() { |
| | |
| | | delta: 1 |
| | | }) |
| | | }, |
| | | showError(ex) { |
| | | let exStr = JSON.stringify(ex) |
| | | if (exStr == "{}") |
| | | exStr = ex |
| | | let tip = typeof ex.msg == "string" ? ex.msg : exStr |
| | | showModal(tip, "错误", false,"确定") |
| | | }, |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | import { |
| | | session, |
| | | showToast, |
| | | showModal |
| | | showModal, |
| | | showError, |
| | | showInfo |
| | | } from "@/comm/utils.js" |
| | | import { |
| | | getAllScene, |
| | |
| | | } |
| | | } catch (ex) { |
| | | |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | |
| | |
| | | this.pageList = [...list] |
| | | |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | |
| | | }, |
| | |
| | | } |
| | | } |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | async checkConnectSuccess(ip) { |
| | |
| | | } |
| | | }) |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | |
| | | }, |
| | |
| | | url: `/pages/index/backup?ip=${page.ip}` |
| | | }) |
| | | } |
| | | }, |
| | | showError(ex) { |
| | | let exStr = JSON.stringify(ex) |
| | | if (exStr == "{}") |
| | | exStr = ex |
| | | let tip = typeof ex.msg == "string" ? ex.msg : exStr |
| | | showModal(tip, "错误", false, "确定") |
| | | }, |
| | | closeMenu() { |
| | | this.$refs.refPopupMenu.close() |
| | |
| | | showToast, |
| | | showModal, |
| | | session, |
| | | showError, |
| | | showInfo |
| | | } from "@/comm/utils.js" |
| | | // import OIFabric from "@/components/oi-fabric/index.vue" |
| | | import { |
| | |
| | | img_x: 1, |
| | | img_y: 1 |
| | | }, |
| | | positioningAgv: false |
| | | } |
| | | }, |
| | | computed: { |
| | |
| | | this.setData({ |
| | | unlinked: true |
| | | }) |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | |
| | |
| | | |
| | | showModal("已记录的路径将会被删除。", "是否要退出示教?").then(async (res) => { |
| | | if (res) { |
| | | if (mapOperationStatus == 'end' || mapOperationStatus == 'save') { |
| | | if (this.mapOperationStatus == 'end' || this.mapOperationStatus == |
| | | 'save') { |
| | | try { |
| | | await delTeachingMode(this.vehicleIp, [_this.teachingModeCur]) |
| | | await delTeachingMode(this.vehicleIp, [this.teachingModeCur]) |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | |
| | | } |
| | |
| | | const info = await getAgvState(this.vehicleIp) |
| | | return info |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | return {} |
| | | } |
| | | }, |
| | |
| | | const paths = await getCurrentTeachingData(this.vehicleIp) || [] |
| | | return paths |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | return [] |
| | | } |
| | | }, |
| | |
| | | const info = await stations(this.vehicleIp) |
| | | return info.station_list || [] |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | return [] |
| | | } |
| | | }, |
| | |
| | | const info = await getMapUrl(this.vehicleIp, id) |
| | | return info |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | return {} |
| | | } |
| | | }, |
| | |
| | | try { |
| | | this.setData({ |
| | | bgProgressPercent: 0, |
| | | bgLoading: true |
| | | }) |
| | | const infoAgv = await this.loadAgvState() |
| | | const stationLst = await this.loadStations() |
| | | |
| | | const infoMap = await this.loadMapInfo(id) |
| | | this.curMapInfo = { |
| | | proportion: infoMap.proportion || 1, |
| | | img_proportion: infoMap.img_proportion || 1, |
| | | max_x: infoMap.max_x || 1, |
| | | max_y: infoMap.max_y || 1, |
| | | min_x: infoMap.min_x || 0, |
| | | min_y: infoMap.min_y || 0, |
| | | img_x: infoMap.img_x || 1, |
| | | img_y: infoMap.img_y || 1 |
| | | proportion: parseInt(infoMap.proportion) || 1, |
| | | img_proportion: parseInt(infoMap.img_proportion) || 1, |
| | | max_x: parseInt(infoMap.max_x) || 1, |
| | | max_y: parseInt(infoMap.max_y) || 1, |
| | | min_x: parseInt(infoMap.min_x) || 0, |
| | | min_y: parseInt(infoMap.min_y) || 0, |
| | | img_x: parseInt(infoMap.img_x) || 1, |
| | | img_y: parseInt(infoMap.img_y) || 1 |
| | | } |
| | | // getApp().globalData.curScene = infoMap |
| | | this.setData({ |
| | |
| | | |
| | | }, |
| | | { |
| | | method: "move_canvas", |
| | | method: "move_pt_center", |
| | | param: { |
| | | x: infoAgv.x, |
| | | y: infoAgv.y |
| | | } |
| | | } |
| | | ]) |
| | | this.positioningAgv = true |
| | | this.mapShowAgv = true |
| | | } catch (ex) { |
| | | this.setData({ |
| | | bgProgressPercent: 0, |
| | | bgLoading: false |
| | | }) |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | |
| | |
| | | } |
| | | |
| | | this.$refs.refPopupOperateTeaching.open("bottom") |
| | | } else if (param.method == "cancel_positioning_agv") { |
| | | 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() { |
| | |
| | | mode: "Public", |
| | | main_road: 1, |
| | | } |
| | | this.positioningAgv = true |
| | | this.mapOperationType = "public_teaching" |
| | | this.ctxDataStr = JSON.stringify([{ |
| | | method: "set_selectable", |
| | | param: false, |
| | | }, { |
| | | method: "public_teaching", |
| | | }]) |
| | | |
| | |
| | | } |
| | | |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } finally { |
| | | uni.hideLoading() |
| | | } |
| | |
| | | if (this.sceneList.length > 0) |
| | | this.changeMap(this.sceneList[0]) |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } finally { |
| | | uni.hideLoading() |
| | | } |
| | |
| | | param: [this.regionEdit] |
| | | }, |
| | | { |
| | | method: "move_canvas", |
| | | method: "move_pt_center", |
| | | param: { |
| | | x: agv.x, |
| | | y: agv.y |
| | |
| | | ]) |
| | | } |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | async clickPlanProhibitionRegion() { |
| | |
| | | param: [this.regionEdit] |
| | | }, |
| | | { |
| | | method: "move_canvas", |
| | | method: "move_pt_center", |
| | | param: { |
| | | x: agv.x, |
| | | y: agv.y |
| | |
| | | ]) |
| | | } |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | |
| | |
| | | param: [this.wallEdit] |
| | | }, |
| | | { |
| | | method: "move_canvas", |
| | | method: "move_pt_center", |
| | | param: { |
| | | x: agv.x, |
| | | y: agv.y |
| | |
| | | } |
| | | ]) |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | |
| | | }, |
| | |
| | | showToast("场景重命名成功!") |
| | | } catch (ex) { |
| | | this.mapOperationType = "edit_scene_name" |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } finally { |
| | | uni.hideLoading() |
| | | this.loading = false |
| | |
| | | this.mapOperationType = "" |
| | | }, |
| | | clickStationDelete() { |
| | | const _this = this |
| | | showModal("该站点已绑定任务,删除站点后绑定的任务会停止并删除", "是否确认删除?").then((res) => { |
| | | if (res) { |
| | | this.stationDelete(this.stationEdit) |
| | | } |
| | | }) |
| | | // const _this = this |
| | | // showModal("该站点已绑定任务,删除站点后绑定的任务会停止并删除", "是否确认删除?").then((res) => { |
| | | // if (res) { |
| | | |
| | | // } |
| | | // }) |
| | | }, |
| | | async stationAdd(item) { |
| | | try { |
| | |
| | | |
| | | |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } finally { |
| | | uni.hideLoading() |
| | | } |
| | |
| | | } |
| | | |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } finally { |
| | | uni.hideLoading() |
| | | } |
| | |
| | | this.stationAdd(this.stationEdit) |
| | | this.mapOperationType = "public_teaching" |
| | | this.mapOperationStatus = "teaching" |
| | | this.positioningAgv = true |
| | | return |
| | | } else if (this.mapOperationType == "edit_station") { |
| | | this.stationUpdate(this.stationEdit) |
| | |
| | | }]) |
| | | this.mapOperationType = '' |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | async stationDelete(item) { |
| | |
| | | }]) |
| | | |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } finally { |
| | | uni.hideLoading() |
| | | } |
| | |
| | | }, |
| | | async clickStationNameOK() { |
| | | try { |
| | | this.loading = true |
| | | |
| | | const name = this.stationEdit.name.trim() |
| | | if (!name) { |
| | | showToast("站点名称还未输入") |
| | | return |
| | | } |
| | | if (this.mapOperationType == 'add_station' || this |
| | | .mapOperationType == "teaching_add_station") { |
| | | this.loading = true |
| | | if (this.mapOperationType == 'add_station' || this.mapOperationType == "teaching_add_station") { |
| | | const agv = await this.loadAgvState() |
| | | this.stationEdit = { |
| | | stationID: this.getMaxStationNo + 1, |
| | |
| | | method: "edit_station_pos", |
| | | param: this.stationEdit |
| | | }, { |
| | | method: "move_canvas", |
| | | method: "move_pt_center", |
| | | param: { |
| | | x: agv.x, |
| | | y: agv.y |
| | |
| | | } |
| | | |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } finally { |
| | | this.loading = false |
| | | } |
| | |
| | | method: "update_station", |
| | | param: [this.stationEdit] |
| | | }, { |
| | | method: "move_canvas", |
| | | method: "move_pt_center", |
| | | param: { |
| | | x: this.stationEdit.x, |
| | | y: this.stationEdit.y |
| | |
| | | method: "update_station", |
| | | param: [this.stationEdit] |
| | | }, { |
| | | method: "move_canvas", |
| | | method: "move_pt_center", |
| | | param: { |
| | | x: this.stationEdit.x, |
| | | y: this.stationEdit.y |
| | |
| | | method: "update_station", |
| | | param: [this.stationEdit] |
| | | }, { |
| | | method: "move_canvas", |
| | | method: "move_pt_center", |
| | | param: { |
| | | x: this.stationEdit.x, |
| | | y: this.stationEdit.y |
| | |
| | | method: "update_station", |
| | | param: [this.stationEdit] |
| | | }, { |
| | | method: "move_canvas", |
| | | method: "move_pt_center", |
| | | param: { |
| | | x: this.stationEdit.x, |
| | | y: this.stationEdit.y |
| | |
| | | |
| | | async clickVehiclePosition() { |
| | | try { |
| | | this.positioningAgv = true |
| | | const infoAgv = await this.loadAgvState() |
| | | this.ctxDataStr = JSON.stringify([{ |
| | | method: "update_agv_state", |
| | | param: infoAgv |
| | | }, { |
| | | method: "move_canvas", |
| | | method: "move_pt_center", |
| | | param: { |
| | | x: infoAgv.x, |
| | | y: infoAgv.y |
| | | } |
| | | }]) |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | async clickPositionStation() { |
| | |
| | | param: [this.stationEdit] |
| | | }, |
| | | { |
| | | method: "move_canvas", |
| | | method: "move_pt_center", |
| | | param: { |
| | | x: infoAgv.x, |
| | | y: infoAgv.y |
| | |
| | | |
| | | ]) |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | async loadTeachingMode() { |
| | |
| | | } |
| | | |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | return { |
| | | Public: [], |
| | | Stations: [] |
| | |
| | | try { |
| | | this.teachingMode = await this.loadTeachingMode() |
| | | this.ctxDataStr = JSON.stringify([{ |
| | | method: "clear_teaching_path", |
| | | }, |
| | | { |
| | | method: "public_teaching_path", |
| | | param: this.teachingMode.Public || [] |
| | | }, |
| | |
| | | ]) |
| | | |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | |
| | | } |
| | | }, |
| | |
| | | } |
| | | ]) |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | async refreshAgvPosition() { |
| | | try { |
| | | if (this.isPageVisible && this.mapShowAgv) { |
| | | const agv = await this.loadAgvState() |
| | | |
| | | const listCtrData = [{ |
| | | method: "update_agv_state", |
| | | param: agv |
| | |
| | | } |
| | | }) |
| | | } |
| | | if (this.positioningAgv) { |
| | | 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); |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex).then((res) => { |
| | | setTimeout(this.refreshAgvPosition, 1000); |
| | | }) |
| | | } finally { |
| | | // 无论成功失败,1 秒后再来 |
| | | setTimeout(this.refreshAgvPosition, 1000); |
| | | |
| | | } |
| | | |
| | | }, |
| | |
| | | uni.showLoading({ |
| | | title: "示教结束" |
| | | }) |
| | | await teachingModeFlag(this.vehicleIp, |
| | | teachingMode) |
| | | await teachingModeFlag(this.vehicleIp, teachingMode) |
| | | |
| | | this.mapOperationStatus = "end" |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } finally { |
| | | uni.hideLoading() |
| | | } |
| | |
| | | await _this.teachingStart("Public") |
| | | |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } finally { |
| | | this.loading = false |
| | | uni.hideLoading() |
| | |
| | | _this.mapOperationStatus = "" |
| | | |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } finally { |
| | | this.loading = false |
| | | } |
| | |
| | | |
| | | this.mapOperationStatus = "save" |
| | | try {} catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | |
| | | }, |
| | |
| | | } |
| | | |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | |
| | | }, |
| | |
| | | .teachingModeCur |
| | | ) |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } finally { |
| | | this.loading = false |
| | | } |
| | | |
| | | }, |
| | | async onTeachingModeMainRoad( |
| | | val) { |
| | | async onTeachingModeMainRoad(val) { |
| | | try { |
| | | if (this |
| | | .mapOperationStatus |
| | | ) { |
| | | if (this.mapOperationStatus) { |
| | | |
| | | if (this |
| | | .teachingModeCur |
| | | .main_road == |
| | | val) { |
| | | if (this.teachingModeCur.main_road == val) { |
| | | return |
| | | } |
| | | this.teachingModeCur |
| | | .main_road = |
| | | val |
| | | this.teachingModeCur |
| | | .teaching_flag = |
| | | 1 |
| | | this.teachingModeCur |
| | | .mode = |
| | | "Public" |
| | | const res = |
| | | await teachingModeFlag( |
| | | this |
| | | .vehicleIp, |
| | | this |
| | | .teachingModeCur |
| | | ) |
| | | this.teachingModeCur.teaching_flag = 0 |
| | | const oldName = this.teachingModeCur.name |
| | | await teachingModeFlag(this.vehicleIp, this.teachingModeCur) |
| | | this.teachingModeCur.main_road = val |
| | | this.teachingModeCur.teaching_flag = 1 |
| | | this.teachingModeCur.mode = "Public" |
| | | this.teachingModeCur.name = "" |
| | | const res = await teachingModeFlag(this.vehicleIp, this.teachingModeCur) |
| | | if (val == 0) |
| | | showToast( |
| | | "已将该路段路径保存为主路示教路线" |
| | |
| | | "已将该路段路径保存为支路示教路线" |
| | | ) |
| | | if (res?.name) |
| | | this |
| | | .teachingModeCur |
| | | .name = 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]] |
| | | } ]) |
| | | |
| | | } |
| | | |
| | | |
| | | } else { |
| | | this.teachingModeCur |
| | | .main_road = |
| | |
| | | } |
| | | |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | clickTeachingDelete() { |
| | |
| | | param: item, |
| | | }]) |
| | | } catch (ex) { |
| | | this.showError( |
| | | showError( |
| | | ex) |
| | | } finally { |
| | | uni.hideLoading() |
| | |
| | | await delTeachingModeData(this.vehicleIp, data) |
| | | this.reloadTeachingMode() |
| | | } catch (ex) { |
| | | this.showError( |
| | | ex) |
| | | showError(ex) |
| | | } finally { |
| | | uni.hideLoading() |
| | | } |
| | | }, |
| | | |
| | | showError(ex) { |
| | | let exStr = JSON.stringify(ex) |
| | | if (exStr == "{}") |
| | | exStr = ex |
| | | let tip = typeof ex.msg == "string" ? ex.msg : typeof ex.errMsg == "string" ? ex.errMsg : exStr |
| | | showModal(tip, |
| | | "错误", |
| | | false, |
| | | "确定") |
| | | }, |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | showToast, |
| | | showModal, |
| | | session, |
| | | showError, |
| | | showInfo |
| | | } from "@/comm/utils.js" |
| | | import { |
| | | Button |
| | |
| | | |
| | | } catch (ex) { |
| | | |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | async loadMapLaserData() { |
| | |
| | | const info = await getMapLaserData(this.ip) |
| | | return info |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | return {} |
| | | } |
| | | }, |
| | |
| | | await createScene(this.ip, name, 1) |
| | | this.$emit('update:opSceneType', "scan"); |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | |
| | | }, |
| | |
| | | deltaY = this.workSpace.height - eleHeight |
| | | if (oldX + this.eleWidth >= info.x * zoom && info.x * zoom >= oldX) { |
| | | deltaX = -oldX |
| | | //console.log("move_canvas X", oldX) |
| | | //console.log("move_pt_center X", oldX) |
| | | } |
| | | if (oldY + eleHeight >= info.y * zoom && info.y * zoom >= oldY) { |
| | | // console.log("move_canvas Y", oldY) |
| | | // console.log("move_pt_center Y", oldY) |
| | | deltaY = -oldY |
| | | } |
| | | this.canvas.absolutePan(new fabric.Point(deltaX, deltaY));*/ |
| | |
| | | } else if (item.method == "update_current_teaching") { |
| | | const info = item.param || [] |
| | | await _this.updateCurrentTeaching(info) |
| | | } else if (item.method == "move_canvas") { |
| | | } else if (item.method == "move_pt_center") { |
| | | const info2 = item.param || {} |
| | | |
| | | const pt = { |
| | |
| | | Result |
| | | } from "ant-design-vue"; |
| | | |
| | | import { |
| | | session, |
| | | } from "../../../comm/utils.js" |
| | | |
| | | // import okIcon from '../../../static/images/confirm.svg'; |
| | | // import cancelIcon from '../../../static/images/remove.svg'; |
| | | |
| | |
| | | img_x: 1, |
| | | img_y: 1 |
| | | }, |
| | | pressObjTimer: 0 |
| | | |
| | | pressObjTimer: 0, |
| | | } |
| | | }, |
| | | mounted() { |
| | |
| | | mainObj: obj |
| | | }); |
| | | this.canvas.add(objGroup) |
| | | |
| | | this.$ownerInstance.callMethod('receiveRenderData', { |
| | | method: "cancel_positioning_agv", |
| | | }); |
| | | }, |
| | | |
| | | canvasEventListener() { |
| | |
| | | _this.canvas.requestRenderAll(); |
| | | |
| | | _this.onSelectionChanage() |
| | | //_this.selectionChangeCanvas(); |
| | | |
| | | }); |
| | | _this.canvas.on("selection:updated", function(e) { |
| | | console.log("selection:updated", e); |
| | |
| | | |
| | | _this.canvas.on("object:modified", function(e) { |
| | | // console.log("object:modified", e.target); |
| | | |
| | | |
| | | // _this.resizetCanvas(); |
| | | }); |
| | | _this.canvas.on("object:moving", function(e) { |
| | | console.log("object:moving", e.target); |
| | |
| | | const data = activeObj.mainObj?.data |
| | | |
| | | data.path.push({ |
| | | x: _this.getActualXFromImg(activeObj.left), |
| | | y: _this.getActualYFromImg(activeObj.top) |
| | | x: _this.getActualXFromImg(activeObj.left) || 0, |
| | | y: _this.getActualYFromImg(activeObj.top) || 0 |
| | | }) |
| | | _this.updateRegion(activeObj.mainObj, data) |
| | | } else if (activeObj.eleType == "cmd") { |
| | | let data = activeObj.mainObj.data |
| | | if (activeObj.mainObj.eleType == "edit_teaching") { |
| | | const objCmdMain = activeObj.mainObj |
| | | if (objCmdMain.eleType == "edit_teaching") { |
| | | |
| | | let left = _this.getActualXFromImg(activeObj.left) |
| | | let top = _this.getActualYFromImg(activeObj.top) |
| | | let right = _this.getActualXFromImg(activeObj.left + activeObj.width) |
| | | let bottom = _this.getActualYFromImg(activeObj.top + activeObj.height) |
| | | data = [ |
| | | [left, top], |
| | | [left, bottom], |
| | | [right, bottom], |
| | | [right, top] |
| | | ] |
| | | const left = _this.getActualXFromImg(objCmdMain.left) |
| | | const top = _this.getActualYFromImg(objCmdMain.top) |
| | | const right = _this.getActualXFromImg(objCmdMain.left + objCmdMain.width) |
| | | const bottom = _this.getActualYFromImg(objCmdMain.top + objCmdMain.height) |
| | | data = [] |
| | | if (Number.isNaN(left) || Number.isNaN(top) || Number.isNaN(right) || Number |
| | | .isNaN(bottom)) { |
| | | const now = new Date() |
| | | const date = `${now.getHours()}:${now.getMinutes()}:${now.getSeconds()}` |
| | | _this.$ownerInstance.callMethod('receiveRenderData', { |
| | | method: "show_log", |
| | | data: { |
| | | date, |
| | | method: `POST`, |
| | | url: "app/log/edit_teaching", |
| | | param: objCmdMain, |
| | | statusCode: 100, |
| | | data: _this.mapInfo |
| | | }, |
| | | }); |
| | | } |
| | | data.push([left, top]) |
| | | data.push([left, bottom]) |
| | | data.push([right, bottom]) |
| | | data.push([right, top]) |
| | | console.log(data) |
| | | } |
| | | _this.$ownerInstance.callMethod('receiveRenderData', { |
| | | method: "edit_finish", |
| | | cmd: activeObj.id, |
| | | type: activeObj.mainObj.eleType, |
| | | type: objCmdMain.eleType, |
| | | data: data, |
| | | }); |
| | | if (activeObj.id == "ok") { |
| | | if (activeObj.mainObj.eleType == "region") { |
| | | if (objCmdMain.eleType == "region") { |
| | | _this.addRegionFinish(activeObj.mainObj) |
| | | } else if (activeObj.mainObj.eleType == "virtual_wall") { |
| | | _this.addVirtualWallFinish(activeObj.mainObj) |
| | | } |
| | | |
| | | } |
| | | if (activeObj.mainObj.eleType == "edit_teaching") { |
| | | if (objCmdMain.eleType == "edit_teaching") { |
| | | let list = _this.canvas.getObjects() || [] |
| | | for (let i2 in list) { |
| | | const obj = list[i2] |
| | |
| | | opacity: 1 |
| | | }) |
| | | } |
| | | if (activeObj.mainObj?.mainObj) { |
| | | activeObj.mainObj.mainObj.set({ |
| | | if (objCmdMain?.mainObj) { |
| | | objCmdMain.mainObj.set({ |
| | | selectable: true |
| | | }) |
| | | } |
| | | const ptObjs = activeObj.mainObj.ptObjs || [] |
| | | _this.canvas.remove(activeObj.mainObj) |
| | | const ptObjs = objCmdMain.ptObjs || [] |
| | | _this.canvas.remove(objCmdMain) |
| | | for (let i2 in ptObjs) { |
| | | const obj = ptObjs[i2] |
| | | _this.canvas.remove(obj) |
| | | } |
| | | } |
| | | if (activeObj.mainObj.eleType == "station") { |
| | | if (objCmdMain.eleType == "station") { |
| | | |
| | | _this.setAllObjectSelectable(true) |
| | | activeObj.mainObj.tipObj.set({ |
| | | left: activeObj.mainObj.left, |
| | | top: activeObj.mainObj.top - activeObj.mainObj.height / 2 - |
| | | activeObj.mainObj |
| | | .tipObj.height / 2, |
| | | objCmdMain.tipObj.set({ |
| | | left: objCmdMain.left, |
| | | top: objCmdMain.top - objCmdMain.height / 2 - |
| | | objCmdMain.tipObj.height / 2, |
| | | visible: true |
| | | }) |
| | | activeObj.mainObj.tipObj.setCoords() |
| | | objCmdMain.tipObj.setCoords() |
| | | } |
| | | _this.closeOkCancelControl() |
| | | |
| | |
| | | const objects = this.canvas.getObjects(); |
| | | |
| | | objects.splice(0, 1); |
| | | this.canvas.discardActiveObject() |
| | | const objActive = this.canvas.getActiveObject() |
| | | |
| | | let pointerList = [] |
| | | let pointerList2 = [] |
| | |
| | | if (obj.selectable && obj.opacity > 0) { |
| | | if (obj instanceof fabric.Path || obj instanceof fabric.Line) { |
| | | if (this.isPointOnStroke(obj, pointer)) { |
| | | console.log(i, obj.eleType) |
| | | // console.log(i, obj.eleType) |
| | | pointerList.unshift(obj) |
| | | |
| | | } |
| | | } else { |
| | | const isHit = obj.containsPoint(pointer); |
| | | if (isHit) { |
| | | console.log(i, obj.eleType) |
| | | // console.log(i, obj.eleType) |
| | | pointerList.unshift(obj) |
| | | |
| | | } |
| | |
| | | const obj = pointerList[i]; |
| | | if (obj instanceof fabric.Path || obj instanceof fabric.Line) { |
| | | if (this.isPointOnStroke(obj, pointer, 1)) { |
| | | if (objActive != obj) { |
| | | |
| | | this.canvas.discardActiveObject() |
| | | this.canvas.setActiveObject(obj); |
| | | this.canvas.requestRenderAll(); |
| | | } |
| | | return |
| | | } |
| | | pointerList2.unshift(obj) |
| | | } else { |
| | | if (objActive != obj) { |
| | | |
| | | this.canvas.discardActiveObject() |
| | | this.canvas.setActiveObject(obj); |
| | | this.canvas.requestRenderAll(); |
| | | } |
| | | return |
| | | } |
| | | } |
| | | |
| | | if (pointerList2.length > 0) { |
| | | if (pointerList2.length == 1) { |
| | | const obj = pointerList2[i]; |
| | | const obj = pointerList2[0]; |
| | | if (objActive != obj) { |
| | | |
| | | this.canvas.discardActiveObject() |
| | | this.canvas.setActiveObject(obj); |
| | | this.canvas.requestRenderAll(); |
| | | } |
| | | return |
| | | } |
| | | pointerList = pointerList2 |
| | |
| | | for (let i = pointerList.length - 1; i >= 0; i--) { |
| | | const obj = pointerList[i]; |
| | | if (this.isPointOnStroke(obj, pointer, 2)) { |
| | | if (objActive != obj) { |
| | | |
| | | this.canvas.discardActiveObject() |
| | | this.canvas.setActiveObject(obj); |
| | | this.canvas.requestRenderAll(); |
| | | } |
| | | return |
| | | } |
| | | pointerList2.unshift(obj) |
| | |
| | | } |
| | | if (pointerList2.length > 0) { |
| | | if (pointerList2.length == 1) { |
| | | const obj = pointerList2[i]; |
| | | const obj = pointerList2[0]; |
| | | if (objActive != obj) { |
| | | |
| | | this.canvas.discardActiveObject() |
| | | this.canvas.setActiveObject(obj); |
| | | this.canvas.requestRenderAll(); |
| | | } |
| | | return |
| | | } |
| | | pointerList = pointerList2 |
| | |
| | | for (let i = pointerList.length - 1; i >= 0; i--) { |
| | | const obj = pointerList[i]; |
| | | if (this.isPointOnStroke(obj, pointer, 3)) { |
| | | if (objActive != obj) { |
| | | |
| | | this.canvas.discardActiveObject() |
| | | this.canvas.setActiveObject(obj); |
| | | this.canvas.requestRenderAll(); |
| | | } |
| | | return |
| | | } |
| | | pointerList2.unshift(obj) |
| | |
| | | } |
| | | if (pointerList2.length > 0) { |
| | | if (pointerList2.length == 1) { |
| | | const obj = pointerList2[i]; |
| | | const obj = pointerList2[0]; |
| | | if (objActive != obj) { |
| | | |
| | | this.canvas.discardActiveObject() |
| | | this.canvas.setActiveObject(obj); |
| | | this.canvas.requestRenderAll(); |
| | | } |
| | | return |
| | | } |
| | | pointerList = pointerList2 |
| | |
| | | for (let i = pointerList.length - 1; i >= 0; i--) { |
| | | const obj = pointerList[i]; |
| | | if (this.isPointOnStroke(obj, pointer, 4)) { |
| | | if (objActive != obj) { |
| | | |
| | | this.canvas.discardActiveObject() |
| | | this.canvas.setActiveObject(obj); |
| | | this.canvas.requestRenderAll(); |
| | | } |
| | | return |
| | | } |
| | | pointerList2.unshift(obj) |
| | |
| | | if (pointerList2.length > 0) { |
| | | |
| | | const obj = pointerList2[pointerList2.length - 1]; |
| | | if (objActive != obj) { |
| | | |
| | | this.canvas.discardActiveObject() |
| | | this.canvas.setActiveObject(obj); |
| | | this.canvas.requestRenderAll(); |
| | | } |
| | | return |
| | | } |
| | | // objects.forEach(obj => { |
| | |
| | | }, |
| | | |
| | | onSelectionChanage() { |
| | | const _this = this |
| | | // const list = _this.canvas.getActiveObjects() |
| | | // if (list.length === 1) { |
| | | // if (list[0].eleType == "station") { |
| | | // _this.$ownerInstance.callMethod('receiveRenderData', { |
| | | // method: "selected_change", |
| | | // type: list[0].eleType, |
| | | // param: list[0].data |
| | | // }); |
| | | // } else if (list[0].eleType == "agv") { |
| | | // _this.$ownerInstance.callMethod('receiveRenderData', { |
| | | // method: "selected_change", |
| | | // type: list[0].eleType, |
| | | // param: list[0].data |
| | | // }); |
| | | // } else if (list[0].eleType == "agv_line") { |
| | | // _this.$ownerInstance.callMethod('receiveRenderData', { |
| | | // method: "selected_change", |
| | | // type: list[0].eleType, |
| | | // param: list[0].data |
| | | // }); |
| | | // } else { |
| | | // _this.$ownerInstance.callMethod('receiveRenderData', { |
| | | // method: "selected_change", |
| | | // type: "" |
| | | // }); |
| | | // } |
| | | |
| | | // } else { |
| | | // _this.$ownerInstance.callMethod('receiveRenderData', { |
| | | // method: "selected_change", |
| | | // type: "" |
| | | // }); |
| | | // } |
| | | }, |
| | | safeLoadImage(url, maxSize = 2048) { |
| | | console.log(url) |
| | |
| | | resolve(null); |
| | | }; |
| | | img.src = url; |
| | | }); |
| | | }, |
| | | safeLoadImageData(data, maxSize = 2048) { |
| | | //console.log("safeLoadImageData") |
| | | const _this = this |
| | | return new Promise((resolve) => { |
| | | let base64Image = data |
| | | if (base64Image.indexOf("data:image/png;base64,") < 0) { |
| | | base64Image = "data:image/png;base64," + data |
| | | } |
| | | // var img = new fabric.Image(); |
| | | // img.setSrc(base64Image, function() { |
| | | // console.log("img", JSON.stringify(img)) |
| | | // const scale = Math.min( |
| | | // maxSize / Math.max(img.width, img.height), |
| | | // 1 |
| | | // ); |
| | | // img.set({ |
| | | // scaleX: scale, |
| | | // scaleY: scale |
| | | // }) |
| | | // resolve(img) |
| | | // }); |
| | | fabric.Image.fromURL(base64Image, { |
| | | crossOrigin: 'anonymous' // 重要:设置跨域 |
| | | }).then((img) => { |
| | | |
| | | //console.log("img",JSON.stringify(img)) |
| | | const scale = Math.min( |
| | | maxSize / Math.max(img.width, img.height), |
| | | 1 |
| | | ); |
| | | img.set({ |
| | | scaleX: scale, |
| | | scaleY: scale, |
| | | }) |
| | | resolve(img) |
| | | }).catch((err) => { |
| | | console.error("图片加载失败", err) |
| | | _this.showError("图片加载失败") |
| | | resolve(null); |
| | | }) |
| | | |
| | | }); |
| | | }, |
| | | // 将 Base64 转为 Blob,再生成 URL |
| | |
| | | const cantainerEl = document.getElementById("canvasMap") |
| | | this.eleWidth = cantainerEl.clientWidth |
| | | this.eleHeight = cantainerEl.clientHeight |
| | | console.log("client", this.eleWidth, this.eleHeight) |
| | | this.canvas.setWidth(this.eleWidth); |
| | | this.canvas.setHeight(this.eleHeight); |
| | | this.mapInfo = { |
| | | proportion: info.proportion || 1, |
| | | img_proportion: info.img_proportion || 1, |
| | | max_x: info.max_x || 1, |
| | | max_y: info.max_y || 1, |
| | | min_x: info.min_x || 0, |
| | | min_y: info.min_y || 0, |
| | | img_x: info.img_x || 1, |
| | | img_y: info.img_y || 1, |
| | | proportion: parseInt(info.proportion) || 1, |
| | | img_proportion: parseInt(info.img_proportion) || 1, |
| | | max_x: parseInt(info.max_x) || 1, |
| | | max_y: parseInt(info.max_y) || 1, |
| | | min_x: parseInt(info.min_x) || 0, |
| | | min_y: parseInt(info.min_y) || 0, |
| | | img_x: parseInt(info.img_x) || 1, |
| | | img_y: parseInt(info.img_y) || 1, |
| | | } |
| | | |
| | | return new Promise((resolve, reject) => { |
| | | |
| | | if (info.filedata) { |
| | |
| | | const eleWidth = this.eleWidth - 20 |
| | | const eleHeight = this.eleHeight - 200 |
| | | if (!this.workSpace) |
| | | return 1 |
| | | return 0.8 |
| | | const width = this.workSpace.width |
| | | const height = this.workSpace.height |
| | | if (eleWidth / eleHeight < width / height) { |
| | | return eleWidth / width; |
| | | let scale = eleWidth / width; |
| | | return scale - scale / 10 |
| | | } // 按照宽度缩放 |
| | | return eleHeight / height; |
| | | let scale = eleHeight / height; |
| | | return scale - scale / 10 |
| | | }, |
| | | |
| | | auto() { |
| | |
| | | clearTimeout(this.pressObjTimer); |
| | | this.pressObjTimer = null |
| | | } |
| | | this.$ownerInstance.callMethod('receiveRenderData', { |
| | | method: "cancel_positioning_agv", |
| | | }); |
| | | } |
| | | |
| | | // 移动视口 |
| | | // console.log('relativePan', deltaX, deltaY); |
| | | const vpt = this.canvas.viewportTransform; |
| | |
| | | } |
| | | //console.log(scale, scaleAuto) |
| | | this.setZoomAuto(scale, center) |
| | | |
| | | this.$ownerInstance.callMethod('receiveRenderData', { |
| | | method: "cancel_positioning_agv", |
| | | }); |
| | | // console.log('多点移动 - 距离:', distance, '角度:', angle); |
| | | // 多点移动逻辑 |
| | | }, |
| | |
| | | pos_list.push(item) |
| | | } |
| | | }) |
| | | |
| | | console.log(posArr.length, pos_list.length) |
| | | let path2 = "" |
| | | |
| | | const theta = 20; |
| | |
| | | |
| | | |
| | | } |
| | | //console.log(path2) |
| | | |
| | | // console.log("addTeachingPath",path2) |
| | | // path2 += " Z" |
| | | let strokeWidth = 1 |
| | | let stroke = "#95DE64" |
| | |
| | | lockMovementX: true, |
| | | lockMovementY: true, |
| | | selectable: false, |
| | | opacity: 0, |
| | | opacity: 1, |
| | | mainRoad: main_road, |
| | | data: teachingData |
| | | }) |
| | | this.canvas.add(objPath) |
| | | |
| | | // this.canvas.sendObjectToBack(objPath); |
| | | |
| | | // lenTeaching = 0 |
| | | // for (let i = list.length - 1; i >= 0; i--) { |
| | | // const obj = list[i] |
| | | // if (this.compareOverlap(obj, objPath)) { |
| | | // lenTeaching = i + 1 |
| | | // break |
| | | // } |
| | | // } |
| | | this.canvas.sendObjectToBack(objPath); |
| | | this.canvas.moveObjectTo(objPath, lenTeaching + 1); |
| | | |
| | | return objPath |
| | |
| | | |
| | | }, |
| | | showTeachingPath(show) { |
| | | |
| | | if (!show) |
| | | this.canvas.discardActiveObject(); |
| | | let list = this.canvas.getObjects() || [] |
| | | list = list.filter((a) => a.eleType == "station_teaching" || a.eleType == "public_teaching") |
| | | for (let i2 in list) { |
| | |
| | | left = pt.x - width / 2 |
| | | top = pt.y - height / 2 |
| | | } |
| | | console.log(left, |
| | | top, |
| | | width, |
| | | height, scale2) |
| | | const rect = new fabric.Rect({ |
| | | id: `edit_teaching`, |
| | | eleType: "edit_teaching", |
| | |
| | | oldLeft: rect.left, |
| | | oldTop: rect.top, |
| | | }) |
| | | /*const zoom = this.canvas.getZoom(); |
| | | const eleHeight = this.eleHeight - 150 |
| | | const info = { |
| | | x: rect.left + rect.width / 2, |
| | | y: rect.top + rect.height / 2 |
| | | } |
| | | let deltaX = info.x * zoom - this.eleWidth / 2 // * scale; |
| | | let deltaY = info.y * zoom - eleHeight / 2 //* scale; |
| | | const vpt = this.canvas.viewportTransform; |
| | | const oldX = vpt[4] |
| | | const oldY = vpt[5] |
| | | if (deltaX + this.eleWidth > this.workSpace.width) |
| | | deltaX = this.workSpace.width - this.eleWidth |
| | | if (deltaY + eleHeight > this.workSpace.height) |
| | | deltaY = this.workSpace.height - eleHeight |
| | | if (oldX + this.eleWidth >= info.x * zoom && info.x * zoom >= oldX) { |
| | | deltaX = -oldX |
| | | //console.log("move_canvas X", oldX) |
| | | } |
| | | if (oldY + eleHeight >= info.y * zoom && info.y * zoom >= oldY) { |
| | | // console.log("move_canvas Y", oldY) |
| | | deltaY = -oldY |
| | | } |
| | | this.canvas.absolutePan(new fabric.Point(deltaX, deltaY));*/ |
| | | |
| | | } else { |
| | | for (let i2 in list) { |
| | |
| | | this.canvas.add(ellipse) |
| | | const offX = 20 * Math.cos(angle) |
| | | const offY = 20 * Math.sin(angle) |
| | | console.log("angle", param.angle, offX, offY) |
| | | |
| | | if (this.objAgvLaser) { |
| | | this.canvas.remove(this.objAgvLaser) |
| | | } |
| | |
| | | var zoom = this.canvas.getZoom(); |
| | | var vpt = this.canvas.viewportTransform; // 当前变换矩阵 |
| | | |
| | | var newPanX = vpt[4]; |
| | | var newPanY = vpt[5]; |
| | | if (pt.x * zoom < vpt[4] + 80 || pt.x * zoom > vpt[4] + this.eleWidth - 80) { |
| | | if (pt.x * zoom - this.eleWidth / 2 < 80) { |
| | | newPanX = -80 |
| | | } else if (pt.x * zoom > this.mapInfo.img_x * zoom - 80) { |
| | | newPanX = this.mapInfo.img_x * zoom - this.eleWidth + 80 |
| | | } else { |
| | | var newPanX = -vpt[4]; |
| | | var newPanY = -vpt[5]; |
| | | const offWidth = pt.width || 20 |
| | | const offHeight = pt.height || 20 |
| | | // console.log("ensurePointVisible",pt.x,pt.y,newPanX,newPanY, this.eleWidth,this.eleHeight) |
| | | if (pt.x * zoom < -vpt[4] + offWidth || pt.x * zoom > -vpt[4] + this.eleWidth - offWidth) { |
| | | if (pt.x * zoom - this.eleWidth / 2 <offWidth) { |
| | | newPanX = -offWidth |
| | | } |
| | | // else if (pt.x * zoom > this.mapInfo.img_x * zoom - 20) { |
| | | // newPanX = this.mapInfo.img_x * zoom - this.eleWidth + 20 |
| | | // } |
| | | else { |
| | | newPanX = pt.x * zoom - this.eleWidth / 2 |
| | | } |
| | | } |
| | | if (pt.y * zoom < vpt[5] + 80 || pt.y * zoom > vpt[5] + this.eleHeight - 200) { |
| | | if (pt.y * zoom < -vpt[5] +offHeight || pt.y * zoom > -vpt[5] + this.eleHeight - (120+offHeight)) { |
| | | |
| | | if (pt.y * zoom - this.eleHeight / 2 < 80) { |
| | | newPanY = -80 |
| | | } else if (pt.y * zoom > this.mapInfo.img_y * zoom - 200) { |
| | | newPanY = this.mapInfo.img_y * zoom - this.eleHeight + 200 |
| | | } else { |
| | | newPanY = pt.y * zoom - this.eleHeight / 2 |
| | | if (pt.y * zoom - this.eleHeight / 2 <offHeight) { |
| | | newPanY = -offHeight |
| | | } |
| | | // else if (pt.y * zoom > this.mapInfo.img_y * zoom - 180) { |
| | | // newPanY = this.mapInfo.img_y * zoom - this.eleHeight + 180 |
| | | // } |
| | | else { |
| | | newPanY = pt.y * zoom -(this.eleHeight - 120) / 2 |
| | | } |
| | | } |
| | | |
| | | // console.log("ensurePointVisible2",newPanX,newPanY) |
| | | // 只有在需要时才平移 |
| | | if (newPanX !== vpt[4] || newPanY !== vpt[5]) { |
| | | if (newPanX !== -vpt[4] || newPanY !== -vpt[5]) { |
| | | this.canvas.absolutePan({ |
| | | x: newPanX, |
| | | y: newPanY |
| | | }); |
| | | } |
| | | }, |
| | | |
| | | ensurePointCenter(pt){ |
| | | var zoom = this.canvas.getZoom(); |
| | | var newPanX = newPanX = pt.x * zoom - this.eleWidth / 2 |
| | | var newPanY = pt.y * zoom -(this.eleHeight - 150) / 2 |
| | | this.canvas.absolutePan({ |
| | | x: newPanX, |
| | | y: newPanY |
| | | }); |
| | | }, |
| | | setAllObjectSelectable(selectable) { |
| | | let flag = false |
| | | this.canvas.forEachObject(function(obj) { |
| | |
| | | } else if (item.method == "update_current_teaching") { |
| | | const info = item.param || [] |
| | | await _this.updateCurrentTeaching(info) |
| | | } else if (item.method == "move_canvas") { |
| | | } else if (item.method == "move_pt_visible") { |
| | | const info2 = item.param || {} |
| | | |
| | | const pt = { |
| | | x: this.getXOnImg(info2.x), |
| | | y: this.getYOnImg(info2.y) |
| | | y: this.getYOnImg(info2.y), |
| | | width: 20, |
| | | height: 20 |
| | | } |
| | | this.ensurePointVisible(pt) |
| | | |
| | | |
| | | |
| | | } else if (item.method == "add_station") { |
| | | } |
| | | else if (item.method == "move_pt_center") { |
| | | const info2 = item.param || {} |
| | | const pt = { |
| | | x: this.getXOnImg(info2.x), |
| | | y: this.getYOnImg(info2.y) |
| | | } |
| | | this.ensurePointCenter(pt) |
| | | } |
| | | else if (item.method == "add_station") { |
| | | const stationList = item.param || [] |
| | | let list = _this.canvas.getObjects() || [] |
| | | for (let i2 in stationList) { |
| | |
| | | } |
| | | }) |
| | | } else if (item.method == "public_teaching") { |
| | | _this.setAllObjectSelectable(false) |
| | | let list = _this.canvas.getObjects() || [] |
| | | list.forEach((obj) => { |
| | | if (obj.eleType == "public_teaching" || obj.eleType == |
| | | "station_teaching") { |
| | | if (obj.eleType == "public_teaching" || obj.eleType == "station_teaching") { |
| | | obj.set({ |
| | | hasControls: false, |
| | | selectable: false, |
| | | opacity: 1 |
| | | }) |
| | | // obj.set({ |
| | | // hasControls: false, |
| | | // selectable: false, |
| | | // }) |
| | | } else if (obj.eleType == "agv") |
| | | obj.set({ |
| | | opacity: 1 |
| | |
| | | for (let i2 in list) { |
| | | const obj = list[i2] |
| | | obj.set({ |
| | | selectable: false, |
| | | selectable: obj?.canSelect ?true:false, |
| | | opacity: 1 |
| | | }) |
| | | // if (obj.eleType == "station") { |
| | | // await _this.setMarkStation(obj, false) |
| | | // } |
| | | |
| | | } |
| | | _this.showTeachingPath(_this.showTeachPathFlag ? true : false) |
| | | |
| | | } else if (item.method == "public_teaching_path") { |
| | | } |
| | | else if (item.method == "clear_teaching_path") { |
| | | let list = _this.canvas.getObjects() || [] |
| | | list = list.filter((a) => a.eleType == "public_teaching") |
| | | list = list.filter((a) => a.eleType == "public_teaching" || a.eleType == "station_teaching") |
| | | for (let i2 in list) { |
| | | this.canvas.remove(list[i2]) |
| | | } |
| | | } |
| | | else if (item.method == "public_teaching_path") { |
| | | |
| | | const teachingPathList = item.param || [] |
| | | |
| | | for (let i2 in teachingPathList) { |
| | | const teachingPath = teachingPathList[i2] |
| | | const id = `public_teaching_${teachingPath.name}` |
| | | await this.addTeachingPath(teachingPath, id, "public_teaching") |
| | | } |
| | | } else if (item.method == "station_teaching_path") { |
| | | let list = _this.canvas.getObjects() || [] |
| | | list = list.filter((a) => a.eleType == "station_teaching") |
| | | for (let i2 in list) { |
| | | this.canvas.remove(list[i2]) |
| | | } |
| | | |
| | | const teachingPathList = item.param || [] |
| | | for (let i2 in teachingPathList) { |
| | | const teachingPath = teachingPathList[i2] |
| | |
| | | </view> |
| | | <view class="content" v-show="opSceneType =='scan'"> |
| | | <view class="fabric" :message="ctxDataStr" :change:message="ctx.receiveMsg" id="canvasMap"></view> |
| | | <view class="position" @click="clickVehiclePosition"> |
| | | <text class="ico my-location-rounded"></text> |
| | | </view> |
| | | </view> |
| | | <view class="bottom"> |
| | | <view class="bottom-content" v-if="opSceneType =='add_name' "> |
| | |
| | | showToast, |
| | | showModal, |
| | | session, |
| | | showError, |
| | | showInfo |
| | | } from "@/comm/utils.js" |
| | | import { |
| | | Button |
| | |
| | | showClearName: false, |
| | | mapId: "", |
| | | ctxDataStr: "[]", |
| | | localSceneList: [] |
| | | localSceneList: [], |
| | | positioningAgv: true, |
| | | robotPos: {} |
| | | |
| | | } |
| | | }, |
| | |
| | | }) |
| | | return true |
| | | |
| | | } else if (this.opSceneType == "finish") { |
| | | const eventChannel = this.getOpenerEventChannel(); |
| | | eventChannel.emit('create_finish', this.sceneName); |
| | | return false |
| | | } else { |
| | | return false |
| | | } |
| | |
| | | |
| | | } catch (ex) { |
| | | |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | receiveRenderData(param) { |
| | |
| | | }) |
| | | } |
| | | |
| | | } else if (param.method == "cancel_positioning_agv") { |
| | | this.positioningAgv = false |
| | | } |
| | | }, |
| | | |
| | |
| | | const list = session.getValue("scene_db") || [] |
| | | return list |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | return [] |
| | | } |
| | | }, |
| | |
| | | delta: 1, //返回层数,2则上上页 |
| | | }) |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } finally { |
| | | this.loading = false |
| | | uni.hideLoading() |
| | |
| | | |
| | | |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | this.opSceneType = 'add_name' |
| | | } finally { |
| | | this.loading = false |
| | |
| | | title: "结束场景构建" |
| | | }) |
| | | this.opSceneType = "" |
| | | await createScene(this.ip, this.sceneName, 0) |
| | | const eventChannel = this.getOpenerEventChannel(); |
| | | eventChannel.emit('create_finish', this.sceneName); |
| | | uni.navigateBack({ |
| | |
| | | const info = await getMapLaserData(this.ip, this.mapId) |
| | | return info |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | return {} |
| | | } |
| | | }, |
| | |
| | | |
| | | const listCtrData = [] |
| | | if (data.base_map?.image_base64) { |
| | | |
| | | this.robotPos = {} |
| | | this.mapId = data.base_map.map_id |
| | | listCtrData.push({ |
| | | method: "background", |
| | |
| | | filedata: data.base_map.image_base64 |
| | | } |
| | | }) |
| | | |
| | | |
| | | } |
| | | listCtrData.push({ |
| | | method: "agv_laser", |
| | | param: data.robot_pose |
| | |
| | | method: "point_cloud", |
| | | param: data.point_cloud |
| | | }) |
| | | if (this.positioningAgv) { |
| | | listCtrData.push({ |
| | | method: "move_canvas", |
| | | method: "move_pt_visible", |
| | | param: { |
| | | x: data.robot_pose.x, |
| | | y: data.robot_pose.y, |
| | | width:50, |
| | | height:50, |
| | | } |
| | | }) |
| | | } |
| | | |
| | | this.ctxDataStr = JSON.stringify(listCtrData) |
| | | this.robotPos = { |
| | | x: data.robot_pose.x, |
| | | y: data.robot_pose.y |
| | | } |
| | | }) |
| | | |
| | | } else { |
| | | listCtrData.push({ |
| | | method: "agv_laser", |
| | | param: data.robot_pose |
| | | }) |
| | | listCtrData.push({ |
| | | method: "point_cloud", |
| | | param: data.point_cloud |
| | | }) |
| | | } |
| | | this.ctxDataStr = JSON.stringify(listCtrData) |
| | | } |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | } finally { |
| | | // 无论成功失败,1 秒后再来 |
| | | setTimeout(this.refreshMapLaserData, 1000); |
| | | } catch (ex) { |
| | | showError(ex).then((res) => { |
| | | setTimeout(this.refreshMapLaserData, 1000); |
| | | }) |
| | | } |
| | | }, |
| | | async clickVehiclePosition() { |
| | | this.positioningAgv = true |
| | | |
| | | showError(ex) { |
| | | console.log(ex) |
| | | let exStr = JSON.stringify(ex) |
| | | if (exStr == "{}") |
| | | exStr = ex |
| | | let tip = typeof ex.msg == "string" ? ex.msg : exStr |
| | | showModal(tip, "错误", false, "确定") |
| | | if (this.robotPos.x) { |
| | | this.ctxDataStr = JSON.stringify([{ |
| | | method: "move_pt_center", |
| | | param: { |
| | | x: this.robotPos.x, |
| | | y: this.robotPos.y |
| | | } |
| | | }]) |
| | | } |
| | | |
| | | |
| | | }, |
| | | |
| | | |
| | |
| | | background-color: #fff; |
| | | } |
| | | |
| | | .position { |
| | | position: absolute; |
| | | right: 50rpx; |
| | | bottom: 500rpx; |
| | | |
| | | .ico { |
| | | font-size: 65rpx; |
| | | color: #1890FF; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | <script> |
| | | import { |
| | | showToast, |
| | | showModal |
| | | showModal, |
| | | showError, |
| | | showInfo |
| | | } from "@/comm/utils.js" |
| | | import { |
| | | Button |
| | |
| | | const info = await getAgvState(this.vehicleIp) |
| | | return info |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | return {} |
| | | } |
| | | }, |
| | |
| | | const info = await stations(this.vehicleIp) |
| | | return info.station_list || [] |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | return [] |
| | | } |
| | | }, |
| | |
| | | uni.navigateTo({ |
| | | url: `/pages/task/log-list?ip=${this.vehicleIp}` |
| | | }) |
| | | }, |
| | | showError(ex) { |
| | | let exStr = JSON.stringify(ex) |
| | | if (exStr == "{}") |
| | | exStr = ex |
| | | let tip = typeof ex.msg == "string" ? ex.msg : exStr |
| | | showModal(tip, "错误", false,"确定") |
| | | }, |
| | | |
| | | |
| | |
| | | <script> |
| | | import { |
| | | showToast, |
| | | showModal |
| | | showModal, |
| | | showError, |
| | | showInfo |
| | | } from "@/comm/utils.js" |
| | | // import OIFabric from "@/components/oi-fabric/index.vue" |
| | | import { |
| | |
| | | }, |
| | | |
| | | { |
| | | method: "move_canvas", |
| | | method: "move_pt_center", |
| | | param: { |
| | | x: infoAgv.x, |
| | | y: infoAgv.y |
| | |
| | | bgProgressPercent: 0, |
| | | bgLoading: false |
| | | }) |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | async loadAgvState() { |
| | |
| | | const info = await getAgvState(this.vehicleIp) |
| | | return info |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | return {} |
| | | } |
| | | }, |
| | |
| | | const info = await stations(this.vehicleIp) |
| | | return info.station_list || [] |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | return [] |
| | | } |
| | | }, |
| | |
| | | const info = await getMapUrl(this.vehicleIp, id) |
| | | return info |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | return {} |
| | | } |
| | | }, |
| | |
| | | } |
| | | |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | return { |
| | | Public: [], |
| | | Stations: [] |
| | |
| | | ]) |
| | | |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | |
| | | } |
| | | }, |
| | |
| | | param: item, |
| | | }]) |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | async removeTeachingModeData(data) { |
| | |
| | | await delTeachingModeData(this.vehicleIp, data) |
| | | this.reloadTeachingMode() |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | clickPublicTeaching() { |
| | |
| | | }]) |
| | | this.mapOperationType = 'public_teaching' |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | async stationAdd(item) { |
| | |
| | | |
| | | |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | async teachingStart(mode) { |
| | |
| | | } |
| | | |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | |
| | | }, |
| | |
| | | this.askTeachingBiDirection(this.teachingModeCur) |
| | | } |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | |
| | | }, |
| | |
| | | } |
| | | |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | |
| | |
| | | }]) |
| | | |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | |
| | |
| | | stationTeaching.splice(curIndex, 1) |
| | | _this.teachingStart("Stations") |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | |
| | | } else { |
| | |
| | | } |
| | | |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | clickTeachingEnd() { |
| | |
| | | _this.reloadTeachingMode() |
| | | |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | } else { |
| | | _this.teachingStatus = "save" |
| | |
| | | |
| | | this.teachingStatus = "save" |
| | | try {} catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | |
| | | }, |
| | |
| | | |
| | | } |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | |
| | |
| | | |
| | | } |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | askTeachingBiDirection(teachingMode) { |
| | |
| | | this.reloadTeachingMode() |
| | | this.teachingStatus = "end" |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | clickBackTeaching() { |
| | |
| | | method: "edit_station_pos", |
| | | param: this.stationEdit |
| | | }, { |
| | | method: "move_canvas", |
| | | method: "move_pt_center", |
| | | param: { |
| | | x: agv.x, |
| | | y: agv.y |
| | |
| | | } |
| | | |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | |
| | | }, |
| | |
| | | method: "update_station", |
| | | param: [this.stationEdit] |
| | | }, { |
| | | method: "move_canvas", |
| | | method: "move_pt_center", |
| | | param: { |
| | | x: this.stationEdit.x, |
| | | y: this.stationEdit.y |
| | |
| | | method: "update_station", |
| | | param: [this.stationEdit] |
| | | }, { |
| | | method: "move_canvas", |
| | | method: "move_pt_center", |
| | | param: { |
| | | x: this.stationEdit.x, |
| | | y: this.stationEdit.y |
| | |
| | | method: "update_station", |
| | | param: [this.stationEdit] |
| | | }, { |
| | | method: "move_canvas", |
| | | method: "move_pt_center", |
| | | param: { |
| | | x: this.stationEdit.x, |
| | | y: this.stationEdit.y |
| | |
| | | method: "update_station", |
| | | param: [this.stationEdit] |
| | | }, { |
| | | method: "move_canvas", |
| | | method: "move_pt_center", |
| | | param: { |
| | | x: this.stationEdit.x, |
| | | y: this.stationEdit.y |
| | |
| | | method: "update_agv_state", |
| | | param: infoAgv |
| | | }, { |
| | | method: "move_canvas", |
| | | method: "move_pt_center", |
| | | param: { |
| | | x: infoAgv.x, |
| | | y: infoAgv.y |
| | | } |
| | | }]) |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | async clickShowTeachingPath() { |
| | |
| | | ]) |
| | | console.log(this.ctxDataStr) |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | async clickPositionStation() { |
| | |
| | | param: [this.stationEdit] |
| | | }, |
| | | { |
| | | method: "move_canvas", |
| | | method: "move_pt_center", |
| | | param: { |
| | | x: infoAgv.x, |
| | | y: infoAgv.y |
| | |
| | | |
| | | ]) |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | |
| | | showError(ex) { |
| | | let exStr = JSON.stringify(ex) |
| | | if (exStr == "{}") |
| | | exStr = ex |
| | | let tip = typeof ex.msg == "string" ? ex.msg : exStr |
| | | showModal(tip, "错误", false, "确定") |
| | | }, |
| | | |
| | | |
| | |
| | | </view> |
| | | <view class="title">错误信息 |
| | | </view> |
| | | <view class="content error">{{info.msg}} |
| | | </view> |
| | | <textarea class="content error" disabled :value="result"></textarea> |
| | | |
| | | </template> |
| | | <template v-else> |
| | | <view class="title">结果 |
| | |
| | | }, |
| | | onLoad(option) { |
| | | this.info = JSON.parse(option.info) || {} |
| | | console.log( this.info) |
| | | if(this.info.data_key) |
| | | { |
| | | const maxData = session.getValue("request_log_max_data") || {} |
| | |
| | | showToast, |
| | | showModal, |
| | | session, |
| | | showError, |
| | | showInfo |
| | | } from "@/comm/utils.js" |
| | | // import OIFabric from "@/components/oi-fabric/index.vue" |
| | | import { |
| | |
| | | |
| | | } catch (ex) { |
| | | |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | async loadAgvState() { |
| | |
| | | const info = await getAgvState(this.ip) |
| | | return info |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | return {} |
| | | } |
| | | }, |
| | |
| | | const info = await stations(this.ip) |
| | | return info.station_list || [] |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | return [] |
| | | } |
| | | }, |
| | |
| | | } |
| | | |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | |
| | | }, |
| | |
| | | |
| | | |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | async stationUpdate(item) { |
| | |
| | | } |
| | | |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | |
| | |
| | | } |
| | | |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | |
| | | }, |
| | |
| | | } |
| | | } catch (ex) { |
| | | |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | clickClearName() { |
| | |
| | | this.angleSvg = `/static/images/angle${angle}.svg` |
| | | this.stationEdit.angle = angle * 3.14 / 180 |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | showError(ex) { |
| | | let exStr = JSON.stringify(ex) |
| | | if (exStr == "{}") |
| | | exStr = ex |
| | | let tip = typeof ex.msg == "string" ? ex.msg : exStr |
| | | showModal(tip, "错误", false,"确定") |
| | | }, |
| | | |
| | | |
| | |
| | | <script> |
| | | import { |
| | | showToast, |
| | | showModal |
| | | showModal, |
| | | showError, |
| | | showInfo |
| | | } from "@/comm/utils.js" |
| | | import { |
| | | Button |
| | |
| | | taskGroupName: "", |
| | | cycleTime: 1, |
| | | taskButton: 0, |
| | | tasktype:1 |
| | | }, |
| | | pathwayList: [{}], |
| | | pickerView: { |
| | |
| | | const info = await stations(this.ip) |
| | | this.stationList = info.station_list || [] |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | async clickSave() { |
| | |
| | | showToast("未选择任务属性!") |
| | | return |
| | | } |
| | | uni.showLoading({ |
| | | title:"任务新增中" |
| | | }) |
| | | const taskList = [] |
| | | const task = { |
| | | taskGroupID: uuidv4(), |
| | |
| | | return |
| | | } |
| | | await addTask(this.ip, task) |
| | | |
| | | task.taskList = taskList |
| | | const eventChannel = this.getOpenerEventChannel(); |
| | | eventChannel.emit('add_task', task); |
| | |
| | | delta: 1, //返回层数,2则上上页 |
| | | }) |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | finally { |
| | | uni.hideLoading() |
| | | } |
| | | }, |
| | | clickCancel() { |
| | |
| | | closeMenu() { |
| | | this.$refs.refPopupMenu.close() |
| | | }, |
| | | showError(ex) { |
| | | let exStr = JSON.stringify(ex) |
| | | if (exStr == "{}") |
| | | exStr = ex |
| | | let tip = typeof ex.msg == "string" ? ex.msg : exStr |
| | | showModal(tip, "错误", false,"确定") |
| | | }, |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | getDestText(item) { |
| | | const index = this.taskData.taskList.findIndex((a) => a.taskID == item.taskID) |
| | | if (index > -1) { |
| | | return this.taskData.taskList[index]?.dest?.name || "" |
| | | return this.taskData.taskList[index].dest?.name || "" |
| | | } |
| | | return "" |
| | | }, |
| | |
| | | } else if (task.actionType === 2) { |
| | | actionText = "取货" |
| | | } else if (task.actionType === 3) { |
| | | actionText = `卸货 等待${taskData.taskList[index]?.wait || 0}秒` |
| | | actionText = `卸货 等待${task.wait || 0}秒` |
| | | } else if (task.actionType === 4) { |
| | | actionText = "人工" |
| | | } |
| | |
| | | <template> |
| | | <view class="pages-task-log-item vert-line"> |
| | | <view class="btn-no "> {{taskData.taskButton}} |
| | | <view class="btn-no "> {{taskData.task_button}} |
| | | </view> |
| | | <view class="content"> |
| | | <view class="line"> |
| | | <view class="title"> {{taskData.taskGroupName}}</view> |
| | | <view class="status" :style="{'background-color':taskStatusColor+ '20','color':taskStatusColor}"> |
| | | <view class="title"> {{taskData.task_group_name}}</view> |
| | | <view class="status" :style="{'background-color':taskStatusColor+ '10','color':taskStatusColor}"> |
| | | {{taskStatusText}} |
| | | </view> |
| | | </view> |
| | | <view class="line"><text class="text">{{taskData.startTime}}-{{taskData.endTime}} </text> |
| | | <text class="text">{{taskData.duration}}min</text> |
| | | <text class="text">{{taskData.cycleNumber}}次</text> |
| | | <view class="line"><text class="text">{{ startTime}} - {{endTime}} </text> |
| | | <text class="text">{{Math.ceil((taskData.end_time- taskData.start_time) / (60* 1000)) }}min</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | |
| | | </template> |
| | | |
| | |
| | | } |
| | | }, |
| | | computed: { |
| | | startTime() { |
| | | const date = new Date(Number(this.taskData.start_time)) |
| | | return`${date.getHours()}:${date.getMinutes()}`; |
| | | }, |
| | | endTime() { |
| | | const date = new Date(Number(this.taskData.end_time)) |
| | | return `${date.getHours()}:${date.getMinutes()}`; |
| | | }, |
| | | taskStatusText() { |
| | | let statusText = "" |
| | | if (this.taskData.status == 1) { |
| | | statusText = "任务执行中" |
| | | } else if (this.taskData.status == 2) { |
| | | if (this.taskData.task_status == "finish") { |
| | | statusText = "任务完成" |
| | | } else if (this.taskData.status == 3) { |
| | | statusText = "任务取消" |
| | | } else if (this.taskData.status == 4) { |
| | | } else if (this.taskData.task_status == "cancel") { |
| | | statusText = "任务异常" |
| | | } else if (this.taskData.status == 5) { |
| | | statusText = "任务强制完成" |
| | | } else { |
| | | statusText = "" |
| | | statusText = this.taskData.task_status |
| | | } |
| | | return statusText |
| | | }, |
| | | taskStatusText() { |
| | | let statusText = "" |
| | | if (this.taskData.task_status == "finish") { |
| | | statusText = "任务完成" |
| | | } else if (this.taskData.task_status == "cancel") { |
| | | statusText = "任务异常" |
| | | } else { |
| | | statusText = this.taskData.task_status |
| | | } |
| | | return statusText |
| | | }, |
| | | taskStatusColor() { |
| | | let statusColor = "" |
| | | if (this.taskData.status == 1) { |
| | | statusColor = "#0055ff" |
| | | } else if (this.taskData.status == 2) { |
| | | statusColor = "#237804" |
| | | } else if (this.taskData.status == 3) { |
| | | statusColor = "#787277" |
| | | } else if (this.taskData.status == 4) { |
| | | statusColor = "#D4380D" |
| | | } else if (this.taskData.status == 5) { |
| | | statusColor = "#55aa00" |
| | | } else if (this.taskData.status == 5) { |
| | | if (this.taskData.task_status == "finish") { |
| | | statusColor = "#38861a" |
| | | } else if (this.taskData.task_status == "cancel") { |
| | | statusColor = "#d64017" |
| | | } else if (this.taskData.task_status == 5) { |
| | | statusColor = "#000000" |
| | | } |
| | | return statusColor |
| | |
| | | <uni-icons color="#ccc" type="info" size="128"></uni-icons> |
| | | <view class="space">没有找到符合条件的任务</view> |
| | | </view> |
| | | <view class="position-add" @click="clickAddTask()" @touchstart='btnAddTouchStart' @touchmove='btnAddTouchMove' |
| | | <view class="position-add" @click="clickAddTask" @touchstart='btnAddTouchStart' @touchmove='btnAddTouchMove' |
| | | :style="{transform:`translate(${btnAddInfo.x}px,${btnAddInfo.y}px) scale(1)`}"> |
| | | <uni-icons class="img" type="plus-filled" size="80" color="#1890FF"></uni-icons> |
| | | </view> |
| | |
| | | showToast, |
| | | showModal, |
| | | session, |
| | | showError, |
| | | showInfo |
| | | } from "@/comm/utils.js" |
| | | import TaskItemView from "./infos/task-item.vue" |
| | | import { |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | loading:false, |
| | | ip: "", |
| | | sceneId: "", |
| | | list: [], |
| | |
| | | this.ip = option.ip || "" |
| | | this.sceneId = option.sceneId || "" |
| | | this.isPageVisible = true |
| | | |
| | | this.$nextTick(()=>{ |
| | | this.loadData() |
| | | }) |
| | | |
| | | }, |
| | | onShow() { |
| | | this.isPageVisible = true |
| | |
| | | |
| | | } catch (ex) { |
| | | |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | async loadTaskList() { |
| | |
| | | const res = await tasks(this.ip) |
| | | const list = res?.data || [] |
| | | this.list = list |
| | | showToast(`装载了${list.length}任务`) |
| | | } catch (ex) { |
| | | |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | |
| | | }, |
| | | |
| | | async timerCheckTaskGroupStatus() { |
| | | try { |
| | | if (this.isPageVisible) |
| | | await this.checkTaskGroupStatus() |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | } finally { |
| | | setTimeout(this.timerCheckTaskGroupStatus, 1000); |
| | | } catch (ex) { |
| | | showError(ex).then((res)=>{ |
| | | setTimeout(this.timerCheckTaskGroupStatus, 1000); |
| | | }) |
| | | } finally { |
| | | |
| | | } |
| | | }, |
| | | async checkTaskGroupStatus() { |
| | |
| | | } catch (ex) { |
| | | |
| | | this.taskStatus = {} |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | setTaskGroupStatus(cmdID) { |
| | |
| | | }, |
| | | clickAddTask() { |
| | | const _this = this |
| | | |
| | | uni.navigateTo({ |
| | | url: `/pages/task/add?ip=${this.ip}&title=新增任务`, |
| | | events: { |
| | |
| | | this.setTaskGroupStatus(cmdID) |
| | | |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | |
| | |
| | | await addTaskGroupCmd(this.ip, item.taskGroupID, this.taskStatus.taskGroupCmdID, 2) |
| | | showToast("终止任务成功") |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | |
| | |
| | | showToast("未找到未开始或正在执行的子任务") |
| | | } |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | |
| | |
| | | this.list = [...list] |
| | | |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | |
| | | }, |
| | | |
| | | |
| | | showError(ex) { |
| | | let exStr = JSON.stringify(ex) |
| | | if (exStr == "{}") |
| | | exStr = ex |
| | | let tip = typeof ex.msg == "string" ? ex.msg : typeof ex.errMsg == "string" ? ex.errMsg : exStr |
| | | showModal(tip, "错误", false, "确定") |
| | | }, |
| | | } |
| | | } |
| | | </script> |
| | |
| | | <view class="list-content" v-if="list.length > 0"> |
| | | <view class="header"> |
| | | <view class="item"> |
| | | <view class="title">{{accumulatedDuration}}<text class="text">min</text></view> |
| | | <view class="title">{{totalDuration}}<text class="text">min</text></view> |
| | | <view class="text">累计时长</view> |
| | | </view> |
| | | <!-- <view class="item"> |
| | | <view class="title">{{accumulatedMileage}}<text class="text">m</text></view> |
| | | <view class="text">累计里程</view> |
| | | </view> --> |
| | | |
| | | <view class="item"> |
| | | <view class="title">{{cumulativeCount}}</view> |
| | | <view class="title">{{totalCount}}</view> |
| | | <view class="text">累计次数</view> |
| | | </view> |
| | | </view> |
| | | <view class="list"> |
| | | <view class="task-header" v-if="fixedList.length > 0">固定任务</view> |
| | | <template v-for="(group) in fixedList" :key="group.date"> |
| | | <!-- <view class="task-header" v-if="fixedList.length > 0">固定任务</view> --> |
| | | <template v-for="(group) in taskList" :key="group.date"> |
| | | <view class="task-header">{{group.date}}</view> |
| | | <view class="task-list-view"> |
| | | <TaskLogItemView class="list-item" v-for="(item,index) in group.list" :key="index" :taskData="item"> |
| | | <TaskLogItemView class="list-item" v-for="(item,index) in group.list" :key="index" |
| | | :taskData="item"> |
| | | </TaskLogItemView> |
| | | </view> |
| | | </template> |
| | | <view class="task-header" v-if="tempList.length > 0">临时任务</view> |
| | | <!-- <view class="task-header" v-if="tempList.length > 0">临时任务</view> |
| | | <template v-for="(group) in tempList" :key="group.date"> |
| | | <view class="task-header">{{group.date}}</view> |
| | | <view class="task-list-view"> |
| | | <TaskLogItemView class="list-item" v-for="(item,index) in group.list" :key="index" :taskData="item"> |
| | | <TaskLogItemView class="list-item" v-for="(item,index) in group.list" :key="index" |
| | | :taskData="item"> |
| | | |
| | | </TaskLogItemView> |
| | | </view> |
| | | </template> |
| | | </template> --> |
| | | </view> |
| | | </view> |
| | | <view class="list-no-content" v-else> |
| | |
| | | <script> |
| | | import { |
| | | showToast, |
| | | showModal |
| | | showModal, |
| | | showError, |
| | | showInfo |
| | | } from "@/comm/utils.js" |
| | | import TaskLogItemView from "./infos/task-log-item.vue" |
| | | import { |
| | |
| | | } |
| | | }, |
| | | computed: { |
| | | taskList() { |
| | | const listRes = [] |
| | | this.list.forEach((ele) => { |
| | | const dateStart = new Date(Number(ele.start_time)) |
| | | const date = `${dateStart.getMonth()}-${dateStart.getDay()}`; |
| | | const curIndex = listRes.findIndex((a) => a.date == date) |
| | | if (curIndex < 0) { |
| | | let group = { |
| | | date, |
| | | list: [ele] |
| | | } |
| | | listRes.push(group) |
| | | } else { |
| | | let group = listRes[curIndex] |
| | | group.list.push(ele) |
| | | } |
| | | |
| | | }) |
| | | listRes.sort((a, b) => { |
| | | return a.date < b.date ? 1 : -1 |
| | | }); |
| | | return listRes |
| | | }, |
| | | fixedList() { |
| | | let list = this.list.filter((a) => a.tasktype == 1) |
| | | let group |
| | |
| | | }) |
| | | return listRes |
| | | }, |
| | | tempList() { |
| | | let list = this.list.filter((a) => a.tasktype == 2) |
| | | let group |
| | | const listRes = [] |
| | | list.sort((a, b) => { |
| | | return a.date > b.date |
| | | }); |
| | | list.forEach((item) => { |
| | | if (group) { |
| | | if (item.date != group.date) { |
| | | group = { |
| | | date: item.date, |
| | | list: [] |
| | | } |
| | | listRes.push(group) |
| | | } |
| | | } else { |
| | | group = { |
| | | date: item.date, |
| | | list: [] |
| | | } |
| | | listRes.push(group) |
| | | } |
| | | group.list.push(item) |
| | | }) |
| | | return listRes |
| | | }, |
| | | accumulatedDuration() { |
| | | let res = 0 |
| | | totalDuration() { |
| | | let d = 0 |
| | | // this.list.forEach((item) => { |
| | | // d += item.duration || 0 |
| | | // }) |
| | | this.list.forEach((item) => { |
| | | res += item.duration || 0 |
| | | d +=( item.end_time - item.start_time) |
| | | }) |
| | | return res |
| | | return Math.ceil(d / (60 * 1000)) |
| | | }, |
| | | accumulatedMileage() { |
| | | let res = 0 |
| | | this.list.forEach((item) => { |
| | | res += item.accumulated_mileage || 0 |
| | | }) |
| | | return res |
| | | }, |
| | | cumulativeCount() { |
| | | let res = 0 |
| | | this.list.forEach((item) => { |
| | | res += item.cycleNumber || 0 |
| | | }) |
| | | return res |
| | | totalCount() { |
| | | let cnt =this.list.length |
| | | // this.list.forEach((item) => { |
| | | // cnt += item.list.length |
| | | // }) |
| | | return cnt |
| | | }, |
| | | }, |
| | | onLoad(option) { |
| | |
| | | }, |
| | | async loadData() { |
| | | try { |
| | | /*this.list = [{ |
| | | type: 0, |
| | | taskButton: 1, |
| | | name: "1号站点到2号站点", |
| | | date: "5-18", |
| | | accumulated_duration: 5693, |
| | | accumulated_mileage: 6421, |
| | | cumulative_number: 55, |
| | | status: 1, |
| | | }, { |
| | | type: 0, |
| | | taskButton: 2, |
| | | name: "2号站点到1号站点", |
| | | date: "5-08", |
| | | accumulated_duration: 888, |
| | | accumulated_mileage: 642, |
| | | cumulative_number: 31, |
| | | status: 2, |
| | | }, { |
| | | type: 0, |
| | | taskButton: 1, |
| | | name: "1号站点到2号站点", |
| | | date: "4-28", |
| | | accumulated_duration: 998, |
| | | accumulated_mileage: 2421, |
| | | cumulative_number: 85, |
| | | status: 2, |
| | | }, { |
| | | type: 0, |
| | | taskButton: 2, |
| | | name: "2号站点到1号站点", |
| | | date: "4-28", |
| | | accumulated_duration: 688, |
| | | accumulated_mileage: 1421, |
| | | cumulative_number: 65, |
| | | status: 4, |
| | | }, { |
| | | type: 1, |
| | | taskButton: 3, |
| | | name: "1号站点到2号站点", |
| | | date: "5-18", |
| | | accumulated_duration: 5693, |
| | | accumulated_mileage: 6421, |
| | | cumulative_number: 55, |
| | | status: 2, |
| | | }, { |
| | | type: 1, |
| | | taskButton: 4, |
| | | name: "2号站点到1号站点", |
| | | date: "5-08", |
| | | accumulated_duration: 888, |
| | | accumulated_mileage: 642, |
| | | cumulative_number: 31, |
| | | status: 2, |
| | | }, { |
| | | type: 1, |
| | | taskButton: 3, |
| | | name: "1号站点到2号站点", |
| | | date: "4-28", |
| | | accumulated_duration: 998, |
| | | accumulated_mileage: 2421, |
| | | cumulative_number: 85, |
| | | status: 2, |
| | | }, { |
| | | type: 1, |
| | | taskButton: 4, |
| | | name: "2号站点到1号站点", |
| | | date: "4-28", |
| | | accumulated_duration: 688, |
| | | accumulated_mileage: 1421, |
| | | cumulative_number: 65, |
| | | status: 2, |
| | | |
| | | }]*/ |
| | | this.list = await this.loadTaskLog() |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | async loadTaskLog() { |
| | | try { |
| | | |
| | | const now = new Date(); |
| | | const oneWeekAgo = new Date(); |
| | | const endTimeStamp = `${now.getTime()}` |
| | |
| | | const res = await getTaskLog(this.ip, startTimeStamp, endTimeStamp) |
| | | |
| | | const list = res?.task_info || [] |
| | | console.log(list) |
| | | list.forEach((ele) => { |
| | | |
| | | console.log(ele) |
| | | const dateStart = new Date() |
| | | dateStart.setTime(Number(ele.taskStartTimeStamp)) |
| | | ele.date = `${dateStart.getMonth()}-${dateStart.getDay()}`; |
| | | let taskList = ele.taskList || [] |
| | | taskList.sort((a, b) => { |
| | | return a.lastUpdateTimeStamp > b.lastUpdateTimeStamp |
| | | list.sort((a, b) => { |
| | | return a.end_time < b.end_time ? 1 : -1 |
| | | }); |
| | | console.log(taskList) |
| | | ele.startTime = `${dateStart.getHours()}:${dateStart.getMinutes()}`; |
| | | ele.endTime = ele.startTime |
| | | ele.duration = 0; |
| | | ele.status = 0 |
| | | // console.log(ele) |
| | | if (taskList.length > 0) { |
| | | const dateEnd = new Date() |
| | | dateEnd.setTime(Number(taskList[taskList.length - 1].lastUpdateTimeStamp)) |
| | | for (let i in taskList) { |
| | | const ele2 = taskList[i] |
| | | if (ele2.status == 1) { |
| | | ele.status = 1 |
| | | break; |
| | | } else if (ele2.status == 2 || ele2.status == 4 || ele2.status == 5) { |
| | | ele.status = 2 |
| | | break; |
| | | } |
| | | } |
| | | if (!ele.status) { |
| | | if (taskList.filter((a) => a.status != 3).length == 0) { |
| | | ele.status = 3 |
| | | } |
| | | } |
| | | const diffInMs = dateEnd - dateStart; // 或者 Math.abs(date1 - date2) |
| | | ele.endTime = `${dateEnd.getHours()}:${dateEnd.getMinutes()}`; |
| | | ele.duration = Math.round(diffInMs / (1000 * 60)) |
| | | console.log(ele) |
| | | } |
| | | }) |
| | | console.log(list) |
| | | |
| | | showToast(`装载了${list.length}记录`) |
| | | return list |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | return [] |
| | | } |
| | | }, |
| | |
| | | // url: "/pages/task/index" |
| | | // }) |
| | | }, |
| | | showError(ex) { |
| | | let exStr = JSON.stringify(ex) |
| | | if (exStr == "{}") |
| | | exStr = ex |
| | | let tip = typeof ex.msg == "string" ? ex.msg : exStr |
| | | showModal(tip, "错误", false,"确定") |
| | | }, |
| | | |
| | | } |
| | | } |
| | | </script> |
| | |
| | | border-radius: 10rpx; |
| | | // padding: 0 10rpx; |
| | | background-color: #fff; |
| | | |
| | | .list-item { |
| | | |
| | | border-bottom: 1px solid #ddd; |
| | | } |
| | | |
| | | .list-item:last-child { |
| | | border-bottom: 0; |
| | | /* 右下角 */ |
| | |
| | | <script> |
| | | import { |
| | | showToast, |
| | | showModal |
| | | showModal, |
| | | showError, |
| | | showInfo |
| | | } from "@/comm/utils.js" |
| | | import { |
| | | Button |
| | |
| | | const info = await stations(this.ip) |
| | | this.stationList = info.station_list || [] |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | async clickSave() { |
| | |
| | | showToast("未选择任务属性!") |
| | | return |
| | | } |
| | | uni.showLoading({ |
| | | title:"任务更新中" |
| | | }) |
| | | const task = { |
| | | taskGroupID: this.form.taskGroupID, |
| | | taskGroupName: name, |
| | |
| | | delta: 1, //返回层数,2则上上页 |
| | | }) |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | finally { |
| | | uni.hideLoading() |
| | | } |
| | | }, |
| | | clickCancel() { |
| | |
| | | }) |
| | | |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | |
| | | }, |
| | |
| | | closeMenu() { |
| | | this.$refs.refPopupMenu.close() |
| | | }, |
| | | showError(ex) { |
| | | let exStr = JSON.stringify(ex) |
| | | if (exStr == "{}") |
| | | exStr = ex |
| | | let tip = typeof ex.msg == "string" ? ex.msg : exStr |
| | | showModal(tip, "错误", false,"确定") |
| | | }, |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | <script> |
| | | import { |
| | | showToast, |
| | | showModal |
| | | showModal, |
| | | showError, |
| | | showInfo |
| | | } from "@/comm/utils.js" |
| | | import { |
| | | Button |
| | |
| | | |
| | | } catch (ex) { |
| | | |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | async loadAgvState() { |
| | |
| | | const info = await getAgvState(this.ip) |
| | | return info |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | return {} |
| | | } |
| | | }, |
| | |
| | | const info = await stations(this.ip) |
| | | return info.station_list || [] |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | return [] |
| | | } |
| | | }, |
| | |
| | | } |
| | | |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | |
| | | }, |
| | |
| | | this.askTeachingBiDirection(this.teachingModeCur) |
| | | } |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | |
| | | }, |
| | |
| | | } |
| | | |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | async clickTeachingStart() { |
| | |
| | | stationTeaching.splice(curIndex, 1) |
| | | _this.teachingStart("Stations") |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | |
| | | } else { |
| | |
| | | } |
| | | |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | clickTeachingEnd() { |
| | |
| | | _this.teachingMode = await getTeachingMode(_this.ip) |
| | | |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | } else { |
| | | _this.teachingStatus = "save" |
| | |
| | | |
| | | this.teachingStatus = "save" |
| | | try {} catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | |
| | | }, |
| | |
| | | |
| | | } |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | async clickNoCalibration() { |
| | |
| | | |
| | | } |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | askTeachingBiDirection(teachingMode) { |
| | |
| | | this.teachingMode = await getTeachingMode(this.ip) |
| | | this.teachingStatus = "end" |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | clickBackTeaching() { |
| | | this.$refs.refPopupCalibration.close() |
| | | this.teachingStatus = "" |
| | | }, |
| | | showError(ex) { |
| | | let exStr = JSON.stringify(ex) |
| | | if (exStr == "{}") |
| | | exStr = ex |
| | | let tip = typeof ex.msg == "string" ? ex.msg : exStr |
| | | showModal(tip, "错误", false, "确定") |
| | | }, |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | showToast, |
| | | showModal, |
| | | session, |
| | | showError, |
| | | showInfo |
| | | } from "@/comm/utils.js" |
| | | import { |
| | | Button |
| | |
| | | |
| | | } catch (ex) { |
| | | |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | |
| | |
| | | this.teachingPublic = data?.Public || [] |
| | | this.teachingStation = data?.Stations || [] |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | clickAddTeaching() { |
| | |
| | | } |
| | | |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | |
| | | }, |
| | | |
| | | showError(ex) { |
| | | let exStr = JSON.stringify(ex) |
| | | if (exStr == "{}") |
| | | exStr = ex |
| | | let tip = typeof ex.msg == "string" ? ex.msg : exStr |
| | | showModal(tip, "错误", false,"确定") |
| | | }, |
| | | |
| | | |
| | | } |