fix(web-admin): 月度样本总览导出加宽 Excel 列 (#195)
为导出工作表设置列宽,避免样本编号、时间、备注等列挤在一起。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
cf8358a809
commit
ad9f4ae785
1 file changed
+10
-8
@@ -124,14 +124,14 @@
|
||||
const canExport = computed(() => hasMenuPerm('biz:monthlySampleOverview:export'))
|
||||
|
||||
const columns = [
|
||||
{ prop: 'labStorageCode', label: '样本编号', minWidth: 140 },
|
||||
{ prop: 'receptionTime', label: '到库时间', minWidth: 170 },
|
||||
{ prop: 'motherName', label: '产妇姓名', minWidth: 110 },
|
||||
{ prop: 'salesUserName', label: '销售专员', minWidth: 110 },
|
||||
{ prop: 'remark', label: '接收备注', minWidth: 160 },
|
||||
{ prop: 'originalBloodVolumeMl', label: '原血体积/ml', minWidth: 120 },
|
||||
{ prop: 'originalBloodWeightG', label: '原血重量/g', minWidth: 120 },
|
||||
{ prop: 'cordLengthCm', label: '脐带长度/cm', minWidth: 120 }
|
||||
{ prop: 'labStorageCode', label: '样本编号', minWidth: 140, exportWch: 18 },
|
||||
{ prop: 'receptionTime', label: '到库时间', minWidth: 170, exportWch: 20 },
|
||||
{ prop: 'motherName', label: '产妇姓名', minWidth: 110, exportWch: 12 },
|
||||
{ prop: 'salesUserName', label: '销售专员', minWidth: 110, exportWch: 12 },
|
||||
{ prop: 'remark', label: '接收备注', minWidth: 160, exportWch: 36 },
|
||||
{ prop: 'originalBloodVolumeMl', label: '原血体积/ml', minWidth: 120, exportWch: 14 },
|
||||
{ prop: 'originalBloodWeightG', label: '原血重量/g', minWidth: 120, exportWch: 14 },
|
||||
{ prop: 'cordLengthCm', label: '脐带长度/cm', minWidth: 120, exportWch: 14 }
|
||||
] as const
|
||||
|
||||
function currentMonthRange(): [string, string] {
|
||||
@@ -263,6 +263,8 @@
|
||||
}
|
||||
const { headers, sheetRows } = buildExportRows(rows)
|
||||
const sheet = XLSX.utils.json_to_sheet(sheetRows, { header: headers })
|
||||
// 序号 + 业务列:给够可读宽度,避免 Excel 默认挤在一起
|
||||
sheet['!cols'] = [{ wch: 8 }, ...columns.map((c) => ({ wch: c.exportWch }))]
|
||||
const workbook = XLSX.utils.book_new()
|
||||
XLSX.utils.book_append_sheet(workbook, sheet, '月度样本信息总览')
|
||||
const stamp = new Date().toISOString().slice(0, 19).replace(/[:T]/g, '')
|
||||
|
||||
Reference in new issue
Block a user