|
@@ -215,53 +215,56 @@
|
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
|
<el-form-item label="项目总投资" prop="totalInvestment">
|
|
<el-form-item label="项目总投资" prop="totalInvestment">
|
|
|
<el-input-number
|
|
<el-input-number
|
|
|
- v-model="form.totalInvestment"
|
|
|
|
|
|
|
+ :model-value="totalInvestmentCalculated"
|
|
|
:precision="2"
|
|
:precision="2"
|
|
|
:min="0"
|
|
:min="0"
|
|
|
- :max="99999999"
|
|
|
|
|
placeholder="万元"
|
|
placeholder="万元"
|
|
|
size="large"
|
|
size="large"
|
|
|
style="width: 100%"
|
|
style="width: 100%"
|
|
|
- @change="calculateTotalInvestment"
|
|
|
|
|
|
|
+ :disabled="true"
|
|
|
|
|
+ readonly
|
|
|
/>
|
|
/>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
|
<el-form-item label="市财政资金" prop="totalMunicipalFiscal">
|
|
<el-form-item label="市财政资金" prop="totalMunicipalFiscal">
|
|
|
<el-input-number
|
|
<el-input-number
|
|
|
- v-model="form.totalMunicipalFiscal"
|
|
|
|
|
|
|
+ :model-value="totalMunicipalFiscalCalculated"
|
|
|
:precision="2"
|
|
:precision="2"
|
|
|
:min="0"
|
|
:min="0"
|
|
|
placeholder="万元"
|
|
placeholder="万元"
|
|
|
size="large"
|
|
size="large"
|
|
|
style="width: 100%"
|
|
style="width: 100%"
|
|
|
- @change="calculateTotalInvestment"
|
|
|
|
|
|
|
+ disabled="true"
|
|
|
|
|
+ readonly
|
|
|
/>
|
|
/>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
|
<el-form-item label="单位自筹" prop="totalSelfFunding">
|
|
<el-form-item label="单位自筹" prop="totalSelfFunding">
|
|
|
<el-input-number
|
|
<el-input-number
|
|
|
- v-model="form.totalSelfFunding"
|
|
|
|
|
|
|
+ :model-value="totalSelfFundingCalculated"
|
|
|
:precision="2"
|
|
:precision="2"
|
|
|
:min="0"
|
|
:min="0"
|
|
|
placeholder="万元"
|
|
placeholder="万元"
|
|
|
size="large"
|
|
size="large"
|
|
|
style="width: 100%"
|
|
style="width: 100%"
|
|
|
- @change="calculateTotalInvestment"
|
|
|
|
|
|
|
+ disabled="true"
|
|
|
|
|
+ readonly
|
|
|
/>
|
|
/>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
|
<el-form-item label="其他资金" prop="totalOtherFunding">
|
|
<el-form-item label="其他资金" prop="totalOtherFunding">
|
|
|
<el-input-number
|
|
<el-input-number
|
|
|
- v-model="form.totalOtherFunding"
|
|
|
|
|
|
|
+ :model-value="totalOtherFundingCalculated"
|
|
|
:precision="2"
|
|
:precision="2"
|
|
|
:min="0"
|
|
:min="0"
|
|
|
placeholder="万元"
|
|
placeholder="万元"
|
|
|
size="large"
|
|
size="large"
|
|
|
style="width: 100%"
|
|
style="width: 100%"
|
|
|
- @change="calculateTotalInvestment"
|
|
|
|
|
|
|
+ disabled="true"
|
|
|
|
|
+ readonly
|
|
|
/>
|
|
/>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
@@ -710,14 +713,13 @@ const rules = {
|
|
|
startDate: [{ required: true, message: '请选择项目开始日期', trigger: 'change' }],
|
|
startDate: [{ required: true, message: '请选择项目开始日期', trigger: 'change' }],
|
|
|
endDate: [{ required: true, message: '请选择项目结束日期', trigger: 'change' }],
|
|
endDate: [{ required: true, message: '请选择项目结束日期', trigger: 'change' }],
|
|
|
totalInvestment: [
|
|
totalInvestment: [
|
|
|
- { required: true, message: '请填写项目总投资', trigger: 'blur' },
|
|
|
|
|
{ type: 'number' as const, min: 0.01, message: '投资金额必须大于0', trigger: 'blur' }
|
|
{ type: 'number' as const, min: 0.01, message: '投资金额必须大于0', trigger: 'blur' }
|
|
|
]
|
|
]
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
// 计算属性
|
|
// 计算属性
|
|
|
const canSubmit = computed(() => {
|
|
const canSubmit = computed(() => {
|
|
|
- return form.projectName && form.principal && form.totalInvestment > 0;
|
|
|
|
|
|
|
+ return form.projectName && form.principal && totalInvestmentCalculated.value > 0;
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
const hasBudgetData = computed(() => {
|
|
const hasBudgetData = computed(() => {
|
|
@@ -734,6 +736,26 @@ const yearlyTotals = computed(() => {
|
|
|
};
|
|
};
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+// 市财政资金总额(基于分年度明细自动汇总)
|
|
|
|
|
+const totalMunicipalFiscalCalculated = computed(() => {
|
|
|
|
|
+ return (form.currentYearMunicipal || 0) + (form.nextYearMunicipal || 0) + (form.futureYearMunicipal || 0);
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
|
|
+// 单位自筹总额(基于分年度明细自动汇总)
|
|
|
|
|
+const totalSelfFundingCalculated = computed(() => {
|
|
|
|
|
+ return (form.currentYearSelf || 0) + (form.nextYearSelf || 0) + (form.futureYearSelf || 0);
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
|
|
+// 其他资金总额(基于分年度明细自动汇总)
|
|
|
|
|
+const totalOtherFundingCalculated = computed(() => {
|
|
|
|
|
+ return (form.currentYearOther || 0) + (form.nextYearOther || 0) + (form.futureYearOther || 0);
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
|
|
+// 项目总投资(基于三个汇总字段自动计算)
|
|
|
|
|
+const totalInvestmentCalculated = computed(() => {
|
|
|
|
|
+ return totalMunicipalFiscalCalculated.value + totalSelfFundingCalculated.value + totalOtherFundingCalculated.value;
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
// 分年度预算明细数据
|
|
// 分年度预算明细数据
|
|
|
const budgetBreakdownData = computed(() => {
|
|
const budgetBreakdownData = computed(() => {
|
|
|
const currentYear = parseInt(form.year) || new Date().getFullYear();
|
|
const currentYear = parseInt(form.year) || new Date().getFullYear();
|
|
@@ -784,30 +806,22 @@ const updateBudgetBreakdown = (index: number) => {
|
|
|
recalculateTotalFromBreakdown();
|
|
recalculateTotalFromBreakdown();
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-// 从分年度明细重新计算总投资
|
|
|
|
|
|
|
+// 从分年度明细重新计算总投资(使用计算属性)
|
|
|
const recalculateTotalFromBreakdown = () => {
|
|
const recalculateTotalFromBreakdown = () => {
|
|
|
- const totalMunicipal = (form.currentYearMunicipal || 0) + (form.nextYearMunicipal || 0) + (form.futureYearMunicipal || 0);
|
|
|
|
|
- const totalSelf = (form.currentYearSelf || 0) + (form.nextYearSelf || 0) + (form.futureYearSelf || 0);
|
|
|
|
|
- const totalOther = (form.currentYearOther || 0) + (form.nextYearOther || 0) + (form.futureYearOther || 0);
|
|
|
|
|
-
|
|
|
|
|
- form.totalMunicipalFiscal = totalMunicipal;
|
|
|
|
|
- form.totalSelfFunding = totalSelf;
|
|
|
|
|
- form.totalOtherFunding = totalOther;
|
|
|
|
|
- form.totalInvestment = totalMunicipal + totalSelf + totalOther;
|
|
|
|
|
|
|
+ // 使用计算属性自动同步到表单字段
|
|
|
|
|
+ form.totalMunicipalFiscal = totalMunicipalFiscalCalculated.value;
|
|
|
|
|
+ form.totalSelfFunding = totalSelfFundingCalculated.value;
|
|
|
|
|
+ form.totalOtherFunding = totalOtherFundingCalculated.value;
|
|
|
|
|
+ form.totalInvestment = totalInvestmentCalculated.value;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-// 计算预算汇总
|
|
|
|
|
|
|
+// 计算预算汇总(使用计算属性)
|
|
|
const calculateBudgetSummary = () => {
|
|
const calculateBudgetSummary = () => {
|
|
|
- // 计算各类资金的总和
|
|
|
|
|
- const totalMunicipal = (form.currentYearMunicipal || 0) + (form.nextYearMunicipal || 0) + (form.futureYearMunicipal || 0);
|
|
|
|
|
- const totalSelf = (form.currentYearSelf || 0) + (form.nextYearSelf || 0) + (form.futureYearSelf || 0);
|
|
|
|
|
- const totalOther = (form.currentYearOther || 0) + (form.nextYearOther || 0) + (form.futureYearOther || 0);
|
|
|
|
|
-
|
|
|
|
|
- // 更新总投资字段
|
|
|
|
|
- form.totalMunicipalFiscal = totalMunicipal;
|
|
|
|
|
- form.totalSelfFunding = totalSelf;
|
|
|
|
|
- form.totalOtherFunding = totalOther;
|
|
|
|
|
- form.totalInvestment = totalMunicipal + totalSelf + totalOther;
|
|
|
|
|
|
|
+ // 使用计算属性自动同步到表单字段
|
|
|
|
|
+ form.totalMunicipalFiscal = totalMunicipalFiscalCalculated.value;
|
|
|
|
|
+ form.totalSelfFunding = totalSelfFundingCalculated.value;
|
|
|
|
|
+ form.totalOtherFunding = totalOtherFundingCalculated.value;
|
|
|
|
|
+ form.totalInvestment = totalInvestmentCalculated.value;
|
|
|
|
|
|
|
|
// 更新图表
|
|
// 更新图表
|
|
|
if (budgetChartInstance && hasBudgetData.value) {
|
|
if (budgetChartInstance && hasBudgetData.value) {
|
|
@@ -820,9 +834,13 @@ const formatAmount = (amount: number): string => {
|
|
|
return amount ? amount.toFixed(2) : '0.00';
|
|
return amount ? amount.toFixed(2) : '0.00';
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-// 计算总投资
|
|
|
|
|
-const calculateTotalInvestment = () => {
|
|
|
|
|
- form.totalInvestment = (form.totalMunicipalFiscal || 0) + (form.totalSelfFunding || 0) + (form.totalOtherFunding || 0);
|
|
|
|
|
|
|
+// 更新所有总投资相关字段(从分年度明细计算)
|
|
|
|
|
+const updateTotalInvestmentFromSubItems = () => {
|
|
|
|
|
+ // 自动同步所有计算值到表单字段(用于后端提交)
|
|
|
|
|
+ form.totalMunicipalFiscal = totalMunicipalFiscalCalculated.value;
|
|
|
|
|
+ form.totalSelfFunding = totalSelfFundingCalculated.value;
|
|
|
|
|
+ form.totalOtherFunding = totalOtherFundingCalculated.value;
|
|
|
|
|
+ form.totalInvestment = totalInvestmentCalculated.value;
|
|
|
|
|
|
|
|
// 更新图表
|
|
// 更新图表
|
|
|
if (budgetChartInstance && hasBudgetData.value) {
|
|
if (budgetChartInstance && hasBudgetData.value) {
|
|
@@ -830,6 +848,26 @@ const calculateTotalInvestment = () => {
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+// 保留原函数名以兼容其他调用
|
|
|
|
|
+const calculateTotalInvestment = updateTotalInvestmentFromSubItems;
|
|
|
|
|
+
|
|
|
|
|
+// 监听分年度字段变化,自动同步所有总计字段
|
|
|
|
|
+watch(
|
|
|
|
|
+ () => [
|
|
|
|
|
+ form.currentYearMunicipal, form.nextYearMunicipal, form.futureYearMunicipal,
|
|
|
|
|
+ form.currentYearSelf, form.nextYearSelf, form.futureYearSelf,
|
|
|
|
|
+ form.currentYearOther, form.nextYearOther, form.futureYearOther
|
|
|
|
|
+ ],
|
|
|
|
|
+ () => {
|
|
|
|
|
+ // 同步计算值到表单字段(用于后端提交)
|
|
|
|
|
+ form.totalMunicipalFiscal = totalMunicipalFiscalCalculated.value;
|
|
|
|
|
+ form.totalSelfFunding = totalSelfFundingCalculated.value;
|
|
|
|
|
+ form.totalOtherFunding = totalOtherFundingCalculated.value;
|
|
|
|
|
+ form.totalInvestment = totalInvestmentCalculated.value;
|
|
|
|
|
+ },
|
|
|
|
|
+ { immediate: true }
|
|
|
|
|
+);
|
|
|
|
|
+
|
|
|
// 渲染预算图表
|
|
// 渲染预算图表
|
|
|
const renderBudgetChart = () => {
|
|
const renderBudgetChart = () => {
|
|
|
if (!budgetChartInstance) return;
|
|
if (!budgetChartInstance) return;
|
|
@@ -999,6 +1037,9 @@ const handleSaveDraft = async () => {
|
|
|
try {
|
|
try {
|
|
|
savingDraft.value = true;
|
|
savingDraft.value = true;
|
|
|
|
|
|
|
|
|
|
+ // 同步计算的总投资到表单字段
|
|
|
|
|
+ form.totalInvestment = totalInvestmentCalculated.value;
|
|
|
|
|
+
|
|
|
// 如果当前在绩效指标步骤(第3步),校验分值占比总和
|
|
// 如果当前在绩效指标步骤(第3步),校验分值占比总和
|
|
|
if (currentStep.value === 3 && form.performanceIndicators && form.performanceIndicators.length > 0) {
|
|
if (currentStep.value === 3 && form.performanceIndicators && form.performanceIndicators.length > 0) {
|
|
|
const validationResult = validatePerformanceIndicators();
|
|
const validationResult = validatePerformanceIndicators();
|
|
@@ -1032,6 +1073,9 @@ const handleSubmit = async () => {
|
|
|
try {
|
|
try {
|
|
|
submitting.value = true;
|
|
submitting.value = true;
|
|
|
|
|
|
|
|
|
|
+ // 同步计算的总投资到表单字段
|
|
|
|
|
+ form.totalInvestment = totalInvestmentCalculated.value;
|
|
|
|
|
+
|
|
|
console.log('开始提交申报流程,form.id:', form.id);
|
|
console.log('开始提交申报流程,form.id:', form.id);
|
|
|
|
|
|
|
|
// 先保存数据
|
|
// 先保存数据
|