优化调整
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
<script>
|
<script>
|
||||||
let timer
|
|
||||||
export default {
|
export default {
|
||||||
name: "AppHourSale",
|
name: "AppHourSale",
|
||||||
label: "市场看板-全门店时段销售",
|
label: "市场看板-全门店时段销售",
|
||||||
@@ -91,18 +90,17 @@ export default {
|
|||||||
})).then(res => {
|
})).then(res => {
|
||||||
if (res?.data) {
|
if (res?.data) {
|
||||||
this.summary = res.data.total
|
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}) {
|
handleSta({hour}) {
|
||||||
|
this.handleMouseout()
|
||||||
const rowIndex = this.tableData.findIndex(e => e.hour == hour)
|
const rowIndex = this.tableData.findIndex(e => e.hour == hour)
|
||||||
const v = this
|
const v = this
|
||||||
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)
|
|
||||||
v.tableData.forEach((e, i) => {
|
v.tableData.forEach((e, i) => {
|
||||||
if (i <= rowIndex) {
|
if (i <= rowIndex) {
|
||||||
summary.compareSaleAmt += Number(e.compareSaleAmt || 0)
|
summary.compareSaleAmt += Number(e.compareSaleAmt || 0)
|
||||||
@@ -123,7 +121,6 @@ export default {
|
|||||||
v.tableColumns.forEach(({prop}, i) => {
|
v.tableColumns.forEach(({prop}, i) => {
|
||||||
summaryRow[prop] = i == 0 ? "时段合计" : (summary[prop] || '')
|
summaryRow[prop] = i == 0 ? "时段合计" : (summary[prop] || '')
|
||||||
})
|
})
|
||||||
this.handleMouseout()
|
|
||||||
v.tableData.splice(rowIndex + 1, 0, summaryRow)
|
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)
|
||||||
|
|||||||
@@ -57,9 +57,16 @@ export default {
|
|||||||
})).then(res => {
|
})).then(res => {
|
||||||
if (res?.data) {
|
if (res?.data) {
|
||||||
this.summary = res.data.total
|
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: {
|
watch: {
|
||||||
@@ -71,9 +78,7 @@ export default {
|
|||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getTableData().then(() => {
|
this.getTableData().then(() => {
|
||||||
this.options = this.tableData.map(e => ({
|
this.options = this.getOptions()
|
||||||
label: e.supervisorName, value: e.groupCode
|
|
||||||
}))
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user