|
|
|
@ -6,6 +6,8 @@ import { getScreenInfo, getDataSetDetails, getDataByDataSetId } from '../api/big
|
|
|
|
|
import { stringToFunction } from '../utils/evalFunctions'
|
|
|
|
|
import { EventBus } from '../utils/eventBus'
|
|
|
|
|
import plotList from 'data-room-ui/G2Plots/plotList'
|
|
|
|
|
import { settingToTheme, themeToSetting } from 'data-room-ui/js/utils/themeFormatting'
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
// 初始化页面数据
|
|
|
|
|
initLayout ({ commit, dispatch }, code) {
|
|
|
|
@ -69,6 +71,7 @@ export function handleResData (data) {
|
|
|
|
|
let originalConfig = {}
|
|
|
|
|
pageInfo.chartList.forEach((chart) => {
|
|
|
|
|
if (!['customComponent', 'remoteComponent'].includes(chart.type)) {
|
|
|
|
|
// TODO:一般组件也需要添加主题的兼容处理
|
|
|
|
|
originalConfig = { option: { ...setModules[chart.type] }, ...dataModules[chart.type] }
|
|
|
|
|
// 如果没有版本号,或者版本号修改了则需要进行旧数据兼容
|
|
|
|
|
if ((!chart.version) || chart.version !== originalConfig.version) {
|
|
|
|
@ -90,9 +93,16 @@ export function handleResData (data) {
|
|
|
|
|
chart = compatibility(chart, originalConfig)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 初始化时应该判断,是否存在theme配置,没有的话添加默认的两套主题,这是为了兼容旧组件
|
|
|
|
|
if (!chart.theme) {
|
|
|
|
|
chart.theme = settingToTheme(chart, 'dark')
|
|
|
|
|
chart.theme = settingToTheme(chart, 'light')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
chart.key = chart.code
|
|
|
|
|
})
|
|
|
|
|
// 主题兼容
|
|
|
|
|
pageInfo.chartList = themeToSetting(pageInfo.chartList, pageInfo.pageConfig.customTheme)
|
|
|
|
|
// 存储修改后的配置
|
|
|
|
|
localStorage.setItem('pageInfo', JSON.stringify(pageInfo))
|
|
|
|
|
return pageInfo
|
|
|
|
|