From 1c8a98eacde5acbfcfdba6ccc1e5d089bccbdf37 Mon Sep 17 00:00:00 2001 From: aixianling Date: Tue, 22 Oct 2024 16:37:18 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9C=80=E6=B1=82=E5=8F=98=E6=9B=B4-5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/main.css | 7 +++++- src/views/AppHourSale.vue | 49 +++++++++++++++++++++++++-------------- 2 files changed, 38 insertions(+), 18 deletions(-) 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 {