|
|
@@ -59,18 +59,28 @@ const handleExportStatistics = async () => {
|
|
|
const data = await getOtherFilesStatistics({ tenantIds: tenantIds.join(',') })
|
|
|
console.log('getOtherFilesStatistics 返回:', data)
|
|
|
if (data && data.length > 0) {
|
|
|
- // 处理数据,添加已上传档案数
|
|
|
- const processedData = data.map((item: any) => ({
|
|
|
- ...item,
|
|
|
- uploadedOtherFilesCount: item.totalCount - item.emptyOtherFilesCount
|
|
|
- }))
|
|
|
-
|
|
|
+ // 处理数据,添加已上传档案数,并计算已完成占比
|
|
|
+ const processedData = data.map((item: any) => {
|
|
|
+ const totalCount = item.totalCount || 0
|
|
|
+ const emptyOtherFilesCount = item.emptyOtherFilesCount || 0
|
|
|
+ const uploadedOtherFilesCount = totalCount - emptyOtherFilesCount
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ uploadedOtherFilesCount,
|
|
|
+ emptyOtherFilesPercentage: totalCount > 0
|
|
|
+ ? Number(((uploadedOtherFilesCount / totalCount) * 100).toFixed(2))
|
|
|
+ : 0
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ console.log('processedData:', processedData)
|
|
|
+
|
|
|
const headers = [
|
|
|
{ key: 'tenantName', title: '机构名称', width: 45 },
|
|
|
{ key: 'totalCount', title: '长者总数', width: 12 },
|
|
|
{ key: 'uploadedOtherFilesCount', title: '已上传档案数', width: 15 },
|
|
|
{ key: 'emptyOtherFilesCount', title: '未上传档案数', width: 15 },
|
|
|
- { key: 'emptyOtherFilesPercentage', title: '档案为空占比', width: 15 }
|
|
|
+ { key: 'emptyOtherFilesPercentage', title: '档案已完成占比', width: 15 }
|
|
|
]
|
|
|
console.log('准备导出的数据:', processedData)
|
|
|
await exportWithCustomHeaders(processedData, headers, '各院档案及数据完整率.xlsx')
|