|
@@ -1,8 +1,8 @@
|
|
|
<!-- 底图 -->
|
|
|
<template>
|
|
|
<div id='floor_base' v-loading='loading' ref='graphy'>
|
|
|
- <div id='fengMap'></div>
|
|
|
- <canvas id='canvas' :width='canvasWidth' :height='canvasHeight' tabindex='0'></canvas>
|
|
|
+ <div :id='`fengMap${id}`' class="fengMap"></div>
|
|
|
+ <canvas :id='`canvas${id}`' :width='canvasWidth' :height='canvasHeight' tabindex='0'></canvas>
|
|
|
<!-- 地图底部操作按钮 -->
|
|
|
<div class='strip-bottom'>
|
|
|
<canvasFun @fit='fit' @savePng='savePng' @saveSvg='saveSvg' @saveJson='saveJson' @scale='scale' ref='canvasFun'></canvasFun>
|
|
@@ -32,13 +32,19 @@ export default {
|
|
|
mapServerURL: `/wdfn`,
|
|
|
canvasWidth: 1100,
|
|
|
canvasHeight: 800,
|
|
|
- loading: false,
|
|
|
+ loading: false,// 限制重复查询
|
|
|
view: null,
|
|
|
- isQuerying: false, // 限制重复查询
|
|
|
- urlMsg: {}
|
|
|
+ urlMsg: {},
|
|
|
+ canvasID: 'canvas'
|
|
|
// fmapID:'1001012_42'
|
|
|
}
|
|
|
},
|
|
|
+ props:{
|
|
|
+ id:{
|
|
|
+ default: '1',
|
|
|
+ type: String
|
|
|
+ }
|
|
|
+ },
|
|
|
components: { RoomBox, canvasFun },
|
|
|
computed: {
|
|
|
...mapGetters(['plazaId', 'fmapID'])
|
|
@@ -46,6 +52,11 @@ export default {
|
|
|
methods: {
|
|
|
...mapActions(['getfmapID']),
|
|
|
init(floorid) {
|
|
|
+ if (this.loading) {
|
|
|
+ console.log('正在查询...')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.loading = true
|
|
|
if (!this.fmapID) {
|
|
|
this.getfmapID().then(() => {
|
|
|
this.urlMsg.fmapID = this.fmapID
|
|
@@ -56,18 +67,13 @@ export default {
|
|
|
this.getMap(floorid)
|
|
|
},
|
|
|
getMap(floorid) {
|
|
|
- if (this.isQuerying) {
|
|
|
- console.log('正在查询...')
|
|
|
- return
|
|
|
- }
|
|
|
- this.isQuerying = true
|
|
|
this.clearGraphy()
|
|
|
this.scene = new FloorScene()
|
|
|
this.scene.selectContainer.connect('listChange', this, this.listChange)
|
|
|
- if (!fengmap) {
|
|
|
- fengmap = new SFengParser('fengMap', `${this.mapServerURL}/fmap/${this.fmapID}`, this.key, this.appName, null)
|
|
|
- fengmap.loadMap(this.fmapID, res => {
|
|
|
- this.floorList = res
|
|
|
+ if (!fengmap || this.canvasID!=`canvas${this.id}`) {
|
|
|
+ this.canvasID = `canvas${this.id}`
|
|
|
+ fengmap = new SFengParser(`fengMap${this.id}`, `${this.mapServerURL}/fmap/${this.fmapID}`, this.key, this.appName, null)
|
|
|
+ fengmap.loadMap(this.fmapID, () => {
|
|
|
this.parserData(floorid)
|
|
|
})
|
|
|
// 获取主题数据
|
|
@@ -121,11 +127,10 @@ export default {
|
|
|
this.view.scene = this.scene
|
|
|
this.view.fitSceneToView()
|
|
|
this.loading = false
|
|
|
- this.isQuerying = false
|
|
|
}
|
|
|
} else {
|
|
|
- if (this.floorList[floor]) {
|
|
|
- fengmap.parseData(this.floorList[floor], res => {
|
|
|
+ if (fengmap.gnameToGid[floor]) {
|
|
|
+ fengmap.parseData(fengmap.gnameToGid[floor], res => {
|
|
|
if (res.err) {
|
|
|
console.log(res.err)
|
|
|
return
|
|
@@ -144,7 +149,6 @@ export default {
|
|
|
this.view.scene = this.scene
|
|
|
this.view.fitSceneToView()
|
|
|
this.loading = false
|
|
|
- this.isQuerying = false
|
|
|
console.log('success')
|
|
|
})
|
|
|
} else {
|
|
@@ -157,7 +161,7 @@ export default {
|
|
|
this.view.scene = null
|
|
|
return
|
|
|
}
|
|
|
- this.view = new FloorView('canvas')
|
|
|
+ this.view = new FloorView(`canvas${this.id}`)
|
|
|
},
|
|
|
listChange(item, ev) {
|
|
|
let name = ev[0][0].data.Name
|
|
@@ -230,7 +234,7 @@ export default {
|
|
|
<style lang="less" scoped>
|
|
|
#floor_base {
|
|
|
position: relative;
|
|
|
- #fengMap {
|
|
|
+ .fengMap {
|
|
|
position: fixed;
|
|
|
width: 100px;
|
|
|
height: 100px;
|