提交 1aa5b483 authored 作者: fit2cloud-chenyw's avatar fit2cloud-chenyw

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

上级 e239ddf0
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 = () => { ...@@ -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 { ...@@ -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
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论