mirror of
https://gitee.com/xiongmao1988/rax-medical.git
synced 2026-06-12 14:51:50 +08:00
3级地图优化
This commit is contained in:
parent
e4e795e774
commit
0edba5a83b
|
|
@ -18,16 +18,24 @@ onMounted(() => {
|
||||||
defineExpose({
|
defineExpose({
|
||||||
setMap
|
setMap
|
||||||
})
|
})
|
||||||
|
function adcodeFormatter(code: string) {
|
||||||
function setMap(name: string) {
|
let str = code;
|
||||||
|
if(str.slice(-2) === '00') str = str.slice(0, -2)
|
||||||
|
return str
|
||||||
|
}
|
||||||
|
function setMap(name: string, totalData: any) {
|
||||||
getMapJson(name + '_full.json').then((res: any) => {
|
getMapJson(name + '_full.json').then((res: any) => {
|
||||||
const chinaJson = res.data
|
const chinaJson = res.data
|
||||||
const data: any = []
|
const data: any = []
|
||||||
const markData: any = []
|
const markData: any = []
|
||||||
|
console.log(totalData)
|
||||||
|
console.log(chinaJson.features)
|
||||||
chinaJson.features.forEach((item: any, index: number) => {
|
chinaJson.features.forEach((item: any, index: number) => {
|
||||||
|
const key = adcodeFormatter(item.properties.adcode + '')
|
||||||
|
console.log(key)
|
||||||
const obj = {
|
const obj = {
|
||||||
name: item.properties.name,
|
name: item.properties.name,
|
||||||
value: Math.ceil(Math.random() * 30)
|
value: totalData.c[key] ? totalData.c[key].t || 0 : 0
|
||||||
}
|
}
|
||||||
data.push(obj)
|
data.push(obj)
|
||||||
markData.push({
|
markData.push({
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ function initCitys(data: any, adcode: string) {
|
||||||
// 显示二级地图
|
// 显示二级地图
|
||||||
isCityMap.value = true
|
isCityMap.value = true
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
cityMapChartRef.value.setMap(adcode + '0000')
|
cityMapChartRef.value.setMap(adcode + '0000', data)
|
||||||
}, 0)
|
}, 0)
|
||||||
}
|
}
|
||||||
// 名称格式化
|
// 名称格式化
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user