项目分配与实施方案新增合计数
This commit is contained in:
@@ -221,6 +221,17 @@
|
||||
<el-descriptions-item label="合同总产值(元)">
|
||||
{{ formatAmountText(currentProject.contractAmount) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="分项合同产值合计(元)">
|
||||
{{ formatAmountText(planningAmountTotal) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="contractBalanceLabel">
|
||||
<span :class="contractBalanceClass">
|
||||
{{ formatAmountText(contractBalanceDisplayAmount) }}
|
||||
</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="分配进度">
|
||||
<span :class="contractBalanceClass">{{ contractAllocationProgressText }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="建筑面积(m²)">
|
||||
{{ formatAreaText(currentProject.totalConstructionArea) }}
|
||||
</el-descriptions-item>
|
||||
@@ -410,6 +421,46 @@ const queryParams = reactive<ProjectApi.ProjectPageReqVO>({
|
||||
const getProjectRowIndex = (index: number) =>
|
||||
((queryParams.pageNo ?? 1) - 1) * (queryParams.pageSize ?? 10) + index + 1
|
||||
|
||||
const toAmountNumber = (value?: number | string | null) => {
|
||||
const numericValue = Number(value ?? 0)
|
||||
return Number.isNaN(numericValue) ? 0 : numericValue
|
||||
}
|
||||
|
||||
const roundAmount = (value: number) => Math.round((Number(value) || 0) * 100) / 100
|
||||
|
||||
const contractAmountValue = computed(() => toAmountNumber(currentProject.value?.contractAmount))
|
||||
|
||||
const planningAmountTotal = computed(() =>
|
||||
roundAmount(
|
||||
planningList.value.reduce((sum, item) => sum + toAmountNumber(item.planningAmount), 0)
|
||||
)
|
||||
)
|
||||
|
||||
const contractBalanceAmount = computed(() =>
|
||||
roundAmount(contractAmountValue.value - planningAmountTotal.value)
|
||||
)
|
||||
|
||||
const contractOverAllocated = computed(() => contractBalanceAmount.value < 0)
|
||||
|
||||
const contractBalanceDisplayAmount = computed(() =>
|
||||
contractOverAllocated.value ? Math.abs(contractBalanceAmount.value) : contractBalanceAmount.value
|
||||
)
|
||||
|
||||
const contractBalanceLabel = computed(() =>
|
||||
contractOverAllocated.value ? '已超出合同总产值(元)' : '剩余未分配合同产值(元)'
|
||||
)
|
||||
|
||||
const contractBalanceClass = computed(() =>
|
||||
contractOverAllocated.value ? 'text-[var(--el-color-danger)] font-600' : 'text-[var(--el-color-success)] font-600'
|
||||
)
|
||||
|
||||
const contractAllocationProgressText = computed(() => {
|
||||
if (contractAmountValue.value <= 0) {
|
||||
return planningAmountTotal.value > 0 ? '合同总产值为 0,无法计算' : '0.00%'
|
||||
}
|
||||
return formatPercentText(planningAmountTotal.value / contractAmountValue.value)
|
||||
})
|
||||
|
||||
const queryProjectStartYearValue = computed({
|
||||
get: () => (queryParams.projectStartYear ? String(queryParams.projectStartYear) : undefined),
|
||||
set: (value?: string) => {
|
||||
|
||||
Reference in New Issue
Block a user