项目成本测算新增项目成本预算、核算、结算,季度分配调整可子合约规划分配
This commit is contained in:
@@ -4,7 +4,7 @@ import type { ProjectPlanningGuideDetailVO } from '@/api/tjt/planningGuideDetail
|
||||
export interface ProjectPlanningVO {
|
||||
id?: number
|
||||
projectId: number
|
||||
sortNo?: number
|
||||
sortNo?: string
|
||||
ownershipType: string
|
||||
calculationMethod: string
|
||||
planningContent: string
|
||||
@@ -55,7 +55,6 @@ export type ProjectPlanningSaveVO = Omit<
|
||||
| 'managementFee'
|
||||
| 'vatAmount'
|
||||
| 'projectBudgetOutputValue'
|
||||
| 'contractUnitPrice'
|
||||
| 'totalAdjustmentFactor'
|
||||
| 'assessmentArea'
|
||||
| 'virtualOutputValue'
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
import request from '@/config/axios'
|
||||
import type { ProjectPlanningVO } from '@/api/tjt/planning'
|
||||
import type { ProjectPlanningGuideDetailVO } from '@/api/tjt/planningGuideDetail'
|
||||
|
||||
export interface ProjectPlanningQuarterVO {
|
||||
id?: number
|
||||
planningId: number
|
||||
guideDetailId?: number
|
||||
guideDetailSortNo?: number
|
||||
distributionYear: number
|
||||
quarterNo: number
|
||||
distributionRatio?: number
|
||||
@@ -19,6 +22,17 @@ export type ProjectPlanningQuarterSaveVO = Omit<
|
||||
export interface ProjectPlanningQuarterPlanningDetailVO {
|
||||
planning: ProjectPlanningVO
|
||||
quarters: ProjectPlanningQuarterVO[]
|
||||
guideDetailMode?: boolean
|
||||
historyParentMode?: boolean
|
||||
message?: string
|
||||
parentQuarters?: ProjectPlanningQuarterVO[]
|
||||
guideDetails?: ProjectPlanningQuarterGuideDetailVO[]
|
||||
}
|
||||
|
||||
export interface ProjectPlanningQuarterGuideDetailVO extends ProjectPlanningGuideDetailVO {
|
||||
allocatedAmount?: number
|
||||
pendingAmount?: number
|
||||
quarters: ProjectPlanningQuarterVO[]
|
||||
}
|
||||
|
||||
export const getProjectPlanningQuarter = (id: number) => {
|
||||
|
||||
@@ -3,7 +3,7 @@ import request from '@/config/axios'
|
||||
export interface ProjectProfitVO {
|
||||
projectId: number
|
||||
projectName: string
|
||||
sortNo?: number
|
||||
sortNo?: string
|
||||
contractSignedFlag: boolean
|
||||
contractAmount?: number
|
||||
finalSettlementAmount?: number
|
||||
@@ -22,6 +22,47 @@ export interface ProjectProfitVO {
|
||||
profitLossRate?: number
|
||||
projectStartYear?: number
|
||||
createTime?: string
|
||||
budgetSnapshot?: ProjectProfitSnapshotVO
|
||||
accountingSnapshot?: ProjectProfitSnapshotVO
|
||||
settlementSnapshot?: ProjectProfitSnapshotVO
|
||||
}
|
||||
|
||||
export interface ProjectProfitSnapshotVO {
|
||||
id?: number
|
||||
projectId: number
|
||||
snapshotType: 'budget' | 'accounting' | 'settlement'
|
||||
lockedFlag?: boolean
|
||||
actionUserId?: number
|
||||
actionUserName?: string
|
||||
actionTime?: string
|
||||
contractAmount?: number
|
||||
finalSettlementAmount?: number
|
||||
effectiveSettlementAmount?: number
|
||||
comprehensivePlanningAmount?: number
|
||||
subcontractPlanningAmount?: number
|
||||
specialSubcontractPlanningAmount?: number
|
||||
sourceCoopSubcontractPlanningAmount?: number
|
||||
comprehensiveSubcontractPlanningAmount?: number
|
||||
majorOutputValue?: number
|
||||
majorExpectedPerformance?: number
|
||||
innovationOutputRate?: number
|
||||
innovationOutputValue?: number
|
||||
otherCost?: number
|
||||
profitLossValue?: number
|
||||
profitLossRate?: number
|
||||
assessmentResult?: string
|
||||
assessmentCoefficient?: number
|
||||
comprehensiveAccountingOutputValue?: number
|
||||
comprehensiveSettlementOutputValue?: number
|
||||
majorAccountingOutputValue?: number
|
||||
majorSettlementOutputValue?: number
|
||||
remark?: string
|
||||
}
|
||||
|
||||
export interface ProjectProfitSettlementSaveReqVO {
|
||||
projectId: number
|
||||
assessmentResult?: string
|
||||
remark?: string
|
||||
}
|
||||
|
||||
export interface ProjectProfitPageReqVO extends PageParam {
|
||||
@@ -38,3 +79,15 @@ export const getProjectProfitPage = (params: ProjectProfitPageReqVO) => {
|
||||
export const getProjectProfit = (projectId: number) => {
|
||||
return request.get({ url: '/tjt/profit/get', params: { projectId } })
|
||||
}
|
||||
|
||||
export const lockBudgetSnapshot = (projectId: number) => {
|
||||
return request.post({ url: '/tjt/profit/lock-budget', params: { projectId } })
|
||||
}
|
||||
|
||||
export const lockAccountingSnapshot = (projectId: number) => {
|
||||
return request.post({ url: '/tjt/profit/lock-accounting', params: { projectId } })
|
||||
}
|
||||
|
||||
export const saveSettlementSnapshot = (data: ProjectProfitSettlementSaveReqVO) => {
|
||||
return request.put({ url: '/tjt/profit/save-settlement', data })
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ export interface ProjectRolePersonVO {
|
||||
export interface ProjectVO {
|
||||
id?: number
|
||||
projectName: string
|
||||
sortNo?: number
|
||||
sortNo?: string
|
||||
contractSignedFlag: boolean
|
||||
contractAmount?: number
|
||||
totalConstructionArea?: number
|
||||
|
||||
@@ -124,7 +124,14 @@
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="合同单价(元/m²)">
|
||||
<el-input :model-value="contractUnitPricePreview" disabled />
|
||||
<el-input-number
|
||||
v-model="formData.contractUnitPrice"
|
||||
:min="0"
|
||||
:precision="4"
|
||||
:step="1"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -913,17 +920,6 @@ const guideDetailSummary = computed(() =>
|
||||
)
|
||||
)
|
||||
|
||||
const contractUnitPricePreview = computed(() => {
|
||||
const planningAmount = Number(formData.value.planningAmount || 0)
|
||||
const planningArea = showGuideDetailSection.value
|
||||
? Number(guideDetailSummary.value.designArea || 0)
|
||||
: Number(formData.value.planningArea || 0)
|
||||
if (!planningArea) {
|
||||
return formatAmountText(0)
|
||||
}
|
||||
return formatAmountText(planningAmount / planningArea)
|
||||
})
|
||||
|
||||
const formatFactorText = (value?: number, digits = 4) => {
|
||||
if (value === undefined || value === null) {
|
||||
return '-'
|
||||
@@ -1096,6 +1092,7 @@ const buildSavePayload = (): PlanningApi.ProjectPlanningSaveVO => ({
|
||||
sortNo: formData.value.sortNo,
|
||||
contractValueQuantity: formData.value.contractValueQuantity,
|
||||
contractValueUnitPrice: formData.value.contractValueUnitPrice,
|
||||
contractUnitPrice: formData.value.contractUnitPrice,
|
||||
managementFeeRate: formData.value.managementFeeRate,
|
||||
vatRate: formData.value.vatRate,
|
||||
implementationTeam: formData.value.implementationTeam,
|
||||
|
||||
@@ -51,17 +51,37 @@
|
||||
|
||||
<div class="mb-16px flex items-center justify-between">
|
||||
<div class="text-14px font-600">季度分配明细</div>
|
||||
<el-button plain @click="addDistributionYear">
|
||||
<el-button v-if="!historyParentMode" plain @click="addDistributionYear">
|
||||
<Icon class="mr-5px" icon="ep:plus" />
|
||||
新增年度
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<el-table v-loading="loading" :data="quarterRows" border>
|
||||
<el-alert
|
||||
v-if="guideDetailMode && historyParentMode"
|
||||
:title="historyMessage || '当前合约规划存在历史父级季度分配,请先清空历史父级分配后,再按指导价法明细维护。'"
|
||||
class="mb-16px"
|
||||
:closable="false"
|
||||
show-icon
|
||||
type="warning"
|
||||
/>
|
||||
|
||||
<div v-if="guideDetailMode && historyParentMode" class="mb-16px flex justify-end">
|
||||
<el-button plain type="danger" @click="clearHistoryParentQuarters">
|
||||
清空历史父级分配
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="quarterRows"
|
||||
border
|
||||
>
|
||||
<el-table-column align="center" label="分配年度" width="150">
|
||||
<template #default="scope">
|
||||
<el-date-picker
|
||||
:model-value="toYearPickerValue(scope.row.distributionYear)"
|
||||
:disabled="historyParentMode"
|
||||
class="!w-1/1"
|
||||
placeholder="请选择年度"
|
||||
type="year"
|
||||
@@ -72,7 +92,14 @@
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="操作" width="90" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button link type="danger" @click="removeDistributionYear(scope.row)">删除</el-button>
|
||||
<el-button
|
||||
:disabled="historyParentMode"
|
||||
link
|
||||
type="danger"
|
||||
@click="removeDistributionYear(scope.row)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
@@ -85,6 +112,7 @@
|
||||
<div class="flex flex-col gap-8px">
|
||||
<el-input-number
|
||||
:model-value="toQuarterPercent(scope.row, quarter.value)"
|
||||
:disabled="historyParentMode"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="0.01"
|
||||
@@ -99,7 +127,7 @@
|
||||
</el-table>
|
||||
|
||||
<template #footer>
|
||||
<el-button :disabled="loading" type="primary" @click="submitForm">保存</el-button>
|
||||
<el-button :disabled="loading || historyParentMode" type="primary" @click="submitForm">保存</el-button>
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
@@ -139,6 +167,10 @@ const formData = ref<PlanningApi.ProjectPlanningVO>({
|
||||
progressRemark: ''
|
||||
})
|
||||
const quarterRows = ref<QuarterYearRow[]>([])
|
||||
const guideDetailMode = ref(false)
|
||||
const historyParentMode = ref(false)
|
||||
const historyMessage = ref('')
|
||||
const activeGuideDetail = ref<PlanningQuarterApi.ProjectPlanningQuarterGuideDetailVO>()
|
||||
|
||||
const totalDistributionAmountPercent = computed({
|
||||
get: () => toPercentValue(formData.value.totalDistributionAmount),
|
||||
@@ -155,9 +187,12 @@ const formRules = reactive<FormRules>({
|
||||
const buildQuarterCell = (
|
||||
currentPlanningId: number,
|
||||
distributionYear: number,
|
||||
quarterNo: number
|
||||
quarterNo: number,
|
||||
guideDetail?: PlanningQuarterApi.ProjectPlanningQuarterGuideDetailVO
|
||||
): PlanningQuarterApi.ProjectPlanningQuarterVO => ({
|
||||
planningId: currentPlanningId,
|
||||
guideDetailId: guideDetail?.id,
|
||||
guideDetailSortNo: guideDetail?.sortNo,
|
||||
distributionYear,
|
||||
quarterNo,
|
||||
distributionRatio: undefined,
|
||||
@@ -166,7 +201,8 @@ const buildQuarterCell = (
|
||||
|
||||
const buildQuarterRows = (
|
||||
planning: PlanningApi.ProjectPlanningVO,
|
||||
quarters: PlanningQuarterApi.ProjectPlanningQuarterVO[]
|
||||
quarters: PlanningQuarterApi.ProjectPlanningQuarterVO[],
|
||||
guideDetail?: PlanningQuarterApi.ProjectPlanningQuarterGuideDetailVO
|
||||
) => {
|
||||
const yearSet = new Set<number>()
|
||||
if (planning.planningStartYear) {
|
||||
@@ -190,20 +226,25 @@ const buildQuarterRows = (
|
||||
const match = quarters.find(
|
||||
(item) =>
|
||||
Number(item.distributionYear) === distributionYear &&
|
||||
Number(item.quarterNo) === quarterNo
|
||||
Number(item.quarterNo) === quarterNo &&
|
||||
Number(item.guideDetailId || 0) === Number(guideDetail?.id || 0)
|
||||
)
|
||||
return match
|
||||
? { ...match }
|
||||
: buildQuarterCell(planning.id!, distributionYear, quarterNo)
|
||||
: buildQuarterCell(planning.id!, distributionYear, quarterNo, guideDetail)
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
const open = async (id: number) => {
|
||||
const open = async (id: number, guideDetailId?: number) => {
|
||||
planningId.value = id
|
||||
dialogVisible.value = true
|
||||
loading.value = true
|
||||
deletedQuarterIds.value = []
|
||||
guideDetailMode.value = false
|
||||
historyParentMode.value = false
|
||||
historyMessage.value = ''
|
||||
activeGuideDetail.value = undefined
|
||||
try {
|
||||
const detail = await PlanningQuarterApi.getProjectPlanningQuarterPlanningDetail(id)
|
||||
if (!detail?.planning) {
|
||||
@@ -217,6 +258,7 @@ const open = async (id: number) => {
|
||||
progressRemark: ''
|
||||
}
|
||||
quarterRows.value = []
|
||||
activeGuideDetail.value = undefined
|
||||
deletedQuarterIds.value = []
|
||||
dialogVisible.value = false
|
||||
message.warning('合约规划不存在或已被删除')
|
||||
@@ -231,7 +273,24 @@ const open = async (id: number) => {
|
||||
totalDistributionAmount: planning.totalDistributionAmount ?? 1,
|
||||
progressRemark: planning.progressRemark ?? ''
|
||||
}
|
||||
guideDetailMode.value = !!detail.guideDetailMode
|
||||
historyParentMode.value = !!detail.historyParentMode
|
||||
historyMessage.value = detail.message || ''
|
||||
if (guideDetailMode.value && !historyParentMode.value) {
|
||||
const targetGuideDetail = guideDetailId
|
||||
? (detail.guideDetails || []).find((item) => Number(item.id) === Number(guideDetailId))
|
||||
: undefined
|
||||
if (!targetGuideDetail) {
|
||||
quarterRows.value = []
|
||||
dialogVisible.value = false
|
||||
message.warning('请先在外层选择指导价法明细')
|
||||
return
|
||||
}
|
||||
activeGuideDetail.value = targetGuideDetail
|
||||
quarterRows.value = buildQuarterRows(formData.value, targetGuideDetail.quarters || [], targetGuideDetail)
|
||||
} else {
|
||||
quarterRows.value = buildQuarterRows(formData.value, detail.quarters || [])
|
||||
}
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
@@ -252,7 +311,7 @@ const addDistributionYear = () => {
|
||||
quarterRows.value.push({
|
||||
distributionYear,
|
||||
quarters: QUARTER_OPTIONS.map((item) =>
|
||||
buildQuarterCell(planningId.value!, distributionYear, item.value)
|
||||
buildQuarterCell(planningId.value!, distributionYear, item.value, activeGuideDetail.value)
|
||||
)
|
||||
})
|
||||
}
|
||||
@@ -267,6 +326,30 @@ const removeDistributionYear = (row: QuarterYearRow) => {
|
||||
quarterRows.value = quarterRows.value.filter((item) => item !== row)
|
||||
}
|
||||
|
||||
const clearHistoryParentQuarters = async () => {
|
||||
if (!planningId.value) {
|
||||
return
|
||||
}
|
||||
const ids = quarterRows.value
|
||||
.flatMap((row) => row.quarters)
|
||||
.map((item) => item.id)
|
||||
.filter((id): id is number => typeof id === 'number')
|
||||
if (!ids.length) {
|
||||
message.warning('没有可清空的历史父级分配')
|
||||
return
|
||||
}
|
||||
await message.confirm('确认清空历史父级季度分配吗?清空后需要按指导价法明细重新录入。')
|
||||
loading.value = true
|
||||
try {
|
||||
await PlanningQuarterApi.deleteProjectPlanningQuarterList(Array.from(new Set(ids)))
|
||||
message.success('历史父级分配已清空,请在外层选择序号后重新录入')
|
||||
dialogVisible.value = false
|
||||
emit('success')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const toYearPickerValue = (value?: number) => (value ? String(value) : undefined)
|
||||
|
||||
const updateDistributionYear = (row: QuarterYearRow, value?: string) => {
|
||||
@@ -303,6 +386,8 @@ const buildQuarterSavePayload = (
|
||||
): PlanningQuarterApi.ProjectPlanningQuarterSaveVO => ({
|
||||
id: quarter.id,
|
||||
planningId: planningId.value!,
|
||||
guideDetailId: quarter.guideDetailId,
|
||||
guideDetailSortNo: quarter.guideDetailSortNo,
|
||||
distributionYear: row.distributionYear,
|
||||
quarterNo: quarter.quarterNo,
|
||||
distributionRatio: quarter.distributionRatio
|
||||
|
||||
@@ -307,9 +307,10 @@
|
||||
</div>
|
||||
<el-button
|
||||
v-hasPermi="['tjt:planning:update', 'tjt:planning-quarter:update', 'tjt:planning-quarter:create']"
|
||||
:disabled="guideDetailMode && !historyParentMode && !activeGuideDetail"
|
||||
plain
|
||||
type="primary"
|
||||
@click="openQuarterDistributionForm"
|
||||
@click="openQuarterDistributionForm(activeGuideDetail?.id)"
|
||||
>
|
||||
编辑季度分配
|
||||
</el-button>
|
||||
@@ -328,7 +329,13 @@
|
||||
<div class="rounded-8px bg-[var(--el-fill-color-light)] px-16px py-12px">
|
||||
<div class="text-12px text-[var(--el-text-color-secondary)]">已分配</div>
|
||||
<div class="mt-6px text-18px font-600">
|
||||
{{ formatPercentText(currentPlanning.allocatedAmount) }}
|
||||
{{
|
||||
formatPercentText(
|
||||
guideDetailMode && activeGuideDetail
|
||||
? activeGuideDetail.allocatedAmount
|
||||
: currentPlanning.allocatedAmount
|
||||
)
|
||||
}}
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
@@ -336,7 +343,13 @@
|
||||
<div class="rounded-8px bg-[var(--el-fill-color-light)] px-16px py-12px">
|
||||
<div class="text-12px text-[var(--el-text-color-secondary)]">待分配</div>
|
||||
<div class="mt-6px text-18px font-600">
|
||||
{{ formatPercentText(currentPlanning.pendingAmount) }}
|
||||
{{
|
||||
formatPercentText(
|
||||
guideDetailMode && activeGuideDetail
|
||||
? activeGuideDetail.pendingAmount
|
||||
: currentPlanning.pendingAmount
|
||||
)
|
||||
}}
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
@@ -350,7 +363,63 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-table :data="quarterRows" border>
|
||||
<template v-if="guideDetailMode && !historyParentMode">
|
||||
<el-empty
|
||||
v-if="!guideDetailRows.length"
|
||||
description="暂无指导价法明细,请先维护指导价法明细"
|
||||
/>
|
||||
<template v-else>
|
||||
<el-tabs v-model="activeGuideDetailTab" class="mb-12px" type="card">
|
||||
<el-tab-pane
|
||||
v-for="detail in guideDetailRows"
|
||||
:key="detail.tabKey"
|
||||
:label="`序号 ${detail.sortNo || '-'}`"
|
||||
:name="detail.tabKey"
|
||||
/>
|
||||
</el-tabs>
|
||||
|
||||
<el-descriptions
|
||||
v-if="activeGuideDetail"
|
||||
:column="4"
|
||||
border
|
||||
class="mb-12px"
|
||||
size="small"
|
||||
>
|
||||
<el-descriptions-item label="设计部位">
|
||||
{{ getDesignPartLabel(activeGuideDetail.designPart) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="设计内容/设计类型">
|
||||
{{ activeGuideDetail.buildingType || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="设计面积">
|
||||
{{ formatAreaText(activeGuideDetail.designArea) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="考核产值小计">
|
||||
{{ formatAmountText(activeGuideDetail.assessmentOutputValue) }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<el-table :data="activeGuideDetailQuarterRows" border>
|
||||
<el-table-column align="center" label="分配年度" width="150" prop="distributionYear" />
|
||||
<el-table-column
|
||||
v-for="quarter in QUARTER_OPTIONS"
|
||||
:key="quarter.value"
|
||||
:label="quarter.label"
|
||||
min-width="220"
|
||||
>
|
||||
<template #default="scope">
|
||||
<div class="flex flex-col gap-8px">
|
||||
<div class="rounded-6px bg-[var(--el-fill-color-light)] px-10px py-8px text-12px">
|
||||
分配比例:{{ formatQuarterRatio(scope.row, quarter.value) }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<el-table v-else :data="quarterRows" border>
|
||||
<el-table-column align="center" label="分配年度" width="150" prop="distributionYear" />
|
||||
<el-table-column
|
||||
v-for="quarter in QUARTER_OPTIONS"
|
||||
@@ -399,6 +468,7 @@ import {
|
||||
formatPercentText,
|
||||
getCalculationMethodLabel,
|
||||
getCalculationRatioLabel,
|
||||
getDesignPartLabel,
|
||||
getDesignStageLabel,
|
||||
getOwnershipTypeLabel,
|
||||
getVirtualCalculationMethodLabel,
|
||||
@@ -416,6 +486,11 @@ interface QuarterYearRow {
|
||||
quarters: PlanningQuarterApi.ProjectPlanningQuarterVO[]
|
||||
}
|
||||
|
||||
interface GuideDetailQuarterRow extends PlanningQuarterApi.ProjectPlanningQuarterGuideDetailVO {
|
||||
tabKey: string
|
||||
quarterRows: QuarterYearRow[]
|
||||
}
|
||||
|
||||
const message = useMessage()
|
||||
|
||||
const loading = ref(false)
|
||||
@@ -427,6 +502,10 @@ const planningList = ref<PlanningApi.ProjectPlanningVO[]>([])
|
||||
const currentProject = ref<ProjectApi.ProjectVO>()
|
||||
const currentPlanning = ref<PlanningApi.ProjectPlanningVO>()
|
||||
const quarterRows = ref<QuarterYearRow[]>([])
|
||||
const guideDetailMode = ref(false)
|
||||
const historyParentMode = ref(false)
|
||||
const guideDetailRows = ref<GuideDetailQuarterRow[]>([])
|
||||
const activeGuideDetailTab = ref('')
|
||||
const queryFormRef = ref()
|
||||
const projectTableRef = ref()
|
||||
const planningTableRef = ref()
|
||||
@@ -479,6 +558,13 @@ const showParentInternalGuidanceUnitPrice = computed(
|
||||
currentPlanning.value?.internalGuidanceUnitPrice !== undefined &&
|
||||
currentPlanning.value?.internalGuidanceUnitPrice !== null
|
||||
)
|
||||
const activeGuideDetail = computed(() => {
|
||||
return (
|
||||
guideDetailRows.value.find((item) => item.tabKey === activeGuideDetailTab.value) ||
|
||||
guideDetailRows.value[0]
|
||||
)
|
||||
})
|
||||
const activeGuideDetailQuarterRows = computed(() => activeGuideDetail.value?.quarterRows || [])
|
||||
|
||||
const formatFactorText = (value?: number, digits = 4) => {
|
||||
if (value === undefined || value === null) {
|
||||
@@ -536,6 +622,14 @@ const buildQuarterRows = (
|
||||
}))
|
||||
}
|
||||
|
||||
const resetQuarterDetailState = () => {
|
||||
quarterRows.value = []
|
||||
guideDetailMode.value = false
|
||||
historyParentMode.value = false
|
||||
guideDetailRows.value = []
|
||||
activeGuideDetailTab.value = ''
|
||||
}
|
||||
|
||||
const getProjectList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
@@ -546,7 +640,7 @@ const getProjectList = async () => {
|
||||
currentProject.value = undefined
|
||||
planningList.value = []
|
||||
currentPlanning.value = undefined
|
||||
quarterRows.value = []
|
||||
resetQuarterDetailState()
|
||||
return
|
||||
}
|
||||
const targetProjectId = currentProject.value?.id || projectList.value[0].id
|
||||
@@ -563,7 +657,7 @@ const getPlanningList = async () => {
|
||||
if (!currentProject.value?.id) {
|
||||
planningList.value = []
|
||||
currentPlanning.value = undefined
|
||||
quarterRows.value = []
|
||||
resetQuarterDetailState()
|
||||
return
|
||||
}
|
||||
planningLoading.value = true
|
||||
@@ -571,7 +665,7 @@ const getPlanningList = async () => {
|
||||
planningList.value = await PlanningApi.getProjectPlanningListByProjectId(currentProject.value.id)
|
||||
if (!planningList.value.length) {
|
||||
currentPlanning.value = undefined
|
||||
quarterRows.value = []
|
||||
resetQuarterDetailState()
|
||||
return
|
||||
}
|
||||
const targetPlanningId = currentPlanning.value?.id || planningList.value[0].id
|
||||
@@ -589,7 +683,23 @@ const loadPlanningDetail = async (planningId: number) => {
|
||||
try {
|
||||
const detail = await PlanningQuarterApi.getProjectPlanningQuarterPlanningDetail(planningId)
|
||||
currentPlanning.value = detail?.planning
|
||||
quarterRows.value = detail?.planning ? buildQuarterRows(detail.planning, detail.quarters || []) : []
|
||||
guideDetailMode.value = !!detail?.guideDetailMode
|
||||
historyParentMode.value = !!detail?.historyParentMode
|
||||
if (!detail?.planning) {
|
||||
resetQuarterDetailState()
|
||||
return
|
||||
}
|
||||
quarterRows.value = buildQuarterRows(detail.planning, detail.quarters || [])
|
||||
guideDetailRows.value = (detail.guideDetails || []).map((item, index) => ({
|
||||
...item,
|
||||
tabKey: String(item.id || item.sortNo || index),
|
||||
quarterRows: buildQuarterRows(detail.planning!, item.quarters || [])
|
||||
}))
|
||||
const currentTab = activeGuideDetailTab.value
|
||||
activeGuideDetailTab.value =
|
||||
guideDetailRows.value.find((item) => item.tabKey === currentTab)?.tabKey ||
|
||||
guideDetailRows.value[0]?.tabKey ||
|
||||
''
|
||||
} finally {
|
||||
quarterLoading.value = false
|
||||
}
|
||||
@@ -613,7 +723,7 @@ const handleCurrentProjectChange = async (row?: ProjectApi.ProjectVO) => {
|
||||
const handleCurrentPlanningChange = async (row?: PlanningApi.ProjectPlanningVO) => {
|
||||
if (!row?.id) {
|
||||
currentPlanning.value = undefined
|
||||
quarterRows.value = []
|
||||
resetQuarterDetailState()
|
||||
return
|
||||
}
|
||||
await loadPlanningDetail(row.id)
|
||||
@@ -630,12 +740,15 @@ const openPlanningOutputForm = () => {
|
||||
planningOutputFormRef.value.open(currentPlanning.value.id)
|
||||
}
|
||||
|
||||
const openQuarterDistributionForm = () => {
|
||||
const openQuarterDistributionForm = (guideDetailId?: number) => {
|
||||
if (!currentPlanning.value?.id) {
|
||||
message.warning('请先选择合约规划')
|
||||
return
|
||||
}
|
||||
quarterDistributionFormRef.value.open(currentPlanning.value.id)
|
||||
quarterDistributionFormRef.value.open(
|
||||
currentPlanning.value.id,
|
||||
guideDetailMode.value && !historyParentMode.value ? guideDetailId : undefined
|
||||
)
|
||||
}
|
||||
|
||||
const handlePlanningOutputFormSuccess = async () => {
|
||||
|
||||
@@ -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>
|
||||
<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"
|
||||
>
|
||||
目标责任书下达
|
||||
</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(currentProfit.contractAmount) }}
|
||||
{{ formatAmountText(budgetDisplay.contractAmount) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="结算合同总产值(元)">
|
||||
{{ formatAmountText(currentProfit.finalSettlementAmount) }}
|
||||
{{ formatAmountText(budgetDisplay.finalSettlementAmount) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="项目预算产值总计(元)">
|
||||
<el-tooltip
|
||||
v-if="isUsingContractAmount(currentProfit)"
|
||||
content="结算合同总产值未填写,当前暂按合同总产值测算"
|
||||
placement="top"
|
||||
>
|
||||
<span>{{ formatAmountText(currentProfit.effectiveSettlementAmount) }}</span>
|
||||
</el-tooltip>
|
||||
<span v-else>{{ formatAmountText(currentProfit.effectiveSettlementAmount) }}</span>
|
||||
{{ formatAmountText(budgetDisplay.effectiveSettlementAmount) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="项目开始年度">
|
||||
{{ currentProfit.projectStartYear || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="综合所人工成本(元)">
|
||||
{{ formatAmountText(currentProfit.comprehensivePlanningAmount) }}
|
||||
{{ formatAmountText(budgetDisplay.comprehensivePlanningAmount) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="专项分包-专业所人工成本(元)">
|
||||
{{ formatAmountText(currentProfit.specialSubcontractPlanningAmount) }}
|
||||
<el-descriptions-item label="专项分包(专业所成本)(元)">
|
||||
{{ formatAmountText(budgetDisplay.specialSubcontractPlanningAmount) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="专项分包-源头合作分包人工成本(元)">
|
||||
{{ formatAmountText(currentProfit.sourceCoopSubcontractPlanningAmount) }}
|
||||
<el-descriptions-item label="专项分包(源头合作成本)(元)">
|
||||
{{ formatAmountText(budgetDisplay.sourceCoopSubcontractPlanningAmount) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="专项分包-综合所人工成本(元)">
|
||||
{{ formatAmountText(currentProfit.comprehensiveSubcontractPlanningAmount) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="专业所考核产值(元)">
|
||||
{{ formatAmountText(currentProfit.majorOutputValue) }}
|
||||
<el-descriptions-item label="专项分包(综合所成本)(元)">
|
||||
{{ formatAmountText(budgetDisplay.comprehensiveSubcontractPlanningAmount) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="专业所人工成本(元)">
|
||||
{{ formatAmountText(currentProfit.majorExpectedPerformance) }}
|
||||
{{ formatAmountText(budgetDisplay.majorExpectedPerformance) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="专业所考核产值(元)">
|
||||
{{ formatAmountText(budgetDisplay.majorOutputValue) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="科创产值比例">
|
||||
{{ formatPercentText(currentProfit.innovationOutputRate) }}
|
||||
{{ formatPercentText(budgetDisplay.innovationOutputRate) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="科创产值(元)">
|
||||
{{ formatAmountText(currentProfit.innovationOutputValue) }}
|
||||
{{ formatAmountText(budgetDisplay.innovationOutputValue) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="其他成本(元)">
|
||||
{{ formatAmountText(currentProfit.otherCost) }}
|
||||
{{ formatAmountText(budgetDisplay.otherCost) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="预算盈亏值(元)">
|
||||
<span :class="profitLossClass(currentProfit.profitLossValue)">
|
||||
{{ formatAmountText(currentProfit.profitLossValue) }}
|
||||
<span :class="profitLossClass(budgetDisplay.profitLossValue)">
|
||||
{{ formatAmountText(budgetDisplay.profitLossValue) }}
|
||||
</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="预算盈亏百分比">
|
||||
<span :class="profitLossClass(currentProfit.profitLossValue)">
|
||||
{{ formatPercentText(currentProfit.profitLossRate) }}
|
||||
<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
|
||||
|
||||
|
||||
@@ -132,13 +132,11 @@
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="排序" prop="sortNo">
|
||||
<el-input-number
|
||||
<el-input
|
||||
v-model="formData.sortNo"
|
||||
:min="0"
|
||||
:precision="0"
|
||||
:step="1"
|
||||
maxlength="50"
|
||||
placeholder="请输入排序,如 A-01"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -174,7 +172,7 @@ const createFormData = (
|
||||
planningAmount?: number
|
||||
): PlanningApi.ProjectPlanningVO => ({
|
||||
projectId: projectId || 0,
|
||||
sortNo: 0,
|
||||
sortNo: '',
|
||||
ownershipType: ownershipTypeOptions[0].value,
|
||||
calculationMethod: '',
|
||||
planningContent: '',
|
||||
@@ -285,7 +283,7 @@ const formRules = reactive<FormRules>({
|
||||
const buildSavePayload = (): PlanningApi.ProjectPlanningSaveVO => ({
|
||||
id: formData.value.id,
|
||||
projectId: formData.value.projectId,
|
||||
sortNo: formData.value.sortNo ?? 0,
|
||||
sortNo: formData.value.sortNo?.trim() || undefined,
|
||||
ownershipType: formData.value.ownershipType,
|
||||
calculationMethod: formData.value.calculationMethod,
|
||||
planningContent: formData.value.planningContent,
|
||||
|
||||
@@ -155,13 +155,11 @@
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="排序" prop="sortNo">
|
||||
<el-input-number
|
||||
<el-input
|
||||
v-model="formData.sortNo"
|
||||
:min="0"
|
||||
:precision="0"
|
||||
:step="1"
|
||||
maxlength="50"
|
||||
placeholder="请输入排序,如 A-01"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -311,7 +309,7 @@ const createRolePerson = (
|
||||
|
||||
const createFormData = (): ProjectApi.ProjectVO => ({
|
||||
projectName: '',
|
||||
sortNo: 0,
|
||||
sortNo: '',
|
||||
contractSignedFlag: true,
|
||||
contractAmount: undefined,
|
||||
totalConstructionArea: undefined,
|
||||
@@ -494,7 +492,7 @@ const emit = defineEmits(['success'])
|
||||
const buildSavePayload = (): ProjectApi.ProjectSaveVO => ({
|
||||
id: formData.value.id,
|
||||
projectName: formData.value.projectName,
|
||||
sortNo: formData.value.sortNo ?? 0,
|
||||
sortNo: formData.value.sortNo?.trim() || undefined,
|
||||
contractSignedFlag: formData.value.contractSignedFlag,
|
||||
contractAmount: formData.value.contractAmount,
|
||||
totalConstructionArea: formData.value.totalConstructionArea,
|
||||
|
||||
Reference in New Issue
Block a user