项目成本测算新增项目成本预算、核算、结算,季度分配调整可子合约规划分配

This commit is contained in:
lzm
2026-05-22 18:05:53 +08:00
parent 865ef2aebe
commit 761112715d
10 changed files with 710 additions and 127 deletions

View File

@@ -90,14 +90,7 @@
</el-table-column>
<el-table-column align="center" label="项目预算产值总计(元)" width="160">
<template #default="scope">
<el-tooltip
v-if="isUsingContractAmount(scope.row)"
content="结算合同总产值未填写,当前暂按合同总产值测算"
placement="top"
>
<span>{{ formatAmountText(scope.row.effectiveSettlementAmount) }}</span>
</el-tooltip>
<span v-else>{{ formatAmountText(scope.row.effectiveSettlementAmount) }}</span>
{{ formatAmountText(scope.row.effectiveSettlementAmount) }}
</template>
</el-table-column>
<el-table-column align="center" label="综合所人工成本(元)" width="150">
@@ -105,31 +98,31 @@
{{ formatAmountText(scope.row.comprehensivePlanningAmount) }}
</template>
</el-table-column>
<el-table-column align="center" label="专项分包-专业所人工成本(元)" width="210">
<el-table-column align="center" label="专项分包专业所成本(元)" width="210">
<template #default="scope">
{{ formatAmountText(scope.row.specialSubcontractPlanningAmount) }}
</template>
</el-table-column>
<el-table-column align="center" label="专项分包-源头合作分包人工成本(元)" width="250">
<el-table-column align="center" label="专项分包源头合作成本(元)" width="240">
<template #default="scope">
{{ formatAmountText(scope.row.sourceCoopSubcontractPlanningAmount) }}
</template>
</el-table-column>
<el-table-column align="center" label="专项分包-综合所人工成本(元)" width="230">
<el-table-column align="center" label="专项分包综合所成本(元)" width="220">
<template #default="scope">
{{ formatAmountText(scope.row.comprehensiveSubcontractPlanningAmount) }}
</template>
</el-table-column>
<el-table-column align="center" label="专业所考核产值(元)" width="150">
<template #default="scope">
{{ formatAmountText(scope.row.majorOutputValue) }}
</template>
</el-table-column>
<el-table-column align="center" label="专业所人工成本(元)" width="150">
<template #default="scope">
{{ formatAmountText(scope.row.majorExpectedPerformance) }}
</template>
</el-table-column>
<el-table-column align="center" label="专业所考核产值(元)" width="150">
<template #default="scope">
{{ formatAmountText(scope.row.majorOutputValue) }}
</template>
</el-table-column>
<el-table-column align="center" label="科创产值比例" width="110">
<template #default="scope">
{{ formatPercentText(scope.row.innovationOutputRate) }}
@@ -180,64 +173,271 @@
</el-button>
</div>
<el-descriptions :column="3" border>
<el-descriptions-item label="合同总产值(元)">
{{ formatAmountText(currentProfit.contractAmount) }}
</el-descriptions-item>
<el-descriptions-item label="结算合同总产值(元)">
{{ formatAmountText(currentProfit.finalSettlementAmount) }}
</el-descriptions-item>
<el-descriptions-item label="项目预算产值总计(元)">
<el-tooltip
v-if="isUsingContractAmount(currentProfit)"
content="结算合同总产值未填写,当前暂按合同总产值测算"
placement="top"
<section class="mb-28px">
<div class="mb-12px flex items-center justify-between gap-16px">
<div>
<div class="text-15px font-600">项目成本预算测算表</div>
<div class="mt-4px flex flex-wrap items-center gap-10px text-13px text-[var(--el-text-color-secondary)]">
<el-tag :type="budgetSnapshot ? 'success' : 'info'">
{{ budgetSnapshot ? '已锁定' : '动态测算' }}
</el-tag>
<span>{{ snapshotActionText(budgetSnapshot) }}</span>
</div>
</div>
<el-button
:disabled="!!budgetSnapshot"
:loading="actionLoading === 'budget'"
type="primary"
@click="handleLockBudgetSnapshot"
>
<span>{{ formatAmountText(currentProfit.effectiveSettlementAmount) }}</span>
</el-tooltip>
<span v-else>{{ formatAmountText(currentProfit.effectiveSettlementAmount) }}</span>
</el-descriptions-item>
<el-descriptions-item label="项目开始年度">
{{ currentProfit.projectStartYear || '-' }}
</el-descriptions-item>
<el-descriptions-item label="综合所人工成本(元)">
{{ formatAmountText(currentProfit.comprehensivePlanningAmount) }}
</el-descriptions-item>
<el-descriptions-item label="专项分包-专业所人工成本(元)">
{{ formatAmountText(currentProfit.specialSubcontractPlanningAmount) }}
</el-descriptions-item>
<el-descriptions-item label="专项分包-源头合作分包人工成本(元)">
{{ formatAmountText(currentProfit.sourceCoopSubcontractPlanningAmount) }}
</el-descriptions-item>
<el-descriptions-item label="专项分包-综合所人工成本(元)">
{{ formatAmountText(currentProfit.comprehensiveSubcontractPlanningAmount) }}
</el-descriptions-item>
<el-descriptions-item label="专业所考核产值(元)">
{{ formatAmountText(currentProfit.majorOutputValue) }}
</el-descriptions-item>
<el-descriptions-item label="专业所人工成本(元)">
{{ formatAmountText(currentProfit.majorExpectedPerformance) }}
</el-descriptions-item>
<el-descriptions-item label="科创产值比例">
{{ formatPercentText(currentProfit.innovationOutputRate) }}
</el-descriptions-item>
<el-descriptions-item label="科创产值(元)">
{{ formatAmountText(currentProfit.innovationOutputValue) }}
</el-descriptions-item>
<el-descriptions-item label="其他成本(元)">
{{ formatAmountText(currentProfit.otherCost) }}
</el-descriptions-item>
<el-descriptions-item label="预算盈亏值(元)">
<span :class="profitLossClass(currentProfit.profitLossValue)">
{{ formatAmountText(currentProfit.profitLossValue) }}
</span>
</el-descriptions-item>
<el-descriptions-item label="预算盈亏百分比">
<span :class="profitLossClass(currentProfit.profitLossValue)">
{{ formatPercentText(currentProfit.profitLossRate) }}
</span>
</el-descriptions-item>
</el-descriptions>
目标责任书下达
</el-button>
</div>
<el-alert
v-if="!budgetSnapshot"
class="mb-12px"
:closable="false"
show-icon
title="当前展示实时动态测算值。点击“目标责任书下达”后,本阶段数据会生成快照并锁定。"
type="info"
/>
<el-descriptions v-if="budgetDisplay" :column="3" border>
<el-descriptions-item label="合同总产值(元)">
{{ formatAmountText(budgetDisplay.contractAmount) }}
</el-descriptions-item>
<el-descriptions-item label="结算合同总产值(元)">
{{ formatAmountText(budgetDisplay.finalSettlementAmount) }}
</el-descriptions-item>
<el-descriptions-item label="项目预算产值总计(元)">
{{ formatAmountText(budgetDisplay.effectiveSettlementAmount) }}
</el-descriptions-item>
<el-descriptions-item label="项目开始年度">
{{ currentProfit.projectStartYear || '-' }}
</el-descriptions-item>
<el-descriptions-item label="综合所人工成本(元)">
{{ formatAmountText(budgetDisplay.comprehensivePlanningAmount) }}
</el-descriptions-item>
<el-descriptions-item label="专项分包(专业所成本)(元)">
{{ formatAmountText(budgetDisplay.specialSubcontractPlanningAmount) }}
</el-descriptions-item>
<el-descriptions-item label="专项分包(源头合作成本)(元)">
{{ formatAmountText(budgetDisplay.sourceCoopSubcontractPlanningAmount) }}
</el-descriptions-item>
<el-descriptions-item label="专项分包(综合所成本)(元)">
{{ formatAmountText(budgetDisplay.comprehensiveSubcontractPlanningAmount) }}
</el-descriptions-item>
<el-descriptions-item label="专业所人工成本(元)">
{{ formatAmountText(budgetDisplay.majorExpectedPerformance) }}
</el-descriptions-item>
<el-descriptions-item label="专业所考核产值(元)">
{{ formatAmountText(budgetDisplay.majorOutputValue) }}
</el-descriptions-item>
<el-descriptions-item label="科创产值比例">
{{ formatPercentText(budgetDisplay.innovationOutputRate) }}
</el-descriptions-item>
<el-descriptions-item label="科创产值(元)">
{{ formatAmountText(budgetDisplay.innovationOutputValue) }}
</el-descriptions-item>
<el-descriptions-item label="其他成本(元)">
{{ formatAmountText(budgetDisplay.otherCost) }}
</el-descriptions-item>
<el-descriptions-item label="预算盈亏值(元)">
<span :class="profitLossClass(budgetDisplay.profitLossValue)">
{{ formatAmountText(budgetDisplay.profitLossValue) }}
</span>
</el-descriptions-item>
<el-descriptions-item label="预算盈亏百分比">
<span :class="profitLossClass(budgetDisplay.profitLossValue)">
{{ formatPercentText(budgetDisplay.profitLossRate) }}
</span>
</el-descriptions-item>
</el-descriptions>
</section>
<section class="mb-28px">
<div class="mb-12px flex items-center justify-between gap-16px">
<div>
<div class="text-15px font-600">项目成本核算测算表</div>
<div class="mt-4px flex flex-wrap items-center gap-10px text-13px text-[var(--el-text-color-secondary)]">
<el-tag :type="accountingSnapshot ? 'success' : 'info'">
{{ accountingSnapshot ? '已锁定' : '动态测算' }}
</el-tag>
<span>{{ snapshotActionText(accountingSnapshot) }}</span>
</div>
</div>
<el-button
:disabled="!budgetSnapshot || !!accountingSnapshot"
:loading="actionLoading === 'accounting'"
type="primary"
@click="handleLockAccountingSnapshot"
>
竣工验收完成
</el-button>
</div>
<el-alert
v-if="!budgetSnapshot"
class="mb-12px"
:closable="false"
show-icon
title="请先下达目标责任书,锁定项目成本预算测算后,才能完成竣工验收。"
type="warning"
/>
<el-alert
v-else-if="!accountingSnapshot"
class="mb-12px"
:closable="false"
show-icon
title="当前展示实时动态测算值。点击“竣工验收完成”后,本阶段数据会生成快照并锁定。"
type="info"
/>
<el-descriptions v-if="accountingDisplay" :column="3" border>
<el-descriptions-item label="合同总产值(元)">
{{ formatAmountText(accountingDisplay.contractAmount) }}
</el-descriptions-item>
<el-descriptions-item label="结算合同总产值(元)">
{{ formatAmountText(accountingDisplay.finalSettlementAmount) }}
</el-descriptions-item>
<el-descriptions-item label="项目预算产值总计(元)">
{{ formatAmountText(accountingDisplay.effectiveSettlementAmount) }}
</el-descriptions-item>
<el-descriptions-item label="项目开始年度">
{{ currentProfit.projectStartYear || '-' }}
</el-descriptions-item>
<el-descriptions-item label="综合所人工成本(元)">
{{ formatAmountText(accountingDisplay.comprehensivePlanningAmount) }}
</el-descriptions-item>
<el-descriptions-item label="专项分包(专业所成本)(元)">
{{ formatAmountText(accountingDisplay.specialSubcontractPlanningAmount) }}
</el-descriptions-item>
<el-descriptions-item label="专项分包(源头合作成本)(元)">
{{ formatAmountText(accountingDisplay.sourceCoopSubcontractPlanningAmount) }}
</el-descriptions-item>
<el-descriptions-item label="专项分包(综合所成本)(元)">
{{ formatAmountText(accountingDisplay.comprehensiveSubcontractPlanningAmount) }}
</el-descriptions-item>
<el-descriptions-item label="专业所人工成本(元)">
{{ formatAmountText(accountingDisplay.majorExpectedPerformance) }}
</el-descriptions-item>
<el-descriptions-item label="专业所考核产值(元)">
{{ formatAmountText(accountingDisplay.majorOutputValue) }}
</el-descriptions-item>
<el-descriptions-item label="科创产值比例">
{{ formatPercentText(accountingDisplay.innovationOutputRate) }}
</el-descriptions-item>
<el-descriptions-item label="科创产值(元)">
{{ formatAmountText(accountingDisplay.innovationOutputValue) }}
</el-descriptions-item>
<el-descriptions-item label="其他成本(元)">
{{ formatAmountText(accountingDisplay.otherCost) }}
</el-descriptions-item>
<el-descriptions-item label="预算盈亏值(元)">
<span :class="profitLossClass(accountingDisplay.profitLossValue)">
{{ formatAmountText(accountingDisplay.profitLossValue) }}
</span>
</el-descriptions-item>
<el-descriptions-item label="预算盈亏百分比">
<span :class="profitLossClass(accountingDisplay.profitLossValue)">
{{ formatPercentText(accountingDisplay.profitLossRate) }}
</span>
</el-descriptions-item>
</el-descriptions>
</section>
<section>
<div class="mb-12px flex items-center justify-between gap-16px">
<div>
<div class="text-15px font-600">项目成本结算测算表</div>
<div class="mt-4px flex flex-wrap items-center gap-10px text-13px text-[var(--el-text-color-secondary)]">
<el-tag :type="settlementSnapshot ? 'success' : 'info'">
{{ settlementSnapshot ? '已保存' : '未保存' }}
</el-tag>
<span>{{ snapshotActionText(settlementSnapshot, '保存结算测算后会记录操作人和操作时间') }}</span>
</div>
</div>
</div>
<el-alert
v-if="!accountingSnapshot"
class="mb-12px"
:closable="false"
show-icon
title="请先点击“竣工验收完成”锁定项目成本核算测算,再维护结算测算。"
type="warning"
/>
<el-descriptions :column="2" border>
<el-descriptions-item label="综合所考核产值核算值(元)">
{{ formatAmountText(settlementComprehensiveAccountingValue) }}
</el-descriptions-item>
<el-descriptions-item label="综合所考核产值结算值(元)">
{{ formatAmountText(settlementComprehensiveSettlementValue) }}
</el-descriptions-item>
<el-descriptions-item label="专业所考核产值核算值(元)">
{{ formatAmountText(settlementMajorAccountingValue) }}
</el-descriptions-item>
<el-descriptions-item label="专业所考核产值结算值(元)">
{{ formatAmountText(settlementMajorSettlementValue) }}
</el-descriptions-item>
</el-descriptions>
<el-form
ref="settlementFormRef"
:disabled="!accountingSnapshot"
:model="settlementForm"
:rules="settlementRules"
class="mt-16px"
label-width="110px"
>
<el-row :gutter="16">
<el-col :span="8">
<el-form-item label="考核结果" prop="assessmentResult">
<el-select
v-model="settlementForm.assessmentResult"
class="!w-1/1"
placeholder="请选择考核结果"
>
<el-option label="优秀" value="优秀" />
<el-option label="合格" value="合格" />
<el-option label="待改进" value="待改进" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="考核系数" prop="assessmentCoefficient">
<el-input :model-value="formatCoefficientText(settlementCoefficient)" disabled />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="操作" prop="action">
<el-button
:disabled="!accountingSnapshot"
:loading="actionLoading === 'settlement'"
type="primary"
@click="handleSaveSettlementSnapshot"
>
保存结算测算
</el-button>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input
v-model="settlementForm.remark"
:rows="2"
maxlength="500"
placeholder="请输入备注"
show-word-limit
type="textarea"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
</section>
</template>
<el-empty v-else-if="!detailLoading" description="请选择项目后查看项目成本详情" />
@@ -297,6 +497,7 @@ import {
fromPercentValue,
toPercentValue
} from '@/views/tjt/shared/planning'
import { formatDate } from '@/utils/formatTime'
defineOptions({ name: 'TjtProfit' })
@@ -305,11 +506,21 @@ const { t } = useI18n()
const loading = ref(false)
const detailLoading = ref(false)
const actionLoading = ref<'budget' | 'accounting' | 'settlement' | ''>('')
const total = ref(0)
const list = ref<ProfitApi.ProjectProfitVO[]>([])
const currentProfit = ref<ProfitApi.ProjectProfitVO>()
const queryFormRef = ref()
const profitTableRef = ref()
const settlementFormRef = ref()
const settlementForm = reactive<ProfitApi.ProjectProfitSettlementSaveReqVO>({
projectId: 0,
assessmentResult: '合格',
remark: ''
})
const settlementRules = {
assessmentResult: [{ required: true, message: '请选择考核结果', trigger: 'change' }]
}
const dialogVisible = ref(false)
const dialogLoading = ref(false)
@@ -354,6 +565,29 @@ const queryProjectStartYearValue = computed({
}
})
const budgetSnapshot = computed(() => currentProfit.value?.budgetSnapshot)
const accountingSnapshot = computed(() => currentProfit.value?.accountingSnapshot)
const settlementSnapshot = computed(() => currentProfit.value?.settlementSnapshot)
const budgetDisplay = computed(() => budgetSnapshot.value || currentProfit.value)
const accountingDisplay = computed(() => accountingSnapshot.value || currentProfit.value)
const settlementCoefficient = computed(() => getAssessmentCoefficient(settlementForm.assessmentResult))
const settlementComprehensiveAccountingValue = computed(() =>
Number(
settlementSnapshot.value?.comprehensiveAccountingOutputValue ??
accountingSnapshot.value?.comprehensivePlanningAmount ??
0
)
)
const settlementMajorAccountingValue = computed(() =>
Number(settlementSnapshot.value?.majorAccountingOutputValue ?? accountingSnapshot.value?.majorOutputValue ?? 0)
)
const settlementComprehensiveSettlementValue = computed(() =>
roundAmount(settlementComprehensiveAccountingValue.value * settlementCoefficient.value)
)
const settlementMajorSettlementValue = computed(() =>
roundAmount(settlementMajorAccountingValue.value * settlementCoefficient.value)
)
const getList = async () => {
loading.value = true
let targetProfit: ProfitApi.ProjectProfitVO | undefined
@@ -412,6 +646,60 @@ const refreshCurrentProfit = async () => {
await getList()
}
const handleLockBudgetSnapshot = async () => {
if (!currentProfit.value?.projectId) {
return
}
await message.confirm('确认下达目标责任书并锁定当前项目成本预算测算吗?锁定后不能重复操作。')
actionLoading.value = 'budget'
try {
currentProfit.value = await ProfitApi.lockBudgetSnapshot(currentProfit.value.projectId)
message.success('目标责任书已下达')
await getList()
} finally {
actionLoading.value = ''
}
}
const handleLockAccountingSnapshot = async () => {
if (!currentProfit.value?.projectId) {
return
}
if (!budgetSnapshot.value) {
message.warning('请先下达目标责任书,再完成竣工验收')
return
}
await message.confirm('确认竣工验收完成并锁定当前项目成本核算测算吗?锁定后不能重复操作。')
actionLoading.value = 'accounting'
try {
currentProfit.value = await ProfitApi.lockAccountingSnapshot(currentProfit.value.projectId)
message.success('竣工验收已完成')
await getList()
} finally {
actionLoading.value = ''
}
}
const handleSaveSettlementSnapshot = async () => {
if (!currentProfit.value?.projectId || !accountingSnapshot.value) {
message.warning('请先完成竣工验收,再维护结算测算')
return
}
await settlementFormRef.value?.validate()
actionLoading.value = 'settlement'
try {
currentProfit.value = await ProfitApi.saveSettlementSnapshot({
projectId: currentProfit.value.projectId,
assessmentResult: settlementForm.assessmentResult,
remark: settlementForm.remark
})
message.success('结算测算已保存')
await getList()
} finally {
actionLoading.value = ''
}
}
const openProfitEditDialog = async () => {
if (!currentProfit.value?.projectId) {
return
@@ -469,8 +757,46 @@ const profitLossClass = (value?: number) => {
return 'text-[var(--el-text-color-primary)]'
}
const isUsingContractAmount = (row?: ProfitApi.ProjectProfitVO) =>
!!row && Number(row.finalSettlementAmount || 0) <= 0 && Number(row.contractAmount || 0) > 0
const snapshotActionText = (
snapshot?: ProfitApi.ProjectProfitSnapshotVO,
emptyText = '当前为实时动态测算值,尚未锁定'
) => {
if (!snapshot) {
return emptyText
}
const actionName = snapshot.actionUserName || '未知操作人'
const actionTime = snapshot.actionTime ? formatDate(snapshot.actionTime as any) : '未知时间'
return `${actionName}${actionTime} 操作`
}
const roundAmount = (value: number) => Math.round((Number(value) || 0) * 100) / 100
const getAssessmentCoefficient = (assessmentResult?: string) => {
if (assessmentResult === '优秀') {
return 1.02
}
if (assessmentResult === '待改进') {
return 0.95
}
return 1
}
const formatCoefficientText = (value?: number) => Number(value ?? 1).toFixed(2)
const syncSettlementForm = () => {
if (!currentProfit.value?.projectId) {
settlementForm.projectId = 0
settlementForm.assessmentResult = '合格'
settlementForm.remark = ''
return
}
const snapshot = currentProfit.value.settlementSnapshot
settlementForm.projectId = currentProfit.value.projectId
settlementForm.assessmentResult = snapshot?.assessmentResult || '合格'
settlementForm.remark = snapshot?.remark || ''
}
watch(currentProfit, syncSettlementForm)
let activatedOnce = false