fix: 修改线上线下地图配置方式,优化自建台站首次加载谱时间太久的问题

This commit is contained in:
Xu Zhimeng 2024-10-10 16:03:36 +08:00
parent 1dcd0dd06f
commit 0eb46e8343
9 changed files with 55 additions and 43 deletions

View File

@ -3,7 +3,6 @@ VUE_APP_API_BASE_URL=http://182.92.183.230:9999
# VUE_APP_API_BASE_URL=http://192.168.0.111:9999 # VUE_APP_API_BASE_URL=http://192.168.0.111:9999
VUE_APP_CAS_BASE_URL=http://cas.example.org:8443/cas VUE_APP_CAS_BASE_URL=http://cas.example.org:8443/cas
VUE_APP_ONLINE_BASE_URL=http://fileview.jeecg.com/onlinePreview VUE_APP_ONLINE_BASE_URL=http://fileview.jeecg.com/onlinePreview
VUE_APP_MAP_BASE_URL=https://ibasemaps-api.arcgis.com/arcgis/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}?token=AAPK2b935e8bbf564ef581ca3c6fcaa5f2a71ZH84cPqqFvyz3KplFRHP8HyAwJJkh6cnpcQ-qkWh5aiyDQsGJbsXglGx0QM2cPm
# 微应用列表必须VUE_APP_SUB_开头,jeecg-app-1为子应用的项目名称,也是子应用的路由父路径 # 微应用列表必须VUE_APP_SUB_开头,jeecg-app-1为子应用的项目名称,也是子应用的路由父路径
VUE_APP_SUB_jeecg-app-1 = '//localhost:8092' VUE_APP_SUB_jeecg-app-1 = '//localhost:8092'

View File

@ -2,4 +2,3 @@ NODE_ENV=production
VUE_APP_API_BASE_URL=/armd VUE_APP_API_BASE_URL=/armd
VUE_APP_CAS_BASE_URL=http://localhost:8888/cas VUE_APP_CAS_BASE_URL=http://localhost:8888/cas
VUE_APP_ONLINE_BASE_URL=http://fileview.jeecg.com/onlinePreview VUE_APP_ONLINE_BASE_URL=http://fileview.jeecg.com/onlinePreview
VUE_APP_MAP_BASE_URL=https://ibasemaps-api.arcgis.com/arcgis/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}?token=AAPK2b935e8bbf564ef581ca3c6fcaa5f2a71ZH84cPqqFvyz3KplFRHP8HyAwJJkh6cnpcQ-qkWh5aiyDQsGJbsXglGx0QM2cPm

1
.gitignore vendored
View File

@ -15,3 +15,4 @@ dist
## front ## front
/yarn-error.log /yarn-error.log
dist.zip

View File

@ -8,6 +8,11 @@ window._CONFIG = {
VUE_APP_CAS_BASE_URL: '', VUE_APP_CAS_BASE_URL: '',
// 文件预览路径 // 文件预览路径
VUE_APP_ONLINE_BASE_URL: '', VUE_APP_ONLINE_BASE_URL: '',
// 离线地图 // 地图源配置
VUE_APP_MAP_BASE_URL_OFFLINE: 'http://localhost:8001/map/{z}/{x}/{y}.jpg' VUE_APP_MAP_SOURCE: {
type: 'online', // 默认是在线还是离线
online:
'https://ibasemaps-api.arcgis.com/arcgis/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}?token=AAPK2b935e8bbf564ef581ca3c6fcaa5f2a71ZH84cPqqFvyz3KplFRHP8HyAwJJkh6cnpcQ-qkWh5aiyDQsGJbsXglGx0QM2cPm',
offline: 'http://localhost:8001/map/{z}/{x}/{y}.jpg'
}
} }

View File

@ -205,7 +205,6 @@ export default {
ROILists: [], ROILists: [],
ROIAnalyzeLists: [], ROIAnalyzeLists: [],
roiParamList: cloneDeep(InitialRoiParamList), roiParamList: cloneDeep(InitialRoiParamList),
sampleDetail: {},
resultDisplay: [], resultDisplay: [],
timerStamp: Date.now(), timerStamp: Date.now(),
} }
@ -218,7 +217,6 @@ export default {
this.cancelLastRequest() this.cancelLastRequest()
this.isLoading = false this.isLoading = false
const { data } = sampleData const { data } = sampleData
console.log('%c [ data ]-221', 'font-size:13px; background:pink; color:#bf2c9f;', data)
this.sampleDetail = data this.sampleDetail = data
this.changeChartByType('sample') this.changeChartByType('sample')
// XeData // XeData
@ -497,6 +495,7 @@ export default {
betaEnergyData, betaEnergyData,
gammaEnergyData, gammaEnergyData,
histogramDataList, histogramDataList,
histogramDataDList,
ROIOneList, ROIOneList,
ROITwoList, ROITwoList,
ROIThreeList, ROIThreeList,
@ -523,7 +522,7 @@ export default {
this.roiParamList = cloneDeep(boundaryList) this.roiParamList = cloneDeep(boundaryList)
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.betaChartRef.setBoundaryList(boundaryList) this.$refs.betaChartRef.setBoundaryList(boundaryList)
this.$refs.betaChartRef.setData(histogramDataList) this.$refs.betaChartRef.setData(histogramDataList, histogramDataDList)
}) })
this.gammaEnergyData = gammaEnergyData this.gammaEnergyData = gammaEnergyData
this.betaEnergyData = betaEnergyData this.betaEnergyData = betaEnergyData

