perf: rest请求优化为json文件请求

This commit is contained in:
fit2cloud-chenyw 2021-08-03 16:05:05 +08:00
parent e239ddf052
commit 1aa5b483fb
3 changed files with 35 additions and 4 deletions

View 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);
}
}

View File

@ -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
}) })

View File

@ -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
} }