修复数据导出不正确

This commit is contained in:
zwgczx committed 2026-04-13 11:24:47 +08:00
1 parent 99684c04f2
commit aed6fe2bfa
8 files changed
+221 -23

No files matched your search

+38 -3
View File
@@ -863,6 +863,10 @@ const getSelectedServiceIdsWithoutFixed = () =>
const ensurePricingDetailRowsForCurrentSelection = async () => {
const serviceIds = getSelectedServiceIdsWithoutFixed()
if (serviceIds.length === 0) return
console.log('[zxfw][ensure-current-selection] ' + JSON.stringify({
contractId: props.contractId,
serviceIds
}))
await ensurePricingMethodDetailRowsForServices({
contractId: props.contractId,
serviceIds,
@@ -875,7 +879,6 @@ const ensurePricingDetailRowsForCurrentSelection = async () => {
* 计价法变更场景统一走这里,最终会触发 applyFixedRowTotals。
*/
const fillPricingTotalsForServiceIds = async (serviceIds: string[]) => {
const currentState = getCurrentContractState()
const targetIds = Array.from(
new Set(
@@ -893,6 +896,21 @@ const fillPricingTotalsForServiceIds = async (serviceIds: string[]) => {
return
}
console.log('[zxfw][fill-pricing-totals][start] ' + JSON.stringify({
contractId: props.contractId,
requestedIds: serviceIds,
targetIds,
currentRows: currentState.detailRows.map(row => ({
id: row.id,
investScale: row.investScale,
landScale: row.landScale,
workload: row.workload,
hourly: row.hourly,
subtotal: row.subtotal,
finalFee: row.finalFee
}))
}))
await ensurePricingMethodDetailRowsForServices({
contractId: props.contractId,
serviceIds: targetIds,
@@ -905,6 +923,15 @@ const fillPricingTotalsForServiceIds = async (serviceIds: string[]) => {
options: PRICING_TOTALS_OPTIONS
})
console.log('[zxfw][fill-pricing-totals][totals] ' + JSON.stringify({
contractId: props.contractId,
targetIds,
totals: targetIds.map(id => ({
serviceId: id,
totals: totalsByServiceId.get(String(id)) || null
}))
}))
const targetSet = new Set(targetIds.map(id => String(id)))
const nextRows = currentState.detailRows.map(row => {
if (isFixedRow(row) || !targetSet.has(String(row.id))) return row
@@ -1014,15 +1041,23 @@ const applySelection = async (codes: string[]) => {
* 服务勾选变化入口:先更新行,再刷新新增服务的计价汇总。
*/
const handleServiceSelectionChange = async (ids: string[]) => {
const prevIds = [...selectedIds.value]
console.log('[zxfw][selection-change][start] ' + JSON.stringify({
contractId: props.contractId,
prevIds,
nextIds: ids
}))
await applySelection(ids)
const nextSelectedIds = getCurrentContractState().selectedIds || []
const nextSelectedSet = new Set(nextSelectedIds)
const addedIds = nextSelectedIds.filter(id => !prevIds.includes(id) && nextSelectedSet.has(id))
console.log('[zxfw][selection-change][after-apply] ' + JSON.stringify({
contractId: props.contractId,
nextSelectedIds,
addedIds
}))
await ensureWorkContentStateForServices(addedIds)
await fillPricingTotalsForServiceIds(addedIds)
await ensurePricingDetailRowsForCurrentSelection()
}
/**