fix: 地图详情点击其他地方后底图错误

This commit is contained in:
fit2cloud-chenyw 2022-04-25 18:59:05 +08:00
parent f2bcdb0369
commit ca29445bf2
2 changed files with 22 additions and 4 deletions

View File

@ -58,7 +58,8 @@ export default {
data() {
return {
refId: null,
element: {}
element: {},
lastMapChart: null
}
},
computed: {
@ -119,7 +120,12 @@ export default {
if (this.curComponent && this.curComponent.DetailAreaCode && this.curComponent.DetailAreaCode.length) {
DetailAreaCode = this.curComponent.DetailAreaCode
}
return { ...temp, ...{ DetailAreaCode: DetailAreaCode }}
if (!this.curComponent && this.lastMapChart) {
return this.lastMapChart
}
const result = { ...temp, ...{ DetailAreaCode: DetailAreaCode }}
this.setLastMapChart(result)
return result
}
return null
}
@ -142,6 +148,9 @@ export default {
exportViewImg() {
exportImg(this.chart.name)
},
setLastMapChart(data) {
this.lastMapChart = JSON.parse(JSON.stringify(data))
},
exportExcelDownload(snapshot, width, height) {
const excelHeader = JSON.parse(JSON.stringify(this.chart.data.fields)).map(item => item.name)
const excelHeaderKeys = JSON.parse(JSON.stringify(this.chart.data.fields)).map(item => item.dataeaseName)

View File

@ -47,7 +47,8 @@ export default {
},
data() {
return {
refId: null
refId: null,
lastMapChart: null
}
},
computed: {
@ -86,7 +87,12 @@ export default {
if (this.curComponent && this.curComponent.DetailAreaCode && this.curComponent.DetailAreaCode.length) {
DetailAreaCode = this.curComponent.DetailAreaCode
}
return { ...temp, ...{ DetailAreaCode: DetailAreaCode }}
if (!this.curComponent && this.lastMapChart) {
return this.lastMapChart
}
const result = { ...temp, ...{ DetailAreaCode: DetailAreaCode }}
this.setLastMapChart(result)
return result
}
return null
}
@ -95,6 +101,9 @@ export default {
renderComponent() {
return this.chart.render
},
setLastMapChart(data) {
this.lastMapChart = JSON.parse(JSON.stringify(data))
}
}
}