优化调整
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
<script>
|
||||
let timer
|
||||
export default {
|
||||
name: "AppHourSale",
|
||||
label: "市场看板-全门店时段销售",
|
||||
@@ -91,18 +90,17 @@ export default {
|
||||
})).then(res => {
|
||||
if (res?.data) {
|
||||
this.summary = res.data.total
|
||||
this.tableData = res.data?.page?.records?.map(e => ({...e, hour: `${e.hour.padStart(2, '0')}:00-${`${Number(e.hour) + 1}`.padStart(2, '0')}:00`})) || []
|
||||
this.tableData = res.data?.page?.records?.map(e => ({...e, hour: `${e.hour.padStart(2, '0')}:00-${`${Number(e.hour) + 1}`.padStart(2, '0')}:00`, index: e.hour})).sort((a, b) => a.index - b.index) || []
|
||||
}
|
||||
})
|
||||
},
|
||||
handleSta({hour}) {
|
||||
this.handleMouseout()
|
||||
const rowIndex = this.tableData.findIndex(e => e.hour == hour)
|
||||
const v = this
|
||||
const summary = {
|
||||
compareSaleAmt: 0, compareValidOrderNum: 0, currentSaleAmt: 0, currentValidOrderNum: 0, saleGrowthRate: 0
|
||||
}
|
||||
|
||||
console.log(rowIndex)
|
||||
v.tableData.forEach((e, i) => {
|
||||
if (i <= rowIndex) {
|
||||
summary.compareSaleAmt += Number(e.compareSaleAmt || 0)
|
||||
@@ -123,7 +121,6 @@ export default {
|
||||
v.tableColumns.forEach(({prop}, i) => {
|
||||
summaryRow[prop] = i == 0 ? "时段合计" : (summary[prop] || '')
|
||||
})
|
||||
this.handleMouseout()
|
||||
v.tableData.splice(rowIndex + 1, 0, summaryRow)
|
||||
// this.hourSummary = v.tableColumns.map((column, i) => {
|
||||
// const isNumber = v => /^-?\d+(\.\d+)?%?$/.test(v)
|
||||
|
||||
@@ -57,9 +57,16 @@ export default {
|
||||
})).then(res => {
|
||||
if (res?.data) {
|
||||
this.summary = res.data.total
|
||||
this.tableData = res.data?.page?.records || []
|
||||
return this.tableData = res.data?.page?.records || []
|
||||
}
|
||||
})
|
||||
},
|
||||
getOptions() {
|
||||
const ops = {}
|
||||
this.tableData.forEach(e => {
|
||||
ops[e.groupCode] = e.supervisorName
|
||||
})
|
||||
return Object.entries(ops).map(([key, value]) => ({label: value, value: key}))
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -71,9 +78,7 @@ export default {
|
||||
},
|
||||
created() {
|
||||
this.getTableData().then(() => {
|
||||
this.options = this.tableData.map(e => ({
|
||||
label: e.supervisorName, value: e.groupCode
|
||||
}))
|
||||
this.options = this.getOptions()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user