refactor: 代码合并

main
wu.jian2 2 years ago
commit b52faefa3e

@ -113,7 +113,7 @@ export default {
methods: { methods: {
init () { init () {
this.dialogVisible = true this.dialogVisible = true
this.imgUrl = this.form.bg this.imgUrl = this.form.customTheme === 'dark' ? this.form.bg : this.form.lightBg
this.fileList = this.imgUrl this.fileList = this.imgUrl
? [{ ? [{
name: '背景图', name: '背景图',

@ -78,39 +78,39 @@
</el-form-item> </el-form-item>
<el-form-item label="背景图"> <el-form-item label="背景图">
<el-button <el-button
v-if="!form.bg" v-if="!form[currentBg]"
type="primary" type="primary"
@click="$refs.bgImg.init()" @click="$refs.bgImg.init()"
> >
选择背景图 选择背景图
</el-button> </el-button>
<el-image <el-image
v-if="form.bg" v-if="form.currentBg"
class="bg-img bs-el-img" class="bg-img bs-el-img"
:src="form.bg" :src="form[currentBg]"
fit="cover" fit="cover"
@click="$refs.bgImg.init()" @click="$refs.bgImg.init()"
/> />
<div <div
v-show="form.bg" v-show="form[currentBg]"
@click="form.bg = ''" @click="form[currentBg] = ''"
> >
<i class="el-icon-circle-close close-icon" /> <i class="el-icon-circle-close close-icon" />
</div> </div>
<span <span
v-if="form.bg" v-if="form[currentBg]"
class="description" class="description"
>背景图优先级高于背景色设置后将覆盖背景色</span> >背景图优先级高于背景色设置后将覆盖背景色</span>
<BgImg <BgImg
ref="bgImg" ref="bgImg"
:form="form" :form="form"
@imgUrl="form.bg = $event" @imgUrl="form[currentBg] = $event"
/> />
</el-form-item> </el-form-item>
<el-form-item label="背景色"> <el-form-item label="背景色">
<ColorPicker <ColorPicker
v-model="form.bgColor" v-model="form[currentBgColor]"
:placeholder="form.bg ? '' : '请选择背景色'" :placeholder="form[currentBg] ? '' : '请选择背景色'"
:predefine-colors="predefineColors" :predefine-colors="predefineColors"
/> />
</el-form-item> </el-form-item>
@ -287,6 +287,8 @@ export default {
h: 1080, h: 1080,
bg: '', bg: '',
bgColor: '#151a26', // bgColor: '#151a26', //
lightBg: '',
lightBgColor: '#151a26',
opacity: 100, opacity: 100,
customTheme: 'dark', customTheme: 'dark',
themeJson: {}, themeJson: {},
@ -315,6 +317,13 @@ export default {
pageInfo: state => state.bigScreen.pageInfo, pageInfo: state => state.bigScreen.pageInfo,
config: state => state.bigScreen.activeItemConfig config: state => state.bigScreen.activeItemConfig
}), }),
//
currentBgColor () {
return this.form.customTheme === 'dark' ? 'bgColor' : 'lightBgColor'
},
currentBg () {
return this.form.customTheme === 'dark' ? 'bg' : 'lightBgColor'
},
dsValue () { dsValue () {
return this.form.cacheDataSets?.map(dSet => ({ return this.form.cacheDataSets?.map(dSet => ({
id: dSet.dataSetId, id: dSet.dataSetId,
@ -382,7 +391,7 @@ export default {
this.form.refreshConfig = [] this.form.refreshConfig = []
} else { } else {
this.pageInfo.chartList.forEach(chart => { this.pageInfo.chartList.forEach(chart => {
if (chart.dataSource?.businessKey) { if (chart.dataSource?.businessKey || chart.type === 'marquee') {
this.chartOptions.push({ this.chartOptions.push({
code: chart.code, code: chart.code,
title: chart.title, title: chart.title,

@ -240,11 +240,6 @@ export default {
this.$emit('changeZoom', val) this.$emit('changeZoom', val)
// console.log(val) // console.log(val)
}, },
//
changeTheme (val) {
//
this.$emit('updateTheme', val)
},
setAlign (command) { setAlign (command) {
const pageInfo = cloneDeep(this.pageInfo) const pageInfo = cloneDeep(this.pageInfo)
// //

@ -9,7 +9,6 @@
:right-fold="rightVisiable" :right-fold="rightVisiable"
@updateRightVisiable="updateRightVisiable" @updateRightVisiable="updateRightVisiable"
@showPageInfo="showPageInfo" @showPageInfo="showPageInfo"
@updateTheme="updateTheme"
@changeZoom="changeScreenZoom" @changeZoom="changeScreenZoom"
@empty="empty" @empty="empty"
/> />
@ -138,7 +137,6 @@ import { isFirefox } from 'data-room-ui/js/utils/userAgent'
import { handleResData } from 'data-room-ui/js/store/actions.js' import { handleResData } from 'data-room-ui/js/store/actions.js'
import { EventBus } from 'data-room-ui/js/utils/eventBus' import { EventBus } from 'data-room-ui/js/utils/eventBus'
import NotPermission from 'data-room-ui/NotPermission' import NotPermission from 'data-room-ui/NotPermission'
import { themeToSetting } from 'data-room-ui/js/utils/themeFormatting'
export default { export default {
name: 'BigScreenDesign', name: 'BigScreenDesign',
components: { components: {
@ -412,12 +410,6 @@ export default {
}) })
.catch(() => {}) .catch(() => {})
}, },
//
updateTheme (theme) {
const pageInfo = this.pageInfo
pageInfo.chartList = themeToSetting(pageInfo.chartList, theme)
this.changePageInfo(pageInfo)
},
// //
updateSetting (config) { updateSetting (config) {
if (config.type === 'map' || config.type === 'video' ||config.type === 'flyMap') { if (config.type === 'map' || config.type === 'video' ||config.type === 'flyMap') {

@ -262,9 +262,11 @@ export default {
w: this.type === 'component' ? 1024 : 1920, w: this.type === 'component' ? 1024 : 1920,
h: this.type === 'component' ? 768 : 1080, h: this.type === 'component' ? 768 : 1080,
bgColor: '#151a26', bgColor: '#151a26',
lightBgColor: '#151a26',
opacity: 100, opacity: 100,
customTheme: 'dark', customTheme: 'dark',
bg: null, bg: null,
lightBg: null,
fitMode: 'auto' fitMode: 'auto'
}) })
this.resolutionRatio.w = this.type === 'component' ? 1024 : 1920 this.resolutionRatio.w = this.type === 'component' ? 1024 : 1920

@ -365,6 +365,7 @@ export default {
w: this.resolutionRatio.w || '1920', w: this.resolutionRatio.w || '1920',
h: this.resolutionRatio.h || '1080', h: this.resolutionRatio.h || '1080',
bgColor: '#151a26', bgColor: '#151a26',
lightBgColor: '#151a26',
opacity: 100, opacity: 100,
customTheme: 'dark' customTheme: 'dark'
}, },

@ -94,8 +94,8 @@ export default {
previewWrapStyle () { previewWrapStyle () {
const bg = this.fitMode !== 'none' const bg = this.fitMode !== 'none'
? { ? {
backgroundColor: this.fitPageConfig.bgColor, backgroundColor: this.fitPageConfig.customTheme === 'dark' ? this.fitPageConfig.bgColor : this.fitPageConfig.lightBgColor,
backgroundImage: `url(${this.fitPageConfig.bg})`, backgroundImage: this.fitPageConfig.customTheme === 'dark' ? `url(${this.fitPageConfig.bg})` : `url(${this.fitPageConfig.lightBg})`,
backgroundSize: 'cover' backgroundSize: 'cover'
} }
: {} : {}
@ -116,8 +116,8 @@ export default {
const bg = this.fitMode === 'none' const bg = this.fitMode === 'none'
? { ? {
backgroundColor: this.fitPageConfig.bgColor, backgroundColor: this.fitPageConfig.customTheme === 'dark' ? this.fitPageConfig.bgColor : this.fitPageConfig.lightBgColor,
backgroundImage: `url(${this.fitPageConfig.bg})`, backgroundImage: this.fitPageConfig.customTheme === 'dark' ? `url(${this.fitPageConfig.bg})` : `url(${this.fitPageConfig.lightBg})`,
backgroundSize: 'cover' backgroundSize: 'cover'
} }
: {} : {}

@ -298,6 +298,8 @@ export default {
opacity: 100, opacity: 100,
customTheme: 'dark', customTheme: 'dark',
bg: null, bg: null,
lightBgColor: '#151a26',
lightBg: null,
fitMode: 'auto' fitMode: 'auto'
}) })
this.resolutionRatio.w = this.type === 'component' ? 1024 : 1920 this.resolutionRatio.w = this.type === 'component' ? 1024 : 1920

@ -19,6 +19,7 @@ import { mapState, mapMutations } from 'vuex'
import * as g2Plot from '@antv/g2plot' import * as g2Plot from '@antv/g2plot'
import plotList, { getCustomPlots } from '../G2Plots/plotList' import plotList, { getCustomPlots } from '../G2Plots/plotList'
import { settingToTheme } from 'data-room-ui/js/utils/themeFormatting' import { settingToTheme } from 'data-room-ui/js/utils/themeFormatting'
import _ from 'lodash'
export default { export default {
name: 'PlotCustomComponent', name: 'PlotCustomComponent',
@ -66,7 +67,7 @@ export default {
'config.option.theme': { 'config.option.theme': {
handler (val) { handler (val) {
if (val) { if (val) {
this.changeStyle(this.config) this.changeStyle(this.config, true)
} }
} }
} }
@ -175,7 +176,7 @@ export default {
return config return config
}, },
// config // config
changeStyle (config) { changeStyle (config, isUpdateTheme) {
config = { ...this.config, ...config } config = { ...this.config, ...config }
config = this.transformSettingToOption(config, 'custom') config = this.transformSettingToOption(config, 'custom')
// optionsettingeval,optionHandlerdataHandler // optionsettingeval,optionHandlerdataHandler
@ -189,8 +190,10 @@ export default {
console.error(e) console.error(e)
} }
} }
// //
config.theme = settingToTheme(cloneDeep(config), this.customTheme) if (!isUpdateTheme) {
config.theme = settingToTheme(_.cloneDeep(config), this.customTheme)
}
this.changeChartConfig(config) this.changeChartConfig(config)
if (config.code === this.activeCode) { if (config.code === this.activeCode) {
this.changeActiveItemConfig(config) this.changeActiveItemConfig(config)

@ -19,8 +19,9 @@ import remoteVueLoader from 'remote-vue-loader'
import { mapMutations, mapState } from 'vuex' import { mapMutations, mapState } from 'vuex'
import innerRemoteComponents, { getRemoteComponents } from 'data-room-ui/RemoteComponents/remoteComponentsList' import innerRemoteComponents, { getRemoteComponents } from 'data-room-ui/RemoteComponents/remoteComponentsList'
import { getBizComponentInfo } from 'data-room-ui/js/api/bigScreenApi' import { getBizComponentInfo } from 'data-room-ui/js/api/bigScreenApi'
import {settingToTheme} from "data-room-ui/js/utils/themeFormatting"; import { settingToTheme } from 'data-room-ui/js/utils/themeFormatting'
import _ from "lodash"; import _ from 'lodash'
import cloneDeep from 'lodash/cloneDeep'
export default { export default {
name: 'LcdpRemoteComponent', name: 'LcdpRemoteComponent',
mixins: [linkageMixins, commonMixins], mixins: [linkageMixins, commonMixins],
@ -50,10 +51,18 @@ export default {
'config.option.theme': { 'config.option.theme': {
handler (val) { handler (val) {
if (val) { if (val) {
this.changeStyle(this.config) this.changeStyle(this.config, true)
} }
} }
} }
// customTheme: {
// handler (val) {
// if (val) {
// this.changeStyle(this.config, true)
// }
// },
// deep: true
// }
}, },
created () { created () {
this.getRemoteComponent() this.getRemoteComponent()
@ -133,13 +142,19 @@ export default {
// export default // export default
settingContent = settingContent.replace(/export default[\s\S]*/, '') settingContent = settingContent.replace(/export default[\s\S]*/, '')
eval(settingContent) eval(settingContent)
// this.config.option = {
// ...this.config.option,
// ...option
// }
this.config.option = { this.config.option = {
...this.config.option, ...option,
...option ...this.config.option
} }
this.config.setting = setting this.config.setting = setting
//
// this.config.theme = settingToTheme(cloneDeep(this.config), this.customTheme)
// settingtheme // settingtheme
this.config.theme = settingToTheme(this.config, this.customTheme) // this.config.theme = settingToTheme(this.config, this.customTheme)
return { return {
option, option,
@ -196,10 +211,8 @@ export default {
return config return config
}, },
// config // config
changeStyle (config) { changeStyle (config, isUpdateTheme) {
config = { ...this.config, ...config } config = { ...this.config, ...config }
//
config.theme = settingToTheme(_.cloneDeep(config), this.customTheme)
config = this.transformSettingToOption(config, 'custom') config = this.transformSettingToOption(config, 'custom')
// optionsettingeval,optionHandlerdataHandler // optionsettingeval,optionHandlerdataHandler
const option = config.option const option = config.option
@ -212,6 +225,10 @@ export default {
console.error(e) console.error(e)
} }
} }
//
if (!isUpdateTheme) {
config.theme = settingToTheme(_.cloneDeep(config), this.customTheme)
}
if (this.chart) { if (this.chart) {
this.chart.update(config.option) this.chart.update(config.option)
} }

@ -6,8 +6,8 @@
:style="{ :style="{
width: pageInfo.pageConfig.w + 'px', width: pageInfo.pageConfig.w + 'px',
height: pageInfo.pageConfig.h + 'px', height: pageInfo.pageConfig.h + 'px',
backgroundColor: pageInfo.pageConfig.bgColor, backgroundColor:pageInfo.pageConfig.customTheme ==='dark' ? pageInfo.pageConfig.bgColor : pageInfo.pageConfig.lightBgColor,
backgroundImage: `url(${pageInfo.pageConfig.bg})` backgroundImage:pageInfo.pageConfig.customTheme ==='dark' ? `url(${pageInfo.pageConfig.bg})`:`url(${pageInfo.pageConfig.lightBg})`
}" }"
@drop="drop($event)" @drop="drop($event)"
@dragover.prevent @dragover.prevent

@ -248,7 +248,9 @@ export default {
bgColor: '#151a26', bgColor: '#151a26',
opacity: 100, opacity: 100,
customTheme: 'auto', customTheme: 'auto',
bg: null bg: null,
lightBgColor: '#151a26',
lightBg: null
}) })
if (this.dataForm.type === 'bigScreen') { if (this.dataForm.type === 'bigScreen') {
this.resolutionRatio.w = '1920' this.resolutionRatio.w = '1920'

@ -59,6 +59,8 @@ export function handleResData (data) {
w: 1920, w: 1920,
h: 1080, h: 1080,
bgColor: '#151a26', // 背景色 bgColor: '#151a26', // 背景色
lightBgColor: '#151a26',
lightBg: '',
bg: '', // 背景图 bg: '', // 背景图
customTheme: 'dark', customTheme: 'dark',
opacity: 100 opacity: 100

@ -22,6 +22,8 @@ export const defaultData = {
h: 1080, h: 1080,
bgColor: '#151a26', // 背景色 bgColor: '#151a26', // 背景色
bg: '', // 背景图 bg: '', // 背景图
lightBgColor: '#151a26',
lightBg: '',
opacity: 100, opacity: 100,
customTheme: 'dark', customTheme: 'dark',
themeJson: {}, // 自定义主题配置 themeJson: {}, // 自定义主题配置

Loading…
Cancel
Save