CN-1563 feat: 地图配置从接口获取

This commit is contained in:
chenjinsong
2024-03-12 17:33:29 +08:00
parent 011ed9ca63
commit bfcae5b3cc
3 changed files with 19 additions and 7 deletions

View File

@@ -223,6 +223,7 @@ export default {
localStorage.setItem(storageKey.dateFormat, data.date_format)
localStorage.setItem(storageKey.sysName, data.system_name)
localStorage.setItem(storageKey.sysLogo, data.system_logo)
localStorage.setItem(storageKey.mapConfig, data.map_config)
}
},
async mounted () {

View File

@@ -47,7 +47,8 @@ export const storageKey = {
linkInfo: 'cn-link-info',
history: 'cn-history',
schemaEntityExplore: 'schema_entity_explore',
trackingSubscribers: 'tracking-subscribers'
trackingSubscribers: 'cn-tracking-subscribers',
mapConfig: 'cn-map-config'
}
export const largeCountryList = ['CN', 'US', 'RU', 'AU', 'CA', 'KZ', 'IN', 'BR']
@@ -2531,6 +2532,14 @@ export const reg = {
containChinese: /[\u4E00-\u9FA5\uF900-\uFA2D]+/
}
export const defaultMapConfig = {
center: [116.38, 39.82], // 默认地图中心
maxZoom: 14, // 最大缩放等级
minZoom: 3, // 最小缩放等级
mapLevel: 2, // 数据精度 1、2、31最大
defaultZoom: 12 // 默认缩放等级
}
export const report = {
timeRuleList: [
{ name: 'overall.today', value: 'today' },

View File

@@ -391,7 +391,7 @@ import maplibregl from 'maplibre-gl'
import mapStyle from '@/views/charts2/charts/entityDetail/mapStyle'
import 'maplibre-gl/dist/maplibre-gl.css'
import unitConvert, { valueToRangeValue } from '@/utils/unit-convert'
import { unitTypes, storageKey } from '@/utils/constants'
import { unitTypes, storageKey, defaultMapConfig } from '@/utils/constants'
import * as echarts from 'echarts'
import { appListChartOption } from '@/views/charts2/charts/options/echartOption'
import { pieOption } from '@/views/location/chartOption'
@@ -1687,6 +1687,8 @@ export default {
baseStation: 153,
human: 167
}
const mapConfig = localStorage.getItem(storageKey.mapConfig) ? JSON.parse(localStorage.getItem(storageKey.mapConfig)) : defaultMapConfig
return {
activeTab,
dropDownValue,
@@ -1719,12 +1721,12 @@ export default {
currentShowSubscriber, // 当前在地图上展示轨迹的Subscriber
trackingSubscriberRecordMap: [], // record数据量大时vue监听性能开销太大所以单独用非监听的数组来维护subscriberId与record的关系
loading, // 控制组件内各处loading图标
maxZoom: 14, // 地图最小缩放比例
minZoom: 3, // 地图最大缩放比例
mapLevel: 2, // 地图精度 1、2、3
maxZoom: mapConfig.maxZoom, // 地图最小缩放比例
minZoom: mapConfig.minZoom, // 地图最大缩放比例
mapLevel: mapConfig.mapLevel, // 地图精度 1、2、3
unitTypes,
defaultZoom: 12, // 地图默认缩放比例
center: [116.38, 39.82], // 地图默认中心点。北京:[116.38, 39.9] 纽约:[-73.94539, 40.841843]
defaultZoom: mapConfig.defaultZoom, // 地图默认缩放比例
center: mapConfig.center, // 地图默认中心点。北京:[116.38, 39.9] 纽约:[-73.94539, 40.841843]
debounceMinuteChange: shallowRef(null),
debounceOnResize: shallowRef(null),
debounceVisualChange: shallowRef(null),