From c93aa37262866bea96f0bde33f3252a4918b6ff7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=9C=E7=AC=99=E6=AD=8C?= <2277317060@qq.com> Date: Tue, 29 Oct 2024 18:00:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B94F=20agv?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/cs/index2.vue | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/views/cs/index2.vue b/src/views/cs/index2.vue index f183ef0..104b5dd 100644 --- a/src/views/cs/index2.vue +++ b/src/views/cs/index2.vue @@ -275,7 +275,11 @@ export default { ], hfData: [], equipmentData: [], - agvData: [] + agvData: [], + siteData:{ + x:250000, + y:200000 + } } }, methods: { @@ -292,8 +296,8 @@ export default { e.Data.forEach(v => { agvArr.push({ id: v.AgvId, - x: Math.random(), - y: Math.random(), + x: Math.random() || v.X/this.siteData.x, + y: Math.random() || v.Y/this.siteData.y, rotate: v.Angle, isGoods: false, }) @@ -305,12 +309,12 @@ export default { getAgvData().then(e => { e.Data.forEach(v => { if(this.agvData.filter(r=>r.id===v.AgvId).length>=1){ - new TWEEN.Tween(this.agvData.find(r=>r.id===v.AgvId)).to({x: Math.random(), y: Math.random()}, time).start() + new TWEEN.Tween(this.agvData.find(r=>r.id===v.AgvId)).to({x:v.X/this.siteData.x, y: v.Y/this.siteData.y}, time).start() }else{ this.agvData.push({ id: v.AgvId, - x: Math.random(), - y: Math.random(), + x: Math.random() || v.X/this.siteData.x, + y: Math.random() || v.Y/this.siteData.y, rotate: v.Angle, isGoods: false, })