94 lines
2.9 KiB
Vue
94 lines
2.9 KiB
Vue
<script>
|
|
export default {
|
|
name: "AppGroupMonitorTable",
|
|
label: "市场看板-课区运营监控表",
|
|
data() {
|
|
return {
|
|
tableData: [],
|
|
columns: [
|
|
{label: "课区", prop: "groupName", width: 50, align: 'center'},
|
|
{label: "课长", prop: "supervisorName", width: 60, align: 'center'},
|
|
{label: "销售额", prop: "saleAmt", width: 60, align: 'right'},
|
|
{label: "外卖销售额", prop: "deliverySaleAmt", width: 60, align: 'right'},
|
|
{label: "有效订单数", prop: "validOrderNum", width: 60, align: 'right'},
|
|
{label: "客单价", prop: "customerUnitPrice", width: 58, align: 'right'},
|
|
{label: "蛋糕销售额", prop: "cakeSaleAmt", width: 60, align: 'right'},
|
|
{label: "西点销售额", prop: "westSaleAmt", width: 60, align: 'right'},
|
|
{label: "现烤销售额", prop: "bakeSaleAmt", width: 60, align: 'right'},
|
|
{label: "现烤损货比", prop: "lossAmtRate", width: 60, align: 'right'},
|
|
{label: "环比(目标完成比)", prop: "targetRate", align: 'right'},
|
|
],
|
|
summary: {}
|
|
}
|
|
},
|
|
computed: {
|
|
search: v => v.$marketBoard.search,
|
|
tableConfig: v => {
|
|
return {
|
|
headerBGC: 'rgba(13, 48, 99, 0.6)',
|
|
oddRowBGC: window.evenRowBGC(), evenRowBGC: "transparent",
|
|
header: v.columns.map(e => e.label),
|
|
columnWidth: v.columns.map(e => e.width || "0;flex:1;min-width:0;"),
|
|
align: v.columns.map(e => e.align || "left"),
|
|
data: v.tableData.map(e => v.columns.map(column => e[column.prop])),
|
|
}
|
|
},
|
|
summaryRow: v => v.columns.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(v.summary[column.prop]) ? v.summary[column.prop] :
|
|
i == 0 ? v.summary.groupName : ""
|
|
}
|
|
})
|
|
},
|
|
methods: {
|
|
getTableData() {
|
|
const {$http, $waitFor} = window
|
|
$waitFor($http).then(() => $http.post("/data-boot/la/screen/marketBoard/groupMonitor", {
|
|
...this.search, limit: 999
|
|
})).then(res => {
|
|
if (res?.data) {
|
|
this.summary = res.data.total
|
|
this.tableData = res.data?.page?.records || []
|
|
}
|
|
})
|
|
}
|
|
},
|
|
watch: {
|
|
search: {
|
|
immediate: true, deep: true, handler() {
|
|
this.getTableData()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<section class="AppGroupMonitorTable">
|
|
<dv-scroll-board :config="tableConfig" @click=""/>
|
|
<div class="summary flex">
|
|
<div class="item" v-for="(col,i) in summaryRow" :key="i" v-text="col.value" :style="col.style"/>
|
|
</div>
|
|
</section>
|
|
</template>
|
|
|
|
<style>
|
|
.AppGroupMonitorTable {
|
|
color: #fff;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.AppGroupMonitorTable .dv-scroll-board {
|
|
height: calc(100% - 30px) !important;
|
|
}
|
|
</style>
|