Compare commits

...

2 Commits

  1. 32
      src/api/util/mapDrawing.js
  2. 5
      src/router/index.js
  3. 28
      src/views/libraryManage/mapRouter/index.vue
  4. 37
      src/views/libraryManage/warehouseMap/index.vue

@ -508,6 +508,7 @@ class MapDrawing extends EventEmitter {
var gubeMaterial = new THREE.MeshMatcapMaterial({
color: self.loadColor(info.color)
})
var gubeMesh = new THREE.Mesh(gube, gubeMaterial)
// gubeMesh.position.set(info.p3[0], info.p3[1], info.p3[2])
gubeMesh.nodeId = info.id
@ -622,7 +623,7 @@ class MapDrawing extends EventEmitter {
canvas.height = info.height
// 设置文字
ctx.fillStyle = 'transparent'
ctx.fillRect(0, 0, info.width, info.height)
rows.map((row, index) => {
// if(latticeForPiler1)
@ -746,15 +747,15 @@ class MapDrawing extends EventEmitter {
/**
* 绘制仓库
*/
drawWarehouses () {
async drawWarehouses () {
// console.log('我不知道我调用了几次');
//调用一次
let self = this
Object.keys(this.property.warehouseInfo.storageRack).map(storageRackId => {
await Promise.all(Object.keys(this.property.warehouseInfo.storageRack).map(storageRackId => {
let storageRack = this.property.warehouseInfo.storageRack[storageRackId]
let stateDictionary = this.property.config.tileStateDictionary[this.property.config.tileStateDictionary.hasOwnProperty(storageRack.state) ? storageRack.state : '0']
//疑似仓库地图 点位`1
console.log(this.property.layer.levels.nowLevel);
// console.log('仓库',this.property.layer.levels.nowLevel);
let storageRackInfo = {
id: storageRack.id,
@ -782,7 +783,7 @@ class MapDrawing extends EventEmitter {
console.log(2222);
storageRack.childNodes = self.drawRactangleInParent(storageRackInfo, freightSpaces, dictionary)
}
})
}))
}
filterFreightSpace (rowIndex, columnIndex, levelIndex) {
@ -805,9 +806,10 @@ class MapDrawing extends EventEmitter {
/**
* 绘制四向车通路
*/
drawRoad () {
async drawRoad () {
let self = this
Object.keys(this.property.warehouseInfo.fourwayCarRoad).map(fourwayCarRoadId => {
await Promise.all(Object.keys(this.property.warehouseInfo.fourwayCarRoad).map(fourwayCarRoadId => {
// console.log('通道')
let fourwayCarRoad = this.property.warehouseInfo.fourwayCarRoad[fourwayCarRoadId]
let stateDictionary = this.property.config.roadStateDictionary[this.property.config.roadStateDictionary.hasOwnProperty(fourwayCarRoad.state) ? fourwayCarRoad.state : '0']
@ -834,7 +836,7 @@ class MapDrawing extends EventEmitter {
} else {
fourwayCarRoad.childNodes = self.drawRactangleInParent(fourwayCarRoadInfo, children, dictionary)
}
})
}))
}
/**
@ -1719,25 +1721,25 @@ class MapDrawing extends EventEmitter {
}
}
initWarehouse () {
initWarehouse () {
if (this.property.warehouseInfo) {
this.drawWarehouses()
if (this.property.config.vehicleType === 1) {
// this.drawPilers()
// this.drawBelt()
} else {
this.drawRoad()
}
this.drawWarehouses()
// this.drawCars()
} else {
this.initLight()
}
this.animate()
this.initEvent()
// if (this.property.grid) {
// this.initGrid(this.property.grid.width, this.property.grid.height, this.property.grid.singleWidth, this.property.grid.singleHeight)
// }
}
}
export default MapDrawing

@ -106,6 +106,11 @@ export const constantRoutes = [
},
],
},
{
path: "/mapRouter",
component: () => import("@/views/libraryManage/mapRouter/index.vue"),
hidden: true,
},
// {
// path: "/",
// component: Layout,

@ -0,0 +1,28 @@
<script setup>
export default {
name: "mapRouter",
data() {
return {}
},
created() {
this.$router.replace('/libraryManage/warehouseMap');
},
// 使 watch
watch: {
'$route': function(to, from) {
// console.log('////')
this.$router.replace('/libraryManage/warehouseMap');
}
},
}
</script>
<template>
<div>
</div>
</template>
<style scoped lang="scss">
</style>

@ -1,6 +1,8 @@
<template>
<div class="app-container">
<div class="app-container"
v-loading="loading"
>
<div
class="dataContainer"
@ -377,7 +379,8 @@ export default {
num2: '',
num3: '',
num4: ''
}
},
loading: false
}
},
mounted() {
@ -388,25 +391,12 @@ export default {
}
var layerId1 = localStorage.getItem('level') || 'level-1'
this.mapControl.layerControl(layerId1, this.layer[layerId1], layerId1.slice(6, 7))
// this.init('piler')
// var layerId1 = localStorage.getItem('level') || 'level-1'
// this.mapControl.layerControl(layerId1, this.layer[layerId1], layerId1.slice(6, 7))
// console.log(layerId1, this.layer[layerId1], layerId1.slice(6, 7), this.layer)
// getLogicalAreaList({ pageNum: 1, pageSize: 999 }).then((response) => {
// this.LogicalAreaList = response.rows
// // this.paging.total = response.total
// this.loading = false
// })
// // clearInterval(timer)
// var timer = setInterval(() => {
// this.startMap()
// // console.log(2222)
// }, 30000)
},
methods: {
init(type) {
let self = this
this.type = type
this.config=JSON.parse(JSON.stringify(sysConfig))
switch (type) {
case 'fourwayCar':
this.config.mutiLayer = true
@ -420,12 +410,14 @@ export default {
this.config.warehouseType = 1
break
}
let container = document.getElementById('mapContainer')
let container=null
container = document.getElementById('mapContainer')
if (container) {
this.config.mapWidth = this.config.columnCount * this.config.standardXLength
this.config.mapHeight = this.config.rowCount * this.config.standardYLength
this.config.leftOffset = this.config.leftOffset - this.config.mapWidth / 2 - this.config.standardXLength / 2 - this.config.standardXLength * this.config.leftOffsetCell
this.config.topOffset = this.config.topOffset - this.config.mapHeight / 2 - this.config.standardYLength / 2 - this.config.standardYLength * this.config.topOffsetCell
this.mapControl =null
this.mapControl = new MapDrawing('mapContainer', {
width: container.offsetWidth - 10,
height: window.innerHeight - 10,
@ -493,6 +485,7 @@ export default {
}
}
this.mapControl.initWarehouse()
} else {
this.init()
}
@ -898,13 +891,9 @@ export default {
}
})
localStorage.setItem('layerItem', JSON.stringify(this.layer))
// }
// this.layer[layerId1]
// this.layer[layerId] = !this.layer[layerId]
// this.mapControl.layerControl(layerId1, this.layer[layerId1], layerId1.slice(6, 7))
// this.mapControl.initWarehouse()
// console.log(this.layer[layerId]);
location.reload()
// location.reload()
this.$router.replace('/mapRouter');
},
getPointPosition(tileData) {
// x

Loading…
Cancel
Save