weizong song 7 days ago
parent b7581b11e9
commit 3082e3ac30

@ -2014,12 +2014,9 @@ export default {
},
handleUploadRemove(file, fileList, row) {
//
const index = fileList.findIndex(f => f.uid === file.uid)
if (index !== -1) {
fileList.splice(index, 1)
row.fileList = fileList
}
// Element UI fileList
// fileList splice
row.fileList = fileList.slice()
},
handleGeneralUploadSuccess(response, file, fileList) {
@ -2036,12 +2033,8 @@ export default {
},
handleGeneralUploadRemove(file, fileList) {
//
const index = fileList.findIndex(f => f.uid === file.uid)
if (index !== -1) {
fileList.splice(index, 1)
this.formData.generalFiles = fileList
}
// Element UI fileList
this.formData.generalFiles = fileList.slice()
},
handleUploadError(err, file, fileList) {

@ -271,7 +271,7 @@
:on-remove="(file, fileList) => handleEconomicUploadRemove(fileList, scope.row)"
:on-error="handleUploadError"
multiple
:limit="5"
:limit="99"
>
<el-button size="mini" type="primary" icon="el-icon-upload">上传附件</el-button>
</el-upload>
@ -334,31 +334,101 @@
<i class="el-icon-money" />
申请资金汇总
</div>
<el-row :gutter="16" class="amount-grid">
<el-col v-for="field in fundAmountFields" :key="field.key" :xs="24" :sm="12" :md="8">
<el-form-item :label="field.label">
<el-input
v-model="field.target[field.key]"
:readonly="isViewMode"
inputmode="decimal"
@blur="normalizeAmountField(field.target, field.key)"
/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="16">
<el-col :xs="24" :sm="12">
<el-form-item label="旧项目合同编号">
<el-input v-model="formData.fundApplication.oldProject.contractNumber" :readonly="isViewMode" />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12">
<el-form-item label="固定资产">
<el-checkbox v-model="formData.fundApplication.newProject.hasFixedAssets" :disabled="isViewMode"></el-checkbox>
<el-checkbox v-model="formData.fundApplication.oldProject.hasFixedAssets" :disabled="isViewMode"></el-checkbox>
</el-form-item>
</el-col>
</el-row>
<div class="fund-summary-table-container">
<el-table :data="fundApplicationRows" border class="fund-summary-table" style="width: 100%;">
<el-table-column label="新项目" align="center">
<el-table-column label="项目总额(万元)" width="150" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.newProject.totalAmount" :readonly="isViewMode" inputmode="decimal" @blur="normalizeAmountField(scope.row.newProject, 'totalAmount')" />
</template>
</el-table-column>
<el-table-column label="分年度申请资金(万元)" align="center">
<el-table-column :label="formData.budgetYear || '当年'" width="130" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.newProject.yearCurrent" :readonly="isViewMode" inputmode="decimal" @blur="normalizeAmountField(scope.row.newProject, 'yearCurrent')" />
</template>
</el-table-column>
<el-table-column :label="nextBudgetYearLabel" width="130" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.newProject.yearNext" :readonly="isViewMode" inputmode="decimal" @blur="normalizeAmountField(scope.row.newProject, 'yearNext')" />
</template>
</el-table-column>
</el-table-column>
<el-table-column label="含固定资产(打√)" align="center">
<el-table-column label="是" width="60" align="center">
<template slot-scope="scope">
<el-checkbox
:value="scope.row.newProject.hasFixedAssets === true"
:disabled="isViewMode"
aria-label="新项目包含固定资产"
@change="handleFixedAssetOptionChange(scope.row.newProject, true, $event)"
/>
</template>
</el-table-column>
<el-table-column label="否" width="60" align="center">
<template slot-scope="scope">
<el-checkbox
:value="scope.row.newProject.hasFixedAssets === false"
:disabled="isViewMode"
aria-label="新项目不包含固定资产"
@change="handleFixedAssetOptionChange(scope.row.newProject, false, $event)"
/>
</template>
</el-table-column>
</el-table-column>
</el-table-column>
<el-table-column label="老项目" align="center">
<el-table-column label="合同总额(万元)" width="150" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.oldProject.contractTotal" :readonly="isViewMode" inputmode="decimal" @blur="normalizeAmountField(scope.row.oldProject, 'contractTotal')" />
</template>
</el-table-column>
<el-table-column label="往年累计安排资金(万元)" width="170" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.oldProject.previousYearsTotal" :readonly="isViewMode" inputmode="decimal" @blur="normalizeAmountField(scope.row.oldProject, 'previousYearsTotal')" />
</template>
</el-table-column>
<el-table-column label="上年结余资金(万元)" width="150" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.oldProject.previousYearBalance" :readonly="isViewMode" inputmode="decimal" @blur="normalizeAmountField(scope.row.oldProject, 'previousYearBalance')" />
</template>
</el-table-column>
<el-table-column label="合同或任务书编号" width="180" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.oldProject.contractNumber" :readonly="isViewMode" />
</template>
</el-table-column>
<el-table-column :label="`申请${formData.budgetYear || '当年'}`" width="140" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.oldProject.yearCurrent" :readonly="isViewMode" inputmode="decimal" @blur="normalizeAmountField(scope.row.oldProject, 'yearCurrent')" />
</template>
</el-table-column>
<el-table-column label="含固定资产(打√)" align="center">
<el-table-column label="是" width="60" align="center">
<template slot-scope="scope">
<el-checkbox
:value="scope.row.oldProject.hasFixedAssets === true"
:disabled="isViewMode"
aria-label="老项目包含固定资产"
@change="handleFixedAssetOptionChange(scope.row.oldProject, true, $event)"
/>
</template>
</el-table-column>
<el-table-column label="否" width="60" align="center">
<template slot-scope="scope">
<el-checkbox
:value="scope.row.oldProject.hasFixedAssets === false"
:disabled="isViewMode"
aria-label="老项目不包含固定资产"
@change="handleFixedAssetOptionChange(scope.row.oldProject, false, $event)"
/>
</template>
</el-table-column>
</el-table-column>
</el-table-column>
</el-table>
</div>
<el-alert
v-if="!isNewProjectAmountValid"
title="新项目总额必须等于本年和下年金额合计"
@ -879,7 +949,7 @@ export default {
totalAmount: '0.0000',
yearCurrent: '0.0000',
yearNext: '0.0000',
hasFixedAssets: false
hasFixedAssets: null
},
oldProject: {
contractTotal: '0.0000',
@ -887,7 +957,7 @@ export default {
previousYearBalance: '0.0000',
contractNumber: '',
yearCurrent: '0.0000',
hasFixedAssets: false
hasFixedAssets: null
}
},
summaryPerformanceIndicators: [],
@ -942,17 +1012,13 @@ export default {
.map(item => item.departmentName)
},
fundAmountFields() {
const fund = this.formData.fundApplication
return [
{ label: '新项目总额(万元)', target: fund.newProject, key: 'totalAmount' },
{ label: '新项目本年(万元)', target: fund.newProject, key: 'yearCurrent' },
{ label: '新项目下年(万元)', target: fund.newProject, key: 'yearNext' },
{ label: '旧项目合同总额(万元)', target: fund.oldProject, key: 'contractTotal' },
{ label: '旧项目前年累计(万元)', target: fund.oldProject, key: 'previousYearsTotal' },
{ label: '旧项目前年余额(万元)', target: fund.oldProject, key: 'previousYearBalance' },
{ label: '旧项目本年(万元)', target: fund.oldProject, key: 'yearCurrent' }
]
fundApplicationRows() {
return [this.formData.fundApplication]
},
nextBudgetYearLabel() {
const currentYear = parseInt(this.formData.budgetYear, 10)
return Number.isFinite(currentYear) ? `${currentYear + 1}` : '下一年'
},
currentYearMonthlyTotal() {
@ -1090,7 +1156,9 @@ export default {
submissionDate: submission.submissionDate,
economicItems: submission.economicItems || [],
performanceIndicators: submission.performanceIndicators || [],
implementationSchedule: submission.implementationSchedule || ''
implementationSchedule: submission.implementationSchedule || '',
implementationScheduleDetail: submission.implementationScheduleDetail || {},
fundApplication: submission.fundApplication || {}
})))
//
@ -1103,22 +1171,9 @@ export default {
}
this.formData.executeDepartmentCount = this.formData.departmentSubmissions.length
// 使
if (data.economicSummary && data.economicSummary.length > 0) {
this.$set(this.formData, 'economicSummary', data.economicSummary.map(item => ({
categoryId: item.categoryId,
categoryName: item.categoryName,
totalAmount: item.totalAmount,
departmentCount: item.departmentCount,
summaryCalculationBasis: '', //
fileList: [],
basisList: item.departments ? item.departments.map(dept => ({ department: dept, basis: '' })) : []
})))
} else {
//
this.generateEconomicSummary(this.formData.departmentSubmissions)
}
this.generateEconomicSummary(this.formData.departmentSubmissions)
this.aggregateFundApplication(this.formData.departmentSubmissions)
this.aggregateImplementationScheduleAmounts(this.formData.departmentSubmissions)
}
} catch (error) {
console.error('获取执行科室填报数据失败:', error)
@ -1140,16 +1195,17 @@ export default {
if (economicMap.has(key)) {
const existing = economicMap.get(key)
existing.totalAmount = addMoney(existing.totalAmount, amount)
//
const existingDept = existing.basisList.find(dept => dept.department === submission.departmentName)
if (existingDept) {
existingDept.amount = addMoney(existingDept.amount, amount)
existingDept.basis = item.calculationBasis //
existingDept.basis = [existingDept.basis, item.calculationBasis].filter(Boolean).join('\n')
existingDept.files.push(...this.normalizeFileList(item.files || []))
} else {
existing.basisList.push({
department: submission.departmentName,
amount: amount,
basis: item.calculationBasis
basis: item.calculationBasis,
files: this.normalizeFileList(item.files || [])
})
existing.departmentCount += 1
}
@ -1159,13 +1215,14 @@ export default {
categoryName: item.categoryName,
totalAmount: amount,
departmentCount: 1,
summaryCalculationBasis: '', //
summaryCalculationBasis: '',
fileList: [],
expanded: false, //
basisList: [{
department: submission.departmentName,
amount: amount,
basis: item.calculationBasis
basis: item.calculationBasis,
files: this.normalizeFileList(item.files || [])
}]
})
}
@ -1173,8 +1230,81 @@ export default {
}
})
//
this.$set(this.formData, 'economicSummary', Array.from(economicMap.values()))
const summary = Array.from(economicMap.values()).map(item => ({
...item,
summaryCalculationBasis: item.basisList
.map(detail => `${detail.department}${detail.basis || '-'}`)
.join('\n\n'),
fileList: this.mergeFileLists(...item.basisList.map(detail => detail.files))
}))
this.$set(this.formData, 'economicSummary', summary)
},
aggregateFundApplication(submissions) {
const values = (section, key) => submissions.map(submission => {
const application = submission.fundApplication || {}
const source = application[section] || {}
return source[key] || '0.0000'
})
const fund = this.formData.fundApplication
fund.newProject.totalAmount = sumMoney(values('newProject', 'totalAmount'))
fund.newProject.yearCurrent = sumMoney(values('newProject', 'yearCurrent'))
fund.newProject.yearNext = sumMoney(values('newProject', 'yearNext'))
fund.oldProject.contractTotal = sumMoney(values('oldProject', 'contractTotal'))
fund.oldProject.previousYearsTotal = sumMoney(values('oldProject', 'previousYearsTotal'))
fund.oldProject.previousYearBalance = sumMoney(values('oldProject', 'previousYearBalance'))
fund.oldProject.yearCurrent = sumMoney(values('oldProject', 'yearCurrent'))
//
if (submissions.length === 1) {
const application = submissions[0].fundApplication || {}
const newProject = application.newProject || {}
const oldProject = application.oldProject || {}
fund.newProject.hasFixedAssets = Boolean(newProject.hasFixedAssets)
fund.oldProject.hasFixedAssets = Boolean(oldProject.hasFixedAssets)
}
},
handleFixedAssetOptionChange(project, hasFixedAssets, checked) {
// /
if (checked) {
this.$set(project, 'hasFixedAssets', hasFixedAssets)
}
},
aggregateImplementationScheduleAmounts(submissions) {
const detail = this.formData.implementationScheduleDetail
const values = key => submissions.map(submission =>
(submission.implementationScheduleDetail || {})[key] || '0.0000'
)
detail.currentYearAmount = sumMoney(values('currentYearAmount'))
for (let month = 1; month <= 12; month++) {
const key = `currentYearMonth${month}`
detail[key] = sumMoney(values(key))
}
},
mergeFileLists(...fileLists) {
const seen = new Set()
return fileLists.reduce((files, fileList) => files.concat(fileList || []), []).filter(file => {
const fileId = file.fileId || file.id
if (!fileId || seen.has(fileId)) return false
seen.add(fileId)
return true
})
},
mergeSavedEconomicSummary(savedItems) {
const items = savedItems || []
items.forEach(savedItem => {
const economicItem = this.formData.economicSummary.find(item => item.categoryId === savedItem.categoryId)
if (economicItem) {
this.$set(economicItem, 'summaryCalculationBasis', savedItem.summaryCalculationBasis || savedItem.summary_calculation_basis || '')
if (Object.prototype.hasOwnProperty.call(savedItem, 'files') || Object.prototype.hasOwnProperty.call(savedItem, 'file_list')) {
this.$set(economicItem, 'fileList', this.normalizeFileList(savedItem.files || savedItem.file_list || []))
}
}
})
},
normalizeSummaryMoney(value) {
@ -1249,14 +1379,7 @@ export default {
//
if (data.economicSummary && data.economicSummary.length > 0) {
//
data.economicSummary.forEach(savedItem => {
const economicItem = this.formData.economicSummary.find(item => item.categoryId === savedItem.categoryId)
if (economicItem) {
this.$set(economicItem, 'summaryCalculationBasis', savedItem.summaryCalculationBasis || '')
this.$set(economicItem, 'fileList', this.normalizeFileList(savedItem.files || []))
}
})
this.mergeSavedEconomicSummary(data.economicSummary)
}
// API
@ -1270,16 +1393,7 @@ export default {
// lead_submission
if (apiData.economicSummary && apiData.economicSummary.length > 0) {
apiData.economicSummary.forEach(savedItem => {
const economicItem = this.formData.economicSummary.find(item => item.categoryId === savedItem.categoryId)
if (economicItem && !economicItem.summaryCalculationBasis) {
//
this.$set(economicItem, 'summaryCalculationBasis', savedItem.summaryCalculationBasis || '')
}
if (economicItem) {
this.$set(economicItem, 'fileList', this.normalizeFileList(savedItem.files || []))
}
})
this.mergeSavedEconomicSummary(apiData.economicSummary)
}
// lead_submission
@ -1325,23 +1439,13 @@ export default {
//
if (data.economicSummary && data.economicSummary.length > 0) {
// 使
data.economicSummary.forEach(savedItem => {
const economicItem = this.formData.economicSummary.find(item => item.categoryId === savedItem.categoryId)
if (economicItem) {
this.$set(economicItem, 'summaryCalculationBasis', savedItem.summaryCalculationBasis || '')
this.$set(economicItem, 'fileList', this.normalizeFileList(savedItem.files || []))
}
})
this.mergeSavedEconomicSummary(data.economicSummary)
} else if (data.economic_summary && data.economic_summary.length > 0) {
//
data.economic_summary.forEach(savedItem => {
const economicItem = this.formData.economicSummary.find(item => item.categoryId === savedItem.categoryId)
if (economicItem) {
this.$set(economicItem, 'summaryCalculationBasis', savedItem.summary_calculation_basis || '')
this.$set(economicItem, 'fileList', this.normalizeFileList(savedItem.files || savedItem.file_list || []))
}
})
this.mergeSavedEconomicSummary(data.economic_summary.map(item => ({
...item,
categoryId: item.categoryId || item.category_id,
files: item.files || item.file_list || []
})))
}
} else if (response && !response.errcode) {
//
@ -1363,12 +1467,11 @@ export default {
}
if (data.economic_summary && data.economic_summary.length > 0) {
data.economic_summary.forEach(savedItem => {
const economicItem = this.formData.economicSummary.find(item => item.categoryId === savedItem.categoryId)
if (economicItem) {
this.$set(economicItem, 'summaryCalculationBasis', savedItem.summary_calculation_basis || '')
}
})
this.mergeSavedEconomicSummary(data.economic_summary.map(item => ({
...item,
categoryId: item.categoryId || item.category_id,
files: item.files || item.file_list || []
})))
}
} else if (response && response.errcode) {
//
@ -1845,6 +1948,29 @@ export default {
margin: 15px 0;
}
.fund-summary-table-container {
margin: 15px 0;
overflow-x: auto;
}
.fund-summary-table {
min-width: 1440px;
}
.fund-summary-table >>> .el-table__header th {
background-color: #f5f7fa;
color: #606266;
font-weight: 600;
}
.fund-summary-table >>> .el-table__cell {
padding: 8px 0;
}
.fund-summary-table >>> .el-input__inner {
text-align: right;
}
.economic-table,
.performance-table {
font-size: 14px;

@ -151,7 +151,7 @@
:disabled="!hasChildren(scope.row) && !getLeadSubmission(scope.row)"
@click="openSummarySubmit(scope.row)"
>
{{ getLeadSubmission(scope.row) && getLeadSubmission(scope.row).status !== 'draft' ? '查看汇总' : '汇总提交' }}
{{ summaryActionLabel(scope.row) }}
</el-button>
</div>
@ -436,6 +436,17 @@ export default {
return row.submission || row.lead_submission || null
},
hasStartedLeadSummary(row) {
const submission = this.getLeadSubmission(row)
return Boolean(submission && (submission.summary_started_at || submission.summaryStartedAt))
},
summaryActionLabel(row) {
const submission = this.getLeadSubmission(row)
if (!this.hasStartedLeadSummary(row)) return '汇总提交'
return submission && submission.status === 'draft' ? '修改汇总' : '查看汇总'
},
canAllocate(row) {
const year = row.budget_year || {}
return year.status === 'ACTIVE'
@ -462,12 +473,12 @@ export default {
openSummarySubmit(row) {
//
this.currentSummaryPackage = { ...row }
//
// lead 稿
const submission = this.getLeadSubmission(row)
const isActiveYear = row.budget_year && row.budget_year.status === 'ACTIVE'
this.summaryMode = !isActiveYear
? 'view'
: !submission ? 'create' : submission.status === 'draft' ? 'edit' : 'view'
: !this.hasStartedLeadSummary(row) ? 'create' : submission.status === 'draft' ? 'edit' : 'view'
this.summarySubmitVisible = true
},

@ -0,0 +1,32 @@
jest.mock('@/api/budget/departmentSubmission.js', () => ({}))
import BudgetSubmissionForm from '@/views/budget/collection/components/BudgetSubmissionForm.vue'
describe('BudgetSubmissionForm attachment removal', () => {
const removedFile = { uid: 1, fileId: 101 }
const remainingFile = { uid: 2, fileId: 102 }
it('uses Element UIs post-removal list for economic-item attachments', () => {
const row = { fileList: [removedFile, remainingFile] }
const remainingFiles = [remainingFile]
BudgetSubmissionForm.methods.handleUploadRemove(removedFile, remainingFiles, row)
expect(row.fileList).toEqual([remainingFile])
expect(row.fileList).not.toBe(remainingFiles)
})
it('uses Element UIs post-removal list for general attachments', () => {
const context = {
formData: {
generalFiles: [removedFile, remainingFile]
}
}
const remainingFiles = [remainingFile]
BudgetSubmissionForm.methods.handleGeneralUploadRemove.call(context, removedFile, remainingFiles)
expect(context.formData.generalFiles).toEqual([remainingFile])
expect(context.formData.generalFiles).not.toBe(remainingFiles)
})
})

@ -0,0 +1,135 @@
jest.mock('@/api/budget/leadDepartment.js', () => ({}))
jest.mock('@/views/budget/collection/components/BudgetSubmissionForm.vue', () => ({}))
import LeadDepartmentSummaryForm from '@/views/budget/collection/components/LeadDepartmentSummaryForm.vue'
function createContext() {
const methods = LeadDepartmentSummaryForm.methods
const context = {
formData: {
economicSummary: [],
fundApplication: {
newProject: {},
oldProject: {}
},
implementationScheduleDetail: {}
},
$set(target, key, value) {
target[key] = value
}
}
context.normalizeFileList = methods.normalizeFileList.bind(context)
context.mergeFileLists = methods.mergeFileLists.bind(context)
return context
}
describe('LeadDepartmentSummaryForm automatic aggregation', () => {
const submissions = [
{
departmentName: '监测一科',
economicItems: [{
categoryId: 1,
categoryName: '物业管理费',
amount: '10.0000',
calculationBasis: '10个月 × 1万元',
files: [{ id: 101, name: '一科.pdf' }]
}],
fundApplication: {
newProject: { totalAmount: '3.0000', yearCurrent: '2.0000', yearNext: '1.0000' },
oldProject: { contractTotal: '8.0000', previousYearsTotal: '4.0000', previousYearBalance: '1.0000', yearCurrent: '2.0000' }
},
implementationScheduleDetail: { currentYearAmount: '4.0000', currentYearMonth1: '1.0000', currentYearMonth2: '3.0000' }
},
{
departmentName: '监测二科',
economicItems: [{
categoryId: 1,
categoryName: '物业管理费',
amount: '20.0000',
calculationBasis: '20个月 × 1万元',
files: [{ id: 102, name: '二科.pdf' }]
}],
fundApplication: {
newProject: { totalAmount: '5.0000', yearCurrent: '3.0000', yearNext: '2.0000' },
oldProject: { contractTotal: '12.0000', previousYearsTotal: '6.0000', previousYearBalance: '2.0000', yearCurrent: '4.0000' }
},
implementationScheduleDetail: { currentYearAmount: '6.0000', currentYearMonth1: '2.0000', currentYearMonth2: '4.0000' }
}
]
it('combines economic amounts, department-labelled bases, and every attachment', () => {
const context = createContext()
LeadDepartmentSummaryForm.methods.generateEconomicSummary.call(context, submissions)
expect(context.formData.economicSummary).toEqual([expect.objectContaining({
categoryId: 1,
totalAmount: '30.0000',
departmentCount: 2,
summaryCalculationBasis: '监测一科10个月 × 1万元\n\n监测二科20个月 × 1万元',
fileList: [
expect.objectContaining({ fileId: 101 }),
expect.objectContaining({ fileId: 102 })
]
})])
})
it('adds all seven fund fields and all thirteen schedule amount fields', () => {
const context = createContext()
LeadDepartmentSummaryForm.methods.aggregateFundApplication.call(context, submissions)
LeadDepartmentSummaryForm.methods.aggregateImplementationScheduleAmounts.call(context, submissions)
expect(context.formData.fundApplication).toEqual({
newProject: { totalAmount: '8.0000', yearCurrent: '5.0000', yearNext: '3.0000' },
oldProject: { contractTotal: '20.0000', previousYearsTotal: '10.0000', previousYearBalance: '3.0000', yearCurrent: '6.0000' }
})
expect(context.formData.implementationScheduleDetail.currentYearAmount).toBe('10.0000')
expect(context.formData.implementationScheduleDetail.currentYearMonth1).toBe('3.0000')
expect(context.formData.implementationScheduleDetail.currentYearMonth2).toBe('7.0000')
expect(context.formData.implementationScheduleDetail.currentYearMonth12).toBe('0.0000')
})
it('inherits fixed-asset choices only when there is one department submission', () => {
const context = createContext()
context.formData.fundApplication = {
newProject: { hasFixedAssets: null },
oldProject: { hasFixedAssets: null }
}
LeadDepartmentSummaryForm.methods.aggregateFundApplication.call(context, submissions)
expect(context.formData.fundApplication.newProject.hasFixedAssets).toBeNull()
expect(context.formData.fundApplication.oldProject.hasFixedAssets).toBeNull()
LeadDepartmentSummaryForm.methods.aggregateFundApplication.call(context, [{
fundApplication: {
newProject: { hasFixedAssets: true },
oldProject: { hasFixedAssets: false }
}
}])
expect(context.formData.fundApplication.newProject.hasFixedAssets).toBe(true)
expect(context.formData.fundApplication.oldProject.hasFixedAssets).toBe(false)
})
it('restores saved economic summary content instead of recalculating it in edit mode', () => {
const context = createContext()
context.formData.economicSummary = [{
categoryId: 1,
summaryCalculationBasis: '自动生成的依据',
fileList: [{ fileId: 101, name: '自动附件.pdf' }]
}]
LeadDepartmentSummaryForm.methods.mergeSavedEconomicSummary.call(context, [{
categoryId: 1,
summaryCalculationBasis: '已保存的汇总依据',
files: [{ id: 201, name: '已保存附件.pdf' }]
}])
expect(context.formData.economicSummary[0]).toEqual(expect.objectContaining({
summaryCalculationBasis: '已保存的汇总依据',
fileList: [expect.objectContaining({ fileId: 201 })]
}))
})
})
Loading…
Cancel
Save