feat(oa): format money fields in print and related-approval summary
Show formatted amount with optional uppercase on print; summary uses numeric text. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
8e98ffe950
commit
b5c4ba4c4f
2 files changed
+34
No files matched your search
@@ -13,6 +13,8 @@ import {
|
||||
} from '@/utils/oa-approval-print-related'
|
||||
import { formatProgressPersonLines } from '@/utils/oa-progress-person-lines'
|
||||
import { formatDeptDisplay } from '@/utils/oa-dept-value'
|
||||
import { formatMoneyDisplay } from '@/utils/money-format'
|
||||
import { toRmbUpper } from '@/utils/rmb-upper'
|
||||
|
||||
export const OA_PRINT_COMPANY_NAME = '安徽中科兴皖医学研究有限公司'
|
||||
|
||||
@@ -244,6 +246,27 @@ async function walkRules(
|
||||
continue
|
||||
}
|
||||
|
||||
if (type === 'money') {
|
||||
const showUpper = rule.props?.showUpper !== false
|
||||
const n =
|
||||
value == null || value === ''
|
||||
? null
|
||||
: typeof value === 'number'
|
||||
? value
|
||||
: Number(String(value).replace(/,/g, ''))
|
||||
if (n == null || !Number.isFinite(n)) {
|
||||
out.push({ label, text: '-' })
|
||||
continue
|
||||
}
|
||||
const numText = formatMoneyDisplay(n, 2)
|
||||
const upper = showUpper ? toRmbUpper(n) : ''
|
||||
out.push({
|
||||
label,
|
||||
text: upper ? `${numText}(${upper})` : numText
|
||||
})
|
||||
continue
|
||||
}
|
||||
|
||||
if (UPLOAD_TYPES.has(type) || String(rule.name || '').toLowerCase().includes('upload')) {
|
||||
const urls = extractUrls(value)
|
||||
out.push({ label, urls: urls.length ? urls : [], text: urls.length ? undefined : '-' })
|
||||
|
||||
Reference in new issue
Block a user