wangrong
2026-08-30 761e5c5fa871959f60e15c971c8d83f2b53d0af5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import request from '@/config/axios'
import { FeatureCollection } from '@antv/l7plot/dist/esm/plots/choropleth/types'
 
export const getWorldTree = (): Promise<IResponse<AreaNode>> => {
  return request.get({ url: '/map/worldTree' })
}
 
export const getGeoJson = (areaId: string): Promise<IResponse<FeatureCollection>> => {
  let prefix = '/map'
  let areaCode = areaId
  if (isCustomGeo(areaId)) {
    prefix = '/geo'
    areaCode = getBusiGeoCode(areaId)
  }
  const realCountry = areaCode.substring(0, 3)
  const url = `${prefix}/${realCountry}/${areaCode}.json`
  return request.get({ url })
}
 
const isCustomGeo = (id: string) => {
  return id.startsWith('geo_')
}
const getBusiGeoCode = (id: string) => {
  return id.substring(4)
}
 
export const listCustomGeoArea = (): Promise<IResponse<CustomGeoArea[]>> => {
  return request.get({ url: '/customGeo/geoArea/list' })
}
 
export const getCustomGeoArea = (id: string): Promise<IResponse<CustomGeoSubArea[]>> => {
  return request.get({ url: `/customGeo/geoArea/${id}` })
}
 
export const deleteCustomGeoArea = (id: string) => {
  return request.delete({ url: `/customGeo/geoArea/${id}` })
}
 
export const saveCustomGeoArea = (area: CustomGeoArea) => {
  return request.post({ url: '/customGeo/geoArea/save', data: area })
}
 
export const deleteCustomGeoSubArea = (id: string) => {
  return request.delete({ url: `/customGeo/geoSubArea/${id}` })
}
 
export const saveCustomGeoSubArea = (area: CustomGeoSubArea) => {
  return request.post({ url: '/customGeo/geoSubArea/save', data: area })
}
 
export const listSubAreaOptions = (): Promise<IResponse<AreaNode[]>> => {
  return request.get({ url: '/customGeo/geoSubArea/options' })
}