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

View File

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