feat:修改表格主题设置问题

main
liu.shiyi 2 years ago
parent 752e1cad84
commit be58d81f78

@ -33,6 +33,7 @@ import commonMixins from 'data-room-ui/js/mixins/commonMixins'
import paramsMixins from 'data-room-ui/js/mixins/paramsMixins' import paramsMixins from 'data-room-ui/js/mixins/paramsMixins'
import linkageMixins from 'data-room-ui/js/mixins/linkageMixins' import linkageMixins from 'data-room-ui/js/mixins/linkageMixins'
import cloneDeep from 'lodash/cloneDeep' import cloneDeep from 'lodash/cloneDeep'
import { settingToTheme } from 'data-room-ui/js/utils/themeFormatting'
export default { export default {
name: 'TableChart', name: 'TableChart',
mixins: [paramsMixins, commonMixins, linkageMixins], mixins: [paramsMixins, commonMixins, linkageMixins],
@ -86,35 +87,34 @@ export default {
fontSize: this.config.customize.headerFontSize + 'px' || '14px' fontSize: this.config.customize.headerFontSize + 'px' || '14px'
} }
return style return style
}, }
cellStyle () { },
created () { },
mounted () {
this.chartInit()
},
methods: {
cellStyle ({ row, column, rowIndex, columnIndex }) {
const bodyBackgroundColor = { const bodyBackgroundColor = {
dark: '#141414', dark: '#141414',
light: '#ffffff', light: '#ffffff',
auto: 'transparent' auto: 'transparent'
} }
const initColor = this.customTheme === 'light' ? '#000000' : '#ffffff'
const style = { const style = {
backgroundColor: backgroundColor: '',
this.customTheme !== 'custom' color: this.config.customize.bodyFontColor || initColor,
? this.config.customize.bodyBackgroundColor || bodyBackgroundColor[this.customTheme] fontSize: this.config.customize.bodyFontSize + 'px' || '14px'
: this.headerCellStyleObj.backgroundColor, }
color: if (rowIndex % 2 && this.config.customize.evenRowBackgroundColor) {
this.customTheme === 'light' style.backgroundColor = this.config.customize.evenRowBackgroundColor
? '#000000' } else if (!(rowIndex % 2) && this.config.customize.oddRowBackgroundColor) {
: this.config.customize.bodyFontColor || '#ffffff', style.backgroundColor = this.config.customize.oddRowBackgroundColor
fontSize: this.config.customize.bodyFontSize + 'px' || '14px', } else {
border: `solid 1px ${this.customTheme !== 'custom' style.backgroundColor = this.config.customize.bodyBackgroundColor || bodyBackgroundColor[this.customTheme]
? this.config.customize.bodyBackgroundColor || bodyBackgroundColor[this.customTheme]
: this.headerCellStyleObj.backgroundColor}`
} }
return style return style
} },
},
created () { },
mounted () {
this.chartInit()
},
methods: {
rowStyle ({ row, rowIndex }) { rowStyle ({ row, rowIndex }) {
if (rowIndex % 2) { if (rowIndex % 2) {
return { return {
@ -130,16 +130,23 @@ export default {
rowClick (row) { rowClick (row) {
this.linkage(row) this.linkage(row)
}, },
changeStyle (oldConfig) { changeStyle (config) {
const config = cloneDeep(oldConfig) config = { ...this.config, ...config }
if (this.customTheme === 'custom') { //
this.headerCellStyleToObj() config.theme = settingToTheme(cloneDeep(config), this.customTheme)
this.cellStyleToObj() this.changeChartConfig(config)
} if (config.code === this.activeCode) {
if (this.customTheme === 'custom') { this.changeActiveItemConfig(config)
this.headerCellStyleToObj()
this.cellStyleToObj()
} }
// const config = cloneDeep(oldConfig)
// if (this.customTheme === 'custom') {
// this.headerCellStyleToObj()
// this.cellStyleToObj()
// }
// if (this.customTheme === 'custom') {
// this.headerCellStyleToObj()
// this.cellStyleToObj()
// }
// if (config.customize.stripe) { // if (config.customize.stripe) {
// const trs = document // const trs = document
// .getElementById(this.config.code) // .getElementById(this.config.code)
@ -173,14 +180,14 @@ export default {
// // }); // // });
// } // }
// this.chartInit(); // this.chartInit();
if (config.customize.evenRowBackgroundColor && !config.customize.oddRowBackgroundColor) { // if (config.customize.evenRowBackgroundColor && !config.customize.oddRowBackgroundColor) {
config.customize.oddRowBackgroundColor = config.customize.bodyBackgroundColor // config.customize.oddRowBackgroundColor = config.customize.bodyBackgroundColor
} else if (!config.customize.evenRowBackgroundColor && config.customize.oddRowBackgroundColor) { // } else if (!config.customize.evenRowBackgroundColor && config.customize.oddRowBackgroundColor) {
config.customize.evenRowBackgroundColor = config.customize.bodyBackgroundColor // config.customize.evenRowBackgroundColor = config.customize.bodyBackgroundColor
} else if (!(!config.customize.evenRowBackgroundColor && !config.customize.oddRowBackgroundColor)) { // } else if (!(!config.customize.evenRowBackgroundColor && !config.customize.oddRowBackgroundColor)) {
config.customize.bodyBackgroundColor = '' // config.customize.bodyBackgroundColor = ''
} // }
this.updateKey = new Date().getTime() // this.updateKey = new Date().getTime()
return config return config
}, },
dataFormatting (config, data) { dataFormatting (config, data) {

Loading…
Cancel
Save