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

View File

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