feat(统计业务): 课程统计添加排序;用户统计修改数据卡片显示;

- 更新课程统计和标签统计页面,添加自定义排序功能
- 实现刷新按钮,重置排序状态并重新获取数据
- 优化数据请求,支持排序参数的传递
- 更新用户统计页面,调整显示逻辑以提升用户体验
This commit is contained in:
2026-04-09 16:52:36 +08:00
parent 3e1b8917a8
commit b71a4464e7
3 changed files with 78 additions and 17 deletions

View File

@@ -37,7 +37,7 @@
<el-button
type="primary"
size="small"
@click="getDataList"
@click="handleRefresh"
>刷新</el-button>
</el-form-item>
<el-form-item>
@@ -51,17 +51,31 @@
<div class="table-container" ref="tableContainer">
<el-table
ref="dataTable"
:data="dataList"
border
:header-cell-style="{ textAlign: 'center' }"
:cell-style="{ textAlign: 'center' }"
:max-height="tableHeight"
@sort-change="handleSortChange"
>
<el-table-column prop="courseLabel" label="分类" min-width="150" />
<el-table-column prop="courseCount" label="总销售门数" min-width="120" />
<el-table-column prop="sales" label="总销量" min-width="100" />
<el-table-column
prop="courseCount"
label="总销售门数"
sortable="custom"
min-width="120"
/>
<el-table-column
prop="sales"
label="总销量"
sortable="custom"
min-width="100"
/>
<el-table-column
:label="timeType === 'year' ? '年销售额(微信+支付宝+银行+天医币)' : '月销售额(微信+支付宝+银行+天医币)'"
prop="salesFee"
sortable="custom"
min-width="280"
>
<template slot-scope="scope">
@@ -70,6 +84,8 @@
</el-table-column>
<el-table-column
:label="timeType === 'year' ? '年销售额(微信+支付宝+银行)' : '月销售额(微信+支付宝+银行)'"
prop="cashFee"
sortable="custom"
min-width="250"
>
<template slot-scope="scope">
@@ -89,7 +105,10 @@ export default {
return {
timeType: 'year',
currentDate: new Date(),
dataForm: {},
dataForm: {
sortKey: '',
sortValue: ''
},
dataList: [],
tableHeight: null
}
@@ -135,6 +154,19 @@ export default {
}
this.getDataList()
},
handleSortChange({ prop, order }) {
this.dataForm.sortKey = prop
this.dataForm.sortValue = order
this.getDataList()
},
handleRefresh() {
this.dataForm.sortKey = ''
this.dataForm.sortValue = ''
this.$nextTick(() => {
this.$refs.dataTable.clearSort()
})
this.getDataList()
},
getDataList() {
const dateStr = this.timeType === 'year'
? this.currentDate.getFullYear().toString()
@@ -143,7 +175,9 @@ export default {
url: http.adornUrl('/master/statisticsBusiness/getCourseSaleInfoByCourseLabel'),
method: 'post',
data: http.adornData({
date: dateStr
date: dateStr,
sortKey: this.dataForm.sortKey,
sortValue: this.dataForm.sortValue
})
}).then(({ data }) => {
if (data && data.code === 0) {