Compare commits
21 Commits
8f9205a6a1
...
master-lzm
| Author | SHA1 | Date | |
|---|---|---|---|
| 4048454ff5 | |||
| 81d259b44a | |||
| bacc2f739f | |||
| 0150d1bf9a | |||
| 0e8dcb1f71 | |||
| 47f48aa09f | |||
| 8bbb03bae7 | |||
| 761112715d | |||
| 865ef2aebe | |||
| 4a0ff37963 | |||
| 5cb913cb0a | |||
| ddc0c7db1e | |||
| 1fbf02a310 | |||
| 92c5071fab | |||
| 9ea02751de | |||
| 2e3a6cc1ec | |||
| 397e60a9ce | |||
| 422c42f19b | |||
| 961c44f455 | |||
| 7fff38fb32 | |||
| 38c634f8de |
2
.env
2
.env
@@ -1,5 +1,5 @@
|
||||
# 标题
|
||||
VITE_APP_TITLE=产值管理系统
|
||||
VITE_APP_TITLE=项目产值管理系统
|
||||
|
||||
# 项目本地运行端口号
|
||||
VITE_PORT=80
|
||||
|
||||
@@ -4,7 +4,7 @@ NODE_ENV=production
|
||||
VITE_DEV=false
|
||||
|
||||
# 请求路径
|
||||
VITE_BASE_URL='http://localhost:48080'
|
||||
VITE_BASE_URL=
|
||||
|
||||
# 文件上传类型:server - 后端上传, client - 前端直连上传,仅支持S3服务
|
||||
VITE_UPLOAD_TYPE=server
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta
|
||||
name="keywords"
|
||||
content="产值管理系统"
|
||||
content="项目产值管理系统"
|
||||
/>
|
||||
<meta
|
||||
name="description"
|
||||
content="产值管理系统"
|
||||
content="项目产值管理系统"
|
||||
/>
|
||||
<title>%VITE_APP_TITLE%</title>
|
||||
</head>
|
||||
|
||||
69
src/api/tjt/employee/index.ts
Normal file
69
src/api/tjt/employee/index.ts
Normal file
@@ -0,0 +1,69 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
export interface EmployeeVO {
|
||||
id?: number
|
||||
employeeName: string
|
||||
gender: string
|
||||
officeId: number
|
||||
officeName?: string
|
||||
registrationType?: string
|
||||
jobTitle?: string
|
||||
registrationSealNo?: string
|
||||
entryDate?: string
|
||||
leaveDate?: string
|
||||
employeeStatus: string
|
||||
remark?: string
|
||||
officeLeaderFlag?: boolean
|
||||
sortNo?: number
|
||||
enabledFlag?: boolean
|
||||
createTime?: string
|
||||
}
|
||||
|
||||
export interface EmployeePageReqVO extends PageParam {
|
||||
employeeName?: string
|
||||
officeId?: number
|
||||
employeeStatus?: string
|
||||
enabledFlag?: boolean
|
||||
officeLeaderFlag?: boolean
|
||||
}
|
||||
|
||||
export interface EmployeeSimpleVO {
|
||||
id: number
|
||||
employeeName: string
|
||||
officeId?: number
|
||||
officeName?: string
|
||||
employeeStatus?: string
|
||||
registrationType?: string
|
||||
jobTitle?: string
|
||||
officeLeaderFlag?: boolean
|
||||
}
|
||||
|
||||
export const getEmployeePage = (params: EmployeePageReqVO) => {
|
||||
return request.get({ url: '/tjt/employee/page', params })
|
||||
}
|
||||
|
||||
export const getEmployee = (id: number) => {
|
||||
return request.get({ url: '/tjt/employee/get', params: { id } })
|
||||
}
|
||||
|
||||
export const createEmployee = (data: EmployeeVO) => {
|
||||
return request.post({ url: '/tjt/employee/create', data })
|
||||
}
|
||||
|
||||
export const updateEmployee = (data: EmployeeVO) => {
|
||||
return request.put({ url: '/tjt/employee/update', data })
|
||||
}
|
||||
|
||||
export const deleteEmployee = (id: number) => {
|
||||
return request.delete({ url: '/tjt/employee/delete', params: { id } })
|
||||
}
|
||||
|
||||
export const getEmployeeSimpleList = (params: {
|
||||
keyword?: string
|
||||
officeId?: number
|
||||
status?: string
|
||||
enabledFlag?: boolean
|
||||
officeLeaderFlag?: boolean
|
||||
}) => {
|
||||
return request.get({ url: '/tjt/employee/simple-list', params })
|
||||
}
|
||||
56
src/api/tjt/employeeYearCostBudget/index.ts
Normal file
56
src/api/tjt/employeeYearCostBudget/index.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
export interface EmployeeYearCostBudgetVO {
|
||||
id?: number
|
||||
employeeId: number
|
||||
employeeName?: string
|
||||
budgetYear: number
|
||||
expectedCostAmount: number
|
||||
remark?: string
|
||||
sortNo?: number
|
||||
enabledFlag?: boolean
|
||||
createTime?: string
|
||||
}
|
||||
|
||||
export interface EmployeeYearCostBudgetPageReqVO extends PageParam {
|
||||
employeeId?: number
|
||||
employeeName?: string
|
||||
budgetYear?: number
|
||||
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 })
|
||||
}
|
||||
|
||||
export const getEmployeeYearCostBudget = (id: number) => {
|
||||
return request.get({ url: '/tjt/employee-year-cost-budget/get', params: { id } })
|
||||
}
|
||||
|
||||
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 })
|
||||
}
|
||||
|
||||
export const deleteEmployeeYearCostBudget = (id: number) => {
|
||||
return request.delete({ url: '/tjt/employee-year-cost-budget/delete', params: { id } })
|
||||
}
|
||||
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 } })
|
||||
}
|
||||
45
src/api/tjt/office/index.ts
Normal file
45
src/api/tjt/office/index.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
export interface OfficeVO {
|
||||
id?: number
|
||||
officeName: string
|
||||
officeCode?: string
|
||||
sortNo?: number
|
||||
enabledFlag?: boolean
|
||||
remark?: string
|
||||
createTime?: string
|
||||
}
|
||||
|
||||
export interface OfficePageReqVO extends PageParam {
|
||||
officeName?: string
|
||||
enabledFlag?: boolean
|
||||
}
|
||||
|
||||
export interface OfficeSimpleVO {
|
||||
id: number
|
||||
officeName: string
|
||||
}
|
||||
|
||||
export const getOfficePage = (params: OfficePageReqVO) => {
|
||||
return request.get({ url: '/tjt/office/page', params })
|
||||
}
|
||||
|
||||
export const getOffice = (id: number) => {
|
||||
return request.get({ url: '/tjt/office/get', params: { id } })
|
||||
}
|
||||
|
||||
export const createOffice = (data: OfficeVO) => {
|
||||
return request.post({ url: '/tjt/office/create', data })
|
||||
}
|
||||
|
||||
export const updateOffice = (data: OfficeVO) => {
|
||||
return request.put({ url: '/tjt/office/update', data })
|
||||
}
|
||||
|
||||
export const deleteOffice = (id: number) => {
|
||||
return request.delete({ url: '/tjt/office/delete', params: { id } })
|
||||
}
|
||||
|
||||
export const getOfficeSimpleList = () => {
|
||||
return request.get({ url: '/tjt/office/simple-list' })
|
||||
}
|
||||
@@ -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
|
||||
@@ -9,11 +11,10 @@ export interface ProjectOutputSplitVO {
|
||||
year?: number
|
||||
assessmentOutputValue?: number
|
||||
projectManagerName?: string
|
||||
projectManagerRatio: number
|
||||
projectManagerAmount?: number
|
||||
engineeringLeaderName?: string
|
||||
engineeringLeaderRatio: number
|
||||
engineeringLeaderAmount?: number
|
||||
projectLeadName?: string
|
||||
projectLeadRatio: number
|
||||
projectLeadAmount?: number
|
||||
officeRatio: number
|
||||
officeAmount?: number
|
||||
archRatio: number
|
||||
@@ -35,8 +36,7 @@ export interface ProjectOutputSplitVO {
|
||||
export type ProjectOutputSplitSaveVO = Pick<
|
||||
ProjectOutputSplitVO,
|
||||
| 'planningId'
|
||||
| 'projectManagerRatio'
|
||||
| 'engineeringLeaderRatio'
|
||||
| 'projectLeadRatio'
|
||||
| 'officeRatio'
|
||||
| 'archRatio'
|
||||
| 'decorRatio'
|
||||
@@ -47,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,14 +1,21 @@
|
||||
import request from '@/config/axios'
|
||||
import type { ProjectPlanningGuideDetailVO } from '@/api/tjt/planningGuideDetail'
|
||||
|
||||
export interface ProjectPlanningVO {
|
||||
id?: number
|
||||
projectId: number
|
||||
sortNo?: string
|
||||
ownershipType: string
|
||||
calculationMethod: string
|
||||
planningContent: string
|
||||
planningAmount?: number
|
||||
contractValueQuantity?: number
|
||||
contractValueUnitPrice?: number
|
||||
managementFeeRate?: number
|
||||
managementFee?: number
|
||||
vatRate?: number
|
||||
vatAmount?: number
|
||||
projectBudgetOutputValue?: number
|
||||
implementationTeam?: string
|
||||
planningStartYear?: number
|
||||
planningArea?: number
|
||||
@@ -31,7 +38,6 @@ export interface ProjectPlanningVO {
|
||||
workingDayUnitPrice?: number
|
||||
guidanceUnitPrice?: number
|
||||
guidanceTotalPrice?: number
|
||||
virtualTotalPrice?: number
|
||||
calculationRatio?: number
|
||||
contractUnitPrice?: number
|
||||
totalAdjustmentFactor?: number
|
||||
@@ -45,8 +51,10 @@ export type ProjectPlanningSaveVO = Omit<
|
||||
ProjectPlanningVO,
|
||||
| 'allocatedAmount'
|
||||
| 'pendingAmount'
|
||||
| 'planningAmount'
|
||||
| 'managementFee'
|
||||
| 'contractUnitPrice'
|
||||
| 'vatAmount'
|
||||
| 'projectBudgetOutputValue'
|
||||
| 'totalAdjustmentFactor'
|
||||
| 'assessmentArea'
|
||||
| 'virtualOutputValue'
|
||||
@@ -63,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 })
|
||||
}
|
||||
@@ -71,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 } })
|
||||
}
|
||||
|
||||
59
src/api/tjt/planningGuideDetail/index.ts
Normal file
59
src/api/tjt/planningGuideDetail/index.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
export interface ProjectPlanningGuideDetailVO {
|
||||
id?: number
|
||||
planningId: number
|
||||
projectId?: number
|
||||
designPart?: string
|
||||
buildingType?: string
|
||||
designArea?: number
|
||||
internalGuidanceUnitPrice?: number
|
||||
buildingOrUnitCount?: number
|
||||
drawingSetFactor?: number
|
||||
scaleFactor?: number
|
||||
modificationFactor?: number
|
||||
complexityFactor?: number
|
||||
totalAdjustmentFactor?: number
|
||||
designRatio?: number
|
||||
assessmentArea?: number
|
||||
assessmentOutputValue?: number
|
||||
sortNo?: number
|
||||
remark?: string
|
||||
createTime?: string
|
||||
}
|
||||
|
||||
export interface ProjectPlanningGuideDetailBatchSaveVO {
|
||||
planningId: number
|
||||
details: Array<
|
||||
Pick<
|
||||
ProjectPlanningGuideDetailVO,
|
||||
| 'id'
|
||||
| 'designPart'
|
||||
| 'buildingType'
|
||||
| 'designArea'
|
||||
| 'internalGuidanceUnitPrice'
|
||||
| 'buildingOrUnitCount'
|
||||
| 'drawingSetFactor'
|
||||
| 'scaleFactor'
|
||||
| 'modificationFactor'
|
||||
| 'complexityFactor'
|
||||
| 'designRatio'
|
||||
| 'sortNo'
|
||||
| 'remark'
|
||||
>
|
||||
>
|
||||
}
|
||||
|
||||
export const getProjectPlanningGuideDetailListByPlanningId = (planningId: number) => {
|
||||
return request.get({ url: '/tjt/planning-guide-detail/list-by-planning', params: { planningId } })
|
||||
}
|
||||
|
||||
export const batchSaveProjectPlanningGuideDetail = (
|
||||
data: ProjectPlanningGuideDetailBatchSaveVO
|
||||
) => {
|
||||
return request.post({ url: '/tjt/planning-guide-detail/batch-save', data })
|
||||
}
|
||||
|
||||
export const deleteProjectPlanningGuideDetail = (id: number) => {
|
||||
return request.delete({ url: '/tjt/planning-guide-detail/delete', params: { id } })
|
||||
}
|
||||
@@ -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,18 +3,66 @@ import request from '@/config/axios'
|
||||
export interface ProjectProfitVO {
|
||||
projectId: number
|
||||
projectName: string
|
||||
sortNo?: string
|
||||
contractSignedFlag: boolean
|
||||
contractAmount?: number
|
||||
finalSettlementAmount?: number
|
||||
effectiveSettlementAmount?: number
|
||||
comprehensivePlanningAmount?: number
|
||||
subcontractPlanningAmount?: number
|
||||
specialSubcontractPlanningAmount?: number
|
||||
sourceCoopSubcontractPlanningAmount?: number
|
||||
comprehensiveSubcontractPlanningAmount?: number
|
||||
majorOutputValue?: number
|
||||
expectedKValue?: number
|
||||
majorExpectedPerformance?: number
|
||||
innovationOutputRate?: number
|
||||
innovationOutputValue?: number
|
||||
otherCost?: number
|
||||
profitLossValue?: number
|
||||
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 {
|
||||
@@ -31,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 })
|
||||
}
|
||||
|
||||
@@ -1,8 +1,19 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
export interface ProjectRolePersonVO {
|
||||
id?: number
|
||||
projectId?: number
|
||||
roleCode: 'project_manager' | 'engineering_principal'
|
||||
roleName?: string
|
||||
employeeId?: number
|
||||
employeeName?: string
|
||||
sortNo?: number
|
||||
}
|
||||
|
||||
export interface ProjectVO {
|
||||
id?: number
|
||||
projectName: string
|
||||
sortNo?: string
|
||||
contractSignedFlag: boolean
|
||||
contractAmount?: number
|
||||
totalConstructionArea?: number
|
||||
@@ -13,18 +24,30 @@ export interface ProjectVO {
|
||||
projectManagerName?: string
|
||||
engineeringPrincipalName?: string
|
||||
projectType?: string
|
||||
projectCategory?: string
|
||||
projectStartYear?: number
|
||||
projectStatus?: string
|
||||
archiveFlag?: boolean
|
||||
archiveTime?: string
|
||||
pauseReason?: string
|
||||
terminateReason?: string
|
||||
finalSettlementAmount?: number
|
||||
expectedKValue?: number
|
||||
innovationOutputRate?: number
|
||||
otherCost?: number
|
||||
rolePersons?: ProjectRolePersonVO[]
|
||||
createTime?: string
|
||||
}
|
||||
|
||||
export type ProjectSaveVO = Omit<ProjectVO, 'createTime'>
|
||||
export type ProjectSaveVO = Omit<
|
||||
ProjectVO,
|
||||
'createTime' | 'archiveTime' | 'projectManagerName' | 'engineeringPrincipalName'
|
||||
>
|
||||
|
||||
export interface ProjectPageReqVO extends PageParam {
|
||||
projectName?: string
|
||||
contractSignedFlag?: boolean
|
||||
projectStartYear?: number
|
||||
projectStatus?: string
|
||||
createTime?: string[]
|
||||
}
|
||||
|
||||
|
||||
354
src/api/tjt/report/index.ts
Normal file
354
src/api/tjt/report/index.ts
Normal file
@@ -0,0 +1,354 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
export interface ProjectOverviewExportReqVO {
|
||||
year?: number
|
||||
officeId?: number
|
||||
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
|
||||
employeeId?: number
|
||||
employeeStatus?: string
|
||||
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 {
|
||||
projectId: number
|
||||
year?: 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 {
|
||||
planningId: number
|
||||
specialtyCode: string
|
||||
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',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
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',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
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() }
|
||||
})
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
export interface SpecialtyRolePersonVO {
|
||||
personName?: string
|
||||
employeeId?: number
|
||||
employeeName?: string
|
||||
personRatio?: number
|
||||
personAmount?: number
|
||||
}
|
||||
@@ -33,6 +34,7 @@ export interface SpecialtyRoleSplitSaveItemVO {
|
||||
export interface SpecialtyRoleSplitBatchSaveVO {
|
||||
planningId: number
|
||||
items: SpecialtyRoleSplitSaveItemVO[]
|
||||
temporarySave?: boolean
|
||||
}
|
||||
|
||||
export const getSpecialtyRoleSplitListByPlanningId = (planningId: number) => {
|
||||
|
||||
49
src/api/tjt/yearKValue/index.ts
Normal file
49
src/api/tjt/yearKValue/index.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
export interface YearKValueVO {
|
||||
id?: number
|
||||
kYear?: number
|
||||
kValue?: number
|
||||
remark?: string
|
||||
enabledFlag?: boolean
|
||||
createTime?: string
|
||||
}
|
||||
|
||||
export interface YearKValuePageReqVO extends PageParam {
|
||||
kYear?: number
|
||||
enabledFlag?: boolean
|
||||
}
|
||||
|
||||
const normalizeYearKValue = (data: any): YearKValueVO => ({
|
||||
id: data?.id,
|
||||
kYear: data?.kYear ?? data?.kyear,
|
||||
kValue: data?.kValue ?? data?.kvalue,
|
||||
remark: data?.remark,
|
||||
enabledFlag: data?.enabledFlag ?? data?.enabledflag,
|
||||
createTime: data?.createTime ?? data?.createtime
|
||||
})
|
||||
|
||||
export const getYearKValuePage = async (params: YearKValuePageReqVO) => {
|
||||
const data = await request.get({ url: '/tjt/year-k-value/page', params })
|
||||
return {
|
||||
...data,
|
||||
list: Array.isArray(data?.list) ? data.list.map(normalizeYearKValue) : []
|
||||
}
|
||||
}
|
||||
|
||||
export const getYearKValue = async (id: number) => {
|
||||
const data = await request.get({ url: '/tjt/year-k-value/get', params: { id } })
|
||||
return normalizeYearKValue(data)
|
||||
}
|
||||
|
||||
export const createYearKValue = (data: YearKValueVO) => {
|
||||
return request.post({ url: '/tjt/year-k-value/create', data })
|
||||
}
|
||||
|
||||
export const updateYearKValue = (data: YearKValueVO) => {
|
||||
return request.put({ url: '/tjt/year-k-value/update', data })
|
||||
}
|
||||
|
||||
export const deleteYearKValue = (id: number) => {
|
||||
return request.delete({ url: '/tjt/year-k-value/delete', params: { id } })
|
||||
}
|
||||
@@ -14,6 +14,12 @@ const request = (option: any) => {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export interface DownloadResponseData {
|
||||
data: Blob
|
||||
fileName?: string
|
||||
}
|
||||
|
||||
export default {
|
||||
get: async <T = any>(option: any) => {
|
||||
const res = await request({ method: 'GET', ...option })
|
||||
@@ -35,9 +41,9 @@ export default {
|
||||
const res = await request({ method: 'PUT', ...option })
|
||||
return res.data as unknown as T
|
||||
},
|
||||
download: async <T = any>(option: any) => {
|
||||
download: async <T = DownloadResponseData>(option: any) => {
|
||||
const res = await request({ method: 'GET', responseType: 'blob', ...option })
|
||||
return res as unknown as Promise<T>
|
||||
return res as T
|
||||
},
|
||||
upload: async <T = any>(option: any) => {
|
||||
option.headersType = 'multipart/form-data'
|
||||
|
||||
@@ -20,6 +20,29 @@ import { ApiEncrypt } from '@/utils/encrypt'
|
||||
const tenantEnable = import.meta.env.VITE_APP_TENANT_ENABLE
|
||||
const { result_code, base_url, request_timeout } = config
|
||||
|
||||
const resolveDownloadFileName = (contentDisposition?: string) => {
|
||||
if (!contentDisposition) {
|
||||
return undefined
|
||||
}
|
||||
const decodeFileName = (value: string) => {
|
||||
const normalizedValue = value.trim().replace(/^"(.*)"$/, '$1').replace(/\+/g, '%20')
|
||||
try {
|
||||
return decodeURIComponent(normalizedValue)
|
||||
} catch (error) {
|
||||
return normalizedValue
|
||||
}
|
||||
}
|
||||
const filenameStarMatch = contentDisposition.match(/filename\*\s*=\s*([^;]+)/i)
|
||||
if (filenameStarMatch?.[1]) {
|
||||
return decodeFileName(filenameStarMatch[1].replace(/^UTF-8''/i, ''))
|
||||
}
|
||||
const filenameMatch = contentDisposition.match(/filename\s*=\s*([^;]+)/i)
|
||||
if (filenameMatch?.[1]) {
|
||||
return decodeFileName(filenameMatch[1])
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
// 需要忽略的提示。忽略后,自动 Promise.reject('error')
|
||||
const ignoreMsgs = [
|
||||
'无效的刷新令牌', // 刷新令牌被删除时,不用提示
|
||||
@@ -141,7 +164,10 @@ service.interceptors.response.use(
|
||||
) {
|
||||
// 注意:如果导出的响应为 json,说明可能失败了,不直接返回进行下载
|
||||
if (response.data.type !== 'application/json') {
|
||||
return response.data
|
||||
return {
|
||||
data: response.data,
|
||||
fileName: resolveDownloadFileName(response.headers['content-disposition'])
|
||||
}
|
||||
}
|
||||
data = await new Response(response.data).json()
|
||||
}
|
||||
|
||||
@@ -6,17 +6,24 @@ export const useRenderMenuTitle = () => {
|
||||
const renderMenuTitle = (meta: RouteMeta) => {
|
||||
const { t } = useI18n()
|
||||
const { title = 'Please set title', icon } = meta
|
||||
const text = t(title as string)
|
||||
|
||||
return icon ? (
|
||||
<>
|
||||
<Icon icon={meta.icon}></Icon>
|
||||
<span class="v-menu__title overflow-hidden overflow-ellipsis whitespace-nowrap">
|
||||
{t(title as string)}
|
||||
<span
|
||||
class="v-menu__title overflow-hidden overflow-ellipsis whitespace-nowrap"
|
||||
title={text}
|
||||
>
|
||||
{text}
|
||||
</span>
|
||||
</>
|
||||
) : (
|
||||
<span class="v-menu__title overflow-hidden overflow-ellipsis whitespace-nowrap">
|
||||
{t(title as string)}
|
||||
<span
|
||||
class="v-menu__title overflow-hidden overflow-ellipsis whitespace-nowrap"
|
||||
title={text}
|
||||
>
|
||||
{text}
|
||||
</span>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ export default {
|
||||
},
|
||||
login: {
|
||||
welcome: '欢迎使用本系统',
|
||||
message: '产值管理系统',
|
||||
message: '项目产值管理系统',
|
||||
tenantname: '租户名称',
|
||||
username: '用户名',
|
||||
password: '密码',
|
||||
@@ -374,7 +374,7 @@ export default {
|
||||
qrSignInFormTitle: '二维码登录',
|
||||
signUpFormTitle: '注册',
|
||||
forgetFormTitle: '重置密码',
|
||||
signInTitle: '产值管理系统',
|
||||
signInTitle: '项目产值管理系统',
|
||||
signInDesc: '输入您的个人详细信息开始使用!',
|
||||
policy: '我同意xxx隐私政策',
|
||||
scanSign: `扫码后点击"确认",即可完成登录`,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
:root {
|
||||
--login-bg-color: #293146;
|
||||
|
||||
--left-menu-max-width: 200px;
|
||||
--left-menu-max-width: 224px;
|
||||
|
||||
--left-menu-min-width: 64px;
|
||||
|
||||
|
||||
@@ -1,12 +1,38 @@
|
||||
const download0 = (data: Blob, fileName: string, mineType: string) => {
|
||||
export interface DownloadSource {
|
||||
data: BlobPart
|
||||
fileName?: string
|
||||
}
|
||||
|
||||
const resolveDownloadPayload = (source: BlobPart | DownloadSource, fallbackFileName?: string) => {
|
||||
if (
|
||||
source &&
|
||||
typeof source === 'object' &&
|
||||
!(source instanceof Blob) &&
|
||||
!(source instanceof ArrayBuffer) &&
|
||||
'data' in source
|
||||
) {
|
||||
const resolvedSource = source as DownloadSource
|
||||
return {
|
||||
data: resolvedSource.data,
|
||||
fileName: resolvedSource.fileName || fallbackFileName || 'download'
|
||||
}
|
||||
}
|
||||
return {
|
||||
data: source as BlobPart,
|
||||
fileName: fallbackFileName || 'download'
|
||||
}
|
||||
}
|
||||
|
||||
const download0 = (source: BlobPart | DownloadSource, fileName: string | undefined, mineType: string) => {
|
||||
const payload = resolveDownloadPayload(source, fileName)
|
||||
// 创建 blob
|
||||
const blob = new Blob([data], { type: mineType })
|
||||
const blob = new Blob([payload.data], { type: mineType })
|
||||
// 创建 href 超链接,点击进行下载
|
||||
window.URL = window.URL || window.webkitURL
|
||||
const href = URL.createObjectURL(blob)
|
||||
const downA = document.createElement('a')
|
||||
downA.href = href
|
||||
downA.download = fileName
|
||||
downA.download = payload.fileName
|
||||
downA.click()
|
||||
// 销毁超连接
|
||||
window.URL.revokeObjectURL(href)
|
||||
@@ -14,27 +40,27 @@ const download0 = (data: Blob, fileName: string, mineType: string) => {
|
||||
|
||||
const download = {
|
||||
// 下载 Excel 方法
|
||||
excel: (data: Blob, fileName: string) => {
|
||||
excel: (data: BlobPart | DownloadSource, fileName?: string) => {
|
||||
download0(data, fileName, 'application/vnd.ms-excel')
|
||||
},
|
||||
// 下载 Word 方法
|
||||
word: (data: Blob, fileName: string) => {
|
||||
word: (data: BlobPart | DownloadSource, fileName?: string) => {
|
||||
download0(data, fileName, 'application/msword')
|
||||
},
|
||||
// 下载 Zip 方法
|
||||
zip: (data: Blob, fileName: string) => {
|
||||
zip: (data: BlobPart | DownloadSource, fileName?: string) => {
|
||||
download0(data, fileName, 'application/zip')
|
||||
},
|
||||
// 下载 Html 方法
|
||||
html: (data: Blob, fileName: string) => {
|
||||
html: (data: BlobPart | DownloadSource, fileName?: string) => {
|
||||
download0(data, fileName, 'text/html')
|
||||
},
|
||||
// 下载 Markdown 方法
|
||||
markdown: (data: Blob, fileName: string) => {
|
||||
markdown: (data: BlobPart | DownloadSource, fileName?: string) => {
|
||||
download0(data, fileName, 'text/markdown')
|
||||
},
|
||||
// 下载 Json 方法
|
||||
json: (data: Blob, fileName: string) => {
|
||||
json: (data: BlobPart | DownloadSource, fileName?: string) => {
|
||||
download0(data, fileName, 'application/json')
|
||||
},
|
||||
// 下载图片(允许跨域)
|
||||
|
||||
467
src/views/tjt/employee-year-cost-budget/index.vue
Normal file
467
src/views/tjt/employee-year-cost-budget/index.vue
Normal file
@@ -0,0 +1,467 @@
|
||||
<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="budgetYear">
|
||||
<el-date-picker
|
||||
v-model="queryBudgetYearValue"
|
||||
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-cost-budget:create']"
|
||||
plain
|
||||
type="primary"
|
||||
@click="openDialog('create')"
|
||||
>
|
||||
<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 :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">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.expectedCostAmount) }}
|
||||
</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-cost-budget:update']"
|
||||
link
|
||||
type="primary"
|
||||
@click="openDialog('update', scope.row.id)"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-hasPermi="['tjt:employee-year-cost-budget: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="budgetYear">
|
||||
<el-date-picker
|
||||
v-model="formBudgetYearValue"
|
||||
class="!w-1/1"
|
||||
placeholder="请选择年度"
|
||||
type="year"
|
||||
value-format="YYYY"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="预计发生成本" prop="expectedCostAmount">
|
||||
<el-input-number
|
||||
v-model="formData.expectedCostAmount"
|
||||
: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="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' })
|
||||
|
||||
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<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')
|
||||
|
||||
const queryParams = reactive<EmployeeYearCostBudgetApi.EmployeeYearCostBudgetPageReqVO>({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
employeeId: undefined,
|
||||
employeeName: undefined,
|
||||
budgetYear: undefined,
|
||||
enabledFlag: undefined
|
||||
})
|
||||
|
||||
const getRowIndex = (index: number) =>
|
||||
(queryParams.pageNo - 1) * queryParams.pageSize + index + 1
|
||||
|
||||
const createFormData = (): EmployeeYearCostBudgetApi.EmployeeYearCostBudgetVO => ({
|
||||
employeeId: undefined as never,
|
||||
employeeName: '',
|
||||
budgetYear: new Date().getFullYear(),
|
||||
expectedCostAmount: 0,
|
||||
remark: '',
|
||||
sortNo: 0,
|
||||
enabledFlag: true
|
||||
})
|
||||
|
||||
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),
|
||||
set: (value?: string) => {
|
||||
queryParams.budgetYear = value ? Number(value) : undefined
|
||||
}
|
||||
})
|
||||
|
||||
const formBudgetYearValue = computed({
|
||||
get: () => (formData.value.budgetYear ? String(formData.value.budgetYear) : undefined),
|
||||
set: (value?: string) => {
|
||||
formData.value.budgetYear = value ? Number(value) : new Date().getFullYear()
|
||||
}
|
||||
})
|
||||
|
||||
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
|
||||
}
|
||||
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
|
||||
})
|
||||
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 EmployeeYearCostBudgetApi.getEmployeeYearCostBudgetPage(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 EmployeeYearCostBudgetApi.getEmployeeYearCostBudget(id)
|
||||
ensureEmployeeOption()
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
const valid = await formRef.value.validate()
|
||||
if (!valid) {
|
||||
return
|
||||
}
|
||||
formLoading.value = true
|
||||
try {
|
||||
if (formType.value === 'create') {
|
||||
await EmployeeYearCostBudgetApi.createEmployeeYearCostBudget(formData.value)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await EmployeeYearCostBudgetApi.updateEmployeeYearCostBudget(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 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()
|
||||
await EmployeeYearCostBudgetApi.deleteEmployeeYearCostBudget(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
await getList()
|
||||
} 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>
|
||||
505
src/views/tjt/employee/index.vue
Normal file
505
src/views/tjt/employee/index.vue
Normal file
@@ -0,0 +1,505 @@
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<el-form
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
:model="queryParams"
|
||||
class="-mb-15px"
|
||||
label-width="88px"
|
||||
>
|
||||
<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="officeId">
|
||||
<el-select
|
||||
v-model="queryParams.officeId"
|
||||
class="!w-220px"
|
||||
clearable
|
||||
placeholder="请选择专业所"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in officeOptions"
|
||||
:key="item.id"
|
||||
:label="item.officeName"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="employeeStatus">
|
||||
<el-select
|
||||
v-model="queryParams.employeeStatus"
|
||||
class="!w-180px"
|
||||
clearable
|
||||
placeholder="请选择状态"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in EMPLOYEE_STATUS_OPTIONS"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</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 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" />
|
||||
搜索
|
||||
</el-button>
|
||||
<el-button @click="resetQuery">
|
||||
<Icon class="mr-5px" icon="ep:refresh" />
|
||||
重置
|
||||
</el-button>
|
||||
<el-button v-hasPermi="['tjt:employee:create']" plain type="primary" @click="openDialog('create')">
|
||||
<Icon class="mr-5px" icon="ep:plus" />
|
||||
新增
|
||||
</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="120" prop="employeeName" />
|
||||
<el-table-column align="center" label="性别" prop="gender" width="80" />
|
||||
<el-table-column align="center" label="所属专业所" min-width="140" prop="officeName" />
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="注册类型及等级"
|
||||
min-width="160"
|
||||
prop="registrationType"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column align="center" label="职称" min-width="120" prop="jobTitle" show-overflow-tooltip />
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="注册章号"
|
||||
min-width="140"
|
||||
prop="registrationSealNo"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<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'">
|
||||
{{ 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="100">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
v-hasPermi="['tjt:employee:update']"
|
||||
link
|
||||
type="primary"
|
||||
@click="openDialog('update', 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="760">
|
||||
<el-form ref="formRef" v-loading="formLoading" :model="formData" :rules="formRules" label-width="120px">
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="员工姓名" prop="employeeName">
|
||||
<el-input v-model="formData.employeeName" maxlength="64" placeholder="请输入员工姓名" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="性别" prop="gender">
|
||||
<el-select v-model="formData.gender" class="!w-1/1" placeholder="请选择性别">
|
||||
<el-option
|
||||
v-for="item in EMPLOYEE_GENDER_OPTIONS"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="所属专业所" prop="officeId">
|
||||
<el-select
|
||||
v-model="formData.officeId"
|
||||
class="!w-1/1"
|
||||
filterable
|
||||
placeholder="请选择专业所"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in officeOptions"
|
||||
:key="item.id"
|
||||
:label="item.officeName"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="状态" prop="employeeStatus">
|
||||
<el-select v-model="formData.employeeStatus" class="!w-1/1" placeholder="请选择状态">
|
||||
<el-option
|
||||
v-for="item in EMPLOYEE_STATUS_OPTIONS"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="注册类型及等级" prop="registrationType">
|
||||
<el-input
|
||||
v-model="formData.registrationType"
|
||||
maxlength="100"
|
||||
placeholder="请输入注册类型及等级"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="职称" prop="jobTitle">
|
||||
<el-select v-model="formData.jobTitle" class="!w-1/1" clearable placeholder="请选择职称">
|
||||
<el-option
|
||||
v-for="item in EMPLOYEE_JOB_TITLE_OPTIONS"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="注册章号" prop="registrationSealNo">
|
||||
<el-input
|
||||
v-model="formData.registrationSealNo"
|
||||
maxlength="100"
|
||||
placeholder="请输入注册章号"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="入职时间" prop="entryDate">
|
||||
<el-date-picker
|
||||
v-model="formData.entryDate"
|
||||
class="!w-1/1"
|
||||
placeholder="请选择入职时间"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="离职时间" prop="leaveDate">
|
||||
<el-date-picker
|
||||
v-model="formData.leaveDate"
|
||||
class="!w-1/1"
|
||||
placeholder="请选择离职时间"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<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-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="是否启用" prop="enabledFlag">
|
||||
<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
|
||||
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>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
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' })
|
||||
|
||||
const EMPLOYEE_GENDER_OPTIONS = [
|
||||
{ label: '男', value: '男' },
|
||||
{ label: '女', value: '女' }
|
||||
]
|
||||
|
||||
const EMPLOYEE_STATUS_OPTIONS = [
|
||||
{ label: '在职', value: '在职' },
|
||||
{ label: '离职', value: '离职' },
|
||||
{ label: '停职', value: '停职' }
|
||||
]
|
||||
|
||||
const EMPLOYEE_JOB_TITLE_OPTIONS = [
|
||||
{ label: '初级', value: '初级' },
|
||||
{ label: '中级', value: '中级' },
|
||||
{ label: '副高级', value: '副高级' },
|
||||
{ label: '正高级', value: '正高级' }
|
||||
]
|
||||
|
||||
const message = useMessage()
|
||||
const { t } = useI18n()
|
||||
|
||||
const loading = ref(false)
|
||||
const formLoading = ref(false)
|
||||
const total = ref(0)
|
||||
const list = ref<EmployeeApi.EmployeeVO[]>([])
|
||||
const officeOptions = ref<OfficeApi.OfficeSimpleVO[]>([])
|
||||
const queryFormRef = ref()
|
||||
const formRef = ref()
|
||||
const dialogVisible = ref(false)
|
||||
const dialogTitle = ref('')
|
||||
const formType = ref<'create' | 'update'>('create')
|
||||
|
||||
const queryParams = reactive<EmployeeApi.EmployeePageReqVO>({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
employeeName: undefined,
|
||||
officeId: undefined,
|
||||
employeeStatus: undefined,
|
||||
enabledFlag: undefined,
|
||||
officeLeaderFlag: undefined
|
||||
})
|
||||
|
||||
const getRowIndex = (index: number) =>
|
||||
(queryParams.pageNo - 1) * queryParams.pageSize + index + 1
|
||||
|
||||
const createFormData = (): EmployeeApi.EmployeeVO => ({
|
||||
employeeName: '',
|
||||
gender: '男',
|
||||
officeId: undefined as never,
|
||||
registrationType: '',
|
||||
jobTitle: undefined,
|
||||
registrationSealNo: '',
|
||||
entryDate: undefined,
|
||||
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' }],
|
||||
officeId: [{ required: true, message: '所属专业所不能为空', trigger: 'change' }],
|
||||
employeeStatus: [{ required: true, message: '状态不能为空', trigger: 'change' }]
|
||||
})
|
||||
|
||||
const loadOfficeOptions = async () => {
|
||||
officeOptions.value = await OfficeApi.getOfficeSimpleList()
|
||||
}
|
||||
|
||||
const ensureCurrentOfficeOption = async () => {
|
||||
if (!formData.value.officeId || officeOptions.value.some((item) => item.id === formData.value.officeId)) {
|
||||
return
|
||||
}
|
||||
const office = await OfficeApi.getOffice(formData.value.officeId)
|
||||
officeOptions.value = [
|
||||
...officeOptions.value,
|
||||
{
|
||||
id: office.id!,
|
||||
officeName: office.officeName
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await EmployeeApi.getEmployeePage(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()
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
|
||||
const openDialog = async (type: 'create' | 'update', id?: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = type === 'create' ? '新增员工' : '编辑员工'
|
||||
formType.value = type
|
||||
resetForm()
|
||||
if (!id) {
|
||||
return
|
||||
}
|
||||
formLoading.value = true
|
||||
try {
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
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 EmployeeApi.createEmployee(formData.value)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await EmployeeApi.updateEmployee(formData.value)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
await getList()
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
let activatedOnce = false
|
||||
|
||||
onMounted(async () => {
|
||||
await loadOfficeOptions()
|
||||
await getList()
|
||||
})
|
||||
|
||||
onActivated(() => {
|
||||
// KeepAlive 首次挂载也会触发 onActivated,跳过首轮避免重复请求列表。
|
||||
if (!activatedOnce) {
|
||||
activatedOnce = true
|
||||
return
|
||||
}
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
253
src/views/tjt/office/index.vue
Normal file
253
src/views/tjt/office/index.vue
Normal file
@@ -0,0 +1,253 @@
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<el-form
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
:model="queryParams"
|
||||
class="-mb-15px"
|
||||
label-width="88px"
|
||||
>
|
||||
<el-form-item label="专业所名称" prop="officeName">
|
||||
<el-input
|
||||
v-model="queryParams.officeName"
|
||||
class="!w-240px"
|
||||
clearable
|
||||
placeholder="请输入专业所名称"
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</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:office:create']" plain type="primary" @click="openDialog('create')">
|
||||
<Icon class="mr-5px" icon="ep:plus" />
|
||||
新增
|
||||
</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="180" prop="officeName" />
|
||||
<el-table-column align="center" label="专业所编码" min-width="140" prop="officeCode" />
|
||||
<el-table-column align="center" label="排序号" prop="sortNo" width="100" />
|
||||
<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="备注" min-width="220" prop="remark" show-overflow-tooltip />
|
||||
<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)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button v-hasPermi="['tjt:office: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="520">
|
||||
<el-form ref="formRef" v-loading="formLoading" :model="formData" :rules="formRules" label-width="100px">
|
||||
<el-form-item label="专业所名称" prop="officeName">
|
||||
<el-input v-model="formData.officeName" maxlength="100" placeholder="请输入专业所名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="专业所编码" prop="officeCode">
|
||||
<el-input v-model="formData.officeCode" maxlength="50" placeholder="请输入专业所编码" />
|
||||
</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>
|
||||
</template>
|
||||
|
||||
<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' })
|
||||
|
||||
const message = useMessage()
|
||||
const { t } = useI18n()
|
||||
|
||||
const loading = ref(false)
|
||||
const formLoading = ref(false)
|
||||
const total = ref(0)
|
||||
const list = ref<OfficeApi.OfficeVO[]>([])
|
||||
const queryFormRef = ref()
|
||||
const formRef = ref()
|
||||
const dialogVisible = ref(false)
|
||||
const dialogTitle = ref('')
|
||||
const formType = ref<'create' | 'update'>('create')
|
||||
|
||||
const queryParams = reactive<OfficeApi.OfficePageReqVO>({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
officeName: undefined,
|
||||
enabledFlag: undefined
|
||||
})
|
||||
|
||||
const getRowIndex = (index: number) =>
|
||||
(queryParams.pageNo - 1) * queryParams.pageSize + index + 1
|
||||
|
||||
const createFormData = (): OfficeApi.OfficeVO => ({
|
||||
officeName: '',
|
||||
officeCode: '',
|
||||
sortNo: 0,
|
||||
enabledFlag: true,
|
||||
remark: ''
|
||||
})
|
||||
|
||||
const formData = ref<OfficeApi.OfficeVO>(createFormData())
|
||||
|
||||
const formRules = reactive<FormRules>({
|
||||
officeName: [{ required: true, message: '专业所名称不能为空', trigger: 'blur' }]
|
||||
})
|
||||
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await OfficeApi.getOfficePage(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()
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
|
||||
const openDialog = async (type: 'create' | 'update', id?: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = type === 'create' ? '新增专业所' : '编辑专业所'
|
||||
formType.value = type
|
||||
resetForm()
|
||||
if (!id) {
|
||||
return
|
||||
}
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await OfficeApi.getOffice(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
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 OfficeApi.createOffice(formData.value)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await OfficeApi.updateOffice(formData.value)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
await getList()
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
await message.delConfirm()
|
||||
await OfficeApi.deleteOffice(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
let activatedOnce = false
|
||||
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
|
||||
onActivated(() => {
|
||||
// KeepAlive 首次挂载也会触发 onActivated,跳过首轮避免重复请求列表。
|
||||
if (!activatedOnce) {
|
||||
activatedOnce = true
|
||||
return
|
||||
}
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
@@ -7,12 +7,12 @@
|
||||
class="-mb-15px"
|
||||
label-width="88px"
|
||||
>
|
||||
<el-form-item label="工程名称" prop="projectName">
|
||||
<el-form-item label="项目名称" prop="projectName">
|
||||
<el-input
|
||||
v-model="queryParams.projectName"
|
||||
class="!w-240px"
|
||||
clearable
|
||||
placeholder="请输入工程名称"
|
||||
placeholder="请输入项目名称"
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
@@ -47,16 +47,21 @@
|
||||
highlight-current-row
|
||||
@current-change="handleCurrentProjectChange"
|
||||
>
|
||||
<el-table-column align="center" label="项目 ID" prop="id" width="88" />
|
||||
<el-table-column align="center" label="工程名称" min-width="220" prop="projectName" />
|
||||
<el-table-column align="center" label="项目经理" min-width="120" prop="projectManagerName" />
|
||||
<el-table-column
|
||||
:index="getProjectRowIndex"
|
||||
align="center"
|
||||
label="工程负责人"
|
||||
min-width="120"
|
||||
prop="engineeringPrincipalName"
|
||||
label="序号"
|
||||
type="index"
|
||||
width="80"
|
||||
/>
|
||||
<el-table-column align="center" label="项目开始年度" prop="projectStartYear" width="120" />
|
||||
<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"
|
||||
@@ -66,14 +71,11 @@
|
||||
/>
|
||||
</ContentWrap>
|
||||
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="8">
|
||||
<SplitPane>
|
||||
<template #left>
|
||||
<ContentWrap>
|
||||
<div class="mb-12px flex items-center justify-between">
|
||||
<div class="text-14px font-600">
|
||||
{{ currentProject?.projectName || '专业所规划列表' }}
|
||||
</div>
|
||||
<el-button v-if="currentProject" size="small" @click="getPlanningList">刷新</el-button>
|
||||
<div class="mb-12px text-14px font-600">
|
||||
{{ currentProject?.projectName || '合约规划列表' }}
|
||||
</div>
|
||||
<el-table
|
||||
ref="planningTableRef"
|
||||
@@ -82,139 +84,161 @@
|
||||
highlight-current-row
|
||||
@current-change="handleCurrentPlanningChange"
|
||||
>
|
||||
<el-table-column align="center" label="规划内容" min-width="180" prop="planningContent" />
|
||||
<el-table-column align="center" label="项目任务包" min-width="180" prop="planningContent" />
|
||||
<el-table-column align="center" label="归属类型" min-width="110">
|
||||
<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>
|
||||
<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) }} 元
|
||||
</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>
|
||||
<el-button @click="refreshCurrentPlanning">
|
||||
<Icon class="mr-5px" icon="ep:refresh" />
|
||||
刷新结果
|
||||
</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="项目经理">{{ formData.projectManagerName || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="项目负责人">{{ 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="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 flex flex-wrap items-start justify-between gap-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 }}
|
||||
<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="mt-6px text-18px font-600">
|
||||
{{ formatAmountText(item.amount) }}
|
||||
<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-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="请选择专业所规划后查看页面4结果" />
|
||||
</ContentWrap>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<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>
|
||||
|
||||
<Dialog v-model="dialogVisible" title="编辑专业及项目总分配比例" width="900">
|
||||
<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>
|
||||
</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>
|
||||
|
||||
<el-empty v-else-if="!quarterLoading" description="请选择合约规划后查看分配结果" />
|
||||
</div>
|
||||
</ContentWrap>
|
||||
</template>
|
||||
</SplitPane>
|
||||
|
||||
<Dialog v-model="dialogVisible" title="编辑专业及项目总分配比例" width="920">
|
||||
<template v-if="editForm">
|
||||
|
||||
<el-divider content-position="left">项目层比例编辑</el-divider>
|
||||
<el-row :gutter="16">
|
||||
<el-col v-for="item in editProjectRatioItems" :key="item.key" :span="8">
|
||||
<div class="rounded-8px border border-solid border-[var(--el-border-color)] p-12px">
|
||||
<div class="mb-8px text-13px font-600">{{ item.label }}</div>
|
||||
<el-col v-for="item in editProjectRatioItems" :key="item.key" :span="12">
|
||||
<div class="ratio-card">
|
||||
<div class="ratio-title">{{ item.label }}</div>
|
||||
<el-input-number
|
||||
:model-value="item.percent"
|
||||
:disabled="item.key === 'officeRatio'"
|
||||
@@ -225,9 +249,7 @@
|
||||
controls-position="right"
|
||||
@update:model-value="(value) => updateProjectRatio(item.key, value)"
|
||||
/>
|
||||
<div class="mt-8px text-12px text-[var(--el-text-color-secondary)]">
|
||||
金额:{{ formatAmountText(item.amount) }} 元
|
||||
</div>
|
||||
<div class="ratio-amount">金额:{{ formatAmountText(item.amount) }} 元</div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -238,8 +260,8 @@
|
||||
<el-divider content-position="left">专业层比例编辑</el-divider>
|
||||
<el-row :gutter="16">
|
||||
<el-col v-for="item in editSpecialtyRatioItems" :key="item.key" :span="8" class="mb-12px">
|
||||
<div class="rounded-8px border border-solid border-[var(--el-border-color)] p-12px">
|
||||
<div class="mb-8px text-13px font-600">{{ item.label }}</div>
|
||||
<div class="ratio-card">
|
||||
<div class="ratio-title">{{ item.label }}</div>
|
||||
<el-input-number
|
||||
:model-value="item.percent"
|
||||
:disabled="item.key === 'archRatio'"
|
||||
@@ -250,9 +272,7 @@
|
||||
controls-position="right"
|
||||
@update:model-value="(value) => updateSpecialtyRatio(item.key, value)"
|
||||
/>
|
||||
<div class="mt-8px text-12px text-[var(--el-text-color-secondary)]">
|
||||
金额:{{ formatAmountText(item.amount) }} 元
|
||||
</div>
|
||||
<div class="ratio-amount">金额:{{ formatAmountText(item.amount) }} 元</div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -260,6 +280,7 @@
|
||||
专业层比例合计:{{ specialtyRatioTotalText }}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template #footer>
|
||||
<el-button :loading="saveLoading" type="primary" @click="handleSave">保存</el-button>
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
@@ -272,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,
|
||||
isMajorOwnership,
|
||||
getOwnershipTypeLabel,
|
||||
OUTPUT_SPLIT_SPECIALTY,
|
||||
OUTPUT_SPLIT_SPECIALTY_OPTIONS,
|
||||
QUARTER_OPTIONS,
|
||||
toPercentValue
|
||||
@@ -283,16 +307,7 @@ import {
|
||||
|
||||
defineOptions({ name: 'TjtOutputSplit' })
|
||||
|
||||
type AnnualCategoryKey =
|
||||
| 'projectManager'
|
||||
| 'engineeringLeader'
|
||||
| 'arch'
|
||||
| 'decor'
|
||||
| 'struct'
|
||||
| 'water'
|
||||
| 'elec'
|
||||
| 'hvac'
|
||||
| 'digital'
|
||||
type AnnualCategoryKey = (typeof OUTPUT_SPLIT_SPECIALTY)[keyof typeof OUTPUT_SPLIT_SPECIALTY]
|
||||
|
||||
interface QuarterYearRow {
|
||||
distributionYear: number
|
||||
@@ -300,15 +315,14 @@ interface QuarterYearRow {
|
||||
}
|
||||
|
||||
const annualCategoryOptions: { label: string; value: AnnualCategoryKey }[] = [
|
||||
{ label: '项目经理', value: 'projectManager' },
|
||||
{ label: '项目负责人', value: 'engineeringLeader' },
|
||||
{ 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()
|
||||
@@ -325,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>('projectManager')
|
||||
const selectedAnnualCategory = ref<AnnualCategoryKey>(OUTPUT_SPLIT_SPECIALTY.projectLead)
|
||||
const dialogVisible = ref(false)
|
||||
const queryFormRef = ref()
|
||||
const projectTableRef = ref()
|
||||
@@ -338,6 +352,9 @@ const queryParams = reactive<ProjectApi.ProjectPageReqVO>({
|
||||
projectStartYear: undefined
|
||||
})
|
||||
|
||||
const getProjectRowIndex = (index: number) =>
|
||||
(queryParams.pageNo - 1) * queryParams.pageSize + index + 1
|
||||
|
||||
const queryProjectStartYearValue = computed({
|
||||
get: () => (queryParams.projectStartYear ? String(queryParams.projectStartYear) : undefined),
|
||||
set: (value?: string) => {
|
||||
@@ -350,29 +367,33 @@ const toNumeric = (value?: number | string | null) => {
|
||||
return Number.isNaN(numericValue) ? 0 : numericValue
|
||||
}
|
||||
|
||||
const multiplyAmount = (...values: Array<number | string | null | undefined>) =>
|
||||
Number(values.reduce((result, value) => result * toNumeric(value), 1).toFixed(2))
|
||||
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 []
|
||||
}
|
||||
return [
|
||||
{
|
||||
key: 'projectManagerRatio',
|
||||
label: '项目经理',
|
||||
percentText: formatRatioText(model.projectManagerRatio),
|
||||
percent: toPercentValue(model.projectManagerRatio),
|
||||
amount: model.projectManagerAmount
|
||||
},
|
||||
{
|
||||
key: 'engineeringLeaderRatio',
|
||||
label: '项目负责人',
|
||||
percentText: formatRatioText(model.engineeringLeaderRatio),
|
||||
percent: toPercentValue(model.engineeringLeaderRatio),
|
||||
amount: model.engineeringLeaderAmount
|
||||
key: 'projectLeadRatio',
|
||||
label: '项目经理/工程负责人',
|
||||
percentText: formatRatioText(model.projectLeadRatio),
|
||||
percent: toPercentValue(model.projectLeadRatio),
|
||||
amount: model.projectLeadAmount
|
||||
},
|
||||
{
|
||||
key: 'officeRatio',
|
||||
@@ -400,8 +421,8 @@ const buildSpecialtyRows = (model?: OutputSplitApi.ProjectOutputSplitVO) => {
|
||||
return OUTPUT_SPLIT_SPECIALTY_OPTIONS.map((item) => ({
|
||||
key: `${item.value}Ratio`,
|
||||
label: item.label,
|
||||
percentText: formatRatioText((model as Record<string, number | undefined>)[`${item.value}Ratio`]),
|
||||
percent: toPercentValue((model as Record<string, number | undefined>)[`${item.value}Ratio`]),
|
||||
percentText: formatRatioText(getRatioValue(model, `${item.value}Ratio`)),
|
||||
percent: toPercentValue(getRatioValue(model, `${item.value}Ratio`)),
|
||||
amount: amountMap[item.value]
|
||||
}))
|
||||
}
|
||||
@@ -413,115 +434,24 @@ const editSpecialtyRatioItems = computed(() => buildSpecialtyRows(editForm.value
|
||||
|
||||
const annualCategoryMeta = computed(() => {
|
||||
const model = formData.value
|
||||
const currentOption =
|
||||
annualCategoryOptions.find((item) => item.value === selectedAnnualCategory.value) ||
|
||||
annualCategoryOptions[0]
|
||||
if (!model) {
|
||||
const option = annualCategoryOptions.find((item) => item.value === selectedAnnualCategory.value)
|
||||
if (!model || !option) {
|
||||
return { label: '-', ratio: 0, totalAmount: 0 }
|
||||
}
|
||||
if (selectedAnnualCategory.value === OUTPUT_SPLIT_SPECIALTY.projectLead) {
|
||||
const ratio = Number(toNumeric(model.projectLeadRatio).toFixed(4))
|
||||
return {
|
||||
label: currentOption.label,
|
||||
ratio: 0,
|
||||
percentText: '0.00%',
|
||||
totalAmount: 0,
|
||||
formulaText: '-'
|
||||
label: option.label,
|
||||
ratio,
|
||||
totalAmount: multiplyAmount(model.assessmentOutputValue, ratio)
|
||||
}
|
||||
}
|
||||
const officeRatio = toNumeric(model.officeRatio)
|
||||
const officeRatioText = formatRatioText(model.officeRatio)
|
||||
switch (selectedAnnualCategory.value) {
|
||||
case 'projectManager':
|
||||
return {
|
||||
label: currentOption.label,
|
||||
ratio: toNumeric(model.projectManagerRatio),
|
||||
percentText: formatRatioText(model.projectManagerRatio),
|
||||
totalAmount: toNumeric(model.projectManagerAmount),
|
||||
formulaText: `考核产值 × 项目经理比例 ${formatRatioText(model.projectManagerRatio)}`
|
||||
}
|
||||
case 'engineeringLeader':
|
||||
return {
|
||||
label: currentOption.label,
|
||||
ratio: toNumeric(model.engineeringLeaderRatio),
|
||||
percentText: formatRatioText(model.engineeringLeaderRatio),
|
||||
totalAmount: toNumeric(model.engineeringLeaderAmount),
|
||||
formulaText: `考核产值 × 项目负责人比例 ${formatRatioText(model.engineeringLeaderRatio)}`
|
||||
}
|
||||
case 'arch': {
|
||||
const ratio = Number((officeRatio * toNumeric(model.archRatio)).toFixed(4))
|
||||
return {
|
||||
label: currentOption.label,
|
||||
ratio,
|
||||
percentText: formatRatioText(ratio),
|
||||
totalAmount: toNumeric(model.archAmount),
|
||||
formulaText: `考核产值 × 专业所比例 ${officeRatioText} × 建筑专业比例 ${formatRatioText(model.archRatio)}`
|
||||
}
|
||||
}
|
||||
case 'decor': {
|
||||
const ratio = Number((officeRatio * toNumeric(model.decorRatio)).toFixed(4))
|
||||
return {
|
||||
label: currentOption.label,
|
||||
ratio,
|
||||
percentText: formatRatioText(ratio),
|
||||
totalAmount: toNumeric(model.decorAmount),
|
||||
formulaText: `考核产值 × 专业所比例 ${officeRatioText} × 装修专业比例 ${formatRatioText(model.decorRatio)}`
|
||||
}
|
||||
}
|
||||
case 'struct': {
|
||||
const ratio = Number((officeRatio * toNumeric(model.structRatio)).toFixed(4))
|
||||
return {
|
||||
label: currentOption.label,
|
||||
ratio,
|
||||
percentText: formatRatioText(ratio),
|
||||
totalAmount: toNumeric(model.structAmount),
|
||||
formulaText: `考核产值 × 专业所比例 ${officeRatioText} × 结构专业比例 ${formatRatioText(model.structRatio)}`
|
||||
}
|
||||
}
|
||||
case 'water': {
|
||||
const ratio = Number((officeRatio * toNumeric(model.waterRatio)).toFixed(4))
|
||||
return {
|
||||
label: currentOption.label,
|
||||
ratio,
|
||||
percentText: formatRatioText(ratio),
|
||||
totalAmount: toNumeric(model.waterAmount),
|
||||
formulaText: `考核产值 × 专业所比例 ${officeRatioText} × 水专业比例 ${formatRatioText(model.waterRatio)}`
|
||||
}
|
||||
}
|
||||
case 'elec': {
|
||||
const ratio = Number((officeRatio * toNumeric(model.elecRatio)).toFixed(4))
|
||||
return {
|
||||
label: currentOption.label,
|
||||
ratio,
|
||||
percentText: formatRatioText(ratio),
|
||||
totalAmount: toNumeric(model.elecAmount),
|
||||
formulaText: `考核产值 × 专业所比例 ${officeRatioText} × 电气专业比例 ${formatRatioText(model.elecRatio)}`
|
||||
}
|
||||
}
|
||||
case 'hvac': {
|
||||
const ratio = Number((officeRatio * toNumeric(model.hvacRatio)).toFixed(4))
|
||||
return {
|
||||
label: currentOption.label,
|
||||
ratio,
|
||||
percentText: formatRatioText(ratio),
|
||||
totalAmount: toNumeric(model.hvacAmount),
|
||||
formulaText: `考核产值 × 专业所比例 ${officeRatioText} × 暖通专业比例 ${formatRatioText(model.hvacRatio)}`
|
||||
}
|
||||
}
|
||||
case 'digital': {
|
||||
const ratio = Number((officeRatio * toNumeric(model.digitalRatio)).toFixed(4))
|
||||
return {
|
||||
label: currentOption.label,
|
||||
ratio,
|
||||
percentText: formatRatioText(ratio),
|
||||
totalAmount: toNumeric(model.digitalAmount),
|
||||
formulaText: `考核产值 × 专业所比例 ${officeRatioText} × 数字化设计专业比例 ${formatRatioText(model.digitalRatio)}`
|
||||
}
|
||||
}
|
||||
default:
|
||||
return {
|
||||
label: currentOption.label,
|
||||
ratio: 0,
|
||||
percentText: '0.00%',
|
||||
totalAmount: 0,
|
||||
formulaText: '-'
|
||||
}
|
||||
const specialtyRatio = toNumeric(getRatioValue(model, `${selectedAnnualCategory.value}Ratio`))
|
||||
const ratio = Number((toNumeric(model.officeRatio) * specialtyRatio).toFixed(4))
|
||||
return {
|
||||
label: option.label,
|
||||
ratio,
|
||||
totalAmount: multiplyAmount(model.assessmentOutputValue, ratio)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -553,8 +483,7 @@ const annualSummaryCards = computed(() => [
|
||||
currentPlanning.value?.assessmentOutputValue,
|
||||
currentPlanning.value?.totalDistributionAmount,
|
||||
annualCategoryMeta.value.ratio
|
||||
),
|
||||
percentText: formatRatioText(currentPlanning.value?.totalDistributionAmount)
|
||||
)
|
||||
},
|
||||
{
|
||||
label: '已分配',
|
||||
@@ -562,8 +491,7 @@ const annualSummaryCards = computed(() => [
|
||||
currentPlanning.value?.assessmentOutputValue,
|
||||
currentPlanning.value?.allocatedAmount,
|
||||
annualCategoryMeta.value.ratio
|
||||
),
|
||||
percentText: formatRatioText(currentPlanning.value?.allocatedAmount)
|
||||
)
|
||||
},
|
||||
{
|
||||
label: '待分配',
|
||||
@@ -571,8 +499,7 @@ const annualSummaryCards = computed(() => [
|
||||
currentPlanning.value?.assessmentOutputValue,
|
||||
currentPlanning.value?.pendingAmount,
|
||||
annualCategoryMeta.value.ratio
|
||||
),
|
||||
percentText: formatRatioText(currentPlanning.value?.pendingAmount)
|
||||
)
|
||||
}
|
||||
])
|
||||
|
||||
@@ -599,12 +526,7 @@ const recalculateOfficeRatio = () => {
|
||||
if (!editForm.value) {
|
||||
return
|
||||
}
|
||||
editForm.value.officeRatio = Number(
|
||||
Math.max(
|
||||
0,
|
||||
1 - Number(editForm.value.projectManagerRatio || 0) - Number(editForm.value.engineeringLeaderRatio || 0)
|
||||
).toFixed(4)
|
||||
)
|
||||
editForm.value.officeRatio = Number(Math.max(0, 1 - Number(editForm.value.projectLeadRatio || 0)).toFixed(4))
|
||||
}
|
||||
|
||||
const recalculateArchRatio = () => {
|
||||
@@ -691,7 +613,7 @@ const getPlanningList = async () => {
|
||||
planningLoading.value = true
|
||||
try {
|
||||
const list = await PlanningApi.getProjectPlanningListByProjectId(currentProject.value.id)
|
||||
planningList.value = list.filter((item) => isMajorOwnership(item.ownershipType))
|
||||
planningList.value = list
|
||||
if (!planningList.value.length) {
|
||||
currentPlanning.value = undefined
|
||||
formData.value = undefined
|
||||
@@ -714,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
|
||||
}
|
||||
@@ -771,7 +691,8 @@ const updateProjectRatio = (key: string, value?: number) => {
|
||||
if (!editForm.value || key === 'officeRatio') {
|
||||
return
|
||||
}
|
||||
;(editForm.value as Record<string, number | undefined>)[key] = fromPercentValue(value) ?? 0
|
||||
;(editForm.value as unknown as Record<string, number | undefined>)[key] =
|
||||
fromPercentValue(value) ?? 0
|
||||
recalculateOfficeRatio()
|
||||
}
|
||||
|
||||
@@ -779,7 +700,8 @@ const updateSpecialtyRatio = (key: string, value?: number) => {
|
||||
if (!editForm.value || key === 'archRatio') {
|
||||
return
|
||||
}
|
||||
;(editForm.value as Record<string, number | undefined>)[key] = fromPercentValue(value) ?? 0
|
||||
;(editForm.value as unknown as Record<string, number | undefined>)[key] =
|
||||
fromPercentValue(value) ?? 0
|
||||
recalculateArchRatio()
|
||||
}
|
||||
|
||||
@@ -788,19 +710,18 @@ const handleSave = async () => {
|
||||
return
|
||||
}
|
||||
if (Math.abs(projectRatioTotal.value - 100) >= 0.001) {
|
||||
message.warning('项目层比例合计必须等于100%')
|
||||
message.warning('项目层比例合计必须等于 100%')
|
||||
return
|
||||
}
|
||||
if (Math.abs(specialtyRatioTotal.value - 100) >= 0.001) {
|
||||
message.warning('专业层比例合计必须等于100%')
|
||||
message.warning('专业层比例合计必须等于 100%')
|
||||
return
|
||||
}
|
||||
saveLoading.value = true
|
||||
try {
|
||||
await OutputSplitApi.saveProjectOutputSplit({
|
||||
planningId: editForm.value.planningId,
|
||||
projectManagerRatio: editForm.value.projectManagerRatio,
|
||||
engineeringLeaderRatio: editForm.value.engineeringLeaderRatio,
|
||||
projectLeadRatio: editForm.value.projectLeadRatio,
|
||||
officeRatio: editForm.value.officeRatio,
|
||||
archRatio: editForm.value.archRatio,
|
||||
decorRatio: editForm.value.decorRatio,
|
||||
@@ -818,11 +739,38 @@ const handleSave = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
let activatedOnce = false
|
||||
|
||||
onMounted(() => {
|
||||
getProjectList()
|
||||
})
|
||||
|
||||
onActivated(() => {
|
||||
// KeepAlive 首次挂载也会触发 onActivated,跳过首轮避免重复请求项目与合约规划列表。
|
||||
if (!activatedOnce) {
|
||||
activatedOnce = true
|
||||
return
|
||||
}
|
||||
getProjectList()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.ratio-card {
|
||||
padding: 12px;
|
||||
border: 1px solid var(--el-border-color);
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.ratio-title {
|
||||
margin-bottom: 8px;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.ratio-amount {
|
||||
margin-top: 8px;
|
||||
font-size: 12px;
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
</style>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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,13 +201,19 @@ const buildQuarterCell = (
|
||||
|
||||
const buildQuarterRows = (
|
||||
planning: PlanningApi.ProjectPlanningVO,
|
||||
quarters: PlanningQuarterApi.ProjectPlanningQuarterVO[]
|
||||
quarters: PlanningQuarterApi.ProjectPlanningQuarterVO[],
|
||||
guideDetail?: PlanningQuarterApi.ProjectPlanningQuarterGuideDetailVO
|
||||
) => {
|
||||
const yearSet = new Set<number>()
|
||||
if (planning.planningStartYear) {
|
||||
yearSet.add(planning.planningStartYear)
|
||||
}
|
||||
quarters.forEach((item) => yearSet.add(item.distributionYear))
|
||||
quarters.forEach((item) => {
|
||||
const distributionYear = Number(item.distributionYear)
|
||||
if (!Number.isNaN(distributionYear)) {
|
||||
yearSet.add(distributionYear)
|
||||
}
|
||||
})
|
||||
if (yearSet.size === 0) {
|
||||
yearSet.add(new Date().getFullYear())
|
||||
}
|
||||
@@ -184,31 +222,75 @@ const buildQuarterRows = (
|
||||
.map((distributionYear) => ({
|
||||
distributionYear,
|
||||
quarters: QUARTER_OPTIONS.map((option) => {
|
||||
const quarterNo = Number(option.value)
|
||||
const match = quarters.find(
|
||||
(item) =>
|
||||
item.distributionYear === distributionYear && item.quarterNo === option.value
|
||||
Number(item.distributionYear) === distributionYear &&
|
||||
Number(item.quarterNo) === quarterNo &&
|
||||
Number(item.guideDetailId || 0) === Number(guideDetail?.id || 0)
|
||||
)
|
||||
return match
|
||||
? { ...match }
|
||||
: buildQuarterCell(planning.id!, distributionYear, option.value)
|
||||
: 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,
|
||||
contractValueUnitPrice: planning.contractValueUnitPrice ?? planning.planningAmount,
|
||||
vatRate: planning.vatRate ?? 0.06,
|
||||
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
|
||||
}
|
||||
@@ -229,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)
|
||||
)
|
||||
})
|
||||
}
|
||||
@@ -244,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) => {
|
||||
@@ -253,12 +359,19 @@ const updateDistributionYear = (row: QuarterYearRow, value?: string) => {
|
||||
})
|
||||
}
|
||||
|
||||
const getQuarterCell = (row: QuarterYearRow, quarterNo: number) => {
|
||||
return row.quarters.find((item) => Number(item.quarterNo) === Number(quarterNo))
|
||||
}
|
||||
|
||||
const toQuarterPercent = (row: QuarterYearRow, quarterNo: number) => {
|
||||
return toPercentValue(row.quarters[quarterNo - 1].distributionRatio)
|
||||
return toPercentValue(getQuarterCell(row, quarterNo)?.distributionRatio)
|
||||
}
|
||||
|
||||
const updateQuarterRatio = (row: QuarterYearRow, quarterNo: number, value?: number) => {
|
||||
const quarter = row.quarters[quarterNo - 1]
|
||||
const quarter = getQuarterCell(row, quarterNo)
|
||||
if (!quarter) {
|
||||
return
|
||||
}
|
||||
quarter.distributionRatio = fromPercentValue(value)
|
||||
quarter.distributionAmount = undefined
|
||||
}
|
||||
@@ -273,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
|
||||
@@ -301,11 +416,14 @@ const submitForm = async () => {
|
||||
await PlanningApi.updateProjectPlanning({
|
||||
id: formData.value.id,
|
||||
projectId: formData.value.projectId,
|
||||
sortNo: formData.value.sortNo,
|
||||
ownershipType: formData.value.ownershipType,
|
||||
calculationMethod: formData.value.calculationMethod,
|
||||
planningContent: formData.value.planningContent,
|
||||
planningAmount: formData.value.planningAmount,
|
||||
contractValueQuantity: formData.value.contractValueQuantity,
|
||||
contractValueUnitPrice: formData.value.contractValueUnitPrice,
|
||||
managementFeeRate: formData.value.managementFeeRate,
|
||||
vatRate: formData.value.vatRate,
|
||||
implementationTeam: formData.value.implementationTeam,
|
||||
planningStartYear: formData.value.planningStartYear,
|
||||
planningArea: formData.value.planningArea,
|
||||
@@ -326,7 +444,6 @@ const submitForm = async () => {
|
||||
workingDayUnitPrice: formData.value.workingDayUnitPrice,
|
||||
guidanceUnitPrice: formData.value.guidanceUnitPrice,
|
||||
guidanceTotalPrice: formData.value.guidanceTotalPrice,
|
||||
virtualTotalPrice: formData.value.virtualTotalPrice,
|
||||
calculationRatio: formData.value.calculationRatio
|
||||
})
|
||||
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
class="-mb-15px"
|
||||
label-width="88px"
|
||||
>
|
||||
<el-form-item label="工程名称" prop="projectName">
|
||||
<el-form-item label="项目名称" prop="projectName">
|
||||
<el-input
|
||||
v-model="queryParams.projectName"
|
||||
class="!w-240px"
|
||||
clearable
|
||||
placeholder="请输入工程名称"
|
||||
placeholder="请输入项目名称"
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
@@ -62,10 +62,16 @@
|
||||
highlight-current-row
|
||||
@current-change="handleCurrentProjectChange"
|
||||
>
|
||||
<el-table-column align="center" label="项目 ID" prop="id" width="88" />
|
||||
<el-table-column
|
||||
:index="getProjectRowIndex"
|
||||
align="center"
|
||||
label="序号"
|
||||
type="index"
|
||||
width="80"
|
||||
/>
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="工程名称"
|
||||
label="项目名称"
|
||||
min-width="220"
|
||||
prop="projectName"
|
||||
show-overflow-tooltip
|
||||
@@ -78,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>
|
||||
@@ -95,6 +101,7 @@
|
||||
prop="createTime"
|
||||
width="180"
|
||||
/>
|
||||
<el-table-column align="center" label="排序" prop="sortNo" width="80" />
|
||||
</el-table>
|
||||
<Pagination
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@@ -104,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">
|
||||
@@ -122,14 +129,22 @@
|
||||
>
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="规划内容"
|
||||
label="项目任务包"
|
||||
min-width="170"
|
||||
prop="planningContent"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column align="center" label="归属类型" prop="ownershipType" width="100" />
|
||||
<el-table-column align="center" label="计算方式" prop="calculationMethod" width="110" />
|
||||
<el-table-column align="center" label="规划金额(元)" width="120">
|
||||
<el-table-column align="center" label="归属类型" width="100">
|
||||
<template #default="scope">
|
||||
{{ getOwnershipTypeLabel(scope.row.ownershipType) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="计算方式" width="110">
|
||||
<template #default="scope">
|
||||
{{ getCalculationMethodLabel(scope.row.calculationMethod) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="分项合同产值(元)" width="120">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.planningAmount) }}
|
||||
</template>
|
||||
@@ -144,17 +159,25 @@
|
||||
{{ formatAmountText(scope.row.assessmentOutputValue) }}
|
||||
</template>
|
||||
</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>
|
||||
<div class="text-16px font-600">{{ currentPlanning.planningContent }}</div>
|
||||
<div class="mt-4px text-13px text-[var(--el-text-color-secondary)]">
|
||||
{{ currentPlanning.ownershipType }} / {{ currentPlanning.calculationMethod }}
|
||||
{{ getOwnershipTypeLabel(currentPlanning.ownershipType) }} /
|
||||
{{ getCalculationMethodLabel(currentPlanning.calculationMethod) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center gap-12px">
|
||||
@@ -177,15 +200,11 @@
|
||||
<Icon class="mr-5px" icon="ep:edit-pen" />
|
||||
编辑季度分配
|
||||
</el-button>
|
||||
<el-button v-if="false" @click="refreshCurrentPlanning">
|
||||
<Icon class="mr-5px" icon="ep:refresh" />
|
||||
刷新结果
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-descriptions :column="2" border title="测算参数">
|
||||
<el-descriptions-item label="规划金额(元)">
|
||||
<el-descriptions-item label="分项合同产值(元)">
|
||||
{{ formatAmountText(currentPlanning.planningAmount) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="管理费费率">
|
||||
@@ -194,7 +213,7 @@
|
||||
<el-descriptions-item label="管理费(元)">
|
||||
{{ formatAmountText(currentPlanning.managementFee) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="实施团队">
|
||||
<el-descriptions-item label="意向实施团队">
|
||||
{{ currentPlanning.implementationTeam || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="开始年度">
|
||||
@@ -207,7 +226,7 @@
|
||||
{{ formatAmountText(currentPlanning.contractUnitPrice) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="设计阶段">
|
||||
{{ currentPlanning.designStage || '-' }}
|
||||
{{ getDesignStageLabel(currentPlanning.designStage) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="本次设计阶段比例">
|
||||
{{ formatPercentText(currentPlanning.currentDesignStageRatio) }}
|
||||
@@ -222,25 +241,25 @@
|
||||
{{ formatPercentText(currentPlanning.calculationRatio) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item
|
||||
v-if="currentPlanning.buildingOrUnitCount"
|
||||
v-if="showParentBuildingOrUnitCount"
|
||||
label="楼栋数/户型数"
|
||||
>
|
||||
{{ currentPlanning.buildingOrUnitCount }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item v-if="showMajorFactorFields" label="套图系数">
|
||||
<el-descriptions-item v-if="showParentMajorFactorFields" label="套图系数">
|
||||
{{ formatFactorText(currentPlanning.drawingSetFactor, 2) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item v-if="showMajorFactorFields" label="规模系数">
|
||||
<el-descriptions-item v-if="showParentMajorFactorFields" label="规模系数">
|
||||
{{ formatFactorText(currentPlanning.scaleFactor, 2) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item v-if="showMajorFactorFields" label="修改系数">
|
||||
<el-descriptions-item v-if="showParentMajorFactorFields" label="修改系数">
|
||||
{{ formatFactorText(currentPlanning.modificationFactor, 2) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item v-if="showMajorFactorFields" label="复杂系数/复杂等级">
|
||||
<el-descriptions-item v-if="showParentMajorFactorFields" label="复杂系数/复杂等级">
|
||||
{{ formatPercentText(currentPlanning.complexityFactor) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item
|
||||
v-if="currentPlanning.internalGuidanceUnitPrice"
|
||||
v-if="showParentInternalGuidanceUnitPrice"
|
||||
label="内部指导单价(元/㎡)"
|
||||
>
|
||||
{{ formatAmountText(currentPlanning.internalGuidanceUnitPrice) }}
|
||||
@@ -249,17 +268,17 @@
|
||||
v-if="currentPlanning.virtualCalculationMethod"
|
||||
label="虚拟产值计算方式"
|
||||
>
|
||||
{{ currentPlanning.virtualCalculationMethod }}
|
||||
{{ getVirtualCalculationMethodLabel(currentPlanning.virtualCalculationMethod) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item v-if="currentPlanning.guidanceUnitPrice" label="指导单价(元)">
|
||||
<el-descriptions-item
|
||||
v-if="currentPlanning.guidanceUnitPrice"
|
||||
label="指导单价(元/㎡)"
|
||||
>
|
||||
{{ formatAmountText(currentPlanning.guidanceUnitPrice) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item v-if="currentPlanning.guidanceTotalPrice" label="指导总价(元)">
|
||||
{{ formatAmountText(currentPlanning.guidanceTotalPrice) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item v-if="currentPlanning.virtualTotalPrice" label="虚拟总价(元)">
|
||||
{{ formatAmountText(currentPlanning.virtualTotalPrice) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item v-if="currentPlanning.workingDayCount" label="工日">
|
||||
{{ formatAmountText(currentPlanning.workingDayCount) }}
|
||||
</el-descriptions-item>
|
||||
@@ -269,7 +288,7 @@
|
||||
</el-descriptions>
|
||||
|
||||
<el-descriptions :column="2" border class="mt-16px" title="计算结果">
|
||||
<el-descriptions-item label="合计调整系数">
|
||||
<el-descriptions-item v-if="!showGuideDetailScene" label="合计调整系数">
|
||||
{{ formatFactorText(currentPlanning.totalAdjustmentFactor) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="考核面积(㎡)">
|
||||
@@ -288,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>
|
||||
@@ -315,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>
|
||||
@@ -323,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>
|
||||
@@ -337,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"
|
||||
@@ -359,8 +453,8 @@
|
||||
<ContentWrap v-else>
|
||||
<el-empty description="请选择合约规划后查看测算结果和季度分配" />
|
||||
</ContentWrap>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
</SplitPane>
|
||||
|
||||
<PlanningOutputForm ref="planningOutputFormRef" @success="handlePlanningOutputFormSuccess" />
|
||||
<QuarterDistributionForm
|
||||
@@ -376,13 +470,20 @@ 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,
|
||||
formatAmountText,
|
||||
formatAreaText,
|
||||
formatPercentText,
|
||||
getCalculationMethodLabel,
|
||||
getCalculationRatioLabel,
|
||||
getDesignPartLabel,
|
||||
getDesignStageLabel,
|
||||
getOwnershipTypeLabel,
|
||||
getVirtualCalculationMethodLabel,
|
||||
isComprehensiveOwnership,
|
||||
isContractPriceMethod,
|
||||
isGuidancePriceMethod,
|
||||
@@ -397,6 +498,11 @@ interface QuarterYearRow {
|
||||
quarters: PlanningQuarterApi.ProjectPlanningQuarterVO[]
|
||||
}
|
||||
|
||||
interface GuideDetailQuarterRow extends PlanningQuarterApi.ProjectPlanningQuarterGuideDetailVO {
|
||||
tabKey: string
|
||||
quarterRows: QuarterYearRow[]
|
||||
}
|
||||
|
||||
const message = useMessage()
|
||||
|
||||
const loading = ref(false)
|
||||
@@ -408,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,
|
||||
@@ -420,6 +531,9 @@ const queryParams = reactive<ProjectApi.ProjectPageReqVO>({
|
||||
projectStartYear: undefined
|
||||
})
|
||||
|
||||
const getProjectRowIndex = (index: number) =>
|
||||
(queryParams.pageNo - 1) * queryParams.pageSize + index + 1
|
||||
|
||||
const queryProjectStartYearValue = computed({
|
||||
get: () => (queryParams.projectStartYear ? String(queryParams.projectStartYear) : undefined),
|
||||
set: (value?: string) => {
|
||||
@@ -435,22 +549,49 @@ const showCalculationRatioField = computed(
|
||||
isComprehensiveOwnership(currentPlanning.value?.ownershipType) ||
|
||||
isSubcontractOwnership(currentPlanning.value?.ownershipType)
|
||||
)
|
||||
const showMajorFactorFields = computed(
|
||||
const showGuideDetailScene = computed(
|
||||
() =>
|
||||
isMajorOwnership(currentPlanning.value?.ownershipType) &&
|
||||
(isGuidancePriceMethod(currentPlanning.value?.calculationMethod) ||
|
||||
isContractPriceMethod(currentPlanning.value?.calculationMethod))
|
||||
isGuidancePriceMethod(currentPlanning.value?.calculationMethod)
|
||||
)
|
||||
const showParentMajorFactorFields = computed(
|
||||
() =>
|
||||
isMajorOwnership(currentPlanning.value?.ownershipType) &&
|
||||
isContractPriceMethod(currentPlanning.value?.calculationMethod)
|
||||
)
|
||||
const showParentBuildingOrUnitCount = computed(
|
||||
() =>
|
||||
showParentMajorFactorFields.value &&
|
||||
currentPlanning.value?.buildingOrUnitCount !== undefined &&
|
||||
currentPlanning.value?.buildingOrUnitCount !== null
|
||||
)
|
||||
const showParentInternalGuidanceUnitPrice = computed(
|
||||
() =>
|
||||
!showGuideDetailScene.value &&
|
||||
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) {
|
||||
return Number(0).toFixed(digits)
|
||||
return '-'
|
||||
}
|
||||
return Number(value).toFixed(digits)
|
||||
}
|
||||
|
||||
const getQuarterCell = (row: QuarterYearRow, quarterNo: number) => {
|
||||
return row.quarters.find((item) => Number(item.quarterNo) === Number(quarterNo))
|
||||
}
|
||||
|
||||
const formatQuarterRatio = (row: QuarterYearRow, quarterNo: number) => {
|
||||
return formatPercentText(row.quarters[quarterNo - 1]?.distributionRatio)
|
||||
return formatPercentText(getQuarterCell(row, quarterNo)?.distributionRatio)
|
||||
}
|
||||
|
||||
const buildQuarterRows = (
|
||||
@@ -461,7 +602,12 @@ const buildQuarterRows = (
|
||||
if (planning.planningStartYear) {
|
||||
yearSet.add(planning.planningStartYear)
|
||||
}
|
||||
quarters.forEach((item) => yearSet.add(item.distributionYear))
|
||||
quarters.forEach((item) => {
|
||||
const distributionYear = Number(item.distributionYear)
|
||||
if (!Number.isNaN(distributionYear)) {
|
||||
yearSet.add(distributionYear)
|
||||
}
|
||||
})
|
||||
if (yearSet.size === 0) {
|
||||
yearSet.add(new Date().getFullYear())
|
||||
}
|
||||
@@ -470,15 +616,17 @@ const buildQuarterRows = (
|
||||
.map((distributionYear) => ({
|
||||
distributionYear,
|
||||
quarters: QUARTER_OPTIONS.map((option) => {
|
||||
const quarterNo = Number(option.value)
|
||||
const match = quarters.find(
|
||||
(item) =>
|
||||
item.distributionYear === distributionYear && item.quarterNo === option.value
|
||||
Number(item.distributionYear) === distributionYear &&
|
||||
Number(item.quarterNo) === quarterNo
|
||||
)
|
||||
return (
|
||||
match || {
|
||||
planningId: planning.id!,
|
||||
distributionYear,
|
||||
quarterNo: option.value,
|
||||
quarterNo,
|
||||
distributionRatio: undefined,
|
||||
distributionAmount: undefined
|
||||
}
|
||||
@@ -487,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 {
|
||||
@@ -497,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
|
||||
@@ -514,7 +676,7 @@ const getPlanningList = async () => {
|
||||
if (!currentProject.value?.id) {
|
||||
planningList.value = []
|
||||
currentPlanning.value = undefined
|
||||
quarterRows.value = []
|
||||
cancelQuarterDetailState()
|
||||
return
|
||||
}
|
||||
planningLoading.value = true
|
||||
@@ -522,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
|
||||
@@ -536,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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -558,27 +741,25 @@ 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)
|
||||
}
|
||||
|
||||
const refreshCurrentPlanning = async () => {
|
||||
if (!currentPlanning.value?.id) {
|
||||
return
|
||||
}
|
||||
await loadPlanningDetail(currentPlanning.value.id)
|
||||
await getPlanningList()
|
||||
}
|
||||
|
||||
const planningOutputFormRef = ref()
|
||||
const quarterDistributionFormRef = ref()
|
||||
|
||||
@@ -590,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 () => {
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
class="-mb-15px"
|
||||
label-width="88px"
|
||||
>
|
||||
<el-form-item label="工程名称" prop="projectName">
|
||||
<el-form-item label="项目名称" prop="projectName">
|
||||
<el-input
|
||||
v-model="queryParams.projectName"
|
||||
class="!w-240px"
|
||||
clearable
|
||||
placeholder="请输入工程名称"
|
||||
placeholder="请输入项目名称"
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
@@ -63,12 +63,13 @@
|
||||
@current-change="handleCurrentProfitChange"
|
||||
>
|
||||
<el-table-column
|
||||
:index="getProjectRowIndex"
|
||||
align="center"
|
||||
label="工程名称"
|
||||
min-width="220"
|
||||
prop="projectName"
|
||||
show-overflow-tooltip
|
||||
label="序号"
|
||||
type="index"
|
||||
width="80"
|
||||
/>
|
||||
<el-table-column align="center" label="项目名称" min-width="220" prop="projectName" />
|
||||
<el-table-column align="center" label="是否签约" width="100">
|
||||
<template #default="scope">
|
||||
<el-tag :type="scope.row.contractSignedFlag ? 'success' : 'info'">
|
||||
@@ -77,55 +78,81 @@
|
||||
</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="预计 K 值" width="100">
|
||||
<el-table-column align="center" label="专项分包(综合所成本)(元)" width="220">
|
||||
<template #default="scope">
|
||||
{{ formatPercentText(scope.row.expectedKValue) }}
|
||||
{{ formatAmountText(scope.row.comprehensiveSubcontractPlanningAmount) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="专业所预计绩效(元)" width="150">
|
||||
<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="120">
|
||||
<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) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="科创产值(元)" width="130">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.innovationOutputValue) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="其他成本(元)" width="130">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.otherCost) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<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) }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="排序" prop="sortNo" width="80" />
|
||||
</el-table>
|
||||
<Pagination
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@@ -135,71 +162,291 @@
|
||||
/>
|
||||
</ContentWrap>
|
||||
|
||||
<ContentWrap v-if="currentProfit">
|
||||
<div class="mb-16px flex items-center justify-between gap-16px">
|
||||
<div>
|
||||
<div class="text-16px font-600">{{ currentProfit.projectName }}</div>
|
||||
</div>
|
||||
<div class="flex items-center gap-12px">
|
||||
<el-button plain type="primary" @click="openProfitEditDialog">
|
||||
<Icon class="mr-5px" icon="ep:edit" />
|
||||
编辑盈亏参数
|
||||
</el-button>
|
||||
<el-button @click="refreshCurrentProfit">
|
||||
<Icon class="mr-5px" icon="ep:refresh" />
|
||||
刷新详情
|
||||
</el-button>
|
||||
</div>
|
||||
<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="预计 K 值">
|
||||
{{ formatPercentText(currentProfit.expectedKValue) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="专业所预计绩效(元)">
|
||||
{{ formatAmountText(currentProfit.majorExpectedPerformance) }}
|
||||
</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-item label="创建时间">
|
||||
{{ currentProfit.createTime || '-' }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</ContentWrap>
|
||||
|
||||
<ContentWrap v-else>
|
||||
<el-empty description="请选择项目后查看盈亏详情" />
|
||||
</ContentWrap>
|
||||
|
||||
<Dialog v-model="dialogVisible" title="编辑盈亏参数" width="520">
|
||||
<el-form ref="formRef" v-loading="dialogLoading" :model="formData" :rules="formRules" label-width="140px">
|
||||
<el-form-item label="最终结算金额(元)" prop="finalSettlementAmount">
|
||||
<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-input-number
|
||||
v-model="formData.finalSettlementAmount"
|
||||
:min="0"
|
||||
@@ -209,17 +456,29 @@
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="预计 K 值(%)" prop="expectedKValue">
|
||||
<el-form-item label="科创产值比例(%)" prop="innovationOutputRate">
|
||||
<el-input-number
|
||||
v-model="expectedKValuePercent"
|
||||
v-model="innovationOutputRatePercent"
|
||||
:min="0"
|
||||
:max="100"
|
||||
:precision="2"
|
||||
:step="0.01"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="其他成本(元)" prop="otherCost">
|
||||
<el-input-number
|
||||
v-model="formData.otherCost"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="1000"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<template #footer>
|
||||
<el-button :disabled="dialogLoading" type="primary" @click="submitProfitForm">保存</el-button>
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
@@ -228,16 +487,17 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { FormRules } from 'element-plus'
|
||||
import * as ProfitApi from '@/api/tjt/profit'
|
||||
import * as ProjectApi from '@/api/tjt/project'
|
||||
import {
|
||||
CONTRACT_SIGN_OPTIONS,
|
||||
DEFAULT_INNOVATION_OUTPUT_RATE,
|
||||
formatAmountText,
|
||||
formatPercentText,
|
||||
fromPercentValue,
|
||||
toPercentValue
|
||||
} from '@/views/tjt/shared/planning'
|
||||
import { formatDate } from '@/utils/formatTime'
|
||||
|
||||
defineOptions({ name: 'TjtProfit' })
|
||||
|
||||
@@ -245,28 +505,47 @@ 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)
|
||||
const formRef = ref()
|
||||
const formData = ref<ProjectApi.ProjectVO>({
|
||||
projectName: '',
|
||||
contractSignedFlag: true
|
||||
contractSignedFlag: true,
|
||||
innovationOutputRate: DEFAULT_INNOVATION_OUTPUT_RATE,
|
||||
otherCost: 0,
|
||||
rolePersons: []
|
||||
})
|
||||
|
||||
const expectedKValuePercent = computed({
|
||||
get: () => toPercentValue(formData.value.expectedKValue),
|
||||
const innovationOutputRatePercent = computed({
|
||||
get: () => toPercentValue(formData.value.innovationOutputRate),
|
||||
set: (value) => {
|
||||
formData.value.expectedKValue = fromPercentValue(value)
|
||||
formData.value.innovationOutputRate = fromPercentValue(value)
|
||||
}
|
||||
})
|
||||
|
||||
const formRules = reactive<FormRules>({})
|
||||
const normalizeProjectFormData = (data: ProjectApi.ProjectVO): ProjectApi.ProjectVO => ({
|
||||
...data,
|
||||
innovationOutputRate: data.innovationOutputRate ?? DEFAULT_INNOVATION_OUTPUT_RATE,
|
||||
otherCost: data.otherCost ?? 0,
|
||||
rolePersons: data.rolePersons || []
|
||||
})
|
||||
|
||||
const queryParams = reactive<ProfitApi.ProjectProfitPageReqVO>({
|
||||
pageNo: 1,
|
||||
@@ -276,6 +555,9 @@ const queryParams = reactive<ProfitApi.ProjectProfitPageReqVO>({
|
||||
projectStartYear: undefined
|
||||
})
|
||||
|
||||
const getProjectRowIndex = (index: number) =>
|
||||
(queryParams.pageNo - 1) * queryParams.pageSize + index + 1
|
||||
|
||||
const queryProjectStartYearValue = computed({
|
||||
get: () => (queryParams.projectStartYear ? String(queryParams.projectStartYear) : undefined),
|
||||
set: (value?: string) => {
|
||||
@@ -283,24 +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 = () => {
|
||||
@@ -318,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
|
||||
@@ -336,7 +707,7 @@ const openProfitEditDialog = async () => {
|
||||
dialogVisible.value = true
|
||||
dialogLoading.value = true
|
||||
try {
|
||||
formData.value = await ProjectApi.getProject(currentProfit.value.projectId)
|
||||
formData.value = normalizeProjectFormData(await ProjectApi.getProject(currentProfit.value.projectId))
|
||||
} finally {
|
||||
dialogLoading.value = false
|
||||
}
|
||||
@@ -352,22 +723,19 @@ const buildProjectSavePayload = (): ProjectApi.ProjectSaveVO => ({
|
||||
contactName: formData.value.contactName,
|
||||
contactPhone: formData.value.contactPhone,
|
||||
contractSigningDate: formData.value.contractSigningDate,
|
||||
projectManagerName: formData.value.projectManagerName,
|
||||
engineeringPrincipalName: formData.value.engineeringPrincipalName,
|
||||
projectType: formData.value.projectType,
|
||||
projectCategory: formData.value.projectCategory,
|
||||
projectStartYear: formData.value.projectStartYear,
|
||||
projectStatus: formData.value.projectStatus,
|
||||
pauseReason: formData.value.pauseReason,
|
||||
terminateReason: formData.value.terminateReason,
|
||||
finalSettlementAmount: formData.value.finalSettlementAmount,
|
||||
expectedKValue: formData.value.expectedKValue
|
||||
innovationOutputRate: formData.value.innovationOutputRate,
|
||||
otherCost: formData.value.otherCost,
|
||||
rolePersons: formData.value.rolePersons || []
|
||||
})
|
||||
|
||||
const submitProfitForm = async () => {
|
||||
if (!formRef.value) {
|
||||
return
|
||||
}
|
||||
const valid = await formRef.value.validate()
|
||||
if (!valid) {
|
||||
return
|
||||
}
|
||||
dialogLoading.value = true
|
||||
try {
|
||||
await ProjectApi.updateProject(buildProjectSavePayload())
|
||||
@@ -389,11 +757,59 @@ const profitLossClass = (value?: number) => {
|
||||
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>
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
<template>
|
||||
<Dialog v-model="dialogVisible" :title="dialogTitle" width="920">
|
||||
<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)]">
|
||||
页面一只维护合约规划的基础参数,测算参数与季度分配请在页面二维护。
|
||||
</div>
|
||||
<Dialog v-model="dialogVisible" :title="dialogTitle" width="980">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
v-loading="formLoading"
|
||||
@@ -20,7 +17,7 @@
|
||||
placeholder="请选择归属类型"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in OWNERSHIP_TYPE_OPTIONS"
|
||||
v-for="item in ownershipTypeOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
@@ -29,31 +26,11 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="产值计算方式" prop="calculationMethod">
|
||||
<el-select
|
||||
v-model="formData.calculationMethod"
|
||||
:disabled="formType === 'update'"
|
||||
class="!w-1/1"
|
||||
placeholder="请选择产值计算方式"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in CALCULATION_METHOD_OPTIONS"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="规划内容" prop="planningContent">
|
||||
<el-form-item label="项目任务包" prop="planningContent">
|
||||
<el-input
|
||||
v-model="formData.planningContent"
|
||||
maxlength="255"
|
||||
placeholder="请输入规划内容"
|
||||
placeholder="请输入项目任务包"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -61,19 +38,71 @@
|
||||
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="规划金额(元)" prop="planningAmount">
|
||||
<el-form-item label="合同产值数量" prop="contractValueQuantity">
|
||||
<el-input-number
|
||||
v-model="formData.planningAmount"
|
||||
v-model="formData.contractValueQuantity"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="1000"
|
||||
:precision="4"
|
||||
:step="1"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="管理费费率(%)" prop="managementFeeRate">
|
||||
<el-form-item label="合同产值单价" prop="contractValueUnitPrice">
|
||||
<el-input-number
|
||||
v-model="formData.contractValueUnitPrice"
|
||||
:min="0"
|
||||
:precision="4"
|
||||
:step="1000"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="分项合同产值(元)">
|
||||
<el-input :model-value="planningAmountPreview" class="readonly-result" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="意向实施团队" prop="implementationTeam">
|
||||
<el-input
|
||||
v-model="formData.implementationTeam"
|
||||
maxlength="100"
|
||||
placeholder="请输入意向实施团队"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="增值税率(%)" prop="vatRate">
|
||||
<el-input-number
|
||||
v-model="vatRatePercent"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="0.01"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="增值税(元)">
|
||||
<el-input :model-value="vatAmountPreview" class="readonly-result" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="管理费率(%)" prop="managementFeeRate">
|
||||
<el-input-number
|
||||
v-model="managementFeeRatePercent"
|
||||
:min="0"
|
||||
@@ -84,20 +113,30 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="管理费(元)">
|
||||
<el-input :model-value="managementFeePreview" class="readonly-result" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="管理费(元)">
|
||||
<el-input :model-value="managementFeePreview" disabled />
|
||||
<el-form-item label="项目预算产值(元)">
|
||||
<el-input
|
||||
:model-value="projectBudgetOutputValuePreview"
|
||||
class="budget-result"
|
||||
disabled
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="实施团队" prop="implementationTeam">
|
||||
<el-form-item label="排序" prop="sortNo">
|
||||
<el-input
|
||||
v-model="formData.implementationTeam"
|
||||
maxlength="100"
|
||||
placeholder="请输入实施团队"
|
||||
v-model="formData.sortNo"
|
||||
maxlength="50"
|
||||
placeholder="请输入排序,如 A-01"
|
||||
class="!w-1/1"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -113,23 +152,19 @@
|
||||
<script lang="ts" setup>
|
||||
import type { FormRules } from 'element-plus'
|
||||
import * as PlanningApi from '@/api/tjt/planning'
|
||||
import {
|
||||
CALCULATION_METHOD_OPTIONS,
|
||||
OWNERSHIP_TYPE_OPTIONS,
|
||||
formatAmountText,
|
||||
fromPercentValue,
|
||||
toPercentValue
|
||||
} from '@/views/tjt/shared/planning'
|
||||
import { OWNERSHIP_TYPE_OPTIONS } from '@/views/tjt/shared/planning'
|
||||
|
||||
defineOptions({ name: 'TjtPlanningForm' })
|
||||
|
||||
const ownershipTypeOptions = OWNERSHIP_TYPE_OPTIONS
|
||||
|
||||
const { t } = useI18n()
|
||||
const message = useMessage()
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const dialogTitle = ref('')
|
||||
const formLoading = ref(false)
|
||||
const formType = ref('')
|
||||
const formType = ref<'create' | 'update'>('create')
|
||||
const formRef = ref()
|
||||
|
||||
const createFormData = (
|
||||
@@ -137,12 +172,18 @@ const createFormData = (
|
||||
planningAmount?: number
|
||||
): PlanningApi.ProjectPlanningVO => ({
|
||||
projectId: projectId || 0,
|
||||
ownershipType: OWNERSHIP_TYPE_OPTIONS[0].value,
|
||||
calculationMethod: CALCULATION_METHOD_OPTIONS[0].value,
|
||||
sortNo: '',
|
||||
ownershipType: ownershipTypeOptions[0].value,
|
||||
calculationMethod: '',
|
||||
planningContent: '',
|
||||
planningAmount,
|
||||
contractValueQuantity: 1,
|
||||
contractValueUnitPrice: planningAmount,
|
||||
managementFeeRate: undefined,
|
||||
implementationTeam: '',
|
||||
vatRate: 0.06,
|
||||
vatAmount: undefined,
|
||||
projectBudgetOutputValue: undefined,
|
||||
planningStartYear: undefined,
|
||||
planningArea: undefined,
|
||||
designStage: undefined,
|
||||
@@ -151,6 +192,8 @@ const createFormData = (
|
||||
reviewOutsourceRatio: undefined,
|
||||
totalDistributionAmount: 1,
|
||||
progressRemark: '',
|
||||
allocatedAmount: undefined,
|
||||
pendingAmount: undefined,
|
||||
buildingOrUnitCount: undefined,
|
||||
drawingSetFactor: 1,
|
||||
scaleFactor: 1,
|
||||
@@ -162,42 +205,92 @@ const createFormData = (
|
||||
workingDayUnitPrice: undefined,
|
||||
guidanceUnitPrice: undefined,
|
||||
guidanceTotalPrice: undefined,
|
||||
virtualTotalPrice: undefined,
|
||||
calculationRatio: undefined
|
||||
calculationRatio: undefined,
|
||||
contractUnitPrice: undefined,
|
||||
totalAdjustmentFactor: undefined,
|
||||
assessmentArea: undefined,
|
||||
virtualOutputValue: undefined,
|
||||
assessmentOutputValue: undefined
|
||||
})
|
||||
|
||||
const formData = ref<PlanningApi.ProjectPlanningVO>(createFormData())
|
||||
|
||||
const managementFeeRatePercent = computed({
|
||||
get: () => toPercentValue(formData.value.managementFeeRate),
|
||||
set: (value) => {
|
||||
formData.value.managementFeeRate = fromPercentValue(value)
|
||||
get: () => {
|
||||
if (formData.value.managementFeeRate === undefined || formData.value.managementFeeRate === null) {
|
||||
return undefined
|
||||
}
|
||||
return Number((Number(formData.value.managementFeeRate) * 100).toFixed(2))
|
||||
},
|
||||
set: (value?: number) => {
|
||||
formData.value.managementFeeRate =
|
||||
value === undefined || value === null ? undefined : Number((value / 100).toFixed(4))
|
||||
}
|
||||
})
|
||||
|
||||
const managementFeePreview = computed(() => {
|
||||
const planningAmount = Number(formData.value.planningAmount || 0)
|
||||
const managementFeeRate = Number(formData.value.managementFeeRate || 0)
|
||||
return formatAmountText(planningAmount * managementFeeRate)
|
||||
const vatRatePercent = computed({
|
||||
get: () => {
|
||||
if (formData.value.vatRate === undefined || formData.value.vatRate === null) {
|
||||
return undefined
|
||||
}
|
||||
return Number((Number(formData.value.vatRate) * 100).toFixed(2))
|
||||
},
|
||||
set: (value?: number) => {
|
||||
formData.value.vatRate =
|
||||
value === undefined || value === null ? undefined : Number((value / 100).toFixed(4))
|
||||
}
|
||||
})
|
||||
|
||||
const planningAmountPreviewValue = computed(() => {
|
||||
const quantity = Number(formData.value.contractValueQuantity || 0)
|
||||
const unitPrice = Number(formData.value.contractValueUnitPrice || 0)
|
||||
return Number((quantity * unitPrice).toFixed(2))
|
||||
})
|
||||
|
||||
const planningAmountPreview = computed(() => planningAmountPreviewValue.value.toFixed(2))
|
||||
|
||||
const managementFeePreview = computed(() => {
|
||||
const managementFeeRate = Number(formData.value.managementFeeRate || 0)
|
||||
return (planningAmountPreviewValue.value * managementFeeRate).toFixed(2)
|
||||
})
|
||||
|
||||
const vatAmountPreview = computed(() => {
|
||||
const vatRate = Number(formData.value.vatRate || 0)
|
||||
return (planningAmountPreviewValue.value * vatRate).toFixed(2)
|
||||
})
|
||||
|
||||
const projectBudgetOutputValuePreview = computed(() =>
|
||||
(
|
||||
planningAmountPreviewValue.value -
|
||||
Number(managementFeePreview.value || 0) -
|
||||
Number(vatAmountPreview.value || 0)
|
||||
).toFixed(2)
|
||||
)
|
||||
|
||||
const normalizeOwnershipType = (value?: string) =>
|
||||
ownershipTypeOptions.find((item) => item.value === value)?.value || ownershipTypeOptions[0].value
|
||||
|
||||
const formRules = reactive<FormRules>({
|
||||
projectId: [{ required: true, message: '请选择所属项目', trigger: 'change' }],
|
||||
ownershipType: [{ required: true, message: '归属类型不能为空', trigger: 'change' }],
|
||||
calculationMethod: [{ required: true, message: '产值计算方式不能为空', trigger: 'change' }],
|
||||
planningContent: [{ required: true, message: '规划内容不能为空', trigger: 'blur' }],
|
||||
planningAmount: [{ required: true, message: '规划金额不能为空', trigger: 'blur' }],
|
||||
managementFeeRate: [{ required: true, message: '管理费费率不能为空', trigger: 'blur' }]
|
||||
planningContent: [{ required: true, message: '项目任务包不能为空', trigger: 'blur' }],
|
||||
contractValueQuantity: [{ required: true, message: '合同产值数量不能为空', trigger: 'blur' }],
|
||||
contractValueUnitPrice: [{ required: true, message: '合同产值单价不能为空', trigger: 'blur' }],
|
||||
managementFeeRate: [{ required: true, message: '管理费率不能为空', trigger: 'blur' }],
|
||||
vatRate: [{ required: true, message: '增值税率不能为空', trigger: 'blur' }]
|
||||
})
|
||||
|
||||
const buildSavePayload = (): PlanningApi.ProjectPlanningSaveVO => ({
|
||||
id: formData.value.id,
|
||||
projectId: formData.value.projectId,
|
||||
sortNo: formData.value.sortNo?.trim() || undefined,
|
||||
ownershipType: formData.value.ownershipType,
|
||||
calculationMethod: formData.value.calculationMethod,
|
||||
planningContent: formData.value.planningContent,
|
||||
planningAmount: formData.value.planningAmount,
|
||||
contractValueQuantity: formData.value.contractValueQuantity,
|
||||
contractValueUnitPrice: formData.value.contractValueUnitPrice,
|
||||
managementFeeRate: formData.value.managementFeeRate,
|
||||
vatRate: formData.value.vatRate,
|
||||
implementationTeam: formData.value.implementationTeam,
|
||||
planningStartYear: formData.value.planningStartYear,
|
||||
planningArea: formData.value.planningArea,
|
||||
@@ -218,12 +311,11 @@ const buildSavePayload = (): PlanningApi.ProjectPlanningSaveVO => ({
|
||||
workingDayUnitPrice: formData.value.workingDayUnitPrice,
|
||||
guidanceUnitPrice: formData.value.guidanceUnitPrice,
|
||||
guidanceTotalPrice: formData.value.guidanceTotalPrice,
|
||||
virtualTotalPrice: formData.value.virtualTotalPrice,
|
||||
calculationRatio: formData.value.calculationRatio
|
||||
})
|
||||
|
||||
const open = async (
|
||||
type: string,
|
||||
type: 'create' | 'update',
|
||||
options: {
|
||||
id?: number
|
||||
projectId?: number
|
||||
@@ -231,7 +323,7 @@ const open = async (
|
||||
} = {}
|
||||
) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = t('action.' + type)
|
||||
dialogTitle.value = type === 'create' ? '新增合约规划' : '编辑合约规划'
|
||||
formType.value = type
|
||||
resetForm(options.projectId, options.defaultPlanningAmount)
|
||||
if (!options.id) {
|
||||
@@ -239,7 +331,16 @@ const open = async (
|
||||
}
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await PlanningApi.getProjectPlanning(options.id)
|
||||
const planning = await PlanningApi.getProjectPlanning(options.id)
|
||||
formData.value = {
|
||||
...createFormData(options.projectId, options.defaultPlanningAmount),
|
||||
...planning,
|
||||
ownershipType: normalizeOwnershipType(planning.ownershipType),
|
||||
contractValueQuantity: planning.contractValueQuantity ?? 1,
|
||||
contractValueUnitPrice:
|
||||
planning.contractValueUnitPrice ?? planning.planningAmount ?? options.defaultPlanningAmount,
|
||||
vatRate: planning.vatRate ?? 0.06
|
||||
}
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
@@ -278,3 +379,19 @@ const resetForm = (projectId?: number, planningAmount?: number) => {
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.readonly-result :deep(.el-input__wrapper.is-disabled) {
|
||||
background-color: var(--el-fill-color-light);
|
||||
}
|
||||
|
||||
.budget-result :deep(.el-input__wrapper.is-disabled) {
|
||||
background-color: var(--el-color-primary-light-9);
|
||||
box-shadow: 0 0 0 1px var(--el-color-primary-light-5) inset;
|
||||
}
|
||||
|
||||
.budget-result :deep(.el-input__inner) {
|
||||
color: var(--el-color-primary);
|
||||
font-weight: 700;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -5,135 +5,264 @@
|
||||
v-loading="formLoading"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="120px"
|
||||
label-width="130px"
|
||||
>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="工程名称" prop="projectName">
|
||||
<el-input v-model="formData.projectName" maxlength="200" placeholder="请输入工程名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="是否签订合同" prop="contractSignedFlag">
|
||||
<el-switch
|
||||
v-model="formData.contractSignedFlag"
|
||||
active-text="已签订"
|
||||
inactive-text="未签订"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="合同金额(元)" prop="contractAmount">
|
||||
<el-input-number
|
||||
v-model="formData.contractAmount"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="1000"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="工程总面积(㎡)" prop="totalConstructionArea">
|
||||
<el-input-number
|
||||
v-model="formData.totalConstructionArea"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="100"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="建设单位" prop="constructionUnitName">
|
||||
<el-input
|
||||
v-model="formData.constructionUnitName"
|
||||
maxlength="200"
|
||||
placeholder="请输入建设单位"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="工程类型" prop="projectType">
|
||||
<el-select
|
||||
v-model="formData.projectType"
|
||||
class="!w-1/1"
|
||||
clearable
|
||||
placeholder="请选择工程类型"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in PROJECT_TYPE_OPTIONS"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
<div class="form-section">
|
||||
<div class="form-section-title">项目基础信息</div>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="项目名称" prop="projectName">
|
||||
<el-input v-model="formData.projectName" maxlength="200" placeholder="请输入项目名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="建筑面积(㎡)" prop="totalConstructionArea">
|
||||
<el-input-number
|
||||
v-model="formData.totalConstructionArea"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="100"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="联系人" prop="contactName">
|
||||
<el-input v-model="formData.contactName" maxlength="64" placeholder="请输入联系人" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="联系方式" prop="contactPhone">
|
||||
<el-input v-model="formData.contactPhone" maxlength="32" placeholder="请输入联系方式" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="合同签订日期" prop="contractSigningDate">
|
||||
<el-date-picker
|
||||
v-model="formData.contractSigningDate"
|
||||
class="!w-1/1"
|
||||
placeholder="请选择合同签订日期"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="项目开始年度" prop="projectStartYear">
|
||||
<el-date-picker
|
||||
v-model="projectStartYearValue"
|
||||
class="!w-1/1"
|
||||
placeholder="请选择项目开始年度"
|
||||
type="year"
|
||||
value-format="YYYY"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="项目经理" prop="projectManagerName">
|
||||
<el-input
|
||||
v-model="formData.projectManagerName"
|
||||
maxlength="64"
|
||||
placeholder="请输入项目经理"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="工程负责人" prop="engineeringPrincipalName">
|
||||
<el-input
|
||||
v-model="formData.engineeringPrincipalName"
|
||||
maxlength="64"
|
||||
placeholder="请输入工程负责人"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="建设单位" prop="constructionUnitName">
|
||||
<el-input
|
||||
v-model="formData.constructionUnitName"
|
||||
maxlength="200"
|
||||
placeholder="请输入建设单位"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="工程类型" prop="projectType">
|
||||
<el-select v-model="formData.projectType" class="!w-1/1" clearable placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in PROJECT_TYPE_OPTIONS"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="设计类型" prop="projectCategory">
|
||||
<el-select
|
||||
v-model="formData.projectCategory"
|
||||
class="!w-1/1"
|
||||
clearable
|
||||
placeholder="请选择"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in PROJECT_CATEGORY_OPTIONS"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
|
||||
<div class="form-section">
|
||||
<div class="form-section-title">合同与财务信息</div>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="合同状态" prop="contractSignedFlag" required>
|
||||
<el-radio-group v-model="formData.contractSignedFlag">
|
||||
<el-radio :value="true">已签订</el-radio>
|
||||
<el-radio :value="false">未签订</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="合同总产值(元)" prop="contractAmount">
|
||||
<el-input-number
|
||||
v-model="formData.contractAmount"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="1000"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="签订日期" prop="contractSigningDate">
|
||||
<el-date-picker
|
||||
v-model="formData.contractSigningDate"
|
||||
class="!w-1/1"
|
||||
placeholder="请选择日期"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
|
||||
<div class="form-section">
|
||||
<div class="form-section-title">状态与进度</div>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="项目状态" prop="projectStatus">
|
||||
<el-select
|
||||
v-model="formData.projectStatus"
|
||||
class="!w-1/1"
|
||||
clearable
|
||||
placeholder="请选择项目状态"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in PROJECT_STATUS_OPTIONS"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="开始年度" prop="projectStartYear">
|
||||
<el-date-picker
|
||||
v-model="projectStartYearValue"
|
||||
class="!w-1/1"
|
||||
placeholder="请选择年度"
|
||||
type="year"
|
||||
value-format="YYYY"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="statusReasonLabel" :prop="statusReasonProp">
|
||||
<el-input
|
||||
v-if="formData.projectStatus === PROJECT_STATUS.paused"
|
||||
v-model="formData.pauseReason"
|
||||
maxlength="255"
|
||||
placeholder="请输入暂停原因"
|
||||
/>
|
||||
<el-input
|
||||
v-else-if="formData.projectStatus === PROJECT_STATUS.terminated"
|
||||
v-model="formData.terminateReason"
|
||||
maxlength="255"
|
||||
placeholder="请输入中止原因"
|
||||
/>
|
||||
<el-input v-else disabled placeholder="进行中或完成状态无需填写原因" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="排序" prop="sortNo">
|
||||
<el-input
|
||||
v-model="formData.sortNo"
|
||||
maxlength="50"
|
||||
placeholder="请输入排序,如 A-01"
|
||||
class="!w-1/1"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
|
||||
<div class="form-section">
|
||||
<div class="form-section-title">人员与建设单位联系信息</div>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="建设单位联系人" prop="contactName">
|
||||
<el-input v-model="formData.contactName" maxlength="64" placeholder="请输入建设单位联系人" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="建设单位联系电话" prop="contactPhone">
|
||||
<el-input v-model="formData.contactPhone" maxlength="32" placeholder="请输入建设单位联系电话" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="项目经理">
|
||||
<div class="person-group">
|
||||
<div
|
||||
v-for="(item, index) in projectManagerPersons"
|
||||
:key="`manager-${index}`"
|
||||
class="person-row"
|
||||
>
|
||||
<el-select
|
||||
:model-value="item.employeeId"
|
||||
class="!w-1/1"
|
||||
clearable
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
placeholder="请输入项目经理姓名搜索"
|
||||
:remote-method="searchEmployees"
|
||||
:loading="employeeLoading"
|
||||
@change="(value) => handleEmployeeChange(item, value)"
|
||||
>
|
||||
<el-option
|
||||
v-for="employee in employeeOptions"
|
||||
:key="employee.id"
|
||||
:label="employee.officeName ? `${employee.employeeName} / ${employee.officeName}` : employee.employeeName"
|
||||
:value="employee.id"
|
||||
/>
|
||||
</el-select>
|
||||
<el-button text type="danger" @click="removeRolePerson(ROLE_PROJECT_MANAGER, index)">
|
||||
删除
|
||||
</el-button>
|
||||
</div>
|
||||
<el-button text type="primary" @click="addRolePerson(ROLE_PROJECT_MANAGER)">
|
||||
<Icon class="mr-5px" icon="ep:plus" />
|
||||
添加项目经理
|
||||
</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="工程负责人">
|
||||
<div class="person-group">
|
||||
<div
|
||||
v-for="(item, index) in engineeringPrincipalPersons"
|
||||
:key="`principal-${index}`"
|
||||
class="person-row"
|
||||
>
|
||||
<el-select
|
||||
:model-value="item.employeeId"
|
||||
class="!w-1/1"
|
||||
clearable
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
placeholder="请输入工程负责人姓名搜索"
|
||||
:remote-method="searchEmployees"
|
||||
:loading="employeeLoading"
|
||||
@change="(value) => handleEmployeeChange(item, value)"
|
||||
>
|
||||
<el-option
|
||||
v-for="employee in employeeOptions"
|
||||
:key="employee.id"
|
||||
:label="employee.officeName ? `${employee.employeeName} / ${employee.officeName}` : employee.employeeName"
|
||||
:value="employee.id"
|
||||
/>
|
||||
</el-select>
|
||||
<el-button
|
||||
text
|
||||
type="danger"
|
||||
@click="removeRolePerson(ROLE_ENGINEERING_PRINCIPAL, index)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</div>
|
||||
<el-button text type="primary" @click="addRolePerson(ROLE_ENGINEERING_PRINCIPAL)">
|
||||
<Icon class="mr-5px" icon="ep:plus" />
|
||||
添加工程负责人
|
||||
</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-form>
|
||||
|
||||
<template #footer>
|
||||
<el-button :disabled="formLoading" type="primary" @click="submitForm">保存</el-button>
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
@@ -143,22 +272,44 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { FormRules } from 'element-plus'
|
||||
import * as EmployeeApi from '@/api/tjt/employee'
|
||||
import * as ProjectApi from '@/api/tjt/project'
|
||||
import { PROJECT_TYPE_OPTIONS } from '@/views/tjt/shared/planning'
|
||||
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 = OUTPUT_SPLIT_ROLE.projectManager
|
||||
const ROLE_ENGINEERING_PRINCIPAL = OUTPUT_SPLIT_ROLE.engineeringPrincipal
|
||||
|
||||
const { t } = useI18n()
|
||||
const message = useMessage()
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const dialogTitle = ref('')
|
||||
const formLoading = ref(false)
|
||||
const formType = ref('')
|
||||
const formType = ref<'create' | 'update'>('create')
|
||||
const formRef = ref()
|
||||
const employeeOptions = ref<EmployeeApi.EmployeeSimpleVO[]>([])
|
||||
const employeeLoading = ref(false)
|
||||
|
||||
const createRolePerson = (
|
||||
roleCode: ProjectApi.ProjectRolePersonVO['roleCode']
|
||||
): ProjectApi.ProjectRolePersonVO => ({
|
||||
roleCode,
|
||||
employeeId: undefined,
|
||||
employeeName: ''
|
||||
})
|
||||
|
||||
const createFormData = (): ProjectApi.ProjectVO => ({
|
||||
projectName: '',
|
||||
sortNo: '',
|
||||
contractSignedFlag: true,
|
||||
contractAmount: undefined,
|
||||
totalConstructionArea: undefined,
|
||||
@@ -166,14 +317,99 @@ const createFormData = (): ProjectApi.ProjectVO => ({
|
||||
contactName: '',
|
||||
contactPhone: '',
|
||||
contractSigningDate: undefined,
|
||||
projectManagerName: '',
|
||||
engineeringPrincipalName: '',
|
||||
projectType: '',
|
||||
projectStartYear: new Date().getFullYear()
|
||||
projectCategory: '',
|
||||
projectStartYear: new Date().getFullYear(),
|
||||
projectStatus: PROJECT_STATUS.inProgress,
|
||||
pauseReason: '',
|
||||
terminateReason: '',
|
||||
innovationOutputRate: DEFAULT_INNOVATION_OUTPUT_RATE,
|
||||
otherCost: 0,
|
||||
rolePersons: []
|
||||
})
|
||||
|
||||
const formData = ref<ProjectApi.ProjectVO>(createFormData())
|
||||
|
||||
const normalizeValue = (value: string | undefined, options: Array<{ value: string }>, fallback = '') =>
|
||||
options.find((item) => item.value === value)?.value || fallback
|
||||
|
||||
const normalizeFormData = (data: ProjectApi.ProjectVO): ProjectApi.ProjectVO => ({
|
||||
...createFormData(),
|
||||
...data,
|
||||
projectType: normalizeValue(data.projectType, PROJECT_TYPE_OPTIONS),
|
||||
projectCategory: normalizeValue(data.projectCategory, PROJECT_CATEGORY_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 || '',
|
||||
terminateReason: data.terminateReason || '',
|
||||
rolePersons: (data.rolePersons || []).map((item) => ({
|
||||
roleCode: item.roleCode,
|
||||
employeeId: item.employeeId,
|
||||
employeeName: item.employeeName,
|
||||
sortNo: item.sortNo
|
||||
}))
|
||||
})
|
||||
|
||||
const getRolePersons = (roleCode: ProjectApi.ProjectRolePersonVO['roleCode']) => {
|
||||
if (!formData.value.rolePersons) {
|
||||
formData.value.rolePersons = []
|
||||
}
|
||||
return formData.value.rolePersons.filter((item) => item.roleCode === roleCode)
|
||||
}
|
||||
|
||||
const projectManagerPersons = computed(() => getRolePersons(ROLE_PROJECT_MANAGER))
|
||||
const engineeringPrincipalPersons = computed(() => getRolePersons(ROLE_ENGINEERING_PRINCIPAL))
|
||||
|
||||
const addRolePerson = (roleCode: ProjectApi.ProjectRolePersonVO['roleCode']) => {
|
||||
formData.value.rolePersons = [...(formData.value.rolePersons || []), createRolePerson(roleCode)]
|
||||
}
|
||||
|
||||
const removeRolePerson = (roleCode: ProjectApi.ProjectRolePersonVO['roleCode'], index: number) => {
|
||||
const roleIndexes = (formData.value.rolePersons || [])
|
||||
.map((item, itemIndex) => ({ item, itemIndex }))
|
||||
.filter(({ item }) => item.roleCode === roleCode)
|
||||
const target = roleIndexes[index]
|
||||
if (!target) {
|
||||
return
|
||||
}
|
||||
formData.value.rolePersons?.splice(target.itemIndex, 1)
|
||||
}
|
||||
|
||||
const ensureEmployeeOptions = (persons?: ProjectApi.ProjectRolePersonVO[]) => {
|
||||
const existingIds = new Set(employeeOptions.value.map((item) => item.id))
|
||||
;(persons || []).forEach((item) => {
|
||||
if (!item.employeeId || existingIds.has(item.employeeId)) {
|
||||
return
|
||||
}
|
||||
employeeOptions.value.push({
|
||||
id: item.employeeId,
|
||||
employeeName: item.employeeName || '',
|
||||
officeId: undefined,
|
||||
officeName: undefined
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const searchEmployees = async (keyword: string) => {
|
||||
employeeLoading.value = true
|
||||
try {
|
||||
employeeOptions.value = await EmployeeApi.getEmployeeSimpleList({
|
||||
keyword,
|
||||
enabledFlag: true
|
||||
})
|
||||
ensureEmployeeOptions(formData.value.rolePersons)
|
||||
} finally {
|
||||
employeeLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleEmployeeChange = (item: ProjectApi.ProjectRolePersonVO, employeeId?: number) => {
|
||||
const employee = employeeOptions.value.find((option) => option.id === employeeId)
|
||||
item.employeeId = employeeId
|
||||
item.employeeName = employee?.employeeName || ''
|
||||
}
|
||||
|
||||
const projectStartYearValue = computed({
|
||||
get: () => (formData.value.projectStartYear ? String(formData.value.projectStartYear) : undefined),
|
||||
set: (value?: string) => {
|
||||
@@ -181,16 +417,61 @@ const projectStartYearValue = computed({
|
||||
}
|
||||
})
|
||||
|
||||
const statusReasonLabel = computed(() =>
|
||||
formData.value.projectStatus === PROJECT_STATUS.terminated ? '中止原因' : '暂停原因'
|
||||
)
|
||||
|
||||
const statusReasonProp = computed(() =>
|
||||
formData.value.projectStatus === PROJECT_STATUS.terminated ? 'terminateReason' : 'pauseReason'
|
||||
)
|
||||
|
||||
watch(
|
||||
() => formData.value.projectStatus,
|
||||
(status) => {
|
||||
if (status !== PROJECT_STATUS.paused) {
|
||||
formData.value.pauseReason = ''
|
||||
}
|
||||
if (status !== PROJECT_STATUS.terminated) {
|
||||
formData.value.terminateReason = ''
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
const formRules = reactive<FormRules>({
|
||||
projectName: [{ required: true, message: '工程名称不能为空', trigger: 'blur' }],
|
||||
contractAmount: [{ required: true, message: '合同金额不能为空', trigger: 'blur' }],
|
||||
totalConstructionArea: [{ required: true, message: '工程总面积不能为空', trigger: 'blur' }],
|
||||
projectStartYear: [{ required: true, message: '项目开始年度不能为空', trigger: 'change' }]
|
||||
projectName: [{ 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 === PROJECT_STATUS.paused && !String(value || '').trim()) {
|
||||
callback(new Error('暂停状态必须填写暂停原因'))
|
||||
return
|
||||
}
|
||||
callback()
|
||||
},
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
terminateReason: [
|
||||
{
|
||||
validator: (_rule, value, callback) => {
|
||||
if (formData.value.projectStatus === PROJECT_STATUS.terminated && !String(value || '').trim()) {
|
||||
callback(new Error('中止状态必须填写中止原因'))
|
||||
return
|
||||
}
|
||||
callback()
|
||||
},
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
const open = async (type: string, id?: number) => {
|
||||
const open = async (type: 'create' | 'update', id?: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = t('action.' + type)
|
||||
dialogTitle.value = type === 'create' ? '新增项目' : '编辑项目'
|
||||
formType.value = type
|
||||
resetForm()
|
||||
if (!id) {
|
||||
@@ -198,7 +479,8 @@ const open = async (type: string, id?: number) => {
|
||||
}
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await ProjectApi.getProject(id)
|
||||
formData.value = normalizeFormData(await ProjectApi.getProject(id))
|
||||
ensureEmployeeOptions(formData.value.rolePersons)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
@@ -210,6 +492,7 @@ const emit = defineEmits(['success'])
|
||||
const buildSavePayload = (): ProjectApi.ProjectSaveVO => ({
|
||||
id: formData.value.id,
|
||||
projectName: formData.value.projectName,
|
||||
sortNo: formData.value.sortNo?.trim() || undefined,
|
||||
contractSignedFlag: formData.value.contractSignedFlag,
|
||||
contractAmount: formData.value.contractAmount,
|
||||
totalConstructionArea: formData.value.totalConstructionArea,
|
||||
@@ -217,12 +500,23 @@ const buildSavePayload = (): ProjectApi.ProjectSaveVO => ({
|
||||
contactName: formData.value.contactName,
|
||||
contactPhone: formData.value.contactPhone,
|
||||
contractSigningDate: formData.value.contractSigningDate,
|
||||
projectManagerName: formData.value.projectManagerName,
|
||||
engineeringPrincipalName: formData.value.engineeringPrincipalName,
|
||||
projectType: formData.value.projectType,
|
||||
projectCategory: formData.value.projectCategory,
|
||||
projectStartYear: formData.value.projectStartYear,
|
||||
projectStatus: formData.value.projectStatus,
|
||||
pauseReason: formData.value.pauseReason?.trim() || undefined,
|
||||
terminateReason: formData.value.terminateReason?.trim() || undefined,
|
||||
finalSettlementAmount: formData.value.finalSettlementAmount,
|
||||
expectedKValue: formData.value.expectedKValue
|
||||
innovationOutputRate: formData.value.innovationOutputRate,
|
||||
otherCost: formData.value.otherCost,
|
||||
rolePersons: (formData.value.rolePersons || [])
|
||||
.map((item, index) => ({
|
||||
roleCode: item.roleCode,
|
||||
employeeId: item.employeeId,
|
||||
employeeName: item.employeeName?.trim() || undefined,
|
||||
sortNo: index + 1
|
||||
}))
|
||||
.filter((item) => !!item.employeeId)
|
||||
})
|
||||
|
||||
const submitForm = async () => {
|
||||
@@ -252,6 +546,38 @@ const submitForm = async () => {
|
||||
|
||||
const resetForm = () => {
|
||||
formData.value = createFormData()
|
||||
employeeOptions.value = []
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.form-section {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.form-section:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.form-section-title {
|
||||
margin-bottom: 12px;
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
line-height: 22px;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
|
||||
.person-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.person-row {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
grid-template-columns: minmax(0, 1fr) 56px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
class="-mb-15px"
|
||||
label-width="88px"
|
||||
>
|
||||
<el-form-item label="工程名称" prop="projectName">
|
||||
<el-form-item label="项目名称" prop="projectName">
|
||||
<el-input
|
||||
v-model="queryParams.projectName"
|
||||
class="!w-240px"
|
||||
clearable
|
||||
placeholder="请输入工程名称"
|
||||
placeholder="请输入项目名称"
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
@@ -24,7 +24,7 @@
|
||||
placeholder="请选择"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in CONTRACT_SIGN_OPTIONS"
|
||||
v-for="item in contractSignOptions"
|
||||
:key="String(item.value)"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
@@ -41,6 +41,21 @@
|
||||
value-format="YYYY"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="项目状态" prop="projectStatus">
|
||||
<el-select
|
||||
v-model="queryParams.projectStatus"
|
||||
class="!w-180px"
|
||||
clearable
|
||||
placeholder="请选择项目状态"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in projectStatusOptions"
|
||||
:key="String(item.value)"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-date-picker
|
||||
v-model="queryParams.createTime"
|
||||
@@ -82,39 +97,40 @@
|
||||
highlight-current-row
|
||||
@current-change="handleCurrentProjectChange"
|
||||
>
|
||||
<el-table-column align="center" label="项目 ID" prop="id" width="88" />
|
||||
<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="140" prop="projectManagerName" />
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="工程名称"
|
||||
min-width="220"
|
||||
prop="projectName"
|
||||
show-overflow-tooltip
|
||||
label="工程负责人"
|
||||
min-width="140"
|
||||
prop="engineeringPrincipalName"
|
||||
/>
|
||||
<el-table-column align="center" label="是否签约" width="100">
|
||||
<el-table-column align="center" label="开始年度" prop="projectStartYear" width="110" />
|
||||
<el-table-column align="center" label="项目状态" width="110">
|
||||
<template #default="scope">
|
||||
<el-tag :type="scope.row.contractSignedFlag ? 'success' : 'info'">
|
||||
{{ scope.row.contractSignedFlag ? '已签订' : '未签订' }}
|
||||
<el-tag :type="projectStatusTagType(scope.row.projectStatus)">
|
||||
{{ getProjectStatusText(scope.row.projectStatus) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="合同金额(元)" width="130">
|
||||
<el-table-column align="center" label="是否封档" width="90">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.contractAmount) }}
|
||||
{{ scope.row.archiveFlag ? '是' : '否' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="工程总面积(㎡)" width="140">
|
||||
<el-table-column align="center" label="创建时间" prop="createTime" width="180">
|
||||
<template #default="scope">
|
||||
{{ formatAreaText(scope.row.totalConstructionArea) }}
|
||||
{{ formatDate(scope.row.createTime as any) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="项目开始年度" prop="projectStartYear" width="120" />
|
||||
<el-table-column
|
||||
:formatter="dateFormatter"
|
||||
align="center"
|
||||
label="创建时间"
|
||||
prop="createTime"
|
||||
width="180"
|
||||
/>
|
||||
<el-table-column align="center" label="排序" prop="sortNo" width="80" />
|
||||
<el-table-column align="center" fixed="right" label="操作" width="150">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
@@ -149,50 +165,74 @@
|
||||
<div>
|
||||
<div class="text-16px font-600">{{ currentProject.projectName }}</div>
|
||||
<div class="mt-4px text-13px text-[var(--el-text-color-secondary)]">
|
||||
建设单位:{{ currentProject.constructionUnitName || '-' }},
|
||||
项目经理:{{ currentProject.projectManagerName || '-' }},
|
||||
工程负责人:{{ currentProject.engineeringPrincipalName || '-' }}
|
||||
建设单位:{{ currentProject.constructionUnitName || '-' }},项目经理:{{
|
||||
currentProject.projectManagerName || '-'
|
||||
}},工程负责人:{{ currentProject.engineeringPrincipalName || '-' }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center gap-12px">
|
||||
<el-button
|
||||
v-hasPermi="['tjt:planning:create']"
|
||||
plain
|
||||
type="primary"
|
||||
@click="openPlanningForm('create')"
|
||||
>
|
||||
<Icon class="mr-5px" icon="ep:plus" />
|
||||
新增合约规划
|
||||
</el-button>
|
||||
<el-button @click="getPlanningList">
|
||||
<Icon class="mr-5px" icon="ep:refresh" />
|
||||
刷新规划
|
||||
</el-button>
|
||||
</div>
|
||||
<el-button
|
||||
v-hasPermi="['tjt:planning:create']"
|
||||
plain
|
||||
type="primary"
|
||||
@click="openPlanningForm('create')"
|
||||
>
|
||||
<Icon class="mr-5px" icon="ep:plus" />
|
||||
新增合约规划
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="8">
|
||||
<el-descriptions :column="1" border title="项目概况">
|
||||
<el-descriptions-item label="工程名称">
|
||||
{{ currentProject.projectName }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="项目名称">{{ currentProject.projectName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="工程类型">
|
||||
{{ currentProject.projectType || '-' }}
|
||||
{{ getProjectTypeText(currentProject.projectType) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="设计类型">
|
||||
{{ getProjectCategoryText(currentProject.projectCategory) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="合同签订日期">
|
||||
{{ currentProject.contractSigningDate || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="联系人">
|
||||
<el-descriptions-item label="建设单位联系人">
|
||||
{{ currentProject.contactName || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="联系方式">
|
||||
<el-descriptions-item label="建设单位联系电话">
|
||||
{{ currentProject.contactPhone || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="合同金额(元)">
|
||||
<el-descriptions-item label="项目状态">
|
||||
{{ getProjectStatusText(currentProject.projectStatus) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="封档时间">
|
||||
{{ currentProject.archiveTime ? formatDate(currentProject.archiveTime as any) : '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item
|
||||
v-if="normalizeProjectStatus(currentProject.projectStatus) === pausedStatusValue"
|
||||
label="暂停原因"
|
||||
>
|
||||
{{ currentProject.pauseReason || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item
|
||||
v-if="normalizeProjectStatus(currentProject.projectStatus) === terminatedStatusValue"
|
||||
label="中止原因"
|
||||
>
|
||||
{{ currentProject.terminateReason || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="合同总产值(元)">
|
||||
{{ formatAmountText(currentProject.contractAmount) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="工程总面积(㎡)">
|
||||
<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>
|
||||
@@ -200,21 +240,35 @@
|
||||
|
||||
<el-col :span="16">
|
||||
<el-table v-loading="planningLoading" :data="planningList">
|
||||
<el-table-column align="center" label="序号" type="index" width="70" />
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="规划内容"
|
||||
min-width="200"
|
||||
label="项目任务包"
|
||||
min-width="260"
|
||||
prop="planningContent"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column align="center" label="归属类型" prop="ownershipType" width="100" />
|
||||
<el-table-column align="center" label="计算方式" prop="calculationMethod" width="110" />
|
||||
<el-table-column align="center" label="规划金额(元)" width="130">
|
||||
<el-table-column align="center" label="归属类型" width="100">
|
||||
<template #default="scope">
|
||||
{{ getOwnershipTypeText(scope.row.ownershipType) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="合同产值数量" width="130">
|
||||
<template #default="scope">
|
||||
{{ scope.row.contractValueQuantity ?? '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="合同产值单价" width="130">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.contractValueUnitPrice) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="分项合同产值(元)" width="130">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.planningAmount) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="管理费费率" width="110">
|
||||
<el-table-column align="center" label="管理费率" width="110">
|
||||
<template #default="scope">
|
||||
{{ formatPercentText(scope.row.managementFeeRate) }}
|
||||
</template>
|
||||
@@ -224,13 +278,29 @@
|
||||
{{ formatAmountText(scope.row.managementFee) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="增值税率" width="100">
|
||||
<template #default="scope">
|
||||
{{ formatPercentText(scope.row.vatRate) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="增值税(元)" width="120">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.vatAmount) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="项目预算产值(元)" width="140">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.projectBudgetOutputValue) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="实施团队"
|
||||
label="意向实施团队"
|
||||
min-width="140"
|
||||
prop="implementationTeam"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column align="center" label="排序" prop="sortNo" width="80" />
|
||||
<el-table-column align="center" fixed="right" label="操作" width="140">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
@@ -265,16 +335,21 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import { formatDate } from '@/utils/formatTime'
|
||||
import * as ProjectApi from '@/api/tjt/project'
|
||||
import * as PlanningApi from '@/api/tjt/planning'
|
||||
import ProjectForm from './ProjectForm.vue'
|
||||
import PlanningForm from './PlanningForm.vue'
|
||||
import {
|
||||
CONTRACT_SIGN_OPTIONS,
|
||||
OWNERSHIP_TYPE_OPTIONS,
|
||||
PROJECT_CATEGORY_OPTIONS,
|
||||
PROJECT_STATUS_OPTIONS,
|
||||
PROJECT_TYPE_OPTIONS,
|
||||
formatAmountText,
|
||||
formatAreaText,
|
||||
formatPercentText
|
||||
formatPercentText,
|
||||
normalizeProjectStatus
|
||||
} from '@/views/tjt/shared/planning'
|
||||
|
||||
defineOptions({ name: 'TjtProject' })
|
||||
@@ -282,6 +357,48 @@ defineOptions({ name: 'TjtProject' })
|
||||
const message = useMessage()
|
||||
const { t } = useI18n()
|
||||
|
||||
const cleanOptionLabels = <T,>(options: Array<{ label: string; value: T }>, labels: string[]) =>
|
||||
options.map((item, index) => ({
|
||||
label: labels[index] || item.label,
|
||||
value: item.value
|
||||
}))
|
||||
|
||||
const contractSignOptions = cleanOptionLabels(CONTRACT_SIGN_OPTIONS, ['已签约', '未签约'])
|
||||
const ownershipTypeOptions = OWNERSHIP_TYPE_OPTIONS
|
||||
const projectTypeOptions = cleanOptionLabels(PROJECT_TYPE_OPTIONS, [
|
||||
'建筑工程',
|
||||
'精装工程',
|
||||
'综合工程',
|
||||
'专项设计',
|
||||
'BIM设计',
|
||||
'其他'
|
||||
])
|
||||
const projectCategoryOptions = cleanOptionLabels(PROJECT_CATEGORY_OPTIONS, [
|
||||
'住宅',
|
||||
'公建',
|
||||
'工业',
|
||||
'园林景观',
|
||||
'其他'
|
||||
])
|
||||
const projectStatusOptions = cleanOptionLabels(PROJECT_STATUS_OPTIONS, [
|
||||
'进行中',
|
||||
'已完成',
|
||||
'已暂停',
|
||||
'已中止'
|
||||
])
|
||||
|
||||
const completedStatusValue = projectStatusOptions[1]?.value
|
||||
const pausedStatusValue = projectStatusOptions[2]?.value
|
||||
const terminatedStatusValue = projectStatusOptions[3]?.value
|
||||
|
||||
const getOptionLabel = <T,>(options: Array<{ label: string; value: T }>, value?: T) =>
|
||||
options.find((item) => item.value === value)?.label || '-'
|
||||
|
||||
const getOwnershipTypeText = (value?: string) => getOptionLabel(ownershipTypeOptions, value)
|
||||
const getProjectTypeText = (value?: string) => getOptionLabel(projectTypeOptions, value)
|
||||
const getProjectCategoryText = (value?: string) => getOptionLabel(projectCategoryOptions, value)
|
||||
const getProjectStatusText = (value?: string) => getOptionLabel(projectStatusOptions, value)
|
||||
|
||||
const loading = ref(false)
|
||||
const planningLoading = ref(false)
|
||||
const total = ref(0)
|
||||
@@ -297,9 +414,53 @@ const queryParams = reactive<ProjectApi.ProjectPageReqVO>({
|
||||
projectName: undefined,
|
||||
contractSignedFlag: undefined,
|
||||
projectStartYear: undefined,
|
||||
projectStatus: undefined,
|
||||
createTime: []
|
||||
})
|
||||
|
||||
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) => {
|
||||
@@ -307,6 +468,20 @@ const queryProjectStartYearValue = computed({
|
||||
}
|
||||
})
|
||||
|
||||
const projectStatusTagType = (status?: string) => {
|
||||
const normalizedStatus = normalizeProjectStatus(status)
|
||||
if (normalizedStatus === completedStatusValue) {
|
||||
return 'success'
|
||||
}
|
||||
if (normalizedStatus === pausedStatusValue) {
|
||||
return 'warning'
|
||||
}
|
||||
if (normalizedStatus === terminatedStatusValue) {
|
||||
return 'danger'
|
||||
}
|
||||
return 'primary'
|
||||
}
|
||||
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
@@ -356,7 +531,7 @@ const handleCurrentProjectChange = async (row?: ProjectApi.ProjectVO) => {
|
||||
}
|
||||
|
||||
const projectFormRef = ref()
|
||||
const openProjectForm = (type: string, id?: number) => {
|
||||
const openProjectForm = (type: 'create' | 'update', id?: number) => {
|
||||
projectFormRef.value.open(type, id)
|
||||
}
|
||||
|
||||
@@ -402,13 +577,18 @@ const handlePlanningFormSuccess = async () => {
|
||||
await getPlanningList()
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await getList()
|
||||
await getPlanningList()
|
||||
let activatedOnce = false
|
||||
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
|
||||
onActivated(async () => {
|
||||
await getList()
|
||||
await getPlanningList()
|
||||
onActivated(() => {
|
||||
// KeepAlive 首次挂载也会触发 onActivated,跳过首轮避免重复请求列表。
|
||||
if (!activatedOnce) {
|
||||
activatedOnce = true
|
||||
return
|
||||
}
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
|
||||
741
src/views/tjt/report-budget/index.vue
Normal file
741
src/views/tjt/report-budget/index.vue
Normal file
@@ -0,0 +1,741 @@
|
||||
<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="contractSignedFlag">
|
||||
<el-select
|
||||
v-model="queryParams.contractSignedFlag"
|
||||
class="!w-180px"
|
||||
clearable
|
||||
placeholder="请选择"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in CONTRACT_SIGN_OPTIONS"
|
||||
:key="String(item.value)"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</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"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column align="center" label="是否签约" width="100">
|
||||
<template #default="scope">
|
||||
<el-tag :type="scope.row.contractSignedFlag ? 'success' : 'info'">
|
||||
{{ scope.row.contractSignedFlag ? '已签约' : '未签约' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="项目经理" min-width="120" prop="projectManagerName" />
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="工程负责人"
|
||||
min-width="120"
|
||||
prop="engineeringPrincipalName"
|
||||
/>
|
||||
<el-table-column align="center" label="开始年度" prop="projectStartYear" width="120" />
|
||||
<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">
|
||||
<template #default="scope">
|
||||
{{ formatAreaText(scope.row.totalConstructionArea) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<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>
|
||||
|
||||
<SplitPane>
|
||||
<template #left>
|
||||
<ContentWrap v-if="currentProject">
|
||||
<div class="mb-16px flex items-center justify-between gap-12px">
|
||||
<div>
|
||||
<div class="text-16px font-600">{{ currentProject.projectName }}</div>
|
||||
</div>
|
||||
<el-button
|
||||
v-hasPermi="['tjt:report-budget:export']"
|
||||
:loading="exportLoading"
|
||||
plain
|
||||
type="success"
|
||||
@click="handleExportProjectBudget"
|
||||
>
|
||||
<Icon class="mr-5px" icon="ep:download" />
|
||||
导出考核产值预算表
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<el-descriptions :column="1" border title="项目信息">
|
||||
<el-descriptions-item label="项目名称">
|
||||
{{ currentProject.projectName || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="项目经理">
|
||||
{{ currentProject.projectManagerName || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="工程负责人">
|
||||
{{ currentProject.engineeringPrincipalName || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="合同总产值(元)">
|
||||
{{ formatAmountText(currentProject.contractAmount) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="建筑面积(㎡)">
|
||||
{{ formatAreaText(currentProject.totalConstructionArea) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="开始年度">
|
||||
{{ currentProject.projectStartYear || '-' }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<el-row :gutter="12" class="mt-16px">
|
||||
<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">{{ planningList.length }}</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<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>
|
||||
</el-col>
|
||||
<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(totalAssessmentOutputValue) }}
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</ContentWrap>
|
||||
|
||||
<ContentWrap v-else>
|
||||
<el-empty description="请选择项目后查看预算导出范围" />
|
||||
</ContentWrap>
|
||||
</template>
|
||||
|
||||
<template #right>
|
||||
<ContentWrap>
|
||||
<div class="mb-12px flex items-center justify-between">
|
||||
<div class="text-14px font-600">
|
||||
{{ currentProject?.projectName || '合约规划列表' }}
|
||||
</div>
|
||||
<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="项目任务包"
|
||||
min-width="180"
|
||||
prop="planningContent"
|
||||
/>
|
||||
<el-table-column align="center" label="归属类型" width="100">
|
||||
<template #default="scope">
|
||||
{{ getOwnershipTypeLabel(scope.row.ownershipType) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="计算方式" min-width="110">
|
||||
<template #default="scope">
|
||||
{{ getCalculationMethodLabel(scope.row.calculationMethod) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="开始年度" width="100" prop="planningStartYear" />
|
||||
<el-table-column align="center" label="分项合同产值(元)" width="130">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.planningAmount) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="考核产值(元)" width="130">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.assessmentOutputValue) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="排序" prop="sortNo" width="80" />
|
||||
</el-table>
|
||||
</ContentWrap>
|
||||
</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">
|
||||
<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="exportLoading" type="primary" @click="submitProjectBudgetExport">
|
||||
确定导出
|
||||
</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</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 download from '@/utils/download'
|
||||
import SplitPane from '@/views/tjt/shared/SplitPane.vue'
|
||||
import {
|
||||
CONTRACT_SIGN_OPTIONS,
|
||||
formatAmountText,
|
||||
formatAreaText,
|
||||
getCalculationMethodLabel,
|
||||
getOwnershipTypeLabel
|
||||
} from '@/views/tjt/shared/planning'
|
||||
|
||||
defineOptions({ name: 'TjtReportBudget' })
|
||||
|
||||
const message = useMessage()
|
||||
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()
|
||||
|
||||
const queryParams = reactive<ProjectApi.ProjectPageReqVO>({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
projectName: undefined,
|
||||
contractSignedFlag: undefined,
|
||||
projectStartYear: undefined
|
||||
})
|
||||
|
||||
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 exportYearValue = computed({
|
||||
get: () => (exportYear.value ? String(exportYear.value) : undefined),
|
||||
set: (value?: string) => {
|
||||
exportYear.value = value ? Number(value) : undefined
|
||||
}
|
||||
})
|
||||
|
||||
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)
|
||||
)
|
||||
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 {
|
||||
const data = await ProjectApi.getProjectPage(queryParams)
|
||||
projectList.value = data.list
|
||||
total.value = data.total
|
||||
if (!projectList.value.length) {
|
||||
currentProject.value = undefined
|
||||
planningList.value = []
|
||||
budgetPreview.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 getPlanningList = async () => {
|
||||
if (!currentProject.value?.id) {
|
||||
planningList.value = []
|
||||
return
|
||||
}
|
||||
planningLoading.value = true
|
||||
try {
|
||||
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()
|
||||
}
|
||||
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
const handleCurrentProjectChange = async (row?: ProjectApi.ProjectVO) => {
|
||||
currentProject.value = row || undefined
|
||||
previewYear.value = row?.projectStartYear || currentYear
|
||||
await Promise.all([getPlanningList(), getProjectBudgetPreview()])
|
||||
}
|
||||
|
||||
const handleExportProjectBudget = async () => {
|
||||
if (!currentProject.value?.id) {
|
||||
message.warning('请先选择项目')
|
||||
return
|
||||
}
|
||||
exportYear.value = currentProject.value.projectStartYear || currentYear
|
||||
exportDialogVisible.value = true
|
||||
}
|
||||
|
||||
const submitProjectBudgetExport = async () => {
|
||||
if (!currentProject.value?.id) {
|
||||
message.warning('请先选择项目')
|
||||
return
|
||||
}
|
||||
if (!exportYear.value) {
|
||||
message.warning('请选择年度')
|
||||
return
|
||||
}
|
||||
try {
|
||||
await message.exportConfirm()
|
||||
exportLoading.value = true
|
||||
const data = await ReportApi.exportProjectBudget({
|
||||
projectId: currentProject.value.id,
|
||||
year: exportYear.value
|
||||
})
|
||||
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>
|
||||
455
src/views/tjt/report-project-quarter/index.vue
Normal file
455
src/views/tjt/report-project-quarter/index.vue
Normal file
@@ -0,0 +1,455 @@
|
||||
<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="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-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>
|
||||
|
||||
<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>
|
||||
|
||||
<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: 'TjtReportProjectQuarter' })
|
||||
|
||||
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.ProjectQuarterOutputPreviewRespVO>()
|
||||
const queryFormRef = ref()
|
||||
const projectTableRef = ref()
|
||||
let previewRequestSeq = 0
|
||||
|
||||
const queryParams = reactive<ProjectApi.ProjectPageReqVO>({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
projectName: undefined,
|
||||
projectStartYear: undefined
|
||||
})
|
||||
|
||||
const specialtyColumns = [
|
||||
{ key: 'arch', label: '建筑', ratioKey: 'archRatio', amountKey: 'archAssessmentOutputWan' },
|
||||
{ key: 'decor', label: '精装', ratioKey: 'decorRatio', amountKey: 'decorAssessmentOutputWan' },
|
||||
{ key: 'struct', label: '结构', ratioKey: 'structRatio', amountKey: 'structAssessmentOutputWan' },
|
||||
{ key: 'water', label: '给排水', ratioKey: 'waterRatio', amountKey: 'waterAssessmentOutputWan' },
|
||||
{ key: 'hvac', label: '暖通', ratioKey: 'hvacRatio', amountKey: 'hvacAssessmentOutputWan' },
|
||||
{ key: 'elec', label: '电气', ratioKey: 'elecRatio', amountKey: 'elecAssessmentOutputWan' },
|
||||
{
|
||||
key: 'digital',
|
||||
label: '数字化设计',
|
||||
ratioKey: 'digitalRatio',
|
||||
amountKey: 'digitalAssessmentOutputWan'
|
||||
}
|
||||
] as const
|
||||
|
||||
const previewRows = computed(() => previewData.value?.rows || [])
|
||||
|
||||
const getProjectRowIndex = (index: number) =>
|
||||
((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 getPreviewRowClassName = ({ row }: { row: ReportApi.ProjectQuarterOutputPreviewRow }) =>
|
||||
row?.totalRow ? 'report-total-row' : row?.placeholderRow ? 'report-placeholder-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 loadProjectQuarterPreview = 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.getProjectQuarterOutputPreview({
|
||||
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 handleExportProjectQuarter = 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.exportProjectQuarterOutput({
|
||||
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],
|
||||
() => {
|
||||
loadProjectQuarterPreview()
|
||||
}
|
||||
)
|
||||
|
||||
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>
|
||||
574
src/views/tjt/report-specialty-person/index.vue
Normal file
574
src/views/tjt/report-specialty-person/index.vue
Normal file
@@ -0,0 +1,574 @@
|
||||
<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="120" prop="projectManagerName" />
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="工程负责人"
|
||||
min-width="120"
|
||||
prop="engineeringPrincipalName"
|
||||
/>
|
||||
<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>
|
||||
|
||||
<SplitPane>
|
||||
<template #left>
|
||||
<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="项目任务包" 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>
|
||||
</template>
|
||||
|
||||
<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>
|
||||
</div>
|
||||
|
||||
<div class="mb-16px">
|
||||
<el-radio-group v-model="selectedGroupCode" size="small">
|
||||
<el-radio-button v-for="item in groupTabOptions" :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 buildSummaryCards(currentGroup)" :key="item.label" :span="6">
|
||||
<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">{{ item.value }}</div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<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">
|
||||
{{ formatPercentText(scope.row.roleRatio) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="角色金额(元)" min-width="130">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.roleAmount) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="人员合计" min-width="120">
|
||||
<template #default="scope">
|
||||
{{ formatPercentText(scope.row.personTotalRatio) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<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>
|
||||
</template>
|
||||
</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 download from '@/utils/download'
|
||||
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 = 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 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 previewData = ref<ReportApi.SpecialtyPersonOutputPreviewRespVO>()
|
||||
const selectedGroupCode = ref('')
|
||||
const queryFormRef = ref()
|
||||
const projectTableRef = ref()
|
||||
const planningTableRef = ref()
|
||||
|
||||
const queryParams = reactive<ProjectApi.ProjectPageReqVO>({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
projectName: undefined,
|
||||
projectStartYear: undefined
|
||||
})
|
||||
|
||||
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 formatWanAmountText = (value?: number | string | null) => formatAmountText(value)
|
||||
const formatRatioAmountText = (
|
||||
ratio?: number | string | null,
|
||||
amount?: number | string | null
|
||||
) => `${formatPercentText(ratio)} / ${formatWanAmountText(amount)}`
|
||||
|
||||
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,
|
||||
value: item.specialtyCode
|
||||
}))
|
||||
)
|
||||
const currentGroup = computed(
|
||||
() => groups.value.find((item) => item.specialtyCode === selectedGroupCode.value) || groups.value[0]
|
||||
)
|
||||
const canExportCurrentGroup = computed(
|
||||
() => !!currentGroup.value?.specialtyCode && currentGroup.value.exportable !== false
|
||||
)
|
||||
|
||||
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 []
|
||||
}
|
||||
return [
|
||||
{ label: '分组金额', value: `${formatAmountText(group.specialtyAmount)} 元` },
|
||||
{ label: '角色合计', value: formatPercentText(group.roleTotal) },
|
||||
{ label: '已配置人数', value: `${group.personCount} 人` },
|
||||
{ label: '超额提醒', value: group.overRatio ? '存在' : '无' }
|
||||
]
|
||||
}
|
||||
|
||||
watch(
|
||||
groups,
|
||||
(value) => {
|
||||
const codes = value.map((item) => item.specialtyCode)
|
||||
if (!codes.length) {
|
||||
selectedGroupCode.value = ''
|
||||
return
|
||||
}
|
||||
if (!codes.includes(selectedGroupCode.value)) {
|
||||
selectedGroupCode.value = codes[0]
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
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
|
||||
planningList.value = []
|
||||
currentPlanning.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 getPlanningList = async () => {
|
||||
if (!currentProject.value?.id) {
|
||||
planningList.value = []
|
||||
currentPlanning.value = undefined
|
||||
previewData.value = undefined
|
||||
return
|
||||
}
|
||||
planningLoading.value = true
|
||||
try {
|
||||
const list = await PlanningApi.getProjectPlanningListByProjectId(currentProject.value.id)
|
||||
planningList.value = list
|
||||
if (!planningList.value.length) {
|
||||
currentPlanning.value = undefined
|
||||
previewData.value = undefined
|
||||
return
|
||||
}
|
||||
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 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 = () => {
|
||||
queryParams.pageNo = 1
|
||||
getProjectList()
|
||||
}
|
||||
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
const handleCurrentProjectChange = async (row?: ProjectApi.ProjectVO) => {
|
||||
currentProject.value = row || undefined
|
||||
await getPlanningList()
|
||||
}
|
||||
|
||||
const handleCurrentPlanningChange = async (row?: PlanningApi.ProjectPlanningVO) => {
|
||||
currentPlanning.value = row || undefined
|
||||
if (!row?.id) {
|
||||
previewData.value = undefined
|
||||
return
|
||||
}
|
||||
selectedYear.value = row.planningStartYear || currentYear
|
||||
previewData.value = undefined
|
||||
}
|
||||
|
||||
const handleExportSpecialtyPerson = async () => {
|
||||
if (!currentPlanning.value?.id) {
|
||||
message.warning('请先选择合约规划')
|
||||
return
|
||||
}
|
||||
if (!canExportCurrentGroup.value || !currentGroup.value?.specialtyCode) {
|
||||
message.warning('请选择具体专业后再导出')
|
||||
return
|
||||
}
|
||||
if (!selectedYear.value) {
|
||||
message.warning('请选择年度')
|
||||
return
|
||||
}
|
||||
try {
|
||||
await message.exportConfirm()
|
||||
exportSpecialtyLoading.value = true
|
||||
const data = await ReportApi.exportSpecialtyPersonOutput({
|
||||
planningId: currentPlanning.value.id,
|
||||
specialtyCode: currentGroup.value.specialtyCode,
|
||||
year: selectedYear.value
|
||||
})
|
||||
download.excel(
|
||||
data,
|
||||
`${currentProject.value?.projectName || '项目'}_${selectedYear.value}_${currentGroup.value.specialtyName || '专业'}内人员年度季度计取表.xlsx`
|
||||
)
|
||||
} 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-display-name {
|
||||
font-weight: 600;
|
||||
}
|
||||
</style>
|
||||
590
src/views/tjt/report-summary/index.vue
Normal file
590
src/views/tjt/report-summary/index.vue
Normal file
@@ -0,0 +1,590 @@
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<el-tabs v-model="activeTab">
|
||||
<el-tab-pane label="员工个人考核产值汇总表" name="employeeSummary">
|
||||
<el-form :inline="true" :model="employeeSummaryForm" label-width="88px">
|
||||
<el-form-item label="年度">
|
||||
<el-date-picker
|
||||
v-model="employeeSummaryYearValue"
|
||||
class="!w-180px"
|
||||
clearable
|
||||
placeholder="请选择年度"
|
||||
type="year"
|
||||
value-format="YYYY"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button :loading="employeeSummaryPreviewLoading" @click="getEmployeeSummaryPreview">
|
||||
<Icon class="mr-5px" icon="ep:refresh" />
|
||||
刷新预览
|
||||
</el-button>
|
||||
<el-button
|
||||
v-hasPermi="['tjt:report-summary:export']"
|
||||
:loading="employeeSummaryExportLoading"
|
||||
plain
|
||||
type="primary"
|
||||
@click="openEmployeeSummaryExportDialog"
|
||||
>
|
||||
<Icon class="mr-5px" icon="ep:download" />
|
||||
导出员工汇总
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table
|
||||
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" 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="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>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane label="项目总览表" name="projectOverview">
|
||||
<el-form :inline="true" :model="projectOverviewForm" label-width="88px">
|
||||
<el-form-item label="专业所">
|
||||
<el-select
|
||||
v-model="projectOverviewForm.officeId"
|
||||
class="!w-220px"
|
||||
clearable
|
||||
placeholder="请选择专业所"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in officeOptions"
|
||||
:key="item.id"
|
||||
:label="item.officeName"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<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-button
|
||||
v-hasPermi="['tjt:report-summary:export']"
|
||||
:loading="projectOverviewExportLoading"
|
||||
plain
|
||||
type="primary"
|
||||
@click="openProjectOverviewExportDialog"
|
||||
>
|
||||
<Icon class="mr-5px" icon="ep:download" />
|
||||
导出项目总览
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table
|
||||
v-loading="projectOverviewPreviewLoading"
|
||||
:data="projectOverviewRows"
|
||||
:empty-text="projectOverviewEmptyText"
|
||||
:row-class-name="getRowClassName"
|
||||
border
|
||||
class="summary-table"
|
||||
max-height="640"
|
||||
>
|
||||
<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>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</ContentWrap>
|
||||
|
||||
<Dialog v-model="exportDialogVisible" :title="exportDialogTitle" width="480">
|
||||
<el-form label-width="88px">
|
||||
<template v-if="exportDialogType === 'employeeSummary'">
|
||||
<el-form-item label="年度">
|
||||
<span>{{ employeeSummaryForm.year || '-' }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="导出排序">
|
||||
<el-select
|
||||
v-model="employeeSummaryForm.sortType"
|
||||
class="!w-220px"
|
||||
placeholder="请选择导出排序"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in EMPLOYEE_SUMMARY_SORT_OPTIONS"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</template>
|
||||
|
||||
<template v-else>
|
||||
<el-form-item label="专业所">
|
||||
<span>{{ currentOfficeName || '-' }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="年度">
|
||||
<span>{{ projectOverviewForm.year || '-' }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="导出排序">
|
||||
<el-select
|
||||
v-model="projectOverviewForm.sortType"
|
||||
class="!w-220px"
|
||||
placeholder="请选择导出排序"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in PROJECT_OVERVIEW_SORT_OPTIONS"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-form>
|
||||
|
||||
<template #footer>
|
||||
<el-button @click="exportDialogVisible = false">取消</el-button>
|
||||
<el-button :loading="currentExportLoading" type="primary" @click="submitExport">
|
||||
确定导出
|
||||
</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import * as OfficeApi from '@/api/tjt/office'
|
||||
import * as ReportApi from '@/api/tjt/report'
|
||||
import download from '@/utils/download'
|
||||
|
||||
defineOptions({ name: 'TjtReportSummary' })
|
||||
|
||||
type SelectOption = {
|
||||
label: string
|
||||
value: string
|
||||
}
|
||||
|
||||
type ExportDialogType = 'employeeSummary' | 'projectOverview'
|
||||
|
||||
type SummaryTableRow = {
|
||||
totalRow?: boolean
|
||||
}
|
||||
|
||||
const PROJECT_OVERVIEW_SORT_OPTIONS: SelectOption[] = [
|
||||
{ label: '产值从高到低', value: 'output_desc' },
|
||||
{ label: '产值从低到高', value: 'output_asc' },
|
||||
{ label: '项目名称升序', value: 'name_asc' }
|
||||
]
|
||||
|
||||
const EMPLOYEE_SUMMARY_SORT_OPTIONS: SelectOption[] = [
|
||||
{ label: '专业所 + 所内年度合计从高到低', value: 'annual_total_desc' },
|
||||
{ label: '专业所 + 所内年度合计从低到高', value: 'annual_total_asc' },
|
||||
{ label: '专业所 + 所内姓名升序', value: 'name_asc' }
|
||||
]
|
||||
|
||||
const message = useMessage()
|
||||
|
||||
const activeTab = ref('employeeSummary')
|
||||
const exportDialogVisible = ref(false)
|
||||
const exportDialogType = ref<ExportDialogType>('employeeSummary')
|
||||
const projectOverviewExportLoading = ref(false)
|
||||
const employeeSummaryExportLoading = ref(false)
|
||||
const employeeSummaryPreviewLoading = ref(false)
|
||||
const projectOverviewPreviewLoading = ref(false)
|
||||
const officeOptions = ref<OfficeApi.OfficeSimpleVO[]>([])
|
||||
const employeeSummaryPreview = ref<ReportApi.EmployeeOutputSummaryPreviewRespVO>()
|
||||
const projectOverviewPreview = ref<ReportApi.ProjectOverviewPreviewRespVO>()
|
||||
const currentYear = new Date().getFullYear()
|
||||
|
||||
const projectOverviewForm = reactive<ReportApi.ProjectOverviewExportReqVO>({
|
||||
year: currentYear,
|
||||
officeId: undefined,
|
||||
sortType: 'output_desc'
|
||||
})
|
||||
|
||||
const employeeSummaryForm = reactive<ReportApi.EmployeeOutputSummaryExportReqVO>({
|
||||
year: currentYear,
|
||||
officeId: undefined,
|
||||
employeeId: undefined,
|
||||
employeeStatus: undefined,
|
||||
sortType: 'annual_total_desc'
|
||||
})
|
||||
|
||||
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 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' ? '导出员工个人考核产值汇总表' : '导出项目总览表'
|
||||
)
|
||||
|
||||
const currentExportLoading = computed(() =>
|
||||
exportDialogType.value === 'employeeSummary'
|
||||
? employeeSummaryExportLoading.value
|
||||
: projectOverviewExportLoading.value
|
||||
)
|
||||
|
||||
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) => {
|
||||
projectOverviewForm.year = value ? Number(value) : undefined
|
||||
}
|
||||
})
|
||||
|
||||
const employeeSummaryYearValue = computed({
|
||||
get: () => (employeeSummaryForm.year ? String(employeeSummaryForm.year) : undefined),
|
||||
set: (value?: string) => {
|
||||
employeeSummaryForm.year = value ? Number(value) : undefined
|
||||
}
|
||||
})
|
||||
|
||||
const formatAmount = (value?: number) => {
|
||||
if (value === undefined || value === null) {
|
||||
return ''
|
||||
}
|
||||
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 getEmployeeSummaryPreview = async () => {
|
||||
if (!employeeSummaryForm.year) {
|
||||
employeeSummaryPreview.value = undefined
|
||||
return
|
||||
}
|
||||
employeeSummaryPreviewLoading.value = true
|
||||
try {
|
||||
employeeSummaryPreview.value = await ReportApi.getEmployeeOutputSummaryPreview(employeeSummaryForm)
|
||||
} finally {
|
||||
employeeSummaryPreviewLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const getProjectOverviewPreview = async () => {
|
||||
if (!projectOverviewForm.officeId || !projectOverviewForm.year) {
|
||||
projectOverviewPreview.value = undefined
|
||||
return
|
||||
}
|
||||
projectOverviewPreviewLoading.value = true
|
||||
try {
|
||||
projectOverviewPreview.value = await ReportApi.getProjectOverviewPreview(projectOverviewForm)
|
||||
} finally {
|
||||
projectOverviewPreviewLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const openEmployeeSummaryExportDialog = () => {
|
||||
if (!employeeSummaryForm.year) {
|
||||
message.warning('请选择年度')
|
||||
return
|
||||
}
|
||||
exportDialogType.value = 'employeeSummary'
|
||||
exportDialogVisible.value = true
|
||||
}
|
||||
|
||||
const openProjectOverviewExportDialog = () => {
|
||||
if (!projectOverviewForm.officeId) {
|
||||
message.warning('请选择专业所')
|
||||
return
|
||||
}
|
||||
if (!projectOverviewForm.year) {
|
||||
message.warning('请选择年度')
|
||||
return
|
||||
}
|
||||
exportDialogType.value = 'projectOverview'
|
||||
exportDialogVisible.value = true
|
||||
}
|
||||
|
||||
const submitExport = async () => {
|
||||
if (exportDialogType.value === 'employeeSummary') {
|
||||
await handleExportEmployeeSummary()
|
||||
return
|
||||
}
|
||||
await handleExportProjectOverview()
|
||||
}
|
||||
|
||||
const handleExportProjectOverview = async () => {
|
||||
if (!projectOverviewForm.officeId) {
|
||||
message.warning('请选择专业所')
|
||||
return
|
||||
}
|
||||
if (!projectOverviewForm.year) {
|
||||
message.warning('请选择年度')
|
||||
return
|
||||
}
|
||||
try {
|
||||
projectOverviewExportLoading.value = true
|
||||
const data = await ReportApi.exportProjectOverview(projectOverviewForm)
|
||||
download.excel(
|
||||
data,
|
||||
`${currentOfficeName.value || '专业所'}_${projectOverviewForm.year}_项目总览表.xlsx`
|
||||
)
|
||||
exportDialogVisible.value = false
|
||||
} finally {
|
||||
projectOverviewExportLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleExportEmployeeSummary = async () => {
|
||||
if (!employeeSummaryForm.year) {
|
||||
message.warning('请选择年度')
|
||||
return
|
||||
}
|
||||
try {
|
||||
employeeSummaryExportLoading.value = true
|
||||
const data = await ReportApi.exportEmployeeOutputSummary(employeeSummaryForm)
|
||||
download.excel(data, `${employeeSummaryForm.year}_员工个人考核产值汇总表.xlsx`)
|
||||
exportDialogVisible.value = false
|
||||
} finally {
|
||||
employeeSummaryExportLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const refreshCurrentPreview = () => {
|
||||
if (activeTab.value === 'projectOverview') {
|
||||
getProjectOverviewPreview()
|
||||
return
|
||||
}
|
||||
getEmployeeSummaryPreview()
|
||||
}
|
||||
|
||||
watch(
|
||||
() => [employeeSummaryForm.year, employeeSummaryForm.sortType],
|
||||
() => {
|
||||
getEmployeeSummaryPreview()
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
watch(
|
||||
() => [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>
|
||||
@@ -1,84 +1,370 @@
|
||||
export const OWNERSHIP_TYPE_OPTIONS = [
|
||||
{ label: '专业所', value: '专业所' },
|
||||
{ label: '综合所', value: '综合所' },
|
||||
{ label: '专业分包', value: '专业分包' }
|
||||
export type Option<T = string> = {
|
||||
label: string
|
||||
value: T
|
||||
}
|
||||
|
||||
export const OWNERSHIP_TYPE = {
|
||||
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: '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: '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: '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: '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: '精装工程',
|
||||
comprehensive: '综合工程',
|
||||
special: '专项设计',
|
||||
bim: 'BIM设计',
|
||||
other: '其他'
|
||||
} as const
|
||||
|
||||
export const PROJECT_CATEGORY = {
|
||||
residential: '住宅',
|
||||
publicBuilding: '公建',
|
||||
industry: '工业',
|
||||
landscape: '园林景观',
|
||||
other: '其他'
|
||||
} as const
|
||||
|
||||
export const PROJECT_STATUS = {
|
||||
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: '女'
|
||||
} as const
|
||||
|
||||
export const EMPLOYEE_STATUS = {
|
||||
active: '在职',
|
||||
resigned: '离职',
|
||||
suspended: '停职'
|
||||
} as const
|
||||
|
||||
const normalizeValue = (value: string | undefined, validValues: string[]) =>
|
||||
value && validValues.includes(value) ? value : undefined
|
||||
|
||||
const findLabel = <T>(options: Array<Option<T>>, value?: T | string) =>
|
||||
options.find((item) => String(item.value) === String(value))?.label
|
||||
|
||||
export const normalizeOwnershipType = (value?: string) =>
|
||||
normalizeValue(value, Object.values(OWNERSHIP_TYPE))
|
||||
|
||||
export const normalizeCalculationMethod = (value?: string) =>
|
||||
normalizeValue(value, Object.values(CALCULATION_METHOD))
|
||||
|
||||
export const normalizeVirtualCalculationMethod = (value?: string) =>
|
||||
normalizeValue(value, Object.values(VIRTUAL_CALCULATION_METHOD))
|
||||
|
||||
export const normalizeDesignStage = (value?: string) =>
|
||||
normalizeValue(value, Object.values(DESIGN_STAGE))
|
||||
|
||||
export const normalizeDesignPart = (value?: string) =>
|
||||
normalizeValue(value, Object.values(DESIGN_PART))
|
||||
|
||||
export const normalizeProjectType = (value?: string) =>
|
||||
normalizeValue(value, Object.values(PROJECT_TYPE))
|
||||
|
||||
export const normalizeProjectCategory = (value?: string) =>
|
||||
normalizeValue(value, Object.values(PROJECT_CATEGORY))
|
||||
|
||||
export const normalizeProjectStatus = (value?: string) =>
|
||||
normalizeValue(value, Object.values(PROJECT_STATUS))
|
||||
|
||||
export const OWNERSHIP_TYPE_OPTIONS: Option[] = [
|
||||
{ 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 = [
|
||||
{ label: '指导价法', value: '指导价法' },
|
||||
{ label: '合同价法', value: '合同价法' },
|
||||
{ label: '虚拟产值法', value: '虚拟产值法' }
|
||||
export const CALCULATION_METHOD_OPTIONS: Option[] = [
|
||||
{
|
||||
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 = [
|
||||
{ label: '指导单价法', value: '指导单价法' },
|
||||
{ label: '虚拟总价法', value: '虚拟总价法' },
|
||||
{ label: '工日法', value: '工日法' }
|
||||
export const VIRTUAL_CALCULATION_METHOD_OPTIONS: Option[] = [
|
||||
{
|
||||
label: VIRTUAL_CALCULATION_METHOD_LABEL[VIRTUAL_CALCULATION_METHOD.guidancePrice],
|
||||
value: VIRTUAL_CALCULATION_METHOD.guidancePrice
|
||||
},
|
||||
{
|
||||
label: VIRTUAL_CALCULATION_METHOD_LABEL[VIRTUAL_CALCULATION_METHOD.guidanceTotalPrice],
|
||||
value: VIRTUAL_CALCULATION_METHOD.guidanceTotalPrice
|
||||
},
|
||||
{
|
||||
label: VIRTUAL_CALCULATION_METHOD_LABEL[VIRTUAL_CALCULATION_METHOD.workingDay],
|
||||
value: VIRTUAL_CALCULATION_METHOD.workingDay
|
||||
}
|
||||
]
|
||||
|
||||
export const DESIGN_STAGE_OPTIONS = [
|
||||
{ label: '方案', value: '方案' },
|
||||
{ label: '施工图', value: '施工图' },
|
||||
{ label: '方案+施工图', value: '方案+施工图' }
|
||||
export const DESIGN_STAGE_OPTIONS: Option[] = [
|
||||
{ label: DESIGN_STAGE_LABEL[DESIGN_STAGE.scheme], value: DESIGN_STAGE.scheme },
|
||||
{
|
||||
label: DESIGN_STAGE_LABEL[DESIGN_STAGE.constructionDrawing],
|
||||
value: DESIGN_STAGE.constructionDrawing
|
||||
},
|
||||
{
|
||||
label: DESIGN_STAGE_LABEL[DESIGN_STAGE.schemeAndConstructionDrawing],
|
||||
value: DESIGN_STAGE.schemeAndConstructionDrawing
|
||||
}
|
||||
]
|
||||
|
||||
export const CONTRACT_SIGN_OPTIONS = [
|
||||
{ label: '已签订', value: true },
|
||||
{ label: '未签订', value: false }
|
||||
export const DESIGN_PART_OPTIONS: Option[] = [
|
||||
{ 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 PROJECT_TYPE_OPTIONS = [
|
||||
{ label: '建筑工程', value: '建筑工程' },
|
||||
{ label: '精装工程', value: '精装工程' },
|
||||
{ label: '综合工程', value: '综合工程' }
|
||||
export const CONTRACT_SIGN_OPTIONS: Option<boolean>[] = [
|
||||
{ label: '已签约', value: true },
|
||||
{ label: '未签约', value: false }
|
||||
]
|
||||
|
||||
export const QUARTER_OPTIONS = [
|
||||
export const PROJECT_TYPE_OPTIONS: Option[] = [
|
||||
{ label: PROJECT_TYPE.building, value: PROJECT_TYPE.building },
|
||||
{ label: PROJECT_TYPE.decoration, value: PROJECT_TYPE.decoration },
|
||||
{ label: PROJECT_TYPE.comprehensive, value: PROJECT_TYPE.comprehensive },
|
||||
{ label: PROJECT_TYPE.special, value: PROJECT_TYPE.special },
|
||||
{ label: PROJECT_TYPE.bim, value: PROJECT_TYPE.bim },
|
||||
{ label: PROJECT_TYPE.other, value: PROJECT_TYPE.other }
|
||||
]
|
||||
|
||||
export const PROJECT_CATEGORY_OPTIONS: Option[] = [
|
||||
{ label: PROJECT_CATEGORY.residential, value: PROJECT_CATEGORY.residential },
|
||||
{ label: PROJECT_CATEGORY.publicBuilding, value: PROJECT_CATEGORY.publicBuilding },
|
||||
{ label: PROJECT_CATEGORY.industry, value: PROJECT_CATEGORY.industry },
|
||||
{ label: PROJECT_CATEGORY.landscape, value: PROJECT_CATEGORY.landscape },
|
||||
{ label: PROJECT_CATEGORY.other, value: PROJECT_CATEGORY.other }
|
||||
]
|
||||
|
||||
export const PROJECT_STATUS_OPTIONS: Option[] = [
|
||||
{ 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[] = [
|
||||
{ label: EMPLOYEE_GENDER.male, value: EMPLOYEE_GENDER.male },
|
||||
{ label: EMPLOYEE_GENDER.female, value: EMPLOYEE_GENDER.female }
|
||||
]
|
||||
|
||||
export const EMPLOYEE_STATUS_OPTIONS: Option[] = [
|
||||
{ label: EMPLOYEE_STATUS.active, value: EMPLOYEE_STATUS.active },
|
||||
{ label: EMPLOYEE_STATUS.resigned, value: EMPLOYEE_STATUS.resigned },
|
||||
{ label: EMPLOYEE_STATUS.suspended, value: EMPLOYEE_STATUS.suspended }
|
||||
]
|
||||
|
||||
export const EMPLOYEE_JOB_TITLE = {
|
||||
junior: '初级',
|
||||
intermediate: '中级',
|
||||
viceSenior: '副高级',
|
||||
senior: '正高级'
|
||||
} as const
|
||||
|
||||
export const EMPLOYEE_JOB_TITLE_OPTIONS: Option[] = [
|
||||
{ label: EMPLOYEE_JOB_TITLE.junior, value: EMPLOYEE_JOB_TITLE.junior },
|
||||
{ label: EMPLOYEE_JOB_TITLE.intermediate, value: EMPLOYEE_JOB_TITLE.intermediate },
|
||||
{ label: EMPLOYEE_JOB_TITLE.viceSenior, value: EMPLOYEE_JOB_TITLE.viceSenior },
|
||||
{ label: EMPLOYEE_JOB_TITLE.senior, value: EMPLOYEE_JOB_TITLE.senior }
|
||||
]
|
||||
|
||||
export const DEFAULT_INNOVATION_OUTPUT_RATE = 0.01
|
||||
export const DEFAULT_WORKING_DAY_UNIT_PRICE = 1000
|
||||
|
||||
export const QUARTER_OPTIONS: Option<number>[] = [
|
||||
{ label: '一季度', value: 1 },
|
||||
{ label: '二季度', value: 2 },
|
||||
{ label: '三季度', value: 3 },
|
||||
{ label: '四季度', value: 4 }
|
||||
]
|
||||
|
||||
export const OUTPUT_SPLIT_SPECIALTY_OPTIONS = [
|
||||
{ label: '建筑', value: 'arch' },
|
||||
{ label: '装修', value: 'decor' },
|
||||
{ label: '结构', value: 'struct' },
|
||||
{ label: '水', value: 'water' },
|
||||
{ label: '电气', value: 'elec' },
|
||||
{ label: '暖通', value: 'hvac' },
|
||||
{ label: '数字化设计', value: 'digital' }
|
||||
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: 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 = [
|
||||
{ label: '专业负责人', value: 'director' },
|
||||
{ label: '校对', value: 'check' },
|
||||
{ label: '审核', value: 'review' },
|
||||
{ label: '审定', value: 'approve' },
|
||||
{ label: '设计', value: 'design' }
|
||||
export const SPECIALTY_ROLE_OPTIONS: Option[] = [
|
||||
{ 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 }
|
||||
]
|
||||
|
||||
const OWNERSHIP_TYPE_MAJOR = '专业所'
|
||||
const OWNERSHIP_TYPE_COMPREHENSIVE = '综合所'
|
||||
const OWNERSHIP_TYPE_SUBCONTRACT = '专业分包'
|
||||
const CALCULATION_METHOD_GUIDANCE_PRICE = '指导价法'
|
||||
const CALCULATION_METHOD_CONTRACT_PRICE = '合同价法'
|
||||
const CALCULATION_METHOD_VIRTUAL_OUTPUT = '虚拟产值法'
|
||||
const VIRTUAL_METHOD_GUIDANCE_PRICE = '指导单价法'
|
||||
const VIRTUAL_METHOD_VIRTUAL_TOTAL_PRICE = '虚拟总价法'
|
||||
const VIRTUAL_METHOD_WORKING_DAY = '工日法'
|
||||
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) =>
|
||||
isSpecialSubcontractOwnership(value) ||
|
||||
isSourceCoopSubcontractOwnership(value) ||
|
||||
isComprehensiveSubcontractOwnership(value)
|
||||
|
||||
export const isMajorOwnership = (value?: string) => value === OWNERSHIP_TYPE_MAJOR
|
||||
export const isComprehensiveOwnership = (value?: string) => value === OWNERSHIP_TYPE_COMPREHENSIVE
|
||||
export const isSubcontractOwnership = (value?: string) => value === OWNERSHIP_TYPE_SUBCONTRACT
|
||||
export const isGuidancePriceMethod = (value?: string) =>
|
||||
normalizeCalculationMethod(value) === CALCULATION_METHOD.guidancePrice
|
||||
export const isContractPriceMethod = (value?: string) =>
|
||||
normalizeCalculationMethod(value) === CALCULATION_METHOD.contractPrice
|
||||
export const isVirtualOutputMethod = (value?: string) =>
|
||||
normalizeCalculationMethod(value) === CALCULATION_METHOD.virtualOutput
|
||||
|
||||
export const isGuidancePriceMethod = (value?: string) => value === CALCULATION_METHOD_GUIDANCE_PRICE
|
||||
export const isContractPriceMethod = (value?: string) => value === CALCULATION_METHOD_CONTRACT_PRICE
|
||||
export const isVirtualOutputMethod = (value?: string) => value === CALCULATION_METHOD_VIRTUAL_OUTPUT
|
||||
export const isVirtualGuidanceMethod = (value?: string) =>
|
||||
normalizeVirtualCalculationMethod(value) === VIRTUAL_CALCULATION_METHOD.guidancePrice
|
||||
export const isVirtualGuidanceTotalPriceMethod = (value?: string) =>
|
||||
normalizeVirtualCalculationMethod(value) === VIRTUAL_CALCULATION_METHOD.guidanceTotalPrice
|
||||
export const isWorkingDayMethod = (value?: string) =>
|
||||
normalizeVirtualCalculationMethod(value) === VIRTUAL_CALCULATION_METHOD.workingDay
|
||||
|
||||
export const isVirtualGuidanceMethod = (value?: string) => value === VIRTUAL_METHOD_GUIDANCE_PRICE
|
||||
export const isVirtualTotalPriceMethod = (value?: string) => value === VIRTUAL_METHOD_VIRTUAL_TOTAL_PRICE
|
||||
export const isWorkingDayMethod = (value?: string) => value === VIRTUAL_METHOD_WORKING_DAY
|
||||
export const getOwnershipTypeLabel = (value?: string) =>
|
||||
findLabel(OWNERSHIP_TYPE_OPTIONS, normalizeOwnershipType(value)) || '-'
|
||||
|
||||
export const getCalculationMethodLabel = (value?: string) =>
|
||||
findLabel(CALCULATION_METHOD_OPTIONS, normalizeCalculationMethod(value)) || '-'
|
||||
|
||||
export const getProjectTypeLabel = (value?: string) =>
|
||||
findLabel(PROJECT_TYPE_OPTIONS, normalizeProjectType(value)) || '-'
|
||||
|
||||
export const getProjectCategoryLabel = (value?: string) =>
|
||||
findLabel(PROJECT_CATEGORY_OPTIONS, normalizeProjectCategory(value)) || '-'
|
||||
|
||||
export const getProjectStatusLabel = (value?: string) =>
|
||||
findLabel(PROJECT_STATUS_OPTIONS, normalizeProjectStatus(value)) || '-'
|
||||
|
||||
export const getDesignStageLabel = (value?: string) =>
|
||||
findLabel(DESIGN_STAGE_OPTIONS, normalizeDesignStage(value)) || '-'
|
||||
|
||||
export const getDesignPartLabel = (value?: string) =>
|
||||
findLabel(DESIGN_PART_OPTIONS, normalizeDesignPart(value)) || '-'
|
||||
|
||||
export const getVirtualCalculationMethodLabel = (value?: string) =>
|
||||
findLabel(VIRTUAL_CALCULATION_METHOD_OPTIONS, normalizeVirtualCalculationMethod(value)) || '-'
|
||||
|
||||
export const getCalculationRatioLabel = (ownershipType?: string) => {
|
||||
if (isComprehensiveOwnership(ownershipType)) {
|
||||
|
||||
15
src/views/tjt/shared/report.ts
Normal file
15
src/views/tjt/shared/report.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { OUTPUT_SPLIT_SPECIALTY_OPTIONS, type Option } from './planning'
|
||||
|
||||
export const REPORT_SPECIALTY_OPTIONS = OUTPUT_SPLIT_SPECIALTY_OPTIONS
|
||||
|
||||
export const PROJECT_OVERVIEW_SORT_OPTIONS: Option[] = [
|
||||
{ label: '产值从高到低', value: 'output_desc' },
|
||||
{ label: '产值从低到高', value: 'output_asc' },
|
||||
{ label: '项目名称升序', value: 'name_asc' }
|
||||
]
|
||||
|
||||
export const EMPLOYEE_SUMMARY_SORT_OPTIONS: Option[] = [
|
||||
{ label: '年度合计从高到低', value: 'annual_total_desc' },
|
||||
{ label: '年度合计从低到高', value: 'annual_total_asc' },
|
||||
{ label: '员工姓名升序', value: 'name_asc' }
|
||||
]
|
||||
File diff suppressed because it is too large
Load Diff
316
src/views/tjt/year-k-value/index.vue
Normal file
316
src/views/tjt/year-k-value/index.vue
Normal file
@@ -0,0 +1,316 @@
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<el-form
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
:model="queryParams"
|
||||
class="-mb-15px"
|
||||
label-width="88px"
|
||||
>
|
||||
<el-form-item label="年度" prop="kYear">
|
||||
<el-date-picker
|
||||
v-model="queryYearValue"
|
||||
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:year-k-value:create']"
|
||||
plain
|
||||
type="primary"
|
||||
@click="openDialog('create')"
|
||||
>
|
||||
<Icon class="mr-5px" icon="ep:plus" />
|
||||
新增
|
||||
</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="年度" prop="kYear" width="120" />
|
||||
<el-table-column align="center" label="K值" width="120">
|
||||
<template #default="scope">
|
||||
{{ formatPercentText(scope.row.kValue, 2) }}
|
||||
</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:year-k-value:update']"
|
||||
link
|
||||
type="primary"
|
||||
@click="openDialog('update', scope.row.id)"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-hasPermi="['tjt:year-k-value: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="520">
|
||||
<el-form ref="formRef" v-loading="formLoading" :model="formData" :rules="formRules" label-width="100px">
|
||||
<el-form-item label="年度" prop="kYear">
|
||||
<el-date-picker
|
||||
v-model="formYearValue"
|
||||
class="!w-1/1"
|
||||
placeholder="请选择年度"
|
||||
type="year"
|
||||
value-format="YYYY"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="K值(%)" prop="kValue">
|
||||
<el-input-number
|
||||
v-model="kValuePercent"
|
||||
:max="100"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="0.1"
|
||||
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>
|
||||
</template>
|
||||
|
||||
<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' })
|
||||
|
||||
const message = useMessage()
|
||||
const { t } = useI18n()
|
||||
|
||||
const loading = ref(false)
|
||||
const formLoading = ref(false)
|
||||
const total = ref(0)
|
||||
const list = ref<YearKValueApi.YearKValueVO[]>([])
|
||||
const queryFormRef = ref()
|
||||
const formRef = ref()
|
||||
const dialogVisible = ref(false)
|
||||
const dialogTitle = ref('')
|
||||
const formType = ref<'create' | 'update'>('create')
|
||||
|
||||
const queryParams = reactive<YearKValueApi.YearKValuePageReqVO>({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
kYear: undefined,
|
||||
enabledFlag: undefined
|
||||
})
|
||||
|
||||
const getRowIndex = (index: number) =>
|
||||
(queryParams.pageNo - 1) * queryParams.pageSize + index + 1
|
||||
|
||||
const createFormData = (): YearKValueApi.YearKValueVO => ({
|
||||
kYear: new Date().getFullYear(),
|
||||
kValue: 0.4,
|
||||
enabledFlag: true,
|
||||
remark: ''
|
||||
})
|
||||
|
||||
const formData = ref<YearKValueApi.YearKValueVO>(createFormData())
|
||||
|
||||
const queryYearValue = computed({
|
||||
get: () => (queryParams.kYear ? String(queryParams.kYear) : undefined),
|
||||
set: (value?: string) => {
|
||||
queryParams.kYear = value ? Number(value) : undefined
|
||||
}
|
||||
})
|
||||
|
||||
const formYearValue = computed({
|
||||
get: () => (formData.value.kYear ? String(formData.value.kYear) : undefined),
|
||||
set: (value?: string) => {
|
||||
formData.value.kYear = value ? Number(value) : undefined
|
||||
}
|
||||
})
|
||||
|
||||
const kValuePercent = computed({
|
||||
get: () => toPercentValue(formData.value.kValue) ?? 0,
|
||||
set: (value?: number) => {
|
||||
formData.value.kValue = fromPercentValue(value) ?? undefined
|
||||
}
|
||||
})
|
||||
|
||||
const formRules = reactive<FormRules>({
|
||||
kYear: [{ required: true, message: '年度不能为空', trigger: 'change' }],
|
||||
kValue: [{ required: true, message: 'K值不能为空', trigger: 'change' }]
|
||||
})
|
||||
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await YearKValueApi.getYearKValuePage(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()
|
||||
formRef.value?.clearValidate()
|
||||
}
|
||||
|
||||
const openDialog = async (type: 'create' | 'update', id?: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = type === 'create' ? '新增年度K值' : '编辑年度K值'
|
||||
formType.value = type
|
||||
await nextTick()
|
||||
resetForm()
|
||||
if (!id) {
|
||||
return
|
||||
}
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await YearKValueApi.getYearKValue(id)
|
||||
formRef.value?.clearValidate()
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const buildSavePayload = (): YearKValueApi.YearKValueVO => ({
|
||||
id: formData.value.id,
|
||||
kYear: Number(formData.value.kYear),
|
||||
kValue: Number(formData.value.kValue),
|
||||
remark: formData.value.remark?.trim() || '',
|
||||
enabledFlag: formData.value.enabledFlag ?? true
|
||||
})
|
||||
|
||||
const submitForm = async () => {
|
||||
if (!formRef.value) {
|
||||
return
|
||||
}
|
||||
const valid = await formRef.value.validate()
|
||||
if (!valid) {
|
||||
return
|
||||
}
|
||||
formLoading.value = true
|
||||
try {
|
||||
const payload = buildSavePayload()
|
||||
if (formType.value === 'create') {
|
||||
await YearKValueApi.createYearKValue(payload)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await YearKValueApi.updateYearKValue(payload)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
await getList()
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
await message.delConfirm()
|
||||
await YearKValueApi.deleteYearKValue(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
let activatedOnce = false
|
||||
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
|
||||
onActivated(() => {
|
||||
// KeepAlive 首次挂载也会触发 onActivated,跳过首轮避免重复请求列表。
|
||||
if (!activatedOnce) {
|
||||
activatedOnce = true
|
||||
return
|
||||
}
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
Reference in New Issue
Block a user