From 7af6dcfd84db10b8441b014ce681f3f7368c042c Mon Sep 17 00:00:00 2001 From: yufei0306 <13417315+yufei0306@user.noreply.gitee.com> Date: Mon, 6 May 2024 14:38:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=9A=E8=AE=A1=E9=87=91=E9=A2=9D=E5=B1=95?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/formatter.ts | 11 +++++++++++ .../supplierinvoiceRequestMain.data.ts | 13 +++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/utils/formatter.ts b/src/utils/formatter.ts index 7c6e39ffa..600e0b724 100644 --- a/src/utils/formatter.ts +++ b/src/utils/formatter.ts @@ -10,3 +10,14 @@ export const fenToYuanFormat = ( ) => { return `¥${fenToYuan(cellValue)}` } +export const accountantFormart = (row, column, cellValue) => { + cellValue = cellValue + '' || '' + let x = cellValue.split('.') + let x1 = x[0] + let x2 = x.length > 1 ? '.' + x[1] : '' + const reg = /(\d+)(\d{3})/ + while(reg.test(x1)){ + x1 = x1.replace(reg, '$1,$2') + } + return x1+x2 +} diff --git a/src/views/wms/supplierManage/supplierinvoice/supplierinvoiceRequestMain/supplierinvoiceRequestMain.data.ts b/src/views/wms/supplierManage/supplierinvoice/supplierinvoiceRequestMain/supplierinvoiceRequestMain.data.ts index 5b5a7fcdf..07a6764ca 100644 --- a/src/views/wms/supplierManage/supplierinvoice/supplierinvoiceRequestMain/supplierinvoiceRequestMain.data.ts +++ b/src/views/wms/supplierManage/supplierinvoice/supplierinvoiceRequestMain/supplierinvoiceRequestMain.data.ts @@ -1,5 +1,7 @@ import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' +import { accountantFormart } from '@/utils/formatter' + import * as SupplierApi from '@/api/wms/supplier' import { Supplier } from '@/views/wms/basicDataManage/supplierManage/supplier/supplier.data' const { t } = useI18n() // 国际化 @@ -152,6 +154,7 @@ export const SupplierinvoiceRequestMain = useCrudSchemas(reactive( { label: '金额', field: 'amount', + formatter: accountantFormart, table: { width: 150 }, @@ -183,6 +186,7 @@ export const SupplierinvoiceRequestMain = useCrudSchemas(reactive( { label: '税额', field: 'taxAmount', + formatter: accountantFormart, table: { width: 150 }, @@ -203,6 +207,7 @@ export const SupplierinvoiceRequestMain = useCrudSchemas(reactive( { label: '税后金额', field: 'afterTaxAmount', + formatter: accountantFormart, table: { width: 150 }, @@ -224,6 +229,7 @@ export const SupplierinvoiceRequestMain = useCrudSchemas(reactive( { label: '索赔金额', field: 'claimAmount', + formatter: accountantFormart, table: { width: 150 }, @@ -247,6 +253,7 @@ export const SupplierinvoiceRequestMain = useCrudSchemas(reactive( { label: '折扣金额', field: 'discountAmount', + formatter: accountantFormart, table: { width: 150 }, @@ -283,6 +290,7 @@ export const SupplierinvoiceRequestMain = useCrudSchemas(reactive( { label: '总差额', field: 'totalDifference', + formatter: accountantFormart, table: { width: 150 }, @@ -820,6 +828,7 @@ export const SupplierinvoiceRequestDetail = useCrudSchemas(reactive