View File

@ -79,10 +79,10 @@
<!-- 2D图表结束 --> <!-- 2D图表结束 -->
<!-- 3D Surface开始 --> <!-- 3D Surface开始 -->
<CustomChart v-if="btnActive == 3" key="1" :option="threeDSurfaceOption" autoresize /> <CustomChart v-if="btnActive == 3" key="1" ref="chartThreeDSurfaceRef" autoresize />
<!-- 3D Surface结束 --> <!-- 3D Surface结束 -->
<!-- 3D Scatter --> <!-- 3D Scatter -->
<CustomChart v-if="btnActive == 4" key="2" :option="threeDScatterOption" autoresize /> <CustomChart v-if="btnActive == 4" key="2" ref="chartThreeDScatterRef" autoresize />
<!-- 3D Scatter结束 --> <!-- 3D Scatter结束 -->
</div> </div>
</div> </div>
@ -228,6 +228,7 @@ const ThreeDSurfaceOption = {
// tooltip // tooltip
return `Beta Channel:${x} Count:${z} Gamma Channel: ${y}` return `Beta Channel:${x} Count:${z} Gamma Channel: ${y}`
}, },
confine: true,
}, },
visualMap: { visualMap: {
show: false, show: false,
@ -285,6 +286,7 @@ const ThreeDSurfaceOption = {
series: { series: {
type: 'surface', type: 'surface',
data: [], data: [],
animation: false,
}, },
} }
@ -296,6 +298,7 @@ const ThreeDScatterOption = {
// tooltip // tooltip
return `Beta Channel:${x} Count:${z} Gamma Channel: ${y}` return `Beta Channel:${x} Count:${z} Gamma Channel: ${y}`
}, },
confine: true,
}, },
visualMap: { visualMap: {
show: false, show: false,
@ -352,13 +355,14 @@ const ThreeDScatterOption = {
}, },
series: { series: {
type: 'scatter3D', type: 'scatter3D',
symbolSize: 5, symbolSize: 3,
emphasis: { emphasis: {
label: { label: {
show: false, show: false,
}, },
}, },
data: [], data: [],
animation: false,
}, },
} }
@ -413,8 +417,6 @@ export default {
}, },
btnActive: 2, btnActive: 2,
threeDSurfaceOption: cloneDeep(ThreeDSurfaceOption),
threeDScatterOption: cloneDeep(ThreeDScatterOption),
} }
}, },
created() { created() {
@ -428,7 +430,7 @@ export default {
mounted() { mounted() {
const newOption = cloneDeep(TwoDOption) const newOption = cloneDeep(TwoDOption)
newOption.tooltip.axisPointer.label.formatter = this.axiosPointerFormatter newOption.tooltip.axisPointer.label.formatter = this.axiosPointerFormatter
this.setOption(newOption) this.setTwoDChartOption(newOption)
}, },
methods: { methods: {
getAxiosCount(isBetaChannel, value) { getAxiosCount(isBetaChannel, value) {
@ -453,7 +455,7 @@ export default {
return `c: ${fixedValue}\ne: ${energy ? energy.toFixed(3) : 0}` return `c: ${fixedValue}\ne: ${energy ? energy.toFixed(3) : 0}`
}, },
setData(histogramDataList) { setData(histogramDataList, histogramDataDList) {
const map = new Map() const map = new Map()
histogramDataList.forEach(({ b, g, c }) => { histogramDataList.forEach(({ b, g, c }) => {
map.set(`${b}_${g}`, c) map.set(`${b}_${g}`, c)
@ -461,9 +463,10 @@ export default {
this.histogramDataListMap = map this.histogramDataListMap = map
this.histogramDataList = histogramDataList this.histogramDataList = histogramDataList
this.threedData = histogramDataDList.map(({ b, g, c }) => [b, g, c])
this.setVisialMapParams() this.setVisialMapParams()
this.buildScatterList() this.buildScatterList()
this.initChart() this.initTwoDChart()
this.btnActive = 2 this.btnActive = 2
}, },
@ -477,14 +480,14 @@ export default {
this.reDrawRect() this.reDrawRect()
}, },
setOption(option, opts) { setTwoDChartOption(option, opts) {
this.$refs.chartTwoDRef.setOption(option, opts) this.$refs.chartTwoDRef.setOption(option, opts)
}, },
initChart() { initTwoDChart() {
this.chartAxis = cloneDeep(ChartAxis) this.chartAxis = cloneDeep(ChartAxis)
this.setOption({ this.setTwoDChartOption({
...this.chartAxis, ...this.chartAxis,
series: { series: {
data: this.scatterList, data: this.scatterList,
@ -492,11 +495,6 @@ export default {
}) })
this.reDrawRect() this.reDrawRect()
// 3D
const threedData = this.histogramDataList.map(({ b, g, c }) => [b, g, c])
this.threeDSurfaceOption.series.data = threedData
this.threeDScatterOption.series.data = threedData
}, },
// scatter // scatter
@ -517,7 +515,7 @@ export default {
yAxis: { min: minY, max: maxY }, yAxis: { min: minY, max: maxY },
} = this.chartAxis } = this.chartAxis
this.setOption({ this.setTwoDChartOption({
xAxis: { xAxis: {
min: minX, min: minX,
max: maxX, max: maxX,
@ -568,9 +566,6 @@ export default {
// 100 // 100
this.visualMap.max = max this.visualMap.max = max
this.visualMap.value = [0, max] this.visualMap.value = [0, max]
this.threeDSurfaceOption.visualMap.max = max
this.threeDScatterOption.visualMap.max = max
}, },
// //
@ -646,6 +641,27 @@ export default {
this.$emit('open-modal', index) this.$emit('open-modal', index)
} else { } else {
this.btnActive = index this.btnActive = index
// 3D Surface
if (index == 3) {
const option = cloneDeep(ThreeDSurfaceOption)
option.series.data = this.threedData
this.$nextTick(() => {
console.time('Surface')
this.$refs.chartThreeDSurfaceRef.setOption(option)
console.timeEnd('Surface')
})
}
// 3D Scatter
if (index == 4) {
const option = cloneDeep(ThreeDScatterOption)
option.series.data = this.threedData
this.$nextTick(() => {
console.time('Scatter')
this.$refs.chartThreeDScatterRef.setOption(option)
console.timeEnd('Scatter')
})
}
} }
}, },
// unzoom // unzoom
@ -667,7 +683,7 @@ export default {
max: x2, max: x2,
} }
this.setOption({ this.setTwoDChartOption({
yAxis: { min: x1, max: x2 }, yAxis: { min: x1, max: x2 },
}) })

View File

@ -20,7 +20,6 @@ import { LineString, Point } from 'ol/geom'
import { Feature } from 'ol' import { Feature } from 'ol'
import Style from 'ol/style/Style' import Style from 'ol/style/Style'
const mapSourceUrl = process.env.VUE_APP_MAP_BASE_URL
export default { export default {
props: { props: {
zoom: { zoom: {
@ -58,10 +57,9 @@ export default {
// //
initMap() { initMap() {
const { longitude, latitude } = this.center const { longitude, latitude } = this.center
this.tileLayer = new TileLayer({ this.tileLayer = new TileLayer({
source: new XYZ({ source: new XYZ({
url: mapSourceUrl, url: window._CONFIG.VUE_APP_MAP_SOURCE[window._CONFIG.VUE_APP_MAP_SOURCE.type],
}), }),
}) })

View File

@ -489,7 +489,7 @@ export default {
stationInfo: undefined, stationInfo: undefined,
mapSource: 'online', mapSource: window._CONFIG.VUE_APP_MAP_SOURCE.type,
routeParams: { routeParams: {
stationCode: undefined, stationCode: undefined,

View File

@ -553,12 +553,7 @@ export default {
* @param {'online'|'offline'} mapSource * @param {'online'|'offline'} mapSource
*/ */
handleMapSourceChange(mapSource) { handleMapSourceChange(mapSource) {
if (mapSource == 'online') { this.$refs.mapRef.changeSource(window._CONFIG.VUE_APP_MAP_SOURCE[mapSource])
const mapSourceUrl = process.env.VUE_APP_MAP_BASE_URL
this.$refs.mapRef.changeSource(mapSourceUrl)
} else {
this.$refs.mapRef.changeSource(window._CONFIG.VUE_APP_MAP_BASE_URL_OFFLINE)
}
}, },
getScrollContainer() { getScrollContainer() {