Compare commits
12 Commits
1fbf02a310
...
master-lzm
| Author | SHA1 | Date | |
|---|---|---|---|
| 4048454ff5 | |||
| 81d259b44a | |||
| bacc2f739f | |||
| 0150d1bf9a | |||
| 0e8dcb1f71 | |||
| 47f48aa09f | |||
| 8bbb03bae7 | |||
| 761112715d | |||
| 865ef2aebe | |||
| 4a0ff37963 | |||
| 5cb913cb0a | |||
| ddc0c7db1e |
@@ -13,6 +13,7 @@ export interface EmployeeVO {
|
||||
leaveDate?: string
|
||||
employeeStatus: string
|
||||
remark?: string
|
||||
officeLeaderFlag?: boolean
|
||||
sortNo?: number
|
||||
enabledFlag?: boolean
|
||||
createTime?: string
|
||||
@@ -23,6 +24,7 @@ export interface EmployeePageReqVO extends PageParam {
|
||||
officeId?: number
|
||||
employeeStatus?: string
|
||||
enabledFlag?: boolean
|
||||
officeLeaderFlag?: boolean
|
||||
}
|
||||
|
||||
export interface EmployeeSimpleVO {
|
||||
@@ -33,6 +35,7 @@ export interface EmployeeSimpleVO {
|
||||
employeeStatus?: string
|
||||
registrationType?: string
|
||||
jobTitle?: string
|
||||
officeLeaderFlag?: boolean
|
||||
}
|
||||
|
||||
export const getEmployeePage = (params: EmployeePageReqVO) => {
|
||||
@@ -60,6 +63,7 @@ export const getEmployeeSimpleList = (params: {
|
||||
officeId?: number
|
||||
status?: string
|
||||
enabledFlag?: boolean
|
||||
officeLeaderFlag?: boolean
|
||||
}) => {
|
||||
return request.get({ url: '/tjt/employee/simple-list', params })
|
||||
}
|
||||
|
||||
@@ -19,6 +19,18 @@ export interface EmployeeYearCostBudgetPageReqVO extends PageParam {
|
||||
enabledFlag?: boolean
|
||||
}
|
||||
|
||||
export interface EmployeeYearCostBudgetGenerateReqVO {
|
||||
budgetYear: number
|
||||
expectedCostAmount?: number
|
||||
}
|
||||
|
||||
export interface EmployeeYearCostBudgetGenerateRespVO {
|
||||
budgetYear: number
|
||||
totalEnabledEmployeeCount: number
|
||||
createdCount: number
|
||||
skippedCount: number
|
||||
}
|
||||
|
||||
export const getEmployeeYearCostBudgetPage = (params: EmployeeYearCostBudgetPageReqVO) => {
|
||||
return request.get({ url: '/tjt/employee-year-cost-budget/page', params })
|
||||
}
|
||||
@@ -31,6 +43,10 @@ export const createEmployeeYearCostBudget = (data: EmployeeYearCostBudgetVO) =>
|
||||
return request.post({ url: '/tjt/employee-year-cost-budget/create', data })
|
||||
}
|
||||
|
||||
export const generateEmployeeYearCostBudget = (data: EmployeeYearCostBudgetGenerateReqVO) => {
|
||||
return request.post({ url: '/tjt/employee-year-cost-budget/generate', data })
|
||||
}
|
||||
|
||||
export const updateEmployeeYearCostBudget = (data: EmployeeYearCostBudgetVO) => {
|
||||
return request.put({ url: '/tjt/employee-year-cost-budget/update', data })
|
||||
}
|
||||
|
||||
56
src/api/tjt/employeeYearLeaderOutput/index.ts
Normal file
56
src/api/tjt/employeeYearLeaderOutput/index.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
export interface EmployeeYearLeaderOutputVO {
|
||||
id?: number
|
||||
employeeId: number
|
||||
employeeName?: string
|
||||
outputYear: number
|
||||
leaderOutputAmount: number
|
||||
remark?: string
|
||||
sortNo?: number
|
||||
enabledFlag?: boolean
|
||||
createTime?: string
|
||||
}
|
||||
|
||||
export interface EmployeeYearLeaderOutputPageReqVO extends PageParam {
|
||||
employeeId?: number
|
||||
employeeName?: string
|
||||
outputYear?: number
|
||||
enabledFlag?: boolean
|
||||
}
|
||||
|
||||
export interface EmployeeYearLeaderOutputGenerateReqVO {
|
||||
outputYear: number
|
||||
leaderOutputAmount?: number
|
||||
}
|
||||
|
||||
export interface EmployeeYearLeaderOutputGenerateRespVO {
|
||||
outputYear: number
|
||||
totalEnabledLeaderCount: number
|
||||
createdCount: number
|
||||
skippedCount: number
|
||||
}
|
||||
|
||||
export const getEmployeeYearLeaderOutputPage = (params: EmployeeYearLeaderOutputPageReqVO) => {
|
||||
return request.get({ url: '/tjt/employee-year-leader-output/page', params })
|
||||
}
|
||||
|
||||
export const getEmployeeYearLeaderOutput = (id: number) => {
|
||||
return request.get({ url: '/tjt/employee-year-leader-output/get', params: { id } })
|
||||
}
|
||||
|
||||
export const createEmployeeYearLeaderOutput = (data: EmployeeYearLeaderOutputVO) => {
|
||||
return request.post({ url: '/tjt/employee-year-leader-output/create', data })
|
||||
}
|
||||
|
||||
export const generateEmployeeYearLeaderOutput = (data: EmployeeYearLeaderOutputGenerateReqVO) => {
|
||||
return request.post({ url: '/tjt/employee-year-leader-output/generate', data })
|
||||
}
|
||||
|
||||
export const updateEmployeeYearLeaderOutput = (data: EmployeeYearLeaderOutputVO) => {
|
||||
return request.put({ url: '/tjt/employee-year-leader-output/update', data })
|
||||
}
|
||||
|
||||
export const deleteEmployeeYearLeaderOutput = (id: number) => {
|
||||
return request.delete({ url: '/tjt/employee-year-leader-output/delete', params: { id } })
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
import request from '@/config/axios'
|
||||
import type { ProjectPlanningVO } from '@/api/tjt/planning'
|
||||
import type { ProjectPlanningQuarterVO } from '@/api/tjt/planningQuarter'
|
||||
|
||||
export interface ProjectOutputSplitVO {
|
||||
id?: number
|
||||
@@ -45,10 +47,20 @@ export type ProjectOutputSplitSaveVO = Pick<
|
||||
| 'digitalRatio'
|
||||
>
|
||||
|
||||
export interface ProjectOutputSplitPlanningDetailVO {
|
||||
planning: ProjectPlanningVO
|
||||
outputSplit: ProjectOutputSplitVO
|
||||
quarters: ProjectPlanningQuarterVO[]
|
||||
}
|
||||
|
||||
export const getProjectOutputSplitByPlanningId = (planningId: number) => {
|
||||
return request.get({ url: '/tjt/output-split/get-by-planning', params: { planningId } })
|
||||
}
|
||||
|
||||
export const getProjectOutputSplitPlanningDetail = (planningId: number) => {
|
||||
return request.get({ url: '/tjt/output-split/planning-detail', params: { planningId } })
|
||||
}
|
||||
|
||||
export const saveProjectOutputSplit = (data: ProjectOutputSplitSaveVO) => {
|
||||
return request.put({ url: '/tjt/output-split/save', data })
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import request from '@/config/axios'
|
||||
import type { ProjectPlanningGuideDetailVO } from '@/api/tjt/planningGuideDetail'
|
||||
|
||||
export interface ProjectPlanningVO {
|
||||
id?: number
|
||||
projectId: number
|
||||
sortNo?: number
|
||||
sortNo?: string
|
||||
ownershipType: string
|
||||
calculationMethod: string
|
||||
planningContent: string
|
||||
@@ -54,7 +55,6 @@ export type ProjectPlanningSaveVO = Omit<
|
||||
| 'managementFee'
|
||||
| 'vatAmount'
|
||||
| 'projectBudgetOutputValue'
|
||||
| 'contractUnitPrice'
|
||||
| 'totalAdjustmentFactor'
|
||||
| 'assessmentArea'
|
||||
| 'virtualOutputValue'
|
||||
@@ -71,6 +71,11 @@ export interface ProjectPlanningPageReqVO extends PageParam {
|
||||
createTime?: string[]
|
||||
}
|
||||
|
||||
export interface ProjectPlanningOutputEditDetailVO {
|
||||
planning: ProjectPlanningVO
|
||||
guideDetails: ProjectPlanningGuideDetailVO[]
|
||||
}
|
||||
|
||||
export const getProjectPlanningPage = (params: ProjectPlanningPageReqVO) => {
|
||||
return request.get({ url: '/tjt/planning/page', params })
|
||||
}
|
||||
@@ -79,6 +84,10 @@ export const getProjectPlanning = (id: number) => {
|
||||
return request.get({ url: '/tjt/planning/get', params: { id } })
|
||||
}
|
||||
|
||||
export const getProjectPlanningOutputEditDetail = (id: number) => {
|
||||
return request.get({ url: '/tjt/planning/output-edit-detail', params: { id } })
|
||||
}
|
||||
|
||||
export const getProjectPlanningListByProjectId = (projectId: number) => {
|
||||
return request.get({ url: '/tjt/planning/list-by-project', params: { projectId } })
|
||||
}
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
import request from '@/config/axios'
|
||||
import type { ProjectPlanningVO } from '@/api/tjt/planning'
|
||||
import type { ProjectPlanningGuideDetailVO } from '@/api/tjt/planningGuideDetail'
|
||||
|
||||
export interface ProjectPlanningQuarterVO {
|
||||
id?: number
|
||||
planningId: number
|
||||
guideDetailId?: number
|
||||
guideDetailSortNo?: number
|
||||
distributionYear: number
|
||||
quarterNo: number
|
||||
distributionRatio?: number
|
||||
@@ -15,6 +19,22 @@ export type ProjectPlanningQuarterSaveVO = Omit<
|
||||
'distributionAmount' | 'createTime'
|
||||
>
|
||||
|
||||
export interface ProjectPlanningQuarterPlanningDetailVO {
|
||||
planning: ProjectPlanningVO
|
||||
quarters: ProjectPlanningQuarterVO[]
|
||||
guideDetailMode?: boolean
|
||||
historyParentMode?: boolean
|
||||
message?: string
|
||||
parentQuarters?: ProjectPlanningQuarterVO[]
|
||||
guideDetails?: ProjectPlanningQuarterGuideDetailVO[]
|
||||
}
|
||||
|
||||
export interface ProjectPlanningQuarterGuideDetailVO extends ProjectPlanningGuideDetailVO {
|
||||
allocatedAmount?: number
|
||||
pendingAmount?: number
|
||||
quarters: ProjectPlanningQuarterVO[]
|
||||
}
|
||||
|
||||
export const getProjectPlanningQuarter = (id: number) => {
|
||||
return request.get({ url: '/tjt/planning-quarter/get', params: { id } })
|
||||
}
|
||||
@@ -23,6 +43,13 @@ export const getProjectPlanningQuarterListByPlanningId = (planningId: number) =>
|
||||
return request.get({ url: '/tjt/planning-quarter/list-by-planning', params: { planningId } })
|
||||
}
|
||||
|
||||
export const getProjectPlanningQuarterPlanningDetail = (planningId: number) => {
|
||||
return request.get({
|
||||
url: '/tjt/planning-quarter/planning-detail',
|
||||
params: { planningId }
|
||||
})
|
||||
}
|
||||
|
||||
export const createProjectPlanningQuarter = (data: ProjectPlanningQuarterSaveVO) => {
|
||||
return request.post({ url: '/tjt/planning-quarter/create', data })
|
||||
}
|
||||
|
||||
@@ -3,12 +3,16 @@ import request from '@/config/axios'
|
||||
export interface ProjectProfitVO {
|
||||
projectId: number
|
||||
projectName: string
|
||||
sortNo?: number
|
||||
sortNo?: string
|
||||
contractSignedFlag: boolean
|
||||
contractAmount?: number
|
||||
finalSettlementAmount?: number
|
||||
effectiveSettlementAmount?: number
|
||||
comprehensivePlanningAmount?: number
|
||||
subcontractPlanningAmount?: number
|
||||
specialSubcontractPlanningAmount?: number
|
||||
sourceCoopSubcontractPlanningAmount?: number
|
||||
comprehensiveSubcontractPlanningAmount?: number
|
||||
majorOutputValue?: number
|
||||
majorExpectedPerformance?: number
|
||||
innovationOutputRate?: number
|
||||
@@ -18,6 +22,47 @@ export interface ProjectProfitVO {
|
||||
profitLossRate?: number
|
||||
projectStartYear?: number
|
||||
createTime?: string
|
||||
budgetSnapshot?: ProjectProfitSnapshotVO
|
||||
accountingSnapshot?: ProjectProfitSnapshotVO
|
||||
settlementSnapshot?: ProjectProfitSnapshotVO
|
||||
}
|
||||
|
||||
export interface ProjectProfitSnapshotVO {
|
||||
id?: number
|
||||
projectId: number
|
||||
snapshotType: 'budget' | 'accounting' | 'settlement'
|
||||
lockedFlag?: boolean
|
||||
actionUserId?: number
|
||||
actionUserName?: string
|
||||
actionTime?: string
|
||||
contractAmount?: number
|
||||
finalSettlementAmount?: number
|
||||
effectiveSettlementAmount?: number
|
||||
comprehensivePlanningAmount?: number
|
||||
subcontractPlanningAmount?: number
|
||||
specialSubcontractPlanningAmount?: number
|
||||
sourceCoopSubcontractPlanningAmount?: number
|
||||
comprehensiveSubcontractPlanningAmount?: number
|
||||
majorOutputValue?: number
|
||||
majorExpectedPerformance?: number
|
||||
innovationOutputRate?: number
|
||||
innovationOutputValue?: number
|
||||
otherCost?: number
|
||||
profitLossValue?: number
|
||||
profitLossRate?: number
|
||||
assessmentResult?: string
|
||||
assessmentCoefficient?: number
|
||||
comprehensiveAccountingOutputValue?: number
|
||||
comprehensiveSettlementOutputValue?: number
|
||||
majorAccountingOutputValue?: number
|
||||
majorSettlementOutputValue?: number
|
||||
remark?: string
|
||||
}
|
||||
|
||||
export interface ProjectProfitSettlementSaveReqVO {
|
||||
projectId: number
|
||||
assessmentResult?: string
|
||||
remark?: string
|
||||
}
|
||||
|
||||
export interface ProjectProfitPageReqVO extends PageParam {
|
||||
@@ -34,3 +79,15 @@ export const getProjectProfitPage = (params: ProjectProfitPageReqVO) => {
|
||||
export const getProjectProfit = (projectId: number) => {
|
||||
return request.get({ url: '/tjt/profit/get', params: { projectId } })
|
||||
}
|
||||
|
||||
export const lockBudgetSnapshot = (projectId: number) => {
|
||||
return request.post({ url: '/tjt/profit/lock-budget', params: { projectId } })
|
||||
}
|
||||
|
||||
export const lockAccountingSnapshot = (projectId: number) => {
|
||||
return request.post({ url: '/tjt/profit/lock-accounting', params: { projectId } })
|
||||
}
|
||||
|
||||
export const saveSettlementSnapshot = (data: ProjectProfitSettlementSaveReqVO) => {
|
||||
return request.put({ url: '/tjt/profit/save-settlement', data })
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ export interface ProjectRolePersonVO {
|
||||
export interface ProjectVO {
|
||||
id?: number
|
||||
projectName: string
|
||||
sortNo?: number
|
||||
sortNo?: string
|
||||
contractSignedFlag: boolean
|
||||
contractAmount?: number
|
||||
totalConstructionArea?: number
|
||||
|
||||
@@ -6,6 +6,41 @@ export interface ProjectOverviewExportReqVO {
|
||||
sortType?: string
|
||||
}
|
||||
|
||||
export interface ProjectOverviewPreviewRespVO {
|
||||
year?: number
|
||||
officeName?: string
|
||||
employeeColumns?: ProjectOverviewEmployeeColumn[]
|
||||
rows?: ProjectOverviewProjectRow[]
|
||||
totalRow?: ProjectOverviewProjectRow
|
||||
}
|
||||
|
||||
export interface ProjectOverviewEmployeeColumn {
|
||||
employeeId?: number
|
||||
employeeName?: string
|
||||
}
|
||||
|
||||
export interface ProjectOverviewProjectRow {
|
||||
serialNo?: number
|
||||
totalRow?: boolean
|
||||
projectName?: string
|
||||
progressText?: string
|
||||
workStage?: string
|
||||
totalOutputAmountWan?: number
|
||||
historicalIssuedRatio?: number
|
||||
currentSettlementRatio?: number
|
||||
currentSettlementAmountWan?: number
|
||||
pendingRatio?: number
|
||||
employeeAmountMap?: Record<string, ProjectOverviewEmployeeAmountValue>
|
||||
}
|
||||
|
||||
export interface ProjectOverviewEmployeeAmountValue {
|
||||
quarterOneAmountWan?: number
|
||||
quarterTwoAmountWan?: number
|
||||
quarterThreeAmountWan?: number
|
||||
quarterFourAmountWan?: number
|
||||
annualTotalAmountWan?: number
|
||||
}
|
||||
|
||||
export interface EmployeeOutputSummaryExportReqVO {
|
||||
year?: number
|
||||
officeId?: number
|
||||
@@ -14,19 +49,174 @@ export interface EmployeeOutputSummaryExportReqVO {
|
||||
sortType?: string
|
||||
}
|
||||
|
||||
export interface EmployeeOutputSummaryPreviewRespVO {
|
||||
year?: number
|
||||
kValue?: number
|
||||
rows?: EmployeeOutputSummaryRow[]
|
||||
totalRow?: EmployeeOutputSummaryRow
|
||||
}
|
||||
|
||||
export interface EmployeeOutputSummaryRow {
|
||||
serialNo?: number
|
||||
employeeName?: string
|
||||
officeName?: string
|
||||
quarterOneAmount?: number
|
||||
quarterTwoAmount?: number
|
||||
quarterThreeAmount?: number
|
||||
quarterFourAmount?: number
|
||||
annualTotalAmount?: number
|
||||
officeLeaderOrBimAmount?: number
|
||||
totalAssessmentOutputAmount?: number
|
||||
expectedCostAmount?: number
|
||||
basicAssessmentOutputAmount?: number
|
||||
remainingOutputAmount?: number
|
||||
estimatedYearEndPerformanceAmount?: number
|
||||
totalRow?: boolean
|
||||
}
|
||||
|
||||
export interface ProjectBudgetExportReqVO {
|
||||
projectId: 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 {
|
||||
planningId: number
|
||||
projectId: number
|
||||
year?: number
|
||||
}
|
||||
|
||||
export interface ProjectLeadQuarterOutputExportReqVO {
|
||||
planningId: number
|
||||
export interface ProjectQuarterOutputPreviewRespVO {
|
||||
projectCode?: string
|
||||
projectName?: string
|
||||
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 {
|
||||
@@ -35,10 +225,76 @@ export interface SpecialtyPersonOutputExportReqVO {
|
||||
year?: number
|
||||
}
|
||||
|
||||
export interface SpecialtyPersonOutputPreviewReqVO {
|
||||
planningId: number
|
||||
year?: number
|
||||
}
|
||||
|
||||
export interface SpecialtyPersonOutputPreviewRespVO {
|
||||
planningId: number
|
||||
year: number
|
||||
projectName?: string
|
||||
groups?: SpecialtyPersonOutputPreviewGroupRow[]
|
||||
}
|
||||
|
||||
export interface SpecialtyPersonOutputPreviewGroupRow {
|
||||
specialtyCode: string
|
||||
specialtyName?: string
|
||||
exportable?: boolean
|
||||
specialtyAmount?: number
|
||||
roleTotal?: number
|
||||
personCount?: number
|
||||
overRatio?: boolean
|
||||
specialtyQuarterOneAmountWan?: number
|
||||
specialtyQuarterTwoAmountWan?: number
|
||||
specialtyQuarterThreeAmountWan?: number
|
||||
specialtyQuarterFourAmountWan?: number
|
||||
specialtyYearTotalAmountWan?: number
|
||||
rows: SpecialtyPersonOutputPreviewRoleRow[]
|
||||
}
|
||||
|
||||
export interface SpecialtyPersonOutputPreviewRoleRow {
|
||||
specialtyCode: string
|
||||
specialtyName?: string
|
||||
roleCode: string
|
||||
roleName?: string
|
||||
roleRatio?: number
|
||||
roleAmount?: number
|
||||
personTotalRatio?: number
|
||||
persons: SpecialtyPersonOutputPreviewPersonRow[]
|
||||
}
|
||||
|
||||
export interface SpecialtyPersonOutputPreviewPersonRow {
|
||||
personKey: string
|
||||
employeeId?: number
|
||||
employeeName?: string
|
||||
personRatio?: number
|
||||
personAmount?: number
|
||||
roleNames?: string
|
||||
adjustedPersonRatio?: number
|
||||
quarterOneRatio?: number
|
||||
quarterOneAmountWan?: number
|
||||
quarterTwoRatio?: number
|
||||
quarterTwoAmountWan?: number
|
||||
quarterThreeRatio?: number
|
||||
quarterThreeAmountWan?: number
|
||||
quarterFourRatio?: number
|
||||
quarterFourAmountWan?: number
|
||||
yearTotalRatio?: number
|
||||
yearTotalAmountWan?: number
|
||||
}
|
||||
|
||||
export const exportProjectBudget = (params: ProjectBudgetExportReqVO) => {
|
||||
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) => {
|
||||
return request.download({
|
||||
url: '/tjt/report/project-quarter-output/export-excel',
|
||||
@@ -46,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) => {
|
||||
return request.download({
|
||||
url: '/tjt/report/project-lead-quarter-output/export-excel',
|
||||
@@ -53,14 +316,39 @@ 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) => {
|
||||
return request.download({ url: '/tjt/report/specialty-person-output/export-excel', params })
|
||||
}
|
||||
|
||||
export const getSpecialtyPersonOutputPreview = (params: SpecialtyPersonOutputPreviewReqVO) => {
|
||||
return request.get({ url: '/tjt/report/specialty-person-output/preview', params })
|
||||
}
|
||||
|
||||
export const exportProjectOverview = (params: ProjectOverviewExportReqVO) => {
|
||||
return request.download({ url: '/tjt/report/project-overview/export-excel', params })
|
||||
}
|
||||
|
||||
export const getProjectOverviewPreview = (params: ProjectOverviewExportReqVO) => {
|
||||
return request.get<ProjectOverviewPreviewRespVO>({
|
||||
url: '/tjt/report/project-overview/preview',
|
||||
params: { ...params, _t: Date.now() }
|
||||
})
|
||||
}
|
||||
|
||||
export const exportEmployeeOutputSummary = (params: EmployeeOutputSummaryExportReqVO) => {
|
||||
return request.download({ url: '/tjt/report/employee-output-summary/export-excel', params })
|
||||
}
|
||||
|
||||
export const getEmployeeOutputSummaryPreview = (params: EmployeeOutputSummaryExportReqVO) => {
|
||||
return request.get<EmployeeOutputSummaryPreviewRespVO>({
|
||||
url: '/tjt/report/employee-output-summary/preview',
|
||||
params: { ...params, _t: Date.now() }
|
||||
})
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ export interface SpecialtyRoleSplitSaveItemVO {
|
||||
export interface SpecialtyRoleSplitBatchSaveVO {
|
||||
planningId: number
|
||||
items: SpecialtyRoleSplitSaveItemVO[]
|
||||
temporarySave?: boolean
|
||||
}
|
||||
|
||||
export const getSpecialtyRoleSplitListByPlanningId = (planningId: number) => {
|
||||
|
||||
@@ -50,13 +50,22 @@
|
||||
<Icon class="mr-5px" icon="ep:plus" />
|
||||
新增
|
||||
</el-button>
|
||||
<el-button
|
||||
v-hasPermi="['tjt:employee-year-cost-budget:create']"
|
||||
plain
|
||||
type="success"
|
||||
@click="openGenerateDialog"
|
||||
>
|
||||
<Icon class="mr-5px" icon="ep:document-add" />
|
||||
按年度生成
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column align="center" label="ID" prop="id" width="88" />
|
||||
<el-table-column :index="getRowIndex" align="center" label="序号" type="index" width="88" />
|
||||
<el-table-column align="center" label="员工姓名" min-width="140" prop="employeeName" />
|
||||
<el-table-column align="center" label="预算年度" prop="budgetYear" width="120" />
|
||||
<el-table-column align="center" label="预计发生成本(元)" width="160">
|
||||
@@ -72,7 +81,13 @@
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="创建时间" prop="createTime" width="180" />
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="创建时间"
|
||||
prop="createTime"
|
||||
width="180"
|
||||
:formatter="dateFormatter"
|
||||
/>
|
||||
<el-table-column align="center" fixed="right" label="操作" width="160">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
@@ -167,12 +182,48 @@
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
|
||||
<Dialog v-model="generateDialogVisible" title="按年度生成员工预算记录" width="560">
|
||||
<el-form
|
||||
ref="generateFormRef"
|
||||
v-loading="generateLoading"
|
||||
:model="generateFormData"
|
||||
:rules="generateFormRules"
|
||||
label-width="140px"
|
||||
>
|
||||
<el-form-item label="预算年度" prop="budgetYear">
|
||||
<el-date-picker
|
||||
v-model="generateBudgetYearValue"
|
||||
class="!w-1/1"
|
||||
placeholder="请选择年度"
|
||||
type="year"
|
||||
value-format="YYYY"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="默认预计发生成本" prop="expectedCostAmount">
|
||||
<el-input-number
|
||||
v-model="generateFormData.expectedCostAmount"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="1000"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<template #footer>
|
||||
<el-button :loading="generateLoading" type="primary" @click="submitGenerateForm">确认生成</el-button>
|
||||
<el-button @click="generateDialogVisible = false">取消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { FormRules } from 'element-plus'
|
||||
import * as EmployeeApi from '@/api/tjt/employee'
|
||||
import * as EmployeeYearCostBudgetApi from '@/api/tjt/employeeYearCostBudget'
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import { formatAmountText } from '@/views/tjt/shared/planning'
|
||||
|
||||
defineOptions({ name: 'TjtEmployeeYearCostBudget' })
|
||||
@@ -183,12 +234,15 @@ const { t } = useI18n()
|
||||
const loading = ref(false)
|
||||
const formLoading = ref(false)
|
||||
const employeeLoading = ref(false)
|
||||
const generateLoading = ref(false)
|
||||
const total = ref(0)
|
||||
const list = ref<EmployeeYearCostBudgetApi.EmployeeYearCostBudgetVO[]>([])
|
||||
const employeeOptions = ref<EmployeeApi.EmployeeSimpleVO[]>([])
|
||||
const queryFormRef = ref()
|
||||
const formRef = ref()
|
||||
const generateFormRef = ref()
|
||||
const dialogVisible = ref(false)
|
||||
const generateDialogVisible = ref(false)
|
||||
const dialogTitle = ref('')
|
||||
const formType = ref<'create' | 'update'>('create')
|
||||
|
||||
@@ -201,6 +255,9 @@ const queryParams = reactive<EmployeeYearCostBudgetApi.EmployeeYearCostBudgetPag
|
||||
enabledFlag: undefined
|
||||
})
|
||||
|
||||
const getRowIndex = (index: number) =>
|
||||
(queryParams.pageNo - 1) * queryParams.pageSize + index + 1
|
||||
|
||||
const createFormData = (): EmployeeYearCostBudgetApi.EmployeeYearCostBudgetVO => ({
|
||||
employeeId: undefined as never,
|
||||
employeeName: '',
|
||||
@@ -212,6 +269,10 @@ const createFormData = (): EmployeeYearCostBudgetApi.EmployeeYearCostBudgetVO =>
|
||||
})
|
||||
|
||||
const formData = ref<EmployeeYearCostBudgetApi.EmployeeYearCostBudgetVO>(createFormData())
|
||||
const generateFormData = reactive<EmployeeYearCostBudgetApi.EmployeeYearCostBudgetGenerateReqVO>({
|
||||
budgetYear: new Date().getFullYear(),
|
||||
expectedCostAmount: 0
|
||||
})
|
||||
|
||||
const queryBudgetYearValue = computed({
|
||||
get: () => (queryParams.budgetYear ? String(queryParams.budgetYear) : undefined),
|
||||
@@ -227,12 +288,24 @@ const formBudgetYearValue = computed({
|
||||
}
|
||||
})
|
||||
|
||||
const generateBudgetYearValue = computed({
|
||||
get: () => (generateFormData.budgetYear ? String(generateFormData.budgetYear) : undefined),
|
||||
set: (value?: string) => {
|
||||
generateFormData.budgetYear = value ? Number(value) : new Date().getFullYear()
|
||||
}
|
||||
})
|
||||
|
||||
const formRules = reactive<FormRules>({
|
||||
employeeId: [{ required: true, message: '员工不能为空', trigger: 'change' }],
|
||||
budgetYear: [{ required: true, message: '预算年度不能为空', trigger: 'change' }],
|
||||
expectedCostAmount: [{ required: true, message: '预计发生成本不能为空', trigger: 'blur' }]
|
||||
})
|
||||
|
||||
const generateFormRules = reactive<FormRules>({
|
||||
budgetYear: [{ required: true, message: '预算年度不能为空', trigger: 'change' }],
|
||||
expectedCostAmount: [{ required: true, message: '默认预计发生成本不能为空', trigger: 'blur' }]
|
||||
})
|
||||
|
||||
const ensureEmployeeOption = () => {
|
||||
if (!formData.value.employeeId || !formData.value.employeeName) {
|
||||
return
|
||||
@@ -310,6 +383,13 @@ const openDialog = async (type: 'create' | 'update', id?: number) => {
|
||||
}
|
||||
}
|
||||
|
||||
const openGenerateDialog = () => {
|
||||
generateFormData.budgetYear = queryParams.budgetYear || new Date().getFullYear()
|
||||
generateFormData.expectedCostAmount = 0
|
||||
generateDialogVisible.value = true
|
||||
generateFormRef.value?.clearValidate()
|
||||
}
|
||||
|
||||
const submitForm = async () => {
|
||||
if (!formRef.value) {
|
||||
return
|
||||
@@ -334,6 +414,33 @@ const submitForm = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const submitGenerateForm = async () => {
|
||||
if (!generateFormRef.value) {
|
||||
return
|
||||
}
|
||||
const valid = await generateFormRef.value.validate()
|
||||
if (!valid) {
|
||||
return
|
||||
}
|
||||
generateLoading.value = true
|
||||
try {
|
||||
const data = await EmployeeYearCostBudgetApi.generateEmployeeYearCostBudget(generateFormData)
|
||||
if (data.createdCount > 0) {
|
||||
message.success(
|
||||
`成功为 ${data.budgetYear} 年度生成 ${data.createdCount} 名员工的预算记录,已跳过 ${data.skippedCount} 条重复记录。`
|
||||
)
|
||||
} else {
|
||||
message.info(`${data.budgetYear} 年度没有需要新增的员工预算记录,已跳过 ${data.skippedCount} 条重复记录。`)
|
||||
}
|
||||
generateDialogVisible.value = false
|
||||
queryParams.budgetYear = data.budgetYear
|
||||
queryParams.pageNo = 1
|
||||
await getList()
|
||||
} finally {
|
||||
generateLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
await message.delConfirm()
|
||||
@@ -343,11 +450,18 @@ const handleDelete = async (id: number) => {
|
||||
} catch {}
|
||||
}
|
||||
|
||||
let activatedOnce = false
|
||||
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
|
||||
onActivated(() => {
|
||||
// KeepAlive 首次挂载也会触发 onActivated,跳过首轮避免重复请求列表。
|
||||
if (!activatedOnce) {
|
||||
activatedOnce = true
|
||||
return
|
||||
}
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
|
||||
468
src/views/tjt/employee-year-leader-output/index.vue
Normal file
468
src/views/tjt/employee-year-leader-output/index.vue
Normal file
@@ -0,0 +1,468 @@
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<el-form
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
:model="queryParams"
|
||||
class="-mb-15px"
|
||||
label-width="100px"
|
||||
>
|
||||
<el-form-item label="员工姓名" prop="employeeName">
|
||||
<el-input
|
||||
v-model="queryParams.employeeName"
|
||||
class="!w-220px"
|
||||
clearable
|
||||
placeholder="请输入员工姓名"
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="产值年度" prop="outputYear">
|
||||
<el-date-picker
|
||||
v-model="queryOutputYearValue"
|
||||
class="!w-180px"
|
||||
clearable
|
||||
placeholder="请选择年度"
|
||||
type="year"
|
||||
value-format="YYYY"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否启用" prop="enabledFlag">
|
||||
<el-select v-model="queryParams.enabledFlag" class="!w-180px" clearable placeholder="请选择">
|
||||
<el-option :value="true" label="启用" />
|
||||
<el-option :value="false" label="停用" />
|
||||
</el-select>
|
||||
</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-button
|
||||
v-hasPermi="['tjt:employee-year-leader-output:create']"
|
||||
plain
|
||||
type="primary"
|
||||
@click="openDialog('create')"
|
||||
>
|
||||
<Icon class="mr-5px" icon="ep:plus" />
|
||||
新增
|
||||
</el-button>
|
||||
<el-button
|
||||
v-hasPermi="['tjt:employee-year-leader-output:create']"
|
||||
plain
|
||||
type="success"
|
||||
@click="openGenerateDialog"
|
||||
>
|
||||
<Icon class="mr-5px" icon="ep:document-add" />
|
||||
按年度生成
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column :index="getRowIndex" align="center" label="序号" type="index" width="88" />
|
||||
<el-table-column align="center" label="员工姓名" min-width="140" prop="employeeName" />
|
||||
<el-table-column align="center" label="产值年度" prop="outputYear" width="120" />
|
||||
<el-table-column align="center" label="所长考核产值(元)" width="170">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.leaderOutputAmount) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="备注" min-width="240" prop="remark" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="是否启用" width="100">
|
||||
<template #default="scope">
|
||||
<el-tag :type="scope.row.enabledFlag ? 'success' : 'info'">
|
||||
{{ scope.row.enabledFlag ? '启用' : '停用' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="创建时间"
|
||||
prop="createTime"
|
||||
width="180"
|
||||
:formatter="dateFormatter"
|
||||
/>
|
||||
<el-table-column align="center" fixed="right" label="操作" width="160">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
v-hasPermi="['tjt:employee-year-leader-output:update']"
|
||||
link
|
||||
type="primary"
|
||||
@click="openDialog('update', scope.row.id)"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-hasPermi="['tjt:employee-year-leader-output:delete']"
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row.id)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<Pagination
|
||||
v-model:limit="queryParams.pageSize"
|
||||
v-model:page="queryParams.pageNo"
|
||||
:total="total"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
|
||||
<Dialog v-model="dialogVisible" :title="dialogTitle" width="620">
|
||||
<el-form ref="formRef" v-loading="formLoading" :model="formData" :rules="formRules" label-width="120px">
|
||||
<el-form-item label="所长姓名" prop="employeeId">
|
||||
<el-select
|
||||
:model-value="formData.employeeId"
|
||||
class="!w-1/1"
|
||||
clearable
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
placeholder="请输入所长姓名搜索"
|
||||
:remote-method="searchEmployees"
|
||||
:loading="employeeLoading"
|
||||
@change="handleEmployeeChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in employeeOptions"
|
||||
:key="item.id"
|
||||
:label="item.officeName ? `${item.employeeName} / ${item.officeName}` : item.employeeName"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="产值年度" prop="outputYear">
|
||||
<el-date-picker
|
||||
v-model="formOutputYearValue"
|
||||
class="!w-1/1"
|
||||
placeholder="请选择年度"
|
||||
type="year"
|
||||
value-format="YYYY"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="所长考核产值" prop="leaderOutputAmount">
|
||||
<el-input-number
|
||||
v-model="formData.leaderOutputAmount"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="1000"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序号" prop="sortNo">
|
||||
<el-input-number v-model="formData.sortNo" :min="0" :precision="0" class="!w-1/1" controls-position="right" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否启用" prop="enabledFlag">
|
||||
<el-switch v-model="formData.enabledFlag" active-text="启用" inactive-text="停用" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input
|
||||
v-model="formData.remark"
|
||||
:rows="3"
|
||||
maxlength="255"
|
||||
placeholder="请输入备注"
|
||||
show-word-limit
|
||||
type="textarea"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<template #footer>
|
||||
<el-button :loading="formLoading" type="primary" @click="submitForm">保存</el-button>
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
|
||||
<Dialog v-model="generateDialogVisible" title="按年度生成所长考核产值记录" width="560">
|
||||
<el-form
|
||||
ref="generateFormRef"
|
||||
v-loading="generateLoading"
|
||||
:model="generateFormData"
|
||||
:rules="generateFormRules"
|
||||
label-width="140px"
|
||||
>
|
||||
<el-form-item label="产值年度" prop="outputYear">
|
||||
<el-date-picker
|
||||
v-model="generateOutputYearValue"
|
||||
class="!w-1/1"
|
||||
placeholder="请选择年度"
|
||||
type="year"
|
||||
value-format="YYYY"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="默认所长考核产值" prop="leaderOutputAmount">
|
||||
<el-input-number
|
||||
v-model="generateFormData.leaderOutputAmount"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="1000"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<template #footer>
|
||||
<el-button :loading="generateLoading" type="primary" @click="submitGenerateForm">确认生成</el-button>
|
||||
<el-button @click="generateDialogVisible = false">取消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { FormRules } from 'element-plus'
|
||||
import * as EmployeeApi from '@/api/tjt/employee'
|
||||
import * as EmployeeYearLeaderOutputApi from '@/api/tjt/employeeYearLeaderOutput'
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import { formatAmountText } from '@/views/tjt/shared/planning'
|
||||
|
||||
defineOptions({ name: 'TjtEmployeeYearLeaderOutput' })
|
||||
|
||||
const message = useMessage()
|
||||
const { t } = useI18n()
|
||||
|
||||
const loading = ref(false)
|
||||
const formLoading = ref(false)
|
||||
const employeeLoading = ref(false)
|
||||
const generateLoading = ref(false)
|
||||
const total = ref(0)
|
||||
const list = ref<EmployeeYearLeaderOutputApi.EmployeeYearLeaderOutputVO[]>([])
|
||||
const employeeOptions = ref<EmployeeApi.EmployeeSimpleVO[]>([])
|
||||
const queryFormRef = ref()
|
||||
const formRef = ref()
|
||||
const generateFormRef = ref()
|
||||
const dialogVisible = ref(false)
|
||||
const generateDialogVisible = ref(false)
|
||||
const dialogTitle = ref('')
|
||||
const formType = ref<'create' | 'update'>('create')
|
||||
|
||||
const queryParams = reactive<EmployeeYearLeaderOutputApi.EmployeeYearLeaderOutputPageReqVO>({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
employeeId: undefined,
|
||||
employeeName: undefined,
|
||||
outputYear: undefined,
|
||||
enabledFlag: undefined
|
||||
})
|
||||
|
||||
const getRowIndex = (index: number) =>
|
||||
(queryParams.pageNo - 1) * queryParams.pageSize + index + 1
|
||||
|
||||
const createFormData = (): EmployeeYearLeaderOutputApi.EmployeeYearLeaderOutputVO => ({
|
||||
employeeId: undefined as never,
|
||||
employeeName: '',
|
||||
outputYear: new Date().getFullYear(),
|
||||
leaderOutputAmount: 0,
|
||||
remark: '',
|
||||
sortNo: 0,
|
||||
enabledFlag: true
|
||||
})
|
||||
|
||||
const formData = ref<EmployeeYearLeaderOutputApi.EmployeeYearLeaderOutputVO>(createFormData())
|
||||
const generateFormData = reactive<EmployeeYearLeaderOutputApi.EmployeeYearLeaderOutputGenerateReqVO>({
|
||||
outputYear: new Date().getFullYear(),
|
||||
leaderOutputAmount: 0
|
||||
})
|
||||
|
||||
const queryOutputYearValue = computed({
|
||||
get: () => (queryParams.outputYear ? String(queryParams.outputYear) : undefined),
|
||||
set: (value?: string) => {
|
||||
queryParams.outputYear = value ? Number(value) : undefined
|
||||
}
|
||||
})
|
||||
|
||||
const formOutputYearValue = computed({
|
||||
get: () => (formData.value.outputYear ? String(formData.value.outputYear) : undefined),
|
||||
set: (value?: string) => {
|
||||
formData.value.outputYear = value ? Number(value) : new Date().getFullYear()
|
||||
}
|
||||
})
|
||||
|
||||
const generateOutputYearValue = computed({
|
||||
get: () => (generateFormData.outputYear ? String(generateFormData.outputYear) : undefined),
|
||||
set: (value?: string) => {
|
||||
generateFormData.outputYear = value ? Number(value) : new Date().getFullYear()
|
||||
}
|
||||
})
|
||||
|
||||
const formRules = reactive<FormRules>({
|
||||
employeeId: [{ required: true, message: '所长不能为空', trigger: 'change' }],
|
||||
outputYear: [{ required: true, message: '产值年度不能为空', trigger: 'change' }],
|
||||
leaderOutputAmount: [{ required: true, message: '所长考核产值不能为空', trigger: 'blur' }]
|
||||
})
|
||||
|
||||
const generateFormRules = reactive<FormRules>({
|
||||
outputYear: [{ required: true, message: '产值年度不能为空', trigger: 'change' }],
|
||||
leaderOutputAmount: [{ required: true, message: '默认所长考核产值不能为空', trigger: 'blur' }]
|
||||
})
|
||||
|
||||
const ensureEmployeeOption = () => {
|
||||
if (!formData.value.employeeId || !formData.value.employeeName) {
|
||||
return
|
||||
}
|
||||
if (employeeOptions.value.some((item) => item.id === formData.value.employeeId)) {
|
||||
return
|
||||
}
|
||||
employeeOptions.value.push({
|
||||
id: formData.value.employeeId,
|
||||
employeeName: formData.value.employeeName
|
||||
})
|
||||
}
|
||||
|
||||
const searchEmployees = async (keyword: string) => {
|
||||
employeeLoading.value = true
|
||||
try {
|
||||
employeeOptions.value = await EmployeeApi.getEmployeeSimpleList({
|
||||
keyword,
|
||||
enabledFlag: true,
|
||||
officeLeaderFlag: true
|
||||
})
|
||||
ensureEmployeeOption()
|
||||
} finally {
|
||||
employeeLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleEmployeeChange = (employeeId?: number) => {
|
||||
const employee = employeeOptions.value.find((item) => item.id === employeeId)
|
||||
formData.value.employeeId = employeeId as never
|
||||
formData.value.employeeName = employee?.employeeName || ''
|
||||
}
|
||||
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await EmployeeYearLeaderOutputApi.getEmployeeYearLeaderOutputPage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
const resetForm = () => {
|
||||
formData.value = createFormData()
|
||||
employeeOptions.value = []
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
|
||||
const openDialog = async (type: 'create' | 'update', id?: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = type === 'create' ? '新增年度所长考核产值' : '编辑年度所长考核产值'
|
||||
formType.value = type
|
||||
resetForm()
|
||||
if (!id) {
|
||||
await searchEmployees('')
|
||||
return
|
||||
}
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await EmployeeYearLeaderOutputApi.getEmployeeYearLeaderOutput(id)
|
||||
ensureEmployeeOption()
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const openGenerateDialog = () => {
|
||||
generateFormData.outputYear = queryParams.outputYear || new Date().getFullYear()
|
||||
generateFormData.leaderOutputAmount = 0
|
||||
generateDialogVisible.value = true
|
||||
generateFormRef.value?.clearValidate()
|
||||
}
|
||||
|
||||
const submitForm = async () => {
|
||||
if (!formRef.value) {
|
||||
return
|
||||
}
|
||||
const valid = await formRef.value.validate()
|
||||
if (!valid) {
|
||||
return
|
||||
}
|
||||
formLoading.value = true
|
||||
try {
|
||||
if (formType.value === 'create') {
|
||||
await EmployeeYearLeaderOutputApi.createEmployeeYearLeaderOutput(formData.value)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await EmployeeYearLeaderOutputApi.updateEmployeeYearLeaderOutput(formData.value)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
await getList()
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const submitGenerateForm = async () => {
|
||||
if (!generateFormRef.value) {
|
||||
return
|
||||
}
|
||||
const valid = await generateFormRef.value.validate()
|
||||
if (!valid) {
|
||||
return
|
||||
}
|
||||
generateLoading.value = true
|
||||
try {
|
||||
const data = await EmployeeYearLeaderOutputApi.generateEmployeeYearLeaderOutput(generateFormData)
|
||||
if (data.createdCount > 0) {
|
||||
message.success(
|
||||
`成功为 ${data.outputYear} 年度生成 ${data.createdCount} 名所长的考核产值记录,已跳过 ${data.skippedCount} 条重复记录。`
|
||||
)
|
||||
} else {
|
||||
message.info(`${data.outputYear} 年度没有需要新增的所长考核产值记录,已跳过 ${data.skippedCount} 条重复记录。`)
|
||||
}
|
||||
generateDialogVisible.value = false
|
||||
queryParams.outputYear = data.outputYear
|
||||
queryParams.pageNo = 1
|
||||
await getList()
|
||||
} finally {
|
||||
generateLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
await message.delConfirm()
|
||||
await EmployeeYearLeaderOutputApi.deleteEmployeeYearLeaderOutput(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
let activatedOnce = false
|
||||
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
|
||||
onActivated(() => {
|
||||
// KeepAlive 首次挂载也会触发 onActivated,跳过首轮避免重复请求列表。
|
||||
if (!activatedOnce) {
|
||||
activatedOnce = true
|
||||
return
|
||||
}
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
@@ -57,6 +57,17 @@
|
||||
<el-option :value="false" label="停用" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否所长" prop="officeLeaderFlag">
|
||||
<el-select
|
||||
v-model="queryParams.officeLeaderFlag"
|
||||
class="!w-180px"
|
||||
clearable
|
||||
placeholder="请选择"
|
||||
>
|
||||
<el-option :value="true" label="是" />
|
||||
<el-option :value="false" label="否" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="handleQuery">
|
||||
<Icon class="mr-5px" icon="ep:search" />
|
||||
@@ -76,7 +87,7 @@
|
||||
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column align="center" label="ID" prop="id" width="88" />
|
||||
<el-table-column :index="getRowIndex" align="center" label="序号" type="index" width="88" />
|
||||
<el-table-column align="center" label="员工姓名" min-width="120" prop="employeeName" />
|
||||
<el-table-column align="center" label="性别" prop="gender" width="80" />
|
||||
<el-table-column align="center" label="所属专业所" min-width="140" prop="officeName" />
|
||||
@@ -95,9 +106,28 @@
|
||||
prop="registrationSealNo"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column align="center" label="入职时间" prop="entryDate" width="120" />
|
||||
<el-table-column align="center" label="离职时间" prop="leaveDate" width="120" />
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="入职时间"
|
||||
prop="entryDate"
|
||||
width="120"
|
||||
:formatter="dateFormatter2"
|
||||
/>
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="离职时间"
|
||||
prop="leaveDate"
|
||||
width="120"
|
||||
:formatter="dateFormatter2"
|
||||
/>
|
||||
<el-table-column align="center" label="状态" prop="employeeStatus" width="90" />
|
||||
<el-table-column align="center" label="是否所长" width="100">
|
||||
<template #default="scope">
|
||||
<el-tag :type="scope.row.officeLeaderFlag ? 'warning' : 'info'">
|
||||
{{ scope.row.officeLeaderFlag ? '是' : '否' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="是否启用" width="100">
|
||||
<template #default="scope">
|
||||
<el-tag :type="scope.row.enabledFlag ? 'success' : 'info'">
|
||||
@@ -105,8 +135,14 @@
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="创建时间" prop="createTime" width="180" />
|
||||
<el-table-column align="center" fixed="right" label="操作" width="160">
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="创建时间"
|
||||
prop="createTime"
|
||||
width="180"
|
||||
:formatter="dateFormatter"
|
||||
/>
|
||||
<el-table-column align="center" fixed="right" label="操作" width="100">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
v-hasPermi="['tjt:employee:update']"
|
||||
@@ -116,14 +152,6 @@
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-hasPermi="['tjt:employee:delete']"
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row.id)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -262,6 +290,11 @@
|
||||
<el-switch v-model="formData.enabledFlag" active-text="启用" inactive-text="停用" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="是否所长" prop="officeLeaderFlag">
|
||||
<el-switch v-model="formData.officeLeaderFlag" active-text="是" inactive-text="否" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input
|
||||
@@ -286,6 +319,7 @@
|
||||
import type { FormRules } from 'element-plus'
|
||||
import * as EmployeeApi from '@/api/tjt/employee'
|
||||
import * as OfficeApi from '@/api/tjt/office'
|
||||
import { dateFormatter, dateFormatter2, formatDate } from '@/utils/formatTime'
|
||||
|
||||
defineOptions({ name: 'TjtEmployee' })
|
||||
|
||||
@@ -327,9 +361,13 @@ const queryParams = reactive<EmployeeApi.EmployeePageReqVO>({
|
||||
employeeName: undefined,
|
||||
officeId: undefined,
|
||||
employeeStatus: undefined,
|
||||
enabledFlag: undefined
|
||||
enabledFlag: undefined,
|
||||
officeLeaderFlag: undefined
|
||||
})
|
||||
|
||||
const getRowIndex = (index: number) =>
|
||||
(queryParams.pageNo - 1) * queryParams.pageSize + index + 1
|
||||
|
||||
const createFormData = (): EmployeeApi.EmployeeVO => ({
|
||||
employeeName: '',
|
||||
gender: '男',
|
||||
@@ -341,12 +379,17 @@ const createFormData = (): EmployeeApi.EmployeeVO => ({
|
||||
leaveDate: undefined,
|
||||
employeeStatus: '在职',
|
||||
remark: '',
|
||||
officeLeaderFlag: false,
|
||||
sortNo: 0,
|
||||
enabledFlag: true
|
||||
})
|
||||
|
||||
const formData = ref<EmployeeApi.EmployeeVO>(createFormData())
|
||||
|
||||
const normalizeDateValue = (value?: string | number) => {
|
||||
return value ? formatDate(value as any, 'YYYY-MM-DD') : undefined
|
||||
}
|
||||
|
||||
const formRules = reactive<FormRules>({
|
||||
employeeName: [{ required: true, message: '员工姓名不能为空', trigger: 'blur' }],
|
||||
gender: [{ required: true, message: '性别不能为空', trigger: 'change' }],
|
||||
@@ -408,7 +451,12 @@ const openDialog = async (type: 'create' | 'update', id?: number) => {
|
||||
}
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await EmployeeApi.getEmployee(id)
|
||||
const data = await EmployeeApi.getEmployee(id)
|
||||
formData.value = {
|
||||
...data,
|
||||
entryDate: normalizeDateValue(data.entryDate as any),
|
||||
leaveDate: normalizeDateValue(data.leaveDate as any)
|
||||
}
|
||||
await ensureCurrentOfficeOption()
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
@@ -439,14 +487,7 @@ 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
|
||||
|
||||
onMounted(async () => {
|
||||
await loadOfficeOptions()
|
||||
@@ -454,6 +495,11 @@ onMounted(async () => {
|
||||
})
|
||||
|
||||
onActivated(() => {
|
||||
// KeepAlive 首次挂载也会触发 onActivated,跳过首轮避免重复请求列表。
|
||||
if (!activatedOnce) {
|
||||
activatedOnce = true
|
||||
return
|
||||
}
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column align="center" label="ID" prop="id" width="88" />
|
||||
<el-table-column :index="getRowIndex" align="center" label="序号" type="index" width="88" />
|
||||
<el-table-column align="center" label="专业所名称" min-width="180" prop="officeName" />
|
||||
<el-table-column align="center" label="专业所编码" min-width="140" prop="officeCode" />
|
||||
<el-table-column align="center" label="排序号" prop="sortNo" width="100" />
|
||||
@@ -58,7 +58,13 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="备注" min-width="220" prop="remark" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="创建时间" prop="createTime" width="180" />
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="创建时间"
|
||||
prop="createTime"
|
||||
width="180"
|
||||
:formatter="dateFormatter"
|
||||
/>
|
||||
<el-table-column align="center" fixed="right" label="操作" width="160">
|
||||
<template #default="scope">
|
||||
<el-button v-hasPermi="['tjt:office:update']" link type="primary" @click="openDialog('update', scope.row.id)">
|
||||
@@ -114,6 +120,7 @@
|
||||
<script lang="ts" setup>
|
||||
import type { FormRules } from 'element-plus'
|
||||
import * as OfficeApi from '@/api/tjt/office'
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
|
||||
defineOptions({ name: 'TjtOffice' })
|
||||
|
||||
@@ -137,6 +144,9 @@ const queryParams = reactive<OfficeApi.OfficePageReqVO>({
|
||||
enabledFlag: undefined
|
||||
})
|
||||
|
||||
const getRowIndex = (index: number) =>
|
||||
(queryParams.pageNo - 1) * queryParams.pageSize + index + 1
|
||||
|
||||
const createFormData = (): OfficeApi.OfficeVO => ({
|
||||
officeName: '',
|
||||
officeCode: '',
|
||||
@@ -226,11 +236,18 @@ const handleDelete = async (id: number) => {
|
||||
} catch {}
|
||||
}
|
||||
|
||||
let activatedOnce = false
|
||||
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
|
||||
onActivated(() => {
|
||||
// KeepAlive 首次挂载也会触发 onActivated,跳过首轮避免重复请求列表。
|
||||
if (!activatedOnce) {
|
||||
activatedOnce = true
|
||||
return
|
||||
}
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -71,8 +71,8 @@
|
||||
/>
|
||||
</ContentWrap>
|
||||
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="8">
|
||||
<SplitPane>
|
||||
<template #left>
|
||||
<ContentWrap>
|
||||
<div class="mb-12px text-14px font-600">
|
||||
{{ currentProject?.projectName || '合约规划列表' }}
|
||||
@@ -84,7 +84,6 @@
|
||||
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">
|
||||
@@ -99,115 +98,139 @@
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="排序" prop="sortNo" width="80" />
|
||||
</el-table>
|
||||
<PlanningOwnershipSummary
|
||||
:planning-list="planningList"
|
||||
amount-field="assessmentOutputValue"
|
||||
amount-label="考核产值(元)"
|
||||
title="归属类型考核产值合计"
|
||||
/>
|
||||
</ContentWrap>
|
||||
</el-col>
|
||||
</template>
|
||||
|
||||
<el-col :span="16">
|
||||
<ContentWrap v-if="currentPlanning && formData">
|
||||
<div class="mb-16px flex items-center justify-between gap-16px">
|
||||
<div>
|
||||
<div class="text-16px font-600">{{ currentPlanning.planningContent }}</div>
|
||||
<div class="mt-4px text-13px text-[var(--el-text-color-secondary)]">
|
||||
年度:{{ formData.year || '-' }},考核产值:{{ formatAmountText(formData.assessmentOutputValue) }} 元
|
||||
<template #right>
|
||||
<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 class="text-16px font-600">{{ currentPlanning.planningContent }}</div>
|
||||
<div class="mt-4px text-13px text-[var(--el-text-color-secondary)]">
|
||||
年度:{{ formData.year || '-' }},考核产值:{{
|
||||
formatAmountText(formData.assessmentOutputValue)
|
||||
}}
|
||||
元
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center gap-12px">
|
||||
<el-button
|
||||
v-hasPermi="['tjt:output-split:update']"
|
||||
plain
|
||||
type="primary"
|
||||
@click="openEditDialog"
|
||||
>
|
||||
<Icon class="mr-5px" icon="ep:edit" />
|
||||
编辑比例
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center gap-12px">
|
||||
<el-button
|
||||
v-hasPermi="['tjt:output-split:update']"
|
||||
plain
|
||||
type="primary"
|
||||
@click="openEditDialog"
|
||||
>
|
||||
<Icon class="mr-5px" icon="ep:edit" />
|
||||
编辑比例
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-descriptions :column="2" border title="基础信息">
|
||||
<el-descriptions-item label="项目名称">{{ formData.projectName || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="项目任务包">{{ formData.planningContent || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="工程负责人">
|
||||
{{ getProjectLeadText(formData.projectManagerName, formData.engineeringLeaderName) }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<el-descriptions :column="2" border title="基础信息">
|
||||
<el-descriptions-item label="项目名称">{{
|
||||
formData.projectName || '-'
|
||||
}}</el-descriptions-item>
|
||||
<el-descriptions-item label="项目任务包">{{
|
||||
formData.planningContent || '-'
|
||||
}}</el-descriptions-item>
|
||||
<el-descriptions-item label="工程负责人">
|
||||
{{
|
||||
getProjectLeadText(formData.projectManagerName, formData.engineeringLeaderName)
|
||||
}}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<el-divider content-position="left">项目层结果</el-divider>
|
||||
<el-table :data="projectResultRows" border>
|
||||
<el-table-column align="center" label="类别" min-width="160" 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>
|
||||
<el-table :data="projectResultRows" border>
|
||||
<el-table-column align="center" label="类别" min-width="160" 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>
|
||||
<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>
|
||||
<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-radio-button>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
<el-row :gutter="16" class="mb-16px">
|
||||
<el-col v-for="item in annualSummaryCards" :key="item.label" :span="8">
|
||||
<div class="rounded-8px bg-[var(--el-fill-color-light)] px-16px py-12px">
|
||||
<div class="text-12px text-[var(--el-text-color-secondary)]">{{ item.label }}</div>
|
||||
<div class="mt-6px text-18px font-600">{{ formatAmountText(item.amount) }}</div>
|
||||
<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-radio-button>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-table v-loading="quarterLoading" :data="annualDistributionRows" border>
|
||||
<el-table-column align="center" label="分配年度" min-width="120" prop="distributionYear" />
|
||||
<el-table-column
|
||||
v-for="quarter in QUARTER_OPTIONS"
|
||||
:key="String(quarter.value)"
|
||||
align="center"
|
||||
:label="quarter.label"
|
||||
min-width="150"
|
||||
>
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.quarterAmounts[Number(quarter.value)]) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="年度合计(元)" min-width="160">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.yearTotal) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</ContentWrap>
|
||||
<el-row :gutter="16" class="mb-16px">
|
||||
<el-col v-for="item in annualSummaryCards" :key="item.label" :span="8">
|
||||
<div class="rounded-8px bg-[var(--el-fill-color-light)] px-16px py-12px">
|
||||
<div class="text-12px text-[var(--el-text-color-secondary)]">{{
|
||||
item.label
|
||||
}}</div>
|
||||
<div class="mt-6px text-18px font-600">{{ formatAmountText(item.amount) }}</div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-table :data="annualDistributionRows" border>
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="分配年度"
|
||||
min-width="120"
|
||||
prop="distributionYear"
|
||||
/>
|
||||
<el-table-column
|
||||
v-for="quarter in QUARTER_OPTIONS"
|
||||
:key="String(quarter.value)"
|
||||
align="center"
|
||||
:label="quarter.label"
|
||||
min-width="150"
|
||||
>
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.quarterAmounts[Number(quarter.value)]) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="年度合计(元)" min-width="160">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.yearTotal) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</template>
|
||||
|
||||
<ContentWrap v-else>
|
||||
<el-empty description="请选择合约规划后查看分配结果" />
|
||||
<el-empty v-else-if="!quarterLoading" description="请选择合约规划后查看分配结果" />
|
||||
</div>
|
||||
</ContentWrap>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
</SplitPane>
|
||||
|
||||
<Dialog v-model="dialogVisible" title="编辑专业及项目总分配比例" width="920">
|
||||
<template v-if="editForm">
|
||||
@@ -270,10 +293,13 @@ import * as ProjectApi from '@/api/tjt/project'
|
||||
import * as PlanningApi from '@/api/tjt/planning'
|
||||
import * as PlanningQuarterApi from '@/api/tjt/planningQuarter'
|
||||
import * as OutputSplitApi from '@/api/tjt/outputSplit'
|
||||
import PlanningOwnershipSummary from '@/views/tjt/shared/PlanningOwnershipSummary.vue'
|
||||
import SplitPane from '@/views/tjt/shared/SplitPane.vue'
|
||||
import {
|
||||
formatAmountText,
|
||||
fromPercentValue,
|
||||
getOwnershipTypeLabel,
|
||||
OUTPUT_SPLIT_SPECIALTY,
|
||||
OUTPUT_SPLIT_SPECIALTY_OPTIONS,
|
||||
QUARTER_OPTIONS,
|
||||
toPercentValue
|
||||
@@ -281,15 +307,7 @@ import {
|
||||
|
||||
defineOptions({ name: 'TjtOutputSplit' })
|
||||
|
||||
type AnnualCategoryKey =
|
||||
| 'project_lead'
|
||||
| 'arch'
|
||||
| 'decor'
|
||||
| 'struct'
|
||||
| 'water'
|
||||
| 'elec'
|
||||
| 'hvac'
|
||||
| 'digital'
|
||||
type AnnualCategoryKey = (typeof OUTPUT_SPLIT_SPECIALTY)[keyof typeof OUTPUT_SPLIT_SPECIALTY]
|
||||
|
||||
interface QuarterYearRow {
|
||||
distributionYear: number
|
||||
@@ -297,14 +315,14 @@ interface QuarterYearRow {
|
||||
}
|
||||
|
||||
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' }
|
||||
{ label: '项目经理/工程负责人', value: OUTPUT_SPLIT_SPECIALTY.projectLead },
|
||||
{ label: '建筑专业', value: OUTPUT_SPLIT_SPECIALTY.arch },
|
||||
{ label: '装修专业', value: OUTPUT_SPLIT_SPECIALTY.decor },
|
||||
{ label: '结构专业', value: OUTPUT_SPLIT_SPECIALTY.struct },
|
||||
{ label: '水专业', value: OUTPUT_SPLIT_SPECIALTY.water },
|
||||
{ label: '电气专业', value: OUTPUT_SPLIT_SPECIALTY.elec },
|
||||
{ label: '暖通专业', value: OUTPUT_SPLIT_SPECIALTY.hvac },
|
||||
{ label: '数字化设计专业', value: OUTPUT_SPLIT_SPECIALTY.digital }
|
||||
]
|
||||
|
||||
const message = useMessage()
|
||||
@@ -321,7 +339,7 @@ const currentPlanning = ref<PlanningApi.ProjectPlanningVO>()
|
||||
const formData = ref<OutputSplitApi.ProjectOutputSplitVO>()
|
||||
const editForm = ref<OutputSplitApi.ProjectOutputSplitVO>()
|
||||
const quarterRows = ref<QuarterYearRow[]>([])
|
||||
const selectedAnnualCategory = ref<AnnualCategoryKey>('project_lead')
|
||||
const selectedAnnualCategory = ref<AnnualCategoryKey>(OUTPUT_SPLIT_SPECIALTY.projectLead)
|
||||
const dialogVisible = ref(false)
|
||||
const queryFormRef = ref()
|
||||
const projectTableRef = ref()
|
||||
@@ -420,7 +438,7 @@ const annualCategoryMeta = computed(() => {
|
||||
if (!model || !option) {
|
||||
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))
|
||||
return {
|
||||
label: option.label,
|
||||
@@ -618,14 +636,12 @@ const loadPlanningRelatedData = async (planning: PlanningApi.ProjectPlanningVO)
|
||||
}
|
||||
quarterLoading.value = true
|
||||
try {
|
||||
const [planningDetail, outputSplit, quarterList] = await Promise.all([
|
||||
PlanningApi.getProjectPlanning(planning.id),
|
||||
OutputSplitApi.getProjectOutputSplitByPlanningId(planning.id),
|
||||
PlanningQuarterApi.getProjectPlanningQuarterListByPlanningId(planning.id)
|
||||
])
|
||||
currentPlanning.value = planningDetail
|
||||
formData.value = outputSplit
|
||||
quarterRows.value = buildQuarterRows(planningDetail, quarterList)
|
||||
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
|
||||
}
|
||||
@@ -723,11 +739,18 @@ const handleSave = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
let activatedOnce = false
|
||||
|
||||
onMounted(() => {
|
||||
getProjectList()
|
||||
})
|
||||
|
||||
onActivated(() => {
|
||||
// KeepAlive 首次挂载也会触发 onActivated,跳过首轮避免重复请求项目与合约规划列表。
|
||||
if (!activatedOnce) {
|
||||
activatedOnce = true
|
||||
return
|
||||
}
|
||||
getProjectList()
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -105,7 +105,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="工程总面积(m²)" prop="planningArea">
|
||||
<el-form-item label="建筑面积(m²)" prop="planningArea">
|
||||
<el-input
|
||||
v-if="showGuideDetailSection"
|
||||
:model-value="formatAmountText(guideDetailSummary.designArea)"
|
||||
@@ -124,7 +124,14 @@
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="合同单价(元/m²)">
|
||||
<el-input :model-value="contractUnitPricePreview" disabled />
|
||||
<el-input-number
|
||||
v-model="formData.contractUnitPrice"
|
||||
:min="0"
|
||||
:precision="4"
|
||||
:step="1"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -300,30 +307,36 @@
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="设计部位" min-width="120" fixed="left">
|
||||
<template #default="{ row }">
|
||||
<el-select v-model="row.designPart" class="!w-1/1" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in DESIGN_PART_OPTIONS"
|
||||
:key="String(item.value)"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
<el-tooltip
|
||||
:content="getDesignPartLabel(row.designPart)"
|
||||
:disabled="!hasValue(row.designPart)"
|
||||
placement="top"
|
||||
>
|
||||
<el-select v-model="row.designPart" class="!w-1/1" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in DESIGN_PART_OPTIONS"
|
||||
:key="String(item.value)"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</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 }">
|
||||
<el-tooltip
|
||||
:content="row.buildingType"
|
||||
:disabled="!hasValue(row.buildingType)"
|
||||
placement="top"
|
||||
>
|
||||
<el-input v-model="row.buildingType" maxlength="100" placeholder="建筑类型" />
|
||||
<el-input v-model="row.buildingType" maxlength="100" placeholder="请输入设计内容/设计类型" />
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<!-- 2. 取消 controls 的核心数值列 -->
|
||||
<el-table-column align="center" label="指导单价(元)" min-width="110">
|
||||
<el-table-column align="center" label="内部指导单价(元/m²)" min-width="150">
|
||||
<template #default="{ row }">
|
||||
<el-tooltip
|
||||
:content="formatAmountText(row.internalGuidanceUnitPrice)"
|
||||
@@ -357,55 +370,60 @@
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="楼栋/户型数" min-width="100">
|
||||
<template #default="{ row }">
|
||||
<el-input-number
|
||||
v-model="row.buildingOrUnitCount"
|
||||
:min="0"
|
||||
:precision="0"
|
||||
:controls="false"
|
||||
class="!w-1/1"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<!-- 3. 多级表头折叠系数配置 -->
|
||||
<el-table-column label="调整系数配置" align="center">
|
||||
<el-table-column align="center" label="套图" min-width="85">
|
||||
<el-table-column align="center" label="楼栋/户型数" min-width="110">
|
||||
<template #default="{ row }">
|
||||
<el-input-number
|
||||
v-model="row.buildingOrUnitCount"
|
||||
:min="0"
|
||||
:precision="0"
|
||||
:controls="false"
|
||||
class="!w-1/1"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="套图系数" min-width="100">
|
||||
<template #default="{ row }">
|
||||
<el-input-number v-model="row.drawingSetFactor" :min="0" :precision="2" :controls="false" class="!w-1/1" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="规模" min-width="85">
|
||||
<el-table-column align="center" label="规模系数" min-width="100">
|
||||
<template #default="{ row }">
|
||||
<el-input-number v-model="row.scaleFactor" :min="0" :precision="2" :controls="false" class="!w-1/1" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="修改" min-width="85">
|
||||
<el-table-column align="center" label="修改系数" min-width="100">
|
||||
<template #default="{ row }">
|
||||
<el-input-number v-model="row.modificationFactor" :min="0" :precision="2" :controls="false" class="!w-1/1" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="复杂(%)" min-width="90">
|
||||
<el-table-column align="center" label="复杂系数/复杂等级" min-width="150">
|
||||
<template #default="{ row }">
|
||||
<el-input-number
|
||||
:model-value="toPercentValue(row.complexityFactor)"
|
||||
v-model="row.complexityFactor"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:controls="false"
|
||||
class="!w-1/1"
|
||||
@update:model-value="setGuideDetailPercentValue(row, 'complexityFactor', $event)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="合计" min-width="80">
|
||||
<el-table-column align="center" label="小计" min-width="80">
|
||||
<template #default="{ row }">
|
||||
<span class="text-gray-500">{{ formatFactorText(getGuideDetailTotalAdjustmentFactor(row)) }}</span>
|
||||
</template>
|
||||
</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 }">
|
||||
<el-input-number
|
||||
:model-value="toPercentValue(row.designRatio)"
|
||||
@@ -418,13 +436,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<!-- 4. 结果列靠右显示,用浅色背景区分 -->
|
||||
<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">
|
||||
<el-table-column align="right" label="考核产值小计(元)" min-width="130" class-name="bg-gray-50">
|
||||
<template #default="{ row }">
|
||||
<span class="font-bold text-primary">{{ formatAmountText(getGuideDetailAssessmentOutputValue(row)) }}</span>
|
||||
</template>
|
||||
@@ -469,17 +481,17 @@
|
||||
|
||||
<el-row :gutter="16" class="mt-16px">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="汇总设计面积(m²)">
|
||||
<el-form-item label="设计面积总计(m²)">
|
||||
<el-input :model-value="formatAmountText(guideDetailSummary.designArea)" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="汇总考核面积(m²)">
|
||||
<el-form-item label="考核产值面积总计(m²)">
|
||||
<el-input :model-value="formatAmountText(guideDetailSummary.assessmentArea)" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="汇总考核产值(元)">
|
||||
<el-form-item label="考核产值总计(元)">
|
||||
<el-input
|
||||
:model-value="formatAmountText(guideDetailSummary.assessmentOutputValue)"
|
||||
disabled
|
||||
@@ -576,9 +588,9 @@
|
||||
{{ activeRemarkRow.sortNo || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="设计部位">
|
||||
{{ activeRemarkRow.designPart || '-' }}
|
||||
{{ getDesignPartLabel(activeRemarkRow.designPart) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="建筑类型">
|
||||
<el-descriptions-item label="设计内容/设计类型">
|
||||
{{ activeRemarkRow.buildingType || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="考核产值(元)">
|
||||
@@ -616,6 +628,7 @@ import {
|
||||
fromPercentValue,
|
||||
getCalculationRatioDefaultPercent,
|
||||
getCalculationRatioLabel,
|
||||
getDesignPartLabel,
|
||||
getOwnershipTypeLabel,
|
||||
getReviewOutsourceDefaultPercent,
|
||||
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) => {
|
||||
if (value === undefined || value === null) {
|
||||
return '-'
|
||||
@@ -934,7 +936,7 @@ const formatQuantityText = (value?: number, digits = 4) => {
|
||||
|
||||
const setGuideDetailPercentValue = (
|
||||
row: GuideDetailRow,
|
||||
field: 'complexityFactor' | 'designRatio',
|
||||
field: 'designRatio',
|
||||
value?: number | string | null
|
||||
) => {
|
||||
row[field] = fromPercentValue(value, 4)
|
||||
@@ -953,7 +955,7 @@ const formRules = reactive<FormRules>({
|
||||
return
|
||||
}
|
||||
if (!hasValue(value)) {
|
||||
callback(new Error('工程总面积不能为空'))
|
||||
callback(new Error('建筑面积不能为空'))
|
||||
return
|
||||
}
|
||||
callback()
|
||||
@@ -1090,6 +1092,7 @@ const buildSavePayload = (): PlanningApi.ProjectPlanningSaveVO => ({
|
||||
sortNo: formData.value.sortNo,
|
||||
contractValueQuantity: formData.value.contractValueQuantity,
|
||||
contractValueUnitPrice: formData.value.contractValueUnitPrice,
|
||||
contractUnitPrice: formData.value.contractUnitPrice,
|
||||
managementFeeRate: formData.value.managementFeeRate,
|
||||
vatRate: formData.value.vatRate,
|
||||
implementationTeam: formData.value.implementationTeam,
|
||||
@@ -1153,7 +1156,7 @@ const validateGuideDetails = () => {
|
||||
return false
|
||||
}
|
||||
if (!row.buildingType) {
|
||||
message.warning(`${rowText}建筑类型不能为空`)
|
||||
message.warning(`${rowText}设计内容/设计类型不能为空`)
|
||||
return false
|
||||
}
|
||||
if (!hasValue(row.designArea)) {
|
||||
@@ -1177,11 +1180,11 @@ const validateGuideDetails = () => {
|
||||
return false
|
||||
}
|
||||
if (!hasValue(row.complexityFactor)) {
|
||||
message.warning(`${rowText}复杂系数不能为空`)
|
||||
message.warning(`${rowText}复杂系数/复杂等级不能为空`)
|
||||
return false
|
||||
}
|
||||
if (!hasValue(row.designRatio)) {
|
||||
message.warning(`${rowText}设计占比不能为空`)
|
||||
message.warning(`${rowText}设计阶段占比不能为空`)
|
||||
return false
|
||||
}
|
||||
}
|
||||
@@ -1192,12 +1195,17 @@ const open = async (id: number) => {
|
||||
dialogVisible.value = true
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = await PlanningApi.getProjectPlanning(id)
|
||||
formData.value = normalizeFormData(data)
|
||||
const detail = await PlanningApi.getProjectPlanningOutputEditDetail(id)
|
||||
if (!detail?.planning) {
|
||||
formData.value = createFormData()
|
||||
guideDetails.value = []
|
||||
dialogVisible.value = false
|
||||
message.warning('合约规划不存在或已被删除')
|
||||
return
|
||||
}
|
||||
formData.value = normalizeFormData(detail.planning)
|
||||
guideDetails.value = showGuideDetailSection.value
|
||||
? normalizeGuideDetailList(
|
||||
await PlanningGuideDetailApi.getProjectPlanningGuideDetailListByPlanningId(id)
|
||||
)
|
||||
? normalizeGuideDetailList(detail.guideDetails)
|
||||
: []
|
||||
applyCalculationRatioDefault()
|
||||
if (formData.value.reviewOutsourceRatio === undefined || formData.value.reviewOutsourceRatio === null) {
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
<template>
|
||||
<Dialog v-model="dialogVisible" title="季度分配编辑" width="1280">
|
||||
<div class="mb-16px rounded-8px bg-[var(--el-fill-color-light)] px-16px py-12px text-13px leading-22px text-[var(--el-text-color-secondary)]">
|
||||
在这里维护合约规划的分配总控信息和季度分配明细。新增年度默认各季度为 0%,没有比例或比例为 0 的季度不会落库。
|
||||
</div>
|
||||
|
||||
<el-form
|
||||
ref="formRef"
|
||||
@@ -54,17 +51,37 @@
|
||||
|
||||
<div class="mb-16px flex items-center justify-between">
|
||||
<div class="text-14px font-600">季度分配明细</div>
|
||||
<el-button plain @click="addDistributionYear">
|
||||
<el-button v-if="!historyParentMode" plain @click="addDistributionYear">
|
||||
<Icon class="mr-5px" icon="ep:plus" />
|
||||
新增年度
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<el-table v-loading="loading" :data="quarterRows" border>
|
||||
<el-alert
|
||||
v-if="guideDetailMode && historyParentMode"
|
||||
:title="historyMessage || '当前合约规划存在历史父级季度分配,请先清空历史父级分配后,再按指导价法明细维护。'"
|
||||
class="mb-16px"
|
||||
:closable="false"
|
||||
show-icon
|
||||
type="warning"
|
||||
/>
|
||||
|
||||
<div v-if="guideDetailMode && historyParentMode" class="mb-16px flex justify-end">
|
||||
<el-button plain type="danger" @click="clearHistoryParentQuarters">
|
||||
清空历史父级分配
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="quarterRows"
|
||||
border
|
||||
>
|
||||
<el-table-column align="center" label="分配年度" width="150">
|
||||
<template #default="scope">
|
||||
<el-date-picker
|
||||
:model-value="toYearPickerValue(scope.row.distributionYear)"
|
||||
:disabled="historyParentMode"
|
||||
class="!w-1/1"
|
||||
placeholder="请选择年度"
|
||||
type="year"
|
||||
@@ -75,7 +92,14 @@
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="操作" width="90" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button link type="danger" @click="removeDistributionYear(scope.row)">删除</el-button>
|
||||
<el-button
|
||||
:disabled="historyParentMode"
|
||||
link
|
||||
type="danger"
|
||||
@click="removeDistributionYear(scope.row)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
@@ -88,6 +112,7 @@
|
||||
<div class="flex flex-col gap-8px">
|
||||
<el-input-number
|
||||
:model-value="toQuarterPercent(scope.row, quarter.value)"
|
||||
:disabled="historyParentMode"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="0.01"
|
||||
@@ -102,7 +127,7 @@
|
||||
</el-table>
|
||||
|
||||
<template #footer>
|
||||
<el-button :disabled="loading" type="primary" @click="submitForm">保存</el-button>
|
||||
<el-button :disabled="loading || historyParentMode" type="primary" @click="submitForm">保存</el-button>
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
@@ -142,6 +167,10 @@ const formData = ref<PlanningApi.ProjectPlanningVO>({
|
||||
progressRemark: ''
|
||||
})
|
||||
const quarterRows = ref<QuarterYearRow[]>([])
|
||||
const guideDetailMode = ref(false)
|
||||
const historyParentMode = ref(false)
|
||||
const historyMessage = ref('')
|
||||
const activeGuideDetail = ref<PlanningQuarterApi.ProjectPlanningQuarterGuideDetailVO>()
|
||||
|
||||
const totalDistributionAmountPercent = computed({
|
||||
get: () => toPercentValue(formData.value.totalDistributionAmount),
|
||||
@@ -158,9 +187,12 @@ const formRules = reactive<FormRules>({
|
||||
const buildQuarterCell = (
|
||||
currentPlanningId: number,
|
||||
distributionYear: number,
|
||||
quarterNo: number
|
||||
quarterNo: number,
|
||||
guideDetail?: PlanningQuarterApi.ProjectPlanningQuarterGuideDetailVO
|
||||
): PlanningQuarterApi.ProjectPlanningQuarterVO => ({
|
||||
planningId: currentPlanningId,
|
||||
guideDetailId: guideDetail?.id,
|
||||
guideDetailSortNo: guideDetail?.sortNo,
|
||||
distributionYear,
|
||||
quarterNo,
|
||||
distributionRatio: undefined,
|
||||
@@ -169,7 +201,8 @@ const buildQuarterCell = (
|
||||
|
||||
const buildQuarterRows = (
|
||||
planning: PlanningApi.ProjectPlanningVO,
|
||||
quarters: PlanningQuarterApi.ProjectPlanningQuarterVO[]
|
||||
quarters: PlanningQuarterApi.ProjectPlanningQuarterVO[],
|
||||
guideDetail?: PlanningQuarterApi.ProjectPlanningQuarterGuideDetailVO
|
||||
) => {
|
||||
const yearSet = new Set<number>()
|
||||
if (planning.planningStartYear) {
|
||||
@@ -193,22 +226,45 @@ const buildQuarterRows = (
|
||||
const match = quarters.find(
|
||||
(item) =>
|
||||
Number(item.distributionYear) === distributionYear &&
|
||||
Number(item.quarterNo) === quarterNo
|
||||
Number(item.quarterNo) === quarterNo &&
|
||||
Number(item.guideDetailId || 0) === Number(guideDetail?.id || 0)
|
||||
)
|
||||
return match
|
||||
? { ...match }
|
||||
: buildQuarterCell(planning.id!, distributionYear, quarterNo)
|
||||
: buildQuarterCell(planning.id!, distributionYear, quarterNo, guideDetail)
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
const open = async (id: number) => {
|
||||
const open = async (id: number, guideDetailId?: number) => {
|
||||
planningId.value = id
|
||||
dialogVisible.value = true
|
||||
loading.value = true
|
||||
deletedQuarterIds.value = []
|
||||
guideDetailMode.value = false
|
||||
historyParentMode.value = false
|
||||
historyMessage.value = ''
|
||||
activeGuideDetail.value = undefined
|
||||
try {
|
||||
const planning = await PlanningApi.getProjectPlanning(id)
|
||||
const detail = await PlanningQuarterApi.getProjectPlanningQuarterPlanningDetail(id)
|
||||
if (!detail?.planning) {
|
||||
planningId.value = undefined
|
||||
formData.value = {
|
||||
projectId: 0,
|
||||
ownershipType: '',
|
||||
calculationMethod: '',
|
||||
planningContent: '',
|
||||
totalDistributionAmount: 1,
|
||||
progressRemark: ''
|
||||
}
|
||||
quarterRows.value = []
|
||||
activeGuideDetail.value = undefined
|
||||
deletedQuarterIds.value = []
|
||||
dialogVisible.value = false
|
||||
message.warning('合约规划不存在或已被删除')
|
||||
return
|
||||
}
|
||||
const planning = detail.planning
|
||||
formData.value = {
|
||||
...planning,
|
||||
contractValueQuantity: planning.contractValueQuantity ?? 1,
|
||||
@@ -217,8 +273,24 @@ const open = async (id: number) => {
|
||||
totalDistributionAmount: planning.totalDistributionAmount ?? 1,
|
||||
progressRemark: planning.progressRemark ?? ''
|
||||
}
|
||||
const quarterList = await PlanningQuarterApi.getProjectPlanningQuarterListByPlanningId(id)
|
||||
quarterRows.value = buildQuarterRows(formData.value, quarterList)
|
||||
guideDetailMode.value = !!detail.guideDetailMode
|
||||
historyParentMode.value = !!detail.historyParentMode
|
||||
historyMessage.value = detail.message || ''
|
||||
if (guideDetailMode.value && !historyParentMode.value) {
|
||||
const targetGuideDetail = guideDetailId
|
||||
? (detail.guideDetails || []).find((item) => Number(item.id) === Number(guideDetailId))
|
||||
: undefined
|
||||
if (!targetGuideDetail) {
|
||||
quarterRows.value = []
|
||||
dialogVisible.value = false
|
||||
message.warning('请先在外层选择指导价法明细')
|
||||
return
|
||||
}
|
||||
activeGuideDetail.value = targetGuideDetail
|
||||
quarterRows.value = buildQuarterRows(formData.value, targetGuideDetail.quarters || [], targetGuideDetail)
|
||||
} else {
|
||||
quarterRows.value = buildQuarterRows(formData.value, detail.quarters || [])
|
||||
}
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
@@ -239,7 +311,7 @@ const addDistributionYear = () => {
|
||||
quarterRows.value.push({
|
||||
distributionYear,
|
||||
quarters: QUARTER_OPTIONS.map((item) =>
|
||||
buildQuarterCell(planningId.value!, distributionYear, item.value)
|
||||
buildQuarterCell(planningId.value!, distributionYear, item.value, activeGuideDetail.value)
|
||||
)
|
||||
})
|
||||
}
|
||||
@@ -254,6 +326,30 @@ const removeDistributionYear = (row: QuarterYearRow) => {
|
||||
quarterRows.value = quarterRows.value.filter((item) => item !== row)
|
||||
}
|
||||
|
||||
const clearHistoryParentQuarters = async () => {
|
||||
if (!planningId.value) {
|
||||
return
|
||||
}
|
||||
const ids = quarterRows.value
|
||||
.flatMap((row) => row.quarters)
|
||||
.map((item) => item.id)
|
||||
.filter((id): id is number => typeof id === 'number')
|
||||
if (!ids.length) {
|
||||
message.warning('没有可清空的历史父级分配')
|
||||
return
|
||||
}
|
||||
await message.confirm('确认清空历史父级季度分配吗?清空后需要按指导价法明细重新录入。')
|
||||
loading.value = true
|
||||
try {
|
||||
await PlanningQuarterApi.deleteProjectPlanningQuarterList(Array.from(new Set(ids)))
|
||||
message.success('历史父级分配已清空,请在外层选择序号后重新录入')
|
||||
dialogVisible.value = false
|
||||
emit('success')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const toYearPickerValue = (value?: number) => (value ? String(value) : undefined)
|
||||
|
||||
const updateDistributionYear = (row: QuarterYearRow, value?: string) => {
|
||||
@@ -290,6 +386,8 @@ const buildQuarterSavePayload = (
|
||||
): PlanningQuarterApi.ProjectPlanningQuarterSaveVO => ({
|
||||
id: quarter.id,
|
||||
planningId: planningId.value!,
|
||||
guideDetailId: quarter.guideDetailId,
|
||||
guideDetailSortNo: quarter.guideDetailSortNo,
|
||||
distributionYear: row.distributionYear,
|
||||
quarterNo: quarter.quarterNo,
|
||||
distributionRatio: quarter.distributionRatio
|
||||
|
||||
@@ -84,12 +84,12 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<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">
|
||||
{{ formatAmountText(scope.row.contractAmount) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="工程总面积(㎡)" width="140">
|
||||
<el-table-column align="center" label="建筑面积(㎡)" width="140">
|
||||
<template #default="scope">
|
||||
{{ formatAreaText(scope.row.totalConstructionArea) }}
|
||||
</template>
|
||||
@@ -111,8 +111,8 @@
|
||||
/>
|
||||
</ContentWrap>
|
||||
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="9">
|
||||
<SplitPane>
|
||||
<template #left>
|
||||
<ContentWrap>
|
||||
<div class="mb-12px flex items-center justify-between">
|
||||
<div class="text-14px font-600">
|
||||
@@ -127,7 +127,6 @@
|
||||
highlight-current-row
|
||||
@current-change="handleCurrentPlanningChange"
|
||||
>
|
||||
<el-table-column align="center" label="序号" type="index" width="70" />
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="项目任务包"
|
||||
@@ -162,10 +161,16 @@
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="排序" prop="sortNo" width="80" />
|
||||
</el-table>
|
||||
<PlanningOwnershipSummary
|
||||
:planning-list="planningList"
|
||||
amount-field="assessmentOutputValue"
|
||||
amount-label="考核产值(元)"
|
||||
title="归属类型考核产值合计"
|
||||
/>
|
||||
</ContentWrap>
|
||||
</el-col>
|
||||
</template>
|
||||
|
||||
<el-col :span="15">
|
||||
<template #right>
|
||||
<ContentWrap v-if="currentPlanning">
|
||||
<div class="mb-16px flex items-center justify-between gap-16px">
|
||||
<div>
|
||||
@@ -302,15 +307,22 @@
|
||||
<div class="mb-16px flex items-center justify-between gap-16px">
|
||||
<div>
|
||||
<div class="text-14px font-600">季度分配</div>
|
||||
<div class="mt-4px text-12px text-[var(--el-text-color-secondary)]">
|
||||
<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>
|
||||
<el-button
|
||||
v-hasPermi="['tjt:planning:update', 'tjt:planning-quarter:update', 'tjt:planning-quarter:create']"
|
||||
:disabled="guideDetailMode && !historyParentMode && !activeGuideDetail"
|
||||
plain
|
||||
type="primary"
|
||||
@click="openQuarterDistributionForm"
|
||||
@click="openQuarterDistributionForm(activeGuideDetail?.id)"
|
||||
>
|
||||
编辑季度分配
|
||||
</el-button>
|
||||
@@ -329,7 +341,13 @@
|
||||
<div class="rounded-8px bg-[var(--el-fill-color-light)] px-16px py-12px">
|
||||
<div class="text-12px text-[var(--el-text-color-secondary)]">已分配</div>
|
||||
<div class="mt-6px text-18px font-600">
|
||||
{{ formatPercentText(currentPlanning.allocatedAmount) }}
|
||||
{{
|
||||
formatPercentText(
|
||||
guideDetailMode && activeGuideDetail
|
||||
? activeGuideDetail.allocatedAmount
|
||||
: currentPlanning.allocatedAmount
|
||||
)
|
||||
}}
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
@@ -337,7 +355,13 @@
|
||||
<div class="rounded-8px bg-[var(--el-fill-color-light)] px-16px py-12px">
|
||||
<div class="text-12px text-[var(--el-text-color-secondary)]">待分配</div>
|
||||
<div class="mt-6px text-18px font-600">
|
||||
{{ formatPercentText(currentPlanning.pendingAmount) }}
|
||||
{{
|
||||
formatPercentText(
|
||||
guideDetailMode && activeGuideDetail
|
||||
? activeGuideDetail.pendingAmount
|
||||
: currentPlanning.pendingAmount
|
||||
)
|
||||
}}
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
@@ -351,7 +375,63 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="quarterLoading" :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
|
||||
v-for="quarter in QUARTER_OPTIONS"
|
||||
@@ -373,8 +453,8 @@
|
||||
<ContentWrap v-else>
|
||||
<el-empty description="请选择合约规划后查看测算结果和季度分配" />
|
||||
</ContentWrap>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
</SplitPane>
|
||||
|
||||
<PlanningOutputForm ref="planningOutputFormRef" @success="handlePlanningOutputFormSuccess" />
|
||||
<QuarterDistributionForm
|
||||
@@ -390,6 +470,8 @@ import * as PlanningApi from '@/api/tjt/planning'
|
||||
import * as PlanningQuarterApi from '@/api/tjt/planningQuarter'
|
||||
import PlanningOutputForm from './PlanningOutputForm.vue'
|
||||
import QuarterDistributionForm from './QuarterDistributionForm.vue'
|
||||
import PlanningOwnershipSummary from '@/views/tjt/shared/PlanningOwnershipSummary.vue'
|
||||
import SplitPane from '@/views/tjt/shared/SplitPane.vue'
|
||||
import {
|
||||
CONTRACT_SIGN_OPTIONS,
|
||||
QUARTER_OPTIONS,
|
||||
@@ -398,6 +480,7 @@ import {
|
||||
formatPercentText,
|
||||
getCalculationMethodLabel,
|
||||
getCalculationRatioLabel,
|
||||
getDesignPartLabel,
|
||||
getDesignStageLabel,
|
||||
getOwnershipTypeLabel,
|
||||
getVirtualCalculationMethodLabel,
|
||||
@@ -415,6 +498,11 @@ interface QuarterYearRow {
|
||||
quarters: PlanningQuarterApi.ProjectPlanningQuarterVO[]
|
||||
}
|
||||
|
||||
interface GuideDetailQuarterRow extends PlanningQuarterApi.ProjectPlanningQuarterGuideDetailVO {
|
||||
tabKey: string
|
||||
quarterRows: QuarterYearRow[]
|
||||
}
|
||||
|
||||
const message = useMessage()
|
||||
|
||||
const loading = ref(false)
|
||||
@@ -426,9 +514,14 @@ const planningList = ref<PlanningApi.ProjectPlanningVO[]>([])
|
||||
const currentProject = ref<ProjectApi.ProjectVO>()
|
||||
const currentPlanning = ref<PlanningApi.ProjectPlanningVO>()
|
||||
const quarterRows = ref<QuarterYearRow[]>([])
|
||||
const guideDetailMode = ref(false)
|
||||
const historyParentMode = ref(false)
|
||||
const guideDetailRows = ref<GuideDetailQuarterRow[]>([])
|
||||
const activeGuideDetailTab = ref('')
|
||||
const queryFormRef = ref()
|
||||
const projectTableRef = ref()
|
||||
const planningTableRef = ref()
|
||||
let planningDetailRequestSeq = 0
|
||||
|
||||
const queryParams = reactive<ProjectApi.ProjectPageReqVO>({
|
||||
pageNo: 1,
|
||||
@@ -478,6 +571,13 @@ const showParentInternalGuidanceUnitPrice = computed(
|
||||
currentPlanning.value?.internalGuidanceUnitPrice !== undefined &&
|
||||
currentPlanning.value?.internalGuidanceUnitPrice !== null
|
||||
)
|
||||
const activeGuideDetail = computed(() => {
|
||||
return (
|
||||
guideDetailRows.value.find((item) => item.tabKey === activeGuideDetailTab.value) ||
|
||||
guideDetailRows.value[0]
|
||||
)
|
||||
})
|
||||
const activeGuideDetailQuarterRows = computed(() => activeGuideDetail.value?.quarterRows || [])
|
||||
|
||||
const formatFactorText = (value?: number, digits = 4) => {
|
||||
if (value === undefined || value === null) {
|
||||
@@ -535,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 () => {
|
||||
loading.value = true
|
||||
try {
|
||||
@@ -545,7 +659,7 @@ const getProjectList = async () => {
|
||||
currentProject.value = undefined
|
||||
planningList.value = []
|
||||
currentPlanning.value = undefined
|
||||
quarterRows.value = []
|
||||
cancelQuarterDetailState()
|
||||
return
|
||||
}
|
||||
const targetProjectId = currentProject.value?.id || projectList.value[0].id
|
||||
@@ -562,7 +676,7 @@ const getPlanningList = async () => {
|
||||
if (!currentProject.value?.id) {
|
||||
planningList.value = []
|
||||
currentPlanning.value = undefined
|
||||
quarterRows.value = []
|
||||
cancelQuarterDetailState()
|
||||
return
|
||||
}
|
||||
planningLoading.value = true
|
||||
@@ -570,7 +684,7 @@ const getPlanningList = async () => {
|
||||
planningList.value = await PlanningApi.getProjectPlanningListByProjectId(currentProject.value.id)
|
||||
if (!planningList.value.length) {
|
||||
currentPlanning.value = undefined
|
||||
quarterRows.value = []
|
||||
cancelQuarterDetailState()
|
||||
return
|
||||
}
|
||||
const targetPlanningId = currentPlanning.value?.id || planningList.value[0].id
|
||||
@@ -584,14 +698,35 @@ const getPlanningList = async () => {
|
||||
}
|
||||
|
||||
const loadPlanningDetail = async (planningId: number) => {
|
||||
const planning = await PlanningApi.getProjectPlanning(planningId)
|
||||
currentPlanning.value = planning
|
||||
const requestSeq = ++planningDetailRequestSeq
|
||||
quarterLoading.value = true
|
||||
try {
|
||||
const quarterList = await PlanningQuarterApi.getProjectPlanningQuarterListByPlanningId(planningId)
|
||||
quarterRows.value = buildQuarterRows(planning, quarterList)
|
||||
const detail = await PlanningQuarterApi.getProjectPlanningQuarterPlanningDetail(planningId)
|
||||
if (requestSeq !== planningDetailRequestSeq) {
|
||||
return
|
||||
}
|
||||
currentPlanning.value = detail?.planning
|
||||
guideDetailMode.value = !!detail?.guideDetailMode
|
||||
historyParentMode.value = !!detail?.historyParentMode
|
||||
if (!detail?.planning) {
|
||||
resetQuarterDetailState()
|
||||
return
|
||||
}
|
||||
quarterRows.value = buildQuarterRows(detail.planning, detail.quarters || [])
|
||||
guideDetailRows.value = (detail.guideDetails || []).map((item, index) => ({
|
||||
...item,
|
||||
tabKey: String(item.id ?? item.sortNo ?? index),
|
||||
quarterRows: buildQuarterRows(detail.planning!, item.quarters || [])
|
||||
}))
|
||||
const currentTab = activeGuideDetailTab.value
|
||||
activeGuideDetailTab.value =
|
||||
guideDetailRows.value.find((item) => item.tabKey === currentTab)?.tabKey ||
|
||||
guideDetailRows.value[0]?.tabKey ||
|
||||
''
|
||||
} finally {
|
||||
quarterLoading.value = false
|
||||
if (requestSeq === planningDetailRequestSeq) {
|
||||
quarterLoading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -606,14 +741,20 @@ const resetQuery = () => {
|
||||
}
|
||||
|
||||
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()
|
||||
}
|
||||
|
||||
const handleCurrentPlanningChange = async (row?: PlanningApi.ProjectPlanningVO) => {
|
||||
if (!row?.id) {
|
||||
currentPlanning.value = undefined
|
||||
quarterRows.value = []
|
||||
cancelQuarterDetailState()
|
||||
return
|
||||
}
|
||||
await loadPlanningDetail(row.id)
|
||||
@@ -630,12 +771,15 @@ const openPlanningOutputForm = () => {
|
||||
planningOutputFormRef.value.open(currentPlanning.value.id)
|
||||
}
|
||||
|
||||
const openQuarterDistributionForm = () => {
|
||||
const openQuarterDistributionForm = (guideDetailId?: number) => {
|
||||
if (!currentPlanning.value?.id) {
|
||||
message.warning('请先选择合约规划')
|
||||
return
|
||||
}
|
||||
quarterDistributionFormRef.value.open(currentPlanning.value.id)
|
||||
quarterDistributionFormRef.value.open(
|
||||
currentPlanning.value.id,
|
||||
guideDetailMode.value && !historyParentMode.value ? guideDetailId : undefined
|
||||
)
|
||||
}
|
||||
|
||||
const handlePlanningOutputFormSuccess = async () => {
|
||||
|
||||
@@ -78,36 +78,51 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<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">
|
||||
{{ formatAmountText(scope.row.contractAmount) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="最终结算金额(元)" width="140">
|
||||
<el-table-column align="center" label="结算合同总产值(元)" width="150">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.finalSettlementAmount) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="综合所协作金额(元)" width="150">
|
||||
<el-table-column align="center" label="合同产值(不含增值税)(元)" width="190">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.effectiveSettlementAmount) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="综合所人工成本(元)" width="150">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.comprehensivePlanningAmount) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="专业分包金额(元)" width="150">
|
||||
<el-table-column align="center" label="专项分包(专业所成本)(元)" width="210">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.subcontractPlanningAmount) }}
|
||||
{{ formatAmountText(scope.row.specialSubcontractPlanningAmount) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="专业所产值(元)" width="130">
|
||||
<el-table-column align="center" label="专项分包(源头合作成本)(元)" width="240">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.majorOutputValue) }}
|
||||
{{ formatAmountText(scope.row.sourceCoopSubcontractPlanningAmount) }}
|
||||
</template>
|
||||
</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">
|
||||
{{ formatAmountText(scope.row.majorExpectedPerformance) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="专业所考核产值(元)" width="150">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.majorOutputValue) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="科创产值比例" width="110">
|
||||
<template #default="scope">
|
||||
{{ formatPercentText(scope.row.innovationOutputRate) }}
|
||||
@@ -123,14 +138,14 @@
|
||||
{{ formatAmountText(scope.row.otherCost) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="盈亏值(元)" width="120">
|
||||
<el-table-column align="center" label="预算盈亏值(元)" width="130">
|
||||
<template #default="scope">
|
||||
<span :class="profitLossClass(scope.row.profitLossValue)">
|
||||
{{ formatAmountText(scope.row.profitLossValue) }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="盈亏百分比" width="120">
|
||||
<el-table-column align="center" label="预算盈亏百分比" width="140">
|
||||
<template #default="scope">
|
||||
<span :class="profitLossClass(scope.row.profitLossValue)">
|
||||
{{ formatPercentText(scope.row.profitLossRate) }}
|
||||
@@ -147,66 +162,291 @@
|
||||
/>
|
||||
</ContentWrap>
|
||||
|
||||
<ContentWrap v-if="currentProfit">
|
||||
<div class="mb-16px flex items-center justify-between gap-16px">
|
||||
<div class="text-16px font-600">{{ currentProfit.projectName }}</div>
|
||||
<el-button plain type="primary" @click="openProfitEditDialog">
|
||||
<Icon class="mr-5px" icon="ep:edit" />
|
||||
编辑盈亏参数
|
||||
</el-button>
|
||||
<ContentWrap>
|
||||
<div v-loading="detailLoading" class="min-h-220px">
|
||||
<template v-if="currentProfit">
|
||||
<div class="mb-16px flex items-center justify-between gap-16px">
|
||||
<div class="text-16px font-600">{{ currentProfit.projectName }}</div>
|
||||
<el-button plain type="primary" @click="openProfitEditDialog">
|
||||
<Icon class="mr-5px" icon="ep:edit" />
|
||||
编辑项目成本参数
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<section class="mb-28px">
|
||||
<div class="mb-12px flex items-center justify-between gap-16px">
|
||||
<div>
|
||||
<div class="text-15px font-600">项目成本预算测算表</div>
|
||||
<div class="mt-4px flex flex-wrap items-center gap-10px text-13px text-[var(--el-text-color-secondary)]">
|
||||
<el-tag :type="budgetSnapshot ? 'success' : 'info'">
|
||||
{{ budgetSnapshot ? '已锁定' : '动态测算' }}
|
||||
</el-tag>
|
||||
<span>{{ snapshotActionText(budgetSnapshot) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<el-button
|
||||
:disabled="!!budgetSnapshot"
|
||||
:loading="actionLoading === 'budget'"
|
||||
type="primary"
|
||||
@click="handleLockBudgetSnapshot"
|
||||
>
|
||||
目标责任书下达
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<el-alert
|
||||
v-if="!budgetSnapshot"
|
||||
class="mb-12px"
|
||||
:closable="false"
|
||||
show-icon
|
||||
title="当前展示实时动态测算值。点击“目标责任书下达”后,本阶段数据会生成快照并锁定。"
|
||||
type="info"
|
||||
/>
|
||||
|
||||
<el-descriptions v-if="budgetDisplay" :column="3" border>
|
||||
<el-descriptions-item label="合同总产值(元)">
|
||||
{{ formatAmountText(budgetDisplay.contractAmount) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="结算合同总产值(元)">
|
||||
{{ formatAmountText(budgetDisplay.finalSettlementAmount) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="合同产值(不含增值税)(元)">
|
||||
{{ formatAmountText(budgetDisplay.effectiveSettlementAmount) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="项目开始年度">
|
||||
{{ currentProfit.projectStartYear || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="综合所人工成本(元)">
|
||||
{{ formatAmountText(budgetDisplay.comprehensivePlanningAmount) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="专项分包(专业所成本)(元)">
|
||||
{{ formatAmountText(budgetDisplay.specialSubcontractPlanningAmount) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="专项分包(源头合作成本)(元)">
|
||||
{{ formatAmountText(budgetDisplay.sourceCoopSubcontractPlanningAmount) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="专项分包(综合所成本)(元)">
|
||||
{{ formatAmountText(budgetDisplay.comprehensiveSubcontractPlanningAmount) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="专业所人工成本(元)">
|
||||
{{ formatAmountText(budgetDisplay.majorExpectedPerformance) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="专业所考核产值(元)">
|
||||
{{ formatAmountText(budgetDisplay.majorOutputValue) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="科创产值比例">
|
||||
{{ formatPercentText(budgetDisplay.innovationOutputRate) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="科创产值(元)">
|
||||
{{ formatAmountText(budgetDisplay.innovationOutputValue) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="其他成本(元)">
|
||||
{{ formatAmountText(budgetDisplay.otherCost) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="预算盈亏值(元)">
|
||||
<span :class="profitLossClass(budgetDisplay.profitLossValue)">
|
||||
{{ formatAmountText(budgetDisplay.profitLossValue) }}
|
||||
</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="预算盈亏百分比">
|
||||
<span :class="profitLossClass(budgetDisplay.profitLossValue)">
|
||||
{{ formatPercentText(budgetDisplay.profitLossRate) }}
|
||||
</span>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</section>
|
||||
|
||||
<section class="mb-28px">
|
||||
<div class="mb-12px flex items-center justify-between gap-16px">
|
||||
<div>
|
||||
<div class="text-15px font-600">项目成本核算测算表</div>
|
||||
<div class="mt-4px flex flex-wrap items-center gap-10px text-13px text-[var(--el-text-color-secondary)]">
|
||||
<el-tag :type="accountingSnapshot ? 'success' : 'info'">
|
||||
{{ accountingSnapshot ? '已锁定' : '动态测算' }}
|
||||
</el-tag>
|
||||
<span>{{ snapshotActionText(accountingSnapshot) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<el-button
|
||||
:disabled="!budgetSnapshot || !!accountingSnapshot"
|
||||
:loading="actionLoading === 'accounting'"
|
||||
type="primary"
|
||||
@click="handleLockAccountingSnapshot"
|
||||
>
|
||||
竣工验收完成
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<el-alert
|
||||
v-if="!budgetSnapshot"
|
||||
class="mb-12px"
|
||||
:closable="false"
|
||||
show-icon
|
||||
title="请先下达目标责任书,锁定项目成本预算测算后,才能完成竣工验收。"
|
||||
type="warning"
|
||||
/>
|
||||
<el-alert
|
||||
v-else-if="!accountingSnapshot"
|
||||
class="mb-12px"
|
||||
:closable="false"
|
||||
show-icon
|
||||
title="当前展示实时动态测算值。点击“竣工验收完成”后,本阶段数据会生成快照并锁定。"
|
||||
type="info"
|
||||
/>
|
||||
|
||||
<el-descriptions v-if="accountingDisplay" :column="3" border>
|
||||
<el-descriptions-item label="合同总产值(元)">
|
||||
{{ formatAmountText(accountingDisplay.contractAmount) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="结算合同总产值(元)">
|
||||
{{ formatAmountText(accountingDisplay.finalSettlementAmount) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="合同产值(不含增值税)(元)">
|
||||
{{ formatAmountText(accountingDisplay.effectiveSettlementAmount) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="项目开始年度">
|
||||
{{ currentProfit.projectStartYear || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="综合所人工成本(元)">
|
||||
{{ formatAmountText(accountingDisplay.comprehensivePlanningAmount) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="专项分包(专业所成本)(元)">
|
||||
{{ formatAmountText(accountingDisplay.specialSubcontractPlanningAmount) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="专项分包(源头合作成本)(元)">
|
||||
{{ formatAmountText(accountingDisplay.sourceCoopSubcontractPlanningAmount) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="专项分包(综合所成本)(元)">
|
||||
{{ formatAmountText(accountingDisplay.comprehensiveSubcontractPlanningAmount) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="专业所人工成本(元)">
|
||||
{{ formatAmountText(accountingDisplay.majorExpectedPerformance) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="专业所考核产值(元)">
|
||||
{{ formatAmountText(accountingDisplay.majorOutputValue) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="科创产值比例">
|
||||
{{ formatPercentText(accountingDisplay.innovationOutputRate) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="科创产值(元)">
|
||||
{{ formatAmountText(accountingDisplay.innovationOutputValue) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="其他成本(元)">
|
||||
{{ formatAmountText(accountingDisplay.otherCost) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="预算盈亏值(元)">
|
||||
<span :class="profitLossClass(accountingDisplay.profitLossValue)">
|
||||
{{ formatAmountText(accountingDisplay.profitLossValue) }}
|
||||
</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="预算盈亏百分比">
|
||||
<span :class="profitLossClass(accountingDisplay.profitLossValue)">
|
||||
{{ formatPercentText(accountingDisplay.profitLossRate) }}
|
||||
</span>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<div class="mb-12px flex items-center justify-between gap-16px">
|
||||
<div>
|
||||
<div class="text-15px font-600">项目成本结算测算表</div>
|
||||
<div class="mt-4px flex flex-wrap items-center gap-10px text-13px text-[var(--el-text-color-secondary)]">
|
||||
<el-tag :type="settlementSnapshot ? 'success' : 'info'">
|
||||
{{ settlementSnapshot ? '已保存' : '未保存' }}
|
||||
</el-tag>
|
||||
<span>{{ snapshotActionText(settlementSnapshot, '保存结算测算后会记录操作人和操作时间') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-alert
|
||||
v-if="!accountingSnapshot"
|
||||
class="mb-12px"
|
||||
:closable="false"
|
||||
show-icon
|
||||
title="请先点击“竣工验收完成”锁定项目成本核算测算,再维护结算测算。"
|
||||
type="warning"
|
||||
/>
|
||||
|
||||
<el-descriptions :column="2" border>
|
||||
<el-descriptions-item label="综合所考核产值核算值(元)">
|
||||
{{ formatAmountText(settlementComprehensiveAccountingValue) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="综合所考核产值结算值(元)">
|
||||
{{ formatAmountText(settlementComprehensiveSettlementValue) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="专业所考核产值核算值(元)">
|
||||
{{ formatAmountText(settlementMajorAccountingValue) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="专业所考核产值结算值(元)">
|
||||
{{ formatAmountText(settlementMajorSettlementValue) }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<el-form
|
||||
ref="settlementFormRef"
|
||||
:disabled="!accountingSnapshot"
|
||||
:model="settlementForm"
|
||||
:rules="settlementRules"
|
||||
class="mt-16px"
|
||||
label-width="110px"
|
||||
>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="考核结果" prop="assessmentResult">
|
||||
<el-select
|
||||
v-model="settlementForm.assessmentResult"
|
||||
class="!w-1/1"
|
||||
placeholder="请选择考核结果"
|
||||
>
|
||||
<el-option label="优秀" value="优秀" />
|
||||
<el-option label="合格" value="合格" />
|
||||
<el-option label="待改进" value="待改进" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="考核系数" prop="assessmentCoefficient">
|
||||
<el-input :model-value="formatCoefficientText(settlementCoefficient)" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="操作" prop="action">
|
||||
<el-button
|
||||
:disabled="!accountingSnapshot"
|
||||
:loading="actionLoading === 'settlement'"
|
||||
type="primary"
|
||||
@click="handleSaveSettlementSnapshot"
|
||||
>
|
||||
保存结算测算
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input
|
||||
v-model="settlementForm.remark"
|
||||
:rows="2"
|
||||
maxlength="500"
|
||||
placeholder="请输入备注"
|
||||
show-word-limit
|
||||
type="textarea"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<el-empty v-else-if="!detailLoading" description="请选择项目后查看项目成本详情" />
|
||||
</div>
|
||||
|
||||
<el-descriptions :column="3" border>
|
||||
<el-descriptions-item label="合同产值(元)">
|
||||
{{ formatAmountText(currentProfit.contractAmount) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="最终结算金额(元)">
|
||||
{{ formatAmountText(currentProfit.finalSettlementAmount) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="项目开始年度">
|
||||
{{ currentProfit.projectStartYear || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="综合所协作金额(元)">
|
||||
{{ formatAmountText(currentProfit.comprehensivePlanningAmount) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="专业分包金额(元)">
|
||||
{{ formatAmountText(currentProfit.subcontractPlanningAmount) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="专业所产值(元)">
|
||||
{{ formatAmountText(currentProfit.majorOutputValue) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="专业所预计绩效(元)">
|
||||
{{ formatAmountText(currentProfit.majorExpectedPerformance) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="科创产值比例">
|
||||
{{ formatPercentText(currentProfit.innovationOutputRate) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="科创产值(元)">
|
||||
{{ formatAmountText(currentProfit.innovationOutputValue) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="其他成本(元)">
|
||||
{{ formatAmountText(currentProfit.otherCost) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="盈亏值(元)">
|
||||
<span :class="profitLossClass(currentProfit.profitLossValue)">
|
||||
{{ formatAmountText(currentProfit.profitLossValue) }}
|
||||
</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="盈亏百分比">
|
||||
<span :class="profitLossClass(currentProfit.profitLossValue)">
|
||||
{{ formatPercentText(currentProfit.profitLossRate) }}
|
||||
</span>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</ContentWrap>
|
||||
|
||||
<ContentWrap v-else>
|
||||
<el-empty description="请选择项目后查看盈亏详情" />
|
||||
</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-item label="最终结算金额(元)" prop="finalSettlementAmount">
|
||||
<el-form-item label="结算合同总产值(元)" prop="finalSettlementAmount">
|
||||
<el-input-number
|
||||
v-model="formData.finalSettlementAmount"
|
||||
:min="0"
|
||||
@@ -257,6 +497,7 @@ import {
|
||||
fromPercentValue,
|
||||
toPercentValue
|
||||
} from '@/views/tjt/shared/planning'
|
||||
import { formatDate } from '@/utils/formatTime'
|
||||
|
||||
defineOptions({ name: 'TjtProfit' })
|
||||
|
||||
@@ -264,11 +505,22 @@ const message = useMessage()
|
||||
const { t } = useI18n()
|
||||
|
||||
const loading = ref(false)
|
||||
const detailLoading = ref(false)
|
||||
const actionLoading = ref<'budget' | 'accounting' | 'settlement' | ''>('')
|
||||
const total = ref(0)
|
||||
const list = ref<ProfitApi.ProjectProfitVO[]>([])
|
||||
const currentProfit = ref<ProfitApi.ProjectProfitVO>()
|
||||
const queryFormRef = ref()
|
||||
const profitTableRef = ref()
|
||||
const settlementFormRef = ref()
|
||||
const settlementForm = reactive<ProfitApi.ProjectProfitSettlementSaveReqVO>({
|
||||
projectId: 0,
|
||||
assessmentResult: '合格',
|
||||
remark: ''
|
||||
})
|
||||
const settlementRules = {
|
||||
assessmentResult: [{ required: true, message: '请选择考核结果', trigger: 'change' }]
|
||||
}
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const dialogLoading = ref(false)
|
||||
@@ -313,23 +565,49 @@ const queryProjectStartYearValue = computed({
|
||||
}
|
||||
})
|
||||
|
||||
const budgetSnapshot = computed(() => currentProfit.value?.budgetSnapshot)
|
||||
const accountingSnapshot = computed(() => currentProfit.value?.accountingSnapshot)
|
||||
const settlementSnapshot = computed(() => currentProfit.value?.settlementSnapshot)
|
||||
const budgetDisplay = computed(() => budgetSnapshot.value || currentProfit.value)
|
||||
const accountingDisplay = computed(() => accountingSnapshot.value || currentProfit.value)
|
||||
const settlementCoefficient = computed(() => getAssessmentCoefficient(settlementForm.assessmentResult))
|
||||
const settlementComprehensiveAccountingValue = computed(() =>
|
||||
Number(
|
||||
settlementSnapshot.value?.comprehensiveAccountingOutputValue ??
|
||||
accountingSnapshot.value?.comprehensivePlanningAmount ??
|
||||
0
|
||||
)
|
||||
)
|
||||
const settlementMajorAccountingValue = computed(() =>
|
||||
Number(settlementSnapshot.value?.majorAccountingOutputValue ?? accountingSnapshot.value?.majorOutputValue ?? 0)
|
||||
)
|
||||
const settlementComprehensiveSettlementValue = computed(() =>
|
||||
roundAmount(settlementComprehensiveAccountingValue.value * settlementCoefficient.value)
|
||||
)
|
||||
const settlementMajorSettlementValue = computed(() =>
|
||||
roundAmount(settlementMajorAccountingValue.value * settlementCoefficient.value)
|
||||
)
|
||||
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
let targetProfit: ProfitApi.ProjectProfitVO | undefined
|
||||
try {
|
||||
const data = await ProfitApi.getProjectProfitPage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
if (!list.value.length) {
|
||||
currentProfit.value = undefined
|
||||
return
|
||||
} else {
|
||||
const targetProjectId = currentProfit.value?.projectId || list.value[0].projectId
|
||||
targetProfit = list.value.find((item) => item.projectId === targetProjectId) || list.value[0]
|
||||
}
|
||||
const targetProjectId = currentProfit.value?.projectId || list.value[0].projectId
|
||||
const targetProfit = list.value.find((item) => item.projectId === targetProjectId) || list.value[0]
|
||||
await nextTick()
|
||||
profitTableRef.value?.setCurrentRow(targetProfit)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
if (targetProfit) {
|
||||
await nextTick()
|
||||
profitTableRef.value?.setCurrentRow(targetProfit)
|
||||
}
|
||||
}
|
||||
|
||||
const handleQuery = () => {
|
||||
@@ -347,17 +625,81 @@ const handleCurrentProfitChange = async (row?: ProfitApi.ProjectProfitVO) => {
|
||||
currentProfit.value = undefined
|
||||
return
|
||||
}
|
||||
currentProfit.value = await ProfitApi.getProjectProfit(row.projectId)
|
||||
detailLoading.value = true
|
||||
try {
|
||||
currentProfit.value = await ProfitApi.getProjectProfit(row.projectId)
|
||||
} finally {
|
||||
detailLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const refreshCurrentProfit = async () => {
|
||||
if (!currentProfit.value?.projectId) {
|
||||
return
|
||||
}
|
||||
currentProfit.value = await ProfitApi.getProjectProfit(currentProfit.value.projectId)
|
||||
detailLoading.value = true
|
||||
try {
|
||||
currentProfit.value = await ProfitApi.getProjectProfit(currentProfit.value.projectId)
|
||||
} finally {
|
||||
detailLoading.value = false
|
||||
}
|
||||
await getList()
|
||||
}
|
||||
|
||||
const handleLockBudgetSnapshot = async () => {
|
||||
if (!currentProfit.value?.projectId) {
|
||||
return
|
||||
}
|
||||
await message.confirm('确认下达目标责任书并锁定当前项目成本预算测算吗?锁定后不能重复操作。')
|
||||
actionLoading.value = 'budget'
|
||||
try {
|
||||
currentProfit.value = await ProfitApi.lockBudgetSnapshot(currentProfit.value.projectId)
|
||||
message.success('目标责任书已下达')
|
||||
await getList()
|
||||
} finally {
|
||||
actionLoading.value = ''
|
||||
}
|
||||
}
|
||||
|
||||
const handleLockAccountingSnapshot = async () => {
|
||||
if (!currentProfit.value?.projectId) {
|
||||
return
|
||||
}
|
||||
if (!budgetSnapshot.value) {
|
||||
message.warning('请先下达目标责任书,再完成竣工验收')
|
||||
return
|
||||
}
|
||||
await message.confirm('确认竣工验收完成并锁定当前项目成本核算测算吗?锁定后不能重复操作。')
|
||||
actionLoading.value = 'accounting'
|
||||
try {
|
||||
currentProfit.value = await ProfitApi.lockAccountingSnapshot(currentProfit.value.projectId)
|
||||
message.success('竣工验收已完成')
|
||||
await getList()
|
||||
} finally {
|
||||
actionLoading.value = ''
|
||||
}
|
||||
}
|
||||
|
||||
const handleSaveSettlementSnapshot = async () => {
|
||||
if (!currentProfit.value?.projectId || !accountingSnapshot.value) {
|
||||
message.warning('请先完成竣工验收,再维护结算测算')
|
||||
return
|
||||
}
|
||||
await settlementFormRef.value?.validate()
|
||||
actionLoading.value = 'settlement'
|
||||
try {
|
||||
currentProfit.value = await ProfitApi.saveSettlementSnapshot({
|
||||
projectId: currentProfit.value.projectId,
|
||||
assessmentResult: settlementForm.assessmentResult,
|
||||
remark: settlementForm.remark
|
||||
})
|
||||
message.success('结算测算已保存')
|
||||
await getList()
|
||||
} finally {
|
||||
actionLoading.value = ''
|
||||
}
|
||||
}
|
||||
|
||||
const openProfitEditDialog = async () => {
|
||||
if (!currentProfit.value?.projectId) {
|
||||
return
|
||||
@@ -407,19 +749,67 @@ const submitProfitForm = async () => {
|
||||
|
||||
const profitLossClass = (value?: number) => {
|
||||
if ((value || 0) > 0) {
|
||||
return 'text-[var(--el-color-danger)] font-600'
|
||||
return 'text-[var(--el-color-success)] font-600'
|
||||
}
|
||||
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)]'
|
||||
}
|
||||
|
||||
const snapshotActionText = (
|
||||
snapshot?: ProfitApi.ProjectProfitSnapshotVO,
|
||||
emptyText = '当前为实时动态测算值,尚未锁定'
|
||||
) => {
|
||||
if (!snapshot) {
|
||||
return emptyText
|
||||
}
|
||||
const actionName = snapshot.actionUserName || '未知操作人'
|
||||
const actionTime = snapshot.actionTime ? formatDate(snapshot.actionTime as any) : '未知时间'
|
||||
return `${actionName} 于 ${actionTime} 操作`
|
||||
}
|
||||
|
||||
const roundAmount = (value: number) => Math.round((Number(value) || 0) * 100) / 100
|
||||
|
||||
const getAssessmentCoefficient = (assessmentResult?: string) => {
|
||||
if (assessmentResult === '优秀') {
|
||||
return 1.02
|
||||
}
|
||||
if (assessmentResult === '待改进') {
|
||||
return 0.95
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
const formatCoefficientText = (value?: number) => Number(value ?? 1).toFixed(2)
|
||||
|
||||
const syncSettlementForm = () => {
|
||||
if (!currentProfit.value?.projectId) {
|
||||
settlementForm.projectId = 0
|
||||
settlementForm.assessmentResult = '合格'
|
||||
settlementForm.remark = ''
|
||||
return
|
||||
}
|
||||
const snapshot = currentProfit.value.settlementSnapshot
|
||||
settlementForm.projectId = currentProfit.value.projectId
|
||||
settlementForm.assessmentResult = snapshot?.assessmentResult || '合格'
|
||||
settlementForm.remark = snapshot?.remark || ''
|
||||
}
|
||||
|
||||
watch(currentProfit, syncSettlementForm)
|
||||
|
||||
let activatedOnce = false
|
||||
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
|
||||
onActivated(() => {
|
||||
// KeepAlive 首次挂载也会触发 onActivated,跳过首轮避免重复请求列表。
|
||||
if (!activatedOnce) {
|
||||
activatedOnce = true
|
||||
return
|
||||
}
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -132,13 +132,11 @@
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="排序" prop="sortNo">
|
||||
<el-input-number
|
||||
<el-input
|
||||
v-model="formData.sortNo"
|
||||
:min="0"
|
||||
:precision="0"
|
||||
:step="1"
|
||||
maxlength="50"
|
||||
placeholder="请输入排序,如 A-01"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -158,11 +156,7 @@ import { OWNERSHIP_TYPE_OPTIONS } from '@/views/tjt/shared/planning'
|
||||
|
||||
defineOptions({ name: 'TjtPlanningForm' })
|
||||
|
||||
const OWNERSHIP_TYPE_LABELS = ['专业所', '综合所', '专业分包']
|
||||
const ownershipTypeOptions = OWNERSHIP_TYPE_OPTIONS.map((item, index) => ({
|
||||
label: OWNERSHIP_TYPE_LABELS[index] || item.label,
|
||||
value: item.value
|
||||
}))
|
||||
const ownershipTypeOptions = OWNERSHIP_TYPE_OPTIONS
|
||||
|
||||
const { t } = useI18n()
|
||||
const message = useMessage()
|
||||
@@ -178,7 +172,7 @@ const createFormData = (
|
||||
planningAmount?: number
|
||||
): PlanningApi.ProjectPlanningVO => ({
|
||||
projectId: projectId || 0,
|
||||
sortNo: 0,
|
||||
sortNo: '',
|
||||
ownershipType: ownershipTypeOptions[0].value,
|
||||
calculationMethod: '',
|
||||
planningContent: '',
|
||||
@@ -289,7 +283,7 @@ const formRules = reactive<FormRules>({
|
||||
const buildSavePayload = (): PlanningApi.ProjectPlanningSaveVO => ({
|
||||
id: formData.value.id,
|
||||
projectId: formData.value.projectId,
|
||||
sortNo: formData.value.sortNo ?? 0,
|
||||
sortNo: formData.value.sortNo?.trim() || undefined,
|
||||
ownershipType: formData.value.ownershipType,
|
||||
calculationMethod: formData.value.calculationMethod,
|
||||
planningContent: formData.value.planningContent,
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="工程总面积(㎡)" prop="totalConstructionArea">
|
||||
<el-form-item label="建筑面积(㎡)" prop="totalConstructionArea">
|
||||
<el-input-number
|
||||
v-model="formData.totalConstructionArea"
|
||||
:min="0"
|
||||
@@ -49,7 +49,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="工程类别" prop="projectCategory">
|
||||
<el-form-item label="设计类型" prop="projectCategory">
|
||||
<el-select
|
||||
v-model="formData.projectCategory"
|
||||
class="!w-1/1"
|
||||
@@ -80,7 +80,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="合同产值(元)" prop="contractAmount">
|
||||
<el-form-item label="合同总产值(元)" prop="contractAmount">
|
||||
<el-input-number
|
||||
v-model="formData.contractAmount"
|
||||
:min="0"
|
||||
@@ -139,13 +139,13 @@
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="statusReasonLabel" :prop="statusReasonProp">
|
||||
<el-input
|
||||
v-if="formData.projectStatus === '暂停'"
|
||||
v-if="formData.projectStatus === PROJECT_STATUS.paused"
|
||||
v-model="formData.pauseReason"
|
||||
maxlength="255"
|
||||
placeholder="请输入暂停原因"
|
||||
/>
|
||||
<el-input
|
||||
v-else-if="formData.projectStatus === '中止'"
|
||||
v-else-if="formData.projectStatus === PROJECT_STATUS.terminated"
|
||||
v-model="formData.terminateReason"
|
||||
maxlength="255"
|
||||
placeholder="请输入中止原因"
|
||||
@@ -155,13 +155,11 @@
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="排序" prop="sortNo">
|
||||
<el-input-number
|
||||
<el-input
|
||||
v-model="formData.sortNo"
|
||||
:min="0"
|
||||
:precision="0"
|
||||
:step="1"
|
||||
maxlength="50"
|
||||
placeholder="请输入排序,如 A-01"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -276,37 +274,19 @@
|
||||
import type { FormRules } from 'element-plus'
|
||||
import * as EmployeeApi from '@/api/tjt/employee'
|
||||
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' })
|
||||
|
||||
const ROLE_PROJECT_MANAGER = 'project_manager'
|
||||
const ROLE_ENGINEERING_PRINCIPAL = 'engineering_principal'
|
||||
|
||||
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 ROLE_PROJECT_MANAGER = OUTPUT_SPLIT_ROLE.projectManager
|
||||
const ROLE_ENGINEERING_PRINCIPAL = OUTPUT_SPLIT_ROLE.engineeringPrincipal
|
||||
|
||||
const { t } = useI18n()
|
||||
const message = useMessage()
|
||||
@@ -329,7 +309,7 @@ const createRolePerson = (
|
||||
|
||||
const createFormData = (): ProjectApi.ProjectVO => ({
|
||||
projectName: '',
|
||||
sortNo: 0,
|
||||
sortNo: '',
|
||||
contractSignedFlag: true,
|
||||
contractAmount: undefined,
|
||||
totalConstructionArea: undefined,
|
||||
@@ -340,7 +320,7 @@ const createFormData = (): ProjectApi.ProjectVO => ({
|
||||
projectType: '',
|
||||
projectCategory: '',
|
||||
projectStartYear: new Date().getFullYear(),
|
||||
projectStatus: '进行中',
|
||||
projectStatus: PROJECT_STATUS.inProgress,
|
||||
pauseReason: '',
|
||||
terminateReason: '',
|
||||
innovationOutputRate: DEFAULT_INNOVATION_OUTPUT_RATE,
|
||||
@@ -358,7 +338,7 @@ const normalizeFormData = (data: ProjectApi.ProjectVO): ProjectApi.ProjectVO =>
|
||||
...data,
|
||||
projectType: normalizeValue(data.projectType, PROJECT_TYPE_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,
|
||||
otherCost: data.otherCost ?? 0,
|
||||
pauseReason: data.pauseReason || '',
|
||||
@@ -438,20 +418,20 @@ const projectStartYearValue = computed({
|
||||
})
|
||||
|
||||
const statusReasonLabel = computed(() =>
|
||||
formData.value.projectStatus === '中止' ? '中止原因' : '暂停原因'
|
||||
formData.value.projectStatus === PROJECT_STATUS.terminated ? '中止原因' : '暂停原因'
|
||||
)
|
||||
|
||||
const statusReasonProp = computed(() =>
|
||||
formData.value.projectStatus === '中止' ? 'terminateReason' : 'pauseReason'
|
||||
formData.value.projectStatus === PROJECT_STATUS.terminated ? 'terminateReason' : 'pauseReason'
|
||||
)
|
||||
|
||||
watch(
|
||||
() => formData.value.projectStatus,
|
||||
(status) => {
|
||||
if (status !== '暂停') {
|
||||
if (status !== PROJECT_STATUS.paused) {
|
||||
formData.value.pauseReason = ''
|
||||
}
|
||||
if (status !== '中止') {
|
||||
if (status !== PROJECT_STATUS.terminated) {
|
||||
formData.value.terminateReason = ''
|
||||
}
|
||||
}
|
||||
@@ -459,14 +439,14 @@ watch(
|
||||
|
||||
const formRules = reactive<FormRules>({
|
||||
projectName: [{ required: true, message: '项目名称不能为空', trigger: 'blur' }],
|
||||
contractAmount: [{ required: true, message: '合同产值不能为空', trigger: 'blur' }],
|
||||
totalConstructionArea: [{ required: true, message: '工程总面积不能为空', trigger: 'blur' }],
|
||||
contractAmount: [{ required: true, message: '合同总产值不能为空', trigger: 'blur' }],
|
||||
totalConstructionArea: [{ required: true, message: '建筑面积不能为空', trigger: 'blur' }],
|
||||
projectStartYear: [{ required: true, message: '项目开始年度不能为空', trigger: 'change' }],
|
||||
projectStatus: [{ required: true, message: '项目状态不能为空', trigger: 'change' }],
|
||||
pauseReason: [
|
||||
{
|
||||
validator: (_rule, value, callback) => {
|
||||
if (formData.value.projectStatus === '暂停' && !String(value || '').trim()) {
|
||||
if (formData.value.projectStatus === PROJECT_STATUS.paused && !String(value || '').trim()) {
|
||||
callback(new Error('暂停状态必须填写暂停原因'))
|
||||
return
|
||||
}
|
||||
@@ -478,7 +458,7 @@ const formRules = reactive<FormRules>({
|
||||
terminateReason: [
|
||||
{
|
||||
validator: (_rule, value, callback) => {
|
||||
if (formData.value.projectStatus === '中止' && !String(value || '').trim()) {
|
||||
if (formData.value.projectStatus === PROJECT_STATUS.terminated && !String(value || '').trim()) {
|
||||
callback(new Error('中止状态必须填写中止原因'))
|
||||
return
|
||||
}
|
||||
@@ -512,7 +492,7 @@ const emit = defineEmits(['success'])
|
||||
const buildSavePayload = (): ProjectApi.ProjectSaveVO => ({
|
||||
id: formData.value.id,
|
||||
projectName: formData.value.projectName,
|
||||
sortNo: formData.value.sortNo ?? 0,
|
||||
sortNo: formData.value.sortNo?.trim() || undefined,
|
||||
contractSignedFlag: formData.value.contractSignedFlag,
|
||||
contractAmount: formData.value.contractAmount,
|
||||
totalConstructionArea: formData.value.totalConstructionArea,
|
||||
|
||||
@@ -188,7 +188,7 @@
|
||||
<el-descriptions-item label="工程类型">
|
||||
{{ getProjectTypeText(currentProject.projectType) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="工程类别">
|
||||
<el-descriptions-item label="设计类型">
|
||||
{{ getProjectCategoryText(currentProject.projectCategory) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="合同签订日期">
|
||||
@@ -218,10 +218,21 @@
|
||||
>
|
||||
{{ currentProject.terminateReason || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="合同产值(元)">
|
||||
<el-descriptions-item label="合同总产值(元)">
|
||||
{{ formatAmountText(currentProject.contractAmount) }}
|
||||
</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) }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
@@ -353,7 +364,7 @@ const cleanOptionLabels = <T,>(options: Array<{ label: string; value: T }>, labe
|
||||
}))
|
||||
|
||||
const contractSignOptions = cleanOptionLabels(CONTRACT_SIGN_OPTIONS, ['已签约', '未签约'])
|
||||
const ownershipTypeOptions = cleanOptionLabels(OWNERSHIP_TYPE_OPTIONS, ['专业所', '综合所', '专业分包'])
|
||||
const ownershipTypeOptions = OWNERSHIP_TYPE_OPTIONS
|
||||
const projectTypeOptions = cleanOptionLabels(PROJECT_TYPE_OPTIONS, [
|
||||
'建筑工程',
|
||||
'精装工程',
|
||||
@@ -410,6 +421,46 @@ const queryParams = reactive<ProjectApi.ProjectPageReqVO>({
|
||||
const getProjectRowIndex = (index: number) =>
|
||||
((queryParams.pageNo ?? 1) - 1) * (queryParams.pageSize ?? 10) + index + 1
|
||||
|
||||
const toAmountNumber = (value?: number | string | null) => {
|
||||
const numericValue = Number(value ?? 0)
|
||||
return Number.isNaN(numericValue) ? 0 : numericValue
|
||||
}
|
||||
|
||||
const roundAmount = (value: number) => Math.round((Number(value) || 0) * 100) / 100
|
||||
|
||||
const contractAmountValue = computed(() => toAmountNumber(currentProject.value?.contractAmount))
|
||||
|
||||
const planningAmountTotal = computed(() =>
|
||||
roundAmount(
|
||||
planningList.value.reduce((sum, item) => sum + toAmountNumber(item.planningAmount), 0)
|
||||
)
|
||||
)
|
||||
|
||||
const contractBalanceAmount = computed(() =>
|
||||
roundAmount(contractAmountValue.value - planningAmountTotal.value)
|
||||
)
|
||||
|
||||
const contractOverAllocated = computed(() => contractBalanceAmount.value < 0)
|
||||
|
||||
const contractBalanceDisplayAmount = computed(() =>
|
||||
contractOverAllocated.value ? Math.abs(contractBalanceAmount.value) : contractBalanceAmount.value
|
||||
)
|
||||
|
||||
const contractBalanceLabel = computed(() =>
|
||||
contractOverAllocated.value ? '已超出合同总产值(元)' : '剩余未分配合同产值(元)'
|
||||
)
|
||||
|
||||
const contractBalanceClass = computed(() =>
|
||||
contractOverAllocated.value ? 'text-[var(--el-color-danger)] font-600' : 'text-[var(--el-color-success)] font-600'
|
||||
)
|
||||
|
||||
const contractAllocationProgressText = computed(() => {
|
||||
if (contractAmountValue.value <= 0) {
|
||||
return planningAmountTotal.value > 0 ? '合同总产值为 0,无法计算' : '0.00%'
|
||||
}
|
||||
return formatPercentText(planningAmountTotal.value / contractAmountValue.value)
|
||||
})
|
||||
|
||||
const queryProjectStartYearValue = computed({
|
||||
get: () => (queryParams.projectStartYear ? String(queryParams.projectStartYear) : undefined),
|
||||
set: (value?: string) => {
|
||||
@@ -526,11 +577,18 @@ const handlePlanningFormSuccess = async () => {
|
||||
await getPlanningList()
|
||||
}
|
||||
|
||||
let activatedOnce = false
|
||||
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
|
||||
onActivated(() => {
|
||||
// KeepAlive 首次挂载也会触发 onActivated,跳过首轮避免重复请求列表。
|
||||
if (!activatedOnce) {
|
||||
activatedOnce = true
|
||||
return
|
||||
}
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -91,12 +91,12 @@
|
||||
prop="engineeringPrincipalName"
|
||||
/>
|
||||
<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">
|
||||
{{ formatAmountText(scope.row.contractAmount) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="工程总面积(㎡)" width="140">
|
||||
<el-table-column align="center" label="建筑面积(㎡)" width="140">
|
||||
<template #default="scope">
|
||||
{{ formatAreaText(scope.row.totalConstructionArea) }}
|
||||
</template>
|
||||
@@ -111,8 +111,8 @@
|
||||
/>
|
||||
</ContentWrap>
|
||||
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="8">
|
||||
<SplitPane>
|
||||
<template #left>
|
||||
<ContentWrap v-if="currentProject">
|
||||
<div class="mb-16px flex items-center justify-between gap-12px">
|
||||
<div>
|
||||
@@ -140,10 +140,10 @@
|
||||
<el-descriptions-item label="工程负责人">
|
||||
{{ currentProject.engineeringPrincipalName || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="合同产值(元)">
|
||||
<el-descriptions-item label="合同总产值(元)">
|
||||
{{ formatAmountText(currentProject.contractAmount) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="工程总面积(㎡)">
|
||||
<el-descriptions-item label="建筑面积(㎡)">
|
||||
{{ formatAreaText(currentProject.totalConstructionArea) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="开始年度">
|
||||
@@ -161,7 +161,9 @@
|
||||
<el-col :span="8">
|
||||
<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="mt-6px text-18px font-600">{{ formatAmountText(totalPlanningAmount) }}</div>
|
||||
<div class="mt-6px text-18px font-600">{{
|
||||
formatAmountText(totalPlanningAmount)
|
||||
}}</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
@@ -178,9 +180,9 @@
|
||||
<ContentWrap v-else>
|
||||
<el-empty description="请选择项目后查看预算导出范围" />
|
||||
</ContentWrap>
|
||||
</el-col>
|
||||
</template>
|
||||
|
||||
<el-col :span="16">
|
||||
<template #right>
|
||||
<ContentWrap>
|
||||
<div class="mb-12px flex items-center justify-between">
|
||||
<div class="text-14px font-600">
|
||||
@@ -189,8 +191,12 @@
|
||||
<el-button v-if="currentProject" size="small" @click="getPlanningList">刷新</el-button>
|
||||
</div>
|
||||
<el-table v-loading="planningLoading" :data="planningList" border>
|
||||
<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="归属类型" width="100">
|
||||
<template #default="scope">
|
||||
{{ getOwnershipTypeLabel(scope.row.ownershipType) }}
|
||||
@@ -215,8 +221,255 @@
|
||||
<el-table-column align="center" label="排序" prop="sortNo" width="80" />
|
||||
</el-table>
|
||||
</ContentWrap>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
</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">
|
||||
<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 ReportApi from '@/api/tjt/report'
|
||||
import download from '@/utils/download'
|
||||
import SplitPane from '@/views/tjt/shared/SplitPane.vue'
|
||||
import {
|
||||
CONTRACT_SIGN_OPTIONS,
|
||||
formatAmountText,
|
||||
@@ -261,12 +515,15 @@ const currentYear = new Date().getFullYear()
|
||||
|
||||
const loading = ref(false)
|
||||
const planningLoading = ref(false)
|
||||
const budgetPreviewLoading = ref(false)
|
||||
const exportLoading = ref(false)
|
||||
const exportDialogVisible = ref(false)
|
||||
const previewYear = ref<number>()
|
||||
const exportYear = ref<number>()
|
||||
const total = ref(0)
|
||||
const projectList = ref<ProjectApi.ProjectVO[]>([])
|
||||
const planningList = ref<PlanningApi.ProjectPlanningVO[]>([])
|
||||
const budgetPreview = ref<ReportApi.ProjectBudgetPreviewRespVO>()
|
||||
const currentProject = ref<ProjectApi.ProjectVO>()
|
||||
const queryFormRef = ref()
|
||||
const projectTableRef = ref()
|
||||
@@ -280,7 +537,7 @@ const queryParams = reactive<ProjectApi.ProjectPageReqVO>({
|
||||
})
|
||||
|
||||
const getProjectRowIndex = (index: number) =>
|
||||
(queryParams.pageNo - 1) * queryParams.pageSize + index + 1
|
||||
((queryParams.pageNo || 1) - 1) * (queryParams.pageSize || 10) + index + 1
|
||||
|
||||
const queryProjectStartYearValue = computed({
|
||||
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(() =>
|
||||
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)
|
||||
)
|
||||
|
||||
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 () => {
|
||||
loading.value = true
|
||||
try {
|
||||
@@ -312,6 +618,7 @@ const getProjectList = async () => {
|
||||
if (!projectList.value.length) {
|
||||
currentProject.value = undefined
|
||||
planningList.value = []
|
||||
budgetPreview.value = undefined
|
||||
return
|
||||
}
|
||||
const targetProjectId = currentProject.value?.id || projectList.value[0].id
|
||||
@@ -331,12 +638,30 @@ const getPlanningList = async () => {
|
||||
}
|
||||
planningLoading.value = true
|
||||
try {
|
||||
planningList.value = await PlanningApi.getProjectPlanningListByProjectId(currentProject.value.id)
|
||||
planningList.value = await PlanningApi.getProjectPlanningListByProjectId(
|
||||
currentProject.value.id
|
||||
)
|
||||
} finally {
|
||||
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 = () => {
|
||||
queryParams.pageNo = 1
|
||||
getProjectList()
|
||||
@@ -349,7 +674,8 @@ const resetQuery = () => {
|
||||
|
||||
const handleCurrentProjectChange = async (row?: ProjectApi.ProjectVO) => {
|
||||
currentProject.value = row || undefined
|
||||
await getPlanningList()
|
||||
previewYear.value = row?.projectStartYear || currentYear
|
||||
await Promise.all([getPlanningList(), getProjectBudgetPreview()])
|
||||
}
|
||||
|
||||
const handleExportProjectBudget = async () => {
|
||||
@@ -377,18 +703,39 @@ const submitProjectBudgetExport = async () => {
|
||||
projectId: currentProject.value.id,
|
||||
year: exportYear.value
|
||||
})
|
||||
download.excel(data, `${currentProject.value.projectName}_${exportYear.value}_项目考核产值预算表.xlsx`)
|
||||
download.excel(
|
||||
data,
|
||||
`${currentProject.value.projectName}_${exportYear.value}_项目考核产值预算表.xlsx`
|
||||
)
|
||||
exportDialogVisible.value = false
|
||||
} finally {
|
||||
exportLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
let activatedOnce = false
|
||||
|
||||
onMounted(() => {
|
||||
getProjectList()
|
||||
})
|
||||
|
||||
onActivated(() => {
|
||||
// KeepAlive 首次挂载也会触发 onActivated,跳过首轮避免重复请求项目与合约规划列表。
|
||||
if (!activatedOnce) {
|
||||
activatedOnce = true
|
||||
return
|
||||
}
|
||||
getProjectList()
|
||||
})
|
||||
</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>
|
||||
|
||||
495
src/views/tjt/report-project-lead-quarter/index.vue
Normal file
495
src/views/tjt/report-project-lead-quarter/index.vue
Normal 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>
|
||||
@@ -71,245 +71,201 @@
|
||||
/>
|
||||
</ContentWrap>
|
||||
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="8">
|
||||
<ContentWrap>
|
||||
<div class="mb-12px text-14px font-600">
|
||||
{{ currentProject?.projectName || '合约规划列表' }}
|
||||
</div>
|
||||
<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 v-if="currentPlanning && formData">
|
||||
<div class="mb-16px flex items-center justify-between gap-16px">
|
||||
<div>
|
||||
<div class="text-16px font-600">{{ currentPlanning.planningContent }}</div>
|
||||
</div>
|
||||
<div class="flex items-center gap-12px">
|
||||
<el-button
|
||||
v-hasPermi="['tjt:report-project-quarter:export']"
|
||||
:loading="exportQuarterLoading"
|
||||
plain
|
||||
type="success"
|
||||
@click="handleExportProjectQuarter"
|
||||
>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-descriptions :column="2" border title="基础信息">
|
||||
<el-descriptions-item label="项目名称">{{ formData.projectName || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="项目任务包">{{ formData.planningContent || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="工程负责人">
|
||||
{{ getProjectLeadText(formData.projectManagerName, formData.engineeringLeaderName) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="考核产值(元)">
|
||||
{{ formatAmountText(formData.assessmentOutputValue) }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<el-divider content-position="left">项目层结果</el-divider>
|
||||
<el-table :data="projectResultRows" border>
|
||||
<el-table-column align="center" label="类别" min-width="160" 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>
|
||||
<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-radio-button>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
<el-row :gutter="16" class="mb-16px">
|
||||
<el-col v-for="item in annualSummaryCards" :key="item.label" :span="8">
|
||||
<div class="rounded-8px bg-[var(--el-fill-color-light)] px-16px py-12px">
|
||||
<div class="text-12px text-[var(--el-text-color-secondary)]">{{ item.label }}</div>
|
||||
<div class="mt-6px text-18px font-600">{{ formatAmountText(item.amount) }}</div>
|
||||
<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="loadProjectQuarterPreview">
|
||||
刷新
|
||||
</el-button>
|
||||
<el-button
|
||||
v-hasPermi="['tjt:report-project-quarter:export']"
|
||||
:disabled="!selectedYear"
|
||||
:loading="exportLoading"
|
||||
plain
|
||||
type="success"
|
||||
@click="handleExportProjectQuarter"
|
||||
>
|
||||
<Icon class="mr-5px" icon="ep:download" />
|
||||
导出专业间年度表
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-table v-loading="quarterLoading" :data="annualDistributionRows" border>
|
||||
<el-table-column align="center" label="分配年度" min-width="120" prop="distributionYear" />
|
||||
<el-table-column
|
||||
v-for="quarter in QUARTER_OPTIONS"
|
||||
:key="String(quarter.value)"
|
||||
align="center"
|
||||
:label="quarter.label"
|
||||
min-width="150"
|
||||
>
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.quarterAmounts[Number(quarter.value)]) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="年度合计(元)" min-width="160">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.yearTotal) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</ContentWrap>
|
||||
|
||||
<ContentWrap v-else>
|
||||
<el-empty description="请选择合约规划后查看导出预览" />
|
||||
</ContentWrap>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<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="金额单位">万元</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<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>
|
||||
<el-table
|
||||
:data="previewRows"
|
||||
:empty-text="selectedYear ? '暂无专业间年度表预览数据' : '请先选择年度'"
|
||||
:row-class-name="getPreviewRowClassName"
|
||||
border
|
||||
class="project-quarter-preview-table"
|
||||
max-height="620"
|
||||
>
|
||||
<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">
|
||||
<template #default="scope">
|
||||
{{ scope.row.totalRow ? '合计' : 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="本年度项目考核产值(万元)">
|
||||
<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">
|
||||
{{ scope.row.totalRow ? '' : formatNullablePercent(scope.row.projectLeadRatio) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<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">
|
||||
{{ scope.row.totalRow ? '' : formatNullablePercent(scope.row.officeRatio) }}
|
||||
</template>
|
||||
</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>
|
||||
</template>
|
||||
|
||||
<template #footer>
|
||||
<el-button @click="exportDialogVisible = false">取消</el-button>
|
||||
<el-button :loading="currentExportLoading" type="primary" @click="submitExport">
|
||||
确定导出
|
||||
</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
<el-empty v-else-if="!previewLoading" description="请选择项目后查看专业间年度表预览" />
|
||||
</div>
|
||||
</ContentWrap>
|
||||
</template>
|
||||
|
||||
<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 ReportApi from '@/api/tjt/report'
|
||||
import download from '@/utils/download'
|
||||
import {
|
||||
formatAmountText,
|
||||
getOwnershipTypeLabel,
|
||||
OUTPUT_SPLIT_SPECIALTY_OPTIONS,
|
||||
QUARTER_OPTIONS,
|
||||
toPercentValue
|
||||
} from '@/views/tjt/shared/planning'
|
||||
import { formatAmountText, formatPercentText } from '@/views/tjt/shared/planning'
|
||||
|
||||
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 currentYear = new Date().getFullYear()
|
||||
|
||||
const loading = ref(false)
|
||||
const planningLoading = ref(false)
|
||||
const quarterLoading = ref(false)
|
||||
const exportQuarterLoading = ref(false)
|
||||
const exportLeadLoading = ref(false)
|
||||
const exportDialogVisible = ref(false)
|
||||
const exportDialogType = ref<ExportDialogType>('projectQuarter')
|
||||
const exportYear = ref<number>()
|
||||
const previewLoading = ref(false)
|
||||
const exportLoading = ref(false)
|
||||
const selectedYear = ref<number | undefined>(currentYear)
|
||||
const total = ref(0)
|
||||
const projectList = ref<ProjectApi.ProjectVO[]>([])
|
||||
const planningList = ref<PlanningApi.ProjectPlanningVO[]>([])
|
||||
const currentProject = ref<ProjectApi.ProjectVO>()
|
||||
const currentPlanning = ref<PlanningApi.ProjectPlanningVO>()
|
||||
const formData = ref<OutputSplitApi.ProjectOutputSplitVO>()
|
||||
const quarterRows = ref<QuarterYearRow[]>([])
|
||||
const selectedAnnualCategory = ref<AnnualCategoryKey>('project_lead')
|
||||
const previewData = ref<ReportApi.ProjectQuarterOutputPreviewRespVO>()
|
||||
const queryFormRef = ref()
|
||||
const projectTableRef = ref()
|
||||
const planningTableRef = ref()
|
||||
let previewRequestSeq = 0
|
||||
|
||||
const queryParams = reactive<ProjectApi.ProjectPageReqVO>({
|
||||
pageNo: 1,
|
||||
@@ -318,8 +274,25 @@ const queryParams = reactive<ProjectApi.ProjectPageReqVO>({
|
||||
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) =>
|
||||
(queryParams.pageNo - 1) * queryParams.pageSize + index + 1
|
||||
((queryParams.pageNo || 1) - 1) * (queryParams.pageSize || 10) + index + 1
|
||||
|
||||
const queryProjectStartYearValue = computed({
|
||||
get: () => (queryParams.projectStartYear ? String(queryParams.projectStartYear) : undefined),
|
||||
@@ -328,185 +301,32 @@ const queryProjectStartYearValue = computed({
|
||||
}
|
||||
})
|
||||
|
||||
const exportDialogTitle = computed(() =>
|
||||
exportDialogType.value === 'projectQuarter' ? '导出专业间年度季度计取表' : '导出工程负责人计取表'
|
||||
)
|
||||
|
||||
const currentExportLoading = computed(() =>
|
||||
exportDialogType.value === 'projectQuarter'
|
||||
? exportQuarterLoading.value
|
||||
: exportLeadLoading.value
|
||||
)
|
||||
|
||||
const exportYearValue = computed({
|
||||
get: () => (exportYear.value ? String(exportYear.value) : undefined),
|
||||
const selectedYearValue = computed({
|
||||
get: () => (selectedYear.value ? String(selectedYear.value) : undefined),
|
||||
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) =>
|
||||
[projectManagerName, engineeringLeaderName].filter(Boolean).join(' / ') || '-'
|
||||
|
||||
const buildProjectRows = (model?: OutputSplitApi.ProjectOutputSplitVO) => {
|
||||
if (!model) {
|
||||
return []
|
||||
const formatNullableAmount = (value?: number | string | null) => {
|
||||
if (value === undefined || value === null || value === '') {
|
||||
return ''
|
||||
}
|
||||
return [
|
||||
{
|
||||
label: '项目经理/工程负责人',
|
||||
percentText: formatRatioText(model.projectLeadRatio),
|
||||
amount: model.projectLeadAmount
|
||||
},
|
||||
{
|
||||
label: '专业所',
|
||||
percentText: formatRatioText(model.officeRatio),
|
||||
amount: model.officeAmount
|
||||
}
|
||||
]
|
||||
return formatAmountText(value)
|
||||
}
|
||||
|
||||
const buildSpecialtyRows = (model?: OutputSplitApi.ProjectOutputSplitVO) => {
|
||||
if (!model) {
|
||||
return []
|
||||
const formatNullablePercent = (value?: number | string | null) => {
|
||||
if (value === undefined || value === null || value === '') {
|
||||
return ''
|
||||
}
|
||||
const amountMap: Record<string, number | undefined> = {
|
||||
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]
|
||||
}))
|
||||
return formatPercentText(value)
|
||||
}
|
||||
|
||||
const projectResultRows = computed(() => buildProjectRows(formData.value))
|
||||
const specialtyResultRows = computed(() => buildSpecialtyRows(formData.value))
|
||||
|
||||
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 getPreviewRowClassName = ({ row }: { row: ReportApi.ProjectQuarterOutputPreviewRow }) =>
|
||||
row?.totalRow ? 'report-total-row' : row?.placeholderRow ? 'report-placeholder-row' : ''
|
||||
|
||||
const getProjectList = async () => {
|
||||
loading.value = true
|
||||
@@ -516,10 +336,7 @@ const getProjectList = async () => {
|
||||
total.value = data.total
|
||||
if (!projectList.value.length) {
|
||||
currentProject.value = undefined
|
||||
planningList.value = []
|
||||
currentPlanning.value = undefined
|
||||
formData.value = undefined
|
||||
quarterRows.value = []
|
||||
previewData.value = undefined
|
||||
return
|
||||
}
|
||||
const targetProjectId = currentProject.value?.id || projectList.value[0].id
|
||||
@@ -532,50 +349,32 @@ const getProjectList = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const getPlanningList = async () => {
|
||||
if (!currentProject.value?.id) {
|
||||
planningList.value = []
|
||||
currentPlanning.value = undefined
|
||||
formData.value = undefined
|
||||
quarterRows.value = []
|
||||
const loadProjectQuarterPreview = async () => {
|
||||
const projectId = currentProject.value?.id
|
||||
const year = selectedYear.value
|
||||
const requestSeq = ++previewRequestSeq
|
||||
if (!projectId || !year) {
|
||||
previewData.value = undefined
|
||||
previewLoading.value = false
|
||||
return
|
||||
}
|
||||
planningLoading.value = true
|
||||
previewLoading.value = true
|
||||
try {
|
||||
const list = await PlanningApi.getProjectPlanningListByProjectId(currentProject.value.id)
|
||||
planningList.value = list
|
||||
if (!planningList.value.length) {
|
||||
currentPlanning.value = undefined
|
||||
formData.value = undefined
|
||||
quarterRows.value = []
|
||||
return
|
||||
const data = await ReportApi.getProjectQuarterOutputPreview({
|
||||
projectId,
|
||||
year
|
||||
})
|
||||
if (requestSeq === previewRequestSeq) {
|
||||
previewData.value = data
|
||||
}
|
||||
} 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 {
|
||||
planningLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const loadPlanningRelatedData = async (planning: PlanningApi.ProjectPlanningVO) => {
|
||||
if (!planning.id) {
|
||||
return
|
||||
}
|
||||
quarterLoading.value = true
|
||||
try {
|
||||
const [planningDetail, outputSplit, quarterList] = await Promise.all([
|
||||
PlanningApi.getProjectPlanning(planning.id),
|
||||
OutputSplitApi.getProjectOutputSplitByPlanningId(planning.id),
|
||||
PlanningQuarterApi.getProjectPlanningQuarterListByPlanningId(planning.id)
|
||||
])
|
||||
currentPlanning.value = planningDetail
|
||||
formData.value = outputSplit
|
||||
quarterRows.value = buildQuarterRows(planningDetail, quarterList)
|
||||
} finally {
|
||||
quarterLoading.value = false
|
||||
if (requestSeq === previewRequestSeq) {
|
||||
previewLoading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -589,106 +388,68 @@ const resetQuery = () => {
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
const handleCurrentProjectChange = async (row?: ProjectApi.ProjectVO) => {
|
||||
const handleCurrentProjectChange = (row?: ProjectApi.ProjectVO) => {
|
||||
currentProject.value = row || undefined
|
||||
await getPlanningList()
|
||||
}
|
||||
|
||||
const handleCurrentPlanningChange = async (row?: PlanningApi.ProjectPlanningVO) => {
|
||||
currentPlanning.value = row || undefined
|
||||
if (!row?.id) {
|
||||
formData.value = undefined
|
||||
quarterRows.value = []
|
||||
previewData.value = undefined
|
||||
return
|
||||
}
|
||||
await loadPlanningRelatedData(row)
|
||||
selectedYear.value = row.projectStartYear || currentYear
|
||||
previewData.value = undefined
|
||||
}
|
||||
|
||||
const handleExportProjectQuarter = async () => {
|
||||
if (!currentPlanning.value?.id) {
|
||||
message.warning('请先选择合约规划')
|
||||
if (!currentProject.value?.id) {
|
||||
message.warning('请先选择项目')
|
||||
return
|
||||
}
|
||||
exportDialogType.value = 'projectQuarter'
|
||||
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) {
|
||||
if (!selectedYear.value) {
|
||||
message.warning('请选择年度')
|
||||
return
|
||||
}
|
||||
try {
|
||||
await message.exportConfirm()
|
||||
exportQuarterLoading.value = true
|
||||
exportLoading.value = true
|
||||
const data = await ReportApi.exportProjectQuarterOutput({
|
||||
planningId: currentPlanning.value.id,
|
||||
year: exportYear.value
|
||||
projectId: currentProject.value.id,
|
||||
year: selectedYear.value
|
||||
})
|
||||
download.excel(
|
||||
data,
|
||||
`${currentProject.value?.projectName || '项目'}_${exportYear.value}_专业间年度季度计取表.xlsx`
|
||||
)
|
||||
exportDialogVisible.value = false
|
||||
download.excel(data, `${currentProject.value?.projectName || '项目'}_${selectedYear.value}_专业间年度表.xlsx`)
|
||||
} finally {
|
||||
exportQuarterLoading.value = false
|
||||
exportLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const submitProjectLeadQuarterExport = async () => {
|
||||
if (!currentPlanning.value?.id) {
|
||||
message.warning('请先选择合约规划')
|
||||
return
|
||||
watch(
|
||||
[() => currentProject.value?.id, selectedYear],
|
||||
() => {
|
||||
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
|
||||
|
||||
onMounted(() => {
|
||||
getProjectList()
|
||||
})
|
||||
|
||||
onActivated(() => {
|
||||
// KeepAlive 首次挂载也会触发 onActivated,跳过首轮避免重复请求项目列表。
|
||||
if (!activatedOnce) {
|
||||
activatedOnce = true
|
||||
return
|
||||
}
|
||||
getProjectList()
|
||||
})
|
||||
</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>
|
||||
|
||||
@@ -73,8 +73,8 @@
|
||||
/>
|
||||
</ContentWrap>
|
||||
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="8">
|
||||
<SplitPane>
|
||||
<template #left>
|
||||
<ContentWrap>
|
||||
<div class="mb-12px text-14px font-600">
|
||||
{{ currentProject?.projectName || '合约规划列表' }}
|
||||
@@ -86,7 +86,6 @@
|
||||
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">
|
||||
@@ -102,25 +101,40 @@
|
||||
<el-table-column align="center" label="排序" prop="sortNo" width="80" />
|
||||
</el-table>
|
||||
</ContentWrap>
|
||||
</el-col>
|
||||
</template>
|
||||
|
||||
<el-col :span="16">
|
||||
<ContentWrap v-if="currentPlanning && currentGroup">
|
||||
<template #right>
|
||||
<ContentWrap>
|
||||
<div v-loading="previewLoading" class="min-h-320px">
|
||||
<template v-if="currentPlanning && currentGroup">
|
||||
<div class="mb-16px flex items-center justify-between gap-12px">
|
||||
<div>
|
||||
<div class="text-16px font-600">{{ currentPlanning.planningContent }}</div>
|
||||
<div class="mt-6px text-12px text-[var(--el-text-color-secondary)]">
|
||||
按当前合约规划、年度和专业预览专业内人员计取结果
|
||||
</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
|
||||
v-hasPermi="['tjt:report-specialty-person:export']"
|
||||
:disabled="!canExportCurrentGroup || !selectedYear"
|
||||
:loading="exportSpecialtyLoading"
|
||||
plain
|
||||
type="success"
|
||||
@click="handleExportSpecialtyPerson"
|
||||
>
|
||||
<Icon class="mr-5px" icon="ep:download" />
|
||||
导出专业内人员计取表
|
||||
</el-button>
|
||||
</div>
|
||||
<el-button
|
||||
v-hasPermi="['tjt:report-specialty-person:export']"
|
||||
:disabled="!canExportCurrentGroup"
|
||||
:loading="exportSpecialtyLoading"
|
||||
plain
|
||||
type="success"
|
||||
@click="handleExportSpecialtyPerson"
|
||||
>
|
||||
<Icon class="mr-5px" icon="ep:download" />
|
||||
导出专业内人员计取表
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<div class="mb-16px">
|
||||
@@ -140,7 +154,16 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-table :data="currentGroup.rows" border>
|
||||
<div class="mb-10px flex items-center justify-between gap-12px">
|
||||
<div class="text-14px font-600">专业内人员工作量与年度 / 季度计取预览</div>
|
||||
<div class="text-12px text-[var(--el-text-color-secondary)]">季度金额单位:万元</div>
|
||||
</div>
|
||||
<el-table
|
||||
:data="currentGroupDisplayRows"
|
||||
border
|
||||
empty-text="当前年度暂无可预览的专业人员考核产值计取数据"
|
||||
:span-method="spanRoleColumns"
|
||||
>
|
||||
<el-table-column align="center" label="角色" min-width="110" prop="roleName" />
|
||||
<el-table-column align="center" label="角色比例" min-width="120">
|
||||
<template #default="scope">
|
||||
@@ -154,95 +177,121 @@
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="人员合计" min-width="120">
|
||||
<template #default="scope">
|
||||
{{ formatPercentText(getPersonTotalRatio(scope.row)) }}
|
||||
{{ formatPercentText(scope.row.personTotalRatio) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="人员信息" min-width="360">
|
||||
<template #default="scope">
|
||||
<div v-if="scope.row.persons?.length" class="person-display-list">
|
||||
<div
|
||||
v-for="(person, index) in scope.row.persons"
|
||||
:key="`${scope.row.specialtyCode}-${scope.row.roleCode}-display-${index}`"
|
||||
class="person-display-row"
|
||||
>
|
||||
<span class="person-display-name">{{ person.employeeName || '-' }}</span>
|
||||
<span>{{ formatPercentText(person.personRatio) }}</span>
|
||||
<span>{{ formatAmountText(person.personAmount) }} 元</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="person-empty">暂无人员</div>
|
||||
</template>
|
||||
<el-table-column align="center" label="人员明细">
|
||||
<el-table-column align="center" label="人员基本分配">
|
||||
<el-table-column align="center" label="姓名" min-width="110">
|
||||
<template #default="scope">
|
||||
<span class="person-display-name">{{ scope.row.employeeName || '暂无人员' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="工作量比例" min-width="110">
|
||||
<template #default="scope">
|
||||
{{ scope.row.employeeName ? formatPercentText(scope.row.personRatio) : '' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="人员金额(元)" min-width="120">
|
||||
<template #default="scope">
|
||||
{{ scope.row.employeeName ? formatAmountText(scope.row.personAmount) : '' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="占专业比例" min-width="110">
|
||||
<template #default="scope">
|
||||
{{ scope.row.employeeName ? formatPercentText(scope.row.adjustedPersonRatio) : '' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="季度计取明细(合约规划年度预览:比例 / 金额 万元)">
|
||||
<el-table-column align="center" label="一季度" min-width="150">
|
||||
<template #default="scope">
|
||||
{{
|
||||
scope.row.employeeName
|
||||
? formatRatioAmountText(scope.row.quarterOneRatio, scope.row.quarterOneAmountWan)
|
||||
: ''
|
||||
}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="二季度" min-width="150">
|
||||
<template #default="scope">
|
||||
{{
|
||||
scope.row.employeeName
|
||||
? formatRatioAmountText(scope.row.quarterTwoRatio, scope.row.quarterTwoAmountWan)
|
||||
: ''
|
||||
}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="三季度" min-width="150">
|
||||
<template #default="scope">
|
||||
{{
|
||||
scope.row.employeeName
|
||||
? formatRatioAmountText(scope.row.quarterThreeRatio, scope.row.quarterThreeAmountWan)
|
||||
: ''
|
||||
}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="四季度" min-width="150">
|
||||
<template #default="scope">
|
||||
{{
|
||||
scope.row.employeeName
|
||||
? formatRatioAmountText(scope.row.quarterFourRatio, scope.row.quarterFourAmountWan)
|
||||
: ''
|
||||
}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="本年度小计" min-width="170">
|
||||
<template #default="scope">
|
||||
{{
|
||||
scope.row.employeeName
|
||||
? formatRatioAmountText(scope.row.yearTotalRatio, scope.row.yearTotalAmountWan)
|
||||
: ''
|
||||
}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</template>
|
||||
|
||||
<el-empty v-else-if="!previewLoading" description="请选择合约规划后查看导出预览" />
|
||||
</div>
|
||||
</ContentWrap>
|
||||
|
||||
<ContentWrap v-else>
|
||||
<el-empty description="请选择合约规划后查看导出预览" />
|
||||
</ContentWrap>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<Dialog v-model="exportDialogVisible" title="导出专业内人员计取表" 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="exportSpecialtyLoading" type="primary" @click="submitSpecialtyExport">
|
||||
确定导出
|
||||
</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</SplitPane>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import * as PlanningApi from '@/api/tjt/planning'
|
||||
import * as ProjectApi from '@/api/tjt/project'
|
||||
import * as ReportApi from '@/api/tjt/report'
|
||||
import * as SpecialtyRoleSplitApi from '@/api/tjt/specialtyRoleSplit'
|
||||
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' })
|
||||
|
||||
const PROJECT_LEAD_GROUP_CODE = 'project_lead'
|
||||
const EPSILON = 0.0001
|
||||
|
||||
type SpecialtyRoleSplitVO = SpecialtyRoleSplitApi.SpecialtyRoleSplitVO
|
||||
|
||||
interface SpecialtyGroup {
|
||||
specialtyCode: string
|
||||
specialtyName: string
|
||||
specialtyAmount: number
|
||||
rows: SpecialtyRoleSplitVO[]
|
||||
roleTotal: number
|
||||
personCount: number
|
||||
}
|
||||
const PROJECT_LEAD_GROUP_CODE = OUTPUT_SPLIT_SPECIALTY.projectLead
|
||||
|
||||
const message = useMessage()
|
||||
const currentYear = new Date().getFullYear()
|
||||
|
||||
const loading = ref(false)
|
||||
const planningLoading = ref(false)
|
||||
const previewLoading = ref(false)
|
||||
const exportSpecialtyLoading = ref(false)
|
||||
const exportDialogVisible = ref(false)
|
||||
const exportYear = ref<number>()
|
||||
const selectedYear = ref<number | undefined>(currentYear)
|
||||
const total = ref(0)
|
||||
const projectList = ref<ProjectApi.ProjectVO[]>([])
|
||||
const planningList = ref<PlanningApi.ProjectPlanningVO[]>([])
|
||||
const currentProject = ref<ProjectApi.ProjectVO>()
|
||||
const currentPlanning = ref<PlanningApi.ProjectPlanningVO>()
|
||||
const roleList = ref<SpecialtyRoleSplitVO[]>([])
|
||||
const previewData = ref<ReportApi.SpecialtyPersonOutputPreviewRespVO>()
|
||||
const selectedGroupCode = ref('')
|
||||
const queryFormRef = ref()
|
||||
const projectTableRef = ref()
|
||||
@@ -256,7 +305,7 @@ const queryParams = reactive<ProjectApi.ProjectPageReqVO>({
|
||||
})
|
||||
|
||||
const getProjectRowIndex = (index: number) =>
|
||||
(queryParams.pageNo - 1) * queryParams.pageSize + index + 1
|
||||
((queryParams.pageNo || 1) - 1) * (queryParams.pageSize || 10) + index + 1
|
||||
|
||||
const queryProjectStartYearValue = computed({
|
||||
get: () => (queryParams.projectStartYear ? String(queryParams.projectStartYear) : undefined),
|
||||
@@ -265,49 +314,24 @@ const queryProjectStartYearValue = computed({
|
||||
}
|
||||
})
|
||||
|
||||
const exportYearValue = computed({
|
||||
get: () => (exportYear.value ? String(exportYear.value) : undefined),
|
||||
const selectedYearValue = computed({
|
||||
get: () => (selectedYear.value ? String(selectedYear.value) : undefined),
|
||||
set: (value?: string) => {
|
||||
exportYear.value = value ? Number(value) : undefined
|
||||
selectedYear.value = value ? Number(value) : undefined
|
||||
}
|
||||
})
|
||||
|
||||
const roundRatio = (value?: number | string | null) => {
|
||||
const numericValue = Number(value || 0)
|
||||
return Number.isNaN(numericValue) ? 0 : Number(numericValue.toFixed(4))
|
||||
}
|
||||
const formatWanAmountText = (value?: number | string | null) => formatAmountText(value)
|
||||
const formatRatioAmountText = (
|
||||
ratio?: number | string | null,
|
||||
amount?: number | string | null
|
||||
) => `${formatPercentText(ratio)} / ${formatWanAmountText(amount)}`
|
||||
|
||||
const countConfiguredPersons = (persons?: SpecialtyRoleSplitApi.SpecialtyRolePersonVO[]) =>
|
||||
(persons || []).filter(
|
||||
(person) =>
|
||||
(person.employeeName && person.employeeName.trim()) ||
|
||||
(person.personRatio !== undefined && person.personRatio !== null)
|
||||
).length
|
||||
|
||||
const getPersonTotalRatio = (row: SpecialtyRoleSplitVO) =>
|
||||
roundRatio((row.persons || []).reduce((sum, person) => sum + Number(person?.personRatio || 0), 0))
|
||||
|
||||
const buildGroups = (source: SpecialtyRoleSplitVO[]): SpecialtyGroup[] => {
|
||||
const map = new Map<string, SpecialtyRoleSplitVO[]>()
|
||||
source.forEach((item) => {
|
||||
const list = map.get(item.specialtyCode) || []
|
||||
list.push(item)
|
||||
map.set(item.specialtyCode, list)
|
||||
})
|
||||
return Array.from(map.entries()).map(([specialtyCode, rows]) => {
|
||||
const sortedRows = [...rows].sort((a, b) => Number(a.sortNo || 0) - Number(b.sortNo || 0))
|
||||
return {
|
||||
specialtyCode,
|
||||
specialtyName: sortedRows[0]?.specialtyName || specialtyCode,
|
||||
specialtyAmount: Number(Number(sortedRows[0]?.specialtyAmount || 0).toFixed(2)),
|
||||
rows: sortedRows,
|
||||
roleTotal: roundRatio(sortedRows.reduce((sum, item) => sum + Number(item.roleRatio || 0), 0)),
|
||||
personCount: sortedRows.reduce((sum, row) => sum + countConfiguredPersons(row.persons), 0)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const groups = computed(() => buildGroups(roleList.value))
|
||||
const groups = computed(() =>
|
||||
(previewData.value?.groups || []).filter(
|
||||
(item) => item.specialtyCode !== PROJECT_LEAD_GROUP_CODE && item.exportable !== false
|
||||
)
|
||||
)
|
||||
const groupTabOptions = computed(() =>
|
||||
groups.value.map((item) => ({
|
||||
label: item.specialtyName,
|
||||
@@ -318,12 +342,62 @@ const currentGroup = computed(
|
||||
() => groups.value.find((item) => item.specialtyCode === selectedGroupCode.value) || groups.value[0]
|
||||
)
|
||||
const canExportCurrentGroup = computed(
|
||||
() =>
|
||||
!!currentGroup.value?.specialtyCode &&
|
||||
currentGroup.value.specialtyCode !== PROJECT_LEAD_GROUP_CODE
|
||||
() => !!currentGroup.value?.specialtyCode && currentGroup.value.exportable !== false
|
||||
)
|
||||
|
||||
const buildSummaryCards = (group?: SpecialtyGroup) => {
|
||||
type SpecialtyPersonDisplayRow = ReportApi.SpecialtyPersonOutputPreviewPersonRow &
|
||||
Pick<
|
||||
ReportApi.SpecialtyPersonOutputPreviewRoleRow,
|
||||
'specialtyCode' | 'specialtyName' | 'roleCode' | 'roleName' | 'roleRatio' | 'roleAmount' | 'personTotalRatio'
|
||||
> & {
|
||||
roleRowSpan: number
|
||||
}
|
||||
|
||||
const currentGroupDisplayRows = computed(() => {
|
||||
const displayRows: SpecialtyPersonDisplayRow[] = []
|
||||
const rows = currentGroup.value?.rows || []
|
||||
rows.forEach((roleRow) => {
|
||||
if (!roleRow.persons?.length) {
|
||||
displayRows.push({
|
||||
specialtyCode: roleRow.specialtyCode,
|
||||
specialtyName: roleRow.specialtyName,
|
||||
roleCode: roleRow.roleCode,
|
||||
roleName: roleRow.roleName,
|
||||
roleRatio: roleRow.roleRatio,
|
||||
roleAmount: roleRow.roleAmount,
|
||||
personTotalRatio: roleRow.personTotalRatio,
|
||||
personKey: `${roleRow.specialtyCode}-${roleRow.roleCode}-empty`,
|
||||
roleRowSpan: 1
|
||||
})
|
||||
return
|
||||
}
|
||||
roleRow.persons.forEach((person, index) => {
|
||||
displayRows.push({
|
||||
...person,
|
||||
specialtyCode: roleRow.specialtyCode,
|
||||
specialtyName: roleRow.specialtyName,
|
||||
roleCode: roleRow.roleCode,
|
||||
roleName: roleRow.roleName,
|
||||
roleRatio: roleRow.roleRatio,
|
||||
roleAmount: roleRow.roleAmount,
|
||||
personTotalRatio: roleRow.personTotalRatio,
|
||||
roleRowSpan: index === 0 ? roleRow.persons.length : 0
|
||||
})
|
||||
})
|
||||
})
|
||||
return displayRows
|
||||
})
|
||||
|
||||
const spanRoleColumns = ({ row, columnIndex }: { row: SpecialtyPersonDisplayRow; columnIndex: number }) => {
|
||||
if (columnIndex > 3) {
|
||||
return { rowspan: 1, colspan: 1 }
|
||||
}
|
||||
return row.roleRowSpan > 0
|
||||
? { rowspan: row.roleRowSpan, colspan: 1 }
|
||||
: { rowspan: 0, colspan: 0 }
|
||||
}
|
||||
|
||||
const buildSummaryCards = (group?: ReportApi.SpecialtyPersonOutputPreviewGroupRow) => {
|
||||
if (!group) {
|
||||
return []
|
||||
}
|
||||
@@ -331,7 +405,7 @@ const buildSummaryCards = (group?: SpecialtyGroup) => {
|
||||
{ label: '分组金额', value: `${formatAmountText(group.specialtyAmount)} 元` },
|
||||
{ label: '角色合计', value: formatPercentText(group.roleTotal) },
|
||||
{ label: '已配置人数', value: `${group.personCount} 人` },
|
||||
{ label: '超额提醒', value: group.roleTotal > 1 + EPSILON ? '存在' : '无' }
|
||||
{ label: '超额提醒', value: group.overRatio ? '存在' : '无' }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -343,9 +417,8 @@ watch(
|
||||
selectedGroupCode.value = ''
|
||||
return
|
||||
}
|
||||
const preferredCode = codes.find((code) => code !== PROJECT_LEAD_GROUP_CODE) || codes[0]
|
||||
if (!codes.includes(selectedGroupCode.value) || selectedGroupCode.value === PROJECT_LEAD_GROUP_CODE) {
|
||||
selectedGroupCode.value = preferredCode
|
||||
if (!codes.includes(selectedGroupCode.value)) {
|
||||
selectedGroupCode.value = codes[0]
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
@@ -361,7 +434,7 @@ const getProjectList = async () => {
|
||||
currentProject.value = undefined
|
||||
planningList.value = []
|
||||
currentPlanning.value = undefined
|
||||
roleList.value = []
|
||||
previewData.value = undefined
|
||||
return
|
||||
}
|
||||
const targetProjectId = currentProject.value?.id || projectList.value[0].id
|
||||
@@ -378,7 +451,7 @@ const getPlanningList = async () => {
|
||||
if (!currentProject.value?.id) {
|
||||
planningList.value = []
|
||||
currentPlanning.value = undefined
|
||||
roleList.value = []
|
||||
previewData.value = undefined
|
||||
return
|
||||
}
|
||||
planningLoading.value = true
|
||||
@@ -387,7 +460,7 @@ const getPlanningList = async () => {
|
||||
planningList.value = list
|
||||
if (!planningList.value.length) {
|
||||
currentPlanning.value = undefined
|
||||
roleList.value = []
|
||||
previewData.value = undefined
|
||||
return
|
||||
}
|
||||
const targetPlanningId = currentPlanning.value?.id || planningList.value[0].id
|
||||
@@ -400,8 +473,20 @@ const getPlanningList = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const loadRoleList = async (planningId: number) => {
|
||||
roleList.value = await SpecialtyRoleSplitApi.getSpecialtyRoleSplitListByPlanningId(planningId)
|
||||
const loadSpecialtyPersonPreview = async () => {
|
||||
if (!currentPlanning.value?.id || !selectedYear.value) {
|
||||
previewData.value = undefined
|
||||
return
|
||||
}
|
||||
previewLoading.value = true
|
||||
try {
|
||||
previewData.value = await ReportApi.getSpecialtyPersonOutputPreview({
|
||||
planningId: currentPlanning.value.id,
|
||||
year: selectedYear.value
|
||||
})
|
||||
} finally {
|
||||
previewLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleQuery = () => {
|
||||
@@ -422,10 +507,11 @@ const handleCurrentProjectChange = async (row?: ProjectApi.ProjectVO) => {
|
||||
const handleCurrentPlanningChange = async (row?: PlanningApi.ProjectPlanningVO) => {
|
||||
currentPlanning.value = row || undefined
|
||||
if (!row?.id) {
|
||||
roleList.value = []
|
||||
previewData.value = undefined
|
||||
return
|
||||
}
|
||||
await loadRoleList(row.id)
|
||||
selectedYear.value = row.planningStartYear || currentYear
|
||||
previewData.value = undefined
|
||||
}
|
||||
|
||||
const handleExportSpecialtyPerson = async () => {
|
||||
@@ -437,20 +523,7 @@ const handleExportSpecialtyPerson = async () => {
|
||||
message.warning('请选择具体专业后再导出')
|
||||
return
|
||||
}
|
||||
exportYear.value = currentPlanning.value.planningStartYear || currentYear
|
||||
exportDialogVisible.value = true
|
||||
}
|
||||
|
||||
const submitSpecialtyExport = async () => {
|
||||
if (!currentPlanning.value?.id) {
|
||||
message.warning('请先选择合约规划')
|
||||
return
|
||||
}
|
||||
if (!canExportCurrentGroup.value || !currentGroup.value?.specialtyCode) {
|
||||
message.warning('请选择具体专业后再导出')
|
||||
return
|
||||
}
|
||||
if (!exportYear.value) {
|
||||
if (!selectedYear.value) {
|
||||
message.warning('请选择年度')
|
||||
return
|
||||
}
|
||||
@@ -460,47 +533,41 @@ const submitSpecialtyExport = async () => {
|
||||
const data = await ReportApi.exportSpecialtyPersonOutput({
|
||||
planningId: currentPlanning.value.id,
|
||||
specialtyCode: currentGroup.value.specialtyCode,
|
||||
year: exportYear.value
|
||||
year: selectedYear.value
|
||||
})
|
||||
download.excel(
|
||||
data,
|
||||
`${currentProject.value?.projectName || '项目'}_${exportYear.value}_${currentGroup.value.specialtyName || '专业'}内人员年度季度计取表.xlsx`
|
||||
`${currentProject.value?.projectName || '项目'}_${selectedYear.value}_${currentGroup.value.specialtyName || '专业'}内人员年度季度计取表.xlsx`
|
||||
)
|
||||
exportDialogVisible.value = false
|
||||
} finally {
|
||||
exportSpecialtyLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
[() => currentPlanning.value?.id, selectedYear],
|
||||
() => {
|
||||
loadSpecialtyPersonPreview()
|
||||
}
|
||||
)
|
||||
|
||||
let activatedOnce = false
|
||||
|
||||
onMounted(() => {
|
||||
getProjectList()
|
||||
})
|
||||
|
||||
onActivated(() => {
|
||||
// KeepAlive 首次挂载也会触发 onActivated,跳过首轮避免重复请求项目与合约规划列表。
|
||||
if (!activatedOnce) {
|
||||
activatedOnce = true
|
||||
return
|
||||
}
|
||||
getProjectList()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.person-empty {
|
||||
font-size: 12px;
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
|
||||
.person-display-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.person-display-row {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(120px, 1fr) 100px 120px;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.person-display-name {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<el-tabs v-model="activeTab">
|
||||
<el-tab-pane label="员工产值汇总" name="employeeSummary">
|
||||
<el-tab-pane label="员工个人考核产值汇总表" name="employeeSummary">
|
||||
<el-form :inline="true" :model="employeeSummaryForm" label-width="88px">
|
||||
<el-form-item label="年度">
|
||||
<el-date-picker
|
||||
@@ -13,13 +13,11 @@
|
||||
value-format="YYYY"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item>
|
||||
<el-button @click="getEmployeeBudgetList">
|
||||
<el-form-item>
|
||||
<el-button :loading="employeeSummaryPreviewLoading" @click="getEmployeeSummaryPreview">
|
||||
<Icon class="mr-5px" icon="ep:refresh" />
|
||||
刷新预览
|
||||
</el-button>
|
||||
</el-form-item> -->
|
||||
<el-form-item>
|
||||
<el-button
|
||||
v-hasPermi="['tjt:report-summary:export']"
|
||||
:loading="employeeSummaryExportLoading"
|
||||
@@ -34,29 +32,62 @@
|
||||
</el-form>
|
||||
|
||||
<el-table
|
||||
v-loading="employeeBudgetLoading"
|
||||
:data="employeeBudgetList"
|
||||
class="mt-12px"
|
||||
:empty-text="employeeSummaryForm.year ? '暂无年度成本预算数据' : '请先选择年度'"
|
||||
v-loading="employeeSummaryPreviewLoading"
|
||||
:data="employeeSummaryRows"
|
||||
:empty-text="employeeSummaryForm.year ? '暂无员工个人考核产值汇总数据' : '请先选择年度'"
|
||||
:row-class-name="getRowClassName"
|
||||
border
|
||||
class="summary-table"
|
||||
max-height="640"
|
||||
>
|
||||
<el-table-column align="center" label="序号" type="index" width="70" />
|
||||
<el-table-column align="center" label="员工姓名" min-width="160" prop="employeeName" />
|
||||
<el-table-column align="center" label="预计年度" prop="budgetYear" width="120" />
|
||||
<el-table-column align="center" label="预计发生成本" min-width="160">
|
||||
<el-table-column align="center" fixed="left" label="序号" width="70">
|
||||
<template #default="scope">
|
||||
{{ formatAmount(scope.row.expectedCostAmount) }}
|
||||
{{ scope.row.totalRow ? '' : scope.row.serialNo }}
|
||||
</template>
|
||||
</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" label="第一季度" min-width="110">
|
||||
<template #default="scope">{{ formatAmount(scope.row.quarterOneAmount) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="第二季度" min-width="110">
|
||||
<template #default="scope">{{ formatAmount(scope.row.quarterTwoAmount) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="第三季度" min-width="110">
|
||||
<template #default="scope">{{ formatAmount(scope.row.quarterThreeAmount) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="第四季度" min-width="110">
|
||||
<template #default="scope">{{ formatAmount(scope.row.quarterFourAmount) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="年度合计" min-width="110">
|
||||
<template #default="scope">{{ formatAmount(scope.row.annualTotalAmount) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="所长 / BIM 考核产值" min-width="150">
|
||||
<template #default="scope">{{ formatAmount(scope.row.officeLeaderOrBimAmount) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="年度考核产值合计" min-width="150">
|
||||
<template #default="scope">{{ formatAmount(scope.row.totalAssessmentOutputAmount) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="1~12 月份预计发生成本(含预计精神文明奖)"
|
||||
min-width="220"
|
||||
>
|
||||
<template #default="scope">{{ formatAmount(scope.row.expectedCostAmount) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="基本考核产值" min-width="130">
|
||||
<template #default="scope">{{ formatAmount(scope.row.basicAssessmentOutputAmount) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="剩余产值" min-width="120">
|
||||
<template #default="scope">{{ formatAmount(scope.row.remainingOutputAmount) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="预估年底绩效" min-width="130">
|
||||
<template #default="scope">{{ formatAmount(scope.row.estimatedYearEndPerformanceAmount) }}</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<Pagination
|
||||
v-model:limit="employeeBudgetQuery.pageSize"
|
||||
v-model:page="employeeBudgetQuery.pageNo"
|
||||
:total="employeeBudgetTotal"
|
||||
@pagination="getEmployeeBudgetList"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane label="项目产值总览" name="projectOverview">
|
||||
<el-tab-pane label="项目总览表" name="projectOverview">
|
||||
<el-form :inline="true" :model="projectOverviewForm" label-width="88px">
|
||||
<el-form-item label="专业所">
|
||||
<el-select
|
||||
@@ -73,13 +104,21 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item>
|
||||
<el-button @click="getProjectEmployeeList">
|
||||
<el-form-item label="年度">
|
||||
<el-date-picker
|
||||
v-model="projectOverviewYearValue"
|
||||
class="!w-180px"
|
||||
clearable
|
||||
placeholder="请选择年度"
|
||||
type="year"
|
||||
value-format="YYYY"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button :loading="projectOverviewPreviewLoading" @click="getProjectOverviewPreview">
|
||||
<Icon class="mr-5px" icon="ep:refresh" />
|
||||
刷新预览
|
||||
</el-button>
|
||||
</el-form-item> -->
|
||||
<el-form-item>
|
||||
<el-button
|
||||
v-hasPermi="['tjt:report-summary:export']"
|
||||
:loading="projectOverviewExportLoading"
|
||||
@@ -94,22 +133,99 @@
|
||||
</el-form>
|
||||
|
||||
<el-table
|
||||
v-loading="projectEmployeeLoading"
|
||||
:data="projectEmployeeList"
|
||||
class="mt-12px"
|
||||
:empty-text="projectOverviewForm.officeId ? '该专业所下暂无员工' : '请先选择专业所'"
|
||||
v-loading="projectOverviewPreviewLoading"
|
||||
:data="projectOverviewRows"
|
||||
:empty-text="projectOverviewEmptyText"
|
||||
:row-class-name="getRowClassName"
|
||||
border
|
||||
class="summary-table"
|
||||
max-height="640"
|
||||
>
|
||||
<el-table-column align="center" label="序号" type="index" width="70" />
|
||||
<el-table-column align="center" label="员工姓名" min-width="160" prop="employeeName" />
|
||||
<el-table-column align="center" label="性别" prop="gender" width="100" />
|
||||
<el-table-column align="center" label="所属所" min-width="180" prop="officeName" />
|
||||
<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="220"
|
||||
prop="projectName"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="工程进度情况及其它说明"
|
||||
min-width="240"
|
||||
prop="progressText"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="工作阶段"
|
||||
min-width="180"
|
||||
prop="workStage"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column align="center" label="本专业 + 项目总核算总产值" min-width="170">
|
||||
<template #default="scope">{{ formatAmountBlank(scope.row.totalOutputAmountWan) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="往期已发放百分比" min-width="140">
|
||||
<template #default="scope">
|
||||
{{ scope.row.totalRow ? '' : formatPercent(scope.row.historicalIssuedRatio) }}
|
||||
</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 ? '' : formatPercent(scope.row.currentSettlementRatio) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="考核产值" min-width="120">
|
||||
<template #default="scope">
|
||||
{{ formatAmountBlank(scope.row.currentSettlementAmountWan) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="未结算比例" min-width="120">
|
||||
<template #default="scope">
|
||||
{{ scope.row.totalRow ? '' : formatPercent(scope.row.pendingRatio) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-for="employee in projectOverviewEmployeeColumns"
|
||||
:key="employee.employeeId"
|
||||
align="center"
|
||||
:label="employee.employeeName || '-'"
|
||||
>
|
||||
<el-table-column align="center" label="一季度" min-width="100">
|
||||
<template #default="scope">
|
||||
{{ formatAmountBlank(getEmployeeAmount(scope.row, employee.employeeId).quarterOneAmountWan) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="二季度" min-width="100">
|
||||
<template #default="scope">
|
||||
{{ formatAmountBlank(getEmployeeAmount(scope.row, employee.employeeId).quarterTwoAmountWan) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="三季度" min-width="100">
|
||||
<template #default="scope">
|
||||
{{ formatAmountBlank(getEmployeeAmount(scope.row, employee.employeeId).quarterThreeAmountWan) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="四季度" min-width="100">
|
||||
<template #default="scope">
|
||||
{{ formatAmountBlank(getEmployeeAmount(scope.row, employee.employeeId).quarterFourAmountWan) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="本年度小计" min-width="120">
|
||||
<template #default="scope">
|
||||
{{ formatAmountBlank(getEmployeeAmount(scope.row, employee.employeeId).annualTotalAmountWan) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<Pagination
|
||||
v-model:limit="projectEmployeeQuery.pageSize"
|
||||
v-model:page="projectEmployeeQuery.pageNo"
|
||||
:total="projectEmployeeTotal"
|
||||
@pagination="getProjectEmployeeList"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</ContentWrap>
|
||||
@@ -141,14 +257,7 @@
|
||||
<span>{{ currentOfficeName || '-' }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="年度">
|
||||
<el-date-picker
|
||||
v-model="projectOverviewYearValue"
|
||||
class="!w-220px"
|
||||
clearable
|
||||
placeholder="请选择年度"
|
||||
type="year"
|
||||
value-format="YYYY"
|
||||
/>
|
||||
<span>{{ projectOverviewForm.year || '-' }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="导出排序">
|
||||
<el-select
|
||||
@@ -177,8 +286,6 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import * as EmployeeApi from '@/api/tjt/employee'
|
||||
import * as EmployeeYearCostBudgetApi from '@/api/tjt/employeeYearCostBudget'
|
||||
import * as OfficeApi from '@/api/tjt/office'
|
||||
import * as ReportApi from '@/api/tjt/report'
|
||||
import download from '@/utils/download'
|
||||
@@ -192,6 +299,10 @@ type SelectOption = {
|
||||
|
||||
type ExportDialogType = 'employeeSummary' | 'projectOverview'
|
||||
|
||||
type SummaryTableRow = {
|
||||
totalRow?: boolean
|
||||
}
|
||||
|
||||
const PROJECT_OVERVIEW_SORT_OPTIONS: SelectOption[] = [
|
||||
{ label: '产值从高到低', value: 'output_desc' },
|
||||
{ label: '产值从低到高', value: 'output_asc' },
|
||||
@@ -199,9 +310,9 @@ const PROJECT_OVERVIEW_SORT_OPTIONS: SelectOption[] = [
|
||||
]
|
||||
|
||||
const EMPLOYEE_SUMMARY_SORT_OPTIONS: SelectOption[] = [
|
||||
{ label: '年度合计从高到低', value: 'annual_total_desc' },
|
||||
{ label: '年度合计从低到高', value: 'annual_total_asc' },
|
||||
{ label: '员工姓名升序', value: 'name_asc' }
|
||||
{ label: '专业所 + 所内年度合计从高到低', value: 'annual_total_desc' },
|
||||
{ label: '专业所 + 所内年度合计从低到高', value: 'annual_total_asc' },
|
||||
{ label: '专业所 + 所内姓名升序', value: 'name_asc' }
|
||||
]
|
||||
|
||||
const message = useMessage()
|
||||
@@ -211,13 +322,11 @@ const exportDialogVisible = ref(false)
|
||||
const exportDialogType = ref<ExportDialogType>('employeeSummary')
|
||||
const projectOverviewExportLoading = ref(false)
|
||||
const employeeSummaryExportLoading = ref(false)
|
||||
const employeeBudgetLoading = ref(false)
|
||||
const projectEmployeeLoading = ref(false)
|
||||
const employeeSummaryPreviewLoading = ref(false)
|
||||
const projectOverviewPreviewLoading = ref(false)
|
||||
const officeOptions = ref<OfficeApi.OfficeSimpleVO[]>([])
|
||||
const employeeBudgetList = ref<EmployeeYearCostBudgetApi.EmployeeYearCostBudgetVO[]>([])
|
||||
const projectEmployeeList = ref<EmployeeApi.EmployeeVO[]>([])
|
||||
const employeeBudgetTotal = ref(0)
|
||||
const projectEmployeeTotal = ref(0)
|
||||
const employeeSummaryPreview = ref<ReportApi.EmployeeOutputSummaryPreviewRespVO>()
|
||||
const projectOverviewPreview = ref<ReportApi.ProjectOverviewPreviewRespVO>()
|
||||
const currentYear = new Date().getFullYear()
|
||||
|
||||
const projectOverviewForm = reactive<ReportApi.ProjectOverviewExportReqVO>({
|
||||
@@ -234,26 +343,30 @@ const employeeSummaryForm = reactive<ReportApi.EmployeeOutputSummaryExportReqVO>
|
||||
sortType: 'annual_total_desc'
|
||||
})
|
||||
|
||||
const employeeBudgetQuery = reactive<EmployeeYearCostBudgetApi.EmployeeYearCostBudgetPageReqVO>({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
employeeId: undefined,
|
||||
employeeName: undefined,
|
||||
budgetYear: currentYear,
|
||||
enabledFlag: true
|
||||
const employeeSummaryRows = computed<ReportApi.EmployeeOutputSummaryRow[]>(() => {
|
||||
const rows = employeeSummaryPreview.value?.rows || []
|
||||
const totalRow = employeeSummaryPreview.value?.totalRow
|
||||
if (!totalRow) {
|
||||
return rows
|
||||
}
|
||||
return [...rows, { ...totalRow, totalRow: true }]
|
||||
})
|
||||
|
||||
const projectEmployeeQuery = reactive<EmployeeApi.EmployeePageReqVO>({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
employeeName: undefined,
|
||||
officeId: undefined,
|
||||
employeeStatus: undefined,
|
||||
enabledFlag: true
|
||||
const projectOverviewEmployeeColumns = computed(
|
||||
() => projectOverviewPreview.value?.employeeColumns || []
|
||||
)
|
||||
|
||||
const projectOverviewRows = computed<ReportApi.ProjectOverviewProjectRow[]>(() => {
|
||||
const rows = projectOverviewPreview.value?.rows || []
|
||||
const totalRow = projectOverviewPreview.value?.totalRow
|
||||
if (!totalRow) {
|
||||
return rows
|
||||
}
|
||||
return [...rows, { ...totalRow, totalRow: true }]
|
||||
})
|
||||
|
||||
const exportDialogTitle = computed(() =>
|
||||
exportDialogType.value === 'employeeSummary' ? '导出员工产值汇总' : '导出项目产值总览'
|
||||
exportDialogType.value === 'employeeSummary' ? '导出员工个人考核产值汇总表' : '导出项目总览表'
|
||||
)
|
||||
|
||||
const currentExportLoading = computed(() =>
|
||||
@@ -266,6 +379,16 @@ const currentOfficeName = computed(() => {
|
||||
return officeOptions.value.find((item) => item.id === projectOverviewForm.officeId)?.officeName || ''
|
||||
})
|
||||
|
||||
const projectOverviewEmptyText = computed(() => {
|
||||
if (!projectOverviewForm.officeId) {
|
||||
return '请先选择专业所'
|
||||
}
|
||||
if (!projectOverviewForm.year) {
|
||||
return '请先选择年度'
|
||||
}
|
||||
return '暂无项目总览数据'
|
||||
})
|
||||
|
||||
const projectOverviewYearValue = computed({
|
||||
get: () => (projectOverviewForm.year ? String(projectOverviewForm.year) : undefined),
|
||||
set: (value?: string) => {
|
||||
@@ -287,39 +410,61 @@ const formatAmount = (value?: number) => {
|
||||
return Number(value).toFixed(2)
|
||||
}
|
||||
|
||||
const formatAmountBlank = (value?: number) => {
|
||||
if (value === undefined || value === null || Number(value) === 0) {
|
||||
return ''
|
||||
}
|
||||
return Number(value).toFixed(2)
|
||||
}
|
||||
|
||||
const formatPercent = (value?: number) => {
|
||||
if (value === undefined || value === null || Number(value) === 0) {
|
||||
return ''
|
||||
}
|
||||
return `${(Number(value) * 100).toFixed(2)}%`
|
||||
}
|
||||
|
||||
const getEmployeeAmount = (
|
||||
row: ReportApi.ProjectOverviewProjectRow,
|
||||
employeeId?: number
|
||||
): ReportApi.ProjectOverviewEmployeeAmountValue => {
|
||||
if (!employeeId || !row.employeeAmountMap) {
|
||||
return {}
|
||||
}
|
||||
return row.employeeAmountMap[String(employeeId)] || {}
|
||||
}
|
||||
|
||||
const getRowClassName = ({ row }: { row: SummaryTableRow }) => {
|
||||
return row?.totalRow ? 'summary-total-row' : ''
|
||||
}
|
||||
|
||||
const getOfficeList = async () => {
|
||||
officeOptions.value = await OfficeApi.getOfficeSimpleList()
|
||||
}
|
||||
|
||||
const getEmployeeBudgetList = async () => {
|
||||
if (!employeeBudgetQuery.budgetYear) {
|
||||
employeeBudgetList.value = []
|
||||
employeeBudgetTotal.value = 0
|
||||
const getEmployeeSummaryPreview = async () => {
|
||||
if (!employeeSummaryForm.year) {
|
||||
employeeSummaryPreview.value = undefined
|
||||
return
|
||||
}
|
||||
employeeBudgetLoading.value = true
|
||||
employeeSummaryPreviewLoading.value = true
|
||||
try {
|
||||
const data = await EmployeeYearCostBudgetApi.getEmployeeYearCostBudgetPage(employeeBudgetQuery)
|
||||
employeeBudgetList.value = data.list
|
||||
employeeBudgetTotal.value = data.total
|
||||
employeeSummaryPreview.value = await ReportApi.getEmployeeOutputSummaryPreview(employeeSummaryForm)
|
||||
} finally {
|
||||
employeeBudgetLoading.value = false
|
||||
employeeSummaryPreviewLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const getProjectEmployeeList = async () => {
|
||||
if (!projectEmployeeQuery.officeId) {
|
||||
projectEmployeeList.value = []
|
||||
projectEmployeeTotal.value = 0
|
||||
const getProjectOverviewPreview = async () => {
|
||||
if (!projectOverviewForm.officeId || !projectOverviewForm.year) {
|
||||
projectOverviewPreview.value = undefined
|
||||
return
|
||||
}
|
||||
projectEmployeeLoading.value = true
|
||||
projectOverviewPreviewLoading.value = true
|
||||
try {
|
||||
const data = await EmployeeApi.getEmployeePage(projectEmployeeQuery)
|
||||
projectEmployeeList.value = data.list
|
||||
projectEmployeeTotal.value = data.total
|
||||
projectOverviewPreview.value = await ReportApi.getProjectOverviewPreview(projectOverviewForm)
|
||||
} finally {
|
||||
projectEmployeeLoading.value = false
|
||||
projectOverviewPreviewLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,7 +483,8 @@ const openProjectOverviewExportDialog = () => {
|
||||
return
|
||||
}
|
||||
if (!projectOverviewForm.year) {
|
||||
projectOverviewForm.year = currentYear
|
||||
message.warning('请选择年度')
|
||||
return
|
||||
}
|
||||
exportDialogType.value = 'projectOverview'
|
||||
exportDialogVisible.value = true
|
||||
@@ -389,27 +535,56 @@ const handleExportEmployeeSummary = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const refreshCurrentPreview = () => {
|
||||
if (activeTab.value === 'projectOverview') {
|
||||
getProjectOverviewPreview()
|
||||
return
|
||||
}
|
||||
getEmployeeSummaryPreview()
|
||||
}
|
||||
|
||||
watch(
|
||||
() => employeeSummaryForm.year,
|
||||
(year) => {
|
||||
employeeBudgetQuery.pageNo = 1
|
||||
employeeBudgetQuery.budgetYear = year
|
||||
getEmployeeBudgetList()
|
||||
() => [employeeSummaryForm.year, employeeSummaryForm.sortType],
|
||||
() => {
|
||||
getEmployeeSummaryPreview()
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
watch(
|
||||
() => projectOverviewForm.officeId,
|
||||
(officeId) => {
|
||||
projectEmployeeQuery.pageNo = 1
|
||||
projectEmployeeQuery.officeId = officeId
|
||||
getProjectEmployeeList()
|
||||
() => [projectOverviewForm.officeId, projectOverviewForm.year, projectOverviewForm.sortType],
|
||||
() => {
|
||||
getProjectOverviewPreview()
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
watch(
|
||||
() => activeTab.value,
|
||||
() => {
|
||||
refreshCurrentPreview()
|
||||
}
|
||||
)
|
||||
|
||||
let activatedOnce = false
|
||||
|
||||
onActivated(() => {
|
||||
// immediate watch 已经负责首次预览加载,跳过 KeepAlive 首轮激活避免重复请求。
|
||||
if (!activatedOnce) {
|
||||
activatedOnce = true
|
||||
return
|
||||
}
|
||||
refreshCurrentPreview()
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
await getOfficeList()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.summary-table :deep(.summary-total-row) {
|
||||
background: var(--el-fill-color-light);
|
||||
font-weight: 700;
|
||||
}
|
||||
</style>
|
||||
|
||||
156
src/views/tjt/shared/PlanningOwnershipSummary.vue
Normal file
156
src/views/tjt/shared/PlanningOwnershipSummary.vue
Normal 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>
|
||||
194
src/views/tjt/shared/SplitPane.vue
Normal file
194
src/views/tjt/shared/SplitPane.vue
Normal 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>
|
||||
@@ -4,34 +4,75 @@ export type Option<T = string> = {
|
||||
}
|
||||
|
||||
export const OWNERSHIP_TYPE = {
|
||||
major: '专业所',
|
||||
comprehensive: '综合所',
|
||||
subcontract: '专业分包'
|
||||
major: 'major',
|
||||
comprehensive: 'comprehensive',
|
||||
specialSubcontract: 'special_subcontract_major',
|
||||
sourceCoopSubcontract: 'special_subcontract_source_coop',
|
||||
comprehensiveSubcontract: 'special_subcontract_comprehensive'
|
||||
} 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 = {
|
||||
guidancePrice: '指导价法',
|
||||
contractPrice: '合同价法',
|
||||
virtualOutput: '虚拟产值法'
|
||||
guidancePrice: 'guidance_price',
|
||||
contractPrice: 'contract_price',
|
||||
virtualOutput: 'virtual_output'
|
||||
} 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 = {
|
||||
guidancePrice: '指导单价法',
|
||||
guidanceTotalPrice: '指导总价法',
|
||||
workingDay: '工日法'
|
||||
guidancePrice: 'guidance_price',
|
||||
guidanceTotalPrice: 'guidance_total_price',
|
||||
workingDay: 'working_day'
|
||||
} 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 = {
|
||||
scheme: '方案',
|
||||
constructionDrawing: '施工图',
|
||||
schemeAndConstructionDrawing: '方案+施工图'
|
||||
scheme: 'scheme',
|
||||
constructionDrawing: 'construction_drawing',
|
||||
schemeAndConstructionDrawing: 'scheme_and_construction_drawing'
|
||||
} 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 = {
|
||||
realEstate: '地上部分',
|
||||
underground: '地下部分'
|
||||
realEstate: 'above_ground',
|
||||
underground: 'underground',
|
||||
other: 'other'
|
||||
} 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 = {
|
||||
building: '建筑工程',
|
||||
decoration: '精装工程',
|
||||
@@ -50,12 +91,19 @@ export const PROJECT_CATEGORY = {
|
||||
} as const
|
||||
|
||||
export const PROJECT_STATUS = {
|
||||
inProgress: '进行中',
|
||||
completed: '完成',
|
||||
paused: '暂停',
|
||||
terminated: '中止'
|
||||
inProgress: 'in_progress',
|
||||
completed: 'completed',
|
||||
paused: 'paused',
|
||||
terminated: 'terminated'
|
||||
} 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 = {
|
||||
male: '男',
|
||||
female: '女'
|
||||
@@ -98,41 +146,68 @@ export const normalizeProjectStatus = (value?: string) =>
|
||||
normalizeValue(value, Object.values(PROJECT_STATUS))
|
||||
|
||||
export const OWNERSHIP_TYPE_OPTIONS: Option[] = [
|
||||
{ label: OWNERSHIP_TYPE.major, value: OWNERSHIP_TYPE.major },
|
||||
{ label: OWNERSHIP_TYPE.comprehensive, value: OWNERSHIP_TYPE.comprehensive },
|
||||
{ label: OWNERSHIP_TYPE.subcontract, value: OWNERSHIP_TYPE.subcontract }
|
||||
{ label: OWNERSHIP_TYPE_LABEL[OWNERSHIP_TYPE.major], value: OWNERSHIP_TYPE.major },
|
||||
{ label: OWNERSHIP_TYPE_LABEL[OWNERSHIP_TYPE.comprehensive], value: OWNERSHIP_TYPE.comprehensive },
|
||||
{
|
||||
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[] = [
|
||||
{ label: CALCULATION_METHOD.guidancePrice, value: CALCULATION_METHOD.guidancePrice },
|
||||
{ label: CALCULATION_METHOD.contractPrice, value: CALCULATION_METHOD.contractPrice },
|
||||
{ label: CALCULATION_METHOD.virtualOutput, value: CALCULATION_METHOD.virtualOutput }
|
||||
{
|
||||
label: CALCULATION_METHOD_LABEL[CALCULATION_METHOD.guidancePrice],
|
||||
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[] = [
|
||||
{
|
||||
label: VIRTUAL_CALCULATION_METHOD.guidancePrice,
|
||||
label: VIRTUAL_CALCULATION_METHOD_LABEL[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
|
||||
},
|
||||
{ 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[] = [
|
||||
{ label: DESIGN_STAGE.scheme, value: DESIGN_STAGE.scheme },
|
||||
{ label: DESIGN_STAGE.constructionDrawing, value: DESIGN_STAGE.constructionDrawing },
|
||||
{ label: DESIGN_STAGE_LABEL[DESIGN_STAGE.scheme], value: DESIGN_STAGE.scheme },
|
||||
{
|
||||
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
|
||||
}
|
||||
]
|
||||
|
||||
export const DESIGN_PART_OPTIONS: Option[] = [
|
||||
{ label: DESIGN_PART.realEstate, value: DESIGN_PART.realEstate },
|
||||
{ label: DESIGN_PART.underground, value: DESIGN_PART.underground }
|
||||
{ label: DESIGN_PART_LABEL[DESIGN_PART.realEstate], value: DESIGN_PART.realEstate },
|
||||
{ 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>[] = [
|
||||
@@ -158,10 +233,10 @@ export const PROJECT_CATEGORY_OPTIONS: Option[] = [
|
||||
]
|
||||
|
||||
export const PROJECT_STATUS_OPTIONS: Option[] = [
|
||||
{ label: PROJECT_STATUS.inProgress, value: PROJECT_STATUS.inProgress },
|
||||
{ label: PROJECT_STATUS.completed, value: PROJECT_STATUS.completed },
|
||||
{ label: PROJECT_STATUS.paused, value: PROJECT_STATUS.paused },
|
||||
{ label: PROJECT_STATUS.terminated, value: PROJECT_STATUS.terminated }
|
||||
{ label: PROJECT_STATUS_LABEL[PROJECT_STATUS.inProgress], value: PROJECT_STATUS.inProgress },
|
||||
{ label: PROJECT_STATUS_LABEL[PROJECT_STATUS.completed], value: PROJECT_STATUS.completed },
|
||||
{ label: PROJECT_STATUS_LABEL[PROJECT_STATUS.paused], value: PROJECT_STATUS.paused },
|
||||
{ label: PROJECT_STATUS_LABEL[PROJECT_STATUS.terminated], value: PROJECT_STATUS.terminated }
|
||||
]
|
||||
|
||||
export const EMPLOYEE_GENDER_OPTIONS: Option[] = [
|
||||
@@ -199,30 +274,59 @@ export const QUARTER_OPTIONS: Option<number>[] = [
|
||||
{ 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[] = [
|
||||
{ label: '建筑', value: 'arch' },
|
||||
{ label: '装饰', value: 'decor' },
|
||||
{ label: '结构', value: 'struct' },
|
||||
{ label: '给排水', value: 'water' },
|
||||
{ label: '电气', value: 'elec' },
|
||||
{ label: '暖通', value: 'hvac' },
|
||||
{ label: '数字化设计', value: 'digital' }
|
||||
{ label: '建筑', value: OUTPUT_SPLIT_SPECIALTY.arch },
|
||||
{ label: '装饰', value: OUTPUT_SPLIT_SPECIALTY.decor },
|
||||
{ label: '结构', value: OUTPUT_SPLIT_SPECIALTY.struct },
|
||||
{ label: '给排水', value: OUTPUT_SPLIT_SPECIALTY.water },
|
||||
{ label: '电气', value: OUTPUT_SPLIT_SPECIALTY.elec },
|
||||
{ label: '暖通', value: OUTPUT_SPLIT_SPECIALTY.hvac },
|
||||
{ label: '数字化设计', value: OUTPUT_SPLIT_SPECIALTY.digital }
|
||||
]
|
||||
|
||||
export const SPECIALTY_ROLE_OPTIONS: Option[] = [
|
||||
{ label: '专业负责人', value: 'director' },
|
||||
{ label: '校对', value: 'check' },
|
||||
{ label: '审核', value: 'review' },
|
||||
{ label: '审定', value: 'approve' },
|
||||
{ label: '设计', value: 'design' }
|
||||
{ label: '专业负责人', value: OUTPUT_SPLIT_ROLE.director },
|
||||
{ label: '校对', value: OUTPUT_SPLIT_ROLE.check },
|
||||
{ label: '审核', value: OUTPUT_SPLIT_ROLE.review },
|
||||
{ label: '审定', value: OUTPUT_SPLIT_ROLE.approve },
|
||||
{ label: '设计', value: OUTPUT_SPLIT_ROLE.design }
|
||||
]
|
||||
|
||||
export const isMajorOwnership = (value?: string) =>
|
||||
normalizeOwnershipType(value) === OWNERSHIP_TYPE.major
|
||||
export const isComprehensiveOwnership = (value?: string) =>
|
||||
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) =>
|
||||
normalizeOwnershipType(value) === OWNERSHIP_TYPE.subcontract
|
||||
isSpecialSubcontractOwnership(value) ||
|
||||
isSourceCoopSubcontractOwnership(value) ||
|
||||
isComprehensiveSubcontractOwnership(value)
|
||||
|
||||
export const isGuidancePriceMethod = (value?: string) =>
|
||||
normalizeCalculationMethod(value) === CALCULATION_METHOD.guidancePrice
|
||||
|
||||
@@ -73,8 +73,8 @@
|
||||
/>
|
||||
</ContentWrap>
|
||||
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="8">
|
||||
<SplitPane>
|
||||
<template #left>
|
||||
<ContentWrap>
|
||||
<div class="mb-12px text-14px font-600">
|
||||
{{ currentProject?.projectName || '合约规划列表' }}
|
||||
@@ -86,7 +86,6 @@
|
||||
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">
|
||||
@@ -101,14 +100,32 @@
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="排序" prop="sortNo" width="80" />
|
||||
</el-table>
|
||||
<PlanningOwnershipSummary
|
||||
:planning-list="planningList"
|
||||
amount-field="assessmentOutputValue"
|
||||
amount-label="考核产值(元)"
|
||||
title="归属类型考核产值合计"
|
||||
/>
|
||||
</ContentWrap>
|
||||
</el-col>
|
||||
</template>
|
||||
|
||||
<el-col :span="16">
|
||||
<ContentWrap v-if="currentPlanning && currentGroup">
|
||||
<template #right>
|
||||
<ContentWrap>
|
||||
<div v-loading="roleLoading" class="min-h-320px">
|
||||
<template v-if="currentPlanning && currentGroup">
|
||||
<div class="mb-16px flex items-center justify-between gap-12px">
|
||||
<div class="text-16px font-600">{{ currentPlanning.planningContent }}</div>
|
||||
<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
|
||||
v-hasPermi="['tjt:specialty-role-split:update']"
|
||||
plain
|
||||
@@ -172,13 +189,13 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</ContentWrap>
|
||||
</template>
|
||||
|
||||
<ContentWrap v-else>
|
||||
<el-empty description="请选择合约规划后查看人员分配" />
|
||||
<el-empty v-else-if="!roleLoading" description="请选择合约规划后查看人员分配" />
|
||||
</div>
|
||||
</ContentWrap>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
</SplitPane>
|
||||
|
||||
<Dialog v-model="dialogVisible" title="编辑专业人员角色分配" width="1180">
|
||||
<template v-if="currentEditGroup">
|
||||
@@ -306,10 +323,36 @@
|
||||
</template>
|
||||
|
||||
<template #footer>
|
||||
<el-button :loading="saveLoading" type="primary" @click="handleSave">保存</el-button>
|
||||
<el-button :loading="saveLoading" @click="handleTemporarySave">临时保存</el-button>
|
||||
<el-button :loading="saveLoading" type="primary" @click="handleSave">校验保存</el-button>
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
</template>
|
||||
</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>
|
||||
|
||||
<script lang="ts" setup>
|
||||
@@ -317,20 +360,24 @@ import * as EmployeeApi from '@/api/tjt/employee'
|
||||
import * as ProjectApi from '@/api/tjt/project'
|
||||
import * as PlanningApi from '@/api/tjt/planning'
|
||||
import * as SpecialtyRoleSplitApi from '@/api/tjt/specialtyRoleSplit'
|
||||
import PlanningOwnershipSummary from '@/views/tjt/shared/PlanningOwnershipSummary.vue'
|
||||
import SplitPane from '@/views/tjt/shared/SplitPane.vue'
|
||||
import {
|
||||
formatAmountText,
|
||||
formatPercentText,
|
||||
fromPercentValue,
|
||||
getOwnershipTypeLabel,
|
||||
OUTPUT_SPLIT_ROLE,
|
||||
OUTPUT_SPLIT_SPECIALTY,
|
||||
toPercentValue
|
||||
} from '@/views/tjt/shared/planning'
|
||||
|
||||
defineOptions({ name: 'TjtStaffAssignment' })
|
||||
|
||||
const DESIGN_ROLE_CODE = 'design'
|
||||
const PROJECT_LEAD_GROUP_CODE = 'project_lead'
|
||||
const ROLE_PROJECT_MANAGER = 'project_manager'
|
||||
const ROLE_ENGINEERING_PRINCIPAL = 'engineering_principal'
|
||||
const DESIGN_ROLE_CODE = OUTPUT_SPLIT_ROLE.design
|
||||
const PROJECT_LEAD_GROUP_CODE = OUTPUT_SPLIT_SPECIALTY.projectLead
|
||||
const ROLE_PROJECT_MANAGER = OUTPUT_SPLIT_ROLE.projectManager
|
||||
const ROLE_ENGINEERING_PRINCIPAL = OUTPUT_SPLIT_ROLE.engineeringPrincipal
|
||||
const EPSILON = 0.0001
|
||||
|
||||
type SpecialtyRolePersonVO = SpecialtyRoleSplitApi.SpecialtyRolePersonVO
|
||||
@@ -349,7 +396,9 @@ const message = useMessage()
|
||||
|
||||
const loading = ref(false)
|
||||
const planningLoading = ref(false)
|
||||
const roleLoading = ref(false)
|
||||
const saveLoading = ref(false)
|
||||
const copyLoading = ref(false)
|
||||
const total = ref(0)
|
||||
const projectList = ref<ProjectApi.ProjectVO[]>([])
|
||||
const planningList = ref<PlanningApi.ProjectPlanningVO[]>([])
|
||||
@@ -360,6 +409,8 @@ const editRoleList = ref<SpecialtyRoleSplitVO[]>([])
|
||||
const selectedGroupCode = ref('')
|
||||
const editGroupCode = ref('')
|
||||
const dialogVisible = ref(false)
|
||||
const copyDialogVisible = ref(false)
|
||||
const copySourcePlanningId = ref<number>()
|
||||
const employeeOptions = ref<EmployeeApi.EmployeeSimpleVO[]>([])
|
||||
const employeeLoading = ref(false)
|
||||
const queryFormRef = ref()
|
||||
@@ -374,7 +425,7 @@ const queryParams = reactive<ProjectApi.ProjectPageReqVO>({
|
||||
})
|
||||
|
||||
const getProjectRowIndex = (index: number) =>
|
||||
(queryParams.pageNo - 1) * queryParams.pageSize + index + 1
|
||||
(Number(queryParams.pageNo || 1) - 1) * Number(queryParams.pageSize || 10) + index + 1
|
||||
|
||||
const queryProjectStartYearValue = computed({
|
||||
get: () => (queryParams.projectStartYear ? String(queryParams.projectStartYear) : undefined),
|
||||
@@ -541,6 +592,12 @@ const currentEditGroup = computed(
|
||||
() =>
|
||||
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 isEngineeringPrincipalRole = (row?: SpecialtyRoleSplitVO) =>
|
||||
row?.roleCode === ROLE_ENGINEERING_PRINCIPAL
|
||||
@@ -681,7 +738,8 @@ const updateRoleRatio = (row: SpecialtyRoleSplitVO, value?: number) => {
|
||||
}
|
||||
|
||||
const buildSavePersons = (
|
||||
row: SpecialtyRoleSplitVO
|
||||
row: SpecialtyRoleSplitVO,
|
||||
validate: boolean
|
||||
):
|
||||
| { persons: SpecialtyRolePersonVO[]; error?: never }
|
||||
| { persons?: never; error: string } => {
|
||||
@@ -693,35 +751,39 @@ const buildSavePersons = (
|
||||
if (!hasEmployeeId && !hasRatio) {
|
||||
continue
|
||||
}
|
||||
if (!hasEmployeeId || !hasRatio) {
|
||||
if (!validate && !hasEmployeeId) {
|
||||
continue
|
||||
}
|
||||
if (validate && (!hasEmployeeId || !hasRatio)) {
|
||||
return { error: `${row.roleName} 的员工和比例必须同时填写` }
|
||||
}
|
||||
persons.push({
|
||||
employeeId: person.employeeId,
|
||||
employeeName: employeeName || undefined,
|
||||
personRatio: roundRatio(person.personRatio)
|
||||
personRatio: roundRatio(hasRatio ? person.personRatio : 0)
|
||||
})
|
||||
}
|
||||
return { persons }
|
||||
}
|
||||
|
||||
const validateAndBuildSaveItems = () => {
|
||||
const buildSaveItems = (validate: boolean, sourceGroups = editGroups.value) => {
|
||||
const items: SpecialtyRoleSplitApi.SpecialtyRoleSplitSaveItemVO[] = []
|
||||
for (const group of editGroups.value) {
|
||||
for (const group of sourceGroups) {
|
||||
let roleTotal = 0
|
||||
for (const row of group.rows) {
|
||||
const result = buildSavePersons(row)
|
||||
const result = buildSavePersons(row, validate)
|
||||
if (result.error) {
|
||||
message.warning(result.error)
|
||||
return undefined
|
||||
}
|
||||
const persons = result.persons || []
|
||||
const personTotalRatio = sumPersonRatios(persons)
|
||||
if (personTotalRatio > 1 + EPSILON) {
|
||||
if (validate && personTotalRatio > 1 + EPSILON) {
|
||||
message.warning(`${group.specialtyName}-${row.roleName} 的人员比例合计不能大于 100%`)
|
||||
return undefined
|
||||
}
|
||||
if (
|
||||
validate &&
|
||||
row.roleCode === DESIGN_ROLE_CODE &&
|
||||
Number(row.roleAmount || 0) > EPSILON &&
|
||||
persons.length === 0
|
||||
@@ -737,7 +799,7 @@ const validateAndBuildSaveItems = () => {
|
||||
persons: isProjectLeadRow(row) ? [] : persons
|
||||
})
|
||||
}
|
||||
if (Math.abs(roleTotal - 1) > EPSILON) {
|
||||
if (validate && Math.abs(roleTotal - 1) > EPSILON) {
|
||||
message.warning(`${group.specialtyName} 的角色比例合计必须等于 100%`)
|
||||
return undefined
|
||||
}
|
||||
@@ -798,10 +860,15 @@ const getPlanningList = async () => {
|
||||
}
|
||||
|
||||
const loadRoleList = async (planningId: number) => {
|
||||
const data = await SpecialtyRoleSplitApi.getSpecialtyRoleSplitListByPlanningId(planningId)
|
||||
roleList.value = cloneRoleRows(data)
|
||||
roleList.value.forEach((row) => syncRoleRatiosForGroup(roleList.value, row.specialtyCode))
|
||||
syncAllDerivedValues(roleList.value)
|
||||
roleLoading.value = true
|
||||
try {
|
||||
const data = await SpecialtyRoleSplitApi.getSpecialtyRoleSplitListByPlanningId(planningId)
|
||||
roleList.value = cloneRoleRows(data)
|
||||
roleList.value.forEach((row) => syncRoleRatiosForGroup(roleList.value, row.specialtyCode))
|
||||
syncAllDerivedValues(roleList.value)
|
||||
} finally {
|
||||
roleLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleQuery = () => {
|
||||
@@ -841,11 +908,88 @@ const openEditDialog = () => {
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
const handleSave = async () => {
|
||||
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
|
||||
}
|
||||
const items = validateAndBuildSaveItems()
|
||||
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) => {
|
||||
if (!currentPlanning.value?.id) {
|
||||
return
|
||||
}
|
||||
const items = buildSaveItems(!temporarySave)
|
||||
if (!items) {
|
||||
return
|
||||
}
|
||||
@@ -853,21 +997,35 @@ const handleSave = async () => {
|
||||
try {
|
||||
await SpecialtyRoleSplitApi.saveSpecialtyRoleSplitBatch({
|
||||
planningId: currentPlanning.value.id,
|
||||
items
|
||||
items,
|
||||
temporarySave
|
||||
})
|
||||
message.success('保存成功')
|
||||
dialogVisible.value = false
|
||||
message.success(temporarySave ? '临时保存成功' : '保存成功')
|
||||
if (!temporarySave) {
|
||||
dialogVisible.value = false
|
||||
}
|
||||
await loadRoleList(currentPlanning.value.id)
|
||||
} finally {
|
||||
saveLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleTemporarySave = () => saveRoleSplit(true)
|
||||
|
||||
const handleSave = () => saveRoleSplit(false)
|
||||
|
||||
let activatedOnce = false
|
||||
|
||||
onMounted(() => {
|
||||
getProjectList()
|
||||
})
|
||||
|
||||
onActivated(() => {
|
||||
// KeepAlive 首次挂载也会触发 onActivated,跳过首轮避免重复请求项目与合约规划列表。
|
||||
if (!activatedOnce) {
|
||||
activatedOnce = true
|
||||
return
|
||||
}
|
||||
getProjectList()
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column align="center" label="ID" prop="id" width="88" />
|
||||
<el-table-column :index="getRowIndex" align="center" label="序号" type="index" width="88" />
|
||||
<el-table-column align="center" label="年度" prop="kYear" width="120" />
|
||||
<el-table-column align="center" label="K值" width="120">
|
||||
<template #default="scope">
|
||||
@@ -67,7 +67,13 @@
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="创建时间" prop="createTime" width="180" />
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="创建时间"
|
||||
prop="createTime"
|
||||
width="180"
|
||||
:formatter="dateFormatter"
|
||||
/>
|
||||
<el-table-column align="center" fixed="right" label="操作" width="160">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
@@ -144,6 +150,7 @@
|
||||
<script lang="ts" setup>
|
||||
import type { FormRules } from 'element-plus'
|
||||
import * as YearKValueApi from '@/api/tjt/yearKValue'
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import { formatPercentText, fromPercentValue, toPercentValue } from '@/views/tjt/shared/planning'
|
||||
|
||||
defineOptions({ name: 'TjtYearKValue' })
|
||||
@@ -168,6 +175,9 @@ const queryParams = reactive<YearKValueApi.YearKValuePageReqVO>({
|
||||
enabledFlag: undefined
|
||||
})
|
||||
|
||||
const getRowIndex = (index: number) =>
|
||||
(queryParams.pageNo - 1) * queryParams.pageSize + index + 1
|
||||
|
||||
const createFormData = (): YearKValueApi.YearKValueVO => ({
|
||||
kYear: new Date().getFullYear(),
|
||||
kValue: 0.4,
|
||||
@@ -289,11 +299,18 @@ const handleDelete = async (id: number) => {
|
||||
} catch {}
|
||||
}
|
||||
|
||||
let activatedOnce = false
|
||||
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
|
||||
onActivated(() => {
|
||||
// KeepAlive 首次挂载也会触发 onActivated,跳过首轮避免重复请求列表。
|
||||
if (!activatedOnce) {
|
||||
activatedOnce = true
|
||||
return
|
||||
}
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user