✨ 应收账单列表增加筛选导出
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.bms.web.controller.ar;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Date;
|
||||
|
||||
@@ -31,6 +32,7 @@ import com.bms.ar.domain.ArBillLog;
|
||||
import com.bms.ar.domain.vo.ArBillActionRequest;
|
||||
import com.bms.ar.domain.vo.ArBillGenerateQuery;
|
||||
import com.bms.ar.domain.vo.ArBillGenerateRequest;
|
||||
import com.bms.ar.domain.vo.ArBillListExportRow;
|
||||
import com.bms.ar.domain.vo.ArBillQuery;
|
||||
import com.bms.ar.service.IArBillService;
|
||||
import com.bms.common.annotation.Log;
|
||||
@@ -40,6 +42,7 @@ import com.bms.common.core.page.TableDataInfo;
|
||||
import com.bms.common.exception.ServiceException;
|
||||
import com.bms.common.enums.BusinessType;
|
||||
import com.bms.common.utils.StringUtils;
|
||||
import com.bms.common.utils.poi.ExcelUtil;
|
||||
import com.bms.common.utils.uuid.IdUtils;
|
||||
import com.bms.price.domain.PrcOrderBill;
|
||||
|
||||
@@ -78,6 +81,23 @@ public class ArBillController extends BaseController {
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 按当前筛选条件导出全部应收账单,不受列表分页参数影响。
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ar:bill:export')")
|
||||
@Log(title = "应收账单", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, ArBillQuery query, HttpServletRequest request) {
|
||||
rejectMultiValueParameter(request, "customerId");
|
||||
List<ArBill> bills = billService.selectArBillList(query == null ? new ArBillQuery() : query);
|
||||
List<ArBillListExportRow> rows = new ArrayList<>(bills.size());
|
||||
for (ArBill bill : bills) {
|
||||
rows.add(ArBillListExportRow.from(bill));
|
||||
}
|
||||
ExcelUtil<ArBillListExportRow> util = new ExcelUtil<>(ArBillListExportRow.class);
|
||||
util.exportExcel(response, rows, "应收账单");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询账单头信息;账单明细通过独立分页接口按需加载。
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.bms.ar.domain.vo;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.bms.ar.domain.ArBill;
|
||||
import com.bms.ar.enums.ArBillStatus;
|
||||
import com.bms.common.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
/** 应收账单列表 Excel 导出行。 */
|
||||
@Data
|
||||
public class ArBillListExportRow implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Excel(name = "账单号", sort = 0, width = 22)
|
||||
private String billNo;
|
||||
|
||||
@Excel(name = "账单名称", sort = 1, width = 24)
|
||||
private String billName;
|
||||
|
||||
@Excel(name = "客户名称", sort = 2, width = 24)
|
||||
private String customerName;
|
||||
|
||||
@Excel(name = "客户编码", sort = 3, width = 16)
|
||||
private String customerCode;
|
||||
|
||||
@Excel(name = "账单截止日", sort = 4, dateFormat = "yyyy-MM-dd", width = 16)
|
||||
private Date billPeriodEnd;
|
||||
|
||||
@Excel(name = "订单数", sort = 5, width = 12)
|
||||
private Integer orderCount;
|
||||
|
||||
@Excel(name = "应收总额", sort = 6, scale = 2, width = 16)
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
@Excel(name = "已核销", sort = 7, scale = 2, width = 16)
|
||||
private BigDecimal writtenOffAmount;
|
||||
|
||||
@Excel(name = "未核销", sort = 8, scale = 2, width = 16)
|
||||
private BigDecimal unwrittenAmount;
|
||||
|
||||
@Excel(name = "状态", sort = 9, width = 14)
|
||||
private String status;
|
||||
|
||||
@Excel(name = "账单日期", sort = 10, dateFormat = "yyyy-MM-dd", width = 16)
|
||||
private Date billDate;
|
||||
|
||||
public static ArBillListExportRow from(ArBill bill) {
|
||||
ArBillListExportRow row = new ArBillListExportRow();
|
||||
row.setBillNo(bill.getBillNo());
|
||||
row.setBillName(bill.getBillName());
|
||||
row.setCustomerName(bill.getCustomerName());
|
||||
row.setCustomerCode(bill.getCustomerCode());
|
||||
row.setBillPeriodEnd(bill.getBillPeriodEnd());
|
||||
row.setOrderCount(bill.getOrderCount());
|
||||
row.setTotalAmount(bill.getTotalAmount());
|
||||
row.setWrittenOffAmount(bill.getWrittenOffAmount());
|
||||
row.setUnwrittenAmount(bill.getUnwrittenAmount());
|
||||
ArBillStatus billStatus = ArBillStatus.of(bill.getStatus());
|
||||
row.setStatus(billStatus == null ? bill.getStatus() : billStatus.getLabel());
|
||||
row.setBillDate(bill.getBillDate());
|
||||
return row;
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,9 @@
|
||||
<el-col :span="1.5"><el-button type="primary" plain icon="Plus" v-hasPermi="['ar:bill:generate']" @click="generateOpen = true">生成账单</el-button></el-col>
|
||||
<el-col v-if="customerScoped" :span="1.5"><el-button type="info" plain icon="Close" @click="clearCustomerFilter">清除客户条件</el-button></el-col>
|
||||
</template>
|
||||
<template #search-extra>
|
||||
<el-button type="warning" plain icon="Download" v-hasPermi="['ar:bill:export']" @click="handleExport">导出</el-button>
|
||||
</template>
|
||||
<template #search-customerId="{ model }">
|
||||
<customer-select v-model="model.customerId" placeholder="请输入客户名称或代码搜索" :remote-search="true" :page-size="20" />
|
||||
</template>
|
||||
@@ -159,7 +162,22 @@ const searchColumns = [
|
||||
]
|
||||
|
||||
// 将页面日期范围转换为后端查询字段,其他筛选条件原样透传。
|
||||
function queryList(params) { const query = { ...params }; if (query.billDateRange?.length === 2) { query.billDateStart = query.billDateRange[0]; query.billDateEnd = query.billDateRange[1] }; delete query.billDateRange; return listArBill(query) }
|
||||
function normalizeBillQuery(params) {
|
||||
const query = { ...params }
|
||||
if (query.billDateRange?.length === 2) {
|
||||
query.billDateStart = query.billDateRange[0]
|
||||
query.billDateEnd = query.billDateRange[1]
|
||||
}
|
||||
delete query.billDateRange
|
||||
return query
|
||||
}
|
||||
function queryList(params) { return listArBill(normalizeBillQuery(params)) }
|
||||
function handleExport() {
|
||||
const query = normalizeBillQuery(tableRef.value?.getQueryParams() || defaultSearchParams.value)
|
||||
delete query.pageNum
|
||||
delete query.pageSize
|
||||
proxy.download('/ar/bill/export', query, `ar_bill_${Date.now()}.xlsx`)
|
||||
}
|
||||
// 生成弹窗只提交任务,账单明细由后台异步批量写入;这里负责刷新列表并开始轮询。
|
||||
function handleGenerateSuccess(task) {
|
||||
tableRef.value?.refresh()
|
||||
|
||||
Reference in New Issue
Block a user