From fe4270178f36baa172b9b63c5bab3c101146b6ff Mon Sep 17 00:00:00 2001
From: qsh <>
Date: Fri, 8 Nov 2024 16:02:28 +0800
Subject: [PATCH] sc
---
.../Home/Comp/DialogSalerReportDetail.vue | 12 +++-
src/views/Home/SalesReport.vue | 61 +++++++++++++++++--
2 files changed, 66 insertions(+), 7 deletions(-)
diff --git a/src/views/Home/Comp/DialogSalerReportDetail.vue b/src/views/Home/Comp/DialogSalerReportDetail.vue
index 89f6e84..3804b7a 100644
--- a/src/views/Home/Comp/DialogSalerReportDetail.vue
+++ b/src/views/Home/Comp/DialogSalerReportDetail.vue
@@ -25,7 +25,12 @@
/>
-
+
-
+
-
-
+
+
{{
@@ -164,22 +176,61 @@ function handleReset() {
const month = new Date().getMonth() + 1
searchForm.value = {
nickname: undefined,
- consultTime: [`${year}-${month}-01`, formatDate(new Date())]
+ consultTime: [`${year}-${month}-01`, formatDate(new Date())],
+ licenseTypeList: [],
+ sourceId: undefined
}
}
const loading = ref(false)
const tableList = ref([])
+const avgData = ref({})
async function handleSearch() {
loading.value = true
try {
const data = await reportApi.getList(removeNullField(searchForm.value))
- tableList.value = data
+ tableList.value = data.personDataVOList
+ avgData.value = data.averageDataVO
} finally {
loading.value = false
}
}
+function getSummaries({ columns, data }) {
+ const sums = []
+ columns.forEach((column, index) => {
+ if (index == 0) {
+ sums[index] = '统计'
+ return
+ }
+
+ const doubleSumsColumns = [
+ 'newClueNumber',
+ 'signNumber',
+ 'clueCostTotal',
+ 'payPriceTotal',
+ 'profitTotal'
+ ]
+ if (column.property in avgData.value) {
+ sums[index] = `均值: ${avgData.value[column.property]}`
+ } else if (doubleSumsColumns.includes(column.property)) {
+ const values = data.map((item) => Number(item[column.property]))
+ let sum = values.reduce((prev, curr) => prev + curr, 0)
+ let avg = sum / values.length
+ if (['newClueNumber', 'signNumber'].includes(column.property)) {
+ avg = Math.floor(avg)
+ } else {
+ sum = sum.toFixed(2)
+ avg = avg.toFixed(2)
+ }
+ sums[index] = h('div', {}, [h('div', {}, `合计:${sum}`), h('div', {}, `均值:${avg}`)])
+ } else {
+ sums[index] = ''
+ }
+ })
+ return sums
+}
+
const SalerDetailDialog = ref()
function handleDetail(info) {
SalerDetailDialog.value.open(info, searchForm.value)