From d8743368ffda9bc0fb2c6818f695a9a6b1079e57 Mon Sep 17 00:00:00 2001
From: cuiqian2004 <cuiqian2004@163.com>
Date: 星期五, 19 九月 2025 18:22:15 +0800
Subject: [PATCH] laster
---
pages/task/infos/task-log-item.vue | 59 +
pages/teaching/index.vue | 38
pages/task/update.vue | 24
pages/map/scene.vue | 107 ++-
comm/utils.js | 76 +
pages/map/teaching.vue | 78 +-
pages/index/connect.vue | 20
pages/station/index.vue | 29
pages/my/log-detail.vue | 5
pages/map/js/ctx.js | 443 ++++++-------
api/request.js | 11
package.json | 1
pages/map/task.vue | 15
package-lock.json | 7
pages/teaching/list.vue | 15
pages/task/add.vue | 24
pages/task/list.vue | 42
pages/index/detail.vue | 14
/dev/null | 383 -----------
pages/task/infos/task-item.vue | 4
pages/map/infos/scene-create.vue | 8
pages/task/log-list.vue | 253 ++-----
pages/map/index.vue | 242 +++---
pages/index/index.vue | 19
pages/map/js/ctx-mini.js | 6
pages/index/backup.vue | 46
pages.json | 7
manifest.json | 4
28 files changed, 752 insertions(+), 1,228 deletions(-)
diff --git a/api/request.js b/api/request.js
index dd77289..7e3c7d5 100644
--- a/api/request.js
+++ b/api/request.js
@@ -8,7 +8,8 @@
// "Content-Type": "application/json;charset=UTF-8"
// },
method: "GET",
- dataType: "json"
+ dataType: "json",
+
},
addLog(item) {
const list = session.getValue("request_log") || []
@@ -28,7 +29,7 @@
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") || {}
@@ -47,7 +48,7 @@
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)
}
@@ -60,7 +61,7 @@
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)
}
@@ -121,7 +122,7 @@
} else {
reject({
- msg: ret.msg || ""
+ msg: ret.msg || ret.message|| ""
});
}
},
diff --git a/comm/utils.js b/comm/utils.js
index c3df92c..a109d14 100644
--- a/comm/utils.js
+++ b/comm/utils.js
@@ -18,35 +18,77 @@
})
}
-export function showToast(title, icon) {
- uni.showToast({
- title: title,
- icon: icon ? icon : 'none'
- })
-}
-export function showInfo(ex){
- if( !ex)
+export function showToast(ex) {
+ if (!ex)
return
- let tip =ex
- console.log(ex);
- if( typeof ex !== "string" )
- {
+ 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.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"
+ });
+ // 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") {
+ 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"
+ // });
+ 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);
diff --git a/manifest.json b/manifest.json
index 3f2ec68..db7bf66 100644
--- a/manifest.json
+++ b/manifest.json
@@ -2,8 +2,8 @@
"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" : {
diff --git a/package-lock.json b/package-lock.json
index 9b54f8c..42022fa 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -7,7 +7,6 @@
"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"
@@ -1338,9 +1337,9 @@
}
},
"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": {
diff --git a/package.json b/package.json
index 9220115..4e35f38 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,6 @@
"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"
diff --git a/pages.json b/pages.json
index cf34dcc..07b1844 100644
--- a/pages.json
+++ b/pages.json
@@ -108,12 +108,7 @@
"navigationBarTitleText": "鍦板浘"
}
},
- {
- "path": "pages/map/edit",
- "style": {
- "navigationBarTitleText": "缂栬緫鍦板浘"
- }
- },
+
{
"path": "pages/map/teaching",
"style": {
diff --git a/pages/index/backup.vue b/pages/index/backup.vue
index 6ca1706..acdc864 100644
--- a/pages/index/backup.vue
+++ b/pages/index/backup.vue
@@ -72,7 +72,8 @@
session,
showToast,
showModal,
- showInfo
+ showInfo,
+ showError
} from "@/comm/utils.js"
import {
getAllScene,
@@ -139,7 +140,7 @@
console.log(this.pageList[1].list)
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
async loadScene() {
@@ -148,7 +149,7 @@
const list = res?.sceneList || []
return list
} catch (ex) {
- this.showError(ex)
+ showError(ex)
return []
}
},
@@ -157,7 +158,7 @@
const list = session.getValue("scene_db") || []
return list
} catch (ex) {
- this.showError(ex)
+ showError(ex)
return []
}
},
@@ -211,6 +212,9 @@
this.setData({
loading: true
})
+ uni.showLoading({
+ title:"姝e湪涓婁紶鍦烘櫙"
+ })
const scene = this.pageList[0].list[index]
await handoffScene(this.ip, "", scene)
session.setValue("scene_db", [])
@@ -222,15 +226,16 @@
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()
}
},
@@ -256,30 +261,29 @@
this.setData({
loading: true
})
- console.log(this.pageList[1].list[index])
+ uni.showLoading({
+ title:"姝e湪涓嬭浇鍦烘櫙"
+ })
+
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>
diff --git a/pages/index/connect.vue b/pages/index/connect.vue
index f7ff7a2..ff1ed67 100644
--- a/pages/index/connect.vue
+++ b/pages/index/connect.vue
@@ -56,7 +56,9 @@
import {
session,
showToast,
- showModal
+ showModal,
+ showError,
+ showInfo
} from "@/comm/utils.js"
import {
Button
@@ -143,7 +145,7 @@
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
checkConnectStatus() {
@@ -181,11 +183,11 @@
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]
@@ -291,7 +293,7 @@
} catch (ex) {
console.log("connectVehicle faile",this.ip,ex)
this.connectState = 3
- // this.showError(ex)
+ // showError(ex)
}
},
@@ -360,14 +362,6 @@
}, 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>
diff --git a/pages/index/detail.vue b/pages/index/detail.vue
index 0413f43..5c410d6 100644
--- a/pages/index/detail.vue
+++ b/pages/index/detail.vue
@@ -71,7 +71,9 @@
<script>
import {
showToast,
- showModal
+ showModal,
+ showError,
+ showInfo
} from "@/comm/utils.js"
import {
Button
@@ -129,7 +131,7 @@
const info = await shellVersion(this.vehicleIp)
this.car_version = info.software_version
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
clickDelete() {
@@ -164,13 +166,7 @@
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,"纭畾")
- },
+
}
}
diff --git a/pages/index/index.vue b/pages/index/index.vue
index 63dadb8..3fcc182 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -123,7 +123,9 @@
import {
session,
showToast,
- showModal
+ showModal,
+ showError,
+ showInfo
} from "@/comm/utils.js"
import {
getAllScene,
@@ -280,7 +282,7 @@
}
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
@@ -304,7 +306,7 @@
this.pageList = [...list]
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
@@ -409,7 +411,7 @@
}
}
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
async checkConnectSuccess(ip) {
@@ -532,7 +534,7 @@
}
})
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
@@ -618,13 +620,6 @@
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()
diff --git a/pages/map/edit.vue b/pages/map/edit.vue
deleted file mode 100644
index a88ebd4..0000000
--- a/pages/map/edit.vue
+++ /dev/null
@@ -1,345 +0,0 @@
-<template>
- <view class="pages-map-edit">
- <view class="view-content">
- <view class="no-content" v-if="unlinked">
- <image class="img" src="/images/image 25.png" alt=" 鍥剧墖" mode="aspectFit" />
- <view class="title">杞﹁締杩炴帴澶辫触</view>
- <view class="space">璇锋鏌ヤ綘鐨勭綉缁滆缃垨閲嶆柊鍔犺浇</view>
- </view>
- <view class="map-content" v-show="!unlinked">
-
- </view>
- </view>
- <view class="bottom" v-if="!unlinked">
-
- <view class="bottom-content">
- <view class="img-button-group">
- <view fill="none" class="button" @click="clickPathTeaching">
- <text class="ico teach"></text>
- <view class="text">璺緞绀烘暀</view>
- </view>
- <view fill="none" class="button" @click="clickMapRename">
- <text class="ico teach disabled"></text>
- <view class="text disabled">閲嶅懡鍚�/view>
- </view>
- <view fill="none" class="button" @click="clickRegionalPlanning">
- <text class="ico teach disabled"></text>
- <view class="text disabled">鍖哄煙瑙勫垝</view>
- </view>
- <view fill="none" class="button " @click="clickMapEdit">
- <text class="ico teach disabled"></text>
- <view class="text disabled">淇敼鍦板浘</view>
- </view>
- </view>
-
- </view>
- </view>
-
- </view>
-</template>
-<script>
- import {
- showToast,
- showModal
- } from "@/comm/utils.js"
- // import OIFabric from "@/components/oi-fabric/index.vue"
- import {
- Button
- } from 'antd-mobile-vue-next'
-
- import {
- getAgvState,
- } from "@/api/vehicle.js"
- export default {
- name: "PagesMapEdit",
- components: {
- 'a-button': Button
- },
- data() {
- return {
- navigationBarTitle: "",
- vehicleIp: "",
- stationList: [],
- unlinked: true
- }
- },
- computed: {
- getMaxStationNo() {
- let num = 0
- this.stationList.forEach((item) => {
- if (num < item.stationID) {
- num = item.stationID
- }
- })
- return num
- },
- },
- watch: {
-
- },
- onLoad(option) {
- const _this = this
- this.vehicleIp = option.ip || ""
-
- this.loadData()
-
- },
- methods: {
- setData(obj) {
- let that = this;
- let keys = [];
- let val, data;
-
- Object.keys(obj).forEach(function(key) {
- keys = key.split(".");
- val = obj[key];
- data = that.$data;
- keys.forEach(function(key2, index) {
- if (index + 1 == keys.length) {
- that.$set(data, key2, val);
- } else {
- if (!data[key2]) {
- that.$set(data, key2, {});
- }
- }
- data = data[key2];
- });
- });
- },
- async loadData() {
- try {
- const info = await getAgvState(this.vehicleIp)
- this.setData({
- unlinked: false
- })
- } catch (ex) {
- this.setData({
- unlinked: true
- })
-
- }
- },
- clickShowMenu() {
- this.$refs.refPopupMenu.open("top")
- },
- clickBack() {
- uni.navigateBack({
- delta: 1
- })
-
- },
- clickPathTeaching() {
- uni.navigateTo({
- url: `/pages/teaching/index?ip=${this.vehicleIp}`
- })
- },
- clickRegionalPlanning() {
-
- },
- clickMapRename() {
-
- },
- clickMapEdit() {
-
- },
-
- showError(ex) {
- let exStr = JSON.stringify(ex)
- if (exStr == "{}")
- exStr = ex
- let tip = typeof ex.msg == "string" ? ex.msg : exStr
- showModal(tip, "閿欒", false,"纭畾")
- },
-
-
- }
- }
-</script>
-
-<style lang="scss">
- .pages-map-edit {
- display: flex;
- width: 750rpx;
- height: 100vh;
- background-color: #fff;
- position: relative;
-
- .uni-navbar-container-inner {
- display: flex;
- flex: 1;
- flex-direction: row;
- align-items: center;
- justify-content: center;
- font-size: 40rpx;
- overflow: hidden;
- font-weight: 700;
- color: #333;
-
- .icon {
- width: 30rpx;
- height: 16rpx;
- }
- }
-
- .uni-nav-bar-text {
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- }
-
- .view-content {
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- display: flex;
- flex-direction: column;
- }
-
- .map-content {
- width: 100%;
- display: flex;
- flex: 1;
- margin: auto;
-
- .text-button-group {
- display: flex;
- width: 100%;
- justify-content: center;
- align-items: center;
- flex-direction: column;
- font-size: 30rpx !important;
- background-color: #eee;
-
- .button {
- margin-top: 20rpx;
- width: 375rpx;
- }
- }
-
-
- }
-
- .no-content {
- margin-top: 50px;
- padding: 20rpx 40rpx;
- align-items: center;
- text-align: center;
- display: flex;
- flex-direction: column;
- font-size: 30rpx;
- font-weight: 400;
-
- .title {
- font-size: 40rpx;
- margin-bottom: 10rpx;
- }
-
-
- }
-
- .bottom {
- position: fixed;
- left: 50rpx;
- right: 50rpx;
- bottom: 20rpx;
- display: flex;
-
- .bottom-content {
- display: flex;
- flex-direction: column;
- width: 100%;
- // justify-content: center;
- // align-items: center;
- padding: 0 10rpx;
- padding-bottom: 10rpx;
- background-color: #fff;
- border-radius: 10rpx;
- }
-
-
-
- }
-
- .img-button-group {
- display: flex;
- //width: 100%;
- flex-direction: row;
- border-radius: 10px;
- border: 1px solid #fff;
- font-size: 30rpx !important;
- justify-content: space-around;
-
- .button {
- margin: 10rpx 20rpx;
-
- height: 144rpx !important;
- border: 0;
- display: flex;
- flex-direction: column;
- background-color: #00000000;
-
- .img {
- margin: auto;
- width: 72rpx;
- height: 72rpx;
-
- }
-
- .ico {
- margin: auto;
- font-size: 72rpx;
- color: #1890FF;
- }
-
- .text {
- margin: auto;
-
- }
- }
-
- }
-
- .disabled {
- color: #ccc !important;
- }
-
- .popup-content {
- display: flex;
- justify-content: center;
- flex-direction: column;
- background-color: transparent;
- }
-
- .popup-content-menu {
- margin-top: 75px;
- margin-left: 120px;
- width: 150px;
- align-items: center;
- justify-content: center;
- flex-direction: column;
- background-color: #fff;
- border-radius: 5px;
- border: 1px solid gray;
- }
-
- .popup-content-menu-item {
- display: flex;
- flex-wrap: nowrap;
- flex-direction: row !important;
- align-items: center;
- padding: 4px 8px;
- font-size: 16px;
-
- .img {
- width: 20px;
- height: 20px;
- margin: 5px;
- }
- }
-
-
-
- }
-</style>
\ No newline at end of file
diff --git a/pages/map/index.vue b/pages/map/index.vue
index 98e8b78..e176d03 100644
--- a/pages/map/index.vue
+++ b/pages/map/index.vue
@@ -393,6 +393,8 @@
showToast,
showModal,
session,
+ showError,
+ showInfo
} from "@/comm/utils.js"
// import OIFabric from "@/components/oi-fabric/index.vue"
import {
@@ -480,6 +482,7 @@
img_x: 1,
img_y: 1
},
+ positioningAgv: false
}
},
computed: {
@@ -575,7 +578,7 @@
this.setData({
unlinked: true
})
- this.showError(ex)
+ showError(ex)
}
},
@@ -719,11 +722,12 @@
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)
}
}
@@ -806,7 +810,7 @@
const info = await getAgvState(this.vehicleIp)
return info
} catch (ex) {
- this.showError(ex)
+ showError(ex)
return {}
}
},
@@ -815,7 +819,7 @@
const paths = await getCurrentTeachingData(this.vehicleIp) || []
return paths
} catch (ex) {
- this.showError(ex)
+ showError(ex)
return []
}
},
@@ -825,7 +829,7 @@
const info = await stations(this.vehicleIp)
return info.station_list || []
} catch (ex) {
- this.showError(ex)
+ showError(ex)
return []
}
},
@@ -834,7 +838,7 @@
const info = await getMapUrl(this.vehicleIp, id)
return info
} catch (ex) {
- this.showError(ex)
+ showError(ex)
return {}
}
},
@@ -864,20 +868,21 @@
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({
@@ -914,20 +919,21 @@
},
{
- 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)
}
},
@@ -1086,7 +1092,14 @@
}
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() {
@@ -1138,11 +1151,9 @@
mode: "Public",
main_road: 1,
}
+ this.positioningAgv = true
this.mapOperationType = "public_teaching"
this.ctxDataStr = JSON.stringify([{
- method: "set_selectable",
- param: false,
- }, {
method: "public_teaching",
}])
@@ -1190,7 +1201,7 @@
}
} catch (ex) {
- this.showError(ex)
+ showError(ex)
} finally {
uni.hideLoading()
}
@@ -1208,7 +1219,7 @@
if (this.sceneList.length > 0)
this.changeMap(this.sceneList[0])
} catch (ex) {
- this.showError(ex)
+ showError(ex)
} finally {
uni.hideLoading()
}
@@ -1263,7 +1274,7 @@
param: [this.regionEdit]
},
{
- method: "move_canvas",
+ method: "move_pt_center",
param: {
x: agv.x,
y: agv.y
@@ -1272,7 +1283,7 @@
])
}
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
async clickPlanProhibitionRegion() {
@@ -1309,7 +1320,7 @@
param: [this.regionEdit]
},
{
- method: "move_canvas",
+ method: "move_pt_center",
param: {
x: agv.x,
y: agv.y
@@ -1318,7 +1329,7 @@
])
}
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
@@ -1350,7 +1361,7 @@
param: [this.wallEdit]
},
{
- method: "move_canvas",
+ method: "move_pt_center",
param: {
x: agv.x,
y: agv.y
@@ -1358,7 +1369,7 @@
}
])
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
@@ -1387,7 +1398,7 @@
showToast("鍦烘櫙閲嶅懡鍚嶆垚鍔燂紒")
} catch (ex) {
this.mapOperationType = "edit_scene_name"
- this.showError(ex)
+ showError(ex)
} finally {
uni.hideLoading()
this.loading = false
@@ -1416,12 +1427,13 @@
this.mapOperationType = ""
},
clickStationDelete() {
- const _this = this
- showModal("璇ョ珯鐐瑰凡缁戝畾浠诲姟锛屽垹闄ょ珯鐐瑰悗缁戝畾鐨勪换鍔′細鍋滄骞跺垹闄�, "鏄惁纭鍒犻櫎锛�).then((res) => {
- if (res) {
- this.stationDelete(this.stationEdit)
- }
- })
+ this.stationDelete(this.stationEdit)
+ // const _this = this
+ // showModal("璇ョ珯鐐瑰凡缁戝畾浠诲姟锛屽垹闄ょ珯鐐瑰悗缁戝畾鐨勪换鍔′細鍋滄骞跺垹闄�, "鏄惁纭鍒犻櫎锛�).then((res) => {
+ // if (res) {
+
+ // }
+ // })
},
async stationAdd(item) {
try {
@@ -1440,7 +1452,7 @@
} catch (ex) {
- this.showError(ex)
+ showError(ex)
} finally {
uni.hideLoading()
}
@@ -1463,7 +1475,7 @@
}
} catch (ex) {
- this.showError(ex)
+ showError(ex)
} finally {
uni.hideLoading()
}
@@ -1477,6 +1489,7 @@
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)
@@ -1487,7 +1500,7 @@
}])
this.mapOperationType = ''
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
async stationDelete(item) {
@@ -1514,7 +1527,7 @@
}])
} catch (ex) {
- this.showError(ex)
+ showError(ex)
} finally {
uni.hideLoading()
}
@@ -1559,14 +1572,14 @@
},
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,
@@ -1589,7 +1602,7 @@
method: "edit_station_pos",
param: this.stationEdit
}, {
- method: "move_canvas",
+ method: "move_pt_center",
param: {
x: agv.x,
y: agv.y
@@ -1613,7 +1626,7 @@
}
} catch (ex) {
- this.showError(ex)
+ showError(ex)
} finally {
this.loading = false
}
@@ -1639,7 +1652,7 @@
method: "update_station",
param: [this.stationEdit]
}, {
- method: "move_canvas",
+ method: "move_pt_center",
param: {
x: this.stationEdit.x,
y: this.stationEdit.y
@@ -1654,7 +1667,7 @@
method: "update_station",
param: [this.stationEdit]
}, {
- method: "move_canvas",
+ method: "move_pt_center",
param: {
x: this.stationEdit.x,
y: this.stationEdit.y
@@ -1667,7 +1680,7 @@
method: "update_station",
param: [this.stationEdit]
}, {
- method: "move_canvas",
+ method: "move_pt_center",
param: {
x: this.stationEdit.x,
y: this.stationEdit.y
@@ -1680,7 +1693,7 @@
method: "update_station",
param: [this.stationEdit]
}, {
- method: "move_canvas",
+ method: "move_pt_center",
param: {
x: this.stationEdit.x,
y: this.stationEdit.y
@@ -1766,19 +1779,20 @@
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() {
@@ -1801,7 +1815,7 @@
param: [this.stationEdit]
},
{
- method: "move_canvas",
+ method: "move_pt_center",
param: {
x: infoAgv.x,
y: infoAgv.y
@@ -1811,7 +1825,7 @@
])
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
async loadTeachingMode() {
@@ -1825,7 +1839,7 @@
}
} catch (ex) {
- this.showError(ex)
+ showError(ex)
return {
Public: [],
Stations: []
@@ -1836,6 +1850,9 @@
try {
this.teachingMode = await this.loadTeachingMode()
this.ctxDataStr = JSON.stringify([{
+ method: "clear_teaching_path",
+ },
+ {
method: "public_teaching_path",
param: this.teachingMode.Public || []
},
@@ -1851,7 +1868,7 @@
])
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
@@ -1893,14 +1910,13 @@
}
])
} 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
@@ -1917,13 +1933,28 @@
}
})
}
+ 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 {
// 鏃犺鎴愬姛澶辫触锛� 绉掑悗鍐嶆潵
- setTimeout(this.refreshAgvPosition, 1000);
+
}
},
@@ -1946,12 +1977,11 @@
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()
}
@@ -1969,7 +1999,7 @@
await _this.teachingStart("Public")
} catch (ex) {
- this.showError(ex)
+ showError(ex)
} finally {
this.loading = false
uni.hideLoading()
@@ -1996,7 +2026,7 @@
_this.mapOperationStatus = ""
} catch (ex) {
- this.showError(ex)
+ showError(ex)
} finally {
this.loading = false
}
@@ -2013,7 +2043,7 @@
this.mapOperationStatus = "save"
try {} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
@@ -2071,7 +2101,7 @@
}
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
@@ -2094,41 +2124,27 @@
.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(
"宸插皢璇ヨ矾娈佃矾寰勪繚瀛樹负涓昏矾绀烘暀璺嚎"
@@ -2138,10 +2154,25 @@
"宸插皢璇ヨ矾娈佃矾寰勪繚瀛樹负鏀矾绀烘暀璺嚎"
)
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 =
@@ -2149,7 +2180,7 @@
}
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
clickTeachingDelete() {
@@ -2188,7 +2219,7 @@
param: item,
}])
} catch (ex) {
- this.showError(
+ showError(
ex)
} finally {
uni.hideLoading()
@@ -2202,24 +2233,11 @@
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,
- "纭畾")
- },
-
}
}
diff --git a/pages/map/index2.vue b/pages/map/index2.vue
deleted file mode 100644
index 3d67348..0000000
--- a/pages/map/index2.vue
+++ /dev/null
@@ -1,383 +0,0 @@
-<template>
- <view class="pages-map">
- <view class="view-content">
- <view class="no-content" v-if="unlinked">
- <image class="img" src="/images/image 25.png" alt=" 鍥剧墖" mode="aspectFit" />
- <view class="title">杞﹁締杩炴帴澶辫触</view>
- <view class="space">璇锋鏌ヤ綘鐨勭綉缁滆缃垨閲嶆柊鍔犺浇</view>
- </view>
- <view class="map-content" v-else-if="sceneList.length ==0">
- <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">
- 寮�鏋勫缓
- </a-button>
- <a-button type="primary" class="button" @click="clickDownloadScene">
- 涓嬭浇鍦烘櫙
- </a-button>
- </view>
-
- </view>
- <view class="map-content" v-else>
- <view class="text-button-group">
- <a-button type="primary" class="button" @click="clickStationList">
- 绔欑偣鍒楄〃
- </a-button>
- <a-button type="primary" class="button" @click="clickTeachingList">
- 绀烘暀璺嚎鍒楄〃
- </a-button>
- </view>
-
- </view>
- </view>
- <view class="bottom" v-if="sceneList.length > 0">
-
- <view class="bottom-content">
- <view class="img-button-group">
- <view fill="none" class="button" @click="clickMapStation">
- <text class="ico location1"></text>
- <view class="text"> 娣诲姞绔欑偣</view>
- </view>
- <view type="text" class="button" @click="clickMapEdit">
- <text class="ico edit-line"></text>
- <view class="text"> 缂栬緫鍦板浘</view>
- </view>
- <view type="text" class="button" @click="clickMapTask">
- <text class="ico task-list"></text>
- <view class="text">杞﹁締浠诲姟</view>
-
- </view>
- </view>
-
- </view>
- </view>
-
- </view>
-</template>
-<script>
- import {
- showToast,
- showModal
- } from "@/comm/utils.js"
- // import OIFabric from "@/components/oi-fabric/index.vue"
- import {
- Button
- } from 'antd-mobile-vue-next'
-
- import {
- getAgvState,
- getAllScene
- } from "@/api/vehicle.js"
- export default {
- name: "PagesMap",
- components: {
- 'a-button': Button
- },
- data() {
- return {
- navigationBarTitle: "",
- vehicleIp: "",
- stationList: [],
- sceneList: [{name:"鍦板浘1"}],
- unlinked: true
- }
- },
- computed: {
- getMaxStationNo() {
- let num = 0
- this.stationList.forEach((item) => {
- if (num < item.stationID) {
- num = item.stationID
- }
- })
- return num
- },
- },
- watch: {
-
- },
- onLoad(option) {
- const _this = this
- this.vehicleIp = option.ip || ""
-
- this.loadData()
-
- },
- methods: {
- setData(obj) {
- let that = this;
- let keys = [];
- let val, data;
-
- Object.keys(obj).forEach(function(key) {
- keys = key.split(".");
- val = obj[key];
- data = that.$data;
- keys.forEach(function(key2, index) {
- if (index + 1 == keys.length) {
- that.$set(data, key2, val);
- } else {
- if (!data[key2]) {
- that.$set(data, key2, {});
- }
- }
- data = data[key2];
- });
- });
- },
- async loadData() {
- try {
- const res = await getAllScene(this.vehicleIp)
- //this.sceneList = res.sceneList || []
- this.setData({
- unlinked: false
- })
- } catch (ex) {
- this.setData({
- unlinked: true
- })
-
- }
- },
- clickShowMenu() {
- this.$refs.refPopupMenu.open("top")
- },
- clickBack() {
- uni.navigateBack({
- delta: 1
- })
-
- },
- clickStationList() {
- uni.navigateTo({
- url: `/pages/station/index?ip=${this.vehicleIp}`
- })
- },
- clickTeachingList() {
- uni.navigateTo({
- url: `/pages/teaching/list?ip=${this.vehicleIp}`
- })
- },
- clickMapStation() {
- uni.navigateTo({
- url: `/pages/station/index?ip=${this.vehicleIp}&isAdd=1`
- })
- },
- clickMapEdit() {
- uni.navigateTo({
- url: `/pages/map/edit?ip=${this.vehicleIp}`
- })
- },
- clickMapTask() {
- uni.navigateTo({
- url: `/pages/map/task?ip=${this.vehicleIp}`
- })
- },
- clickStartConstructScene() {
- uni.navigateTo({
- url: `/pages/scene/index?ip=${this.vehicleIp}`
- })
- },
- clickDownloadScene() {
-
- },
- showError(ex) {
- let exStr = JSON.stringify(ex)
- if (exStr == "{}")
- exStr = ex
- let tip = typeof ex.msg == "string" ? ex.msg : exStr
- showModal(tip, "閿欒", false,"纭畾")
- },
-
-
- }
- }
-</script>
-
-<style lang="scss">
- .pages-map {
- display: flex;
- width: 750rpx;
- height: 100vh;
- background-color: #fff;
- position: relative;
-
- .uni-navbar-container-inner {
- display: flex;
- flex: 1;
- flex-direction: row;
- align-items: center;
- justify-content: center;
- font-size: 40rpx;
- overflow: hidden;
- font-weight: 700;
- color: #333;
-
- .icon {
- width: 30rpx;
- height: 16rpx;
- }
- }
-
- .uni-nav-bar-text {
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- }
-
- .view-content {
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- display: flex;
- flex-direction: column;
- }
-
- .map-content {
- width: 100%;
- display: flex;
- flex: 1;
- margin: auto;
- flex-direction: column;
- align-items: center;
- justify-content: center;
-
- .text-button-group {
- display: flex;
- width: 100%;
- justify-content: center;
- align-items: center;
- flex-direction: column;
- font-size: 30rpx !important;
-
- .button {
- margin-top: 20rpx;
- width: 375rpx;
- }
- }
-
-
- }
-
- .no-content {
- margin-top: 50px;
- padding: 20rpx 40rpx;
- align-items: center;
- text-align: center;
- display: flex;
- flex-direction: column;
- font-size: 30rpx;
- font-weight: 400;
-
- .title {
- font-size: 40rpx;
- margin-bottom: 10rpx;
- }
-
-
- }
-
- .bottom {
- position: fixed;
- left: 50rpx;
- right: 50rpx;
- bottom: 20rpx;
- display: flex;
-
- .bottom-content {
- display: flex;
- flex-direction: column;
- width: 100%;
- // justify-content: center;
- // align-items: center;
- padding: 0 10rpx;
- padding-bottom: 10rpx;
- background-color: #fff;
- border-radius: 10rpx;
- }
-
-
-
- }
-
- .img-button-group {
- display: flex;
- //width: 100%;
- flex-direction: row;
- border-radius: 10px;
- border: 1px solid #fff;
- font-size: 30rpx !important;
- justify-content: space-around;
-
- .button {
- margin: 10rpx 20rpx;
-
- height: 144rpx !important;
- border: 0;
- display: flex;
- flex-direction: column;
- background-color: #00000000;
-
- .img {
- margin: auto;
- width: 72rpx;
- height: 72rpx;
-
- }
-
- .ico {
- margin: auto;
- font-size: 72rpx;
- color: #1890FF;
- }
-
- .text {
- margin: auto;
-
- }
- }
-
- }
-
-
- .popup-content {
- display: flex;
- justify-content: center;
- flex-direction: column;
- background-color: transparent;
- }
-
- .popup-content-menu {
- margin-top: 75px;
- margin-left: 120px;
- width: 150px;
- align-items: center;
- justify-content: center;
- flex-direction: column;
- background-color: #fff;
- border-radius: 5px;
- border: 1px solid gray;
- }
-
- .popup-content-menu-item {
- display: flex;
- flex-wrap: nowrap;
- flex-direction: row !important;
- align-items: center;
- padding: 4px 8px;
- font-size: 16px;
-
- .img {
- width: 20px;
- height: 20px;
- margin: 5px;
- }
- }
-
-
-
- }
-</style>
\ No newline at end of file
diff --git a/pages/map/infos/scene-create.vue b/pages/map/infos/scene-create.vue
index 793bc09..67a281b 100644
--- a/pages/map/infos/scene-create.vue
+++ b/pages/map/infos/scene-create.vue
@@ -57,6 +57,8 @@
showToast,
showModal,
session,
+ showError,
+ showInfo
} from "@/comm/utils.js"
import {
Button
@@ -139,7 +141,7 @@
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
async loadMapLaserData() {
@@ -147,7 +149,7 @@
const info = await getMapLaserData(this.ip)
return info
} catch (ex) {
- this.showError(ex)
+ showError(ex)
return {}
}
},
@@ -177,7 +179,7 @@
await createScene(this.ip, name, 1)
this.$emit('update:opSceneType', "scan");
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
diff --git a/pages/map/js/ctx-mini.js b/pages/map/js/ctx-mini.js
index a07a0b5..e5014a9 100644
--- a/pages/map/js/ctx-mini.js
+++ b/pages/map/js/ctx-mini.js
@@ -2349,10 +2349,10 @@
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));*/
@@ -3082,7 +3082,7 @@
} 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 = {
diff --git a/pages/map/js/ctx.js b/pages/map/js/ctx.js
index d1b6b1b..837925d 100644
--- a/pages/map/js/ctx.js
+++ b/pages/map/js/ctx.js
@@ -21,6 +21,10 @@
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';
@@ -59,8 +63,7 @@
img_x: 1,
img_y: 1
},
- pressObjTimer: 0
-
+ pressObjTimer: 0,
}
},
mounted() {
@@ -353,7 +356,9 @@
mainObj: obj
});
this.canvas.add(objGroup)
-
+ this.$ownerInstance.callMethod('receiveRenderData', {
+ method: "cancel_positioning_agv",
+ });
},
canvasEventListener() {
@@ -375,7 +380,7 @@
_this.canvas.requestRenderAll();
_this.onSelectionChanage()
- //_this.selectionChangeCanvas();
+
});
_this.canvas.on("selection:updated", function(e) {
console.log("selection:updated", e);
@@ -409,9 +414,6 @@
_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);
@@ -497,41 +499,57 @@
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]
@@ -539,29 +557,28 @@
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()
@@ -735,7 +752,7 @@
const objects = this.canvas.getObjects();
objects.splice(0, 1);
- this.canvas.discardActiveObject()
+ const objActive = this.canvas.getActiveObject()
let pointerList = []
let pointerList2 = []
@@ -745,14 +762,14 @@
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)
}
@@ -764,26 +781,35 @@
const obj = pointerList[i];
if (obj instanceof fabric.Path || obj instanceof fabric.Line) {
if (this.isPointOnStroke(obj, pointer, 1)) {
- this.canvas.discardActiveObject()
- this.canvas.setActiveObject(obj);
- this.canvas.requestRenderAll();
+ if (objActive != obj) {
+
+ this.canvas.discardActiveObject()
+ this.canvas.setActiveObject(obj);
+ this.canvas.requestRenderAll();
+ }
return
}
pointerList2.unshift(obj)
} else {
- this.canvas.discardActiveObject()
- this.canvas.setActiveObject(obj);
- this.canvas.requestRenderAll();
+ 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];
- this.canvas.discardActiveObject()
- this.canvas.setActiveObject(obj);
- this.canvas.requestRenderAll();
+ const obj = pointerList2[0];
+ if (objActive != obj) {
+
+ this.canvas.discardActiveObject()
+ this.canvas.setActiveObject(obj);
+ this.canvas.requestRenderAll();
+ }
return
}
pointerList = pointerList2
@@ -791,9 +817,12 @@
for (let i = pointerList.length - 1; i >= 0; i--) {
const obj = pointerList[i];
if (this.isPointOnStroke(obj, pointer, 2)) {
- this.canvas.discardActiveObject()
- this.canvas.setActiveObject(obj);
- this.canvas.requestRenderAll();
+ if (objActive != obj) {
+
+ this.canvas.discardActiveObject()
+ this.canvas.setActiveObject(obj);
+ this.canvas.requestRenderAll();
+ }
return
}
pointerList2.unshift(obj)
@@ -801,10 +830,13 @@
}
if (pointerList2.length > 0) {
if (pointerList2.length == 1) {
- const obj = pointerList2[i];
- this.canvas.discardActiveObject()
- this.canvas.setActiveObject(obj);
- this.canvas.requestRenderAll();
+ const obj = pointerList2[0];
+ if (objActive != obj) {
+
+ this.canvas.discardActiveObject()
+ this.canvas.setActiveObject(obj);
+ this.canvas.requestRenderAll();
+ }
return
}
pointerList = pointerList2
@@ -812,9 +844,12 @@
for (let i = pointerList.length - 1; i >= 0; i--) {
const obj = pointerList[i];
if (this.isPointOnStroke(obj, pointer, 3)) {
- this.canvas.discardActiveObject()
- this.canvas.setActiveObject(obj);
- this.canvas.requestRenderAll();
+ if (objActive != obj) {
+
+ this.canvas.discardActiveObject()
+ this.canvas.setActiveObject(obj);
+ this.canvas.requestRenderAll();
+ }
return
}
pointerList2.unshift(obj)
@@ -822,10 +857,13 @@
}
if (pointerList2.length > 0) {
if (pointerList2.length == 1) {
- const obj = pointerList2[i];
- this.canvas.discardActiveObject()
- this.canvas.setActiveObject(obj);
- this.canvas.requestRenderAll();
+ const obj = pointerList2[0];
+ if (objActive != obj) {
+
+ this.canvas.discardActiveObject()
+ this.canvas.setActiveObject(obj);
+ this.canvas.requestRenderAll();
+ }
return
}
pointerList = pointerList2
@@ -833,9 +871,12 @@
for (let i = pointerList.length - 1; i >= 0; i--) {
const obj = pointerList[i];
if (this.isPointOnStroke(obj, pointer, 4)) {
- this.canvas.discardActiveObject()
- this.canvas.setActiveObject(obj);
- this.canvas.requestRenderAll();
+ if (objActive != obj) {
+
+ this.canvas.discardActiveObject()
+ this.canvas.setActiveObject(obj);
+ this.canvas.requestRenderAll();
+ }
return
}
pointerList2.unshift(obj)
@@ -844,9 +885,12 @@
if (pointerList2.length > 0) {
const obj = pointerList2[pointerList2.length - 1];
- this.canvas.discardActiveObject()
- this.canvas.setActiveObject(obj);
- this.canvas.requestRenderAll();
+ if (objActive != obj) {
+
+ this.canvas.discardActiveObject()
+ this.canvas.setActiveObject(obj);
+ this.canvas.requestRenderAll();
+ }
return
}
// objects.forEach(obj => {
@@ -1081,40 +1125,7 @@
},
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)
@@ -1136,49 +1147,6 @@
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
@@ -1313,19 +1281,19 @@
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) {
@@ -1426,13 +1394,15 @@
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() {
@@ -1544,7 +1514,11 @@
clearTimeout(this.pressObjTimer);
this.pressObjTimer = null
}
+ this.$ownerInstance.callMethod('receiveRenderData', {
+ method: "cancel_positioning_agv",
+ });
}
+
// 绉诲姩瑙嗗彛
// console.log('relativePan', deltaX, deltaY);
const vpt = this.canvas.viewportTransform;
@@ -1775,7 +1749,9 @@
}
//console.log(scale, scaleAuto)
this.setZoomAuto(scale, center)
-
+ this.$ownerInstance.callMethod('receiveRenderData', {
+ method: "cancel_positioning_agv",
+ });
// console.log('澶氱偣绉诲姩 - 璺濈:', distance, '瑙掑害:', angle);
// 澶氱偣绉诲姩閫昏緫
},
@@ -2112,8 +2088,6 @@
pos_list.push(item)
}
})
-
- console.log(posArr.length, pos_list.length)
let path2 = ""
const theta = 20;
@@ -2212,7 +2186,8 @@
}
- //console.log(path2)
+
+ // console.log("addTeachingPath",path2)
// path2 += " Z"
let strokeWidth = 1
let stroke = "#95DE64"
@@ -2248,22 +2223,12 @@
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
@@ -2298,7 +2263,8 @@
},
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) {
@@ -2366,10 +2332,6 @@
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",
@@ -2434,30 +2396,6 @@
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) {
@@ -3122,7 +3060,7 @@
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)
}
@@ -3205,38 +3143,54 @@
ensurePointVisible(pt) {
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) {
@@ -3293,18 +3247,27 @@
} 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) {
@@ -3509,14 +3472,17 @@
}
})
} 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
@@ -3535,34 +3501,31 @@
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]
diff --git a/pages/map/scene.vue b/pages/map/scene.vue
index 4da13fa..74d3bfd 100644
--- a/pages/map/scene.vue
+++ b/pages/map/scene.vue
@@ -17,6 +17,9 @@
</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' ">
@@ -64,6 +67,8 @@
showToast,
showModal,
session,
+ showError,
+ showInfo
} from "@/comm/utils.js"
import {
Button
@@ -94,7 +99,9 @@
showClearName: false,
mapId: "",
ctxDataStr: "[]",
- localSceneList: []
+ localSceneList: [],
+ positioningAgv: true,
+ robotPos: {}
}
},
@@ -139,6 +146,10 @@
})
return true
+ } else if (this.opSceneType == "finish") {
+ const eventChannel = this.getOpenerEventChannel();
+ eventChannel.emit('create_finish', this.sceneName);
+ return false
} else {
return false
}
@@ -186,7 +197,7 @@
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
receiveRenderData(param) {
@@ -219,6 +230,8 @@
})
}
+ } else if (param.method == "cancel_positioning_agv") {
+ this.positioningAgv = false
}
},
@@ -227,7 +240,7 @@
const list = session.getValue("scene_db") || []
return list
} catch (ex) {
- this.showError(ex)
+ showError(ex)
return []
}
},
@@ -250,7 +263,7 @@
delta: 1, //杩斿洖灞傛暟锛�鍒欎笂涓婇〉
})
} catch (ex) {
- this.showError(ex)
+ showError(ex)
} finally {
this.loading = false
uni.hideLoading()
@@ -286,7 +299,7 @@
} catch (ex) {
- this.showError(ex)
+ showError(ex)
this.opSceneType = 'add_name'
} finally {
this.loading = false
@@ -349,7 +362,6 @@
title: "缁撴潫鍦烘櫙鏋勫缓"
})
this.opSceneType = ""
- await createScene(this.ip, this.sceneName, 0)
const eventChannel = this.getOpenerEventChannel();
eventChannel.emit('create_finish', this.sceneName);
uni.navigateBack({
@@ -376,7 +388,7 @@
const info = await getMapLaserData(this.ip, this.mapId)
return info
} catch (ex) {
- this.showError(ex)
+ showError(ex)
return {}
}
},
@@ -388,7 +400,7 @@
const listCtrData = []
if (data.base_map?.image_base64) {
-
+ this.robotPos = {}
this.mapId = data.base_map.map_id
listCtrData.push({
method: "background",
@@ -404,49 +416,56 @@
filedata: data.base_map.image_base64
}
})
+
+
+ }
+ listCtrData.push({
+ method: "agv_laser",
+ param: data.robot_pose
+ })
+ listCtrData.push({
+ method: "point_cloud",
+ param: data.point_cloud
+ })
+ if (this.positioningAgv) {
listCtrData.push({
- method: "agv_laser",
- param: data.robot_pose
- })
- listCtrData.push({
- method: "point_cloud",
- param: data.point_cloud
- })
- listCtrData.push({
- method: "move_canvas",
+ method: "move_pt_visible",
param: {
x: data.robot_pose.x,
- y: data.robot_pose.y
+ y: data.robot_pose.y,
+ width:50,
+ height:50,
}
})
-
- } else {
- listCtrData.push({
- method: "agv_laser",
- param: data.robot_pose
- })
- listCtrData.push({
- method: "point_cloud",
- param: data.point_cloud
- })
}
+
this.ctxDataStr = JSON.stringify(listCtrData)
+ this.robotPos = {
+ x: data.robot_pose.x,
+ y: data.robot_pose.y
+ }
}
- } catch (ex) {
- this.showError(ex)
- } finally {
- // 鏃犺鎴愬姛澶辫触锛� 绉掑悗鍐嶆潵
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
+ }
+ }])
+ }
+
+
},
@@ -475,6 +494,16 @@
background-color: #fff;
}
+ .position {
+ position: absolute;
+ right: 50rpx;
+ bottom: 500rpx;
+
+ .ico {
+ font-size: 65rpx;
+ color: #1890FF;
+ }
+ }
}
diff --git a/pages/map/task.vue b/pages/map/task.vue
index df03da6..6a4ee73 100644
--- a/pages/map/task.vue
+++ b/pages/map/task.vue
@@ -33,7 +33,9 @@
<script>
import {
showToast,
- showModal
+ showModal,
+ showError,
+ showInfo
} from "@/comm/utils.js"
import {
Button
@@ -115,7 +117,7 @@
const info = await getAgvState(this.vehicleIp)
return info
} catch (ex) {
- this.showError(ex)
+ showError(ex)
return {}
}
},
@@ -124,7 +126,7 @@
const info = await stations(this.vehicleIp)
return info.station_list || []
} catch (ex) {
- this.showError(ex)
+ showError(ex)
return []
}
},
@@ -137,13 +139,6 @@
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,"纭畾")
},
diff --git a/pages/map/teaching.vue b/pages/map/teaching.vue
index 482b381..bb5182d 100644
--- a/pages/map/teaching.vue
+++ b/pages/map/teaching.vue
@@ -234,7 +234,9 @@
<script>
import {
showToast,
- showModal
+ showModal,
+ showError,
+ showInfo
} from "@/comm/utils.js"
// import OIFabric from "@/components/oi-fabric/index.vue"
import {
@@ -463,7 +465,7 @@
},
{
- method: "move_canvas",
+ method: "move_pt_center",
param: {
x: infoAgv.x,
y: infoAgv.y
@@ -478,7 +480,7 @@
bgProgressPercent: 0,
bgLoading: false
})
- this.showError(ex)
+ showError(ex)
}
},
async loadAgvState() {
@@ -486,7 +488,7 @@
const info = await getAgvState(this.vehicleIp)
return info
} catch (ex) {
- this.showError(ex)
+ showError(ex)
return {}
}
},
@@ -495,7 +497,7 @@
const info = await stations(this.vehicleIp)
return info.station_list || []
} catch (ex) {
- this.showError(ex)
+ showError(ex)
return []
}
},
@@ -504,7 +506,7 @@
const info = await getMapUrl(this.vehicleIp, id)
return info
} catch (ex) {
- this.showError(ex)
+ showError(ex)
return {}
}
},
@@ -519,7 +521,7 @@
}
} catch (ex) {
- this.showError(ex)
+ showError(ex)
return {
Public: [],
Stations: []
@@ -540,7 +542,7 @@
])
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
@@ -701,7 +703,7 @@
param: item,
}])
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
async removeTeachingModeData(data) {
@@ -709,7 +711,7 @@
await delTeachingModeData(this.vehicleIp, data)
this.reloadTeachingMode()
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
clickPublicTeaching() {
@@ -751,7 +753,7 @@
}])
this.mapOperationType = 'public_teaching'
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
async stationAdd(item) {
@@ -768,7 +770,7 @@
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
async teachingStart(mode) {
@@ -812,7 +814,7 @@
}
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
@@ -830,7 +832,7 @@
this.askTeachingBiDirection(this.teachingModeCur)
}
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
@@ -856,7 +858,7 @@
}
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
@@ -870,7 +872,7 @@
}])
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
@@ -900,7 +902,7 @@
stationTeaching.splice(curIndex, 1)
_this.teachingStart("Stations")
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
} else {
@@ -925,7 +927,7 @@
}
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
clickTeachingEnd() {
@@ -948,7 +950,7 @@
_this.reloadTeachingMode()
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
} else {
_this.teachingStatus = "save"
@@ -960,7 +962,7 @@
this.teachingStatus = "save"
try {} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
@@ -1145,7 +1147,7 @@
}
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
@@ -1172,7 +1174,7 @@
}
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
askTeachingBiDirection(teachingMode) {
@@ -1193,7 +1195,7 @@
this.reloadTeachingMode()
this.teachingStatus = "end"
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
clickBackTeaching() {
@@ -1233,7 +1235,7 @@
method: "edit_station_pos",
param: this.stationEdit
}, {
- method: "move_canvas",
+ method: "move_pt_center",
param: {
x: agv.x,
y: agv.y
@@ -1243,7 +1245,7 @@
}
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
@@ -1267,7 +1269,7 @@
method: "update_station",
param: [this.stationEdit]
}, {
- method: "move_canvas",
+ method: "move_pt_center",
param: {
x: this.stationEdit.x,
y: this.stationEdit.y
@@ -1282,7 +1284,7 @@
method: "update_station",
param: [this.stationEdit]
}, {
- method: "move_canvas",
+ method: "move_pt_center",
param: {
x: this.stationEdit.x,
y: this.stationEdit.y
@@ -1295,7 +1297,7 @@
method: "update_station",
param: [this.stationEdit]
}, {
- method: "move_canvas",
+ method: "move_pt_center",
param: {
x: this.stationEdit.x,
y: this.stationEdit.y
@@ -1308,7 +1310,7 @@
method: "update_station",
param: [this.stationEdit]
}, {
- method: "move_canvas",
+ method: "move_pt_center",
param: {
x: this.stationEdit.x,
y: this.stationEdit.y
@@ -1399,14 +1401,14 @@
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() {
@@ -1439,7 +1441,7 @@
])
console.log(this.ctxDataStr)
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
async clickPositionStation() {
@@ -1459,7 +1461,7 @@
param: [this.stationEdit]
},
{
- method: "move_canvas",
+ method: "move_pt_center",
param: {
x: infoAgv.x,
y: infoAgv.y
@@ -1469,16 +1471,8 @@
])
} 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, "纭畾")
},
diff --git a/pages/my/log-detail.vue b/pages/my/log-detail.vue
index 82168f5..3b5d184 100644
--- a/pages/my/log-detail.vue
+++ b/pages/my/log-detail.vue
@@ -16,8 +16,8 @@
</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">缁撴灉
@@ -42,6 +42,7 @@
},
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") || {}
diff --git a/pages/station/index.vue b/pages/station/index.vue
index a4e7884..abf4d17 100644
--- a/pages/station/index.vue
+++ b/pages/station/index.vue
@@ -110,6 +110,8 @@
showToast,
showModal,
session,
+ showError,
+ showInfo
} from "@/comm/utils.js"
// import OIFabric from "@/components/oi-fabric/index.vue"
import {
@@ -258,7 +260,7 @@
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
async loadAgvState() {
@@ -266,7 +268,7 @@
const info = await getAgvState(this.ip)
return info
} catch (ex) {
- this.showError(ex)
+ showError(ex)
return {}
}
},
@@ -275,7 +277,7 @@
const info = await stations(this.ip)
return info.station_list || []
} catch (ex) {
- this.showError(ex)
+ showError(ex)
return []
}
},
@@ -386,7 +388,7 @@
}
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
@@ -433,7 +435,7 @@
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
async stationUpdate(item) {
@@ -449,7 +451,7 @@
}
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
@@ -497,7 +499,7 @@
}
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
@@ -527,7 +529,7 @@
}
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
clickClearName() {
@@ -664,17 +666,10 @@
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,"纭畾")
- },
-
+
}
}
diff --git a/pages/task/add.vue b/pages/task/add.vue
index a4e2980..e0dacb4 100644
--- a/pages/task/add.vue
+++ b/pages/task/add.vue
@@ -103,7 +103,9 @@
<script>
import {
showToast,
- showModal
+ showModal,
+ showError,
+ showInfo
} from "@/comm/utils.js"
import {
Button
@@ -131,6 +133,7 @@
taskGroupName: "",
cycleTime: 1,
taskButton: 0,
+ tasktype:1
},
pathwayList: [{}],
pickerView: {
@@ -203,7 +206,7 @@
const info = await stations(this.ip)
this.stationList = info.station_list || []
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
async clickSave() {
@@ -217,6 +220,9 @@
showToast("鏈�鎷╀换鍔″睘鎬э紒")
return
}
+ uni.showLoading({
+ title:"浠诲姟鏂板涓�
+ })
const taskList = []
const task = {
taskGroupID: uuidv4(),
@@ -251,6 +257,7 @@
return
}
await addTask(this.ip, task)
+
task.taskList = taskList
const eventChannel = this.getOpenerEventChannel();
eventChannel.emit('add_task', task);
@@ -258,7 +265,10 @@
delta: 1, //杩斿洖灞傛暟锛�鍒欎笂涓婇〉
})
} catch (ex) {
- this.showError(ex)
+ showError(ex)
+ }
+ finally {
+ uni.hideLoading()
}
},
clickCancel() {
@@ -468,13 +478,7 @@
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,"纭畾")
- },
+
}
}
diff --git a/pages/task/infos/task-item.vue b/pages/task/infos/task-item.vue
index bf6b196..6cc732f 100644
--- a/pages/task/infos/task-item.vue
+++ b/pages/task/infos/task-item.vue
@@ -216,7 +216,7 @@
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 ""
},
@@ -230,7 +230,7 @@
} 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 = "浜哄伐"
}
diff --git a/pages/task/infos/task-log-item.vue b/pages/task/infos/task-log-item.vue
index 7684d4f..adcd347 100644
--- a/pages/task/infos/task-log-item.vue
+++ b/pages/task/infos/task-log-item.vue
@@ -1,20 +1,20 @@
<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>
@@ -39,36 +39,43 @@
}
},
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
diff --git a/pages/task/list.vue b/pages/task/list.vue
index afa7af0..4d85b88 100644
--- a/pages/task/list.vue
+++ b/pages/task/list.vue
@@ -33,7 +33,7 @@
<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>
@@ -45,6 +45,8 @@
showToast,
showModal,
session,
+ showError,
+ showInfo
} from "@/comm/utils.js"
import TaskItemView from "./infos/task-item.vue"
import {
@@ -68,6 +70,7 @@
},
data() {
return {
+ loading:false,
ip: "",
sceneId: "",
list: [],
@@ -104,8 +107,10 @@
this.ip = option.ip || ""
this.sceneId = option.sceneId || ""
this.isPageVisible = true
-
- this.loadData()
+ this.$nextTick(()=>{
+ this.loadData()
+ })
+
},
onShow() {
this.isPageVisible = true
@@ -159,7 +164,7 @@
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
async loadTaskList() {
@@ -167,20 +172,25 @@
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()
+ setTimeout(this.timerCheckTaskGroupStatus, 1000);
} catch (ex) {
- this.showError(ex)
+ showError(ex).then((res)=>{
+ setTimeout(this.timerCheckTaskGroupStatus, 1000);
+ })
} finally {
- setTimeout(this.timerCheckTaskGroupStatus, 1000);
+
}
},
async checkTaskGroupStatus() {
@@ -210,7 +220,7 @@
} catch (ex) {
this.taskStatus = {}
- this.showError(ex)
+ showError(ex)
}
},
setTaskGroupStatus(cmdID) {
@@ -220,6 +230,7 @@
},
clickAddTask() {
const _this = this
+
uni.navigateTo({
url: `/pages/task/add?ip=${this.ip}&title=鏂板浠诲姟`,
events: {
@@ -305,7 +316,7 @@
this.setTaskGroupStatus(cmdID)
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
@@ -314,7 +325,7 @@
await addTaskGroupCmd(this.ip, item.taskGroupID, this.taskStatus.taskGroupCmdID, 2)
showToast("缁堟浠诲姟鎴愬姛")
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
@@ -345,7 +356,7 @@
showToast("鏈壘鍒版湭寮�鎴栨鍦ㄦ墽琛岀殑瀛愪换鍔�)
}
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
@@ -379,19 +390,12 @@
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>
diff --git a/pages/task/log-list.vue b/pages/task/log-list.vue
index 7d2f6d4..b1c6003 100644
--- a/pages/task/log-list.vue
+++ b/pages/task/log-list.vue
@@ -3,36 +3,35 @@
<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>
@@ -46,7 +45,9 @@
<script>
import {
showToast,
- showModal
+ showModal,
+ showError,
+ showInfo
} from "@/comm/utils.js"
import TaskLogItemView from "./infos/task-log-item.vue"
import {
@@ -59,12 +60,35 @@
},
data() {
return {
- ip:"",
+ ip: "",
sceneId: "",
list: [],
}
},
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
@@ -92,53 +116,22 @@
})
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) {
@@ -170,87 +163,14 @@
},
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()}`
@@ -259,53 +179,16 @@
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
- });
- 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)
+ list.sort((a, b) => {
+ return a.end_time < b.end_time ? 1 : -1
+ });
+
+ showToast(`瑁呰浇浜�{list.length}璁板綍`)
return list
} catch (ex) {
- this.showError(ex)
+ showError(ex)
return []
- }
+ }
},
clickTask(item) {
@@ -313,13 +196,7 @@
// 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>
@@ -377,20 +254,22 @@
overflow: auto;
.task-header {
- width: 100% ;
+ width: 100%;
padding: 10rpx;
font-size: 32rpx;
}
.task-list-view {
- width: 100% ;
+ width: 100%;
border-radius: 10rpx;
// padding: 0 10rpx;
background-color: #fff;
+
.list-item {
-
+
border-bottom: 1px solid #ddd;
}
+
.list-item:last-child {
border-bottom: 0;
/* 鍙充笅瑙�*/
diff --git a/pages/task/update.vue b/pages/task/update.vue
index 421d5a9..72c2f7f 100644
--- a/pages/task/update.vue
+++ b/pages/task/update.vue
@@ -95,7 +95,9 @@
<script>
import {
showToast,
- showModal
+ showModal,
+ showError,
+ showInfo
} from "@/comm/utils.js"
import {
Button
@@ -229,7 +231,7 @@
const info = await stations(this.ip)
this.stationList = info.station_list || []
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
async clickSave() {
@@ -243,6 +245,9 @@
showToast("鏈�鎷╀换鍔″睘鎬э紒")
return
}
+ uni.showLoading({
+ title:"浠诲姟鏇存柊涓�
+ })
const task = {
taskGroupID: this.form.taskGroupID,
taskGroupName: name,
@@ -298,7 +303,10 @@
delta: 1, //杩斿洖灞傛暟锛�鍒欎笂涓婇〉
})
} catch (ex) {
- this.showError(ex)
+ showError(ex)
+ }
+ finally {
+ uni.hideLoading()
}
},
clickCancel() {
@@ -519,7 +527,7 @@
})
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
@@ -550,13 +558,7 @@
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,"纭畾")
- },
+
}
}
diff --git a/pages/teaching/index.vue b/pages/teaching/index.vue
index 924f9a3..d412b91 100644
--- a/pages/teaching/index.vue
+++ b/pages/teaching/index.vue
@@ -150,7 +150,9 @@
<script>
import {
showToast,
- showModal
+ showModal,
+ showError,
+ showInfo
} from "@/comm/utils.js"
import {
Button
@@ -284,7 +286,7 @@
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
async loadAgvState() {
@@ -292,7 +294,7 @@
const info = await getAgvState(this.ip)
return info
} catch (ex) {
- this.showError(ex)
+ showError(ex)
return {}
}
},
@@ -301,7 +303,7 @@
const info = await stations(this.ip)
return info.station_list || []
} catch (ex) {
- this.showError(ex)
+ showError(ex)
return []
}
},
@@ -367,7 +369,7 @@
}
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
@@ -386,7 +388,7 @@
this.askTeachingBiDirection(this.teachingModeCur)
}
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
@@ -405,7 +407,7 @@
}
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
async clickTeachingStart() {
@@ -433,7 +435,7 @@
stationTeaching.splice(curIndex, 1)
_this.teachingStart("Stations")
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
} else {
@@ -452,7 +454,7 @@
}
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
clickTeachingEnd() {
@@ -473,7 +475,7 @@
_this.teachingMode = await getTeachingMode(_this.ip)
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
} else {
_this.teachingStatus = "save"
@@ -485,7 +487,7 @@
this.teachingStatus = "save"
try {} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
@@ -637,7 +639,7 @@
}
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
async clickNoCalibration() {
@@ -662,7 +664,7 @@
}
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
askTeachingBiDirection(teachingMode) {
@@ -683,21 +685,13 @@
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, "纭畾")
- },
-
}
}
diff --git a/pages/teaching/list.vue b/pages/teaching/list.vue
index 8894b87..7d62a86 100644
--- a/pages/teaching/list.vue
+++ b/pages/teaching/list.vue
@@ -44,6 +44,8 @@
showToast,
showModal,
session,
+ showError,
+ showInfo
} from "@/comm/utils.js"
import {
Button
@@ -129,7 +131,7 @@
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
@@ -141,7 +143,7 @@
this.teachingPublic = data?.Public || []
this.teachingStation = data?.Stations || []
} catch (ex) {
- this.showError(ex)
+ showError(ex)
}
},
clickAddTeaching() {
@@ -259,18 +261,11 @@
}
} 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,"纭畾")
- },
}
--
Gitblit v1.9.1