1
This commit is contained in:
1 parent
0f71fff9ac
commit
cd107604a9
9 files changed
+124
-117
No files matched your search
+22
-31
@@ -124,7 +124,7 @@ interface QuantityMethodRowLike {
|
||||
unit?: unknown
|
||||
quantity?: unknown
|
||||
unitPrice?: unknown
|
||||
budgetFee?: unknown
|
||||
budgetFee?: number|null
|
||||
remark?: unknown
|
||||
}
|
||||
|
||||
@@ -286,12 +286,7 @@ interface ExportContract {
|
||||
reserve: ExportReserve | null
|
||||
}
|
||||
|
||||
interface ExportRichTextCode {
|
||||
richText: Array<{
|
||||
text: string
|
||||
font?: Record<string, unknown>
|
||||
}>
|
||||
}
|
||||
|
||||
|
||||
interface ExportMethod0 {
|
||||
coe: number
|
||||
@@ -314,8 +309,7 @@ interface ExportMethod5 {
|
||||
|
||||
interface ExportAdditionalDetail {
|
||||
id: number
|
||||
code: ExportRichTextCode
|
||||
ref?: ExportRichTextCode
|
||||
ref?: unknown
|
||||
name: string
|
||||
fee: number
|
||||
m0?: ExportMethod0
|
||||
@@ -324,16 +318,14 @@ interface ExportAdditionalDetail {
|
||||
}
|
||||
|
||||
interface ExportAdditional {
|
||||
code: ExportRichTextCode
|
||||
ref?: ExportRichTextCode
|
||||
ref?: unknown
|
||||
name: string
|
||||
fee: number
|
||||
det: ExportAdditionalDetail[]
|
||||
}
|
||||
|
||||
interface ExportReserve {
|
||||
code: ExportRichTextCode
|
||||
ref?: ExportRichTextCode
|
||||
ref?: unknown
|
||||
name: string
|
||||
fee: number
|
||||
m0?: ExportMethod0
|
||||
@@ -1032,7 +1024,7 @@ const buildMethod1 = (rows: ScaleMethodRowLike[] | undefined): ExportMethod1 | n
|
||||
const det = rows
|
||||
.map(row => {
|
||||
const major = toSafeInteger(row.id)
|
||||
if (major == null || row.budgetFee ==null) return null
|
||||
if (major == null || row.budgetFee == null) return null
|
||||
const cost = toFiniteNumber(row.amount)
|
||||
const basicFee = toFiniteNumber(row.budgetFee)
|
||||
if (basicFee != null) hasTotalValue = true
|
||||
@@ -1065,7 +1057,6 @@ const buildMethod1 = (rows: ScaleMethodRowLike[] | undefined): ExportMethod1 | n
|
||||
.filter((item): item is ExportMethod1Detail => Boolean(item))
|
||||
|
||||
if (det.length === 0 || !hasTotalValue) return null
|
||||
console.log(det)
|
||||
return {
|
||||
cost: sumNumbers(det.map(item => item.cost)),
|
||||
basicFee: sumNumbers(det.map(item => item.basicFee)),
|
||||
@@ -1082,7 +1073,7 @@ const buildMethod2 = (rows: ScaleMethodRowLike[] | undefined): ExportMethod2 | n
|
||||
const det = rows
|
||||
.map(row => {
|
||||
const major = toSafeInteger(row.id)
|
||||
if (major == null || row.budgetFee ==null) return null
|
||||
if (major == null || row.budgetFee == null) return null
|
||||
const area = toFiniteNumber(row.landArea)
|
||||
const basicFee = toFiniteNumber(row.budgetFee)
|
||||
if (basicFee != null) hasTotalValue = true
|
||||
@@ -1131,7 +1122,7 @@ const buildMethod3 = (rows: WorkloadMethodRowLike[] | undefined): ExportMethod3
|
||||
const det = rows
|
||||
.map(row => {
|
||||
const task = getTaskIdFromRowId(row.id)
|
||||
if (task == null) return null
|
||||
if (task == null || row.basicFee == null) return null
|
||||
const amount = toFiniteNumber(row.workload)
|
||||
const basicFee = toFiniteNumber(row.basicFee)
|
||||
const fee = toFiniteNumber(row.serviceFee)
|
||||
@@ -1165,7 +1156,7 @@ const buildMethod4 = (rows: HourlyMethodRowLike[] | undefined): ExportMethod4 |
|
||||
const det = rows
|
||||
.map(row => {
|
||||
const expert = getExpertIdFromRowId(row.id)
|
||||
if (expert == null) return null
|
||||
if (expert == null || row.serviceBudget == null) return null
|
||||
const personNum = toFiniteNumber(row.personnelCount)
|
||||
const workDay = toFiniteNumber(row.workdayCount)
|
||||
const fee = toFiniteNumber(row.serviceBudget)
|
||||
@@ -1214,7 +1205,7 @@ const buildServiceFee = (
|
||||
])
|
||||
}
|
||||
|
||||
const createRichTextCode = (...parts: string[]): ExportRichTextCode => ({
|
||||
const createRichTextCode = (...parts: string[]): unknown => ({
|
||||
richText: parts
|
||||
.map(item => String(item || '').trim())
|
||||
.filter(Boolean)
|
||||
@@ -1232,10 +1223,11 @@ const buildMethod0 = (payload: RateMethodRowLike | null | undefined): ExportMeth
|
||||
}
|
||||
|
||||
const buildMethod5 = (rows: QuantityMethodRowLike[] | undefined): ExportMethod5 | null => {
|
||||
console.log(rows)
|
||||
if (!Array.isArray(rows) || rows.length === 0) return null
|
||||
const subtotalRow = rows.find(row => String(row?.id || '') === 'fee-subtotal-fixed')
|
||||
const subtotalFee = toFiniteNumber(subtotalRow?.budgetFee)
|
||||
if (subtotalFee == null) return null
|
||||
if (subtotalFee == null || subtotalRow?.budgetFee == null) return null
|
||||
const det = rows
|
||||
.filter(row => String(row?.id || '') !== 'fee-subtotal-fixed')
|
||||
.map(row => {
|
||||
@@ -1292,6 +1284,8 @@ const loadHtFeeMethodsByRow = async (mainStorageKey: string, rowId: string) => {
|
||||
zxFwPricingStore.loadHtFeeMethodState<DetailRowsStorageLike<QuantityMethodRowLike>>(mainStorageKey, rowId, 'quantity-unit-price-fee')
|
||||
])
|
||||
const m0 = buildMethod0(rateState)
|
||||
|
||||
|
||||
const m4 = buildMethod4(Array.isArray(hourlyState?.detailRows) ? hourlyState?.detailRows : undefined)
|
||||
const m5 = buildMethod5(Array.isArray(quantityState?.detailRows) ? quantityState?.detailRows : undefined)
|
||||
if (!m0 && !m4 && !m5) return null
|
||||
@@ -1303,7 +1297,7 @@ const loadHtFeeMethodsByRow = async (mainStorageKey: string, rowId: string) => {
|
||||
}
|
||||
}
|
||||
|
||||
const buildAdditionalDetailCode = (index: number, name: string): ExportRichTextCode => {
|
||||
const buildAdditionalDetailCode = (index: number, name: string): unknown => {
|
||||
const dictionaryIndex = additionalWorkList.findIndex(item => item === name)
|
||||
const useIndex = dictionaryIndex >= 0 ? dictionaryIndex : index
|
||||
const suffix = useIndex === 0 ? 'F' : useIndex === 1 ? 'X' : String(useIndex + 1)
|
||||
@@ -1323,11 +1317,11 @@ const buildAdditionalExport = async (contractId: string): Promise<ExportAddition
|
||||
if (!methodPayload) return null
|
||||
const item: ExportAdditionalDetail = {
|
||||
id: index,
|
||||
code: buildAdditionalDetailCode(index, row.name),
|
||||
name: row.name || `附加工作-${index + 1}`,
|
||||
ref: { richText: [{ font: { charset: 134, color: { theme: 1 }, italic: true, name: '宋体', size: 10 }, text: 'C' }, { font: { charset: 134, color: { theme: 1 }, italic: true, name: 'Calibri', size: 10, vertAlign: 'subscript' }, text: 'F' }] },
|
||||
|
||||
name: row.name,
|
||||
fee: methodPayload.fee
|
||||
}
|
||||
item.ref = item.code
|
||||
if (methodPayload.m0) item.m0 = methodPayload.m0
|
||||
if (methodPayload.m4) item.m4 = methodPayload.m4
|
||||
if (methodPayload.m5) item.m5 = methodPayload.m5
|
||||
@@ -1337,10 +1331,9 @@ const buildAdditionalExport = async (contractId: string): Promise<ExportAddition
|
||||
).filter((item): item is ExportAdditionalDetail => Boolean(item))
|
||||
|
||||
if (det.length === 0) return null
|
||||
const addtionalCode = createRichTextCode('C', 'C')
|
||||
return {
|
||||
code: addtionalCode,
|
||||
ref: addtionalCode,
|
||||
ref: { richText: [{ font: { charset: 134, color: { theme: 1 }, italic: true, name: '宋体', size: 10 }, text: 'C' }, { font: { charset: 134, color: { theme: 1 }, italic: true, name: 'Calibri', size: 10, vertAlign: 'subscript' }, text: 'C' }] },
|
||||
|
||||
name: '附加工作',
|
||||
fee: sumNumbers(det.map(item => item.fee)),
|
||||
det
|
||||
@@ -1357,11 +1350,9 @@ const buildReserveExport = async (contractId: string): Promise<ExportReserve | n
|
||||
const methodPayload = await loadHtFeeMethodsByRow(storageKey, row.id)
|
||||
if (!methodPayload) continue
|
||||
const reserve: ExportReserve = {
|
||||
code: createRichTextCode('Y', 'B'),
|
||||
name: row.name || '预备费',
|
||||
fee: methodPayload.fee
|
||||
}
|
||||
reserve.ref = reserve.code
|
||||
if (methodPayload.m0) reserve.m0 = methodPayload.m0
|
||||
if (methodPayload.m4) reserve.m4 = methodPayload.m4
|
||||
if (methodPayload.m5) reserve.m5 = methodPayload.m5
|
||||
@@ -1466,11 +1457,11 @@ const buildExportReportPayload = async (): Promise<ExportReportPayload> => {
|
||||
zxFwPricingStore.loadServicePricingMethodState<WorkloadMethodRowLike>(contractId, serviceIdText, 'workload'),
|
||||
zxFwPricingStore.loadServicePricingMethodState<HourlyMethodRowLike>(contractId, serviceIdText, 'hourly')
|
||||
])
|
||||
|
||||
const method1Raw = method1State ? { detailRows: method1State.detailRows } : null
|
||||
const method2Raw = method2State ? { detailRows: method2State.detailRows } : null
|
||||
const method3Raw = method3State ? { detailRows: method3State.detailRows } : null
|
||||
const method4Raw = method4State ? { detailRows: method4State.detailRows } : null
|
||||
|
||||
const method1 = buildMethod1(method1Raw?.detailRows)
|
||||
const method2 = buildMethod2(method2Raw?.detailRows)
|
||||
const method3 = buildMethod3(method3Raw?.detailRows)
|
||||
@@ -1514,7 +1505,7 @@ const buildExportReportPayload = async (): Promise<ExportReportPayload> => {
|
||||
})
|
||||
const contractServiceCoesRaw = buildProjectServiceCoes(htConsultCategoryFactorRaw?.detailRows)
|
||||
const contractMajorCoesRaw = buildProjectMajorCoes(htMajorFactorRaw?.detailRows)
|
||||
|
||||
|
||||
|
||||
contracts.push({
|
||||
name: isNonEmptyString(contract.name) ? contract.name : `合同段-${index + 1}`,
|
||||
|
||||
Reference in new issue
Block a user