报表功能提交

This commit is contained in:
lizhenhua 2025-09-24 08:48:45 +08:00
parent 4768bdfc93
commit 1e61cf7d13
2 changed files with 71 additions and 13 deletions

View File

@ -160,7 +160,21 @@
</span>
</template>
</el-table-column>
<el-table-column label="支付时间" prop="payTime" align="center" />
<el-table-column label="钱包类型" prop="amount" align="center">
<template slot-scope="scope">
<span v-if="scope.row.walletId === '1'">
个人钱包
</span>
<span v-else-if="scope.row.walletId === '2'">
补贴钱包
</span>
<span v-else-if="scope.row.walletId === '3'">
补贴钱包+个人钱包
</span>
</template>
</el-table-column>
<el-table-column label="下单时间" prop="payTime" align="center" />
<el-table-column label="备注" prop="remark" align="center" />
</el-table>
<!-- 详情分页 -->
@ -276,11 +290,13 @@ export default {
// +
sheet.columns = [
{ header: "所属组织", key: "orgFullName", width: 40 },
{ header: "人员姓名", key: "custName", width: 10 },
{ header: "消费金额", key: "amount", width: 10 },
{ header: "消费类型", key: "flow_type_name", width: 10 },
{ header: "支付时间", key: "payTime", width: 30 },
{ header: "食堂名称", key: "orgFullName", width: 40 },
{ header: "预订餐消费", key: "custName", width: 10 },
{ header: "食堂消费", key: "amount", width: 10 },
{ header: "超市消费", key: "flow_type_name", width: 10 },
{ header: "驿站消费", key: "payTime", width: 30 },
{ header: "消费补扣", key: "payTime", width: 30 },
{ header: "总和", key: "payTime", width: 30 }
];
@ -334,7 +350,7 @@ export default {
const sheet = workbook.addWorksheet("消费详情");
//
const header = ["所属组织", "人员姓名", "消费金额", "消费类型", "支付时间"];
const header = ["所属组织", "人员姓名", "消费金额", "消费类型","钱包类型", "下单时间"];
sheet.addRow(header);
//
@ -355,11 +371,20 @@ export default {
} else if (ft === 130) {
item.amount = Math.abs(item.amount); // 退
}
let wallType = item.walletId || "";
if (wallType ==='1') {
wallType="个人钱包"
}else if(wallType ==='2'){
wallType="补贴钱包"
}else{
wallType="补贴钱包+个人钱包"
}
sheet.addRow([
item.orgFullName || "",
item.custName || "",
item.amount,
flowTypeLabel,
wallType,
item.payTime || ""
]);
});

View File

@ -26,7 +26,7 @@
</el-cascader>
</el-form-item>
<el-form-item label="用户姓名">
<el-input v-model="queryParams.custName" placeholder="请输入组织名称" clearable />
<el-input v-model="queryParams.custName" placeholder="请输入用户姓名" clearable />
</el-form-item>
<el-form-item label="支付开始时间">
<el-date-picker
@ -51,7 +51,14 @@
<el-button type="success" @click="newexportExcel">导出列表</el-button>
</el-form-item>
</el-form>
<!-- 金额汇总信息 -->
<el-card class="summary-card" shadow="never" style="padding: 12px;">
<div style="display: flex; justify-content: space-around; align-items: center; font-weight: bold;">
<div style="color: #F56C6C;">消费总额: {{ (totalConsume / 100).toFixed(2) }} </div>
<div style="color: #67C23A;">退款总额: {{ (totalRefund / 100).toFixed(2) }} </div>
<div style="color: #409EFF;">净收入: {{ ((totalConsume - totalRefund) / 100).toFixed(2) }} </div>
</div>
</el-card>
<!-- 主表格 -->
<el-table
:data="tableData.slice((pageNum-1)*pageSize,pageNum*pageSize)"
@ -168,6 +175,8 @@ export default {
const startOfDay = `${today.getFullYear()}-${String(today.getMonth() + 1).padStart(2, "0")}-${String(today.getDate()).padStart(2,"0")} 00:00:00`;
const endOfDay = `${today.getFullYear()}-${String(today.getMonth() + 1).padStart(2,"0")}-${String(today.getDate()).padStart(2,"0")} 23:59:59`;
return {
totalConsume: 0, //
totalRefund: 0, // 退
selectedOrg: [], //
orgOptions:[],
queryParams: {
@ -259,7 +268,17 @@ export default {
this.queryParams.pageNum = 1;
this.getList();
},
//
calculateTotalAmounts() {
this.totalConsume = 0;
this.totalRefund = 0;
if (this.tableData.length > 0) {
const first = this.tableData[0]; //
this.totalConsume = first.totalConsume; //
this.totalRefund = first.totalRefund; //
}
},
getList() {
this.loading = true;
// orgId
@ -269,14 +288,28 @@ export default {
peoplelistRecord(this.queryParams).then(res => {
this.tableData = res.rows || [];
this.total = Number(res.total) || 0; //
this.calculateTotalAmounts();
this.loading = false;
});
},
/** 导出主表 */
newexportExcel(){
this.queryParams.selectedOrg = this.getSelectedOrgIds(); // id
this.download('/smart-canteen/api/v2/report/consume/exportExcel', { ...this.queryParams }, `人员信息报表_${Date.now()}.xlsx`)
},
newexportExcel() {
// ID
this.queryParams.selectedOrg = this.getSelectedOrgIds();
// encodeURIComponent
const params = { ...this.queryParams };
if (params.custName) {
params.custName = encodeURIComponent(params.custName); //
}
//
this.download(
'/smart-canteen/api/v2/report/consume/exportExcel',
params,
`人员信息报表_${Date.now()}.xlsx`
);
},
handleDetail(row) {
this.detail = row;
this.detailVisible = true;