@@ -32,8 +32,9 @@ const result = ref<ReceivableStatisticsResult | null>(null)
const canView = computed ( ( ) => access . can ( 'platform:finance:receivable-statistics:list' ) )
const canExport = computed ( ( ) => access . can ( 'platform:finance:receivable-statistics:export' ) && access . can ( 'platform:download:list' ) )
const rows = computed < ReceivableStatisticsRow [ ] > ( ( ) => result . value ? . records ? ? [ ] )
const customerNameById = computed ( ( ) => new Map ( customers . value . map ( ( item ) => [ String ( item . id ) , item . tenantName ] ) ) )
const columns : DataTableColumn [ ] = [
{ key : 'customerName' , label : '应收单位' , minWidth : 240 } ,
{ key : 'customerName' , label : '应收单位' , minWidth : 240 , slotName : 'customerName' } ,
{ key : 'currency' , label : '币种' , width : 100 } ,
{ key : 'totalReceivable' , label : '应收总额(CNY)' , width : 180 , slotName : 'totalReceivable' } ,
{ key : 'totalReceived' , label : '已收合计(CNY)' , width : 180 , slotName : 'totalReceived' } ,
@@ -63,6 +64,13 @@ function search() { page.value = 1; void load() }
function reset ( ) { month . value = defaultMonth ; customerId . value = '' ; page . value = 1 ; void load ( ) }
function printCurrent ( ) { window . print ( ) }
function statisticsRowKey ( row : ReceivableStatisticsRow ) { return ` ${ row . customerId } : ${ row . customerName } ` }
function displayCustomerName ( value : unknown ) {
const row = value as ReceivableStatisticsRow
const masterName = customerNameById . value . get ( String ( row . customerId ) ) ? . trim ( )
const snapshot = row . customerName ? . trim ( )
if ( ! snapshot || /^客户\s*\d+$/ . test ( snapshot ) || snapshot === String ( row . customerId ) ) return masterName || '—'
return snapshot
}
async function exportCurrent ( ) {
exporting . value = true
try {
@@ -98,7 +106,7 @@ onMounted(() => { void loadCustomers(); void load() })
< section class = "surface-panel statistics-table" >
< header > < h2 > 应收款明细 < / h2 > < span > 共 { { result ? . totalCustomers ? ? 0 } } 个应收单位 · 仅统计CNY正式应收结算单 < / span > < / header >
< DataTable v -model :page = "page" v -model :page-size = "pageSize" :data = "rows" :columns = "columns" :loading = "loading" : total = "result?.totalCustomers ?? 0" :row-key = "statisticsRowKey" preference -key = " finance -receivable -statistics -table " aria -label = " 应收款统计列表 " empty -text = " 当前月份暂无应收数据 " @ update :page = "load()" @ update : page -size = " page = 1 ; load ( ) " >
< template # totalReceivable = "{ row }" > { { money ( row . totalReceivable ) } } < / template > < template # totalReceived = "{ row }" > { { money ( row . totalReceived ) } } < / template > < template # totalOutstanding = "{ row }" > < span class = "outstanding-cell" > { { money ( row . totalOutstanding ) } } < / span > < / template >
< template # customerName = "{ row }" > { { displayCustomerName ( row ) } } < / template > < template # totalReceivable = "{ row }" > { { money ( row . totalReceivable ) } } < / template > < template # totalReceived = "{ row }" > { { money ( row . totalReceived ) } } < / template > < template # totalOutstanding = "{ row }" > < span class = "outstanding-cell" > { { money ( row . totalOutstanding ) } } < / span > < / template >
< template # pagination -left > 统计月份 : { { result ? . statisticsMonth } } · 币种 : CNY < / template >
< / DataTable >
< / section >