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

View File

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

View File

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