| | |
| | | 模板名称: 'templateName', |
| | | 产品类别: 'productCategory', |
| | | 产品名称: 'productCategory', |
| | | 规格型号: 'specificationModel', |
| | | 规格型号: 'specificationModel', |
| | | 单位: 'unit', |
| | | 税率: 'taxRate', |
| | | 含税单价: 'taxInclusiveUnitPrice', |
| | |
| | | const bytes = Number(size) |
| | | if (!Number.isFinite(bytes) || bytes <= 0) return '0 B' |
| | | if (bytes < 1024) return `${bytes} B` |
| | | if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1).replace(/\.0$/, '')} KB` |
| | | return `${(bytes / (1024 * 1024)).toFixed(1).replace(/\.0$/, '')} MB` |
| | | if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(4).replace(/\.0$/, '')} KB` |
| | | return `${(bytes / (1024 * 1024)).toFixed(4).replace(/\.0$/, '')} MB` |
| | | } |
| | | |
| | | const createLocalFileSnapshot = (file, index = 0) => { |
| | |
| | | const formatCompactNumber = (value) => { |
| | | const amount = Number(value) || 0 |
| | | if (Math.abs(amount) >= 10000) { |
| | | return `${(amount / 10000).toFixed(2).replace(/\.?0+$/, '')}\u4e07` |
| | | return `${(amount / 10000).toFixed(4).replace(/\.?0+$/, '')}\u4e07` |
| | | } |
| | | return amount.toLocaleString('zh-CN', { maximumFractionDigits: 2 }) |
| | | } |