修改editMap 返回 emit

This commit is contained in:
xhf 2025-03-06 10:07:11 +08:00
parent 8b9dc456a0
commit 446b359632
2 changed files with 19 additions and 13 deletions

View File

@ -673,7 +673,7 @@ const mapBackgroundRef = ref()
const inputBoxRef = ref() //
const message = useMessage() //
const emit = defineEmits(['backMapInfo'])
//
const interfaceRefreshed = ref(true)
const resizeEnd = (locationX, locationY, w, h, item, index) => {
@ -2327,12 +2327,13 @@ const removeEventListener = () => {
const router = useRouter()
onBeforeRouteLeave((to, from) => {
if (to.path == '/mapPage/realTimeMap' && to.query.mapId != imgBgObj.positionMapId) {
router.replace({
name: 'MapPageRealTimeMap',
query: {
mapId: imgBgObj.positionMapId
}
})
// router.replace({
// name: 'MapPageRealTimeMap',
// query: {
// mapId: imgBgObj.positionMapId
// }
// })
emit('backMapInfo', imgBgObj.positionMapId)
}
})

View File

@ -23,7 +23,7 @@
</div>
<!-- 新建任务的弹窗 -->
<createTaskDialog v-if="mapValue.length" ref="createTaskDialogRef" :positionMapId="mapValue[1]" />
<createTaskDialog v-if="mapValue.length" ref="createTaskDialogRef" @backMapInfo="backMapInfo" :positionMapId="mapValue[1]" />
</template>
<script setup>
@ -33,7 +33,7 @@ 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'
const mapId = ref(null)
const message = useMessage() //
const route = useRoute()
const { push } = useRouter()
@ -87,7 +87,9 @@ const findChildrenByValues = (tree, values) => {
}
return null
}
const backMapInfo = (id) => {
mapId.value = id
}
//
const getList = async () => {
let data = await MapApi.getPositionMapGetMap()
@ -113,11 +115,14 @@ const getList = async () => {
list.value = mapList
if (query.mapId) {
let item = findDataById(data, Number(query.mapId))
// if (query.mapId) {
// let item = findDataById(data, Number(query.mapId))
// mapValue.value = [String(item.floor), Number(item.id)]
// }
if (mapId.value) {
let item = findDataById(data, Number(mapId.value))
mapValue.value = [String(item.floor), Number(item.id)]
}
if (mapValue.value.length) {
handleChangeMap(mapValue.value)
} else {