✨ 新增应收账单生成预览结果导出

This commit is contained in:
caojia
2026-11-04 10:23:18 +08:00
parent 071a1d7f55
commit 826d95d3c1
3 changed files with 93 additions and 1 deletions
@@ -28,6 +28,7 @@
<div class="preview-toolbar">
<span v-if="previewSearched" class="preview-summary">可选 {{ previewTotal }} 条订单,已选 <b>{{ displaySelectedCount }}</b> 条,应收合计 <b>{{ money(displaySelectedAmount) }}</b></span>
<span v-else class="preview-summary">请选择客户、币种和账单截止日后查询可生成的计费订单</span>
<el-button v-if="previewSearched && previewTotal > 0" :icon="Download" :loading="previewExportLoading" :disabled="previewLoading" @click="exportPreview">导出查询结果</el-button>
<el-button type="primary" plain :loading="previewLoading" :disabled="!bankAccount" @click="queryGeneratePreview">查询</el-button>
</div>
<div v-if="previewSearched" class="preview-selection-toolbar">
@@ -147,7 +148,7 @@
<script setup name="GenerateBillDialog">
import { listArBillGenerateCustomerOptions, getDefaultArBankAccount, previewArBill, previewExcludedArBill, generateArBill } from '@/api/ar/bill'
import { Refresh, Search, Select } from '@element-plus/icons-vue'
import { Download, Refresh, Search, Select } from '@element-plus/icons-vue'
import { AR_BILL_SELECTION_MODE } from '@/constants/ar/enums'
const props = defineProps({
@@ -166,6 +167,7 @@ const dialogOpen = computed({
const billNameOpen = ref(false)
const generateLoading = ref(false)
const previewLoading = ref(false)
const previewExportLoading = ref(false)
const previewSearched = ref(false)
const previewRows = ref([])
const previewTotal = ref(0)
@@ -347,6 +349,15 @@ function handlePreviewPageChange(page) {
fetchPreview()
}
function exportPreview() {
if (!previewSearched.value || !previewTotal.value || !previewQuery.value || previewExportLoading.value) return
previewExportLoading.value = true
proxy.download('/ar/bill/generate/preview/export', { ...previewQuery.value }, `ar_bill_generate_preview_${Date.now()}.xlsx`)
.finally(() => {
previewExportLoading.value = false
})
}
// 当前页变化只更新当前页 ID,selectedRowMap 因此可以跨页保留手动选择。
function handleSelectionChange(rows) {
if (syncingPageSelection || selectionMode.value === AR_BILL_SELECTION_MODE.ALL_MATCHED) return