Compare commits

..

10 Commits

23 changed files with 2872 additions and 899 deletions

View File

@@ -4,7 +4,7 @@ import type { ProjectPlanningGuideDetailVO } from '@/api/tjt/planningGuideDetail
export interface ProjectPlanningVO { export interface ProjectPlanningVO {
id?: number id?: number
projectId: number projectId: number
sortNo?: number sortNo?: string
ownershipType: string ownershipType: string
calculationMethod: string calculationMethod: string
planningContent: string planningContent: string
@@ -55,7 +55,6 @@ export type ProjectPlanningSaveVO = Omit<
| 'managementFee' | 'managementFee'
| 'vatAmount' | 'vatAmount'
| 'projectBudgetOutputValue' | 'projectBudgetOutputValue'
| 'contractUnitPrice'
| 'totalAdjustmentFactor' | 'totalAdjustmentFactor'
| 'assessmentArea' | 'assessmentArea'
| 'virtualOutputValue' | 'virtualOutputValue'

View File

@@ -1,9 +1,12 @@
import request from '@/config/axios' import request from '@/config/axios'
import type { ProjectPlanningVO } from '@/api/tjt/planning' import type { ProjectPlanningVO } from '@/api/tjt/planning'
import type { ProjectPlanningGuideDetailVO } from '@/api/tjt/planningGuideDetail'
export interface ProjectPlanningQuarterVO { export interface ProjectPlanningQuarterVO {
id?: number id?: number
planningId: number planningId: number
guideDetailId?: number
guideDetailSortNo?: number
distributionYear: number distributionYear: number
quarterNo: number quarterNo: number
distributionRatio?: number distributionRatio?: number
@@ -19,6 +22,17 @@ export type ProjectPlanningQuarterSaveVO = Omit<
export interface ProjectPlanningQuarterPlanningDetailVO { export interface ProjectPlanningQuarterPlanningDetailVO {
planning: ProjectPlanningVO planning: ProjectPlanningVO
quarters: ProjectPlanningQuarterVO[] 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) => { export const getProjectPlanningQuarter = (id: number) => {

View File

@@ -3,13 +3,16 @@ import request from '@/config/axios'
export interface ProjectProfitVO { export interface ProjectProfitVO {
projectId: number projectId: number
projectName: string projectName: string
sortNo?: number sortNo?: string
contractSignedFlag: boolean contractSignedFlag: boolean
contractAmount?: number contractAmount?: number
finalSettlementAmount?: number finalSettlementAmount?: number
effectiveSettlementAmount?: number effectiveSettlementAmount?: number
comprehensivePlanningAmount?: number comprehensivePlanningAmount?: number
subcontractPlanningAmount?: number subcontractPlanningAmount?: number
specialSubcontractPlanningAmount?: number
sourceCoopSubcontractPlanningAmount?: number
comprehensiveSubcontractPlanningAmount?: number
majorOutputValue?: number majorOutputValue?: number
majorExpectedPerformance?: number majorExpectedPerformance?: number
innovationOutputRate?: number innovationOutputRate?: number
@@ -19,6 +22,47 @@ export interface ProjectProfitVO {
profitLossRate?: number profitLossRate?: number
projectStartYear?: number projectStartYear?: number
createTime?: string 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 { export interface ProjectProfitPageReqVO extends PageParam {
@@ -35,3 +79,15 @@ export const getProjectProfitPage = (params: ProjectProfitPageReqVO) => {
export const getProjectProfit = (projectId: number) => { export const getProjectProfit = (projectId: number) => {
return request.get({ url: '/tjt/profit/get', params: { projectId } }) 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 })
}

View File

@@ -13,7 +13,7 @@ export interface ProjectRolePersonVO {
export interface ProjectVO { export interface ProjectVO {
id?: number id?: number
projectName: string projectName: string
sortNo?: number sortNo?: string
contractSignedFlag: boolean contractSignedFlag: boolean
contractAmount?: number contractAmount?: number
totalConstructionArea?: number totalConstructionArea?: number

View File

@@ -79,14 +79,144 @@ export interface ProjectBudgetExportReqVO {
year?: number year?: number
} }
export interface ProjectBudgetPreviewRespVO {
year?: number
projectCode?: string
projectName?: string
remark?: string
budgetRows?: ProjectBudgetPreviewBudgetRow[]
quarterBudgetRows?: ProjectBudgetPreviewQuarterRow[]
}
export interface ProjectBudgetPreviewBudgetRow {
rowType?: string
planningId?: number
planningContent?: string
displayDesignPart?: string
displayBuildingType?: string
internalGuidanceUnitPrice?: number
designArea?: number
buildingOrUnitCount?: number
drawingSetFactor?: number
scaleFactor?: number
modificationFactor?: number
complexityFactor?: number
subtotalArea?: number
currentDesignStageRatio?: number
assessmentOutputValueWan?: number
}
export interface ProjectBudgetPreviewQuarterRow {
serialNo?: number
totalRow?: boolean
outputType?: string
designContent?: string
budgetYear?: number
totalDesignArea?: number
totalAssessmentArea?: number
totalAssessmentOutputWan?: number
designStageRatio?: number
designStageOutputWan?: number
historicalIssuedRatio?: number
quarterOneRatio?: number
quarterTwoRatio?: number
quarterThreeRatio?: number
quarterFourRatio?: number
currentYearRatio?: number
pendingRatio?: number
quarterOneAmountWan?: number
quarterTwoAmountWan?: number
quarterThreeAmountWan?: number
quarterFourAmountWan?: number
yearTotalAmountWan?: number
ratioRemark?: string
}
export interface ProjectQuarterOutputExportReqVO { export interface ProjectQuarterOutputExportReqVO {
planningId: number projectId: number
year?: number year?: number
} }
export interface ProjectLeadQuarterOutputExportReqVO { export interface ProjectQuarterOutputPreviewRespVO {
planningId: number projectCode?: string
projectName?: string
year?: number year?: number
rows?: ProjectQuarterOutputPreviewRow[]
}
export interface ProjectQuarterOutputPreviewRow {
serialNo?: number
totalRow?: boolean
placeholderRow?: boolean
outputType?: string
designContent?: string
quarterOneAmountWan?: number
quarterTwoAmountWan?: number
quarterThreeAmountWan?: number
quarterFourAmountWan?: number
yearTotalAmountWan?: number
projectLeadRatio?: number
projectLeadAssessmentOutputWan?: number
projectLeadQuarterOneAmountWan?: number
projectLeadQuarterTwoAmountWan?: number
projectLeadQuarterThreeAmountWan?: number
projectLeadQuarterFourAmountWan?: number
projectLeadYearTotalAmountWan?: number
officeRatio?: number
officeAssessmentOutputWan?: number
officeQuarterOneAmountWan?: number
officeQuarterTwoAmountWan?: number
officeQuarterThreeAmountWan?: number
officeQuarterFourAmountWan?: number
officeYearTotalAmountWan?: number
archRatio?: number
decorRatio?: number
structRatio?: number
waterRatio?: number
hvacRatio?: number
elecRatio?: number
digitalRatio?: number
archAssessmentOutputWan?: number
decorAssessmentOutputWan?: number
structAssessmentOutputWan?: number
waterAssessmentOutputWan?: number
hvacAssessmentOutputWan?: number
elecAssessmentOutputWan?: number
digitalAssessmentOutputWan?: number
}
export interface ProjectLeadQuarterOutputExportReqVO {
projectId: number
year?: number
}
export interface ProjectLeadQuarterOutputPreviewRespVO {
projectName?: string
year?: number
projectManagerNames?: string
engineeringPrincipalNames?: string
rows?: ProjectLeadQuarterOutputPreviewRow[]
}
export interface ProjectLeadQuarterOutputPreviewRow {
serialNo?: number
outputType?: string
designContent?: string
subtotalRow?: boolean
projectManagerNames?: string
projectManagerRatio?: number
engineeringPrincipalNames?: string
engineeringPrincipalRatio?: number
projectManagerQuarterOneAmountWan?: number
projectManagerQuarterTwoAmountWan?: number
projectManagerQuarterThreeAmountWan?: number
projectManagerQuarterFourAmountWan?: number
projectManagerYearTotalAmountWan?: number
engineeringPrincipalQuarterOneAmountWan?: number
engineeringPrincipalQuarterTwoAmountWan?: number
engineeringPrincipalQuarterThreeAmountWan?: number
engineeringPrincipalQuarterFourAmountWan?: number
engineeringPrincipalYearTotalAmountWan?: number
} }
export interface SpecialtyPersonOutputExportReqVO { export interface SpecialtyPersonOutputExportReqVO {
@@ -158,6 +288,13 @@ export const exportProjectBudget = (params: ProjectBudgetExportReqVO) => {
return request.download({ url: '/tjt/report/project-budget/export-excel', params }) return request.download({ url: '/tjt/report/project-budget/export-excel', params })
} }
export const getProjectBudgetPreview = (params: ProjectBudgetExportReqVO) => {
return request.get<ProjectBudgetPreviewRespVO>({
url: '/tjt/report/project-budget/preview',
params: { ...params, _t: Date.now() }
})
}
export const exportProjectQuarterOutput = (params: ProjectQuarterOutputExportReqVO) => { export const exportProjectQuarterOutput = (params: ProjectQuarterOutputExportReqVO) => {
return request.download({ return request.download({
url: '/tjt/report/project-quarter-output/export-excel', url: '/tjt/report/project-quarter-output/export-excel',
@@ -165,6 +302,13 @@ export const exportProjectQuarterOutput = (params: ProjectQuarterOutputExportReq
}) })
} }
export const getProjectQuarterOutputPreview = (params: ProjectQuarterOutputExportReqVO) => {
return request.get<ProjectQuarterOutputPreviewRespVO>({
url: '/tjt/report/project-quarter-output/preview',
params: { ...params, _t: Date.now() }
})
}
export const exportProjectLeadQuarterOutput = (params: ProjectLeadQuarterOutputExportReqVO) => { export const exportProjectLeadQuarterOutput = (params: ProjectLeadQuarterOutputExportReqVO) => {
return request.download({ return request.download({
url: '/tjt/report/project-lead-quarter-output/export-excel', url: '/tjt/report/project-lead-quarter-output/export-excel',
@@ -172,6 +316,13 @@ export const exportProjectLeadQuarterOutput = (params: ProjectLeadQuarterOutputE
}) })
} }
export const getProjectLeadQuarterOutputPreview = (params: ProjectLeadQuarterOutputExportReqVO) => {
return request.get<ProjectLeadQuarterOutputPreviewRespVO>({
url: '/tjt/report/project-lead-quarter-output/preview',
params: { ...params, _t: Date.now() }
})
}
export const exportSpecialtyPersonOutput = (params: SpecialtyPersonOutputExportReqVO) => { export const exportSpecialtyPersonOutput = (params: SpecialtyPersonOutputExportReqVO) => {
return request.download({ url: '/tjt/report/specialty-person-output/export-excel', params }) return request.download({ url: '/tjt/report/specialty-person-output/export-excel', params })
} }

View File

@@ -142,7 +142,7 @@
width="180" width="180"
:formatter="dateFormatter" :formatter="dateFormatter"
/> />
<el-table-column align="center" fixed="right" label="操作" width="160"> <el-table-column align="center" fixed="right" label="操作" width="100">
<template #default="scope"> <template #default="scope">
<el-button <el-button
v-hasPermi="['tjt:employee:update']" v-hasPermi="['tjt:employee:update']"
@@ -152,14 +152,6 @@
> >
编辑 编辑
</el-button> </el-button>
<el-button
v-hasPermi="['tjt:employee:delete']"
link
type="danger"
@click="handleDelete(scope.row.id)"
>
删除
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@@ -495,15 +487,6 @@ const submitForm = async () => {
} }
} }
const handleDelete = async (id: number) => {
try {
await message.delConfirm()
await EmployeeApi.deleteEmployee(id)
message.success(t('common.delSuccess'))
await getList()
} catch {}
}
let activatedOnce = false let activatedOnce = false
onMounted(async () => { onMounted(async () => {

View File

@@ -71,8 +71,8 @@
/> />
</ContentWrap> </ContentWrap>
<el-row :gutter="16"> <SplitPane>
<el-col :span="8"> <template #left>
<ContentWrap> <ContentWrap>
<div class="mb-12px text-14px font-600"> <div class="mb-12px text-14px font-600">
{{ currentProject?.projectName || '合约规划列表' }} {{ currentProject?.projectName || '合约规划列表' }}
@@ -84,7 +84,6 @@
highlight-current-row highlight-current-row
@current-change="handleCurrentPlanningChange" @current-change="handleCurrentPlanningChange"
> >
<el-table-column align="center" label="序号" type="index" width="70" />
<el-table-column align="center" label="项目任务包" min-width="180" prop="planningContent" /> <el-table-column align="center" label="项目任务包" min-width="180" prop="planningContent" />
<el-table-column align="center" label="归属类型" min-width="110"> <el-table-column align="center" label="归属类型" min-width="110">
<template #default="scope"> <template #default="scope">
@@ -99,10 +98,16 @@
</el-table-column> </el-table-column>
<el-table-column align="center" label="排序" prop="sortNo" width="80" /> <el-table-column align="center" label="排序" prop="sortNo" width="80" />
</el-table> </el-table>
<PlanningOwnershipSummary
:planning-list="planningList"
amount-field="assessmentOutputValue"
amount-label="考核产值()"
title="归属类型考核产值合计"
/>
</ContentWrap> </ContentWrap>
</el-col> </template>
<el-col :span="16"> <template #right>
<ContentWrap> <ContentWrap>
<div v-loading="quarterLoading" class="min-h-320px"> <div v-loading="quarterLoading" class="min-h-320px">
<template v-if="currentPlanning && formData"> <template v-if="currentPlanning && formData">
@@ -224,8 +229,8 @@
<el-empty v-else-if="!quarterLoading" description="请选择合约规划后查看分配结果" /> <el-empty v-else-if="!quarterLoading" description="请选择合约规划后查看分配结果" />
</div> </div>
</ContentWrap> </ContentWrap>
</el-col> </template>
</el-row> </SplitPane>
<Dialog v-model="dialogVisible" title="编辑专业及项目总分配比例" width="920"> <Dialog v-model="dialogVisible" title="编辑专业及项目总分配比例" width="920">
<template v-if="editForm"> <template v-if="editForm">
@@ -288,10 +293,13 @@ import * as ProjectApi from '@/api/tjt/project'
import * as PlanningApi from '@/api/tjt/planning' import * as PlanningApi from '@/api/tjt/planning'
import * as PlanningQuarterApi from '@/api/tjt/planningQuarter' import * as PlanningQuarterApi from '@/api/tjt/planningQuarter'
import * as OutputSplitApi from '@/api/tjt/outputSplit' import * as OutputSplitApi from '@/api/tjt/outputSplit'
import PlanningOwnershipSummary from '@/views/tjt/shared/PlanningOwnershipSummary.vue'
import SplitPane from '@/views/tjt/shared/SplitPane.vue'
import { import {
formatAmountText, formatAmountText,
fromPercentValue, fromPercentValue,
getOwnershipTypeLabel, getOwnershipTypeLabel,
OUTPUT_SPLIT_SPECIALTY,
OUTPUT_SPLIT_SPECIALTY_OPTIONS, OUTPUT_SPLIT_SPECIALTY_OPTIONS,
QUARTER_OPTIONS, QUARTER_OPTIONS,
toPercentValue toPercentValue
@@ -299,15 +307,7 @@ import {
defineOptions({ name: 'TjtOutputSplit' }) defineOptions({ name: 'TjtOutputSplit' })
type AnnualCategoryKey = type AnnualCategoryKey = (typeof OUTPUT_SPLIT_SPECIALTY)[keyof typeof OUTPUT_SPLIT_SPECIALTY]
| 'project_lead'
| 'arch'
| 'decor'
| 'struct'
| 'water'
| 'elec'
| 'hvac'
| 'digital'
interface QuarterYearRow { interface QuarterYearRow {
distributionYear: number distributionYear: number
@@ -315,14 +315,14 @@ interface QuarterYearRow {
} }
const annualCategoryOptions: { label: string; value: AnnualCategoryKey }[] = [ const annualCategoryOptions: { label: string; value: AnnualCategoryKey }[] = [
{ label: '项目经理/工程负责人', value: 'project_lead' }, { label: '项目经理/工程负责人', value: OUTPUT_SPLIT_SPECIALTY.projectLead },
{ label: '建筑专业', value: 'arch' }, { label: '建筑专业', value: OUTPUT_SPLIT_SPECIALTY.arch },
{ label: '装修专业', value: 'decor' }, { label: '装修专业', value: OUTPUT_SPLIT_SPECIALTY.decor },
{ label: '结构专业', value: 'struct' }, { label: '结构专业', value: OUTPUT_SPLIT_SPECIALTY.struct },
{ label: '水专业', value: 'water' }, { label: '水专业', value: OUTPUT_SPLIT_SPECIALTY.water },
{ label: '电气专业', value: 'elec' }, { label: '电气专业', value: OUTPUT_SPLIT_SPECIALTY.elec },
{ label: '暖通专业', value: 'hvac' }, { label: '暖通专业', value: OUTPUT_SPLIT_SPECIALTY.hvac },
{ label: '数字化设计专业', value: 'digital' } { label: '数字化设计专业', value: OUTPUT_SPLIT_SPECIALTY.digital }
] ]
const message = useMessage() const message = useMessage()
@@ -339,7 +339,7 @@ const currentPlanning = ref<PlanningApi.ProjectPlanningVO>()
const formData = ref<OutputSplitApi.ProjectOutputSplitVO>() const formData = ref<OutputSplitApi.ProjectOutputSplitVO>()
const editForm = ref<OutputSplitApi.ProjectOutputSplitVO>() const editForm = ref<OutputSplitApi.ProjectOutputSplitVO>()
const quarterRows = ref<QuarterYearRow[]>([]) const quarterRows = ref<QuarterYearRow[]>([])
const selectedAnnualCategory = ref<AnnualCategoryKey>('project_lead') const selectedAnnualCategory = ref<AnnualCategoryKey>(OUTPUT_SPLIT_SPECIALTY.projectLead)
const dialogVisible = ref(false) const dialogVisible = ref(false)
const queryFormRef = ref() const queryFormRef = ref()
const projectTableRef = ref() const projectTableRef = ref()
@@ -438,7 +438,7 @@ const annualCategoryMeta = computed(() => {
if (!model || !option) { if (!model || !option) {
return { label: '-', ratio: 0, totalAmount: 0 } return { label: '-', ratio: 0, totalAmount: 0 }
} }
if (selectedAnnualCategory.value === 'project_lead') { if (selectedAnnualCategory.value === OUTPUT_SPLIT_SPECIALTY.projectLead) {
const ratio = Number(toNumeric(model.projectLeadRatio).toFixed(4)) const ratio = Number(toNumeric(model.projectLeadRatio).toFixed(4))
return { return {
label: option.label, label: option.label,

View File

@@ -105,7 +105,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="工程总面积(m²)" prop="planningArea"> <el-form-item label="建筑面积(m²)" prop="planningArea">
<el-input <el-input
v-if="showGuideDetailSection" v-if="showGuideDetailSection"
:model-value="formatAmountText(guideDetailSummary.designArea)" :model-value="formatAmountText(guideDetailSummary.designArea)"
@@ -124,7 +124,14 @@
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="合同单价(元/m²)"> <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-form-item>
</el-col> </el-col>
</el-row> </el-row>
@@ -300,6 +307,11 @@
</el-table-column> </el-table-column>
<el-table-column align="center" label="设计部位" min-width="120" fixed="left"> <el-table-column align="center" label="设计部位" min-width="120" fixed="left">
<template #default="{ row }"> <template #default="{ row }">
<el-tooltip
:content="getDesignPartLabel(row.designPart)"
:disabled="!hasValue(row.designPart)"
placement="top"
>
<el-select v-model="row.designPart" class="!w-1/1" placeholder="请选择"> <el-select v-model="row.designPart" class="!w-1/1" placeholder="请选择">
<el-option <el-option
v-for="item in DESIGN_PART_OPTIONS" v-for="item in DESIGN_PART_OPTIONS"
@@ -308,22 +320,23 @@
:value="item.value" :value="item.value"
/> />
</el-select> </el-select>
</el-tooltip>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="建筑类型" min-width="140" fixed="left"> <el-table-column align="center" label="设计内容/设计类型" min-width="210" fixed="left">
<template #default="{ row }"> <template #default="{ row }">
<el-tooltip <el-tooltip
:content="row.buildingType" :content="row.buildingType"
:disabled="!hasValue(row.buildingType)" :disabled="!hasValue(row.buildingType)"
placement="top" placement="top"
> >
<el-input v-model="row.buildingType" maxlength="100" placeholder="建筑类型" /> <el-input v-model="row.buildingType" maxlength="100" placeholder="请输入设计内容/设计类型" />
</el-tooltip> </el-tooltip>
</template> </template>
</el-table-column> </el-table-column>
<!-- 2. 取消 controls 的核心数值列 --> <!-- 2. 取消 controls 的核心数值列 -->
<el-table-column align="center" label="指导单价(元)" min-width="110"> <el-table-column align="center" label="内部指导单价(元/m²)" min-width="150">
<template #default="{ row }"> <template #default="{ row }">
<el-tooltip <el-tooltip
:content="formatAmountText(row.internalGuidanceUnitPrice)" :content="formatAmountText(row.internalGuidanceUnitPrice)"
@@ -357,7 +370,9 @@
</el-tooltip> </el-tooltip>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="楼栋/户型数" min-width="100"> <!-- 3. 多级表头折叠系数配置 -->
<el-table-column label="调整系数配置" align="center">
<el-table-column align="center" label="楼栋/户型数" min-width="110">
<template #default="{ row }"> <template #default="{ row }">
<el-input-number <el-input-number
v-model="row.buildingOrUnitCount" v-model="row.buildingOrUnitCount"
@@ -368,44 +383,47 @@
/> />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="套图系数" min-width="100">
<!-- 3. 多级表头折叠系数配置 -->
<el-table-column label="调整系数配置" align="center">
<el-table-column align="center" label="套图" min-width="85">
<template #default="{ row }"> <template #default="{ row }">
<el-input-number v-model="row.drawingSetFactor" :min="0" :precision="2" :controls="false" class="!w-1/1" /> <el-input-number v-model="row.drawingSetFactor" :min="0" :precision="2" :controls="false" class="!w-1/1" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="规模" min-width="85"> <el-table-column align="center" label="规模系数" min-width="100">
<template #default="{ row }"> <template #default="{ row }">
<el-input-number v-model="row.scaleFactor" :min="0" :precision="2" :controls="false" class="!w-1/1" /> <el-input-number v-model="row.scaleFactor" :min="0" :precision="2" :controls="false" class="!w-1/1" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="修改" min-width="85"> <el-table-column align="center" label="修改系数" min-width="100">
<template #default="{ row }"> <template #default="{ row }">
<el-input-number v-model="row.modificationFactor" :min="0" :precision="2" :controls="false" class="!w-1/1" /> <el-input-number v-model="row.modificationFactor" :min="0" :precision="2" :controls="false" class="!w-1/1" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="复杂(%)" min-width="90"> <el-table-column align="center" label="复杂系数/复杂等级" min-width="150">
<template #default="{ row }"> <template #default="{ row }">
<el-input-number <el-input-number
:model-value="toPercentValue(row.complexityFactor)" v-model="row.complexityFactor"
:min="0" :min="0"
:precision="2" :precision="2"
:controls="false" :controls="false"
class="!w-1/1" class="!w-1/1"
@update:model-value="setGuideDetailPercentValue(row, 'complexityFactor', $event)"
/> />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="计" min-width="80"> <el-table-column align="center" label="计" min-width="80">
<template #default="{ row }"> <template #default="{ row }">
<span class="text-gray-500">{{ formatFactorText(getGuideDetailTotalAdjustmentFactor(row)) }}</span> <span class="text-gray-500">{{ formatFactorText(getGuideDetailTotalAdjustmentFactor(row)) }}</span>
</template> </template>
</el-table-column> </el-table-column>
</el-table-column> </el-table-column>
<el-table-column align="center" label="设计占比(%)" min-width="100"> <!-- 4. 结果列靠右显示用浅色背景区分 -->
<el-table-column align="right" label="考核产值面积小计(m²)" min-width="150" class-name="bg-gray-50">
<template #default="{ row }">
<span class="font-bold">{{ formatAmountText(getGuideDetailAssessmentArea(row)) }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="设计阶段占比(%)" min-width="120">
<template #default="{ row }"> <template #default="{ row }">
<el-input-number <el-input-number
:model-value="toPercentValue(row.designRatio)" :model-value="toPercentValue(row.designRatio)"
@@ -418,13 +436,7 @@
</template> </template>
</el-table-column> </el-table-column>
<!-- 4. 结果列靠右显示用浅色背景区分 --> <el-table-column align="right" label="考核产值小计(元)" min-width="130" class-name="bg-gray-50">
<el-table-column align="right" label="考核面积(m²)" min-width="110" class-name="bg-gray-50">
<template #default="{ row }">
<span class="font-bold">{{ formatAmountText(getGuideDetailAssessmentArea(row)) }}</span>
</template>
</el-table-column>
<el-table-column align="right" label="考核产值(元)" min-width="120" class-name="bg-gray-50">
<template #default="{ row }"> <template #default="{ row }">
<span class="font-bold text-primary">{{ formatAmountText(getGuideDetailAssessmentOutputValue(row)) }}</span> <span class="font-bold text-primary">{{ formatAmountText(getGuideDetailAssessmentOutputValue(row)) }}</span>
</template> </template>
@@ -469,17 +481,17 @@
<el-row :gutter="16" class="mt-16px"> <el-row :gutter="16" class="mt-16px">
<el-col :span="8"> <el-col :span="8">
<el-form-item label="汇总设计面积(m²)"> <el-form-item label="设计面积总计(m²)">
<el-input :model-value="formatAmountText(guideDetailSummary.designArea)" disabled /> <el-input :model-value="formatAmountText(guideDetailSummary.designArea)" disabled />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="汇总考核面积(m²)"> <el-form-item label="考核产值面积总计(m²)">
<el-input :model-value="formatAmountText(guideDetailSummary.assessmentArea)" disabled /> <el-input :model-value="formatAmountText(guideDetailSummary.assessmentArea)" disabled />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="汇总考核产值(元)"> <el-form-item label="考核产值总计(元)">
<el-input <el-input
:model-value="formatAmountText(guideDetailSummary.assessmentOutputValue)" :model-value="formatAmountText(guideDetailSummary.assessmentOutputValue)"
disabled disabled
@@ -576,9 +588,9 @@
{{ activeRemarkRow.sortNo || '-' }} {{ activeRemarkRow.sortNo || '-' }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="设计部位"> <el-descriptions-item label="设计部位">
{{ activeRemarkRow.designPart || '-' }} {{ getDesignPartLabel(activeRemarkRow.designPart) }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="建筑类型"> <el-descriptions-item label="设计内容/设计类型">
{{ activeRemarkRow.buildingType || '-' }} {{ activeRemarkRow.buildingType || '-' }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="考核产值(元)"> <el-descriptions-item label="考核产值(元)">
@@ -616,6 +628,7 @@ import {
fromPercentValue, fromPercentValue,
getCalculationRatioDefaultPercent, getCalculationRatioDefaultPercent,
getCalculationRatioLabel, getCalculationRatioLabel,
getDesignPartLabel,
getOwnershipTypeLabel, getOwnershipTypeLabel,
getReviewOutsourceDefaultPercent, getReviewOutsourceDefaultPercent,
isComprehensiveOwnership, isComprehensiveOwnership,
@@ -907,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) => { const formatFactorText = (value?: number, digits = 4) => {
if (value === undefined || value === null) { if (value === undefined || value === null) {
return '-' return '-'
@@ -934,7 +936,7 @@ const formatQuantityText = (value?: number, digits = 4) => {
const setGuideDetailPercentValue = ( const setGuideDetailPercentValue = (
row: GuideDetailRow, row: GuideDetailRow,
field: 'complexityFactor' | 'designRatio', field: 'designRatio',
value?: number | string | null value?: number | string | null
) => { ) => {
row[field] = fromPercentValue(value, 4) row[field] = fromPercentValue(value, 4)
@@ -953,7 +955,7 @@ const formRules = reactive<FormRules>({
return return
} }
if (!hasValue(value)) { if (!hasValue(value)) {
callback(new Error('工程总面积不能为空')) callback(new Error('建筑面积不能为空'))
return return
} }
callback() callback()
@@ -1090,6 +1092,7 @@ const buildSavePayload = (): PlanningApi.ProjectPlanningSaveVO => ({
sortNo: formData.value.sortNo, sortNo: formData.value.sortNo,
contractValueQuantity: formData.value.contractValueQuantity, contractValueQuantity: formData.value.contractValueQuantity,
contractValueUnitPrice: formData.value.contractValueUnitPrice, contractValueUnitPrice: formData.value.contractValueUnitPrice,
contractUnitPrice: formData.value.contractUnitPrice,
managementFeeRate: formData.value.managementFeeRate, managementFeeRate: formData.value.managementFeeRate,
vatRate: formData.value.vatRate, vatRate: formData.value.vatRate,
implementationTeam: formData.value.implementationTeam, implementationTeam: formData.value.implementationTeam,
@@ -1153,7 +1156,7 @@ const validateGuideDetails = () => {
return false return false
} }
if (!row.buildingType) { if (!row.buildingType) {
message.warning(`${rowText}建筑类型不能为空`) message.warning(`${rowText}设计内容/设计类型不能为空`)
return false return false
} }
if (!hasValue(row.designArea)) { if (!hasValue(row.designArea)) {
@@ -1177,11 +1180,11 @@ const validateGuideDetails = () => {
return false return false
} }
if (!hasValue(row.complexityFactor)) { if (!hasValue(row.complexityFactor)) {
message.warning(`${rowText}复杂系数不能为空`) message.warning(`${rowText}复杂系数/复杂等级不能为空`)
return false return false
} }
if (!hasValue(row.designRatio)) { if (!hasValue(row.designRatio)) {
message.warning(`${rowText}设计占比不能为空`) message.warning(`${rowText}设计阶段占比不能为空`)
return false return false
} }
} }

View File

@@ -51,17 +51,37 @@
<div class="mb-16px flex items-center justify-between"> <div class="mb-16px flex items-center justify-between">
<div class="text-14px font-600">季度分配明细</div> <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" /> <Icon class="mr-5px" icon="ep:plus" />
新增年度 新增年度
</el-button> </el-button>
</div> </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"> <el-table-column align="center" label="分配年度" width="150">
<template #default="scope"> <template #default="scope">
<el-date-picker <el-date-picker
:model-value="toYearPickerValue(scope.row.distributionYear)" :model-value="toYearPickerValue(scope.row.distributionYear)"
:disabled="historyParentMode"
class="!w-1/1" class="!w-1/1"
placeholder="请选择年度" placeholder="请选择年度"
type="year" type="year"
@@ -72,7 +92,14 @@
</el-table-column> </el-table-column>
<el-table-column align="center" label="操作" width="90" fixed="right"> <el-table-column align="center" label="操作" width="90" fixed="right">
<template #default="scope"> <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> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@@ -85,6 +112,7 @@
<div class="flex flex-col gap-8px"> <div class="flex flex-col gap-8px">
<el-input-number <el-input-number
:model-value="toQuarterPercent(scope.row, quarter.value)" :model-value="toQuarterPercent(scope.row, quarter.value)"
:disabled="historyParentMode"
:min="0" :min="0"
:precision="2" :precision="2"
:step="0.01" :step="0.01"
@@ -99,7 +127,7 @@
</el-table> </el-table>
<template #footer> <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> <el-button @click="dialogVisible = false">取消</el-button>
</template> </template>
</Dialog> </Dialog>
@@ -139,6 +167,10 @@ const formData = ref<PlanningApi.ProjectPlanningVO>({
progressRemark: '' progressRemark: ''
}) })
const quarterRows = ref<QuarterYearRow[]>([]) const quarterRows = ref<QuarterYearRow[]>([])
const guideDetailMode = ref(false)
const historyParentMode = ref(false)
const historyMessage = ref('')
const activeGuideDetail = ref<PlanningQuarterApi.ProjectPlanningQuarterGuideDetailVO>()
const totalDistributionAmountPercent = computed({ const totalDistributionAmountPercent = computed({
get: () => toPercentValue(formData.value.totalDistributionAmount), get: () => toPercentValue(formData.value.totalDistributionAmount),
@@ -155,9 +187,12 @@ const formRules = reactive<FormRules>({
const buildQuarterCell = ( const buildQuarterCell = (
currentPlanningId: number, currentPlanningId: number,
distributionYear: number, distributionYear: number,
quarterNo: number quarterNo: number,
guideDetail?: PlanningQuarterApi.ProjectPlanningQuarterGuideDetailVO
): PlanningQuarterApi.ProjectPlanningQuarterVO => ({ ): PlanningQuarterApi.ProjectPlanningQuarterVO => ({
planningId: currentPlanningId, planningId: currentPlanningId,
guideDetailId: guideDetail?.id,
guideDetailSortNo: guideDetail?.sortNo,
distributionYear, distributionYear,
quarterNo, quarterNo,
distributionRatio: undefined, distributionRatio: undefined,
@@ -166,7 +201,8 @@ const buildQuarterCell = (
const buildQuarterRows = ( const buildQuarterRows = (
planning: PlanningApi.ProjectPlanningVO, planning: PlanningApi.ProjectPlanningVO,
quarters: PlanningQuarterApi.ProjectPlanningQuarterVO[] quarters: PlanningQuarterApi.ProjectPlanningQuarterVO[],
guideDetail?: PlanningQuarterApi.ProjectPlanningQuarterGuideDetailVO
) => { ) => {
const yearSet = new Set<number>() const yearSet = new Set<number>()
if (planning.planningStartYear) { if (planning.planningStartYear) {
@@ -190,20 +226,25 @@ const buildQuarterRows = (
const match = quarters.find( const match = quarters.find(
(item) => (item) =>
Number(item.distributionYear) === distributionYear && Number(item.distributionYear) === distributionYear &&
Number(item.quarterNo) === quarterNo Number(item.quarterNo) === quarterNo &&
Number(item.guideDetailId || 0) === Number(guideDetail?.id || 0)
) )
return match return match
? { ...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 planningId.value = id
dialogVisible.value = true dialogVisible.value = true
loading.value = true loading.value = true
deletedQuarterIds.value = [] deletedQuarterIds.value = []
guideDetailMode.value = false
historyParentMode.value = false
historyMessage.value = ''
activeGuideDetail.value = undefined
try { try {
const detail = await PlanningQuarterApi.getProjectPlanningQuarterPlanningDetail(id) const detail = await PlanningQuarterApi.getProjectPlanningQuarterPlanningDetail(id)
if (!detail?.planning) { if (!detail?.planning) {
@@ -217,6 +258,7 @@ const open = async (id: number) => {
progressRemark: '' progressRemark: ''
} }
quarterRows.value = [] quarterRows.value = []
activeGuideDetail.value = undefined
deletedQuarterIds.value = [] deletedQuarterIds.value = []
dialogVisible.value = false dialogVisible.value = false
message.warning('合约规划不存在或已被删除') message.warning('合约规划不存在或已被删除')
@@ -231,7 +273,24 @@ const open = async (id: number) => {
totalDistributionAmount: planning.totalDistributionAmount ?? 1, totalDistributionAmount: planning.totalDistributionAmount ?? 1,
progressRemark: planning.progressRemark ?? '' 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 || []) quarterRows.value = buildQuarterRows(formData.value, detail.quarters || [])
}
} finally { } finally {
loading.value = false loading.value = false
} }
@@ -252,7 +311,7 @@ const addDistributionYear = () => {
quarterRows.value.push({ quarterRows.value.push({
distributionYear, distributionYear,
quarters: QUARTER_OPTIONS.map((item) => 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) 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 toYearPickerValue = (value?: number) => (value ? String(value) : undefined)
const updateDistributionYear = (row: QuarterYearRow, value?: string) => { const updateDistributionYear = (row: QuarterYearRow, value?: string) => {
@@ -303,6 +386,8 @@ const buildQuarterSavePayload = (
): PlanningQuarterApi.ProjectPlanningQuarterSaveVO => ({ ): PlanningQuarterApi.ProjectPlanningQuarterSaveVO => ({
id: quarter.id, id: quarter.id,
planningId: planningId.value!, planningId: planningId.value!,
guideDetailId: quarter.guideDetailId,
guideDetailSortNo: quarter.guideDetailSortNo,
distributionYear: row.distributionYear, distributionYear: row.distributionYear,
quarterNo: quarter.quarterNo, quarterNo: quarter.quarterNo,
distributionRatio: quarter.distributionRatio distributionRatio: quarter.distributionRatio

View File

@@ -84,12 +84,12 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="项目开始年度" prop="projectStartYear" width="120" /> <el-table-column align="center" label="项目开始年度" prop="projectStartYear" width="120" />
<el-table-column align="center" label="合同产值(元)" width="130"> <el-table-column align="center" label="合同产值(元)" width="130">
<template #default="scope"> <template #default="scope">
{{ formatAmountText(scope.row.contractAmount) }} {{ formatAmountText(scope.row.contractAmount) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="工程总面积(㎡)" width="140"> <el-table-column align="center" label="建筑面积(㎡)" width="140">
<template #default="scope"> <template #default="scope">
{{ formatAreaText(scope.row.totalConstructionArea) }} {{ formatAreaText(scope.row.totalConstructionArea) }}
</template> </template>
@@ -111,8 +111,8 @@
/> />
</ContentWrap> </ContentWrap>
<el-row :gutter="16"> <SplitPane>
<el-col :span="9"> <template #left>
<ContentWrap> <ContentWrap>
<div class="mb-12px flex items-center justify-between"> <div class="mb-12px flex items-center justify-between">
<div class="text-14px font-600"> <div class="text-14px font-600">
@@ -127,7 +127,6 @@
highlight-current-row highlight-current-row
@current-change="handleCurrentPlanningChange" @current-change="handleCurrentPlanningChange"
> >
<el-table-column align="center" label="序号" type="index" width="70" />
<el-table-column <el-table-column
align="center" align="center"
label="项目任务包" label="项目任务包"
@@ -162,13 +161,17 @@
</el-table-column> </el-table-column>
<el-table-column align="center" label="排序" prop="sortNo" width="80" /> <el-table-column align="center" label="排序" prop="sortNo" width="80" />
</el-table> </el-table>
<PlanningOwnershipSummary
:planning-list="planningList"
amount-field="assessmentOutputValue"
amount-label="考核产值()"
title="归属类型考核产值合计"
/>
</ContentWrap> </ContentWrap>
</el-col> </template>
<el-col :span="15"> <template #right>
<div v-loading="quarterLoading" class="min-h-320px"> <ContentWrap v-if="currentPlanning">
<template v-if="currentPlanning">
<ContentWrap>
<div class="mb-16px flex items-center justify-between gap-16px"> <div class="mb-16px flex items-center justify-between gap-16px">
<div> <div>
<div class="text-16px font-600">{{ currentPlanning.planningContent }}</div> <div class="text-16px font-600">{{ currentPlanning.planningContent }}</div>
@@ -300,16 +303,26 @@
</el-descriptions> </el-descriptions>
</ContentWrap> </ContentWrap>
<ContentWrap> <ContentWrap v-if="currentPlanning">
<div class="mb-16px flex items-center justify-between gap-16px"> <div class="mb-16px flex items-center justify-between gap-16px">
<div> <div>
<div class="text-14px font-600">季度分配</div> <div class="text-14px font-600">季度分配</div>
<div
v-if="guideDetailMode && !historyParentMode"
class="mt-4px text-12px text-[var(--el-text-color-secondary)]"
>
专业所 + 指导价法按指导价法明细分别维护季度分配
</div>
<div v-else class="mt-4px text-12px text-[var(--el-text-color-secondary)]">
总分配已分配待分配和提取进度备注属于合约规划的总体分配控制季度分配表只展示年度季度和分配比例明细
</div>
</div> </div>
<el-button <el-button
v-hasPermi="['tjt:planning:update', 'tjt:planning-quarter:update', 'tjt:planning-quarter:create']" v-hasPermi="['tjt:planning:update', 'tjt:planning-quarter:update', 'tjt:planning-quarter:create']"
:disabled="guideDetailMode && !historyParentMode && !activeGuideDetail"
plain plain
type="primary" type="primary"
@click="openQuarterDistributionForm" @click="openQuarterDistributionForm(activeGuideDetail?.id)"
> >
编辑季度分配 编辑季度分配
</el-button> </el-button>
@@ -328,7 +341,13 @@
<div class="rounded-8px bg-[var(--el-fill-color-light)] px-16px py-12px"> <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="text-12px text-[var(--el-text-color-secondary)]">已分配</div>
<div class="mt-6px text-18px font-600"> <div class="mt-6px text-18px font-600">
{{ formatPercentText(currentPlanning.allocatedAmount) }} {{
formatPercentText(
guideDetailMode && activeGuideDetail
? activeGuideDetail.allocatedAmount
: currentPlanning.allocatedAmount
)
}}
</div> </div>
</div> </div>
</el-col> </el-col>
@@ -336,7 +355,13 @@
<div class="rounded-8px bg-[var(--el-fill-color-light)] px-16px py-12px"> <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="text-12px text-[var(--el-text-color-secondary)]">待分配</div>
<div class="mt-6px text-18px font-600"> <div class="mt-6px text-18px font-600">
{{ formatPercentText(currentPlanning.pendingAmount) }} {{
formatPercentText(
guideDetailMode && activeGuideDetail
? activeGuideDetail.pendingAmount
: currentPlanning.pendingAmount
)
}}
</div> </div>
</div> </div>
</el-col> </el-col>
@@ -350,7 +375,63 @@
</el-col> </el-col>
</el-row> </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 v-loading="quarterLoading" :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 v-loading="quarterLoading" :data="quarterRows" border>
<el-table-column align="center" label="分配年度" width="150" prop="distributionYear" /> <el-table-column align="center" label="分配年度" width="150" prop="distributionYear" />
<el-table-column <el-table-column
v-for="quarter in QUARTER_OPTIONS" v-for="quarter in QUARTER_OPTIONS"
@@ -368,14 +449,12 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
</ContentWrap> </ContentWrap>
</template>
<ContentWrap v-else-if="!quarterLoading"> <ContentWrap v-else>
<el-empty description="请选择合约规划后查看测算结果和季度分配" /> <el-empty description="请选择合约规划后查看测算结果和季度分配" />
</ContentWrap> </ContentWrap>
</div> </template>
</el-col> </SplitPane>
</el-row>
<PlanningOutputForm ref="planningOutputFormRef" @success="handlePlanningOutputFormSuccess" /> <PlanningOutputForm ref="planningOutputFormRef" @success="handlePlanningOutputFormSuccess" />
<QuarterDistributionForm <QuarterDistributionForm
@@ -391,6 +470,8 @@ import * as PlanningApi from '@/api/tjt/planning'
import * as PlanningQuarterApi from '@/api/tjt/planningQuarter' import * as PlanningQuarterApi from '@/api/tjt/planningQuarter'
import PlanningOutputForm from './PlanningOutputForm.vue' import PlanningOutputForm from './PlanningOutputForm.vue'
import QuarterDistributionForm from './QuarterDistributionForm.vue' import QuarterDistributionForm from './QuarterDistributionForm.vue'
import PlanningOwnershipSummary from '@/views/tjt/shared/PlanningOwnershipSummary.vue'
import SplitPane from '@/views/tjt/shared/SplitPane.vue'
import { import {
CONTRACT_SIGN_OPTIONS, CONTRACT_SIGN_OPTIONS,
QUARTER_OPTIONS, QUARTER_OPTIONS,
@@ -399,6 +480,7 @@ import {
formatPercentText, formatPercentText,
getCalculationMethodLabel, getCalculationMethodLabel,
getCalculationRatioLabel, getCalculationRatioLabel,
getDesignPartLabel,
getDesignStageLabel, getDesignStageLabel,
getOwnershipTypeLabel, getOwnershipTypeLabel,
getVirtualCalculationMethodLabel, getVirtualCalculationMethodLabel,
@@ -416,6 +498,11 @@ interface QuarterYearRow {
quarters: PlanningQuarterApi.ProjectPlanningQuarterVO[] quarters: PlanningQuarterApi.ProjectPlanningQuarterVO[]
} }
interface GuideDetailQuarterRow extends PlanningQuarterApi.ProjectPlanningQuarterGuideDetailVO {
tabKey: string
quarterRows: QuarterYearRow[]
}
const message = useMessage() const message = useMessage()
const loading = ref(false) const loading = ref(false)
@@ -427,9 +514,14 @@ const planningList = ref<PlanningApi.ProjectPlanningVO[]>([])
const currentProject = ref<ProjectApi.ProjectVO>() const currentProject = ref<ProjectApi.ProjectVO>()
const currentPlanning = ref<PlanningApi.ProjectPlanningVO>() const currentPlanning = ref<PlanningApi.ProjectPlanningVO>()
const quarterRows = ref<QuarterYearRow[]>([]) const quarterRows = ref<QuarterYearRow[]>([])
const guideDetailMode = ref(false)
const historyParentMode = ref(false)
const guideDetailRows = ref<GuideDetailQuarterRow[]>([])
const activeGuideDetailTab = ref('')
const queryFormRef = ref() const queryFormRef = ref()
const projectTableRef = ref() const projectTableRef = ref()
const planningTableRef = ref() const planningTableRef = ref()
let planningDetailRequestSeq = 0
const queryParams = reactive<ProjectApi.ProjectPageReqVO>({ const queryParams = reactive<ProjectApi.ProjectPageReqVO>({
pageNo: 1, pageNo: 1,
@@ -479,6 +571,13 @@ const showParentInternalGuidanceUnitPrice = computed(
currentPlanning.value?.internalGuidanceUnitPrice !== undefined && currentPlanning.value?.internalGuidanceUnitPrice !== undefined &&
currentPlanning.value?.internalGuidanceUnitPrice !== null 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) => { const formatFactorText = (value?: number, digits = 4) => {
if (value === undefined || value === null) { if (value === undefined || value === null) {
@@ -536,6 +635,20 @@ const buildQuarterRows = (
})) }))
} }
const resetQuarterDetailState = () => {
quarterRows.value = []
guideDetailMode.value = false
historyParentMode.value = false
guideDetailRows.value = []
activeGuideDetailTab.value = ''
}
const cancelQuarterDetailState = () => {
planningDetailRequestSeq += 1
quarterLoading.value = false
resetQuarterDetailState()
}
const getProjectList = async () => { const getProjectList = async () => {
loading.value = true loading.value = true
try { try {
@@ -546,7 +659,7 @@ const getProjectList = async () => {
currentProject.value = undefined currentProject.value = undefined
planningList.value = [] planningList.value = []
currentPlanning.value = undefined currentPlanning.value = undefined
quarterRows.value = [] cancelQuarterDetailState()
return return
} }
const targetProjectId = currentProject.value?.id || projectList.value[0].id const targetProjectId = currentProject.value?.id || projectList.value[0].id
@@ -563,7 +676,7 @@ const getPlanningList = async () => {
if (!currentProject.value?.id) { if (!currentProject.value?.id) {
planningList.value = [] planningList.value = []
currentPlanning.value = undefined currentPlanning.value = undefined
quarterRows.value = [] cancelQuarterDetailState()
return return
} }
planningLoading.value = true planningLoading.value = true
@@ -571,7 +684,7 @@ const getPlanningList = async () => {
planningList.value = await PlanningApi.getProjectPlanningListByProjectId(currentProject.value.id) planningList.value = await PlanningApi.getProjectPlanningListByProjectId(currentProject.value.id)
if (!planningList.value.length) { if (!planningList.value.length) {
currentPlanning.value = undefined currentPlanning.value = undefined
quarterRows.value = [] cancelQuarterDetailState()
return return
} }
const targetPlanningId = currentPlanning.value?.id || planningList.value[0].id const targetPlanningId = currentPlanning.value?.id || planningList.value[0].id
@@ -585,14 +698,36 @@ const getPlanningList = async () => {
} }
const loadPlanningDetail = async (planningId: number) => { const loadPlanningDetail = async (planningId: number) => {
const requestSeq = ++planningDetailRequestSeq
quarterLoading.value = true quarterLoading.value = true
try { try {
const detail = await PlanningQuarterApi.getProjectPlanningQuarterPlanningDetail(planningId) const detail = await PlanningQuarterApi.getProjectPlanningQuarterPlanningDetail(planningId)
if (requestSeq !== planningDetailRequestSeq) {
return
}
currentPlanning.value = detail?.planning 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 { } finally {
if (requestSeq === planningDetailRequestSeq) {
quarterLoading.value = false quarterLoading.value = false
} }
}
} }
const handleQuery = () => { const handleQuery = () => {
@@ -606,14 +741,20 @@ const resetQuery = () => {
} }
const handleCurrentProjectChange = async (row?: ProjectApi.ProjectVO) => { const handleCurrentProjectChange = async (row?: ProjectApi.ProjectVO) => {
currentProject.value = row || undefined const previousProjectId = currentProject.value?.id
const nextProject = row || undefined
currentProject.value = nextProject
if (previousProjectId !== nextProject?.id) {
currentPlanning.value = undefined
cancelQuarterDetailState()
}
await getPlanningList() await getPlanningList()
} }
const handleCurrentPlanningChange = async (row?: PlanningApi.ProjectPlanningVO) => { const handleCurrentPlanningChange = async (row?: PlanningApi.ProjectPlanningVO) => {
if (!row?.id) { if (!row?.id) {
currentPlanning.value = undefined currentPlanning.value = undefined
quarterRows.value = [] cancelQuarterDetailState()
return return
} }
await loadPlanningDetail(row.id) await loadPlanningDetail(row.id)
@@ -630,12 +771,15 @@ const openPlanningOutputForm = () => {
planningOutputFormRef.value.open(currentPlanning.value.id) planningOutputFormRef.value.open(currentPlanning.value.id)
} }
const openQuarterDistributionForm = () => { const openQuarterDistributionForm = (guideDetailId?: number) => {
if (!currentPlanning.value?.id) { if (!currentPlanning.value?.id) {
message.warning('请先选择合约规划') message.warning('请先选择合约规划')
return return
} }
quarterDistributionFormRef.value.open(currentPlanning.value.id) quarterDistributionFormRef.value.open(
currentPlanning.value.id,
guideDetailMode.value && !historyParentMode.value ? guideDetailId : undefined
)
} }
const handlePlanningOutputFormSuccess = async () => { const handlePlanningOutputFormSuccess = async () => {
@@ -646,18 +790,11 @@ const handlePlanningOutputFormSuccess = async () => {
} }
} }
let activatedOnce = false
onMounted(() => { onMounted(() => {
getProjectList() getProjectList()
}) })
onActivated(() => { onActivated(() => {
// KeepAlive 首次挂载也会触发 onActivated跳过首轮避免重复请求项目与合约规划列表。
if (!activatedOnce) {
activatedOnce = true
return
}
getProjectList() getProjectList()
}) })
</script> </script>

View File

@@ -78,48 +78,51 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="开始年度" prop="projectStartYear" width="100" /> <el-table-column align="center" label="开始年度" prop="projectStartYear" width="100" />
<el-table-column align="center" label="合同产值(元)" width="120"> <el-table-column align="center" label="合同产值(元)" width="120">
<template #default="scope"> <template #default="scope">
{{ formatAmountText(scope.row.contractAmount) }} {{ formatAmountText(scope.row.contractAmount) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="最终结算金额(元)" width="140"> <el-table-column align="center" label="结算合同总产值(元)" width="150">
<template #default="scope"> <template #default="scope">
{{ formatAmountText(scope.row.finalSettlementAmount) }} {{ formatAmountText(scope.row.finalSettlementAmount) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="测算采用金额(元)" width="140"> <el-table-column align="center" label="合同产值(不含增值税)(元)" width="190">
<template #default="scope"> <template #default="scope">
<el-tooltip {{ formatAmountText(scope.row.effectiveSettlementAmount) }}
v-if="isUsingContractAmount(scope.row)"
content="最终结算金额未填写,当前暂按合同产值测算"
placement="top"
>
<span>{{ formatAmountText(scope.row.effectiveSettlementAmount) }}</span>
</el-tooltip>
<span v-else>{{ formatAmountText(scope.row.effectiveSettlementAmount) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="综合所协作金额(元)" width="150"> <el-table-column align="center" label="综合所人工成本(元)" width="150">
<template #default="scope"> <template #default="scope">
{{ formatAmountText(scope.row.comprehensivePlanningAmount) }} {{ formatAmountText(scope.row.comprehensivePlanningAmount) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="专分包金额(元)" width="150"> <el-table-column align="center" label="专分包(专业所成本)(元)" width="210">
<template #default="scope"> <template #default="scope">
{{ formatAmountText(scope.row.subcontractPlanningAmount) }} {{ formatAmountText(scope.row.specialSubcontractPlanningAmount) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="专业所产值(元)" width="130"> <el-table-column align="center" label="专项分包(源头合作成本)(元)" width="240">
<template #default="scope"> <template #default="scope">
{{ formatAmountText(scope.row.majorOutputValue) }} {{ formatAmountText(scope.row.sourceCoopSubcontractPlanningAmount) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="专业所预计绩效(元)" width="150"> <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"> <template #default="scope">
{{ formatAmountText(scope.row.majorExpectedPerformance) }} {{ formatAmountText(scope.row.majorExpectedPerformance) }}
</template> </template>
</el-table-column> </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"> <el-table-column align="center" label="科创产值比例" width="110">
<template #default="scope"> <template #default="scope">
{{ formatPercentText(scope.row.innovationOutputRate) }} {{ formatPercentText(scope.row.innovationOutputRate) }}
@@ -135,14 +138,14 @@
{{ formatAmountText(scope.row.otherCost) }} {{ formatAmountText(scope.row.otherCost) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="盈亏值(元)" width="120"> <el-table-column align="center" label="预算盈亏值(元)" width="130">
<template #default="scope"> <template #default="scope">
<span :class="profitLossClass(scope.row.profitLossValue)"> <span :class="profitLossClass(scope.row.profitLossValue)">
{{ formatAmountText(scope.row.profitLossValue) }} {{ formatAmountText(scope.row.profitLossValue) }}
</span> </span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="盈亏百分比" width="120"> <el-table-column align="center" label="预算盈亏百分比" width="140">
<template #default="scope"> <template #default="scope">
<span :class="profitLossClass(scope.row.profitLossValue)"> <span :class="profitLossClass(scope.row.profitLossValue)">
{{ formatPercentText(scope.row.profitLossRate) }} {{ formatPercentText(scope.row.profitLossRate) }}
@@ -166,71 +169,284 @@
<div class="text-16px font-600">{{ currentProfit.projectName }}</div> <div class="text-16px font-600">{{ currentProfit.projectName }}</div>
<el-button plain type="primary" @click="openProfitEditDialog"> <el-button plain type="primary" @click="openProfitEditDialog">
<Icon class="mr-5px" icon="ep:edit" /> <Icon class="mr-5px" icon="ep:edit" />
编辑盈亏参数 编辑项目成本参数
</el-button> </el-button>
</div> </div>
<el-descriptions :column="3" border> <section class="mb-28px">
<el-descriptions-item label="合同产值(元)"> <div class="mb-12px flex items-center justify-between gap-16px">
{{ formatAmountText(currentProfit.contractAmount) }} <div>
</el-descriptions-item> <div class="text-15px font-600">项目成本预算测算表</div>
<el-descriptions-item label="最终结算金额(元)"> <div class="mt-4px flex flex-wrap items-center gap-10px text-13px text-[var(--el-text-color-secondary)]">
{{ formatAmountText(currentProfit.finalSettlementAmount) }} <el-tag :type="budgetSnapshot ? 'success' : 'info'">
</el-descriptions-item> {{ budgetSnapshot ? '已锁定' : '动态测算' }}
<el-descriptions-item label="测算采用金额(元)"> </el-tag>
<el-tooltip <span>{{ snapshotActionText(budgetSnapshot) }}</span>
v-if="isUsingContractAmount(currentProfit)" </div>
content="最终结算金额未填写,当前暂按合同产值测算" </div>
placement="top" <el-button
:disabled="!!budgetSnapshot"
:loading="actionLoading === 'budget'"
type="primary"
@click="handleLockBudgetSnapshot"
> >
<span>{{ formatAmountText(currentProfit.effectiveSettlementAmount) }}</span> 目标责任书下达
</el-tooltip> </el-button>
<span v-else>{{ formatAmountText(currentProfit.effectiveSettlementAmount) }}</span> </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>
<el-descriptions-item label="项目开始年度"> <el-descriptions-item label="项目开始年度">
{{ currentProfit.projectStartYear || '-' }} {{ currentProfit.projectStartYear || '-' }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="综合所协作金额(元)"> <el-descriptions-item label="综合所人工成本(元)">
{{ formatAmountText(currentProfit.comprehensivePlanningAmount) }} {{ formatAmountText(budgetDisplay.comprehensivePlanningAmount) }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="专分包金额(元)"> <el-descriptions-item label="专分包(专业所成本)(元)">
{{ formatAmountText(currentProfit.subcontractPlanningAmount) }} {{ formatAmountText(budgetDisplay.specialSubcontractPlanningAmount) }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="专业所产值(元)"> <el-descriptions-item label="专项分包(源头合作成本)(元)">
{{ formatAmountText(currentProfit.majorOutputValue) }} {{ formatAmountText(budgetDisplay.sourceCoopSubcontractPlanningAmount) }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="专业所预计绩效(元)"> <el-descriptions-item label="专项分包(综合所成本)(元)">
{{ formatAmountText(currentProfit.majorExpectedPerformance) }} {{ 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>
<el-descriptions-item label="科创产值比例"> <el-descriptions-item label="科创产值比例">
{{ formatPercentText(currentProfit.innovationOutputRate) }} {{ formatPercentText(budgetDisplay.innovationOutputRate) }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="科创产值(元)"> <el-descriptions-item label="科创产值(元)">
{{ formatAmountText(currentProfit.innovationOutputValue) }} {{ formatAmountText(budgetDisplay.innovationOutputValue) }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="其他成本(元)"> <el-descriptions-item label="其他成本(元)">
{{ formatAmountText(currentProfit.otherCost) }} {{ formatAmountText(budgetDisplay.otherCost) }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="盈亏值(元)"> <el-descriptions-item label="预算盈亏值(元)">
<span :class="profitLossClass(currentProfit.profitLossValue)"> <span :class="profitLossClass(budgetDisplay.profitLossValue)">
{{ formatAmountText(currentProfit.profitLossValue) }} {{ formatAmountText(budgetDisplay.profitLossValue) }}
</span> </span>
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="盈亏百分比"> <el-descriptions-item label="预算盈亏百分比">
<span :class="profitLossClass(currentProfit.profitLossValue)"> <span :class="profitLossClass(budgetDisplay.profitLossValue)">
{{ formatPercentText(currentProfit.profitLossRate) }} {{ formatPercentText(budgetDisplay.profitLossRate) }}
</span> </span>
</el-descriptions-item> </el-descriptions-item>
</el-descriptions> </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> </template>
<el-empty v-else-if="!detailLoading" description="请选择项目后查看盈亏详情" /> <el-empty v-else-if="!detailLoading" description="请选择项目后查看项目成本详情" />
</div> </div>
</ContentWrap> </ContentWrap>
<Dialog v-model="dialogVisible" title="编辑盈亏参数" width="520"> <Dialog v-model="dialogVisible" title="编辑项目成本参数" width="520">
<el-form ref="formRef" v-loading="dialogLoading" :model="formData" label-width="140px"> <el-form ref="formRef" v-loading="dialogLoading" :model="formData" label-width="140px">
<el-form-item label="最终结算金额(元)" prop="finalSettlementAmount"> <el-form-item label="结算合同总产值(元)" prop="finalSettlementAmount">
<el-input-number <el-input-number
v-model="formData.finalSettlementAmount" v-model="formData.finalSettlementAmount"
:min="0" :min="0"
@@ -281,6 +497,7 @@ import {
fromPercentValue, fromPercentValue,
toPercentValue toPercentValue
} from '@/views/tjt/shared/planning' } from '@/views/tjt/shared/planning'
import { formatDate } from '@/utils/formatTime'
defineOptions({ name: 'TjtProfit' }) defineOptions({ name: 'TjtProfit' })
@@ -289,11 +506,21 @@ const { t } = useI18n()
const loading = ref(false) const loading = ref(false)
const detailLoading = ref(false) const detailLoading = ref(false)
const actionLoading = ref<'budget' | 'accounting' | 'settlement' | ''>('')
const total = ref(0) const total = ref(0)
const list = ref<ProfitApi.ProjectProfitVO[]>([]) const list = ref<ProfitApi.ProjectProfitVO[]>([])
const currentProfit = ref<ProfitApi.ProjectProfitVO>() const currentProfit = ref<ProfitApi.ProjectProfitVO>()
const queryFormRef = ref() const queryFormRef = ref()
const profitTableRef = 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 dialogVisible = ref(false)
const dialogLoading = ref(false) const dialogLoading = ref(false)
@@ -338,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 () => { const getList = async () => {
loading.value = true loading.value = true
let targetProfit: ProfitApi.ProjectProfitVO | undefined let targetProfit: ProfitApi.ProjectProfitVO | undefined
@@ -396,6 +646,60 @@ const refreshCurrentProfit = async () => {
await getList() 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 () => { const openProfitEditDialog = async () => {
if (!currentProfit.value?.projectId) { if (!currentProfit.value?.projectId) {
return return
@@ -445,16 +749,54 @@ const submitProfitForm = async () => {
const profitLossClass = (value?: number) => { const profitLossClass = (value?: number) => {
if ((value || 0) > 0) { if ((value || 0) > 0) {
return 'text-[var(--el-color-danger)] font-600' return 'text-[var(--el-color-success)] font-600'
} }
if ((value || 0) < 0) { if ((value || 0) < 0) {
return 'text-[var(--el-color-success)] font-600' return 'text-[var(--el-color-danger)] font-600'
} }
return 'text-[var(--el-text-color-primary)]' return 'text-[var(--el-text-color-primary)]'
} }
const isUsingContractAmount = (row?: ProfitApi.ProjectProfitVO) => const snapshotActionText = (
!!row && Number(row.finalSettlementAmount || 0) <= 0 && Number(row.contractAmount || 0) > 0 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 let activatedOnce = false

View File

@@ -132,13 +132,11 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="排序" prop="sortNo"> <el-form-item label="排序" prop="sortNo">
<el-input-number <el-input
v-model="formData.sortNo" v-model="formData.sortNo"
:min="0" maxlength="50"
:precision="0" placeholder="请输入排序,如 A-01"
:step="1"
class="!w-1/1" class="!w-1/1"
controls-position="right"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
@@ -158,11 +156,7 @@ import { OWNERSHIP_TYPE_OPTIONS } from '@/views/tjt/shared/planning'
defineOptions({ name: 'TjtPlanningForm' }) defineOptions({ name: 'TjtPlanningForm' })
const OWNERSHIP_TYPE_LABELS = ['专业所', '综合所', '专业分包'] const ownershipTypeOptions = OWNERSHIP_TYPE_OPTIONS
const ownershipTypeOptions = OWNERSHIP_TYPE_OPTIONS.map((item, index) => ({
label: OWNERSHIP_TYPE_LABELS[index] || item.label,
value: item.value
}))
const { t } = useI18n() const { t } = useI18n()
const message = useMessage() const message = useMessage()
@@ -178,7 +172,7 @@ const createFormData = (
planningAmount?: number planningAmount?: number
): PlanningApi.ProjectPlanningVO => ({ ): PlanningApi.ProjectPlanningVO => ({
projectId: projectId || 0, projectId: projectId || 0,
sortNo: 0, sortNo: '',
ownershipType: ownershipTypeOptions[0].value, ownershipType: ownershipTypeOptions[0].value,
calculationMethod: '', calculationMethod: '',
planningContent: '', planningContent: '',
@@ -289,7 +283,7 @@ const formRules = reactive<FormRules>({
const buildSavePayload = (): PlanningApi.ProjectPlanningSaveVO => ({ const buildSavePayload = (): PlanningApi.ProjectPlanningSaveVO => ({
id: formData.value.id, id: formData.value.id,
projectId: formData.value.projectId, projectId: formData.value.projectId,
sortNo: formData.value.sortNo ?? 0, sortNo: formData.value.sortNo?.trim() || undefined,
ownershipType: formData.value.ownershipType, ownershipType: formData.value.ownershipType,
calculationMethod: formData.value.calculationMethod, calculationMethod: formData.value.calculationMethod,
planningContent: formData.value.planningContent, planningContent: formData.value.planningContent,

View File

@@ -16,7 +16,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="工程总面积(㎡)" prop="totalConstructionArea"> <el-form-item label="建筑面积(㎡)" prop="totalConstructionArea">
<el-input-number <el-input-number
v-model="formData.totalConstructionArea" v-model="formData.totalConstructionArea"
:min="0" :min="0"
@@ -49,7 +49,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="工程类别" prop="projectCategory"> <el-form-item label="设计类型" prop="projectCategory">
<el-select <el-select
v-model="formData.projectCategory" v-model="formData.projectCategory"
class="!w-1/1" class="!w-1/1"
@@ -80,7 +80,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="合同产值(元)" prop="contractAmount"> <el-form-item label="合同产值(元)" prop="contractAmount">
<el-input-number <el-input-number
v-model="formData.contractAmount" v-model="formData.contractAmount"
:min="0" :min="0"
@@ -139,13 +139,13 @@
<el-col :span="12"> <el-col :span="12">
<el-form-item :label="statusReasonLabel" :prop="statusReasonProp"> <el-form-item :label="statusReasonLabel" :prop="statusReasonProp">
<el-input <el-input
v-if="formData.projectStatus === '暂停'" v-if="formData.projectStatus === PROJECT_STATUS.paused"
v-model="formData.pauseReason" v-model="formData.pauseReason"
maxlength="255" maxlength="255"
placeholder="请输入暂停原因" placeholder="请输入暂停原因"
/> />
<el-input <el-input
v-else-if="formData.projectStatus === '中止'" v-else-if="formData.projectStatus === PROJECT_STATUS.terminated"
v-model="formData.terminateReason" v-model="formData.terminateReason"
maxlength="255" maxlength="255"
placeholder="请输入中止原因" placeholder="请输入中止原因"
@@ -155,13 +155,11 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="排序" prop="sortNo"> <el-form-item label="排序" prop="sortNo">
<el-input-number <el-input
v-model="formData.sortNo" v-model="formData.sortNo"
:min="0" maxlength="50"
:precision="0" placeholder="请输入排序,如 A-01"
:step="1"
class="!w-1/1" class="!w-1/1"
controls-position="right"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
@@ -276,37 +274,19 @@
import type { FormRules } from 'element-plus' import type { FormRules } from 'element-plus'
import * as EmployeeApi from '@/api/tjt/employee' import * as EmployeeApi from '@/api/tjt/employee'
import * as ProjectApi from '@/api/tjt/project' import * as ProjectApi from '@/api/tjt/project'
import {
DEFAULT_INNOVATION_OUTPUT_RATE,
OUTPUT_SPLIT_ROLE,
PROJECT_CATEGORY_OPTIONS,
PROJECT_STATUS,
PROJECT_STATUS_OPTIONS,
PROJECT_TYPE_OPTIONS
} from '@/views/tjt/shared/planning'
defineOptions({ name: 'TjtProjectForm' }) defineOptions({ name: 'TjtProjectForm' })
const ROLE_PROJECT_MANAGER = 'project_manager' const ROLE_PROJECT_MANAGER = OUTPUT_SPLIT_ROLE.projectManager
const ROLE_ENGINEERING_PRINCIPAL = 'engineering_principal' const ROLE_ENGINEERING_PRINCIPAL = OUTPUT_SPLIT_ROLE.engineeringPrincipal
const PROJECT_TYPE_OPTIONS = [
{ label: '建筑工程', value: '建筑工程' },
{ label: '精装工程', value: '精装工程' },
{ label: '综合工程', value: '综合工程' },
{ label: '专项设计', value: '专项设计' },
{ label: 'BIM设计', value: 'BIM设计' },
{ label: '其他', value: '其他' }
]
const PROJECT_CATEGORY_OPTIONS = [
{ label: '住宅', value: '住宅' },
{ label: '公建', value: '公建' },
{ label: '工业', value: '工业' },
{ label: '园林景观', value: '园林景观' },
{ label: '其他', value: '其他' }
]
const PROJECT_STATUS_OPTIONS = [
{ label: '进行中', value: '进行中' },
{ label: '完成', value: '完成' },
{ label: '暂停', value: '暂停' },
{ label: '中止', value: '中止' }
]
const DEFAULT_INNOVATION_OUTPUT_RATE = 0.01
const { t } = useI18n() const { t } = useI18n()
const message = useMessage() const message = useMessage()
@@ -329,7 +309,7 @@ const createRolePerson = (
const createFormData = (): ProjectApi.ProjectVO => ({ const createFormData = (): ProjectApi.ProjectVO => ({
projectName: '', projectName: '',
sortNo: 0, sortNo: '',
contractSignedFlag: true, contractSignedFlag: true,
contractAmount: undefined, contractAmount: undefined,
totalConstructionArea: undefined, totalConstructionArea: undefined,
@@ -340,7 +320,7 @@ const createFormData = (): ProjectApi.ProjectVO => ({
projectType: '', projectType: '',
projectCategory: '', projectCategory: '',
projectStartYear: new Date().getFullYear(), projectStartYear: new Date().getFullYear(),
projectStatus: '进行中', projectStatus: PROJECT_STATUS.inProgress,
pauseReason: '', pauseReason: '',
terminateReason: '', terminateReason: '',
innovationOutputRate: DEFAULT_INNOVATION_OUTPUT_RATE, innovationOutputRate: DEFAULT_INNOVATION_OUTPUT_RATE,
@@ -358,7 +338,7 @@ const normalizeFormData = (data: ProjectApi.ProjectVO): ProjectApi.ProjectVO =>
...data, ...data,
projectType: normalizeValue(data.projectType, PROJECT_TYPE_OPTIONS), projectType: normalizeValue(data.projectType, PROJECT_TYPE_OPTIONS),
projectCategory: normalizeValue(data.projectCategory, PROJECT_CATEGORY_OPTIONS), projectCategory: normalizeValue(data.projectCategory, PROJECT_CATEGORY_OPTIONS),
projectStatus: normalizeValue(data.projectStatus, PROJECT_STATUS_OPTIONS, '进行中'), projectStatus: normalizeValue(data.projectStatus, PROJECT_STATUS_OPTIONS, PROJECT_STATUS.inProgress),
innovationOutputRate: data.innovationOutputRate ?? DEFAULT_INNOVATION_OUTPUT_RATE, innovationOutputRate: data.innovationOutputRate ?? DEFAULT_INNOVATION_OUTPUT_RATE,
otherCost: data.otherCost ?? 0, otherCost: data.otherCost ?? 0,
pauseReason: data.pauseReason || '', pauseReason: data.pauseReason || '',
@@ -438,20 +418,20 @@ const projectStartYearValue = computed({
}) })
const statusReasonLabel = computed(() => const statusReasonLabel = computed(() =>
formData.value.projectStatus === '中止' ? '中止原因' : '暂停原因' formData.value.projectStatus === PROJECT_STATUS.terminated ? '中止原因' : '暂停原因'
) )
const statusReasonProp = computed(() => const statusReasonProp = computed(() =>
formData.value.projectStatus === '中止' ? 'terminateReason' : 'pauseReason' formData.value.projectStatus === PROJECT_STATUS.terminated ? 'terminateReason' : 'pauseReason'
) )
watch( watch(
() => formData.value.projectStatus, () => formData.value.projectStatus,
(status) => { (status) => {
if (status !== '暂停') { if (status !== PROJECT_STATUS.paused) {
formData.value.pauseReason = '' formData.value.pauseReason = ''
} }
if (status !== '中止') { if (status !== PROJECT_STATUS.terminated) {
formData.value.terminateReason = '' formData.value.terminateReason = ''
} }
} }
@@ -459,14 +439,14 @@ watch(
const formRules = reactive<FormRules>({ const formRules = reactive<FormRules>({
projectName: [{ required: true, message: '项目名称不能为空', trigger: 'blur' }], projectName: [{ required: true, message: '项目名称不能为空', trigger: 'blur' }],
contractAmount: [{ required: true, message: '合同产值不能为空', trigger: 'blur' }], contractAmount: [{ required: true, message: '合同产值不能为空', trigger: 'blur' }],
totalConstructionArea: [{ required: true, message: '工程总面积不能为空', trigger: 'blur' }], totalConstructionArea: [{ required: true, message: '建筑面积不能为空', trigger: 'blur' }],
projectStartYear: [{ required: true, message: '项目开始年度不能为空', trigger: 'change' }], projectStartYear: [{ required: true, message: '项目开始年度不能为空', trigger: 'change' }],
projectStatus: [{ required: true, message: '项目状态不能为空', trigger: 'change' }], projectStatus: [{ required: true, message: '项目状态不能为空', trigger: 'change' }],
pauseReason: [ pauseReason: [
{ {
validator: (_rule, value, callback) => { validator: (_rule, value, callback) => {
if (formData.value.projectStatus === '暂停' && !String(value || '').trim()) { if (formData.value.projectStatus === PROJECT_STATUS.paused && !String(value || '').trim()) {
callback(new Error('暂停状态必须填写暂停原因')) callback(new Error('暂停状态必须填写暂停原因'))
return return
} }
@@ -478,7 +458,7 @@ const formRules = reactive<FormRules>({
terminateReason: [ terminateReason: [
{ {
validator: (_rule, value, callback) => { validator: (_rule, value, callback) => {
if (formData.value.projectStatus === '中止' && !String(value || '').trim()) { if (formData.value.projectStatus === PROJECT_STATUS.terminated && !String(value || '').trim()) {
callback(new Error('中止状态必须填写中止原因')) callback(new Error('中止状态必须填写中止原因'))
return return
} }
@@ -512,7 +492,7 @@ const emit = defineEmits(['success'])
const buildSavePayload = (): ProjectApi.ProjectSaveVO => ({ const buildSavePayload = (): ProjectApi.ProjectSaveVO => ({
id: formData.value.id, id: formData.value.id,
projectName: formData.value.projectName, projectName: formData.value.projectName,
sortNo: formData.value.sortNo ?? 0, sortNo: formData.value.sortNo?.trim() || undefined,
contractSignedFlag: formData.value.contractSignedFlag, contractSignedFlag: formData.value.contractSignedFlag,
contractAmount: formData.value.contractAmount, contractAmount: formData.value.contractAmount,
totalConstructionArea: formData.value.totalConstructionArea, totalConstructionArea: formData.value.totalConstructionArea,

View File

@@ -188,7 +188,7 @@
<el-descriptions-item label="工程类型"> <el-descriptions-item label="工程类型">
{{ getProjectTypeText(currentProject.projectType) }} {{ getProjectTypeText(currentProject.projectType) }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="工程类别"> <el-descriptions-item label="设计类型">
{{ getProjectCategoryText(currentProject.projectCategory) }} {{ getProjectCategoryText(currentProject.projectCategory) }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="合同签订日期"> <el-descriptions-item label="合同签订日期">
@@ -218,10 +218,21 @@
> >
{{ currentProject.terminateReason || '-' }} {{ currentProject.terminateReason || '-' }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="合同产值(元)"> <el-descriptions-item label="合同产值(元)">
{{ formatAmountText(currentProject.contractAmount) }} {{ formatAmountText(currentProject.contractAmount) }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="工程总面积(m²)"> <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) }} {{ formatAreaText(currentProject.totalConstructionArea) }}
</el-descriptions-item> </el-descriptions-item>
</el-descriptions> </el-descriptions>
@@ -353,7 +364,7 @@ const cleanOptionLabels = <T,>(options: Array<{ label: string; value: T }>, labe
})) }))
const contractSignOptions = cleanOptionLabels(CONTRACT_SIGN_OPTIONS, ['已签约', '未签约']) const contractSignOptions = cleanOptionLabels(CONTRACT_SIGN_OPTIONS, ['已签约', '未签约'])
const ownershipTypeOptions = cleanOptionLabels(OWNERSHIP_TYPE_OPTIONS, ['专业所', '综合所', '专业分包']) const ownershipTypeOptions = OWNERSHIP_TYPE_OPTIONS
const projectTypeOptions = cleanOptionLabels(PROJECT_TYPE_OPTIONS, [ const projectTypeOptions = cleanOptionLabels(PROJECT_TYPE_OPTIONS, [
'建筑工程', '建筑工程',
'精装工程', '精装工程',
@@ -410,6 +421,46 @@ const queryParams = reactive<ProjectApi.ProjectPageReqVO>({
const getProjectRowIndex = (index: number) => const getProjectRowIndex = (index: number) =>
((queryParams.pageNo ?? 1) - 1) * (queryParams.pageSize ?? 10) + index + 1 ((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({ const queryProjectStartYearValue = computed({
get: () => (queryParams.projectStartYear ? String(queryParams.projectStartYear) : undefined), get: () => (queryParams.projectStartYear ? String(queryParams.projectStartYear) : undefined),
set: (value?: string) => { set: (value?: string) => {

View File

@@ -91,12 +91,12 @@
prop="engineeringPrincipalName" prop="engineeringPrincipalName"
/> />
<el-table-column align="center" label="开始年度" prop="projectStartYear" width="120" /> <el-table-column align="center" label="开始年度" prop="projectStartYear" width="120" />
<el-table-column align="center" label="合同产值(元)" width="130"> <el-table-column align="center" label="合同产值(元)" width="130">
<template #default="scope"> <template #default="scope">
{{ formatAmountText(scope.row.contractAmount) }} {{ formatAmountText(scope.row.contractAmount) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="工程总面积(㎡)" width="140"> <el-table-column align="center" label="建筑面积(㎡)" width="140">
<template #default="scope"> <template #default="scope">
{{ formatAreaText(scope.row.totalConstructionArea) }} {{ formatAreaText(scope.row.totalConstructionArea) }}
</template> </template>
@@ -111,8 +111,8 @@
/> />
</ContentWrap> </ContentWrap>
<el-row :gutter="16"> <SplitPane>
<el-col :span="8"> <template #left>
<ContentWrap v-if="currentProject"> <ContentWrap v-if="currentProject">
<div class="mb-16px flex items-center justify-between gap-12px"> <div class="mb-16px flex items-center justify-between gap-12px">
<div> <div>
@@ -140,10 +140,10 @@
<el-descriptions-item label="工程负责人"> <el-descriptions-item label="工程负责人">
{{ currentProject.engineeringPrincipalName || '-' }} {{ currentProject.engineeringPrincipalName || '-' }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="合同产值(元)"> <el-descriptions-item label="合同产值(元)">
{{ formatAmountText(currentProject.contractAmount) }} {{ formatAmountText(currentProject.contractAmount) }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="工程总面积(㎡)"> <el-descriptions-item label="建筑面积(㎡)">
{{ formatAreaText(currentProject.totalConstructionArea) }} {{ formatAreaText(currentProject.totalConstructionArea) }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="开始年度"> <el-descriptions-item label="开始年度">
@@ -161,7 +161,9 @@
<el-col :span="8"> <el-col :span="8">
<div class="rounded-8px bg-[var(--el-fill-color-light)] px-12px py-12px"> <div class="rounded-8px bg-[var(--el-fill-color-light)] px-12px py-12px">
<div class="text-12px text-[var(--el-text-color-secondary)]">分项合同产值合计</div> <div class="text-12px text-[var(--el-text-color-secondary)]">分项合同产值合计</div>
<div class="mt-6px text-18px font-600">{{ formatAmountText(totalPlanningAmount) }}</div> <div class="mt-6px text-18px font-600">{{
formatAmountText(totalPlanningAmount)
}}</div>
</div> </div>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
@@ -178,9 +180,9 @@
<ContentWrap v-else> <ContentWrap v-else>
<el-empty description="请选择项目后查看预算导出范围" /> <el-empty description="请选择项目后查看预算导出范围" />
</ContentWrap> </ContentWrap>
</el-col> </template>
<el-col :span="16"> <template #right>
<ContentWrap> <ContentWrap>
<div class="mb-12px flex items-center justify-between"> <div class="mb-12px flex items-center justify-between">
<div class="text-14px font-600"> <div class="text-14px font-600">
@@ -189,8 +191,12 @@
<el-button v-if="currentProject" size="small" @click="getPlanningList">刷新</el-button> <el-button v-if="currentProject" size="small" @click="getPlanningList">刷新</el-button>
</div> </div>
<el-table v-loading="planningLoading" :data="planningList" border> <el-table v-loading="planningLoading" :data="planningList" border>
<el-table-column align="center" label="序号" type="index" width="70" /> <el-table-column
<el-table-column align="center" label="项目任务包" min-width="180" prop="planningContent" /> align="center"
label="项目任务包"
min-width="180"
prop="planningContent"
/>
<el-table-column align="center" label="归属类型" width="100"> <el-table-column align="center" label="归属类型" width="100">
<template #default="scope"> <template #default="scope">
{{ getOwnershipTypeLabel(scope.row.ownershipType) }} {{ getOwnershipTypeLabel(scope.row.ownershipType) }}
@@ -215,8 +221,255 @@
<el-table-column align="center" label="排序" prop="sortNo" width="80" /> <el-table-column align="center" label="排序" prop="sortNo" width="80" />
</el-table> </el-table>
</ContentWrap> </ContentWrap>
</el-col> </template>
</el-row> </SplitPane>
<ContentWrap v-if="currentProject" v-loading="budgetPreviewLoading">
<div class="mb-12px flex flex-wrap items-center justify-between gap-12px">
<div>
<div class="text-16px font-600">考核产值预算表预览</div>
<div class="mt-4px text-12px text-[var(--el-text-color-secondary)]">
{{ budgetPreview?.projectName || currentProject.projectName }}
</div>
</div>
<div class="flex items-center gap-8px">
<span class="text-13px text-[var(--el-text-color-secondary)]">年度</span>
<el-date-picker
v-model="previewYearValue"
class="!w-150px"
clearable
placeholder="请选择年度"
type="year"
value-format="YYYY"
@change="getProjectBudgetPreview"
/>
<el-button :loading="budgetPreviewLoading" @click="getProjectBudgetPreview">刷新</el-button>
</div>
</div>
<SplitPane>
<template #left>
<div class="budget-preview-pane">
<div class="mb-12px text-14px font-600">建筑装饰工程项目考核产值预算表</div>
<el-table
:data="budgetPreview?.budgetRows || []"
:empty-text="budgetPreviewEmptyText"
:row-class-name="getBudgetPreviewRowClassName"
border
class="budget-preview-table"
max-height="520"
>
<el-table-column
align="center"
fixed="left"
label="规划内容"
min-width="160"
prop="planningContent"
show-overflow-tooltip
/>
<el-table-column
align="center"
fixed="left"
label="设计部位"
min-width="120"
prop="displayDesignPart"
/>
<el-table-column
align="center"
label="设计内容/设计类型"
min-width="160"
prop="displayBuildingType"
show-overflow-tooltip
/>
<el-table-column align="center" label="内部指导单价(元/㎡)" min-width="140">
<template #default="scope">{{
formatNullableAmount(scope.row.internalGuidanceUnitPrice)
}}</template>
</el-table-column>
<el-table-column align="center" label="设计面积(㎡)" min-width="120">
<template #default="scope">{{ formatNullableAmount(scope.row.designArea) }}</template>
</el-table-column>
<el-table-column
align="center"
label="栋数/户型数"
min-width="110"
prop="buildingOrUnitCount"
/>
<el-table-column align="center" label="套图系数" min-width="100">
<template #default="scope">{{ formatFactor(scope.row.drawingSetFactor) }}</template>
</el-table-column>
<el-table-column align="center" label="规模系数" min-width="100">
<template #default="scope">{{ formatFactor(scope.row.scaleFactor) }}</template>
</el-table-column>
<el-table-column align="center" label="修改系数" min-width="100">
<template #default="scope">{{ formatFactor(scope.row.modificationFactor) }}</template>
</el-table-column>
<el-table-column align="center" label="复杂系数/复杂等级" min-width="140">
<template #default="scope">{{ formatFactor(scope.row.complexityFactor) }}</template>
</el-table-column>
<el-table-column align="center" label="小计(㎡)" min-width="120">
<template #default="scope">{{
formatNullableAmount(scope.row.subtotalArea)
}}</template>
</el-table-column>
<el-table-column align="center" label="设计阶段占比" min-width="120">
<template #default="scope">{{
formatNullablePercent(scope.row.currentDesignStageRatio)
}}</template>
</el-table-column>
<el-table-column align="center" label="考核产值小计(万元)" min-width="150">
<template #default="scope">{{
formatNullableAmount(scope.row.assessmentOutputValueWan)
}}</template>
</el-table-column>
</el-table>
<div
v-if="budgetPreview?.remark"
class="mt-10px text-12px text-[var(--el-text-color-secondary)]"
>
备注{{ budgetPreview.remark }}
</div>
</div>
</template>
<template #right>
<div class="budget-preview-pane">
<div class="mb-12px text-14px font-600">项目考核产值年度季度预算计取表</div>
<el-table
:data="budgetPreview?.quarterBudgetRows || []"
:empty-text="budgetPreviewEmptyText"
:row-class-name="getQuarterPreviewRowClassName"
border
class="budget-preview-table"
max-height="520"
>
<el-table-column align="center" fixed="left" label="序号" width="70">
<template #default="scope">{{
scope.row.totalRow ? '' : scope.row.serialNo
}}</template>
</el-table-column>
<el-table-column
align="center"
fixed="left"
label="项目名称"
min-width="180"
show-overflow-tooltip
>
<template #default="scope">{{
scope.row.totalRow ? '项目合计' : budgetPreview?.projectName
}}</template>
</el-table-column>
<el-table-column align="center" label="产值类型" min-width="120" prop="outputType" />
<el-table-column
align="center"
label="设计内容"
min-width="180"
prop="designContent"
show-overflow-tooltip
/>
<el-table-column align="center" label="总建筑设计面积(㎡)" min-width="150">
<template #default="scope">{{
formatNullableAmount(scope.row.totalDesignArea)
}}</template>
</el-table-column>
<el-table-column align="center" label="总考核产值面积(㎡)" min-width="150">
<template #default="scope">{{
formatNullableAmount(scope.row.totalAssessmentArea)
}}</template>
</el-table-column>
<el-table-column align="center" label="总考核产值(万元)" min-width="150">
<template #default="scope">{{
formatNullableAmount(scope.row.totalAssessmentOutputWan)
}}</template>
</el-table-column>
<el-table-column align="center" label="设计阶段考核产值分配">
<el-table-column align="center" label="阶段占比" min-width="110">
<template #default="scope">{{
scope.row.totalRow ? '' : formatNullablePercent(scope.row.designStageRatio)
}}</template>
</el-table-column>
<el-table-column align="center" label="考核产值" min-width="120">
<template #default="scope">{{
formatNullableAmount(scope.row.designStageOutputWan)
}}</template>
</el-table-column>
</el-table-column>
<el-table-column align="center" label="发放情况">
<el-table-column align="center" label="往年已发放比例" min-width="130">
<template #default="scope">{{
scope.row.totalRow ? '' : formatNullablePercent(scope.row.historicalIssuedRatio)
}}</template>
</el-table-column>
<el-table-column align="center" label="一季度" min-width="100">
<template #default="scope">{{
scope.row.totalRow ? '' : formatNullablePercent(scope.row.quarterOneRatio)
}}</template>
</el-table-column>
<el-table-column align="center" label="二季度" min-width="100">
<template #default="scope">{{
scope.row.totalRow ? '' : formatNullablePercent(scope.row.quarterTwoRatio)
}}</template>
</el-table-column>
<el-table-column align="center" label="三季度" min-width="100">
<template #default="scope">{{
scope.row.totalRow ? '' : formatNullablePercent(scope.row.quarterThreeRatio)
}}</template>
</el-table-column>
<el-table-column align="center" label="四季度" min-width="100">
<template #default="scope">{{
scope.row.totalRow ? '' : formatNullablePercent(scope.row.quarterFourRatio)
}}</template>
</el-table-column>
<el-table-column align="center" label="本年度小计" min-width="120">
<template #default="scope">{{
scope.row.totalRow ? '' : formatNullablePercent(scope.row.currentYearRatio)
}}</template>
</el-table-column>
<el-table-column align="center" label="未发放比例" min-width="120">
<template #default="scope">{{
scope.row.totalRow ? '' : formatNullablePercent(scope.row.pendingRatio)
}}</template>
</el-table-column>
</el-table-column>
<el-table-column align="center" label="本年度项目考核产值(万元)">
<el-table-column align="center" label="一季度" min-width="110">
<template #default="scope">{{
formatNullableAmount(scope.row.quarterOneAmountWan)
}}</template>
</el-table-column>
<el-table-column align="center" label="二季度" min-width="110">
<template #default="scope">{{
formatNullableAmount(scope.row.quarterTwoAmountWan)
}}</template>
</el-table-column>
<el-table-column align="center" label="三季度" min-width="110">
<template #default="scope">{{
formatNullableAmount(scope.row.quarterThreeAmountWan)
}}</template>
</el-table-column>
<el-table-column align="center" label="四季度" min-width="110">
<template #default="scope">{{
formatNullableAmount(scope.row.quarterFourAmountWan)
}}</template>
</el-table-column>
<el-table-column align="center" label="本年度小计" min-width="120">
<template #default="scope">{{
formatNullableAmount(scope.row.yearTotalAmountWan)
}}</template>
</el-table-column>
</el-table-column>
<el-table-column
align="center"
label="备注"
min-width="180"
prop="ratioRemark"
show-overflow-tooltip
/>
</el-table>
</div>
</template>
</SplitPane>
</ContentWrap>
<Dialog v-model="exportDialogVisible" title="导出项目考核产值预算表" width="420"> <Dialog v-model="exportDialogVisible" title="导出项目考核产值预算表" width="420">
<el-form label-width="88px"> <el-form label-width="88px">
@@ -246,6 +499,7 @@ import * as PlanningApi from '@/api/tjt/planning'
import * as ProjectApi from '@/api/tjt/project' import * as ProjectApi from '@/api/tjt/project'
import * as ReportApi from '@/api/tjt/report' import * as ReportApi from '@/api/tjt/report'
import download from '@/utils/download' import download from '@/utils/download'
import SplitPane from '@/views/tjt/shared/SplitPane.vue'
import { import {
CONTRACT_SIGN_OPTIONS, CONTRACT_SIGN_OPTIONS,
formatAmountText, formatAmountText,
@@ -261,12 +515,15 @@ const currentYear = new Date().getFullYear()
const loading = ref(false) const loading = ref(false)
const planningLoading = ref(false) const planningLoading = ref(false)
const budgetPreviewLoading = ref(false)
const exportLoading = ref(false) const exportLoading = ref(false)
const exportDialogVisible = ref(false) const exportDialogVisible = ref(false)
const previewYear = ref<number>()
const exportYear = ref<number>() const exportYear = ref<number>()
const total = ref(0) const total = ref(0)
const projectList = ref<ProjectApi.ProjectVO[]>([]) const projectList = ref<ProjectApi.ProjectVO[]>([])
const planningList = ref<PlanningApi.ProjectPlanningVO[]>([]) const planningList = ref<PlanningApi.ProjectPlanningVO[]>([])
const budgetPreview = ref<ReportApi.ProjectBudgetPreviewRespVO>()
const currentProject = ref<ProjectApi.ProjectVO>() const currentProject = ref<ProjectApi.ProjectVO>()
const queryFormRef = ref() const queryFormRef = ref()
const projectTableRef = ref() const projectTableRef = ref()
@@ -280,7 +537,7 @@ const queryParams = reactive<ProjectApi.ProjectPageReqVO>({
}) })
const getProjectRowIndex = (index: number) => const getProjectRowIndex = (index: number) =>
(queryParams.pageNo - 1) * queryParams.pageSize + index + 1 ((queryParams.pageNo || 1) - 1) * (queryParams.pageSize || 10) + index + 1
const queryProjectStartYearValue = computed({ const queryProjectStartYearValue = computed({
get: () => (queryParams.projectStartYear ? String(queryParams.projectStartYear) : undefined), get: () => (queryParams.projectStartYear ? String(queryParams.projectStartYear) : undefined),
@@ -296,6 +553,13 @@ const exportYearValue = computed({
} }
}) })
const previewYearValue = computed({
get: () => (previewYear.value ? String(previewYear.value) : undefined),
set: (value?: string) => {
previewYear.value = value ? Number(value) : undefined
}
})
const totalPlanningAmount = computed(() => const totalPlanningAmount = computed(() =>
planningList.value.reduce((sum, item) => sum + Number(item.planningAmount || 0), 0) planningList.value.reduce((sum, item) => sum + Number(item.planningAmount || 0), 0)
) )
@@ -303,6 +567,48 @@ const totalAssessmentOutputValue = computed(() =>
planningList.value.reduce((sum, item) => sum + Number(item.assessmentOutputValue || 0), 0) planningList.value.reduce((sum, item) => sum + Number(item.assessmentOutputValue || 0), 0)
) )
const budgetPreviewEmptyText = computed(() =>
previewYear.value ? '暂无预算表数据' : '请先选择年度'
)
const formatNullableAmount = (value?: number | string | null) => {
if (value === undefined || value === null || value === '') {
return ''
}
return formatAmountText(value)
}
const formatFactor = (value?: number | string | null) => {
if (value === undefined || value === null || value === '') {
return ''
}
const numericValue = Number(value)
if (Number.isNaN(numericValue)) {
return ''
}
return numericValue.toFixed(2)
}
const formatNullablePercent = (value?: number | string | null) => {
if (value === undefined || value === null || value === '') {
return ''
}
const numericValue = Number(value)
if (Number.isNaN(numericValue)) {
return ''
}
return `${(numericValue * 100).toFixed(2)}%`
}
const getBudgetPreviewRowClassName = ({ row }: { row: ReportApi.ProjectBudgetPreviewBudgetRow }) =>
row?.rowType === 'PART_SUBTOTAL' || row?.rowType === 'PLANNING_TOTAL' ? 'budget-total-row' : ''
const getQuarterPreviewRowClassName = ({
row
}: {
row: ReportApi.ProjectBudgetPreviewQuarterRow
}) => (row?.totalRow ? 'budget-total-row' : '')
const getProjectList = async () => { const getProjectList = async () => {
loading.value = true loading.value = true
try { try {
@@ -312,6 +618,7 @@ const getProjectList = async () => {
if (!projectList.value.length) { if (!projectList.value.length) {
currentProject.value = undefined currentProject.value = undefined
planningList.value = [] planningList.value = []
budgetPreview.value = undefined
return return
} }
const targetProjectId = currentProject.value?.id || projectList.value[0].id const targetProjectId = currentProject.value?.id || projectList.value[0].id
@@ -331,12 +638,30 @@ const getPlanningList = async () => {
} }
planningLoading.value = true planningLoading.value = true
try { try {
planningList.value = await PlanningApi.getProjectPlanningListByProjectId(currentProject.value.id) planningList.value = await PlanningApi.getProjectPlanningListByProjectId(
currentProject.value.id
)
} finally { } finally {
planningLoading.value = false planningLoading.value = false
} }
} }
const getProjectBudgetPreview = async () => {
if (!currentProject.value?.id || !previewYear.value) {
budgetPreview.value = undefined
return
}
budgetPreviewLoading.value = true
try {
budgetPreview.value = await ReportApi.getProjectBudgetPreview({
projectId: currentProject.value.id,
year: previewYear.value
})
} finally {
budgetPreviewLoading.value = false
}
}
const handleQuery = () => { const handleQuery = () => {
queryParams.pageNo = 1 queryParams.pageNo = 1
getProjectList() getProjectList()
@@ -349,7 +674,8 @@ const resetQuery = () => {
const handleCurrentProjectChange = async (row?: ProjectApi.ProjectVO) => { const handleCurrentProjectChange = async (row?: ProjectApi.ProjectVO) => {
currentProject.value = row || undefined currentProject.value = row || undefined
await getPlanningList() previewYear.value = row?.projectStartYear || currentYear
await Promise.all([getPlanningList(), getProjectBudgetPreview()])
} }
const handleExportProjectBudget = async () => { const handleExportProjectBudget = async () => {
@@ -377,7 +703,10 @@ const submitProjectBudgetExport = async () => {
projectId: currentProject.value.id, projectId: currentProject.value.id,
year: exportYear.value year: exportYear.value
}) })
download.excel(data, `${currentProject.value.projectName}_${exportYear.value}_项目考核产值预算表.xlsx`) download.excel(
data,
`${currentProject.value.projectName}_${exportYear.value}_项目考核产值预算表.xlsx`
)
exportDialogVisible.value = false exportDialogVisible.value = false
} finally { } finally {
exportLoading.value = false exportLoading.value = false
@@ -399,3 +728,14 @@ onActivated(() => {
getProjectList() getProjectList()
}) })
</script> </script>
<style scoped>
.budget-preview-pane {
min-width: 0;
}
.budget-preview-table :deep(.budget-total-row) {
background: var(--el-fill-color-light);
font-weight: 700;
}
</style>

View File

@@ -0,0 +1,495 @@
<template>
<ContentWrap>
<el-form
ref="queryFormRef"
:inline="true"
:model="queryParams"
class="-mb-15px"
label-width="88px"
>
<el-form-item label="项目名称" prop="projectName">
<el-input
v-model="queryParams.projectName"
class="!w-240px"
clearable
placeholder="请输入项目名称"
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="开始年度" prop="projectStartYear">
<el-date-picker
v-model="queryProjectStartYearValue"
class="!w-180px"
clearable
placeholder="请选择年度"
type="year"
value-format="YYYY"
/>
</el-form-item>
<el-form-item>
<el-button @click="handleQuery">
<Icon class="mr-5px" icon="ep:search" />
搜索
</el-button>
<el-button @click="resetQuery">
<Icon class="mr-5px" icon="ep:refresh" />
重置
</el-button>
</el-form-item>
</el-form>
</ContentWrap>
<ContentWrap>
<el-table
ref="projectTableRef"
v-loading="loading"
:data="projectList"
highlight-current-row
@current-change="handleCurrentProjectChange"
>
<el-table-column
:index="getProjectRowIndex"
align="center"
label="序号"
type="index"
width="80"
/>
<el-table-column align="center" label="项目名称" min-width="220" prop="projectName" />
<el-table-column align="center" label="工程负责人" min-width="180">
<template #default="scope">
{{ getProjectLeadText(scope.row.projectManagerName, scope.row.engineeringPrincipalName) }}
</template>
</el-table-column>
<el-table-column align="center" label="开始年度" prop="projectStartYear" width="120" />
<el-table-column align="center" label="排序" prop="sortNo" width="80" />
</el-table>
<Pagination
v-model:limit="queryParams.pageSize"
v-model:page="queryParams.pageNo"
:total="total"
@pagination="getProjectList"
/>
</ContentWrap>
<ContentWrap>
<div v-loading="previewLoading" class="min-h-320px">
<template v-if="currentProject">
<div class="mb-16px flex flex-wrap items-center justify-between gap-12px">
<div>
<div class="text-16px font-600">工程负责人年度表预览</div>
<div class="mt-6px text-12px text-[var(--el-text-color-secondary)]">
{{ currentProject?.projectName || '-' }}
</div>
</div>
<div class="flex items-center gap-10px">
<el-date-picker
v-model="selectedYearValue"
class="!w-150px"
clearable
placeholder="计取年度"
type="year"
value-format="YYYY"
/>
<el-button :loading="previewLoading" @click="loadProjectLeadQuarterPreview">
刷新
</el-button>
<el-button
v-hasPermi="['tjt:report-project-lead-quarter:export']"
:disabled="!selectedYear"
:loading="exportLoading"
plain
type="success"
@click="handleExportProjectLeadQuarter"
>
<Icon class="mr-5px" icon="ep:download" />
导出工程负责人年度表
</el-button>
</div>
</div>
<el-descriptions :column="2" border class="mb-16px">
<el-descriptions-item label="项目名称">
{{ previewData?.projectName || currentProject?.projectName || '-' }}
</el-descriptions-item>
<el-descriptions-item label="预览年度">
{{ previewData?.year || selectedYear || '-' }}
</el-descriptions-item>
<el-descriptions-item label="项目经理人员">
{{ previewData?.projectManagerNames || '-' }}
</el-descriptions-item>
<el-descriptions-item label="工程负责人人员">
{{ previewData?.engineeringPrincipalNames || '-' }}
</el-descriptions-item>
<el-descriptions-item label="金额单位">万元</el-descriptions-item>
</el-descriptions>
<div class="mb-12px text-14px font-600">工作量分配预览</div>
<el-table
:data="previewRows"
:empty-text="selectedYear ? '暂无工作量分配预览数据' : '请先选择年度'"
border
class="mb-20px"
max-height="360"
>
<el-table-column align="center" label="序号" width="70" prop="serialNo" />
<el-table-column align="center" label="项目名称" min-width="180">
<template #default>
{{ previewData?.projectName || currentProject?.projectName || '-' }}
</template>
</el-table-column>
<el-table-column align="center" label="产值类型" min-width="150" prop="outputType" />
<el-table-column
align="center"
label="设计内容"
min-width="180"
prop="designContent"
show-overflow-tooltip
/>
<el-table-column
align="center"
:label="previewData?.projectManagerNames || '项目经理人员'"
min-width="150"
>
<template #default="scope">
{{ formatNullablePercent(scope.row.projectManagerRatio) }}
</template>
</el-table-column>
<el-table-column
align="center"
:label="previewData?.engineeringPrincipalNames || '工程负责人人员'"
min-width="150"
>
<template #default="scope">
{{ formatNullablePercent(scope.row.engineeringPrincipalRatio) }}
</template>
</el-table-column>
</el-table>
<div class="mb-12px text-14px font-600">季度考核产值预览</div>
<el-table
:data="quarterPreviewRows"
:empty-text="selectedYear ? '暂无季度考核产值预览数据' : '请先选择年度'"
:row-class-name="getPreviewRowClassName"
border
class="project-lead-quarter-preview-table"
max-height="520"
>
<el-table-column align="center" fixed="left" label="序号" width="70">
<template #default="scope">
{{ scope.row.subtotalRow ? '' : scope.row.serialNo }}
</template>
</el-table-column>
<el-table-column align="center" fixed="left" label="项目名称" min-width="180">
<template #default="scope">
{{ scope.row.subtotalRow ? '' : previewData?.projectName || currentProject?.projectName }}
</template>
</el-table-column>
<el-table-column align="center" label="产值类型" min-width="150" prop="outputType" />
<el-table-column
align="center"
label="设计内容"
min-width="180"
prop="designContent"
show-overflow-tooltip
/>
<el-table-column
align="center"
:label="previewData?.projectManagerNames || '项目经理人员'"
>
<el-table-column align="center" label="一季度" min-width="110">
<template #default="scope">{{ formatNullableAmount(scope.row.projectManagerQuarterOneAmountWan) }}</template>
</el-table-column>
<el-table-column align="center" label="二季度" min-width="110">
<template #default="scope">{{ formatNullableAmount(scope.row.projectManagerQuarterTwoAmountWan) }}</template>
</el-table-column>
<el-table-column align="center" label="三季度" min-width="110">
<template #default="scope">{{ formatNullableAmount(scope.row.projectManagerQuarterThreeAmountWan) }}</template>
</el-table-column>
<el-table-column align="center" label="四季度" min-width="110">
<template #default="scope">{{ formatNullableAmount(scope.row.projectManagerQuarterFourAmountWan) }}</template>
</el-table-column>
<el-table-column align="center" label="本年度小计" min-width="120">
<template #default="scope">{{ formatNullableAmount(scope.row.projectManagerYearTotalAmountWan) }}</template>
</el-table-column>
</el-table-column>
<el-table-column
align="center"
:label="previewData?.engineeringPrincipalNames || '工程负责人人员'"
>
<el-table-column align="center" label="一季度" min-width="110">
<template #default="scope">{{ formatNullableAmount(scope.row.engineeringPrincipalQuarterOneAmountWan) }}</template>
</el-table-column>
<el-table-column align="center" label="二季度" min-width="110">
<template #default="scope">{{ formatNullableAmount(scope.row.engineeringPrincipalQuarterTwoAmountWan) }}</template>
</el-table-column>
<el-table-column align="center" label="三季度" min-width="110">
<template #default="scope">{{ formatNullableAmount(scope.row.engineeringPrincipalQuarterThreeAmountWan) }}</template>
</el-table-column>
<el-table-column align="center" label="四季度" min-width="110">
<template #default="scope">{{ formatNullableAmount(scope.row.engineeringPrincipalQuarterFourAmountWan) }}</template>
</el-table-column>
<el-table-column align="center" label="本年度小计" min-width="120">
<template #default="scope">{{ formatNullableAmount(scope.row.engineeringPrincipalYearTotalAmountWan) }}</template>
</el-table-column>
</el-table-column>
</el-table>
</template>
<el-empty v-else-if="!previewLoading" description="请选择项目后查看工程负责人年度表预览" />
</div>
</ContentWrap>
</template>
<script lang="ts" setup>
import * as ProjectApi from '@/api/tjt/project'
import * as ReportApi from '@/api/tjt/report'
import download from '@/utils/download'
import { formatAmountText, formatPercentText } from '@/views/tjt/shared/planning'
defineOptions({ name: 'TjtReportProjectLeadQuarter' })
const message = useMessage()
const currentYear = new Date().getFullYear()
const loading = ref(false)
const previewLoading = ref(false)
const exportLoading = ref(false)
const selectedYear = ref<number | undefined>(currentYear)
const total = ref(0)
const projectList = ref<ProjectApi.ProjectVO[]>([])
const currentProject = ref<ProjectApi.ProjectVO>()
const previewData = ref<ReportApi.ProjectLeadQuarterOutputPreviewRespVO>()
const queryFormRef = ref()
const projectTableRef = ref()
let previewRequestSeq = 0
const queryParams = reactive<ProjectApi.ProjectPageReqVO>({
pageNo: 1,
pageSize: 10,
projectName: undefined,
projectStartYear: undefined
})
const previewRows = computed(() => previewData.value?.rows || [])
const getProjectRowIndex = (index: number) =>
((queryParams.pageNo || 1) - 1) * (queryParams.pageSize || 10) + index + 1
const queryProjectStartYearValue = computed({
get: () => (queryParams.projectStartYear ? String(queryParams.projectStartYear) : undefined),
set: (value?: string) => {
queryParams.projectStartYear = value ? Number(value) : undefined
}
})
const selectedYearValue = computed({
get: () => (selectedYear.value ? String(selectedYear.value) : undefined),
set: (value?: string) => {
selectedYear.value = value ? Number(value) : undefined
}
})
const getProjectLeadText = (projectManagerName?: string, engineeringLeaderName?: string) =>
[projectManagerName, engineeringLeaderName].filter(Boolean).join(' / ') || '-'
const formatNullableAmount = (value?: number | string | null) => {
if (value === undefined || value === null || value === '') {
return ''
}
return formatAmountText(value)
}
const formatNullablePercent = (value?: number | string | null) => {
if (value === undefined || value === null || value === '') {
return ''
}
return formatPercentText(value)
}
const addAmount = (left?: number | string | null, right?: number | string | null) =>
Number((Number(left || 0) + Number(right || 0)).toFixed(2))
const buildSubtotalRow = (
rows: ReportApi.ProjectLeadQuarterOutputPreviewRow[]
): ReportApi.ProjectLeadQuarterOutputPreviewRow => {
const subtotal: ReportApi.ProjectLeadQuarterOutputPreviewRow = {
subtotalRow: true,
designContent: '总计'
}
rows.forEach((row) => {
subtotal.projectManagerQuarterOneAmountWan = addAmount(
subtotal.projectManagerQuarterOneAmountWan,
row.projectManagerQuarterOneAmountWan
)
subtotal.projectManagerQuarterTwoAmountWan = addAmount(
subtotal.projectManagerQuarterTwoAmountWan,
row.projectManagerQuarterTwoAmountWan
)
subtotal.projectManagerQuarterThreeAmountWan = addAmount(
subtotal.projectManagerQuarterThreeAmountWan,
row.projectManagerQuarterThreeAmountWan
)
subtotal.projectManagerQuarterFourAmountWan = addAmount(
subtotal.projectManagerQuarterFourAmountWan,
row.projectManagerQuarterFourAmountWan
)
subtotal.projectManagerYearTotalAmountWan = addAmount(
subtotal.projectManagerYearTotalAmountWan,
row.projectManagerYearTotalAmountWan
)
subtotal.engineeringPrincipalQuarterOneAmountWan = addAmount(
subtotal.engineeringPrincipalQuarterOneAmountWan,
row.engineeringPrincipalQuarterOneAmountWan
)
subtotal.engineeringPrincipalQuarterTwoAmountWan = addAmount(
subtotal.engineeringPrincipalQuarterTwoAmountWan,
row.engineeringPrincipalQuarterTwoAmountWan
)
subtotal.engineeringPrincipalQuarterThreeAmountWan = addAmount(
subtotal.engineeringPrincipalQuarterThreeAmountWan,
row.engineeringPrincipalQuarterThreeAmountWan
)
subtotal.engineeringPrincipalQuarterFourAmountWan = addAmount(
subtotal.engineeringPrincipalQuarterFourAmountWan,
row.engineeringPrincipalQuarterFourAmountWan
)
subtotal.engineeringPrincipalYearTotalAmountWan = addAmount(
subtotal.engineeringPrincipalYearTotalAmountWan,
row.engineeringPrincipalYearTotalAmountWan
)
})
return subtotal
}
const quarterPreviewRows = computed(() => {
const rows = previewRows.value
if (!rows.length) {
return []
}
return [...rows, buildSubtotalRow(rows)]
})
const getPreviewRowClassName = ({ row }: { row: ReportApi.ProjectLeadQuarterOutputPreviewRow }) =>
row?.subtotalRow ? 'report-total-row' : ''
const getProjectList = async () => {
loading.value = true
try {
const data = await ProjectApi.getProjectPage(queryParams)
projectList.value = data.list
total.value = data.total
if (!projectList.value.length) {
currentProject.value = undefined
previewData.value = undefined
return
}
const targetProjectId = currentProject.value?.id || projectList.value[0].id
const targetProject =
projectList.value.find((item) => item.id === targetProjectId) || projectList.value[0]
await nextTick()
projectTableRef.value?.setCurrentRow(targetProject)
} finally {
loading.value = false
}
}
const loadProjectLeadQuarterPreview = async () => {
const projectId = currentProject.value?.id
const year = selectedYear.value
const requestSeq = ++previewRequestSeq
if (!projectId || !year) {
previewData.value = undefined
previewLoading.value = false
return
}
previewLoading.value = true
try {
const data = await ReportApi.getProjectLeadQuarterOutputPreview({
projectId,
year
})
if (requestSeq === previewRequestSeq) {
previewData.value = data
}
} catch {
if (requestSeq === previewRequestSeq) {
previewData.value = undefined
}
} finally {
if (requestSeq === previewRequestSeq) {
previewLoading.value = false
}
}
}
const handleQuery = () => {
queryParams.pageNo = 1
getProjectList()
}
const resetQuery = () => {
queryFormRef.value?.resetFields()
handleQuery()
}
const handleCurrentProjectChange = (row?: ProjectApi.ProjectVO) => {
currentProject.value = row || undefined
if (!row?.id) {
previewData.value = undefined
return
}
selectedYear.value = row.projectStartYear || currentYear
previewData.value = undefined
}
const handleExportProjectLeadQuarter = async () => {
if (!currentProject.value?.id) {
message.warning('请先选择项目')
return
}
if (!selectedYear.value) {
message.warning('请选择年度')
return
}
try {
await message.exportConfirm()
exportLoading.value = true
const data = await ReportApi.exportProjectLeadQuarterOutput({
projectId: currentProject.value.id,
year: selectedYear.value
})
download.excel(data, `${currentProject.value?.projectName || '项目'}_${selectedYear.value}_工程负责人年度表.xlsx`)
} finally {
exportLoading.value = false
}
}
watch(
[() => currentProject.value?.id, selectedYear],
() => {
loadProjectLeadQuarterPreview()
}
)
let activatedOnce = false
onMounted(() => {
getProjectList()
})
onActivated(() => {
// KeepAlive 首次挂载也会触发 onActivated跳过首轮避免重复请求项目列表。
if (!activatedOnce) {
activatedOnce = true
return
}
getProjectList()
})
</script>
<style scoped>
.project-lead-quarter-preview-table :deep(.report-total-row) {
background: var(--el-fill-color-light);
font-weight: 700;
}
</style>

View File

@@ -71,247 +71,201 @@
/> />
</ContentWrap> </ContentWrap>
<el-row :gutter="16">
<el-col :span="8">
<ContentWrap> <ContentWrap>
<div class="mb-12px text-14px font-600"> <div v-loading="previewLoading" class="min-h-320px">
{{ currentProject?.projectName || '合约规划列表' }} <template v-if="currentProject">
</div> <div class="mb-16px flex flex-wrap items-center justify-between gap-12px">
<el-table
ref="planningTableRef"
v-loading="planningLoading"
:data="planningList"
highlight-current-row
@current-change="handleCurrentPlanningChange"
>
<el-table-column align="center" label="序号" type="index" width="70" />
<el-table-column align="center" label="项目任务包" min-width="180" prop="planningContent" />
<el-table-column align="center" label="归属类型" min-width="110">
<template #default="scope">
{{ getOwnershipTypeLabel(scope.row.ownershipType) }}
</template>
</el-table-column>
<el-table-column align="center" label="开始年度" prop="planningStartYear" width="100" />
<el-table-column align="center" label="考核产值(元)" width="120">
<template #default="scope">
{{ formatAmountText(scope.row.assessmentOutputValue) }}
</template>
</el-table-column>
<el-table-column align="center" label="排序" prop="sortNo" width="80" />
</el-table>
</ContentWrap>
</el-col>
<el-col :span="16">
<ContentWrap>
<div v-loading="quarterLoading" class="min-h-320px">
<template v-if="currentPlanning && formData">
<div class="mb-16px flex items-center justify-between gap-16px">
<div> <div>
<div class="text-16px font-600">{{ currentPlanning.planningContent }}</div> <div class="text-16px font-600">专业间年度表预览</div>
<div class="mt-6px text-12px text-[var(--el-text-color-secondary)]">
{{ currentProject?.projectName || '-' }}
</div> </div>
<div class="flex items-center gap-12px"> </div>
<div class="flex items-center gap-10px">
<el-date-picker
v-model="selectedYearValue"
class="!w-150px"
clearable
placeholder="计取年度"
type="year"
value-format="YYYY"
/>
<el-button :loading="previewLoading" @click="loadProjectQuarterPreview">
刷新
</el-button>
<el-button <el-button
v-hasPermi="['tjt:report-project-quarter:export']" v-hasPermi="['tjt:report-project-quarter:export']"
:loading="exportQuarterLoading" :disabled="!selectedYear"
:loading="exportLoading"
plain plain
type="success" type="success"
@click="handleExportProjectQuarter" @click="handleExportProjectQuarter"
> >
<Icon class="mr-5px" icon="ep:download" /> <Icon class="mr-5px" icon="ep:download" />
导出专业间年度季度计取 导出专业间年度表
</el-button>
<el-button
v-hasPermi="['tjt:report-project-quarter:export']"
:loading="exportLeadLoading"
plain
type="success"
@click="handleExportProjectLeadQuarter"
>
<Icon class="mr-5px" icon="ep:download" />
导出工程负责人计取表
</el-button> </el-button>
</div> </div>
</div> </div>
<el-descriptions :column="2" border title="基础信息"> <el-descriptions :column="2" border class="mb-16px">
<el-descriptions-item label="项目名称">{{ formData.projectName || '-' }}</el-descriptions-item> <el-descriptions-item label="项目名称">
<el-descriptions-item label="项目任务包">{{ formData.planningContent || '-' }}</el-descriptions-item> {{ previewData?.projectName || currentProject?.projectName || '-' }}
<el-descriptions-item label="工程负责人">
{{ getProjectLeadText(formData.projectManagerName, formData.engineeringLeaderName) }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="考核产值(元)"> <el-descriptions-item label="预览年度">
{{ formatAmountText(formData.assessmentOutputValue) }} {{ previewData?.year || selectedYear || '-' }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="金额单位">万元</el-descriptions-item>
</el-descriptions> </el-descriptions>
<el-divider content-position="left">项目层结果</el-divider> <el-table
<el-table :data="projectResultRows" border> :data="previewRows"
<el-table-column align="center" label="类别" min-width="160" prop="label" /> :empty-text="selectedYear ? '暂无专业间年度表预览数据' : '请先选择年度'"
<el-table-column align="center" label="比例" min-width="120"> :row-class-name="getPreviewRowClassName"
<template #default="scope"> border
{{ scope.row.percentText }} class="project-quarter-preview-table"
</template> max-height="620"
</el-table-column>
<el-table-column align="center" label="金额(元)" min-width="140">
<template #default="scope">
{{ formatAmountText(scope.row.amount) }}
</template>
</el-table-column>
</el-table>
<el-divider content-position="left">专业层结果</el-divider>
<el-table :data="specialtyResultRows" border>
<el-table-column align="center" label="专业" min-width="140" prop="label" />
<el-table-column align="center" label="比例" min-width="120">
<template #default="scope">
{{ scope.row.percentText }}
</template>
</el-table-column>
<el-table-column align="center" label="金额(元)" min-width="140">
<template #default="scope">
{{ formatAmountText(scope.row.amount) }}
</template>
</el-table-column>
</el-table>
<el-divider content-position="left">年度分配信息</el-divider>
<div class="mb-12px">
<el-radio-group v-model="selectedAnnualCategory" size="small">
<el-radio-button
v-for="item in annualCategoryOptions"
:key="item.value"
:label="item.value"
> >
{{ item.label }} <el-table-column align="center" fixed="left" label="序号" width="70">
</el-radio-button> <template #default="scope">
</el-radio-group> {{ scope.row.totalRow ? '' : scope.row.serialNo }}
</div> </template>
<el-row :gutter="16" class="mb-16px"> </el-table-column>
<el-col v-for="item in annualSummaryCards" :key="item.label" :span="8"> <el-table-column align="center" fixed="left" label="项目名称" min-width="180">
<div class="rounded-8px bg-[var(--el-fill-color-light)] px-16px py-12px"> <template #default="scope">
<div class="text-12px text-[var(--el-text-color-secondary)]">{{ item.label }}</div> {{ scope.row.totalRow ? '合计' : previewData?.projectName || currentProject?.projectName }}
<div class="mt-6px text-18px font-600">{{ formatAmountText(item.amount) }}</div> </template>
</div> </el-table-column>
</el-col> <el-table-column align="center" label="产值类型" min-width="150" prop="outputType" />
</el-row>
<el-table :data="annualDistributionRows" border>
<el-table-column align="center" label="分配年度" min-width="120" prop="distributionYear" />
<el-table-column <el-table-column
v-for="quarter in QUARTER_OPTIONS"
:key="String(quarter.value)"
align="center" align="center"
:label="quarter.label" label="设计内容"
min-width="150" min-width="180"
> prop="designContent"
show-overflow-tooltip
/>
<el-table-column align="center" label="本年度项目考核产值(万元)">
<el-table-column align="center" label="一季度" min-width="110">
<template #default="scope">{{ formatNullableAmount(scope.row.quarterOneAmountWan) }}</template>
</el-table-column>
<el-table-column align="center" label="二季度" min-width="110">
<template #default="scope">{{ formatNullableAmount(scope.row.quarterTwoAmountWan) }}</template>
</el-table-column>
<el-table-column align="center" label="三季度" min-width="110">
<template #default="scope">{{ formatNullableAmount(scope.row.quarterThreeAmountWan) }}</template>
</el-table-column>
<el-table-column align="center" label="四季度" min-width="110">
<template #default="scope">{{ formatNullableAmount(scope.row.quarterFourAmountWan) }}</template>
</el-table-column>
<el-table-column align="center" label="本年度小计" min-width="120">
<template #default="scope">{{ formatNullableAmount(scope.row.yearTotalAmountWan) }}</template>
</el-table-column>
</el-table-column>
<el-table-column align="center" label="项目经理/工程负责人年度/季度项目考核产值">
<el-table-column align="center" label="占比" min-width="100">
<template #default="scope"> <template #default="scope">
{{ formatAmountText(scope.row.quarterAmounts[Number(quarter.value)]) }} {{ scope.row.totalRow ? '' : formatNullablePercent(scope.row.projectLeadRatio) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="年度合计(元)" min-width="160"> <el-table-column align="center" label="总考核产值" min-width="120">
<template #default="scope">{{ formatNullableAmount(scope.row.projectLeadAssessmentOutputWan) }}</template>
</el-table-column>
<el-table-column align="center" label="一季度" min-width="110">
<template #default="scope">{{ formatNullableAmount(scope.row.projectLeadQuarterOneAmountWan) }}</template>
</el-table-column>
<el-table-column align="center" label="二季度" min-width="110">
<template #default="scope">{{ formatNullableAmount(scope.row.projectLeadQuarterTwoAmountWan) }}</template>
</el-table-column>
<el-table-column align="center" label="三季度" min-width="110">
<template #default="scope">{{ formatNullableAmount(scope.row.projectLeadQuarterThreeAmountWan) }}</template>
</el-table-column>
<el-table-column align="center" label="四季度" min-width="110">
<template #default="scope">{{ formatNullableAmount(scope.row.projectLeadQuarterFourAmountWan) }}</template>
</el-table-column>
<el-table-column align="center" label="本年度总计" min-width="120">
<template #default="scope">{{ formatNullableAmount(scope.row.projectLeadYearTotalAmountWan) }}</template>
</el-table-column>
</el-table-column>
<el-table-column align="center" label="六大专业年度/季度项目考核产值合计">
<el-table-column align="center" label="占比" min-width="100">
<template #default="scope"> <template #default="scope">
{{ formatAmountText(scope.row.yearTotal) }} {{ scope.row.totalRow ? '' : formatNullablePercent(scope.row.officeRatio) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="总考核产值" min-width="120">
<template #default="scope">{{ formatNullableAmount(scope.row.officeAssessmentOutputWan) }}</template>
</el-table-column>
<el-table-column align="center" label="一季度" min-width="110">
<template #default="scope">{{ formatNullableAmount(scope.row.officeQuarterOneAmountWan) }}</template>
</el-table-column>
<el-table-column align="center" label="二季度" min-width="110">
<template #default="scope">{{ formatNullableAmount(scope.row.officeQuarterTwoAmountWan) }}</template>
</el-table-column>
<el-table-column align="center" label="三季度" min-width="110">
<template #default="scope">{{ formatNullableAmount(scope.row.officeQuarterThreeAmountWan) }}</template>
</el-table-column>
<el-table-column align="center" label="四季度" min-width="110">
<template #default="scope">{{ formatNullableAmount(scope.row.officeQuarterFourAmountWan) }}</template>
</el-table-column>
<el-table-column align="center" label="本年度总计" min-width="120">
<template #default="scope">{{ formatNullableAmount(scope.row.officeYearTotalAmountWan) }}</template>
</el-table-column>
</el-table-column>
<el-table-column align="center" label="各专业考核产值占比">
<el-table-column
v-for="item in specialtyColumns"
:key="`${item.key}-ratio`"
align="center"
:label="item.label"
min-width="110"
>
<template #default="scope">
{{ scope.row.totalRow ? '' : formatNullablePercent(scope.row[item.ratioKey]) }}
</template>
</el-table-column>
</el-table-column>
<el-table-column align="center" label="各专业考核产值(万元)">
<el-table-column
v-for="item in specialtyColumns"
:key="`${item.key}-amount`"
align="center"
:label="item.label"
min-width="120"
>
<template #default="scope">
{{ formatNullableAmount(scope.row[item.amountKey]) }}
</template>
</el-table-column>
</el-table-column>
</el-table> </el-table>
</template> </template>
<el-empty v-else-if="!quarterLoading" description="请选择合约规划后查看导出预览" /> <el-empty v-else-if="!previewLoading" description="请选择项目后查看专业间年度表预览" />
</div> </div>
</ContentWrap> </ContentWrap>
</el-col>
</el-row>
<Dialog v-model="exportDialogVisible" :title="exportDialogTitle" width="420">
<el-form label-width="88px">
<el-form-item label="年度">
<el-date-picker
v-model="exportYearValue"
class="!w-220px"
clearable
placeholder="请选择年度"
type="year"
value-format="YYYY"
/>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="exportDialogVisible = false">取消</el-button>
<el-button :loading="currentExportLoading" type="primary" @click="submitExport">
确定导出
</el-button>
</template>
</Dialog>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import * as OutputSplitApi from '@/api/tjt/outputSplit'
import * as PlanningApi from '@/api/tjt/planning'
import * as PlanningQuarterApi from '@/api/tjt/planningQuarter'
import * as ProjectApi from '@/api/tjt/project' import * as ProjectApi from '@/api/tjt/project'
import * as ReportApi from '@/api/tjt/report' import * as ReportApi from '@/api/tjt/report'
import download from '@/utils/download' import download from '@/utils/download'
import { import { formatAmountText, formatPercentText } from '@/views/tjt/shared/planning'
formatAmountText,
getOwnershipTypeLabel,
OUTPUT_SPLIT_SPECIALTY_OPTIONS,
QUARTER_OPTIONS,
toPercentValue
} from '@/views/tjt/shared/planning'
defineOptions({ name: 'TjtReportProjectQuarter' }) defineOptions({ name: 'TjtReportProjectQuarter' })
type AnnualCategoryKey =
| 'project_lead'
| 'arch'
| 'decor'
| 'struct'
| 'water'
| 'elec'
| 'hvac'
| 'digital'
interface QuarterYearRow {
distributionYear: number
quarters: PlanningQuarterApi.ProjectPlanningQuarterVO[]
}
type ExportDialogType = 'projectQuarter' | 'projectLeadQuarter'
const annualCategoryOptions: { label: string; value: AnnualCategoryKey }[] = [
{ label: '项目经理/工程负责人', value: 'project_lead' },
{ label: '建筑专业', value: 'arch' },
{ label: '装修专业', value: 'decor' },
{ label: '结构专业', value: 'struct' },
{ label: '水专业', value: 'water' },
{ label: '电气专业', value: 'elec' },
{ label: '暖通专业', value: 'hvac' },
{ label: '数字化设计专业', value: 'digital' }
]
const message = useMessage() const message = useMessage()
const currentYear = new Date().getFullYear() const currentYear = new Date().getFullYear()
const loading = ref(false) const loading = ref(false)
const planningLoading = ref(false) const previewLoading = ref(false)
const quarterLoading = ref(false) const exportLoading = ref(false)
const exportQuarterLoading = ref(false) const selectedYear = ref<number | undefined>(currentYear)
const exportLeadLoading = ref(false)
const exportDialogVisible = ref(false)
const exportDialogType = ref<ExportDialogType>('projectQuarter')
const exportYear = ref<number>()
const total = ref(0) const total = ref(0)
const projectList = ref<ProjectApi.ProjectVO[]>([]) const projectList = ref<ProjectApi.ProjectVO[]>([])
const planningList = ref<PlanningApi.ProjectPlanningVO[]>([])
const currentProject = ref<ProjectApi.ProjectVO>() const currentProject = ref<ProjectApi.ProjectVO>()
const currentPlanning = ref<PlanningApi.ProjectPlanningVO>() const previewData = ref<ReportApi.ProjectQuarterOutputPreviewRespVO>()
const formData = ref<OutputSplitApi.ProjectOutputSplitVO>()
const quarterRows = ref<QuarterYearRow[]>([])
const selectedAnnualCategory = ref<AnnualCategoryKey>('project_lead')
const queryFormRef = ref() const queryFormRef = ref()
const projectTableRef = ref() const projectTableRef = ref()
const planningTableRef = ref() let previewRequestSeq = 0
const queryParams = reactive<ProjectApi.ProjectPageReqVO>({ const queryParams = reactive<ProjectApi.ProjectPageReqVO>({
pageNo: 1, pageNo: 1,
@@ -320,8 +274,25 @@ const queryParams = reactive<ProjectApi.ProjectPageReqVO>({
projectStartYear: undefined projectStartYear: undefined
}) })
const specialtyColumns = [
{ key: 'arch', label: '建筑', ratioKey: 'archRatio', amountKey: 'archAssessmentOutputWan' },
{ key: 'decor', label: '精装', ratioKey: 'decorRatio', amountKey: 'decorAssessmentOutputWan' },
{ key: 'struct', label: '结构', ratioKey: 'structRatio', amountKey: 'structAssessmentOutputWan' },
{ key: 'water', label: '给排水', ratioKey: 'waterRatio', amountKey: 'waterAssessmentOutputWan' },
{ key: 'hvac', label: '暖通', ratioKey: 'hvacRatio', amountKey: 'hvacAssessmentOutputWan' },
{ key: 'elec', label: '电气', ratioKey: 'elecRatio', amountKey: 'elecAssessmentOutputWan' },
{
key: 'digital',
label: '数字化设计',
ratioKey: 'digitalRatio',
amountKey: 'digitalAssessmentOutputWan'
}
] as const
const previewRows = computed(() => previewData.value?.rows || [])
const getProjectRowIndex = (index: number) => const getProjectRowIndex = (index: number) =>
(queryParams.pageNo - 1) * queryParams.pageSize + index + 1 ((queryParams.pageNo || 1) - 1) * (queryParams.pageSize || 10) + index + 1
const queryProjectStartYearValue = computed({ const queryProjectStartYearValue = computed({
get: () => (queryParams.projectStartYear ? String(queryParams.projectStartYear) : undefined), get: () => (queryParams.projectStartYear ? String(queryParams.projectStartYear) : undefined),
@@ -330,185 +301,32 @@ const queryProjectStartYearValue = computed({
} }
}) })
const exportDialogTitle = computed(() => const selectedYearValue = computed({
exportDialogType.value === 'projectQuarter' ? '导出专业间年度季度计取表' : '导出工程负责人计取表' get: () => (selectedYear.value ? String(selectedYear.value) : undefined),
)
const currentExportLoading = computed(() =>
exportDialogType.value === 'projectQuarter'
? exportQuarterLoading.value
: exportLeadLoading.value
)
const exportYearValue = computed({
get: () => (exportYear.value ? String(exportYear.value) : undefined),
set: (value?: string) => { set: (value?: string) => {
exportYear.value = value ? Number(value) : undefined selectedYear.value = value ? Number(value) : undefined
} }
}) })
const toNumeric = (value?: number | string | null) => {
const numericValue = Number(value ?? 0)
return Number.isNaN(numericValue) ? 0 : numericValue
}
const multiplyAmount = (...values: Array<number | string | null | undefined>) => {
let result = 1
values.forEach((value) => {
result *= toNumeric(value)
})
return Number(result.toFixed(2))
}
const formatRatioText = (value?: number | string | null) =>
`${(toPercentValue(value) ?? 0).toFixed(2)}%`
const getRatioValue = (model: OutputSplitApi.ProjectOutputSplitVO, key: string) =>
(model as unknown as Record<string, number | undefined>)[key]
const getProjectLeadText = (projectManagerName?: string, engineeringLeaderName?: string) => const getProjectLeadText = (projectManagerName?: string, engineeringLeaderName?: string) =>
[projectManagerName, engineeringLeaderName].filter(Boolean).join(' / ') || '-' [projectManagerName, engineeringLeaderName].filter(Boolean).join(' / ') || '-'
const buildProjectRows = (model?: OutputSplitApi.ProjectOutputSplitVO) => { const formatNullableAmount = (value?: number | string | null) => {
if (!model) { if (value === undefined || value === null || value === '') {
return [] return ''
} }
return [ return formatAmountText(value)
{
label: '项目经理/工程负责人',
percentText: formatRatioText(model.projectLeadRatio),
amount: model.projectLeadAmount
},
{
label: '专业所',
percentText: formatRatioText(model.officeRatio),
amount: model.officeAmount
}
]
} }
const buildSpecialtyRows = (model?: OutputSplitApi.ProjectOutputSplitVO) => { const formatNullablePercent = (value?: number | string | null) => {
if (!model) { if (value === undefined || value === null || value === '') {
return [] return ''
} }
const amountMap: Record<string, number | undefined> = { return formatPercentText(value)
arch: model.archAmount,
decor: model.decorAmount,
struct: model.structAmount,
water: model.waterAmount,
elec: model.elecAmount,
hvac: model.hvacAmount,
digital: model.digitalAmount
}
return OUTPUT_SPLIT_SPECIALTY_OPTIONS.map((item) => ({
label: item.label,
percentText: formatRatioText(getRatioValue(model, `${item.value}Ratio`)),
amount: amountMap[item.value]
}))
} }
const projectResultRows = computed(() => buildProjectRows(formData.value)) const getPreviewRowClassName = ({ row }: { row: ReportApi.ProjectQuarterOutputPreviewRow }) =>
const specialtyResultRows = computed(() => buildSpecialtyRows(formData.value)) row?.totalRow ? 'report-total-row' : row?.placeholderRow ? 'report-placeholder-row' : ''
const annualCategoryMeta = computed(() => {
const model = formData.value
const option = annualCategoryOptions.find((item) => item.value === selectedAnnualCategory.value)
if (!model || !option) {
return { ratio: 0 }
}
if (selectedAnnualCategory.value === 'project_lead') {
return {
ratio: Number(toNumeric(model.projectLeadRatio).toFixed(4))
}
}
const specialtyRatio = toNumeric(getRatioValue(model, `${selectedAnnualCategory.value}Ratio`))
return {
ratio: Number((toNumeric(model.officeRatio) * specialtyRatio).toFixed(4))
}
})
const annualDistributionRows = computed(() =>
quarterRows.value.map((row) => {
const quarterAmounts: Record<number, number> = {}
let yearTotal = 0
QUARTER_OPTIONS.forEach((quarter) => {
const quarterNo = Number(quarter.value)
const quarterAmount = multiplyAmount(
row.quarters.find((item) => item.quarterNo === quarterNo)?.distributionAmount,
annualCategoryMeta.value.ratio
)
quarterAmounts[quarterNo] = quarterAmount
yearTotal += quarterAmount
})
return {
distributionYear: row.distributionYear,
quarterAmounts,
yearTotal: Number(yearTotal.toFixed(2))
}
})
)
const annualSummaryCards = computed(() => [
{
label: '总分配',
amount: multiplyAmount(
currentPlanning.value?.assessmentOutputValue,
currentPlanning.value?.totalDistributionAmount,
annualCategoryMeta.value.ratio
)
},
{
label: '已分配',
amount: multiplyAmount(
currentPlanning.value?.assessmentOutputValue,
currentPlanning.value?.allocatedAmount,
annualCategoryMeta.value.ratio
)
},
{
label: '待分配',
amount: multiplyAmount(
currentPlanning.value?.assessmentOutputValue,
currentPlanning.value?.pendingAmount,
annualCategoryMeta.value.ratio
)
}
])
const buildQuarterRows = (
planning: PlanningApi.ProjectPlanningVO,
quarters: PlanningQuarterApi.ProjectPlanningQuarterVO[]
) => {
const yearSet = new Set<number>()
if (planning.planningStartYear) {
yearSet.add(planning.planningStartYear)
}
quarters.forEach((item) => yearSet.add(item.distributionYear))
if (yearSet.size === 0) {
yearSet.add(new Date().getFullYear())
}
return Array.from(yearSet)
.sort((a, b) => a - b)
.map((distributionYear) => ({
distributionYear,
quarters: QUARTER_OPTIONS.map((option) => {
const quarterNo = Number(option.value)
const match = quarters.find(
(item) =>
item.distributionYear === distributionYear && Number(item.quarterNo) === quarterNo
)
return (
match || {
planningId: planning.id!,
distributionYear,
quarterNo,
distributionRatio: undefined,
distributionAmount: 0
}
)
})
}))
}
const getProjectList = async () => { const getProjectList = async () => {
loading.value = true loading.value = true
@@ -518,10 +336,7 @@ const getProjectList = async () => {
total.value = data.total total.value = data.total
if (!projectList.value.length) { if (!projectList.value.length) {
currentProject.value = undefined currentProject.value = undefined
planningList.value = [] previewData.value = undefined
currentPlanning.value = undefined
formData.value = undefined
quarterRows.value = []
return return
} }
const targetProjectId = currentProject.value?.id || projectList.value[0].id const targetProjectId = currentProject.value?.id || projectList.value[0].id
@@ -534,48 +349,32 @@ const getProjectList = async () => {
} }
} }
const getPlanningList = async () => { const loadProjectQuarterPreview = async () => {
if (!currentProject.value?.id) { const projectId = currentProject.value?.id
planningList.value = [] const year = selectedYear.value
currentPlanning.value = undefined const requestSeq = ++previewRequestSeq
formData.value = undefined if (!projectId || !year) {
quarterRows.value = [] previewData.value = undefined
previewLoading.value = false
return return
} }
planningLoading.value = true previewLoading.value = true
try { try {
const list = await PlanningApi.getProjectPlanningListByProjectId(currentProject.value.id) const data = await ReportApi.getProjectQuarterOutputPreview({
planningList.value = list projectId,
if (!planningList.value.length) { year
currentPlanning.value = undefined })
formData.value = undefined if (requestSeq === previewRequestSeq) {
quarterRows.value = [] previewData.value = data
return }
} catch {
if (requestSeq === previewRequestSeq) {
previewData.value = undefined
} }
const targetPlanningId = currentPlanning.value?.id || planningList.value[0].id
const targetPlanning =
planningList.value.find((item) => item.id === targetPlanningId) || planningList.value[0]
await nextTick()
planningTableRef.value?.setCurrentRow(targetPlanning)
} finally { } finally {
planningLoading.value = false if (requestSeq === previewRequestSeq) {
previewLoading.value = false
} }
}
const loadPlanningRelatedData = async (planning: PlanningApi.ProjectPlanningVO) => {
if (!planning.id) {
return
}
quarterLoading.value = true
try {
const detail = await OutputSplitApi.getProjectOutputSplitPlanningDetail(planning.id)
currentPlanning.value = detail?.planning
formData.value = detail?.outputSplit
quarterRows.value = detail?.planning
? buildQuarterRows(detail.planning, detail.quarters || [])
: []
} finally {
quarterLoading.value = false
} }
} }
@@ -589,100 +388,44 @@ const resetQuery = () => {
handleQuery() handleQuery()
} }
const handleCurrentProjectChange = async (row?: ProjectApi.ProjectVO) => { const handleCurrentProjectChange = (row?: ProjectApi.ProjectVO) => {
currentProject.value = row || undefined currentProject.value = row || undefined
await getPlanningList()
}
const handleCurrentPlanningChange = async (row?: PlanningApi.ProjectPlanningVO) => {
currentPlanning.value = row || undefined
if (!row?.id) { if (!row?.id) {
formData.value = undefined previewData.value = undefined
quarterRows.value = []
return return
} }
await loadPlanningRelatedData(row) selectedYear.value = row.projectStartYear || currentYear
previewData.value = undefined
} }
const handleExportProjectQuarter = async () => { const handleExportProjectQuarter = async () => {
if (!currentPlanning.value?.id) { if (!currentProject.value?.id) {
message.warning('请先选择合约规划') message.warning('请先选择项目')
return return
} }
exportDialogType.value = 'projectQuarter' if (!selectedYear.value) {
exportYear.value = currentPlanning.value.planningStartYear || currentYear
exportDialogVisible.value = true
}
const handleExportProjectLeadQuarter = async () => {
if (!currentPlanning.value?.id) {
message.warning('请先选择合约规划')
return
}
exportDialogType.value = 'projectLeadQuarter'
exportYear.value = currentPlanning.value.planningStartYear || currentYear
exportDialogVisible.value = true
}
const submitExport = async () => {
if (exportDialogType.value === 'projectQuarter') {
await submitProjectQuarterExport()
return
}
await submitProjectLeadQuarterExport()
}
const submitProjectQuarterExport = async () => {
if (!currentPlanning.value?.id) {
message.warning('请先选择合约规划')
return
}
if (!exportYear.value) {
message.warning('请选择年度') message.warning('请选择年度')
return return
} }
try { try {
await message.exportConfirm() await message.exportConfirm()
exportQuarterLoading.value = true exportLoading.value = true
const data = await ReportApi.exportProjectQuarterOutput({ const data = await ReportApi.exportProjectQuarterOutput({
planningId: currentPlanning.value.id, projectId: currentProject.value.id,
year: exportYear.value year: selectedYear.value
}) })
download.excel( download.excel(data, `${currentProject.value?.projectName || '项目'}_${selectedYear.value}_专业间年度表.xlsx`)
data,
`${currentProject.value?.projectName || '项目'}_${exportYear.value}_专业间年度季度计取表.xlsx`
)
exportDialogVisible.value = false
} finally { } finally {
exportQuarterLoading.value = false exportLoading.value = false
} }
} }
const submitProjectLeadQuarterExport = async () => { watch(
if (!currentPlanning.value?.id) { [() => currentProject.value?.id, selectedYear],
message.warning('请先选择合约规划') () => {
return loadProjectQuarterPreview()
} }
if (!exportYear.value) { )
message.warning('请选择年度')
return
}
try {
await message.exportConfirm()
exportLeadLoading.value = true
const data = await ReportApi.exportProjectLeadQuarterOutput({
planningId: currentPlanning.value.id,
year: exportYear.value
})
download.excel(
data,
`${currentProject.value?.projectName || '项目'}_${exportYear.value}_工程负责人年度季度计取表.xlsx`
)
exportDialogVisible.value = false
} finally {
exportLeadLoading.value = false
}
}
let activatedOnce = false let activatedOnce = false
@@ -691,7 +434,7 @@ onMounted(() => {
}) })
onActivated(() => { onActivated(() => {
// KeepAlive 首次挂载也会触发 onActivated跳过首轮避免重复请求项目与合约规划列表。 // KeepAlive 首次挂载也会触发 onActivated跳过首轮避免重复请求项目列表。
if (!activatedOnce) { if (!activatedOnce) {
activatedOnce = true activatedOnce = true
return return
@@ -699,3 +442,14 @@ onActivated(() => {
getProjectList() getProjectList()
}) })
</script> </script>
<style scoped>
.project-quarter-preview-table :deep(.report-total-row) {
background: var(--el-fill-color-light);
font-weight: 700;
}
.project-quarter-preview-table :deep(.report-placeholder-row) {
color: var(--el-text-color-secondary);
}
</style>

View File

@@ -73,8 +73,8 @@
/> />
</ContentWrap> </ContentWrap>
<el-row :gutter="16"> <SplitPane>
<el-col :span="8"> <template #left>
<ContentWrap> <ContentWrap>
<div class="mb-12px text-14px font-600"> <div class="mb-12px text-14px font-600">
{{ currentProject?.projectName || '合约规划列表' }} {{ currentProject?.projectName || '合约规划列表' }}
@@ -86,7 +86,6 @@
highlight-current-row highlight-current-row
@current-change="handleCurrentPlanningChange" @current-change="handleCurrentPlanningChange"
> >
<el-table-column align="center" label="序号" type="index" width="70" />
<el-table-column align="center" label="项目任务包" min-width="180" prop="planningContent" /> <el-table-column align="center" label="项目任务包" min-width="180" prop="planningContent" />
<el-table-column align="center" label="归属类型" min-width="110"> <el-table-column align="center" label="归属类型" min-width="110">
<template #default="scope"> <template #default="scope">
@@ -102,9 +101,9 @@
<el-table-column align="center" label="排序" prop="sortNo" width="80" /> <el-table-column align="center" label="排序" prop="sortNo" width="80" />
</el-table> </el-table>
</ContentWrap> </ContentWrap>
</el-col> </template>
<el-col :span="16"> <template #right>
<ContentWrap> <ContentWrap>
<div v-loading="previewLoading" class="min-h-320px"> <div v-loading="previewLoading" class="min-h-320px">
<template v-if="currentPlanning && currentGroup"> <template v-if="currentPlanning && currentGroup">
@@ -112,7 +111,7 @@
<div> <div>
<div class="text-16px font-600">{{ currentPlanning.planningContent }}</div> <div class="text-16px font-600">{{ currentPlanning.planningContent }}</div>
<div class="mt-6px text-12px text-[var(--el-text-color-secondary)]"> <div class="mt-6px text-12px text-[var(--el-text-color-secondary)]">
按当前年度和专业预览专业内人员计取结果 按当前合约规划年度和专业预览专业内人员计取结果
</div> </div>
</div> </div>
<div class="flex items-center gap-10px"> <div class="flex items-center gap-10px">
@@ -160,10 +159,9 @@
<div class="text-12px text-[var(--el-text-color-secondary)]">季度金额单位万元</div> <div class="text-12px text-[var(--el-text-color-secondary)]">季度金额单位万元</div>
</div> </div>
<el-table <el-table
v-loading="previewLoading"
:data="currentGroupDisplayRows" :data="currentGroupDisplayRows"
border border
empty-text="当前年度暂无可预览的专业人员计取数据" empty-text="当前年度暂无可预览的专业人员考核产值计取数据"
:span-method="spanRoleColumns" :span-method="spanRoleColumns"
> >
<el-table-column align="center" label="角色" min-width="110" prop="roleName" /> <el-table-column align="center" label="角色" min-width="110" prop="roleName" />
@@ -205,7 +203,7 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table-column> </el-table-column>
<el-table-column align="center" label="季度计取明细(年度预览:比例 / 金额 万元)"> <el-table-column align="center" label="季度计取明细(合约规划年度预览:比例 / 金额 万元)">
<el-table-column align="center" label="一季度" min-width="150"> <el-table-column align="center" label="一季度" min-width="150">
<template #default="scope"> <template #default="scope">
{{ {{
@@ -259,8 +257,8 @@
<el-empty v-else-if="!previewLoading" description="请选择合约规划后查看导出预览" /> <el-empty v-else-if="!previewLoading" description="请选择合约规划后查看导出预览" />
</div> </div>
</ContentWrap> </ContentWrap>
</el-col> </template>
</el-row> </SplitPane>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
@@ -268,11 +266,17 @@ import * as PlanningApi from '@/api/tjt/planning'
import * as ProjectApi from '@/api/tjt/project' import * as ProjectApi from '@/api/tjt/project'
import * as ReportApi from '@/api/tjt/report' import * as ReportApi from '@/api/tjt/report'
import download from '@/utils/download' import download from '@/utils/download'
import { formatAmountText, formatPercentText, getOwnershipTypeLabel } from '@/views/tjt/shared/planning' import SplitPane from '@/views/tjt/shared/SplitPane.vue'
import {
formatAmountText,
formatPercentText,
getOwnershipTypeLabel,
OUTPUT_SPLIT_SPECIALTY
} from '@/views/tjt/shared/planning'
defineOptions({ name: 'TjtReportSpecialtyPerson' }) defineOptions({ name: 'TjtReportSpecialtyPerson' })
const PROJECT_LEAD_GROUP_CODE = 'project_lead' const PROJECT_LEAD_GROUP_CODE = OUTPUT_SPLIT_SPECIALTY.projectLead
const message = useMessage() const message = useMessage()
const currentYear = new Date().getFullYear() const currentYear = new Date().getFullYear()

View File

@@ -45,6 +45,7 @@
{{ scope.row.totalRow ? '' : scope.row.serialNo }} {{ scope.row.totalRow ? '' : scope.row.serialNo }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" fixed="left" label="专业所" min-width="140" prop="officeName" />
<el-table-column align="center" fixed="left" label="姓名" min-width="120" prop="employeeName" /> <el-table-column align="center" fixed="left" label="姓名" min-width="120" prop="employeeName" />
<el-table-column align="center" label="第一季度" min-width="110"> <el-table-column align="center" label="第一季度" min-width="110">
<template #default="scope">{{ formatAmount(scope.row.quarterOneAmount) }}</template> <template #default="scope">{{ formatAmount(scope.row.quarterOneAmount) }}</template>
@@ -309,9 +310,9 @@ const PROJECT_OVERVIEW_SORT_OPTIONS: SelectOption[] = [
] ]
const EMPLOYEE_SUMMARY_SORT_OPTIONS: SelectOption[] = [ const EMPLOYEE_SUMMARY_SORT_OPTIONS: SelectOption[] = [
{ label: '年度合计从高到低', value: 'annual_total_desc' }, { label: '专业所 + 所内年度合计从高到低', value: 'annual_total_desc' },
{ label: '年度合计从低到高', value: 'annual_total_asc' }, { label: '专业所 + 所内年度合计从低到高', value: 'annual_total_asc' },
{ label: '员工姓名升序', value: 'name_asc' } { label: '专业所 + 所内姓名升序', value: 'name_asc' }
] ]
const message = useMessage() const message = useMessage()

View File

@@ -0,0 +1,156 @@
<template>
<div class="planning-ownership-summary">
<div class="summary-header">
<span class="summary-title">{{ title }}</span>
<span class="summary-subtitle">{{ amountLabel }}</span>
</div>
<div class="summary-grid">
<div v-for="item in summaryRows" :key="item.key" class="summary-item">
<span class="summary-label">{{ item.label }}合计</span>
<span class="summary-value">{{ formatAmountText(item.amount) }}</span>
</div>
<div class="summary-item summary-total">
<span class="summary-label">总合计</span>
<span class="summary-value">{{ formatAmountText(totalAmount) }}</span>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import type { ProjectPlanningVO } from '@/api/tjt/planning'
import {
getOwnershipTypeLabel,
OWNERSHIP_TYPE_OPTIONS,
formatAmountText
} from '@/views/tjt/shared/planning'
type AmountField = keyof Pick<
ProjectPlanningVO,
'planningAmount' | 'assessmentOutputValue' | 'projectBudgetOutputValue'
>
const props = withDefaults(
defineProps<{
planningList?: ProjectPlanningVO[]
amountField: AmountField
title?: string
amountLabel?: string
}>(),
{
planningList: () => [],
title: '归属类型产值合计',
amountLabel: '金额(元)'
}
)
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 groupedAmountMap = computed(() => {
const map = new Map<string, number>()
props.planningList.forEach((planning) => {
const ownershipType = planning.ownershipType || ''
const amount = toAmountNumber(planning[props.amountField] as number | string | null | undefined)
map.set(ownershipType, roundAmount((map.get(ownershipType) || 0) + amount))
})
return map
})
const summaryRows = computed(() => {
const knownRows = OWNERSHIP_TYPE_OPTIONS.map((option) => ({
key: String(option.value),
label: option.label,
amount: groupedAmountMap.value.get(String(option.value)) || 0
}))
const knownKeys = new Set(knownRows.map((item) => item.key))
const unknownRows = Array.from(groupedAmountMap.value.entries())
.filter(([key]) => key && !knownKeys.has(key))
.map(([key, amount]) => ({
key,
label: getOwnershipTypeLabel(key),
amount
}))
return [...knownRows, ...unknownRows]
})
const totalAmount = computed(() =>
roundAmount(summaryRows.value.reduce((sum, item) => sum + item.amount, 0))
)
</script>
<style scoped>
.planning-ownership-summary {
margin-top: 12px;
border: 1px solid var(--el-border-color-lighter);
border-radius: 10px;
background:
linear-gradient(135deg, rgba(64, 158, 255, 0.08), transparent 42%),
var(--el-fill-color-blank);
padding: 12px;
}
.summary-header {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 12px;
margin-bottom: 10px;
}
.summary-title {
color: var(--el-text-color-primary);
font-size: 14px;
font-weight: 600;
}
.summary-subtitle {
color: var(--el-text-color-secondary);
font-size: 12px;
}
.summary-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
gap: 8px;
}
.summary-item {
min-width: 0;
border-radius: 8px;
background: rgba(255, 255, 255, 0.72);
padding: 9px 10px;
}
.summary-label {
display: block;
overflow: hidden;
color: var(--el-text-color-secondary);
font-size: 12px;
text-overflow: ellipsis;
white-space: nowrap;
}
.summary-value {
display: block;
margin-top: 4px;
color: var(--el-text-color-primary);
font-size: 14px;
font-weight: 600;
}
.summary-total {
background: var(--el-color-primary-light-9);
}
.summary-total .summary-value {
color: var(--el-color-primary);
}
</style>

View File

@@ -0,0 +1,194 @@
<template>
<div ref="paneRef" class="tjt-split-pane" :class="{ 'is-resizing': isResizing }">
<div class="tjt-split-pane__panel tjt-split-pane__panel--left" :style="{ flexBasis: leftBasis }">
<slot name="left"></slot>
</div>
<div
aria-label="Resize panels"
class="tjt-split-pane__resize"
role="separator"
tabindex="0"
@keydown="handleKeydown"
@pointerdown="startResize"
>
<span class="tjt-split-pane__resize-handle"></span>
</div>
<div class="tjt-split-pane__panel tjt-split-pane__panel--right">
<slot name="right"></slot>
</div>
</div>
</template>
<script lang="ts" setup>
defineOptions({ name: 'TjtSplitPane' })
const props = withDefaults(
defineProps<{
defaultPercent?: number
minPanelWidth?: number
}>(),
{
defaultPercent: 50,
minPanelWidth: 320
}
)
const RESIZER_WIDTH = 16
const KEYBOARD_STEP = 2
const paneRef = ref<HTMLElement>()
const leftPercent = ref(props.defaultPercent)
const isResizing = ref(false)
const leftBasis = computed(() => `calc(${leftPercent.value}% - ${RESIZER_WIDTH / 2}px)`)
const getBounds = () => {
const rect = paneRef.value?.getBoundingClientRect()
if (!rect?.width) {
return
}
const minPercent = Math.min(
45,
((props.minPanelWidth + RESIZER_WIDTH / 2) / rect.width) * 100
)
return {
rect,
minPercent,
maxPercent: 100 - minPercent
}
}
const setLeftPercent = (percent: number) => {
const bounds = getBounds()
if (!bounds) {
leftPercent.value = percent
return
}
leftPercent.value = Math.min(bounds.maxPercent, Math.max(bounds.minPercent, percent))
}
const updateByPointer = (event: PointerEvent) => {
const bounds = getBounds()
if (!bounds) {
return
}
setLeftPercent(((event.clientX - bounds.rect.left) / bounds.rect.width) * 100)
}
const stopResize = () => {
if (!isResizing.value) {
return
}
isResizing.value = false
window.removeEventListener('pointermove', updateByPointer)
window.removeEventListener('pointerup', stopResize)
window.removeEventListener('pointercancel', stopResize)
document.body.style.cursor = ''
document.body.style.userSelect = ''
}
const startResize = (event: PointerEvent) => {
isResizing.value = true
event.preventDefault()
updateByPointer(event)
document.body.style.cursor = 'col-resize'
document.body.style.userSelect = 'none'
window.addEventListener('pointermove', updateByPointer)
window.addEventListener('pointerup', stopResize)
window.addEventListener('pointercancel', stopResize)
}
const handleKeydown = (event: KeyboardEvent) => {
if (event.key === 'ArrowLeft') {
event.preventDefault()
setLeftPercent(leftPercent.value - KEYBOARD_STEP)
}
if (event.key === 'ArrowRight') {
event.preventDefault()
setLeftPercent(leftPercent.value + KEYBOARD_STEP)
}
}
onBeforeUnmount(() => {
stopResize()
})
</script>
<style scoped>
.tjt-split-pane {
display: flex;
align-items: stretch;
width: 100%;
min-width: 0;
}
.tjt-split-pane__panel {
min-width: 0;
}
.tjt-split-pane__panel--left {
flex: 0 0 50%;
}
.tjt-split-pane__panel--right {
flex: 1 1 0;
}
.tjt-split-pane__resize {
position: relative;
display: flex;
flex: 0 0 16px;
align-items: center;
justify-content: center;
cursor: col-resize;
outline: none;
touch-action: none;
user-select: none;
}
.tjt-split-pane__resize::before {
position: absolute;
top: 0;
bottom: 0;
width: 1px;
content: '';
background: var(--el-border-color);
}
.tjt-split-pane__resize-handle {
position: sticky;
top: calc(50vh - 21px);
z-index: 1;
width: 6px;
height: 42px;
border-radius: 4px;
background: var(--el-border-color);
transition:
width 0.15s ease,
background-color 0.15s ease;
}
.tjt-split-pane__resize:hover .tjt-split-pane__resize-handle,
.tjt-split-pane__resize:focus-visible .tjt-split-pane__resize-handle,
.tjt-split-pane.is-resizing .tjt-split-pane__resize-handle {
width: 8px;
background: var(--el-color-primary);
}
@media (max-width: 900px) {
.tjt-split-pane {
flex-direction: column;
}
.tjt-split-pane__panel--left,
.tjt-split-pane__panel--right {
flex: 0 0 auto;
}
.tjt-split-pane__resize {
display: none;
}
}
</style>

View File

@@ -4,34 +4,75 @@ export type Option<T = string> = {
} }
export const OWNERSHIP_TYPE = { export const OWNERSHIP_TYPE = {
major: '专业所', major: 'major',
comprehensive: '综合所', comprehensive: 'comprehensive',
subcontract: '专业分包' specialSubcontract: 'special_subcontract_major',
sourceCoopSubcontract: 'special_subcontract_source_coop',
comprehensiveSubcontract: 'special_subcontract_comprehensive'
} as const } as const
export const OWNERSHIP_TYPE_LABEL: Record<(typeof OWNERSHIP_TYPE)[keyof typeof OWNERSHIP_TYPE], string> = {
[OWNERSHIP_TYPE.major]: '专业所',
[OWNERSHIP_TYPE.comprehensive]: '综合所',
[OWNERSHIP_TYPE.specialSubcontract]: '专项分包-专业所',
[OWNERSHIP_TYPE.sourceCoopSubcontract]: '专项分包-源头合作分包',
[OWNERSHIP_TYPE.comprehensiveSubcontract]: '专项分包-综合所'
}
export const CALCULATION_METHOD = { export const CALCULATION_METHOD = {
guidancePrice: '指导价法', guidancePrice: 'guidance_price',
contractPrice: '合同价法', contractPrice: 'contract_price',
virtualOutput: '虚拟产值法' virtualOutput: 'virtual_output'
} as const } as const
export const CALCULATION_METHOD_LABEL: Record<
(typeof CALCULATION_METHOD)[keyof typeof CALCULATION_METHOD],
string
> = {
[CALCULATION_METHOD.guidancePrice]: '指导价法',
[CALCULATION_METHOD.contractPrice]: '合同价法',
[CALCULATION_METHOD.virtualOutput]: '虚拟产值法'
}
export const VIRTUAL_CALCULATION_METHOD = { export const VIRTUAL_CALCULATION_METHOD = {
guidancePrice: '指导单价法', guidancePrice: 'guidance_price',
guidanceTotalPrice: '指导总价法', guidanceTotalPrice: 'guidance_total_price',
workingDay: '工日法' workingDay: 'working_day'
} as const } as const
export const VIRTUAL_CALCULATION_METHOD_LABEL: Record<
(typeof VIRTUAL_CALCULATION_METHOD)[keyof typeof VIRTUAL_CALCULATION_METHOD],
string
> = {
[VIRTUAL_CALCULATION_METHOD.guidancePrice]: '指导单价法',
[VIRTUAL_CALCULATION_METHOD.guidanceTotalPrice]: '指导总价法',
[VIRTUAL_CALCULATION_METHOD.workingDay]: '工日法'
}
export const DESIGN_STAGE = { export const DESIGN_STAGE = {
scheme: '方案', scheme: 'scheme',
constructionDrawing: '施工图', constructionDrawing: 'construction_drawing',
schemeAndConstructionDrawing: '方案+施工图' schemeAndConstructionDrawing: 'scheme_and_construction_drawing'
} as const } as const
export const DESIGN_STAGE_LABEL: Record<(typeof DESIGN_STAGE)[keyof typeof DESIGN_STAGE], string> = {
[DESIGN_STAGE.scheme]: '方案',
[DESIGN_STAGE.constructionDrawing]: '施工图',
[DESIGN_STAGE.schemeAndConstructionDrawing]: '方案+施工图'
}
export const DESIGN_PART = { export const DESIGN_PART = {
realEstate: '地上部分', realEstate: 'above_ground',
underground: '地下部分' underground: 'underground',
other: 'other'
} as const } as const
export const DESIGN_PART_LABEL: Record<(typeof DESIGN_PART)[keyof typeof DESIGN_PART], string> = {
[DESIGN_PART.realEstate]: '地上部分',
[DESIGN_PART.underground]: '地下部分',
[DESIGN_PART.other]: '其他'
}
export const PROJECT_TYPE = { export const PROJECT_TYPE = {
building: '建筑工程', building: '建筑工程',
decoration: '精装工程', decoration: '精装工程',
@@ -50,12 +91,19 @@ export const PROJECT_CATEGORY = {
} as const } as const
export const PROJECT_STATUS = { export const PROJECT_STATUS = {
inProgress: '进行中', inProgress: 'in_progress',
completed: '完成', completed: 'completed',
paused: '暂停', paused: 'paused',
terminated: '中止' terminated: 'terminated'
} as const } as const
export const PROJECT_STATUS_LABEL: Record<(typeof PROJECT_STATUS)[keyof typeof PROJECT_STATUS], string> = {
[PROJECT_STATUS.inProgress]: '进行中',
[PROJECT_STATUS.completed]: '完成',
[PROJECT_STATUS.paused]: '暂停',
[PROJECT_STATUS.terminated]: '中止'
}
export const EMPLOYEE_GENDER = { export const EMPLOYEE_GENDER = {
male: '男', male: '男',
female: '女' female: '女'
@@ -98,41 +146,68 @@ export const normalizeProjectStatus = (value?: string) =>
normalizeValue(value, Object.values(PROJECT_STATUS)) normalizeValue(value, Object.values(PROJECT_STATUS))
export const OWNERSHIP_TYPE_OPTIONS: Option[] = [ export const OWNERSHIP_TYPE_OPTIONS: Option[] = [
{ label: OWNERSHIP_TYPE.major, value: OWNERSHIP_TYPE.major }, { label: OWNERSHIP_TYPE_LABEL[OWNERSHIP_TYPE.major], value: OWNERSHIP_TYPE.major },
{ label: OWNERSHIP_TYPE.comprehensive, value: OWNERSHIP_TYPE.comprehensive }, { label: OWNERSHIP_TYPE_LABEL[OWNERSHIP_TYPE.comprehensive], value: OWNERSHIP_TYPE.comprehensive },
{ label: OWNERSHIP_TYPE.subcontract, value: OWNERSHIP_TYPE.subcontract } {
label: OWNERSHIP_TYPE_LABEL[OWNERSHIP_TYPE.specialSubcontract],
value: OWNERSHIP_TYPE.specialSubcontract
},
{
label: OWNERSHIP_TYPE_LABEL[OWNERSHIP_TYPE.sourceCoopSubcontract],
value: OWNERSHIP_TYPE.sourceCoopSubcontract
},
{
label: OWNERSHIP_TYPE_LABEL[OWNERSHIP_TYPE.comprehensiveSubcontract],
value: OWNERSHIP_TYPE.comprehensiveSubcontract
}
] ]
export const CALCULATION_METHOD_OPTIONS: Option[] = [ export const CALCULATION_METHOD_OPTIONS: Option[] = [
{ label: CALCULATION_METHOD.guidancePrice, value: CALCULATION_METHOD.guidancePrice }, {
{ label: CALCULATION_METHOD.contractPrice, value: CALCULATION_METHOD.contractPrice }, label: CALCULATION_METHOD_LABEL[CALCULATION_METHOD.guidancePrice],
{ label: CALCULATION_METHOD.virtualOutput, value: CALCULATION_METHOD.virtualOutput } value: CALCULATION_METHOD.guidancePrice
},
{
label: CALCULATION_METHOD_LABEL[CALCULATION_METHOD.contractPrice],
value: CALCULATION_METHOD.contractPrice
},
{
label: CALCULATION_METHOD_LABEL[CALCULATION_METHOD.virtualOutput],
value: CALCULATION_METHOD.virtualOutput
}
] ]
export const VIRTUAL_CALCULATION_METHOD_OPTIONS: Option[] = [ export const VIRTUAL_CALCULATION_METHOD_OPTIONS: Option[] = [
{ {
label: VIRTUAL_CALCULATION_METHOD.guidancePrice, label: VIRTUAL_CALCULATION_METHOD_LABEL[VIRTUAL_CALCULATION_METHOD.guidancePrice],
value: VIRTUAL_CALCULATION_METHOD.guidancePrice value: VIRTUAL_CALCULATION_METHOD.guidancePrice
}, },
{ {
label: VIRTUAL_CALCULATION_METHOD.guidanceTotalPrice, label: VIRTUAL_CALCULATION_METHOD_LABEL[VIRTUAL_CALCULATION_METHOD.guidanceTotalPrice],
value: VIRTUAL_CALCULATION_METHOD.guidanceTotalPrice value: VIRTUAL_CALCULATION_METHOD.guidanceTotalPrice
}, },
{ label: VIRTUAL_CALCULATION_METHOD.workingDay, value: VIRTUAL_CALCULATION_METHOD.workingDay } {
label: VIRTUAL_CALCULATION_METHOD_LABEL[VIRTUAL_CALCULATION_METHOD.workingDay],
value: VIRTUAL_CALCULATION_METHOD.workingDay
}
] ]
export const DESIGN_STAGE_OPTIONS: Option[] = [ export const DESIGN_STAGE_OPTIONS: Option[] = [
{ label: DESIGN_STAGE.scheme, value: DESIGN_STAGE.scheme }, { label: DESIGN_STAGE_LABEL[DESIGN_STAGE.scheme], value: DESIGN_STAGE.scheme },
{ label: DESIGN_STAGE.constructionDrawing, value: DESIGN_STAGE.constructionDrawing },
{ {
label: DESIGN_STAGE.schemeAndConstructionDrawing, label: DESIGN_STAGE_LABEL[DESIGN_STAGE.constructionDrawing],
value: DESIGN_STAGE.constructionDrawing
},
{
label: DESIGN_STAGE_LABEL[DESIGN_STAGE.schemeAndConstructionDrawing],
value: DESIGN_STAGE.schemeAndConstructionDrawing value: DESIGN_STAGE.schemeAndConstructionDrawing
} }
] ]
export const DESIGN_PART_OPTIONS: Option[] = [ export const DESIGN_PART_OPTIONS: Option[] = [
{ label: DESIGN_PART.realEstate, value: DESIGN_PART.realEstate }, { label: DESIGN_PART_LABEL[DESIGN_PART.realEstate], value: DESIGN_PART.realEstate },
{ label: DESIGN_PART.underground, value: DESIGN_PART.underground } { label: DESIGN_PART_LABEL[DESIGN_PART.underground], value: DESIGN_PART.underground },
{ label: DESIGN_PART_LABEL[DESIGN_PART.other], value: DESIGN_PART.other }
] ]
export const CONTRACT_SIGN_OPTIONS: Option<boolean>[] = [ export const CONTRACT_SIGN_OPTIONS: Option<boolean>[] = [
@@ -158,10 +233,10 @@ export const PROJECT_CATEGORY_OPTIONS: Option[] = [
] ]
export const PROJECT_STATUS_OPTIONS: Option[] = [ export const PROJECT_STATUS_OPTIONS: Option[] = [
{ label: PROJECT_STATUS.inProgress, value: PROJECT_STATUS.inProgress }, { label: PROJECT_STATUS_LABEL[PROJECT_STATUS.inProgress], value: PROJECT_STATUS.inProgress },
{ label: PROJECT_STATUS.completed, value: PROJECT_STATUS.completed }, { label: PROJECT_STATUS_LABEL[PROJECT_STATUS.completed], value: PROJECT_STATUS.completed },
{ label: PROJECT_STATUS.paused, value: PROJECT_STATUS.paused }, { label: PROJECT_STATUS_LABEL[PROJECT_STATUS.paused], value: PROJECT_STATUS.paused },
{ label: PROJECT_STATUS.terminated, value: PROJECT_STATUS.terminated } { label: PROJECT_STATUS_LABEL[PROJECT_STATUS.terminated], value: PROJECT_STATUS.terminated }
] ]
export const EMPLOYEE_GENDER_OPTIONS: Option[] = [ export const EMPLOYEE_GENDER_OPTIONS: Option[] = [
@@ -199,30 +274,59 @@ export const QUARTER_OPTIONS: Option<number>[] = [
{ label: '四季度', value: 4 } { label: '四季度', value: 4 }
] ]
export const OUTPUT_SPLIT_SPECIALTY = {
projectLead: 'project_lead',
arch: 'arch',
decor: 'decor',
struct: 'struct',
water: 'water',
elec: 'elec',
hvac: 'hvac',
digital: 'digital'
} as const
export const OUTPUT_SPLIT_ROLE = {
director: 'director',
check: 'check',
review: 'review',
approve: 'approve',
design: 'design',
projectManager: 'project_manager',
engineeringPrincipal: 'engineering_principal'
} as const
export const OUTPUT_SPLIT_SPECIALTY_OPTIONS: Option[] = [ export const OUTPUT_SPLIT_SPECIALTY_OPTIONS: Option[] = [
{ label: '建筑', value: 'arch' }, { label: '建筑', value: OUTPUT_SPLIT_SPECIALTY.arch },
{ label: '装饰', value: 'decor' }, { label: '装饰', value: OUTPUT_SPLIT_SPECIALTY.decor },
{ label: '结构', value: 'struct' }, { label: '结构', value: OUTPUT_SPLIT_SPECIALTY.struct },
{ label: '给排水', value: 'water' }, { label: '给排水', value: OUTPUT_SPLIT_SPECIALTY.water },
{ label: '电气', value: 'elec' }, { label: '电气', value: OUTPUT_SPLIT_SPECIALTY.elec },
{ label: '暖通', value: 'hvac' }, { label: '暖通', value: OUTPUT_SPLIT_SPECIALTY.hvac },
{ label: '数字化设计', value: 'digital' } { label: '数字化设计', value: OUTPUT_SPLIT_SPECIALTY.digital }
] ]
export const SPECIALTY_ROLE_OPTIONS: Option[] = [ export const SPECIALTY_ROLE_OPTIONS: Option[] = [
{ label: '专业负责人', value: 'director' }, { label: '专业负责人', value: OUTPUT_SPLIT_ROLE.director },
{ label: '校对', value: 'check' }, { label: '校对', value: OUTPUT_SPLIT_ROLE.check },
{ label: '审核', value: 'review' }, { label: '审核', value: OUTPUT_SPLIT_ROLE.review },
{ label: '审定', value: 'approve' }, { label: '审定', value: OUTPUT_SPLIT_ROLE.approve },
{ label: '设计', value: 'design' } { label: '设计', value: OUTPUT_SPLIT_ROLE.design }
] ]
export const isMajorOwnership = (value?: string) => export const isMajorOwnership = (value?: string) =>
normalizeOwnershipType(value) === OWNERSHIP_TYPE.major normalizeOwnershipType(value) === OWNERSHIP_TYPE.major
export const isComprehensiveOwnership = (value?: string) => export const isComprehensiveOwnership = (value?: string) =>
normalizeOwnershipType(value) === OWNERSHIP_TYPE.comprehensive normalizeOwnershipType(value) === OWNERSHIP_TYPE.comprehensive
export const isSpecialSubcontractOwnership = (value?: string) =>
normalizeOwnershipType(value) === OWNERSHIP_TYPE.specialSubcontract
export const isSourceCoopSubcontractOwnership = (value?: string) =>
normalizeOwnershipType(value) === OWNERSHIP_TYPE.sourceCoopSubcontract
export const isComprehensiveSubcontractOwnership = (value?: string) =>
normalizeOwnershipType(value) === OWNERSHIP_TYPE.comprehensiveSubcontract
export const isSubcontractOwnership = (value?: string) => export const isSubcontractOwnership = (value?: string) =>
normalizeOwnershipType(value) === OWNERSHIP_TYPE.subcontract isSpecialSubcontractOwnership(value) ||
isSourceCoopSubcontractOwnership(value) ||
isComprehensiveSubcontractOwnership(value)
export const isGuidancePriceMethod = (value?: string) => export const isGuidancePriceMethod = (value?: string) =>
normalizeCalculationMethod(value) === CALCULATION_METHOD.guidancePrice normalizeCalculationMethod(value) === CALCULATION_METHOD.guidancePrice

View File

@@ -73,8 +73,8 @@
/> />
</ContentWrap> </ContentWrap>
<el-row :gutter="16"> <SplitPane>
<el-col :span="8"> <template #left>
<ContentWrap> <ContentWrap>
<div class="mb-12px text-14px font-600"> <div class="mb-12px text-14px font-600">
{{ currentProject?.projectName || '合约规划列表' }} {{ currentProject?.projectName || '合约规划列表' }}
@@ -86,7 +86,6 @@
highlight-current-row highlight-current-row
@current-change="handleCurrentPlanningChange" @current-change="handleCurrentPlanningChange"
> >
<el-table-column align="center" label="序号" type="index" width="70" />
<el-table-column align="center" label="项目任务包" min-width="180" prop="planningContent" /> <el-table-column align="center" label="项目任务包" min-width="180" prop="planningContent" />
<el-table-column align="center" label="归属类型" min-width="110"> <el-table-column align="center" label="归属类型" min-width="110">
<template #default="scope"> <template #default="scope">
@@ -101,16 +100,32 @@
</el-table-column> </el-table-column>
<el-table-column align="center" label="排序" prop="sortNo" width="80" /> <el-table-column align="center" label="排序" prop="sortNo" width="80" />
</el-table> </el-table>
<PlanningOwnershipSummary
:planning-list="planningList"
amount-field="assessmentOutputValue"
amount-label="考核产值()"
title="归属类型考核产值合计"
/>
</ContentWrap> </ContentWrap>
</el-col> </template>
<el-col :span="16"> <template #right>
<ContentWrap> <ContentWrap>
<div v-loading="roleLoading" class="min-h-320px"> <div v-loading="roleLoading" class="min-h-320px">
<template v-if="currentPlanning && currentGroup"> <template v-if="currentPlanning && currentGroup">
<div class="mb-16px flex items-center justify-between gap-12px"> <div class="mb-16px flex items-center justify-between gap-12px">
<div class="text-16px font-600">{{ currentPlanning.planningContent }}</div> <div class="text-16px font-600">{{ currentPlanning.planningContent }}</div>
<div class="flex items-center gap-12px"> <div class="flex items-center gap-12px">
<el-button
v-hasPermi="['tjt:specialty-role-split:update']"
:disabled="copyPlanningOptions.length === 0"
plain
type="primary"
@click="openCopyDialog"
>
<Icon class="mr-5px" icon="ep:copy-document" />
复制人员设置
</el-button>
<el-button <el-button
v-hasPermi="['tjt:specialty-role-split:update']" v-hasPermi="['tjt:specialty-role-split:update']"
plain plain
@@ -179,8 +194,8 @@
<el-empty v-else-if="!roleLoading" description="请选择合约规划后查看人员分配" /> <el-empty v-else-if="!roleLoading" description="请选择合约规划后查看人员分配" />
</div> </div>
</ContentWrap> </ContentWrap>
</el-col> </template>
</el-row> </SplitPane>
<Dialog v-model="dialogVisible" title="编辑专业人员角色分配" width="1180"> <Dialog v-model="dialogVisible" title="编辑专业人员角色分配" width="1180">
<template v-if="currentEditGroup"> <template v-if="currentEditGroup">
@@ -313,6 +328,31 @@
<el-button @click="dialogVisible = false">取消</el-button> <el-button @click="dialogVisible = false">取消</el-button>
</template> </template>
</Dialog> </Dialog>
<Dialog v-model="copyDialogVisible" title="复制其他任务包人员设置" width="560">
<el-form label-width="96px">
<el-form-item label="来源任务包">
<el-select
v-model="copySourcePlanningId"
class="!w-1/1"
filterable
placeholder="请选择任务包"
>
<el-option
v-for="item in copyPlanningOptions"
:key="item.id"
:label="buildPlanningOptionLabel(item)"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-form>
<template #footer>
<el-button :loading="copyLoading" type="primary" @click="handleCopyConfirm">确定复制</el-button>
<el-button @click="copyDialogVisible = false">取消</el-button>
</template>
</Dialog>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
@@ -320,20 +360,24 @@ import * as EmployeeApi from '@/api/tjt/employee'
import * as ProjectApi from '@/api/tjt/project' import * as ProjectApi from '@/api/tjt/project'
import * as PlanningApi from '@/api/tjt/planning' import * as PlanningApi from '@/api/tjt/planning'
import * as SpecialtyRoleSplitApi from '@/api/tjt/specialtyRoleSplit' import * as SpecialtyRoleSplitApi from '@/api/tjt/specialtyRoleSplit'
import PlanningOwnershipSummary from '@/views/tjt/shared/PlanningOwnershipSummary.vue'
import SplitPane from '@/views/tjt/shared/SplitPane.vue'
import { import {
formatAmountText, formatAmountText,
formatPercentText, formatPercentText,
fromPercentValue, fromPercentValue,
getOwnershipTypeLabel, getOwnershipTypeLabel,
OUTPUT_SPLIT_ROLE,
OUTPUT_SPLIT_SPECIALTY,
toPercentValue toPercentValue
} from '@/views/tjt/shared/planning' } from '@/views/tjt/shared/planning'
defineOptions({ name: 'TjtStaffAssignment' }) defineOptions({ name: 'TjtStaffAssignment' })
const DESIGN_ROLE_CODE = 'design' const DESIGN_ROLE_CODE = OUTPUT_SPLIT_ROLE.design
const PROJECT_LEAD_GROUP_CODE = 'project_lead' const PROJECT_LEAD_GROUP_CODE = OUTPUT_SPLIT_SPECIALTY.projectLead
const ROLE_PROJECT_MANAGER = 'project_manager' const ROLE_PROJECT_MANAGER = OUTPUT_SPLIT_ROLE.projectManager
const ROLE_ENGINEERING_PRINCIPAL = 'engineering_principal' const ROLE_ENGINEERING_PRINCIPAL = OUTPUT_SPLIT_ROLE.engineeringPrincipal
const EPSILON = 0.0001 const EPSILON = 0.0001
type SpecialtyRolePersonVO = SpecialtyRoleSplitApi.SpecialtyRolePersonVO type SpecialtyRolePersonVO = SpecialtyRoleSplitApi.SpecialtyRolePersonVO
@@ -354,6 +398,7 @@ const loading = ref(false)
const planningLoading = ref(false) const planningLoading = ref(false)
const roleLoading = ref(false) const roleLoading = ref(false)
const saveLoading = ref(false) const saveLoading = ref(false)
const copyLoading = ref(false)
const total = ref(0) const total = ref(0)
const projectList = ref<ProjectApi.ProjectVO[]>([]) const projectList = ref<ProjectApi.ProjectVO[]>([])
const planningList = ref<PlanningApi.ProjectPlanningVO[]>([]) const planningList = ref<PlanningApi.ProjectPlanningVO[]>([])
@@ -364,6 +409,8 @@ const editRoleList = ref<SpecialtyRoleSplitVO[]>([])
const selectedGroupCode = ref('') const selectedGroupCode = ref('')
const editGroupCode = ref('') const editGroupCode = ref('')
const dialogVisible = ref(false) const dialogVisible = ref(false)
const copyDialogVisible = ref(false)
const copySourcePlanningId = ref<number>()
const employeeOptions = ref<EmployeeApi.EmployeeSimpleVO[]>([]) const employeeOptions = ref<EmployeeApi.EmployeeSimpleVO[]>([])
const employeeLoading = ref(false) const employeeLoading = ref(false)
const queryFormRef = ref() const queryFormRef = ref()
@@ -545,6 +592,12 @@ const currentEditGroup = computed(
() => () =>
editGroups.value.find((item) => item.specialtyCode === editGroupCode.value) || editGroups.value[0] editGroups.value.find((item) => item.specialtyCode === editGroupCode.value) || editGroups.value[0]
) )
const copyPlanningOptions = computed<Array<PlanningApi.ProjectPlanningVO & { id: number }>>(() =>
planningList.value.filter(
(item): item is PlanningApi.ProjectPlanningVO & { id: number } =>
typeof item.id === 'number' && item.id !== currentPlanning.value?.id
)
)
const isProjectLeadRow = (row?: SpecialtyRoleSplitVO) => row?.specialtyCode === PROJECT_LEAD_GROUP_CODE const isProjectLeadRow = (row?: SpecialtyRoleSplitVO) => row?.specialtyCode === PROJECT_LEAD_GROUP_CODE
const isEngineeringPrincipalRole = (row?: SpecialtyRoleSplitVO) => const isEngineeringPrincipalRole = (row?: SpecialtyRoleSplitVO) =>
row?.roleCode === ROLE_ENGINEERING_PRINCIPAL row?.roleCode === ROLE_ENGINEERING_PRINCIPAL
@@ -713,9 +766,9 @@ const buildSavePersons = (
return { persons } return { persons }
} }
const buildSaveItems = (validate: boolean) => { const buildSaveItems = (validate: boolean, sourceGroups = editGroups.value) => {
const items: SpecialtyRoleSplitApi.SpecialtyRoleSplitSaveItemVO[] = [] const items: SpecialtyRoleSplitApi.SpecialtyRoleSplitSaveItemVO[] = []
for (const group of editGroups.value) { for (const group of sourceGroups) {
let roleTotal = 0 let roleTotal = 0
for (const row of group.rows) { for (const row of group.rows) {
const result = buildSavePersons(row, validate) const result = buildSavePersons(row, validate)
@@ -855,6 +908,83 @@ const openEditDialog = () => {
dialogVisible.value = true dialogVisible.value = true
} }
const buildPlanningOptionLabel = (item: PlanningApi.ProjectPlanningVO) => {
const parts = [item.planningContent]
if (item.planningStartYear) {
parts.push(String(item.planningStartYear))
}
return parts.filter(Boolean).join(' / ')
}
const openCopyDialog = () => {
if (!currentPlanning.value?.id) {
return
}
if (!copyPlanningOptions.value.length) {
message.warning('暂无可复制的其他任务包')
return
}
copySourcePlanningId.value = copyPlanningOptions.value[0]?.id
copyDialogVisible.value = true
}
const buildCopiedRoleRows = (sourceRows: SpecialtyRoleSplitVO[]) => {
const sourceMap = new Map(
sourceRows.map((item) => [`${item.specialtyCode}:${item.roleCode}`, item] as const)
)
const rows = roleList.value.map((targetRow) => {
const sourceRow = sourceMap.get(`${targetRow.specialtyCode}:${targetRow.roleCode}`)
return buildEditableRow({
...targetRow,
roleRatio: sourceRow?.roleRatio ?? targetRow.roleRatio,
persons: isProjectLeadRow(targetRow) ? targetRow.persons || [] : sourceRow?.persons || []
})
})
rows.forEach((row) => syncRoleRatiosForGroup(rows, row.specialtyCode))
syncAllDerivedValues(rows)
return rows
}
const handleCopyConfirm = async () => {
if (!currentPlanning.value?.id || !copySourcePlanningId.value) {
message.warning('请选择来源任务包')
return
}
try {
await message.confirm('确认用所选任务包的人员分配设置替换当前任务包吗?')
} catch {
return
}
copyLoading.value = true
try {
const sourceData = await SpecialtyRoleSplitApi.getSpecialtyRoleSplitListByPlanningId(
copySourcePlanningId.value
)
const sourceRows = cloneRoleRows(sourceData)
if (!sourceRows.length) {
message.warning('来源任务包暂无人员分配设置')
return
}
sourceRows.forEach((row) => syncRoleRatiosForGroup(sourceRows, row.specialtyCode))
syncAllDerivedValues(sourceRows)
const copiedRows = buildCopiedRoleRows(sourceRows)
const items = buildSaveItems(false, buildGroups(copiedRows))
if (!items) {
return
}
await SpecialtyRoleSplitApi.saveSpecialtyRoleSplitBatch({
planningId: currentPlanning.value.id,
items,
temporarySave: true
})
message.success('复制人员分配设置成功')
copyDialogVisible.value = false
await loadRoleList(currentPlanning.value.id)
} finally {
copyLoading.value = false
}
}
const saveRoleSplit = async (temporarySave: boolean) => { const saveRoleSplit = async (temporarySave: boolean) => {
if (!currentPlanning.value?.id) { if (!currentPlanning.value?.id) {
return return