'20260305修复bug'

This commit is contained in:
zwgczx committed 2026-03-05 17:58:38 +08:00
1 parent 53c1b2c0db
commit 75f293f877
20 files changed
+1167 -1400

No files matched your search

+23 -7
View File
@@ -1,5 +1,11 @@
import localforage from 'localforage'
import { expertList, majorList, serviceList, taskList } from '@/sql'
import {
expertList,
getMajorDictEntries,
getMajorIdAliasMap,
getServiceDictById,
taskList
} from '@/sql'
import { roundTo, sumByNumber, toDecimal } from '@/lib/decimal'
import { toFiniteNumberOrNull } from '@/lib/number'
import { getBenchmarkBudgetByScale, getScaleBudgetFee } from '@/lib/pricingScaleFee'
@@ -73,20 +79,23 @@ const toRowMap = <TRow extends { id: string }>(rows?: TRow[]) => {
}
const getDefaultConsultCategoryFactor = (serviceId: string | number) => {
const service = (serviceList as Record<string, ServiceLite | undefined>)[String(serviceId)]
const service = (getServiceDictById() as Record<string, ServiceLite | undefined>)[String(serviceId)]
return toFiniteNumberOrNull(service?.defCoe)
}
const majorById = new Map(getMajorDictEntries().map(({ id, item }) => [id, item as MajorLite]))
const majorIdAliasMap = getMajorIdAliasMap()
const getDefaultMajorFactorById = (id: string) => {
const major = (majorList as Record<string, MajorLite | undefined>)[id]
const resolvedId = majorById.has(id) ? id : majorIdAliasMap.get(id) || id
const major = majorById.get(resolvedId)
return toFiniteNumberOrNull(major?.defCoe)
}
const getMajorLeafIds = () =>
Object.entries(majorList as Record<string, MajorLite>)
.sort((a, b) => Number(a[0]) - Number(b[0]))
.filter(([, item]) => Boolean(item?.code && item.code.includes('-')))
.map(([id]) => id)
getMajorDictEntries()
.filter(({ item }) => Boolean(item?.code && String(item.code).includes('-')))
.map(({ id }) => id)
const buildDefaultScaleRows = (serviceId: string | number): ScaleRow[] => {
const defaultConsultCategoryFactor = getDefaultConsultCategoryFactor(serviceId)
@@ -104,6 +113,13 @@ const mergeScaleRows = (
rowsFromDb: Array<Partial<ScaleRow> & Pick<ScaleRow, 'id'>> | undefined
): ScaleRow[] => {
const dbValueMap = toRowMap(rowsFromDb)
for (const row of rowsFromDb || []) {
const rowId = String(row.id)
const nextId = majorIdAliasMap.get(rowId)
if (nextId && !dbValueMap.has(nextId)) {
dbValueMap.set(nextId, row as ScaleRow)
}
}
const defaultConsultCategoryFactor = getDefaultConsultCategoryFactor(serviceId)
return buildDefaultScaleRows(serviceId).map(row => {