CN-268 feat: panel重构--地图

This commit is contained in:
chenjinsong
2022-01-17 16:00:12 +08:00
parent d86d18a2ee
commit 35d948257a
3 changed files with 22 additions and 16 deletions

View File

@@ -166,7 +166,7 @@ export default {
...this.entity,
...extraParams
}
const requestUrl = url || chartParams.url
const requestUrl = url || (chartParams && chartParams.url)
if (requestUrl) {
get(replaceUrlPlaceholder(requestUrl, this.queryParams)).then(response => {
if (response.code === 200) {
@@ -177,11 +177,14 @@ export default {
this.noData = true
this.errorInfo = response.msg || response.message || 'Unknown'
}
}).finally(() => {
setTimeout(() => {
this.loading = false
}, 200)
})
}
} catch (e) {
console.error(e)
} finally {
setTimeout(() => {
this.loading = false
}, 200)

View File

@@ -308,15 +308,9 @@ export default {
]
`)*/
const tempList = n.map(item => {
let params = {}
const height = item.h
if (item.params) {
try {
params = JSON.parse(item.params)
} catch (e) {
console.error(e)
}
params.showHeader = true
item.params.showHeader = true
}
return {
...item,
@@ -325,7 +319,7 @@ export default {
h: height,
x: item.x || 0,
y: item.y || 0,
params,
params: item.params,
category: getTypeCategory(item.type) // 类别是echarts还是map等等
}
})

View File

@@ -115,7 +115,9 @@ export default {
}
},
loadAm4ChartMap (polygonSeries, country, chartData) {
if (chartData) {
this.$emit('showLoading', true)
}
try {
// 清除数据
polygonSeries.data.splice(0)
@@ -187,10 +189,12 @@ export default {
} catch (e) {
console.error(e)
} finally {
if (chartData) {
setTimeout(() => {
this.$emit('showLoading', false)
}, 200)
}
}
},
loadLeafletMap () {
this.$emit('showLoading', true)
@@ -250,8 +254,13 @@ export default {
return { key, labelText }
}
},
mounted () {
watch: {
chartData: {
deep: true,
handler (n) {
this.initMap(`chart${this.chartInfo.id}`)
}
}
},
setup (props) {
return {