forked from github/dataease
perf: rest请求优化为json文件请求
This commit is contained in:
parent
e239ddf052
commit
1aa5b483fb
20
backend/src/main/java/io/dataease/config/WebMvcConfig.java
Normal file
20
backend/src/main/java/io/dataease/config/WebMvcConfig.java
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
package io.dataease.config;
|
||||||
|
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class WebMvcConfig implements WebMvcConfigurer {
|
||||||
|
|
||||||
|
@Value("${geo.rootpath:file:/opt/dataease/data/feature/full/}")
|
||||||
|
private String geoPath;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||||
|
|
||||||
|
registry.addResourceHandler("/geo/**").addResourceLocations(geoPath);
|
||||||
|
}
|
||||||
|
}
|
@ -8,9 +8,17 @@ export const areaMapping = () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// export function geoJson(areaCode) {
|
||||||
|
// return request({
|
||||||
|
// url: '/api/map/resourceFull/' + areaCode,
|
||||||
|
// method: 'get',
|
||||||
|
// loading: true
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
|
||||||
export function geoJson(areaCode) {
|
export function geoJson(areaCode) {
|
||||||
return request({
|
return request({
|
||||||
url: '/api/map/resourceFull/' + areaCode,
|
url: '/geo/' + areaCode + '_full.json',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
loading: true
|
loading: true
|
||||||
})
|
})
|
||||||
|
@ -113,13 +113,16 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
geoJson(customAttr.areaCode).then(res => {
|
geoJson(customAttr.areaCode).then(res => {
|
||||||
this.initMapChart(res.data, chart)
|
// this.initMapChart(res.data, chart)
|
||||||
|
this.initMapChart(res, chart)
|
||||||
|
|
||||||
this.$store.dispatch('map/setGeo', {
|
this.$store.dispatch('map/setGeo', {
|
||||||
key: customAttr.areaCode,
|
key: customAttr.areaCode,
|
||||||
value: res.data
|
value: res
|
||||||
|
// value: res.data
|
||||||
})
|
})
|
||||||
this.currentGeoJson = res.data
|
// this.currentGeoJson = res.data
|
||||||
|
this.currentGeoJson = res
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user