This commit is contained in:
zwgczx committed 2026-02-27 18:25:19 +08:00
1 parent 9849801e46
commit e97707ac59
6 files changed
+153 -59

No files matched your search

@@ -5,7 +5,7 @@ import type { ColDef } from 'ag-grid-community'
import localforage from 'localforage'
import { getBasicFeeFromScale, majorList, serviceList } from '@/sql'
import { myTheme, gridOptions } from '@/lib/diyAgGridOptions'
import { addNumbers, decimalAggSum, sumByNumber } from '@/lib/decimal'
import { addNumbers, decimalAggSum, roundTo, sumByNumber, toDecimal } from '@/lib/decimal'
import { usePricingPaneReloadStore } from '@/pinia/pricingPaneReload'
import { AG_GRID_LOCALE_CN } from '@ag-grid-community/locale';
@@ -234,18 +234,18 @@ const formatMajorFactor = (params: any) => {
const formatReadonlyNumber = (params: any) => {
if (params.value == null || params.value === '') return ''
return Number(params.value).toFixed(2)
return roundTo(params.value, 2).toFixed(2)
}
const getBenchmarkBudgetByAmount = (row?: Pick<DetailRow, 'amount'>) => {
const result = getBasicFeeFromScale(row?.amount, 'cost')
return result ? addNumbers(result.basic, result.optional) : null
return result ? roundTo(addNumbers(result.basic, result.optional), 2) : null
}
const getBudgetFee = (row?: Pick<DetailRow, 'amount' | 'majorFactor' | 'consultCategoryFactor'>) => {
const benchmarkBudget = getBenchmarkBudgetByAmount(row)
if (benchmarkBudget == null || row?.majorFactor == null || row?.consultCategoryFactor == null) return null
return benchmarkBudget * row.majorFactor * row.consultCategoryFactor
return roundTo(toDecimal(benchmarkBudget).mul(row.majorFactor).mul(row.consultCategoryFactor), 2)
}
const columnDefs: ColDef<DetailRow>[] = [