zhou zhou
2 天以前 7c2bffa1a495cc4a3a263f654c08c231009c5c4e
rsf-design/src/components/biz/list-export-print/list-print-document.js
@@ -1,3 +1,5 @@
import { $t } from '@/locales'
function escapeHtml(value) {
  return String(value ?? '')
    .replaceAll('&', '&')
@@ -35,10 +37,10 @@
function getMetaItems(meta = {}) {
  return [
    { key: 'reportDate', label: '报表日期', value: meta.reportDate ?? '--' },
    { key: 'operator', label: '打印人', value: meta.operator ?? '--' },
    { key: 'printedAt', label: '打印时间', value: meta.printedAt ?? '--' },
    { key: 'count', label: '记录数', value: meta.count ?? '--' }
    { key: 'reportDate', label: $t('print.reportDate'), value: meta.reportDate ?? '--' },
    { key: 'operator', label: $t('print.operator'), value: meta.operator ?? '--' },
    { key: 'printedAt', label: $t('print.printedAt'), value: meta.printedAt ?? '--' },
    { key: 'count', label: $t('print.count'), value: meta.count ?? '--' }
  ]
}
@@ -58,9 +60,9 @@
  return alignMap[column.align] ?? alignMap.left
}
export function buildPrintDocumentHtml({ title = '报表', meta = {}, rows = [], columns = [] } = {}) {
export function buildPrintDocumentHtml({ title = '', meta = {}, rows = [], columns = [] } = {}) {
  const reportStyle = getReportStyle(meta)
  const reportTitle = meta.reportTitle || title
  const reportTitle = meta.reportTitle || title || $t('print.defaultReportTitle')
  const titleClass = `${getTitleAlignClass(reportStyle.titleAlign)} ${getTitleLevelClass(reportStyle.titleLevel)}`
  const orientation = getPageOrientation(reportStyle)
  const showBorder = reportStyle.showBorder !== false
@@ -88,7 +90,7 @@
            return `<tr>${cells}</tr>`
          })
          .join('')
      : `<tr><td colspan="${Math.max(columns.length, 1)}" class="empty-cell">暂无打印数据</td></tr>`
      : `<tr><td colspan="${Math.max(columns.length, 1)}" class="empty-cell">${escapeHtml($t('print.noData'))}</td></tr>`
  const metaHtml = metaItems
    .map(