|
|
|
|
@ -251,6 +251,33 @@
|
|
|
|
|
<div v-else style="word-break: break-all;">{{ scope.row.summaryCalculationBasis || '-' }}</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
|
|
<el-table-column label="附件" min-width="240">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-upload
|
|
|
|
|
v-if="!isViewMode"
|
|
|
|
|
:action="uploadAction"
|
|
|
|
|
:headers="uploadHeaders"
|
|
|
|
|
:file-list="scope.row.files || []"
|
|
|
|
|
:on-success="(response, file, fileList) => handleEconomicUploadSuccess(response, file, fileList, scope.row)"
|
|
|
|
|
:on-remove="(file, fileList) => handleEconomicUploadRemove(file, fileList, scope.row)"
|
|
|
|
|
:on-error="handleUploadError"
|
|
|
|
|
multiple
|
|
|
|
|
:limit="10"
|
|
|
|
|
accept=".pdf,.doc,.docx,.xls,.xlsx,.jpg,.jpeg,.png"
|
|
|
|
|
>
|
|
|
|
|
<el-button size="mini" type="primary" icon="el-icon-upload">上传</el-button>
|
|
|
|
|
</el-upload>
|
|
|
|
|
<div v-if="scope.row.files && scope.row.files.length" style="margin-top: 6px;">
|
|
|
|
|
<div v-for="file in scope.row.files" :key="file.id || file.uid" style="margin-bottom: 4px;">
|
|
|
|
|
<el-link type="primary" :href="file.url" target="_blank">
|
|
|
|
|
<i class="el-icon-paperclip"></i>{{ file.name || file.original_name }}
|
|
|
|
|
</el-link>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<span v-else-if="isViewMode" style="color: #909399;">-</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
|
|
<!-- 明细数据展示区域 -->
|
|
|
|
|
@ -282,6 +309,18 @@
|
|
|
|
|
<div class="detail-basis">{{ scope.row.basis || '-' }}</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="附件" min-width="220">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<div v-if="scope.row.files && scope.row.files.length">
|
|
|
|
|
<div v-for="file in scope.row.files" :key="file.id" style="margin-bottom: 4px;">
|
|
|
|
|
<el-link type="primary" :href="file.url" target="_blank">
|
|
|
|
|
<i class="el-icon-paperclip"></i>{{ file.name || file.original_name }}
|
|
|
|
|
</el-link>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<span v-else style="color: #909399;">-</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
</div>
|
|
|
|
|
</el-collapse-transition>
|
|
|
|
|
@ -594,6 +633,37 @@
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="form-section">
|
|
|
|
|
<div class="section-title">
|
|
|
|
|
<i class="el-icon-folder-opened"></i>
|
|
|
|
|
牵头科室汇总附件
|
|
|
|
|
<span style="margin-left: 20px; color: #666; font-size: 12px; font-weight: normal;">
|
|
|
|
|
初次汇总自动带入执行科室通用附件;删除仅移除汇总引用,不影响原始填报
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
<el-upload
|
|
|
|
|
v-if="!isViewMode"
|
|
|
|
|
:action="uploadAction"
|
|
|
|
|
:headers="uploadHeaders"
|
|
|
|
|
:file-list="formData.generalFiles"
|
|
|
|
|
:on-success="handleGeneralUploadSuccess"
|
|
|
|
|
:on-remove="handleGeneralUploadRemove"
|
|
|
|
|
:on-error="handleUploadError"
|
|
|
|
|
multiple
|
|
|
|
|
:limit="10"
|
|
|
|
|
accept=".pdf,.doc,.docx,.xls,.xlsx,.jpg,.jpeg,.png"
|
|
|
|
|
>
|
|
|
|
|
<el-button size="small" type="primary" icon="el-icon-upload">上传汇总附件</el-button>
|
|
|
|
|
<div slot="tip" class="el-upload__tip">该处仅维护通用汇总附件;分类附件请在经济分类表最后一列维护。</div>
|
|
|
|
|
</el-upload>
|
|
|
|
|
<div v-else-if="formData.generalFiles.length">
|
|
|
|
|
<div v-for="file in formData.generalFiles" :key="file.id || file.uid" style="margin-bottom: 6px;">
|
|
|
|
|
<el-link type="primary" :href="file.url" target="_blank">{{ file.name || file.original_name }}</el-link>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<span v-else style="color: #909399;">暂无通用汇总附件</span>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
|
|
<!-- 临时调试信息 -->
|
|
|
|
|
@ -691,7 +761,7 @@
|
|
|
|
|
<budget-submission-form
|
|
|
|
|
:package-data="currentDepartmentDetail"
|
|
|
|
|
mode="view"
|
|
|
|
|
:show-application-info="false"
|
|
|
|
|
:show-application-info="true"
|
|
|
|
|
@cancel="closeDrawerSafely"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
@ -703,6 +773,7 @@
|
|
|
|
|
<script>
|
|
|
|
|
import BudgetSubmissionForm from './BudgetSubmissionForm.vue'
|
|
|
|
|
import { getDepartmentSubmissionsSummary, getLeadDepartmentSummary } from '@/api/budget/leadDepartment.js'
|
|
|
|
|
import { getPackageDecomposition } from '@/api/budget/departmentSubmission.js'
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: 'LeadDepartmentSummaryForm',
|
|
|
|
|
@ -737,12 +808,17 @@ export default {
|
|
|
|
|
economicSummary: [],
|
|
|
|
|
implementationSchedule: '',
|
|
|
|
|
summaryPerformanceIndicators: [],
|
|
|
|
|
otherNotes: ''
|
|
|
|
|
otherNotes: '',
|
|
|
|
|
generalFiles: []
|
|
|
|
|
},
|
|
|
|
|
departmentDetailVisible: false,
|
|
|
|
|
currentDepartmentDetail: null,
|
|
|
|
|
dynamicZIndex: 3000, // 动态z-index管理
|
|
|
|
|
selectedDepartmentIndicators: [], // 选中的执行科室指标
|
|
|
|
|
uploadAction: process.env.VUE_APP_UPLOAD_API || '/api/upload',
|
|
|
|
|
uploadHeaders: {
|
|
|
|
|
'Authorization': 'Bearer ' + (this.$store.state.user.token || localStorage.getItem('token') || '')
|
|
|
|
|
},
|
|
|
|
|
formRules: {
|
|
|
|
|
applicationBasis: [
|
|
|
|
|
{ required: false, message: '请填写申请依据汇总', trigger: 'blur' }
|
|
|
|
|
@ -880,8 +956,11 @@ export default {
|
|
|
|
|
|
|
|
|
|
async initFormData() {
|
|
|
|
|
this.formData.packageId = this.packageData.id
|
|
|
|
|
this.formData.leadDepartmentName = this.packageData.lead_department ? this.packageData.lead_department.name : ''
|
|
|
|
|
this.formData.budgetYear = this.packageData.budget_year ? this.packageData.budget_year.year + '年' : ''
|
|
|
|
|
// 当前接口统一返回 department / budgetYear;保留旧字段兼容历史响应。
|
|
|
|
|
const responsibleDepartment = this.packageData.department || this.packageData.lead_department
|
|
|
|
|
const budgetYear = this.packageData.budget_year || this.packageData.budgetYear
|
|
|
|
|
this.formData.leadDepartmentName = responsibleDepartment ? responsibleDepartment.name : ''
|
|
|
|
|
this.formData.budgetYear = budgetYear ? budgetYear.year + '年' : ''
|
|
|
|
|
this.formData.packageName = this.packageData.name || ''
|
|
|
|
|
this.formData.totalAmount = this.packageData.allocated_amount || 0
|
|
|
|
|
|
|
|
|
|
@ -898,10 +977,11 @@ export default {
|
|
|
|
|
async loadDepartmentSubmissions() {
|
|
|
|
|
try {
|
|
|
|
|
const response = await getDepartmentSubmissionsSummary(this.formData.packageId)
|
|
|
|
|
// request 拦截器已经返回 res.data;同时保留兼容未解包响应的能力。
|
|
|
|
|
const data = response && response.success && response.data ? response.data : response
|
|
|
|
|
|
|
|
|
|
// 处理新的响应格式
|
|
|
|
|
if (response && response.success && response.data) {
|
|
|
|
|
const data = response.data
|
|
|
|
|
// 汇总接口返回 packageInfo、submissions、economicSummary。
|
|
|
|
|
if (data && data.packageInfo && Array.isArray(data.submissions)) {
|
|
|
|
|
|
|
|
|
|
// 更新基本信息,也作为申请信息字段的备用数据源
|
|
|
|
|
if (data.packageInfo) {
|
|
|
|
|
@ -924,7 +1004,7 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 处理执行科室填报数据
|
|
|
|
|
this.$set(this.formData, 'departmentSubmissions', (data.submission || []).map(submission => ({
|
|
|
|
|
this.$set(this.formData, 'departmentSubmissions', data.submissions.map(submission => ({
|
|
|
|
|
id: submission.id,
|
|
|
|
|
departmentName: submission.departmentName,
|
|
|
|
|
allocatedAmount: submission.allocatedAmount,
|
|
|
|
|
@ -932,9 +1012,20 @@ export default {
|
|
|
|
|
submissionDate: submission.submissionDate,
|
|
|
|
|
economicItems: submission.economicItems || [],
|
|
|
|
|
performanceIndicators: submission.performanceIndicators || [],
|
|
|
|
|
implementationSchedule: submission.implementationSchedule || ''
|
|
|
|
|
implementationSchedule: submission.implementationSchedule || '',
|
|
|
|
|
otherNotes: submission.otherNotes || '',
|
|
|
|
|
generalFiles: submission.generalFiles || []
|
|
|
|
|
})))
|
|
|
|
|
|
|
|
|
|
// 新建汇总时,先按执行科室维度自动带入原始内容,牵头科室仍可编辑为最终口径。
|
|
|
|
|
if (!this.formData.implementationSchedule) {
|
|
|
|
|
this.formData.implementationSchedule = this.buildDepartmentTextSummary('implementationSchedule')
|
|
|
|
|
}
|
|
|
|
|
if (!this.formData.otherNotes) {
|
|
|
|
|
this.formData.otherNotes = this.buildDepartmentTextSummary('otherNotes')
|
|
|
|
|
}
|
|
|
|
|
this.initializeGeneralSummaryFiles()
|
|
|
|
|
|
|
|
|
|
// 检查并提示缺少绩效指标数据
|
|
|
|
|
const hasAnyIndicators = this.formData.departmentSubmissions.some(sub =>
|
|
|
|
|
sub.performanceIndicators && sub.performanceIndicators.length > 0
|
|
|
|
|
@ -953,114 +1044,27 @@ export default {
|
|
|
|
|
categoryName: item.categoryName,
|
|
|
|
|
totalAmount: item.totalAmount,
|
|
|
|
|
departmentCount: item.departmentCount,
|
|
|
|
|
summaryCalculationBasis: '', // 默认为空,需要用户填写
|
|
|
|
|
basisList: item.departments ? item.departments.map(dept => ({ department: dept, basis: '' })) : []
|
|
|
|
|
basisList: item.details || (item.departments || []).map(dept => ({ department: dept, basis: '' })),
|
|
|
|
|
files: this.collectEconomicFiles(item.details || []),
|
|
|
|
|
summaryCalculationBasis: this.buildEconomicCalculationBasis(item.details || [])
|
|
|
|
|
})))
|
|
|
|
|
} else {
|
|
|
|
|
// 自动生成经济分类汇总(向后兼容)
|
|
|
|
|
this.generateEconomicSummary(this.formData.departmentSubmissions)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else if (response && response.code !== 0) {
|
|
|
|
|
this.$message.error(response.msg || '获取执行科室填报数据失败')
|
|
|
|
|
this.loadMockData()
|
|
|
|
|
} else {
|
|
|
|
|
// 处理老格式的响应(向后兼容)
|
|
|
|
|
this.$set(this.formData, 'departmentSubmissions', (response.submission || []).map(submission => ({
|
|
|
|
|
...submission,
|
|
|
|
|
performanceIndicators: submission.performanceIndicators || [],
|
|
|
|
|
economicItems: submission.economicItems || [],
|
|
|
|
|
implementationSchedule: submission.implementationSchedule || ''
|
|
|
|
|
})))
|
|
|
|
|
this.formData.executeDepartmentCount = response.submission ? response.submission.length : 0
|
|
|
|
|
this.generateEconomicSummary(this.formData.departmentSubmissions)
|
|
|
|
|
throw new Error((data && data.msg) || '汇总接口返回格式不正确')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('获取执行科室填报数据失败:', error)
|
|
|
|
|
|
|
|
|
|
// 检查是否是404错误,提供更具体的提示
|
|
|
|
|
if (error.response && error.response.status === 404) {
|
|
|
|
|
this.$message.error('后端汇总数据接口尚未实现,请确保以下接口已配置:GET /api/admin/budget-collection-packages/{id}/department-submissions-summary')
|
|
|
|
|
this.loadMockData()
|
|
|
|
|
} else {
|
|
|
|
|
this.$message.warning('获取执行科室填报数据失败,使用模拟数据进行演示')
|
|
|
|
|
this.loadMockData()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
loadMockData() {
|
|
|
|
|
// 模拟数据用于演示
|
|
|
|
|
const mockData = {
|
|
|
|
|
submission: [
|
|
|
|
|
{
|
|
|
|
|
id: 1,
|
|
|
|
|
departmentName: '内科',
|
|
|
|
|
allocatedAmount: 50.0000,
|
|
|
|
|
status: 'submitted',
|
|
|
|
|
submissionDate: '2024-01-15 10:30:00',
|
|
|
|
|
economicItems: [
|
|
|
|
|
{ categoryId: 1, categoryName: '办公费', amount: 20.0000, calculationBasis: '日常办公用品采购' },
|
|
|
|
|
{ categoryId: 2, categoryName: '差旅费', amount: 30.0000, calculationBasis: '学术会议出差' }
|
|
|
|
|
],
|
|
|
|
|
implementationSchedule: '第一季度完成设备采购,第二季度开始使用...',
|
|
|
|
|
performanceIndicators: [
|
|
|
|
|
{
|
|
|
|
|
level1: '过程指标',
|
|
|
|
|
level2: '数量指标',
|
|
|
|
|
level3: '采购设备数量',
|
|
|
|
|
symbol: '>=',
|
|
|
|
|
halfYearValue: '5',
|
|
|
|
|
fullYearValue: '10',
|
|
|
|
|
unit: '台'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 2,
|
|
|
|
|
departmentName: '外科',
|
|
|
|
|
allocatedAmount: 80.0000,
|
|
|
|
|
status: 'submitted',
|
|
|
|
|
submissionDate: '2024-01-16 14:20:00',
|
|
|
|
|
economicItems: [
|
|
|
|
|
{ categoryId: 1, categoryName: '办公费', amount: 30.0000, calculationBasis: '科室办公材料' },
|
|
|
|
|
{ categoryId: 3, categoryName: '设备费', amount: 50.0000, calculationBasis: '购买专业医疗设备' }
|
|
|
|
|
],
|
|
|
|
|
implementationSchedule: '按季度分批采购和实施...',
|
|
|
|
|
performanceIndicators: [
|
|
|
|
|
{
|
|
|
|
|
level1: '效益指标',
|
|
|
|
|
level2: '质量指标',
|
|
|
|
|
level3: '医疗服务质量提升率',
|
|
|
|
|
symbol: '>=',
|
|
|
|
|
halfYearValue: '10',
|
|
|
|
|
fullYearValue: '20',
|
|
|
|
|
unit: '%'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
level1: '效益指标',
|
|
|
|
|
level2: '经济效益指标',
|
|
|
|
|
level3: '成本节约金额',
|
|
|
|
|
symbol: '>=',
|
|
|
|
|
halfYearValue: '5',
|
|
|
|
|
fullYearValue: '10',
|
|
|
|
|
unit: '万元'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.$set(this.formData, 'departmentSubmissions', mockData.submission)
|
|
|
|
|
this.formData.executeDepartmentCount = mockData.submission.length
|
|
|
|
|
|
|
|
|
|
// 设置模拟的实施进度安排(用于演示)
|
|
|
|
|
if (!this.formData.implementationSchedule) {
|
|
|
|
|
this.formData.implementationSchedule = '第一季度完成设备采购,第二季度开始使用,第三季度进行中期评估,第四季度完成年度总结。'
|
|
|
|
|
// 汇总页属于正式业务页面,接口失败时绝不能展示模拟数据。
|
|
|
|
|
this.$set(this.formData, 'departmentSubmissions', [])
|
|
|
|
|
this.$set(this.formData, 'economicSummary', [])
|
|
|
|
|
this.formData.executeDepartmentCount = 0
|
|
|
|
|
this.$message.error(error.message || '获取执行科室填报数据失败')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.generateEconomicSummary(mockData.submission)
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
generateEconomicSummary(submissions) {
|
|
|
|
|
@ -1081,26 +1085,35 @@ export default {
|
|
|
|
|
if (existingDept) {
|
|
|
|
|
existingDept.amount += amount
|
|
|
|
|
existingDept.basis = item.calculationBasis // 更新测算依据
|
|
|
|
|
existingDept.files = item.files || []
|
|
|
|
|
} else {
|
|
|
|
|
existing.basisList.push({
|
|
|
|
|
department: submission.departmentName,
|
|
|
|
|
amount: amount,
|
|
|
|
|
basis: item.calculationBasis
|
|
|
|
|
basis: item.calculationBasis,
|
|
|
|
|
files: item.files || []
|
|
|
|
|
})
|
|
|
|
|
existing.departmentCount += 1
|
|
|
|
|
}
|
|
|
|
|
existing.summaryCalculationBasis = this.buildEconomicCalculationBasis(existing.basisList)
|
|
|
|
|
existing.files = this.collectEconomicFiles(existing.basisList)
|
|
|
|
|
} else {
|
|
|
|
|
economicMap.set(key, {
|
|
|
|
|
categoryId: item.categoryId,
|
|
|
|
|
categoryName: item.categoryName,
|
|
|
|
|
totalAmount: amount,
|
|
|
|
|
departmentCount: 1,
|
|
|
|
|
summaryCalculationBasis: '', // 默认为空,需要用户填写
|
|
|
|
|
summaryCalculationBasis: this.buildEconomicCalculationBasis([{
|
|
|
|
|
department: submission.departmentName,
|
|
|
|
|
basis: item.calculationBasis
|
|
|
|
|
}]),
|
|
|
|
|
files: item.files || [],
|
|
|
|
|
expanded: false, // 初始状态为收起
|
|
|
|
|
basisList: [{
|
|
|
|
|
department: submission.departmentName,
|
|
|
|
|
amount: amount,
|
|
|
|
|
basis: item.calculationBasis
|
|
|
|
|
basis: item.calculationBasis,
|
|
|
|
|
files: item.files || []
|
|
|
|
|
}]
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
@ -1127,9 +1140,10 @@ export default {
|
|
|
|
|
applicationPurpose: data.applicationPurpose || '',
|
|
|
|
|
applicationReason: data.applicationReason || '',
|
|
|
|
|
projectContent: data.projectContent || '',
|
|
|
|
|
implementationSchedule: data.implementationSchedule || '',
|
|
|
|
|
implementationSchedule: data.implementationSchedule || this.formData.implementationSchedule,
|
|
|
|
|
summaryPerformanceIndicators: data.summaryPerformanceIndicators || [],
|
|
|
|
|
otherNotes: data.otherNotes || ''
|
|
|
|
|
otherNotes: data.otherNotes || this.formData.otherNotes,
|
|
|
|
|
generalFiles: this.resolveGeneralFiles(data.generalFiles, data.status)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log('使用lead_submission中的数据:', this.formData)
|
|
|
|
|
@ -1141,6 +1155,7 @@ export default {
|
|
|
|
|
const economicItem = this.formData.economicSummary.find(item => item.categoryId === savedItem.categoryId)
|
|
|
|
|
if (economicItem) {
|
|
|
|
|
this.$set(economicItem, 'summaryCalculationBasis', savedItem.summaryCalculationBasis || '')
|
|
|
|
|
if (savedItem.files) this.$set(economicItem, 'files', savedItem.files)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
@ -1149,9 +1164,9 @@ export default {
|
|
|
|
|
if (this.mode === 'edit' || this.mode === 'view') {
|
|
|
|
|
try {
|
|
|
|
|
const response = await getLeadDepartmentSummary(this.formData.packageId)
|
|
|
|
|
const apiData = response && response.success && response.data ? response.data : response
|
|
|
|
|
|
|
|
|
|
if (response && response.success && response.data) {
|
|
|
|
|
const apiData = response.data
|
|
|
|
|
if (apiData && apiData.id) {
|
|
|
|
|
|
|
|
|
|
// 补充经济分类汇总数据(如果lead_submission中没有完整数据)
|
|
|
|
|
if (apiData.economicSummary && apiData.economicSummary.length > 0) {
|
|
|
|
|
@ -1161,6 +1176,9 @@ export default {
|
|
|
|
|
// 只在没有数据时补充
|
|
|
|
|
this.$set(economicItem, 'summaryCalculationBasis', savedItem.summaryCalculationBasis || '')
|
|
|
|
|
}
|
|
|
|
|
if (economicItem && savedItem.files) {
|
|
|
|
|
this.$set(economicItem, 'files', savedItem.files)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -1168,6 +1186,8 @@ export default {
|
|
|
|
|
if (apiData.summaryPerformanceIndicators && (!data.summaryPerformanceIndicators || data.summaryPerformanceIndicators.length === 0)) {
|
|
|
|
|
this.formData.summaryPerformanceIndicators = apiData.summaryPerformanceIndicators
|
|
|
|
|
}
|
|
|
|
|
this.formData.generalFiles = this.resolveGeneralFiles(apiData.generalFiles, apiData.status)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.warn('获取详细汇总数据失败,使用lead_submission中的数据:', error)
|
|
|
|
|
@ -1180,10 +1200,9 @@ export default {
|
|
|
|
|
// 如果没有传递的数据,回退到原来的API调用方式
|
|
|
|
|
try {
|
|
|
|
|
const response = await getLeadDepartmentSummary(this.formData.packageId)
|
|
|
|
|
const data = response && response.success && response.data ? response.data : response
|
|
|
|
|
|
|
|
|
|
// 处理新的响应格式
|
|
|
|
|
if (response && response.success && response.data) {
|
|
|
|
|
const data = response.data
|
|
|
|
|
if (data && data.id) {
|
|
|
|
|
|
|
|
|
|
// 填充表单数据
|
|
|
|
|
this.formData = {
|
|
|
|
|
@ -1193,9 +1212,10 @@ export default {
|
|
|
|
|
applicationPurpose: data.applicationPurpose || data.application_purpose || '',
|
|
|
|
|
applicationReason: data.applicationReason || data.application_reason || '',
|
|
|
|
|
projectContent: data.projectContent || data.project_content || '',
|
|
|
|
|
implementationSchedule: data.implementationSchedule || data.implementation_schedule || '',
|
|
|
|
|
implementationSchedule: data.implementationSchedule || data.implementation_schedule || this.formData.implementationSchedule,
|
|
|
|
|
summaryPerformanceIndicators: data.summaryPerformanceIndicators || data.summary_performance_indicators || [],
|
|
|
|
|
otherNotes: data.otherNotes || data.other_notes || ''
|
|
|
|
|
otherNotes: data.otherNotes || data.other_notes || this.formData.otherNotes,
|
|
|
|
|
generalFiles: this.resolveGeneralFiles(data.generalFiles || data.general_files, data.status)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log('从API获取的数据:', this.formData)
|
|
|
|
|
@ -1207,6 +1227,7 @@ export default {
|
|
|
|
|
const economicItem = this.formData.economicSummary.find(item => item.categoryId === savedItem.categoryId)
|
|
|
|
|
if (economicItem) {
|
|
|
|
|
this.$set(economicItem, 'summaryCalculationBasis', savedItem.summaryCalculationBasis || '')
|
|
|
|
|
if (savedItem.files) this.$set(economicItem, 'files', savedItem.files)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
} else if (data.economic_summary && data.economic_summary.length > 0) {
|
|
|
|
|
@ -1215,39 +1236,14 @@ export default {
|
|
|
|
|
const economicItem = this.formData.economicSummary.find(item => item.categoryId === savedItem.categoryId)
|
|
|
|
|
if (economicItem) {
|
|
|
|
|
this.$set(economicItem, 'summaryCalculationBasis', savedItem.summary_calculation_basis || '')
|
|
|
|
|
if (savedItem.files) this.$set(economicItem, 'files', savedItem.files)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
} else if (response && response.code === 0) {
|
|
|
|
|
// 处理老格式的响应(向后兼容)
|
|
|
|
|
const data = response
|
|
|
|
|
|
|
|
|
|
this.formData = {
|
|
|
|
|
...this.formData,
|
|
|
|
|
summaryId: data.id || '', // 设置汇总填报表ID
|
|
|
|
|
applicationBasis: data.application_basis || '',
|
|
|
|
|
applicationPurpose: data.application_purpose || '',
|
|
|
|
|
applicationReason: data.application_reason || '',
|
|
|
|
|
projectContent: data.project_content || '',
|
|
|
|
|
implementationSchedule: data.implementation_schedule || '',
|
|
|
|
|
summaryPerformanceIndicators: data.summary_performance_indicators || [],
|
|
|
|
|
otherNotes: data.other_notes || ''
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log('从API获取的汇总数据(旧格式):', this.formData)
|
|
|
|
|
|
|
|
|
|
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 || '')
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
} else if (response && response.code !== 0) {
|
|
|
|
|
} else {
|
|
|
|
|
// 如果是新建模式,不显示错误
|
|
|
|
|
if (this.mode !== 'create') {
|
|
|
|
|
this.$message.error(response.msg || '加载汇总数据失败')
|
|
|
|
|
this.$message.error((data && data.msg) || '加载汇总数据失败')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
@ -1280,17 +1276,101 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
openDepartmentDrawer(departmentData) {
|
|
|
|
|
buildDepartmentTextSummary(field) {
|
|
|
|
|
return this.formData.departmentSubmissions
|
|
|
|
|
.filter(submission => submission[field] && submission[field].trim())
|
|
|
|
|
.map(submission => `【${submission.departmentName}】\n${submission[field].trim()}`)
|
|
|
|
|
.join('\n\n')
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
initializeGeneralSummaryFiles() {
|
|
|
|
|
const isInitialSummary = this.mode === 'create' || this.packageData.submission?.status === 'draft'
|
|
|
|
|
if (!isInitialSummary || this.formData.generalFiles.length > 0) return
|
|
|
|
|
|
|
|
|
|
const filesById = {}
|
|
|
|
|
this.formData.departmentSubmissions.forEach(submission => {
|
|
|
|
|
const generalFiles = submission.generalFiles || []
|
|
|
|
|
generalFiles.forEach(file => {
|
|
|
|
|
if (file.id) filesById[file.id] = { ...file, uid: `inherited-general-${file.id}`, fileId: file.id }
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
this.formData.generalFiles = Object.values(filesById)
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
resolveGeneralFiles(savedFiles, status) {
|
|
|
|
|
if (Array.isArray(savedFiles) && savedFiles.length > 0) return savedFiles
|
|
|
|
|
// 分配时预建的空草稿不是人工删除,不能覆盖初次自动汇总的通用附件。
|
|
|
|
|
if (status === 'draft' || !status) return this.formData.generalFiles
|
|
|
|
|
return []
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
buildEconomicCalculationBasis(details) {
|
|
|
|
|
return details
|
|
|
|
|
.filter(detail => detail.basis && detail.basis.trim())
|
|
|
|
|
.map(detail => `【${detail.department}】${detail.basis.trim()}`)
|
|
|
|
|
.join('\n')
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
collectEconomicFiles(details) {
|
|
|
|
|
const filesById = {}
|
|
|
|
|
details.forEach(detail => {
|
|
|
|
|
const files = detail.files || []
|
|
|
|
|
files.forEach(file => {
|
|
|
|
|
if (file.id) filesById[file.id] = file
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
return Object.values(filesById)
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
handleEconomicUploadSuccess(response, file, fileList, economicItem) {
|
|
|
|
|
if (!response || !response.data) {
|
|
|
|
|
this.$message.error('附件上传失败')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
economicItem.files = fileList.map(item => ({
|
|
|
|
|
...item,
|
|
|
|
|
fileId: item.response && item.response.data ? item.response.data.id : item.fileId
|
|
|
|
|
}))
|
|
|
|
|
this.$message.success('附件上传成功')
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
handleEconomicUploadRemove(file, fileList, economicItem) {
|
|
|
|
|
economicItem.files = fileList
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
handleGeneralUploadSuccess(response, file, fileList) {
|
|
|
|
|
if (!response || !response.data) {
|
|
|
|
|
this.$message.error('附件上传失败')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
this.formData.generalFiles = fileList.map(item => ({
|
|
|
|
|
...item,
|
|
|
|
|
fileId: item.response && item.response.data ? item.response.data.id : item.fileId
|
|
|
|
|
}))
|
|
|
|
|
this.$message.success('附件上传成功')
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
handleGeneralUploadRemove(file, fileList) {
|
|
|
|
|
this.formData.generalFiles = fileList
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
handleUploadError() {
|
|
|
|
|
this.$message.error('附件上传失败,请检查网络或文件大小')
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
async openDepartmentDrawer(departmentData) {
|
|
|
|
|
// 直接设置抽屉层级,基于当前弹窗层级
|
|
|
|
|
this.dynamicZIndex = this.getNextZIndex()
|
|
|
|
|
|
|
|
|
|
// 构造查看详情需要的数据格式
|
|
|
|
|
this.currentDepartmentDetail = {
|
|
|
|
|
id: departmentData.id,
|
|
|
|
|
department: { name: departmentData.departmentName },
|
|
|
|
|
budget_year: this.packageData.budget_year,
|
|
|
|
|
allocated_amount: departmentData.allocatedAmount,
|
|
|
|
|
name: this.formData.packageName
|
|
|
|
|
try {
|
|
|
|
|
// 不再只传分配金额:读取该小包的完整执行科室填报,供只读表单展示。
|
|
|
|
|
const detail = await getPackageDecomposition(departmentData.id)
|
|
|
|
|
this.currentDepartmentDetail = detail
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('获取执行科室填报详情失败:', error)
|
|
|
|
|
this.$message.error('获取执行科室填报详情失败')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 打开抽屉
|
|
|
|
|
@ -1577,11 +1657,13 @@ export default {
|
|
|
|
|
categoryId: item.categoryId,
|
|
|
|
|
totalAmount: item.totalAmount,
|
|
|
|
|
departmentCount: item.departmentCount,
|
|
|
|
|
summaryCalculationBasis: item.summaryCalculationBasis || ''
|
|
|
|
|
summaryCalculationBasis: item.summaryCalculationBasis || '',
|
|
|
|
|
fileIds: (item.files || []).map(file => file.fileId || file.id).filter(Boolean)
|
|
|
|
|
})),
|
|
|
|
|
implementationSchedule: this.formData.implementationSchedule.trim(),
|
|
|
|
|
summaryPerformanceIndicators: this.formData.summaryPerformanceIndicators || [],
|
|
|
|
|
otherNotes: this.formData.otherNotes || ''
|
|
|
|
|
otherNotes: this.formData.otherNotes || '',
|
|
|
|
|
generalFileIds: (this.formData.generalFiles || []).map(file => file.fileId || file.id).filter(Boolean)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 如果是编辑模式,添加汇总表ID(如果存在)
|
|
|
|
|
|