|
|
@ -31,6 +31,7 @@
|
|
|
|
import commonMixins from 'packages/js/mixins/commonMixins'
|
|
|
|
import commonMixins from 'packages/js/mixins/commonMixins'
|
|
|
|
import paramsMixins from 'packages/js/mixins/paramsMixins'
|
|
|
|
import paramsMixins from 'packages/js/mixins/paramsMixins'
|
|
|
|
import linkageMixins from 'packages/js/mixins/linkageMixins'
|
|
|
|
import linkageMixins from 'packages/js/mixins/linkageMixins'
|
|
|
|
|
|
|
|
import _ from 'lodash'
|
|
|
|
export default {
|
|
|
|
export default {
|
|
|
|
name: 'TableChart',
|
|
|
|
name: 'TableChart',
|
|
|
|
mixins: [paramsMixins, commonMixins, linkageMixins],
|
|
|
|
mixins: [paramsMixins, commonMixins, linkageMixins],
|
|
|
@ -46,6 +47,7 @@ export default {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
data () {
|
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
|
|
|
|
updateKey: '',
|
|
|
|
headerCellStyleObj: {
|
|
|
|
headerCellStyleObj: {
|
|
|
|
backgroundColor: 'transparent'
|
|
|
|
backgroundColor: 'transparent'
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -110,14 +112,15 @@ export default {
|
|
|
|
created () { },
|
|
|
|
created () { },
|
|
|
|
mounted () {
|
|
|
|
mounted () {
|
|
|
|
this.chartInit()
|
|
|
|
this.chartInit()
|
|
|
|
this.initStyle()
|
|
|
|
this.changeStyle(this.config)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
methods: {
|
|
|
|
// 表格点击事件
|
|
|
|
// 表格点击事件
|
|
|
|
rowClick (row) {
|
|
|
|
rowClick (row) {
|
|
|
|
this.linkage(row)
|
|
|
|
this.linkage(row)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
initStyle () {
|
|
|
|
changeStyle (oldConfig) {
|
|
|
|
|
|
|
|
const config = _.cloneDeep(oldConfig)
|
|
|
|
if (this.customTheme === 'custom') {
|
|
|
|
if (this.customTheme === 'custom') {
|
|
|
|
this.headerCellStyleToObj()
|
|
|
|
this.headerCellStyleToObj()
|
|
|
|
this.cellStyleToObj()
|
|
|
|
this.cellStyleToObj()
|
|
|
@ -126,7 +129,7 @@ export default {
|
|
|
|
this.headerCellStyleToObj()
|
|
|
|
this.headerCellStyleToObj()
|
|
|
|
this.cellStyleToObj()
|
|
|
|
this.cellStyleToObj()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (this.config.customize.stripe) {
|
|
|
|
if (config.customize.stripe) {
|
|
|
|
const trs = document
|
|
|
|
const trs = document
|
|
|
|
.getElementById(this.config.code)
|
|
|
|
.getElementById(this.config.code)
|
|
|
|
?.querySelectorAll('tr.el-table__row--striped')
|
|
|
|
?.querySelectorAll('tr.el-table__row--striped')
|
|
|
@ -142,7 +145,7 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
const trs = document
|
|
|
|
const trs = document
|
|
|
|
.getElementById(this.config.code)
|
|
|
|
.getElementById(config.code)
|
|
|
|
?.querySelectorAll('tr.el-table__row--striped')
|
|
|
|
?.querySelectorAll('tr.el-table__row--striped')
|
|
|
|
if (trs) {
|
|
|
|
if (trs) {
|
|
|
|
trs.forEach(tr => {
|
|
|
|
trs.forEach(tr => {
|
|
|
@ -159,21 +162,23 @@ export default {
|
|
|
|
// });
|
|
|
|
// });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// this.chartInit();
|
|
|
|
// this.chartInit();
|
|
|
|
if (this.config.customize.evenRowBackgroundColor && !this.config.customize.oddRowBackgroundColor) {
|
|
|
|
if (config.customize.evenRowBackgroundColor && !config.customize.oddRowBackgroundColor) {
|
|
|
|
this.config.customize.oddRowBackgroundColor = this.config.customize.bodyBackgroundColor
|
|
|
|
config.customize.oddRowBackgroundColor = config.customize.bodyBackgroundColor
|
|
|
|
} else if (!this.config.customize.evenRowBackgroundColor && this.config.customize.oddRowBackgroundColor) {
|
|
|
|
} else if (!config.customize.evenRowBackgroundColor && config.customize.oddRowBackgroundColor) {
|
|
|
|
this.config.customize.evenRowBackgroundColor = this.config.customize.bodyBackgroundColor
|
|
|
|
config.customize.evenRowBackgroundColor = config.customize.bodyBackgroundColor
|
|
|
|
} else if (!(!this.config.customize.evenRowBackgroundColor && !this.config.customize.oddRowBackgroundColor)) {
|
|
|
|
} else if (!(!config.customize.evenRowBackgroundColor && !config.customize.oddRowBackgroundColor)) {
|
|
|
|
this.config.customize.bodyBackgroundColor = ''
|
|
|
|
config.customize.bodyBackgroundColor = ''
|
|
|
|
}
|
|
|
|
}
|
|
|
|
window.requestAnimationFrame(() => {
|
|
|
|
window.requestAnimationFrame(() => {
|
|
|
|
document.querySelectorAll(`.even-row${this.config.code}`).forEach(node => {
|
|
|
|
document.querySelectorAll(`.even-row${config.code}`).forEach(node => {
|
|
|
|
node.style.backgroundColor = this.config.customize.evenRowBackgroundColor
|
|
|
|
node.style.backgroundColor = config.customize.evenRowBackgroundColor
|
|
|
|
})
|
|
|
|
})
|
|
|
|
document.querySelectorAll(`.odd-row${this.config.code}`).forEach(node => {
|
|
|
|
document.querySelectorAll(`.odd-row${config.code}`).forEach(node => {
|
|
|
|
node.style.backgroundColor = this.config.customize.oddRowBackgroundColor
|
|
|
|
node.style.backgroundColor = config.customize.oddRowBackgroundColor
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
this.updateKey = new Date().getTime()
|
|
|
|
|
|
|
|
return config
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// 表格行样式
|
|
|
|
// 表格行样式
|
|
|
|
tableRowClassName ({ row, rowIndex }) {
|
|
|
|
tableRowClassName ({ row, rowIndex }) {
|
|
|
@ -195,6 +200,7 @@ export default {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
config.option.columnData = columnData
|
|
|
|
config.option.columnData = columnData
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
this.updateKey = new Date().getTime()
|
|
|
|
return config
|
|
|
|
return config
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// 将样式字符串转成对象, 用于自定义主题,表格头部样式
|
|
|
|
// 将样式字符串转成对象, 用于自定义主题,表格头部样式
|
|
|
|