diff --git a/src/assets/main.css b/src/assets/main.css index 55a5f7a..da5dcb6 100644 --- a/src/assets/main.css +++ b/src/assets/main.css @@ -92,7 +92,8 @@ a, .green { height: 30px; align-items: center; color: #66FFFF; - background-image: linear-gradient(90deg, rgba(1, 196, 236, 0.5) 0%, rgba(1, 196, 236, 0.01) 100%); + background-image: linear-gradient(90deg, rgba(1, 196, 236, 0.5) 0%, rgba(1, 196, 236, 0.01) 100%) !important; + background-size: 100% 100% !important; } .tableHead { @@ -111,6 +112,10 @@ a, .green { flex-shrink: 0; } +.summary .tableCell { + color: #66FFFF !important; +} + .summary .item { white-space: wrap; word-break: break-all; diff --git a/src/views/AppHourSale.vue b/src/views/AppHourSale.vue index fbc81e7..7dadef8 100644 --- a/src/views/AppHourSale.vue +++ b/src/views/AppHourSale.vue @@ -117,27 +117,42 @@ export default { summary.saleGrowthRate = summary.saleGrowthRate.toFixed(2) + "%" } }) - this.hourSummary = v.tableColumns.map((column, i) => { - const isNumber = v => /^-?\d+(\.\d+)?%?$/.test(v) - const style = {textAlign: column.align} - if (column.width > 0) { - style.width = `${column.width}px` - } else { - style.flex = 1 - style.minWidth = 0 - } - return { - style, - value: isNumber(summary[column.prop]) ? summary[column.prop] : - i == 0 ? "时段合计" : "" - } + const summaryRow = {} + v.tableColumns.forEach(({prop}, i) => { + summaryRow[prop] = i == 0 ? "时段合计" : (summary[prop] || '') }) - this.hourSummaryStyle.display = "flex" + v.tableData.splice(rowIndex, 0, summaryRow) + // this.hourSummary = v.tableColumns.map((column, i) => { + // const isNumber = v => /^-?\d+(\.\d+)?%?$/.test(v) + // const style = {textAlign: column.align} + // if (column.width > 0) { + // style.width = `${column.width}px` + // } else { + // style.flex = 1 + // style.minWidth = 0 + // } + // return { + // style, + // value: isNumber(summary[column.prop]) ? summary[column.prop] : + // i == 0 ? "时段合计" : "" + // } + // }) + // this.hourSummaryStyle.display = "flex" }, handleMouseOver(evt) { const getTop = e => e.offsetParent ? getTop(e.offsetParent) + e.offsetTop : e.offsetTop const top = getTop(this.$el) - // this.$set(this.hourSummaryStyle, "top", (evt.clientY - top + 10) + "px") + }, + handleRowStyle({row}) { + if (row.hour == '时段合计') return 'summary' + return '' + }, + handleMouseout() { + // this.hourSummaryStyle = {display: 'none'} + console.log('handleMouseout') + const i = this.tableData.findIndex(e => e.hour == '时段合计') + this.tableData.splice(i, 1) + // this.$refs.table.doLayout() } }, watch: { @@ -152,7 +167,7 @@ export default {