传递参数给实时地图
This commit is contained in:
parent
9e50046f72
commit
30ce5ae75b
@ -29,8 +29,8 @@ export const downloadPositionMap = async (params) => {
|
|||||||
return await request.get({ url: `/system/position-map/download`, params })
|
return await request.get({ url: `/system/position-map/download`, params })
|
||||||
}
|
}
|
||||||
//获得仓库点位地图
|
//获得仓库点位地图
|
||||||
export const getPositionMap = async (params) => {
|
export const getPositionMap = async (id) => {
|
||||||
return await request.get({ url: `/system/position-map/get`, params })
|
return await request.get({ url: `/system/position-map/get?id=` + id })
|
||||||
}
|
}
|
||||||
// 文件上传
|
// 文件上传
|
||||||
export const uploadPositionMap = async (data) => {
|
export const uploadPositionMap = async (data) => {
|
||||||
@ -135,4 +135,4 @@ export const mapLineGet = async (params) => {
|
|||||||
//通过地图id获取连线列表
|
//通过地图id获取连线列表
|
||||||
export const mapLineListGet = async (params) => {
|
export const mapLineListGet = async (params) => {
|
||||||
return await request.get({ url: `/system/position-map-line/list`, params })
|
return await request.get({ url: `/system/position-map-line/list`, params })
|
||||||
}
|
}
|
||||||
|
@ -1993,20 +1993,25 @@ const imgBgObj = reactive({
|
|||||||
height: '',
|
height: '',
|
||||||
floor: '',
|
floor: '',
|
||||||
area: '',
|
area: '',
|
||||||
resolution: 0.05,
|
resolution: 0,
|
||||||
origin: [-54.4, -34.2]
|
origin: null
|
||||||
})
|
})
|
||||||
//接收参数
|
//接收参数
|
||||||
const { query } = useRoute() // 查询参数
|
const { query } = useRoute() // 查询参数
|
||||||
//获取地图点位
|
//获取地图点位
|
||||||
const getMapList = async () => {
|
const getMapList = async () => {
|
||||||
if (query.mapId) {
|
if (!query.mapId) return
|
||||||
imgBgObj.positionMapId = query.mapId
|
let res = await MapApi.getPositionMap(query.mapId)
|
||||||
imgBgObj.floor = query.floor
|
let yamlJson = JSON.parse(res.yamlJson)
|
||||||
imgBgObj.area = query.area
|
imgBgObj.positionMapId = res.id
|
||||||
//调转换成png的接口
|
imgBgObj.floor = res.floor
|
||||||
getMapData(imgBgObj)
|
imgBgObj.area = res.area
|
||||||
}
|
imgBgObj.width = yamlJson.width
|
||||||
|
imgBgObj.height = yamlJson.height
|
||||||
|
imgBgObj.origin = yamlJson.origin
|
||||||
|
imgBgObj.resolution = yamlJson.resolution
|
||||||
|
// //调转换成png的接口
|
||||||
|
getMapData(imgBgObj)
|
||||||
}
|
}
|
||||||
//调转换成png的接口
|
//调转换成png的接口
|
||||||
const getMapData = async (mapInfo) => {
|
const getMapData = async (mapInfo) => {
|
||||||
@ -2016,20 +2021,9 @@ const getMapData = async (mapInfo) => {
|
|||||||
})
|
})
|
||||||
imgBgObj.imgUrl = data
|
imgBgObj.imgUrl = data
|
||||||
|
|
||||||
//获取一下图片的宽高
|
//获取节点 路径等信息
|
||||||
const img = new Image()
|
getAllNodeList()
|
||||||
img.src = imgBgObj.imgUrl
|
getAllMapRoute()
|
||||||
//加载图片成功
|
|
||||||
img.onload = () => {
|
|
||||||
imgBgObj.width = img.naturalWidth
|
|
||||||
imgBgObj.height = img.naturalHeight
|
|
||||||
getAllNodeList()
|
|
||||||
getAllMapRoute()
|
|
||||||
}
|
|
||||||
//加载图片失败
|
|
||||||
img.onerror = () => {
|
|
||||||
console.error('图片加载失败')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//获取所有的点位 处理七种类型的
|
//获取所有的点位 处理七种类型的
|
||||||
const getAllNodeList = async () => {
|
const getAllNodeList = async () => {
|
||||||
@ -2306,6 +2300,20 @@ const removeEventListener = () => {
|
|||||||
window.removeEventListener('keydown', handleKeyDown)
|
window.removeEventListener('keydown', handleKeyDown)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
|
onBeforeRouteLeave((to, from) => {
|
||||||
|
if (to.fullPath == '/mapPage/realTimeMap') {
|
||||||
|
router.replace({
|
||||||
|
name: 'MapPageRealTimeMap',
|
||||||
|
query: {
|
||||||
|
floor: imgBgObj.floor,
|
||||||
|
area: imgBgObj.area,
|
||||||
|
mapId: imgBgObj.positionMapId
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getMapList()
|
getMapList()
|
||||||
window.addEventListener('keydown', handleKeyDown)
|
window.addEventListener('keydown', handleKeyDown)
|
||||||
|
@ -112,7 +112,6 @@ const getList = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
list.value = mapList
|
list.value = mapList
|
||||||
console.log(list.value, data)
|
|
||||||
if (mapValue.value.length) {
|
if (mapValue.value.length) {
|
||||||
handleChangeMap(mapValue.value)
|
handleChangeMap(mapValue.value)
|
||||||
} else {
|
} else {
|
||||||
@ -135,7 +134,6 @@ const handleChangeMap = async (e) => {
|
|||||||
floor: '',
|
floor: '',
|
||||||
area: ''
|
area: ''
|
||||||
}
|
}
|
||||||
console.log(mapInfo.value)
|
|
||||||
indexPageRef.value.getMapData(mapInfo.value)
|
indexPageRef.value.getMapData(mapInfo.value)
|
||||||
}
|
}
|
||||||
//新建任务
|
//新建任务
|
||||||
@ -163,9 +161,7 @@ const editMap = () => {
|
|||||||
router.push({
|
router.push({
|
||||||
name: 'editMapPageRealTimeMap',
|
name: 'editMapPageRealTimeMap',
|
||||||
query: {
|
query: {
|
||||||
mapId: mapInfo.value.id,
|
mapId: mapInfo.value.id
|
||||||
floor: mapInfo.value.floor,
|
|
||||||
area: mapInfo.value.area
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -176,14 +172,12 @@ const mapInfo = ref({
|
|||||||
floor: '',
|
floor: '',
|
||||||
area: ''
|
area: ''
|
||||||
})
|
})
|
||||||
// const transmitMapInfo = (map) => {
|
|
||||||
// mapInfo.value = map
|
|
||||||
// }
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (route.query.floorArea) {
|
if (route.query.mapId) {
|
||||||
console.log(route.query.floorArea, route)
|
mapInfo.value.mapId = route.query.mapId
|
||||||
mapValue.value = JSON.parse(route.query.floorArea)
|
mapInfo.value.floor = route.query.floor
|
||||||
|
mapInfo.value.area = route.query.area
|
||||||
}
|
}
|
||||||
getList()
|
getList()
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user