fix: echarts表格隐藏表头同时隐藏统计行

This commit is contained in:
wisonic-s 2023-11-15 21:10:32 +08:00
parent dd89657d6c
commit e290b4a489
2 changed files with 16 additions and 18 deletions

View File

@ -108,7 +108,6 @@
<table-normal <table-normal
v-else-if="tableShowFlag" v-else-if="tableShowFlag"
:ref="element.propValue.id" :ref="element.propValue.id"
:show-summary="chart.type === 'table-normal'"
:chart="chart" :chart="chart"
:track-menu="trackMenu" :track-menu="trackMenu"
class="table-class" class="table-class"

View File

@ -123,11 +123,6 @@ export default {
return {} return {}
} }
}, },
showSummary: {
type: Boolean,
required: false,
default: true
},
enableScroll: { enableScroll: {
type: Boolean, type: Boolean,
required: false, required: false,
@ -214,7 +209,8 @@ export default {
left: '0px', left: '0px',
top: '0px' top: '0px'
}, },
pointParam: null pointParam: null,
showSummary: true
} }
}, },
computed: { computed: {
@ -362,8 +358,7 @@ export default {
}) })
} }
this.$refs.plxTable.reloadData(data) this.$refs.plxTable.reloadData(data).then(() => {
this.$nextTick(() => {
this.initStyle() this.initStyle()
}) })
window.addEventListener('resize', this.calcHeightDelay) window.addEventListener('resize', this.calcHeightDelay)
@ -455,8 +450,10 @@ export default {
} }
if (customAttr.size.showTableHeader === false) { if (customAttr.size.showTableHeader === false) {
this.showHeader = false this.showHeader = false
this.showSummary = false
} else { } else {
this.showHeader = true this.showHeader = true
this.showSummary = this.chart.type === 'table-normal'
} }
const autoBreakLine = customAttr.size.tableAutoBreakLine ? customAttr.size.tableAutoBreakLine : DEFAULT_SIZE.tableAutoBreakLine const autoBreakLine = customAttr.size.tableAutoBreakLine ? customAttr.size.tableAutoBreakLine : DEFAULT_SIZE.tableAutoBreakLine
@ -503,16 +500,18 @@ export default {
} }
// footer // footer
const table = document.getElementsByClassName(this.chart.id) const table = document.getElementsByClassName(this.chart.id)
for (let i = 0; i < table.length; i++) { this.$refs.plxTable.updateFooter().then(() => {
const s_table = table[i].getElementsByClassName('elx-table--footer') for (let i = 0; i < table.length; i++) {
let s = '' const s_table = table[i].getElementsByClassName('elx-table--footer')
for (const i in this.table_header_class) { let s = ''
s += (i === 'fontSize' ? 'font-size' : i) + ':' + this.table_header_class[i] + ';' for (const i in this.table_header_class) {
s += (i === 'fontSize' ? 'font-size' : i) + ':' + this.table_header_class[i] + ';'
}
for (let i = 0; i < s_table.length; i++) {
s_table[i].setAttribute('style', s)
}
} }
for (let i = 0; i < s_table.length; i++) { })
s_table[i].setAttribute('style', s)
}
}
}, },
getRowStyle({ row, rowIndex }) { getRowStyle({ row, rowIndex }) {
if (rowIndex % 2 !== 0) { if (rowIndex % 2 !== 0) {