修改4F agv

yangwl
夜笙歌 2 weeks ago
parent c93aa37262
commit 2d0d1e6f97

@ -101,7 +101,7 @@
<div :class="`${i.isGoods? 'agv2':'agv1'}`" v-for="i in agvData"
:style="`${getLocation(i.x,i.y)}transform: rotate(${parseFloat(i.rotate )- 90}deg);`"></div>
:style="`${getLocation(i.x,i.y)}transform: rotate(${parseFloat(i.rotate )- 180}deg);`"></div>
</div>
</div>
</template>
@ -277,8 +277,8 @@ export default {
equipmentData: [],
agvData: [],
siteData: {
x:250000,
y:200000
x: 121000,
y: 82000
}
}
},
@ -293,11 +293,12 @@ export default {
getAgvLocation() {
let agvArr = []
getAgvData().then(e => {
console.log(Math.max(...e.Data.map(v => v.X)), Math.max(...e.Data.map(v => v.Y)))
e.Data.forEach(v => {
agvArr.push({
id: v.AgvId,
x: Math.random() || v.X/this.siteData.x,
y: Math.random() || v.Y/this.siteData.y,
x: (v.X - 126000) / this.siteData.x,
y: (72000 - (v.Y - 116000)) / this.siteData.y,
rotate: v.Angle,
isGoods: false,
})
@ -309,12 +310,18 @@ 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:v.X/this.siteData.x, y: v.Y/this.siteData.y}, time).start()
new TWEEN.Tween(this.agvData.find(r => r.id === v.AgvId)).to({
rotate: v.Angle,
}, 100).start()
new TWEEN.Tween(this.agvData.find(r => r.id === v.AgvId)).to({
x: (v.X - 126000) / this.siteData.x,
y: (72000 - (v.Y - 116000)) / this.siteData.y,
}, time - 100).start()
} else {
this.agvData.push({
id: v.AgvId,
x: Math.random() || v.X/this.siteData.x,
y: Math.random() || v.Y/this.siteData.y,
x: (v.X - 126000) / this.siteData.x,
y: (72000 - (v.Y - 116000)) / this.siteData.y,
rotate: v.Angle,
isGoods: false,
})
@ -340,13 +347,15 @@ export default {
mounted() {
this.getData()
this.getAgvLocation()
let time = 2 * 1000
setInterval(() => {
this.updateAGVLocation(5*1000)
},5*1000)
this.updateAGVLocation(time)
}, time)
setInterval(() => {
this.loopIndex = (this.loopIndex + 1) % 26
}, 1000 * 5)
function animate() {
requestAnimationFrame(animate)
TWEEN.update()

Loading…
Cancel
Save