实时地图点位调用两次问题
This commit is contained in:
parent
5847c3eaa4
commit
39c2a529a8
@ -70,6 +70,7 @@
|
||||
<el-option label="停车点" :value="4" />
|
||||
<el-option label="区域变更点" :value="5" />
|
||||
<el-option label="等待点" :value="6" />
|
||||
<el-option label="取放货点" :value="8" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="弧度" prop="locationYaw" required>
|
||||
@ -82,7 +83,6 @@
|
||||
:precision="4"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<div v-if="form.type === 2 || form.type === 3 || form.type === 4">
|
||||
<el-form-item label="层数" prop="layersNumber" required v-if="form.type === 2">
|
||||
<el-input-number
|
||||
@ -175,35 +175,6 @@
|
||||
<span class="ml-2">cm</span>
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
||||
<!-- <div v-if="form.type === 2 || form.type === 4">
|
||||
<el-form-item label="库位方向" prop="direction">
|
||||
<el-select
|
||||
v-model="form.direction"
|
||||
placeholder="请选择库位方向"
|
||||
@change="directionChange"
|
||||
>
|
||||
<el-option label="单向" :value="1" />
|
||||
<el-option label="双向" :value="2" />
|
||||
<el-option label="三向" :value="3" />
|
||||
<el-option label="四向" :value="4" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<div v-if="form.direction !== 1">
|
||||
<el-form-item label="进入方向" prop="inDirection">
|
||||
<el-select v-model="form.inDirection" placeholder="请选择进入方向">
|
||||
<el-option label="尾入" :value="0" />
|
||||
<el-option label="头入" :value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="离开方向" prop="outDirection">
|
||||
<el-select v-model="form.outDirection" placeholder="请选择离开方向">
|
||||
<el-option label="尾出" :value="0" />
|
||||
<el-option label="头出" :value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
<el-form-item label="区域变更点绑定" label-width="130" v-if="form.type === 5 && form.id">
|
||||
@ -360,7 +331,7 @@ const submit = async (formEl) => {
|
||||
await formEl.validate((valid, fields) => {
|
||||
if (!valid) return
|
||||
//在这边把数据处理好
|
||||
if (form.value.type === 1 || form.value.type === 6) {
|
||||
if (form.value.type === 1 || form.value.type === 6 || form.value.type === 8) {
|
||||
//不需要dataJson的类型
|
||||
form.value.dataJson = ''
|
||||
} else if (form.value.type === 2) {
|
||||
@ -475,7 +446,7 @@ const typeChange = (type) => {
|
||||
form.value.dataObj = {}
|
||||
form.value.dataList = []
|
||||
form.value.locationTypeId = null
|
||||
if (type === 1) {
|
||||
if (type === 1 || type === 8) {
|
||||
form.value.layersNumber = null
|
||||
form.value.direction = null
|
||||
form.value.inDirection = null
|
||||
@ -541,13 +512,7 @@ const deviceChange = (deviceId) => {
|
||||
}
|
||||
})
|
||||
}
|
||||
//方向改变
|
||||
const directionChange = (e) => {
|
||||
if (e === 1) {
|
||||
form.value.inDirection = undefined
|
||||
form.value.outDirection = undefined
|
||||
}
|
||||
}
|
||||
|
||||
//设备信息
|
||||
const deviceInfo = ref({
|
||||
positionMapId: '',
|
||||
|
@ -576,30 +576,23 @@
|
||||
</div>
|
||||
</template>
|
||||
<div @contextmenu="handleContextMenu(item, visibleMapPointIndices[i], $event)">
|
||||
<div
|
||||
v-if="
|
||||
item.type === 1 &&
|
||||
item.layerSelectionShow &&
|
||||
state.isShowSortNum &&
|
||||
item.sortNum
|
||||
"
|
||||
class="sort-num"
|
||||
:style="getSortNumStyle(item, visibleMapPointIndices[i])"
|
||||
>
|
||||
{{ item.sortNum }}
|
||||
</div>
|
||||
<div
|
||||
v-if="
|
||||
item.type !== 1 &&
|
||||
item.layerSelectionShow &&
|
||||
state.isShowSortNum &&
|
||||
item.sortNum
|
||||
"
|
||||
class="sort-num-location"
|
||||
:style="getSortNumLocationStyle(item, visibleMapPointIndices[i])"
|
||||
>
|
||||
{{ item.sortNum }}
|
||||
</div>
|
||||
<!-- sortNum -->
|
||||
<template v-if="item.layerSelectionShow && state.isShowSortNum && item.sortNum">
|
||||
<div
|
||||
v-if="item.type === 1 || item.type === 8"
|
||||
class="sort-num"
|
||||
:style="getSortNumStyle(item, visibleMapPointIndices[i])"
|
||||
>
|
||||
{{ item.sortNum }}
|
||||
</div>
|
||||
<div
|
||||
v-else
|
||||
class="sort-num-location"
|
||||
:style="getSortNumLocationStyle(item, visibleMapPointIndices[i])"
|
||||
>
|
||||
{{ item.sortNum }}
|
||||
</div>
|
||||
</template>
|
||||
<div
|
||||
class="sort-num-location"
|
||||
:style="getLocationNumberStyle(item, visibleMapPointIndices[i])"
|
||||
@ -611,8 +604,9 @@
|
||||
>
|
||||
{{ item.locationNumber }}
|
||||
</div>
|
||||
<!-- 1 路径点和取放货点 -->
|
||||
<div
|
||||
v-if="item.type === 1 && item.layerSelectionShow"
|
||||
v-if="(item.type === 1 || item.type === 8) && item.layerSelectionShow"
|
||||
:style="{
|
||||
width: item.locationWidePx + 'px',
|
||||
height: item.locationDeepPx + 'px',
|
||||
@ -4867,18 +4861,6 @@ const removeEventListener = () => {
|
||||
window.removeEventListener('keydown', handleKeyDown)
|
||||
}
|
||||
|
||||
const router = useRouter()
|
||||
onBeforeRouteLeave((to, from) => {
|
||||
if (to.path == '/mapPage/realTimeMap' && to.query.mapId != imgBgObj.positionMapId) {
|
||||
router.replace({
|
||||
name: 'MapPageRealTimeMap',
|
||||
query: {
|
||||
mapId: imgBgObj.positionMapId
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
await getMapList()
|
||||
await getCheckDistance()
|
||||
|
@ -34,7 +34,7 @@
|
||||
<script setup>
|
||||
import indexPage from './components/indexPage.vue'
|
||||
import createTaskDialog from './components/createTaskDialog.vue'
|
||||
import { ref, defineComponent, reactive, nextTick, onMounted, watch } from 'vue'
|
||||
import { ref, defineComponent, reactive, nextTick, onMounted } from 'vue'
|
||||
import * as MapApi from '@/api/map/map'
|
||||
import download from '@/utils/download'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
@ -77,10 +77,8 @@ const getList = async () => {
|
||||
} catch (error) {
|
||||
console.error('解析floorArea参数失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
// 处理从车辆看板传来的floor和area参数
|
||||
if (query.floor && query.area) {
|
||||
} else if (query.floor && query.area) {
|
||||
// 处理从车辆看板传来的floor和area参数
|
||||
// 查找对应的地图ID
|
||||
const floorItem = list.value.find((item) => item.floor === query.floor)
|
||||
if (floorItem && floorItem.children) {
|
||||
@ -91,20 +89,16 @@ const getList = async () => {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 处理mapId参数
|
||||
if (query.mapId) {
|
||||
} else if (query.mapId) {
|
||||
// 处理mapId参数
|
||||
let item = findItemById(query.mapId)
|
||||
if (item) {
|
||||
mapValue.value = [String(item.floor), String(item.id)]
|
||||
handleChangeMap(mapValue.value)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// 如果没有参数或参数无效,使用默认值
|
||||
if (list.value.length > 0 && list.value[0].children && list.value[0].children.length > 0) {
|
||||
} else if (list.value.length > 0 && list.value[0].children && list.value[0].children.length > 0) {
|
||||
// 如果没有参数或参数无效,使用默认值
|
||||
mapValue.value = [list.value[0].value, list.value[0].children[0].value]
|
||||
indexPageRef.value.getMapData(JSON.parse(JSON.stringify(list.value[0].children[0])))
|
||||
}
|
||||
@ -116,12 +110,6 @@ const handleChangeMap = async (e) => {
|
||||
let item = findItemById(e[1])
|
||||
if (item) {
|
||||
indexPageRef.value.getMapData(item)
|
||||
router.replace({
|
||||
name: 'MapPageRealTimeMap',
|
||||
query: {
|
||||
mapId: item.id
|
||||
}
|
||||
})
|
||||
} else {
|
||||
message.warning('未找到对应地图')
|
||||
}
|
||||
@ -204,35 +192,6 @@ function findItemById(targetId) {
|
||||
return null
|
||||
}
|
||||
|
||||
// 监听路由参数变化,处理从其他页面跳转过来的情况
|
||||
watch(
|
||||
() => route.query,
|
||||
(newQuery) => {
|
||||
if (newQuery.floorArea && list.value.length > 0) {
|
||||
try {
|
||||
const [floor, mapId] = JSON.parse(newQuery.floorArea)
|
||||
if (floor && mapId) {
|
||||
mapValue.value = [String(floor), String(mapId)]
|
||||
handleChangeMap(mapValue.value)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('解析floorArea参数失败:', error)
|
||||
}
|
||||
} else if (newQuery.floor && newQuery.area && list.value.length > 0) {
|
||||
// 处理floor和area参数
|
||||
const floorItem = list.value.find((item) => item.floor === newQuery.floor)
|
||||
if (floorItem && floorItem.children) {
|
||||
const areaItem = floorItem.children.find((item) => item.area === newQuery.area)
|
||||
if (areaItem) {
|
||||
mapValue.value = [String(newQuery.floor), String(areaItem.id)]
|
||||
handleChangeMap(mapValue.value)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{ deep: true }
|
||||
)
|
||||
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user