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