需求变更-5 优化体验
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
|
let timer
|
||||||
export default {
|
export default {
|
||||||
name: "AppHourSale",
|
name: "AppHourSale",
|
||||||
label: "市场看板-全门店时段销售",
|
label: "市场看板-全门店时段销售",
|
||||||
@@ -100,6 +101,7 @@ export default {
|
|||||||
const summary = {
|
const summary = {
|
||||||
compareSaleAmt: 0, compareValidOrderNum: 0, currentSaleAmt: 0, currentValidOrderNum: 0, saleGrowthRate: 0
|
compareSaleAmt: 0, compareValidOrderNum: 0, currentSaleAmt: 0, currentValidOrderNum: 0, saleGrowthRate: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(rowIndex)
|
console.log(rowIndex)
|
||||||
v.tableData.forEach((e, i) => {
|
v.tableData.forEach((e, i) => {
|
||||||
if (i <= rowIndex) {
|
if (i <= rowIndex) {
|
||||||
@@ -121,7 +123,8 @@ export default {
|
|||||||
v.tableColumns.forEach(({prop}, i) => {
|
v.tableColumns.forEach(({prop}, i) => {
|
||||||
summaryRow[prop] = i == 0 ? "时段合计" : (summary[prop] || '')
|
summaryRow[prop] = i == 0 ? "时段合计" : (summary[prop] || '')
|
||||||
})
|
})
|
||||||
v.tableData.splice(rowIndex, 0, summaryRow)
|
this.handleMouseout()
|
||||||
|
v.tableData.splice(rowIndex + 1, 0, summaryRow)
|
||||||
// this.hourSummary = v.tableColumns.map((column, i) => {
|
// this.hourSummary = v.tableColumns.map((column, i) => {
|
||||||
// const isNumber = v => /^-?\d+(\.\d+)?%?$/.test(v)
|
// const isNumber = v => /^-?\d+(\.\d+)?%?$/.test(v)
|
||||||
// const style = {textAlign: column.align}
|
// const style = {textAlign: column.align}
|
||||||
@@ -139,20 +142,15 @@ export default {
|
|||||||
// })
|
// })
|
||||||
// this.hourSummaryStyle.display = "flex"
|
// this.hourSummaryStyle.display = "flex"
|
||||||
},
|
},
|
||||||
handleMouseOver(evt) {
|
|
||||||
const getTop = e => e.offsetParent ? getTop(e.offsetParent) + e.offsetTop : e.offsetTop
|
|
||||||
const top = getTop(this.$el)
|
|
||||||
},
|
|
||||||
handleRowStyle({row}) {
|
handleRowStyle({row}) {
|
||||||
if (row.hour == '时段合计') return 'summary'
|
if (row.hour == '时段合计') return 'summary'
|
||||||
return ''
|
return ''
|
||||||
},
|
},
|
||||||
handleMouseout() {
|
handleMouseout() {
|
||||||
// this.hourSummaryStyle = {display: 'none'}
|
// this.hourSummaryStyle = {display: 'none'}
|
||||||
console.log('handleMouseout')
|
|
||||||
const i = this.tableData.findIndex(e => e.hour == '时段合计')
|
const i = this.tableData.findIndex(e => e.hour == '时段合计')
|
||||||
|
if (i == -1) return;
|
||||||
this.tableData.splice(i, 1)
|
this.tableData.splice(i, 1)
|
||||||
// this.$refs.table.doLayout()
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@@ -161,17 +159,24 @@ export default {
|
|||||||
this.getTableData()
|
this.getTableData()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
document.addEventListener('click', evt => {
|
||||||
|
if (!this.$el.contains(evt.target)) {
|
||||||
|
this.handleMouseout()
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<section class="AppHourSale" @mousemove="handleMouseOver">
|
<section class="AppHourSale">
|
||||||
<scroll-table :table-data="tableData" :columns="columns" @click="handleSta" @mouseout.native="handleMouseout" :config="{rowClassName:handleRowStyle}"/>
|
<scroll-table :table-data="tableData" :columns="columns" @click="handleSta" @click.native.stop :config="{rowClassName:handleRowStyle}"/>
|
||||||
<!--<dv-scroll-board :config="tableConfig" @mouseover="handleSta" @mouseout.native="hourSummaryStyle={display:'none'}"/>-->
|
<!--<dv-scroll-board :config="tableConfig" @mouseover="handleSta" @mouseout.native="hourSummaryStyle={display:'none'}"/>-->
|
||||||
<div class="summary flex hourSummary" :style="hourSummaryStyle">
|
<!-- <div class="summary flex hourSummary" :style="hourSummaryStyle">-->
|
||||||
<div class="item" v-for="(col,i) in hourSummary" :key="i" v-text="col.value" :style="col.style"/>
|
<!-- <div class="item" v-for="(col,i) in hourSummary" :key="i" v-text="col.value" :style="col.style"/>-->
|
||||||
</div>
|
<!-- </div>-->
|
||||||
<div class="summary flex">
|
<div class="summary flex">
|
||||||
<div class="item" v-for="(col,i) in summaryRow" :key="i" v-text="col.value" :style="col.style"/>
|
<div class="item" v-for="(col,i) in summaryRow" :key="i" v-text="col.value" :style="col.style"/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user