Compare commits
8 Commits
8f9205a6a1
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 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>
|
||||
|
||||
65
src/api/tjt/employee/index.ts
Normal file
65
src/api/tjt/employee/index.ts
Normal file
@@ -0,0 +1,65 @@
|
||||
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
|
||||
sortNo?: number
|
||||
enabledFlag?: boolean
|
||||
createTime?: string
|
||||
}
|
||||
|
||||
export interface EmployeePageReqVO extends PageParam {
|
||||
employeeName?: string
|
||||
officeId?: number
|
||||
employeeStatus?: string
|
||||
enabledFlag?: boolean
|
||||
}
|
||||
|
||||
export interface EmployeeSimpleVO {
|
||||
id: number
|
||||
employeeName: string
|
||||
officeId?: number
|
||||
officeName?: string
|
||||
employeeStatus?: string
|
||||
registrationType?: string
|
||||
jobTitle?: string
|
||||
}
|
||||
|
||||
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
|
||||
}) => {
|
||||
return request.get({ url: '/tjt/employee/simple-list', params })
|
||||
}
|
||||
40
src/api/tjt/employeeYearCostBudget/index.ts
Normal file
40
src/api/tjt/employeeYearCostBudget/index.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
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 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 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 } })
|
||||
}
|
||||
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' })
|
||||
}
|
||||
@@ -9,11 +9,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 +34,7 @@ export interface ProjectOutputSplitVO {
|
||||
export type ProjectOutputSplitSaveVO = Pick<
|
||||
ProjectOutputSplitVO,
|
||||
| 'planningId'
|
||||
| 'projectManagerRatio'
|
||||
| 'engineeringLeaderRatio'
|
||||
| 'projectLeadRatio'
|
||||
| 'officeRatio'
|
||||
| 'archRatio'
|
||||
| 'decorRatio'
|
||||
|
||||
@@ -3,12 +3,18 @@ import request from '@/config/axios'
|
||||
export interface ProjectPlanningVO {
|
||||
id?: number
|
||||
projectId: number
|
||||
sortNo?: number
|
||||
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 +37,6 @@ export interface ProjectPlanningVO {
|
||||
workingDayUnitPrice?: number
|
||||
guidanceUnitPrice?: number
|
||||
guidanceTotalPrice?: number
|
||||
virtualTotalPrice?: number
|
||||
calculationRatio?: number
|
||||
contractUnitPrice?: number
|
||||
totalAdjustmentFactor?: number
|
||||
@@ -45,7 +50,10 @@ export type ProjectPlanningSaveVO = Omit<
|
||||
ProjectPlanningVO,
|
||||
| 'allocatedAmount'
|
||||
| 'pendingAmount'
|
||||
| 'planningAmount'
|
||||
| 'managementFee'
|
||||
| 'vatAmount'
|
||||
| 'projectBudgetOutputValue'
|
||||
| 'contractUnitPrice'
|
||||
| 'totalAdjustmentFactor'
|
||||
| 'assessmentArea'
|
||||
|
||||
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 } })
|
||||
}
|
||||
@@ -3,14 +3,17 @@ import request from '@/config/axios'
|
||||
export interface ProjectProfitVO {
|
||||
projectId: number
|
||||
projectName: string
|
||||
sortNo?: number
|
||||
contractSignedFlag: boolean
|
||||
contractAmount?: number
|
||||
finalSettlementAmount?: number
|
||||
comprehensivePlanningAmount?: number
|
||||
subcontractPlanningAmount?: number
|
||||
majorOutputValue?: number
|
||||
expectedKValue?: number
|
||||
majorExpectedPerformance?: number
|
||||
innovationOutputRate?: number
|
||||
innovationOutputValue?: number
|
||||
otherCost?: number
|
||||
profitLossValue?: number
|
||||
profitLossRate?: number
|
||||
projectStartYear?: number
|
||||
|
||||
@@ -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?: number
|
||||
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[]
|
||||
}
|
||||
|
||||
|
||||
66
src/api/tjt/report/index.ts
Normal file
66
src/api/tjt/report/index.ts
Normal file
@@ -0,0 +1,66 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
export interface ProjectOverviewExportReqVO {
|
||||
year?: number
|
||||
officeId?: number
|
||||
sortType?: string
|
||||
}
|
||||
|
||||
export interface EmployeeOutputSummaryExportReqVO {
|
||||
year?: number
|
||||
officeId?: number
|
||||
employeeId?: number
|
||||
employeeStatus?: string
|
||||
sortType?: string
|
||||
}
|
||||
|
||||
export interface ProjectBudgetExportReqVO {
|
||||
projectId: number
|
||||
year?: number
|
||||
}
|
||||
|
||||
export interface ProjectQuarterOutputExportReqVO {
|
||||
planningId: number
|
||||
year?: number
|
||||
}
|
||||
|
||||
export interface ProjectLeadQuarterOutputExportReqVO {
|
||||
planningId: number
|
||||
year?: number
|
||||
}
|
||||
|
||||
export interface SpecialtyPersonOutputExportReqVO {
|
||||
planningId: number
|
||||
specialtyCode: string
|
||||
year?: number
|
||||
}
|
||||
|
||||
export const exportProjectBudget = (params: ProjectBudgetExportReqVO) => {
|
||||
return request.download({ url: '/tjt/report/project-budget/export-excel', params })
|
||||
}
|
||||
|
||||
export const exportProjectQuarterOutput = (params: ProjectQuarterOutputExportReqVO) => {
|
||||
return request.download({
|
||||
url: '/tjt/report/project-quarter-output/export-excel',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export const exportProjectLeadQuarterOutput = (params: ProjectLeadQuarterOutputExportReqVO) => {
|
||||
return request.download({
|
||||
url: '/tjt/report/project-lead-quarter-output/export-excel',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export const exportSpecialtyPersonOutput = (params: SpecialtyPersonOutputExportReqVO) => {
|
||||
return request.download({ url: '/tjt/report/specialty-person-output/export-excel', params })
|
||||
}
|
||||
|
||||
export const exportProjectOverview = (params: ProjectOverviewExportReqVO) => {
|
||||
return request.download({ url: '/tjt/report/project-overview/export-excel', params })
|
||||
}
|
||||
|
||||
export const exportEmployeeOutputSummary = (params: EmployeeOutputSummaryExportReqVO) => {
|
||||
return request.download({ url: '/tjt/report/employee-output-summary/export-excel', params })
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
export interface SpecialtyRolePersonVO {
|
||||
personName?: string
|
||||
employeeId?: number
|
||||
employeeName?: string
|
||||
personRatio?: number
|
||||
personAmount?: 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')
|
||||
},
|
||||
// 下载图片(允许跨域)
|
||||
|
||||
353
src/views/tjt/employee-year-cost-budget/index.vue
Normal file
353
src/views/tjt/employee-year-cost-budget/index.vue
Normal file
@@ -0,0 +1,353 @@
|
||||
<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-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column align="center" label="ID" prop="id" width="88" />
|
||||
<el-table-column 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" />
|
||||
<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>
|
||||
</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 { 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 total = ref(0)
|
||||
const list = ref<EmployeeYearCostBudgetApi.EmployeeYearCostBudgetVO[]>([])
|
||||
const employeeOptions = ref<EmployeeApi.EmployeeSimpleVO[]>([])
|
||||
const queryFormRef = ref()
|
||||
const formRef = ref()
|
||||
const dialogVisible = 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 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 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 formRules = reactive<FormRules>({
|
||||
employeeId: [{ required: true, message: '员工不能为空', trigger: 'change' }],
|
||||
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 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 handleDelete = async (id: number) => {
|
||||
try {
|
||||
await message.delConfirm()
|
||||
await EmployeeYearCostBudgetApi.deleteEmployeeYearCostBudget(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
|
||||
onActivated(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
459
src/views/tjt/employee/index.vue
Normal file
459
src/views/tjt/employee/index.vue
Normal file
@@ -0,0 +1,459 @@
|
||||
<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>
|
||||
<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 align="center" label="ID" prop="id" 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" />
|
||||
<el-table-column align="center" label="离职时间" prop="leaveDate" width="120" />
|
||||
<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.enabledFlag ? 'success' : 'info'">
|
||||
{{ scope.row.enabledFlag ? '启用' : '停用' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="创建时间" prop="createTime" width="180" />
|
||||
<el-table-column align="center" fixed="right" label="操作" width="160">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
v-hasPermi="['tjt:employee:update']"
|
||||
link
|
||||
type="primary"
|
||||
@click="openDialog('update', scope.row.id)"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-hasPermi="['tjt:employee:delete']"
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row.id)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<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-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'
|
||||
|
||||
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
|
||||
})
|
||||
|
||||
const createFormData = (): EmployeeApi.EmployeeVO => ({
|
||||
employeeName: '',
|
||||
gender: '男',
|
||||
officeId: undefined as never,
|
||||
registrationType: '',
|
||||
jobTitle: undefined,
|
||||
registrationSealNo: '',
|
||||
entryDate: undefined,
|
||||
leaveDate: undefined,
|
||||
employeeStatus: '在职',
|
||||
remark: '',
|
||||
sortNo: 0,
|
||||
enabledFlag: true
|
||||
})
|
||||
|
||||
const formData = ref<EmployeeApi.EmployeeVO>(createFormData())
|
||||
|
||||
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 {
|
||||
formData.value = await EmployeeApi.getEmployee(id)
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
await message.delConfirm()
|
||||
await EmployeeApi.deleteEmployee(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await loadOfficeOptions()
|
||||
await getList()
|
||||
})
|
||||
|
||||
onActivated(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
236
src/views/tjt/office/index.vue
Normal file
236
src/views/tjt/office/index.vue
Normal file
@@ -0,0 +1,236 @@
|
||||
<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 align="center" label="ID" prop="id" 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" />
|
||||
<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'
|
||||
|
||||
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 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 {}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
|
||||
onActivated(() => {
|
||||
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"
|
||||
@@ -69,11 +74,8 @@
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="8">
|
||||
<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,13 +84,20 @@
|
||||
highlight-current-row
|
||||
@current-change="handleCurrentPlanningChange"
|
||||
>
|
||||
<el-table-column align="center" label="规划内容" min-width="180" prop="planningContent" />
|
||||
<el-table-column align="center" label="序号" type="index" width="70" />
|
||||
<el-table-column align="center" label="项目任务包" min-width="180" prop="planningContent" />
|
||||
<el-table-column align="center" label="归属类型" min-width="110">
|
||||
<template #default="scope">
|
||||
{{ getOwnershipTypeLabel(scope.row.ownershipType) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="开始年度" prop="planningStartYear" width="100" />
|
||||
<el-table-column align="center" label="考核产值(元)" width="120">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.assessmentOutputValue) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="排序" prop="sortNo" width="80" />
|
||||
</el-table>
|
||||
</ContentWrap>
|
||||
</el-col>
|
||||
@@ -112,23 +121,20 @@
|
||||
<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-item label="项目任务包">{{ formData.planningContent || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="工程负责人">
|
||||
{{ getProjectLeadText(formData.projectManagerName, formData.engineeringLeaderName) }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<el-divider content-position="left">项目层结果</el-divider>
|
||||
<el-table :data="projectResultRows" border>
|
||||
<el-table-column align="center" label="类别" min-width="140" prop="label" />
|
||||
<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 }}
|
||||
@@ -157,7 +163,7 @@
|
||||
</el-table>
|
||||
|
||||
<el-divider content-position="left">年度分配信息</el-divider>
|
||||
<div class="mb-12px flex flex-wrap items-start justify-between gap-12px">
|
||||
<div class="mb-12px">
|
||||
<el-radio-group v-model="selectedAnnualCategory" size="small">
|
||||
<el-radio-button
|
||||
v-for="item in annualCategoryOptions"
|
||||
@@ -171,12 +177,8 @@
|
||||
<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 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>
|
||||
@@ -202,19 +204,18 @@
|
||||
</ContentWrap>
|
||||
|
||||
<ContentWrap v-else>
|
||||
<el-empty description="请选择专业所规划后查看页面4结果" />
|
||||
<el-empty description="请选择合约规划后查看分配结果" />
|
||||
</ContentWrap>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<Dialog v-model="dialogVisible" title="编辑专业及项目总分配比例" width="900">
|
||||
<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 +226,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 +237,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 +249,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 +257,7 @@
|
||||
专业层比例合计:{{ specialtyRatioTotalText }}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template #footer>
|
||||
<el-button :loading="saveLoading" type="primary" @click="handleSave">保存</el-button>
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
@@ -275,7 +273,7 @@ import * as OutputSplitApi from '@/api/tjt/outputSplit'
|
||||
import {
|
||||
formatAmountText,
|
||||
fromPercentValue,
|
||||
isMajorOwnership,
|
||||
getOwnershipTypeLabel,
|
||||
OUTPUT_SPLIT_SPECIALTY_OPTIONS,
|
||||
QUARTER_OPTIONS,
|
||||
toPercentValue
|
||||
@@ -284,8 +282,7 @@ import {
|
||||
defineOptions({ name: 'TjtOutputSplit' })
|
||||
|
||||
type AnnualCategoryKey =
|
||||
| 'projectManager'
|
||||
| 'engineeringLeader'
|
||||
| 'project_lead'
|
||||
| 'arch'
|
||||
| 'decor'
|
||||
| 'struct'
|
||||
@@ -300,8 +297,7 @@ interface QuarterYearRow {
|
||||
}
|
||||
|
||||
const annualCategoryOptions: { label: string; value: AnnualCategoryKey }[] = [
|
||||
{ label: '项目经理', value: 'projectManager' },
|
||||
{ label: '项目负责人', value: 'engineeringLeader' },
|
||||
{ label: '项目经理/工程负责人', value: 'project_lead' },
|
||||
{ label: '建筑专业', value: 'arch' },
|
||||
{ label: '装修专业', value: 'decor' },
|
||||
{ label: '结构专业', value: 'struct' },
|
||||
@@ -325,7 +321,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>('project_lead')
|
||||
const dialogVisible = ref(false)
|
||||
const queryFormRef = ref()
|
||||
const projectTableRef = ref()
|
||||
@@ -338,6 +334,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 +349,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 +403,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 +416,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 === 'project_lead') {
|
||||
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 +465,7 @@ const annualSummaryCards = computed(() => [
|
||||
currentPlanning.value?.assessmentOutputValue,
|
||||
currentPlanning.value?.totalDistributionAmount,
|
||||
annualCategoryMeta.value.ratio
|
||||
),
|
||||
percentText: formatRatioText(currentPlanning.value?.totalDistributionAmount)
|
||||
)
|
||||
},
|
||||
{
|
||||
label: '已分配',
|
||||
@@ -562,8 +473,7 @@ const annualSummaryCards = computed(() => [
|
||||
currentPlanning.value?.assessmentOutputValue,
|
||||
currentPlanning.value?.allocatedAmount,
|
||||
annualCategoryMeta.value.ratio
|
||||
),
|
||||
percentText: formatRatioText(currentPlanning.value?.allocatedAmount)
|
||||
)
|
||||
},
|
||||
{
|
||||
label: '待分配',
|
||||
@@ -571,8 +481,7 @@ const annualSummaryCards = computed(() => [
|
||||
currentPlanning.value?.assessmentOutputValue,
|
||||
currentPlanning.value?.pendingAmount,
|
||||
annualCategoryMeta.value.ratio
|
||||
),
|
||||
percentText: formatRatioText(currentPlanning.value?.pendingAmount)
|
||||
)
|
||||
}
|
||||
])
|
||||
|
||||
@@ -599,12 +508,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 +595,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
|
||||
@@ -771,7 +675,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 +684,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 +694,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,
|
||||
@@ -826,3 +731,23 @@ onActivated(() => {
|
||||
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
@@ -175,7 +175,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())
|
||||
}
|
||||
@@ -184,13 +189,15 @@ 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
|
||||
? { ...match }
|
||||
: buildQuarterCell(planning.id!, distributionYear, option.value)
|
||||
: buildQuarterCell(planning.id!, distributionYear, quarterNo)
|
||||
})
|
||||
}))
|
||||
}
|
||||
@@ -204,6 +211,9 @@ const open = async (id: number) => {
|
||||
const planning = await PlanningApi.getProjectPlanning(id)
|
||||
formData.value = {
|
||||
...planning,
|
||||
contractValueQuantity: planning.contractValueQuantity ?? 1,
|
||||
contractValueUnitPrice: planning.contractValueUnitPrice ?? planning.planningAmount,
|
||||
vatRate: planning.vatRate ?? 0.06,
|
||||
totalDistributionAmount: planning.totalDistributionAmount ?? 1,
|
||||
progressRemark: planning.progressRemark ?? ''
|
||||
}
|
||||
@@ -253,12 +263,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
|
||||
}
|
||||
@@ -301,11 +318,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 +346,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,7 +84,7 @@
|
||||
</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>
|
||||
@@ -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"
|
||||
@@ -120,16 +127,25 @@
|
||||
highlight-current-row
|
||||
@current-change="handleCurrentPlanningChange"
|
||||
>
|
||||
<el-table-column align="center" label="序号" type="index" width="70" />
|
||||
<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,6 +160,7 @@
|
||||
{{ formatAmountText(scope.row.assessmentOutputValue) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="排序" prop="sortNo" width="80" />
|
||||
</el-table>
|
||||
</ContentWrap>
|
||||
</el-col>
|
||||
@@ -154,7 +171,8 @@
|
||||
<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 +195,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 +208,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 +221,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 +236,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 +263,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 +283,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="考核面积(㎡)">
|
||||
@@ -382,7 +396,11 @@ import {
|
||||
formatAmountText,
|
||||
formatAreaText,
|
||||
formatPercentText,
|
||||
getCalculationMethodLabel,
|
||||
getCalculationRatioLabel,
|
||||
getDesignStageLabel,
|
||||
getOwnershipTypeLabel,
|
||||
getVirtualCalculationMethodLabel,
|
||||
isComprehensiveOwnership,
|
||||
isContractPriceMethod,
|
||||
isGuidancePriceMethod,
|
||||
@@ -420,6 +438,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 +456,42 @@ 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 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 +502,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 +516,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
|
||||
}
|
||||
@@ -571,14 +619,6 @@ const handleCurrentPlanningChange = async (row?: PlanningApi.ProjectPlanningVO)
|
||||
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()
|
||||
|
||||
|
||||
@@ -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,7 +78,7 @@
|
||||
</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>
|
||||
@@ -102,16 +103,26 @@
|
||||
{{ formatAmountText(scope.row.majorOutputValue) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="预计 K 值" width="100">
|
||||
<template #default="scope">
|
||||
{{ formatPercentText(scope.row.expectedKValue) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="专业所预计绩效(元)" width="150">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.majorExpectedPerformance) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="科创产值比例" width="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="120">
|
||||
<template #default="scope">
|
||||
<span :class="profitLossClass(scope.row.profitLossValue)">
|
||||
@@ -126,6 +137,7 @@
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="排序" prop="sortNo" width="80" />
|
||||
</el-table>
|
||||
<Pagination
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@@ -137,23 +149,15 @@
|
||||
|
||||
<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>
|
||||
<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>
|
||||
|
||||
<el-descriptions :column="3" border>
|
||||
<el-descriptions-item label="合同金额(元)">
|
||||
<el-descriptions-item label="合同产值(元)">
|
||||
{{ formatAmountText(currentProfit.contractAmount) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="最终结算金额(元)">
|
||||
@@ -171,12 +175,18 @@
|
||||
<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="科创产值比例">
|
||||
{{ formatPercentText(currentProfit.innovationOutputRate) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="科创产值(元)">
|
||||
{{ formatAmountText(currentProfit.innovationOutputValue) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="其他成本(元)">
|
||||
{{ formatAmountText(currentProfit.otherCost) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="盈亏值(元)">
|
||||
<span :class="profitLossClass(currentProfit.profitLossValue)">
|
||||
{{ formatAmountText(currentProfit.profitLossValue) }}
|
||||
@@ -187,9 +197,6 @@
|
||||
{{ formatPercentText(currentProfit.profitLossRate) }}
|
||||
</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="创建时间">
|
||||
{{ currentProfit.createTime || '-' }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</ContentWrap>
|
||||
|
||||
@@ -198,7 +205,7 @@
|
||||
</ContentWrap>
|
||||
|
||||
<Dialog v-model="dialogVisible" title="编辑盈亏参数" width="520">
|
||||
<el-form ref="formRef" v-loading="dialogLoading" :model="formData" :rules="formRules" label-width="140px">
|
||||
<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"
|
||||
@@ -209,17 +216,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,11 +247,11 @@
|
||||
</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,
|
||||
@@ -256,17 +275,25 @@ 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 +303,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) => {
|
||||
@@ -294,8 +324,7 @@ const getList = async () => {
|
||||
return
|
||||
}
|
||||
const targetProjectId = currentProfit.value?.projectId || list.value[0].projectId
|
||||
const targetProfit =
|
||||
list.value.find((item) => item.projectId === targetProjectId) || list.value[0]
|
||||
const targetProfit = list.value.find((item) => item.projectId === targetProjectId) || list.value[0]
|
||||
await nextTick()
|
||||
profitTableRef.value?.setCurrentRow(targetProfit)
|
||||
} finally {
|
||||
@@ -336,7 +365,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 +381,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())
|
||||
|
||||
@@ -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,32 @@
|
||||
/>
|
||||
</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-input
|
||||
v-model="formData.implementationTeam"
|
||||
maxlength="100"
|
||||
placeholder="请输入实施团队"
|
||||
<el-form-item label="排序" prop="sortNo">
|
||||
<el-input-number
|
||||
v-model="formData.sortNo"
|
||||
:min="0"
|
||||
:precision="0"
|
||||
:step="1"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -113,23 +154,23 @@
|
||||
<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 OWNERSHIP_TYPE_LABELS = ['专业所', '综合所', '专业分包']
|
||||
const ownershipTypeOptions = OWNERSHIP_TYPE_OPTIONS.map((item, index) => ({
|
||||
label: OWNERSHIP_TYPE_LABELS[index] || item.label,
|
||||
value: item.value
|
||||
}))
|
||||
|
||||
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 +178,18 @@ const createFormData = (
|
||||
planningAmount?: number
|
||||
): PlanningApi.ProjectPlanningVO => ({
|
||||
projectId: projectId || 0,
|
||||
ownershipType: OWNERSHIP_TYPE_OPTIONS[0].value,
|
||||
calculationMethod: CALCULATION_METHOD_OPTIONS[0].value,
|
||||
sortNo: 0,
|
||||
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 +198,8 @@ const createFormData = (
|
||||
reviewOutsourceRatio: undefined,
|
||||
totalDistributionAmount: 1,
|
||||
progressRemark: '',
|
||||
allocatedAmount: undefined,
|
||||
pendingAmount: undefined,
|
||||
buildingOrUnitCount: undefined,
|
||||
drawingSetFactor: 1,
|
||||
scaleFactor: 1,
|
||||
@@ -162,42 +211,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 ?? 0,
|
||||
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 +317,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 +329,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 +337,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 +385,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,266 @@
|
||||
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 === '暂停'"
|
||||
v-model="formData.pauseReason"
|
||||
maxlength="255"
|
||||
placeholder="请输入暂停原因"
|
||||
/>
|
||||
<el-input
|
||||
v-else-if="formData.projectStatus === '中止'"
|
||||
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-number
|
||||
v-model="formData.sortNo"
|
||||
:min="0"
|
||||
:precision="0"
|
||||
:step="1"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</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 +274,62 @@
|
||||
|
||||
<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'
|
||||
|
||||
defineOptions({ name: 'TjtProjectForm' })
|
||||
|
||||
const ROLE_PROJECT_MANAGER = 'project_manager'
|
||||
const ROLE_ENGINEERING_PRINCIPAL = 'engineering_principal'
|
||||
|
||||
const PROJECT_TYPE_OPTIONS = [
|
||||
{ label: '建筑工程', value: '建筑工程' },
|
||||
{ label: '精装工程', value: '精装工程' },
|
||||
{ label: '综合工程', value: '综合工程' },
|
||||
{ label: '专项设计', value: '专项设计' },
|
||||
{ label: 'BIM设计', value: 'BIM设计' },
|
||||
{ label: '其他', value: '其他' }
|
||||
]
|
||||
|
||||
const PROJECT_CATEGORY_OPTIONS = [
|
||||
{ label: '住宅', value: '住宅' },
|
||||
{ label: '公建', value: '公建' },
|
||||
{ label: '工业', value: '工业' },
|
||||
{ label: '园林景观', value: '园林景观' },
|
||||
{ label: '其他', value: '其他' }
|
||||
]
|
||||
|
||||
const PROJECT_STATUS_OPTIONS = [
|
||||
{ label: '进行中', value: '进行中' },
|
||||
{ label: '完成', value: '完成' },
|
||||
{ label: '暂停', value: '暂停' },
|
||||
{ label: '中止', value: '中止' }
|
||||
]
|
||||
|
||||
const DEFAULT_INNOVATION_OUTPUT_RATE = 0.01
|
||||
|
||||
const { 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: 0,
|
||||
contractSignedFlag: true,
|
||||
contractAmount: undefined,
|
||||
totalConstructionArea: undefined,
|
||||
@@ -166,14 +337,99 @@ const createFormData = (): ProjectApi.ProjectVO => ({
|
||||
contactName: '',
|
||||
contactPhone: '',
|
||||
contractSigningDate: undefined,
|
||||
projectManagerName: '',
|
||||
engineeringPrincipalName: '',
|
||||
projectType: '',
|
||||
projectStartYear: new Date().getFullYear()
|
||||
projectCategory: '',
|
||||
projectStartYear: new Date().getFullYear(),
|
||||
projectStatus: '进行中',
|
||||
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, '进行中'),
|
||||
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 +437,61 @@ const projectStartYearValue = computed({
|
||||
}
|
||||
})
|
||||
|
||||
const statusReasonLabel = computed(() =>
|
||||
formData.value.projectStatus === '中止' ? '中止原因' : '暂停原因'
|
||||
)
|
||||
|
||||
const statusReasonProp = computed(() =>
|
||||
formData.value.projectStatus === '中止' ? 'terminateReason' : 'pauseReason'
|
||||
)
|
||||
|
||||
watch(
|
||||
() => formData.value.projectStatus,
|
||||
(status) => {
|
||||
if (status !== '暂停') {
|
||||
formData.value.pauseReason = ''
|
||||
}
|
||||
if (status !== '中止') {
|
||||
formData.value.terminateReason = ''
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
const formRules = reactive<FormRules>({
|
||||
projectName: [{ required: true, message: '工程名称不能为空', trigger: 'blur' }],
|
||||
contractAmount: [{ required: true, message: '合同金额不能为空', trigger: 'blur' }],
|
||||
projectName: [{ required: true, message: '项目名称不能为空', trigger: 'blur' }],
|
||||
contractAmount: [{ required: true, message: '合同产值不能为空', trigger: 'blur' }],
|
||||
totalConstructionArea: [{ required: true, message: '工程总面积不能为空', trigger: 'blur' }],
|
||||
projectStartYear: [{ required: true, message: '项目开始年度不能为空', trigger: 'change' }]
|
||||
projectStartYear: [{ required: true, message: '项目开始年度不能为空', trigger: 'change' }],
|
||||
projectStatus: [{ required: true, message: '项目状态不能为空', trigger: 'change' }],
|
||||
pauseReason: [
|
||||
{
|
||||
validator: (_rule, value, callback) => {
|
||||
if (formData.value.projectStatus === '暂停' && !String(value || '').trim()) {
|
||||
callback(new Error('暂停状态必须填写暂停原因'))
|
||||
return
|
||||
}
|
||||
callback()
|
||||
},
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
terminateReason: [
|
||||
{
|
||||
validator: (_rule, value, callback) => {
|
||||
if (formData.value.projectStatus === '中止' && !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 +499,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 +512,7 @@ const emit = defineEmits(['success'])
|
||||
const buildSavePayload = (): ProjectApi.ProjectSaveVO => ({
|
||||
id: formData.value.id,
|
||||
projectName: formData.value.projectName,
|
||||
sortNo: formData.value.sortNo ?? 0,
|
||||
contractSignedFlag: formData.value.contractSignedFlag,
|
||||
contractAmount: formData.value.contractAmount,
|
||||
totalConstructionArea: formData.value.totalConstructionArea,
|
||||
@@ -217,12 +520,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 +566,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,63 @@
|
||||
<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="工程总面积(m²)">
|
||||
{{ formatAreaText(currentProject.totalConstructionArea) }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
@@ -200,21 +229,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 +267,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 +324,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 +346,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 = cleanOptionLabels(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 +403,13 @@ 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 queryProjectStartYearValue = computed({
|
||||
get: () => (queryParams.projectStartYear ? String(queryParams.projectStartYear) : undefined),
|
||||
set: (value?: string) => {
|
||||
@@ -307,6 +417,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 +480,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 +526,11 @@ const handlePlanningFormSuccess = async () => {
|
||||
await getPlanningList()
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await getList()
|
||||
await getPlanningList()
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
|
||||
onActivated(async () => {
|
||||
await getList()
|
||||
await getPlanningList()
|
||||
onActivated(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
|
||||
394
src/views/tjt/report-budget/index.vue
Normal file
394
src/views/tjt/report-budget/index.vue
Normal file
@@ -0,0 +1,394 @@
|
||||
<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>
|
||||
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="8">
|
||||
<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>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="16">
|
||||
<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="序号" type="index" width="70" />
|
||||
<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>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<Dialog v-model="exportDialogVisible" title="导出项目考核产值预算表" width="420">
|
||||
<el-form label-width="88px">
|
||||
<el-form-item label="年度">
|
||||
<el-date-picker
|
||||
v-model="exportYearValue"
|
||||
class="!w-220px"
|
||||
clearable
|
||||
placeholder="请选择年度"
|
||||
type="year"
|
||||
value-format="YYYY"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<template #footer>
|
||||
<el-button @click="exportDialogVisible = false">取消</el-button>
|
||||
<el-button :loading="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 {
|
||||
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 exportLoading = ref(false)
|
||||
const exportDialogVisible = ref(false)
|
||||
const exportYear = ref<number>()
|
||||
const total = ref(0)
|
||||
const projectList = ref<ProjectApi.ProjectVO[]>([])
|
||||
const planningList = ref<PlanningApi.ProjectPlanningVO[]>([])
|
||||
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) * queryParams.pageSize + 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 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 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 = []
|
||||
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 handleQuery = () => {
|
||||
queryParams.pageNo = 1
|
||||
getProjectList()
|
||||
}
|
||||
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
const handleCurrentProjectChange = async (row?: ProjectApi.ProjectVO) => {
|
||||
currentProject.value = row || undefined
|
||||
await getPlanningList()
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getProjectList()
|
||||
})
|
||||
|
||||
onActivated(() => {
|
||||
getProjectList()
|
||||
})
|
||||
</script>
|
||||
694
src/views/tjt/report-project-quarter/index.vue
Normal file
694
src/views/tjt/report-project-quarter/index.vue
Normal file
@@ -0,0 +1,694 @@
|
||||
<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>
|
||||
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="8">
|
||||
<ContentWrap>
|
||||
<div class="mb-12px text-14px font-600">
|
||||
{{ currentProject?.projectName || '合约规划列表' }}
|
||||
</div>
|
||||
<el-table
|
||||
ref="planningTableRef"
|
||||
v-loading="planningLoading"
|
||||
:data="planningList"
|
||||
highlight-current-row
|
||||
@current-change="handleCurrentPlanningChange"
|
||||
>
|
||||
<el-table-column align="center" label="序号" type="index" width="70" />
|
||||
<el-table-column align="center" label="项目任务包" min-width="180" prop="planningContent" />
|
||||
<el-table-column align="center" label="归属类型" min-width="110">
|
||||
<template #default="scope">
|
||||
{{ getOwnershipTypeLabel(scope.row.ownershipType) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="开始年度" prop="planningStartYear" width="100" />
|
||||
<el-table-column align="center" label="考核产值(元)" width="120">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.assessmentOutputValue) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="排序" prop="sortNo" width="80" />
|
||||
</el-table>
|
||||
</ContentWrap>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="16">
|
||||
<ContentWrap v-if="currentPlanning && formData">
|
||||
<div class="mb-16px flex items-center justify-between gap-16px">
|
||||
<div>
|
||||
<div class="text-16px font-600">{{ currentPlanning.planningContent }}</div>
|
||||
</div>
|
||||
<div class="flex items-center gap-12px">
|
||||
<el-button
|
||||
v-hasPermi="['tjt:report-project-quarter:export']"
|
||||
:loading="exportQuarterLoading"
|
||||
plain
|
||||
type="success"
|
||||
@click="handleExportProjectQuarter"
|
||||
>
|
||||
<Icon class="mr-5px" icon="ep:download" />
|
||||
导出专业间年度季度计取表
|
||||
</el-button>
|
||||
<el-button
|
||||
v-hasPermi="['tjt:report-project-quarter:export']"
|
||||
:loading="exportLeadLoading"
|
||||
plain
|
||||
type="success"
|
||||
@click="handleExportProjectLeadQuarter"
|
||||
>
|
||||
<Icon class="mr-5px" icon="ep:download" />
|
||||
导出工程负责人计取表
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-descriptions :column="2" border title="基础信息">
|
||||
<el-descriptions-item label="项目名称">{{ formData.projectName || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="项目任务包">{{ formData.planningContent || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="工程负责人">
|
||||
{{ getProjectLeadText(formData.projectManagerName, formData.engineeringLeaderName) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="考核产值(元)">
|
||||
{{ formatAmountText(formData.assessmentOutputValue) }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<el-divider content-position="left">项目层结果</el-divider>
|
||||
<el-table :data="projectResultRows" border>
|
||||
<el-table-column align="center" label="类别" min-width="160" prop="label" />
|
||||
<el-table-column align="center" label="比例" min-width="120">
|
||||
<template #default="scope">
|
||||
{{ scope.row.percentText }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="金额(元)" min-width="140">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.amount) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-divider content-position="left">专业层结果</el-divider>
|
||||
<el-table :data="specialtyResultRows" border>
|
||||
<el-table-column align="center" label="专业" min-width="140" prop="label" />
|
||||
<el-table-column align="center" label="比例" min-width="120">
|
||||
<template #default="scope">
|
||||
{{ scope.row.percentText }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="金额(元)" min-width="140">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.amount) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-divider content-position="left">年度分配信息</el-divider>
|
||||
<div class="mb-12px">
|
||||
<el-radio-group v-model="selectedAnnualCategory" size="small">
|
||||
<el-radio-button
|
||||
v-for="item in annualCategoryOptions"
|
||||
:key="item.value"
|
||||
:label="item.value"
|
||||
>
|
||||
{{ item.label }}
|
||||
</el-radio-button>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
<el-row :gutter="16" class="mb-16px">
|
||||
<el-col v-for="item in annualSummaryCards" :key="item.label" :span="8">
|
||||
<div class="rounded-8px bg-[var(--el-fill-color-light)] px-16px py-12px">
|
||||
<div class="text-12px text-[var(--el-text-color-secondary)]">{{ item.label }}</div>
|
||||
<div class="mt-6px text-18px font-600">{{ formatAmountText(item.amount) }}</div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-table v-loading="quarterLoading" :data="annualDistributionRows" border>
|
||||
<el-table-column align="center" label="分配年度" min-width="120" prop="distributionYear" />
|
||||
<el-table-column
|
||||
v-for="quarter in QUARTER_OPTIONS"
|
||||
:key="String(quarter.value)"
|
||||
align="center"
|
||||
:label="quarter.label"
|
||||
min-width="150"
|
||||
>
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.quarterAmounts[Number(quarter.value)]) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="年度合计(元)" min-width="160">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.yearTotal) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</ContentWrap>
|
||||
|
||||
<ContentWrap v-else>
|
||||
<el-empty description="请选择合约规划后查看导出预览" />
|
||||
</ContentWrap>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<Dialog v-model="exportDialogVisible" :title="exportDialogTitle" width="420">
|
||||
<el-form label-width="88px">
|
||||
<el-form-item label="年度">
|
||||
<el-date-picker
|
||||
v-model="exportYearValue"
|
||||
class="!w-220px"
|
||||
clearable
|
||||
placeholder="请选择年度"
|
||||
type="year"
|
||||
value-format="YYYY"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<template #footer>
|
||||
<el-button @click="exportDialogVisible = false">取消</el-button>
|
||||
<el-button :loading="currentExportLoading" type="primary" @click="submitExport">
|
||||
确定导出
|
||||
</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import * as OutputSplitApi from '@/api/tjt/outputSplit'
|
||||
import * as PlanningApi from '@/api/tjt/planning'
|
||||
import * as PlanningQuarterApi from '@/api/tjt/planningQuarter'
|
||||
import * as ProjectApi from '@/api/tjt/project'
|
||||
import * as ReportApi from '@/api/tjt/report'
|
||||
import download from '@/utils/download'
|
||||
import {
|
||||
formatAmountText,
|
||||
getOwnershipTypeLabel,
|
||||
OUTPUT_SPLIT_SPECIALTY_OPTIONS,
|
||||
QUARTER_OPTIONS,
|
||||
toPercentValue
|
||||
} from '@/views/tjt/shared/planning'
|
||||
|
||||
defineOptions({ name: 'TjtReportProjectQuarter' })
|
||||
|
||||
type AnnualCategoryKey =
|
||||
| 'project_lead'
|
||||
| 'arch'
|
||||
| 'decor'
|
||||
| 'struct'
|
||||
| 'water'
|
||||
| 'elec'
|
||||
| 'hvac'
|
||||
| 'digital'
|
||||
|
||||
interface QuarterYearRow {
|
||||
distributionYear: number
|
||||
quarters: PlanningQuarterApi.ProjectPlanningQuarterVO[]
|
||||
}
|
||||
|
||||
type ExportDialogType = 'projectQuarter' | 'projectLeadQuarter'
|
||||
|
||||
const annualCategoryOptions: { label: string; value: AnnualCategoryKey }[] = [
|
||||
{ label: '项目经理/工程负责人', value: 'project_lead' },
|
||||
{ label: '建筑专业', value: 'arch' },
|
||||
{ label: '装修专业', value: 'decor' },
|
||||
{ label: '结构专业', value: 'struct' },
|
||||
{ label: '水专业', value: 'water' },
|
||||
{ label: '电气专业', value: 'elec' },
|
||||
{ label: '暖通专业', value: 'hvac' },
|
||||
{ label: '数字化设计专业', value: 'digital' }
|
||||
]
|
||||
|
||||
const message = useMessage()
|
||||
const currentYear = new Date().getFullYear()
|
||||
|
||||
const loading = ref(false)
|
||||
const planningLoading = ref(false)
|
||||
const quarterLoading = ref(false)
|
||||
const exportQuarterLoading = ref(false)
|
||||
const exportLeadLoading = ref(false)
|
||||
const exportDialogVisible = ref(false)
|
||||
const exportDialogType = ref<ExportDialogType>('projectQuarter')
|
||||
const exportYear = ref<number>()
|
||||
const total = ref(0)
|
||||
const projectList = ref<ProjectApi.ProjectVO[]>([])
|
||||
const planningList = ref<PlanningApi.ProjectPlanningVO[]>([])
|
||||
const currentProject = ref<ProjectApi.ProjectVO>()
|
||||
const currentPlanning = ref<PlanningApi.ProjectPlanningVO>()
|
||||
const formData = ref<OutputSplitApi.ProjectOutputSplitVO>()
|
||||
const quarterRows = ref<QuarterYearRow[]>([])
|
||||
const selectedAnnualCategory = ref<AnnualCategoryKey>('project_lead')
|
||||
const 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) * queryParams.pageSize + index + 1
|
||||
|
||||
const queryProjectStartYearValue = computed({
|
||||
get: () => (queryParams.projectStartYear ? String(queryParams.projectStartYear) : undefined),
|
||||
set: (value?: string) => {
|
||||
queryParams.projectStartYear = value ? Number(value) : undefined
|
||||
}
|
||||
})
|
||||
|
||||
const exportDialogTitle = computed(() =>
|
||||
exportDialogType.value === 'projectQuarter' ? '导出专业间年度季度计取表' : '导出工程负责人计取表'
|
||||
)
|
||||
|
||||
const currentExportLoading = computed(() =>
|
||||
exportDialogType.value === 'projectQuarter'
|
||||
? exportQuarterLoading.value
|
||||
: exportLeadLoading.value
|
||||
)
|
||||
|
||||
const exportYearValue = computed({
|
||||
get: () => (exportYear.value ? String(exportYear.value) : undefined),
|
||||
set: (value?: string) => {
|
||||
exportYear.value = value ? Number(value) : undefined
|
||||
}
|
||||
})
|
||||
|
||||
const toNumeric = (value?: number | string | null) => {
|
||||
const numericValue = Number(value ?? 0)
|
||||
return Number.isNaN(numericValue) ? 0 : numericValue
|
||||
}
|
||||
|
||||
const multiplyAmount = (...values: Array<number | string | null | undefined>) => {
|
||||
let result = 1
|
||||
values.forEach((value) => {
|
||||
result *= toNumeric(value)
|
||||
})
|
||||
return Number(result.toFixed(2))
|
||||
}
|
||||
|
||||
const formatRatioText = (value?: number | string | null) =>
|
||||
`${(toPercentValue(value) ?? 0).toFixed(2)}%`
|
||||
|
||||
const getRatioValue = (model: OutputSplitApi.ProjectOutputSplitVO, key: string) =>
|
||||
(model as unknown as Record<string, number | undefined>)[key]
|
||||
|
||||
const getProjectLeadText = (projectManagerName?: string, engineeringLeaderName?: string) =>
|
||||
[projectManagerName, engineeringLeaderName].filter(Boolean).join(' / ') || '-'
|
||||
|
||||
const buildProjectRows = (model?: OutputSplitApi.ProjectOutputSplitVO) => {
|
||||
if (!model) {
|
||||
return []
|
||||
}
|
||||
return [
|
||||
{
|
||||
label: '项目经理/工程负责人',
|
||||
percentText: formatRatioText(model.projectLeadRatio),
|
||||
amount: model.projectLeadAmount
|
||||
},
|
||||
{
|
||||
label: '专业所',
|
||||
percentText: formatRatioText(model.officeRatio),
|
||||
amount: model.officeAmount
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
const buildSpecialtyRows = (model?: OutputSplitApi.ProjectOutputSplitVO) => {
|
||||
if (!model) {
|
||||
return []
|
||||
}
|
||||
const amountMap: Record<string, number | undefined> = {
|
||||
arch: model.archAmount,
|
||||
decor: model.decorAmount,
|
||||
struct: model.structAmount,
|
||||
water: model.waterAmount,
|
||||
elec: model.elecAmount,
|
||||
hvac: model.hvacAmount,
|
||||
digital: model.digitalAmount
|
||||
}
|
||||
return OUTPUT_SPLIT_SPECIALTY_OPTIONS.map((item) => ({
|
||||
label: item.label,
|
||||
percentText: formatRatioText(getRatioValue(model, `${item.value}Ratio`)),
|
||||
amount: amountMap[item.value]
|
||||
}))
|
||||
}
|
||||
|
||||
const projectResultRows = computed(() => buildProjectRows(formData.value))
|
||||
const specialtyResultRows = computed(() => buildSpecialtyRows(formData.value))
|
||||
|
||||
const annualCategoryMeta = computed(() => {
|
||||
const model = formData.value
|
||||
const option = annualCategoryOptions.find((item) => item.value === selectedAnnualCategory.value)
|
||||
if (!model || !option) {
|
||||
return { ratio: 0 }
|
||||
}
|
||||
if (selectedAnnualCategory.value === 'project_lead') {
|
||||
return {
|
||||
ratio: Number(toNumeric(model.projectLeadRatio).toFixed(4))
|
||||
}
|
||||
}
|
||||
const specialtyRatio = toNumeric(getRatioValue(model, `${selectedAnnualCategory.value}Ratio`))
|
||||
return {
|
||||
ratio: Number((toNumeric(model.officeRatio) * specialtyRatio).toFixed(4))
|
||||
}
|
||||
})
|
||||
|
||||
const annualDistributionRows = computed(() =>
|
||||
quarterRows.value.map((row) => {
|
||||
const quarterAmounts: Record<number, number> = {}
|
||||
let yearTotal = 0
|
||||
QUARTER_OPTIONS.forEach((quarter) => {
|
||||
const quarterNo = Number(quarter.value)
|
||||
const quarterAmount = multiplyAmount(
|
||||
row.quarters.find((item) => item.quarterNo === quarterNo)?.distributionAmount,
|
||||
annualCategoryMeta.value.ratio
|
||||
)
|
||||
quarterAmounts[quarterNo] = quarterAmount
|
||||
yearTotal += quarterAmount
|
||||
})
|
||||
return {
|
||||
distributionYear: row.distributionYear,
|
||||
quarterAmounts,
|
||||
yearTotal: Number(yearTotal.toFixed(2))
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
const annualSummaryCards = computed(() => [
|
||||
{
|
||||
label: '总分配',
|
||||
amount: multiplyAmount(
|
||||
currentPlanning.value?.assessmentOutputValue,
|
||||
currentPlanning.value?.totalDistributionAmount,
|
||||
annualCategoryMeta.value.ratio
|
||||
)
|
||||
},
|
||||
{
|
||||
label: '已分配',
|
||||
amount: multiplyAmount(
|
||||
currentPlanning.value?.assessmentOutputValue,
|
||||
currentPlanning.value?.allocatedAmount,
|
||||
annualCategoryMeta.value.ratio
|
||||
)
|
||||
},
|
||||
{
|
||||
label: '待分配',
|
||||
amount: multiplyAmount(
|
||||
currentPlanning.value?.assessmentOutputValue,
|
||||
currentPlanning.value?.pendingAmount,
|
||||
annualCategoryMeta.value.ratio
|
||||
)
|
||||
}
|
||||
])
|
||||
|
||||
const buildQuarterRows = (
|
||||
planning: PlanningApi.ProjectPlanningVO,
|
||||
quarters: PlanningQuarterApi.ProjectPlanningQuarterVO[]
|
||||
) => {
|
||||
const yearSet = new Set<number>()
|
||||
if (planning.planningStartYear) {
|
||||
yearSet.add(planning.planningStartYear)
|
||||
}
|
||||
quarters.forEach((item) => yearSet.add(item.distributionYear))
|
||||
if (yearSet.size === 0) {
|
||||
yearSet.add(new Date().getFullYear())
|
||||
}
|
||||
return Array.from(yearSet)
|
||||
.sort((a, b) => a - b)
|
||||
.map((distributionYear) => ({
|
||||
distributionYear,
|
||||
quarters: QUARTER_OPTIONS.map((option) => {
|
||||
const quarterNo = Number(option.value)
|
||||
const match = quarters.find(
|
||||
(item) =>
|
||||
item.distributionYear === distributionYear && Number(item.quarterNo) === quarterNo
|
||||
)
|
||||
return (
|
||||
match || {
|
||||
planningId: planning.id!,
|
||||
distributionYear,
|
||||
quarterNo,
|
||||
distributionRatio: undefined,
|
||||
distributionAmount: 0
|
||||
}
|
||||
)
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
const 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
|
||||
formData.value = undefined
|
||||
quarterRows.value = []
|
||||
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
|
||||
formData.value = undefined
|
||||
quarterRows.value = []
|
||||
return
|
||||
}
|
||||
planningLoading.value = true
|
||||
try {
|
||||
const list = await PlanningApi.getProjectPlanningListByProjectId(currentProject.value.id)
|
||||
planningList.value = list
|
||||
if (!planningList.value.length) {
|
||||
currentPlanning.value = undefined
|
||||
formData.value = undefined
|
||||
quarterRows.value = []
|
||||
return
|
||||
}
|
||||
const targetPlanningId = currentPlanning.value?.id || planningList.value[0].id
|
||||
const targetPlanning =
|
||||
planningList.value.find((item) => item.id === targetPlanningId) || planningList.value[0]
|
||||
await nextTick()
|
||||
planningTableRef.value?.setCurrentRow(targetPlanning)
|
||||
} finally {
|
||||
planningLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const loadPlanningRelatedData = async (planning: PlanningApi.ProjectPlanningVO) => {
|
||||
if (!planning.id) {
|
||||
return
|
||||
}
|
||||
quarterLoading.value = true
|
||||
try {
|
||||
const [planningDetail, outputSplit, quarterList] = await Promise.all([
|
||||
PlanningApi.getProjectPlanning(planning.id),
|
||||
OutputSplitApi.getProjectOutputSplitByPlanningId(planning.id),
|
||||
PlanningQuarterApi.getProjectPlanningQuarterListByPlanningId(planning.id)
|
||||
])
|
||||
currentPlanning.value = planningDetail
|
||||
formData.value = outputSplit
|
||||
quarterRows.value = buildQuarterRows(planningDetail, quarterList)
|
||||
} finally {
|
||||
quarterLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
formData.value = undefined
|
||||
quarterRows.value = []
|
||||
return
|
||||
}
|
||||
await loadPlanningRelatedData(row)
|
||||
}
|
||||
|
||||
const handleExportProjectQuarter = async () => {
|
||||
if (!currentPlanning.value?.id) {
|
||||
message.warning('请先选择合约规划')
|
||||
return
|
||||
}
|
||||
exportDialogType.value = 'projectQuarter'
|
||||
exportYear.value = currentPlanning.value.planningStartYear || currentYear
|
||||
exportDialogVisible.value = true
|
||||
}
|
||||
|
||||
const handleExportProjectLeadQuarter = async () => {
|
||||
if (!currentPlanning.value?.id) {
|
||||
message.warning('请先选择合约规划')
|
||||
return
|
||||
}
|
||||
exportDialogType.value = 'projectLeadQuarter'
|
||||
exportYear.value = currentPlanning.value.planningStartYear || currentYear
|
||||
exportDialogVisible.value = true
|
||||
}
|
||||
|
||||
const submitExport = async () => {
|
||||
if (exportDialogType.value === 'projectQuarter') {
|
||||
await submitProjectQuarterExport()
|
||||
return
|
||||
}
|
||||
await submitProjectLeadQuarterExport()
|
||||
}
|
||||
|
||||
const submitProjectQuarterExport = async () => {
|
||||
if (!currentPlanning.value?.id) {
|
||||
message.warning('请先选择合约规划')
|
||||
return
|
||||
}
|
||||
if (!exportYear.value) {
|
||||
message.warning('请选择年度')
|
||||
return
|
||||
}
|
||||
try {
|
||||
await message.exportConfirm()
|
||||
exportQuarterLoading.value = true
|
||||
const data = await ReportApi.exportProjectQuarterOutput({
|
||||
planningId: currentPlanning.value.id,
|
||||
year: exportYear.value
|
||||
})
|
||||
download.excel(
|
||||
data,
|
||||
`${currentProject.value?.projectName || '项目'}_${exportYear.value}_专业间年度季度计取表.xlsx`
|
||||
)
|
||||
exportDialogVisible.value = false
|
||||
} finally {
|
||||
exportQuarterLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const submitProjectLeadQuarterExport = async () => {
|
||||
if (!currentPlanning.value?.id) {
|
||||
message.warning('请先选择合约规划')
|
||||
return
|
||||
}
|
||||
if (!exportYear.value) {
|
||||
message.warning('请选择年度')
|
||||
return
|
||||
}
|
||||
try {
|
||||
await message.exportConfirm()
|
||||
exportLeadLoading.value = true
|
||||
const data = await ReportApi.exportProjectLeadQuarterOutput({
|
||||
planningId: currentPlanning.value.id,
|
||||
year: exportYear.value
|
||||
})
|
||||
download.excel(
|
||||
data,
|
||||
`${currentProject.value?.projectName || '项目'}_${exportYear.value}_工程负责人年度季度计取表.xlsx`
|
||||
)
|
||||
exportDialogVisible.value = false
|
||||
} finally {
|
||||
exportLeadLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getProjectList()
|
||||
})
|
||||
|
||||
onActivated(() => {
|
||||
getProjectList()
|
||||
})
|
||||
</script>
|
||||
507
src/views/tjt/report-specialty-person/index.vue
Normal file
507
src/views/tjt/report-specialty-person/index.vue
Normal file
@@ -0,0 +1,507 @@
|
||||
<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>
|
||||
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="8">
|
||||
<ContentWrap>
|
||||
<div class="mb-12px text-14px font-600">
|
||||
{{ currentProject?.projectName || '合约规划列表' }}
|
||||
</div>
|
||||
<el-table
|
||||
ref="planningTableRef"
|
||||
v-loading="planningLoading"
|
||||
:data="planningList"
|
||||
highlight-current-row
|
||||
@current-change="handleCurrentPlanningChange"
|
||||
>
|
||||
<el-table-column align="center" label="序号" type="index" width="70" />
|
||||
<el-table-column align="center" label="项目任务包" min-width="180" prop="planningContent" />
|
||||
<el-table-column align="center" label="归属类型" min-width="110">
|
||||
<template #default="scope">
|
||||
{{ getOwnershipTypeLabel(scope.row.ownershipType) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="开始年度" prop="planningStartYear" width="100" />
|
||||
<el-table-column align="center" label="考核产值(元)" width="120">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.assessmentOutputValue) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="排序" prop="sortNo" width="80" />
|
||||
</el-table>
|
||||
</ContentWrap>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="16">
|
||||
<ContentWrap v-if="currentPlanning && currentGroup">
|
||||
<div class="mb-16px flex items-center justify-between gap-12px">
|
||||
<div>
|
||||
<div class="text-16px font-600">{{ currentPlanning.planningContent }}</div>
|
||||
</div>
|
||||
<el-button
|
||||
v-hasPermi="['tjt:report-specialty-person:export']"
|
||||
:disabled="!canExportCurrentGroup"
|
||||
:loading="exportSpecialtyLoading"
|
||||
plain
|
||||
type="success"
|
||||
@click="handleExportSpecialtyPerson"
|
||||
>
|
||||
<Icon class="mr-5px" icon="ep:download" />
|
||||
导出专业内人员计取表
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<div class="mb-16px">
|
||||
<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>
|
||||
|
||||
<el-table :data="currentGroup.rows" border>
|
||||
<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(getPersonTotalRatio(scope.row)) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="人员信息" min-width="360">
|
||||
<template #default="scope">
|
||||
<div v-if="scope.row.persons?.length" class="person-display-list">
|
||||
<div
|
||||
v-for="(person, index) in scope.row.persons"
|
||||
:key="`${scope.row.specialtyCode}-${scope.row.roleCode}-display-${index}`"
|
||||
class="person-display-row"
|
||||
>
|
||||
<span class="person-display-name">{{ person.employeeName || '-' }}</span>
|
||||
<span>{{ formatPercentText(person.personRatio) }}</span>
|
||||
<span>{{ formatAmountText(person.personAmount) }} 元</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="person-empty">暂无人员</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</ContentWrap>
|
||||
|
||||
<ContentWrap v-else>
|
||||
<el-empty description="请选择合约规划后查看导出预览" />
|
||||
</ContentWrap>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<Dialog v-model="exportDialogVisible" title="导出专业内人员计取表" width="420">
|
||||
<el-form label-width="88px">
|
||||
<el-form-item label="年度">
|
||||
<el-date-picker
|
||||
v-model="exportYearValue"
|
||||
class="!w-220px"
|
||||
clearable
|
||||
placeholder="请选择年度"
|
||||
type="year"
|
||||
value-format="YYYY"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<template #footer>
|
||||
<el-button @click="exportDialogVisible = false">取消</el-button>
|
||||
<el-button :loading="exportSpecialtyLoading" type="primary" @click="submitSpecialtyExport">
|
||||
确定导出
|
||||
</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import * as PlanningApi from '@/api/tjt/planning'
|
||||
import * as ProjectApi from '@/api/tjt/project'
|
||||
import * as ReportApi from '@/api/tjt/report'
|
||||
import * as SpecialtyRoleSplitApi from '@/api/tjt/specialtyRoleSplit'
|
||||
import download from '@/utils/download'
|
||||
import { formatAmountText, formatPercentText, getOwnershipTypeLabel } from '@/views/tjt/shared/planning'
|
||||
|
||||
defineOptions({ name: 'TjtReportSpecialtyPerson' })
|
||||
|
||||
const PROJECT_LEAD_GROUP_CODE = 'project_lead'
|
||||
const EPSILON = 0.0001
|
||||
|
||||
type SpecialtyRoleSplitVO = SpecialtyRoleSplitApi.SpecialtyRoleSplitVO
|
||||
|
||||
interface SpecialtyGroup {
|
||||
specialtyCode: string
|
||||
specialtyName: string
|
||||
specialtyAmount: number
|
||||
rows: SpecialtyRoleSplitVO[]
|
||||
roleTotal: number
|
||||
personCount: number
|
||||
}
|
||||
|
||||
const message = useMessage()
|
||||
const currentYear = new Date().getFullYear()
|
||||
|
||||
const loading = ref(false)
|
||||
const planningLoading = ref(false)
|
||||
const exportSpecialtyLoading = ref(false)
|
||||
const exportDialogVisible = ref(false)
|
||||
const exportYear = ref<number>()
|
||||
const total = ref(0)
|
||||
const projectList = ref<ProjectApi.ProjectVO[]>([])
|
||||
const planningList = ref<PlanningApi.ProjectPlanningVO[]>([])
|
||||
const currentProject = ref<ProjectApi.ProjectVO>()
|
||||
const currentPlanning = ref<PlanningApi.ProjectPlanningVO>()
|
||||
const roleList = ref<SpecialtyRoleSplitVO[]>([])
|
||||
const 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) * queryParams.pageSize + 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 roundRatio = (value?: number | string | null) => {
|
||||
const numericValue = Number(value || 0)
|
||||
return Number.isNaN(numericValue) ? 0 : Number(numericValue.toFixed(4))
|
||||
}
|
||||
|
||||
const countConfiguredPersons = (persons?: SpecialtyRoleSplitApi.SpecialtyRolePersonVO[]) =>
|
||||
(persons || []).filter(
|
||||
(person) =>
|
||||
(person.employeeName && person.employeeName.trim()) ||
|
||||
(person.personRatio !== undefined && person.personRatio !== null)
|
||||
).length
|
||||
|
||||
const getPersonTotalRatio = (row: SpecialtyRoleSplitVO) =>
|
||||
roundRatio((row.persons || []).reduce((sum, person) => sum + Number(person?.personRatio || 0), 0))
|
||||
|
||||
const buildGroups = (source: SpecialtyRoleSplitVO[]): SpecialtyGroup[] => {
|
||||
const map = new Map<string, SpecialtyRoleSplitVO[]>()
|
||||
source.forEach((item) => {
|
||||
const list = map.get(item.specialtyCode) || []
|
||||
list.push(item)
|
||||
map.set(item.specialtyCode, list)
|
||||
})
|
||||
return Array.from(map.entries()).map(([specialtyCode, rows]) => {
|
||||
const sortedRows = [...rows].sort((a, b) => Number(a.sortNo || 0) - Number(b.sortNo || 0))
|
||||
return {
|
||||
specialtyCode,
|
||||
specialtyName: sortedRows[0]?.specialtyName || specialtyCode,
|
||||
specialtyAmount: Number(Number(sortedRows[0]?.specialtyAmount || 0).toFixed(2)),
|
||||
rows: sortedRows,
|
||||
roleTotal: roundRatio(sortedRows.reduce((sum, item) => sum + Number(item.roleRatio || 0), 0)),
|
||||
personCount: sortedRows.reduce((sum, row) => sum + countConfiguredPersons(row.persons), 0)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const groups = computed(() => buildGroups(roleList.value))
|
||||
const 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.specialtyCode !== PROJECT_LEAD_GROUP_CODE
|
||||
)
|
||||
|
||||
const buildSummaryCards = (group?: SpecialtyGroup) => {
|
||||
if (!group) {
|
||||
return []
|
||||
}
|
||||
return [
|
||||
{ label: '分组金额', value: `${formatAmountText(group.specialtyAmount)} 元` },
|
||||
{ label: '角色合计', value: formatPercentText(group.roleTotal) },
|
||||
{ label: '已配置人数', value: `${group.personCount} 人` },
|
||||
{ label: '超额提醒', value: group.roleTotal > 1 + EPSILON ? '存在' : '无' }
|
||||
]
|
||||
}
|
||||
|
||||
watch(
|
||||
groups,
|
||||
(value) => {
|
||||
const codes = value.map((item) => item.specialtyCode)
|
||||
if (!codes.length) {
|
||||
selectedGroupCode.value = ''
|
||||
return
|
||||
}
|
||||
const preferredCode = codes.find((code) => code !== PROJECT_LEAD_GROUP_CODE) || codes[0]
|
||||
if (!codes.includes(selectedGroupCode.value) || selectedGroupCode.value === PROJECT_LEAD_GROUP_CODE) {
|
||||
selectedGroupCode.value = preferredCode
|
||||
}
|
||||
},
|
||||
{ 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
|
||||
roleList.value = []
|
||||
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
|
||||
roleList.value = []
|
||||
return
|
||||
}
|
||||
planningLoading.value = true
|
||||
try {
|
||||
const list = await PlanningApi.getProjectPlanningListByProjectId(currentProject.value.id)
|
||||
planningList.value = list
|
||||
if (!planningList.value.length) {
|
||||
currentPlanning.value = undefined
|
||||
roleList.value = []
|
||||
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 loadRoleList = async (planningId: number) => {
|
||||
roleList.value = await SpecialtyRoleSplitApi.getSpecialtyRoleSplitListByPlanningId(planningId)
|
||||
}
|
||||
|
||||
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) {
|
||||
roleList.value = []
|
||||
return
|
||||
}
|
||||
await loadRoleList(row.id)
|
||||
}
|
||||
|
||||
const handleExportSpecialtyPerson = async () => {
|
||||
if (!currentPlanning.value?.id) {
|
||||
message.warning('请先选择合约规划')
|
||||
return
|
||||
}
|
||||
if (!canExportCurrentGroup.value || !currentGroup.value?.specialtyCode) {
|
||||
message.warning('请选择具体专业后再导出')
|
||||
return
|
||||
}
|
||||
exportYear.value = currentPlanning.value.planningStartYear || currentYear
|
||||
exportDialogVisible.value = true
|
||||
}
|
||||
|
||||
const submitSpecialtyExport = async () => {
|
||||
if (!currentPlanning.value?.id) {
|
||||
message.warning('请先选择合约规划')
|
||||
return
|
||||
}
|
||||
if (!canExportCurrentGroup.value || !currentGroup.value?.specialtyCode) {
|
||||
message.warning('请选择具体专业后再导出')
|
||||
return
|
||||
}
|
||||
if (!exportYear.value) {
|
||||
message.warning('请选择年度')
|
||||
return
|
||||
}
|
||||
try {
|
||||
await message.exportConfirm()
|
||||
exportSpecialtyLoading.value = true
|
||||
const data = await ReportApi.exportSpecialtyPersonOutput({
|
||||
planningId: currentPlanning.value.id,
|
||||
specialtyCode: currentGroup.value.specialtyCode,
|
||||
year: exportYear.value
|
||||
})
|
||||
download.excel(
|
||||
data,
|
||||
`${currentProject.value?.projectName || '项目'}_${exportYear.value}_${currentGroup.value.specialtyName || '专业'}内人员年度季度计取表.xlsx`
|
||||
)
|
||||
exportDialogVisible.value = false
|
||||
} finally {
|
||||
exportSpecialtyLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getProjectList()
|
||||
})
|
||||
|
||||
onActivated(() => {
|
||||
getProjectList()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.person-empty {
|
||||
font-size: 12px;
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
|
||||
.person-display-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.person-display-row {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(120px, 1fr) 100px 120px;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.person-display-name {
|
||||
font-weight: 600;
|
||||
}
|
||||
</style>
|
||||
415
src/views/tjt/report-summary/index.vue
Normal file
415
src/views/tjt/report-summary/index.vue
Normal file
@@ -0,0 +1,415 @@
|
||||
<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 @click="getEmployeeBudgetList">
|
||||
<Icon class="mr-5px" icon="ep:refresh" />
|
||||
刷新预览
|
||||
</el-button>
|
||||
</el-form-item> -->
|
||||
<el-form-item>
|
||||
<el-button
|
||||
v-hasPermi="['tjt:report-summary:export']"
|
||||
:loading="employeeSummaryExportLoading"
|
||||
plain
|
||||
type="primary"
|
||||
@click="openEmployeeSummaryExportDialog"
|
||||
>
|
||||
<Icon class="mr-5px" icon="ep:download" />
|
||||
导出员工汇总
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table
|
||||
v-loading="employeeBudgetLoading"
|
||||
:data="employeeBudgetList"
|
||||
class="mt-12px"
|
||||
:empty-text="employeeSummaryForm.year ? '暂无年度成本预算数据' : '请先选择年度'"
|
||||
>
|
||||
<el-table-column align="center" label="序号" type="index" width="70" />
|
||||
<el-table-column align="center" label="员工姓名" min-width="160" prop="employeeName" />
|
||||
<el-table-column align="center" label="预计年度" prop="budgetYear" width="120" />
|
||||
<el-table-column align="center" label="预计发生成本" min-width="160">
|
||||
<template #default="scope">
|
||||
{{ formatAmount(scope.row.expectedCostAmount) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<Pagination
|
||||
v-model:limit="employeeBudgetQuery.pageSize"
|
||||
v-model:page="employeeBudgetQuery.pageNo"
|
||||
:total="employeeBudgetTotal"
|
||||
@pagination="getEmployeeBudgetList"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane label="项目产值总览" name="projectOverview">
|
||||
<el-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>
|
||||
<el-button @click="getProjectEmployeeList">
|
||||
<Icon class="mr-5px" icon="ep:refresh" />
|
||||
刷新预览
|
||||
</el-button>
|
||||
</el-form-item> -->
|
||||
<el-form-item>
|
||||
<el-button
|
||||
v-hasPermi="['tjt:report-summary:export']"
|
||||
:loading="projectOverviewExportLoading"
|
||||
plain
|
||||
type="primary"
|
||||
@click="openProjectOverviewExportDialog"
|
||||
>
|
||||
<Icon class="mr-5px" icon="ep:download" />
|
||||
导出项目总览
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table
|
||||
v-loading="projectEmployeeLoading"
|
||||
:data="projectEmployeeList"
|
||||
class="mt-12px"
|
||||
:empty-text="projectOverviewForm.officeId ? '该专业所下暂无员工' : '请先选择专业所'"
|
||||
>
|
||||
<el-table-column align="center" label="序号" type="index" width="70" />
|
||||
<el-table-column align="center" label="员工姓名" min-width="160" prop="employeeName" />
|
||||
<el-table-column align="center" label="性别" prop="gender" width="100" />
|
||||
<el-table-column align="center" label="所属所" min-width="180" prop="officeName" />
|
||||
</el-table>
|
||||
<Pagination
|
||||
v-model:limit="projectEmployeeQuery.pageSize"
|
||||
v-model:page="projectEmployeeQuery.pageNo"
|
||||
:total="projectEmployeeTotal"
|
||||
@pagination="getProjectEmployeeList"
|
||||
/>
|
||||
</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="年度">
|
||||
<el-date-picker
|
||||
v-model="projectOverviewYearValue"
|
||||
class="!w-220px"
|
||||
clearable
|
||||
placeholder="请选择年度"
|
||||
type="year"
|
||||
value-format="YYYY"
|
||||
/>
|
||||
</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 EmployeeApi from '@/api/tjt/employee'
|
||||
import * as EmployeeYearCostBudgetApi from '@/api/tjt/employeeYearCostBudget'
|
||||
import * as OfficeApi from '@/api/tjt/office'
|
||||
import * as ReportApi from '@/api/tjt/report'
|
||||
import download from '@/utils/download'
|
||||
|
||||
defineOptions({ name: 'TjtReportSummary' })
|
||||
|
||||
type SelectOption = {
|
||||
label: string
|
||||
value: string
|
||||
}
|
||||
|
||||
type ExportDialogType = 'employeeSummary' | 'projectOverview'
|
||||
|
||||
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 employeeBudgetLoading = ref(false)
|
||||
const projectEmployeeLoading = ref(false)
|
||||
const officeOptions = ref<OfficeApi.OfficeSimpleVO[]>([])
|
||||
const employeeBudgetList = ref<EmployeeYearCostBudgetApi.EmployeeYearCostBudgetVO[]>([])
|
||||
const projectEmployeeList = ref<EmployeeApi.EmployeeVO[]>([])
|
||||
const employeeBudgetTotal = ref(0)
|
||||
const projectEmployeeTotal = ref(0)
|
||||
const 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 employeeBudgetQuery = reactive<EmployeeYearCostBudgetApi.EmployeeYearCostBudgetPageReqVO>({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
employeeId: undefined,
|
||||
employeeName: undefined,
|
||||
budgetYear: currentYear,
|
||||
enabledFlag: true
|
||||
})
|
||||
|
||||
const projectEmployeeQuery = reactive<EmployeeApi.EmployeePageReqVO>({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
employeeName: undefined,
|
||||
officeId: undefined,
|
||||
employeeStatus: undefined,
|
||||
enabledFlag: 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 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 getOfficeList = async () => {
|
||||
officeOptions.value = await OfficeApi.getOfficeSimpleList()
|
||||
}
|
||||
|
||||
const getEmployeeBudgetList = async () => {
|
||||
if (!employeeBudgetQuery.budgetYear) {
|
||||
employeeBudgetList.value = []
|
||||
employeeBudgetTotal.value = 0
|
||||
return
|
||||
}
|
||||
employeeBudgetLoading.value = true
|
||||
try {
|
||||
const data = await EmployeeYearCostBudgetApi.getEmployeeYearCostBudgetPage(employeeBudgetQuery)
|
||||
employeeBudgetList.value = data.list
|
||||
employeeBudgetTotal.value = data.total
|
||||
} finally {
|
||||
employeeBudgetLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const getProjectEmployeeList = async () => {
|
||||
if (!projectEmployeeQuery.officeId) {
|
||||
projectEmployeeList.value = []
|
||||
projectEmployeeTotal.value = 0
|
||||
return
|
||||
}
|
||||
projectEmployeeLoading.value = true
|
||||
try {
|
||||
const data = await EmployeeApi.getEmployeePage(projectEmployeeQuery)
|
||||
projectEmployeeList.value = data.list
|
||||
projectEmployeeTotal.value = data.total
|
||||
} finally {
|
||||
projectEmployeeLoading.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) {
|
||||
projectOverviewForm.year = currentYear
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => employeeSummaryForm.year,
|
||||
(year) => {
|
||||
employeeBudgetQuery.pageNo = 1
|
||||
employeeBudgetQuery.budgetYear = year
|
||||
getEmployeeBudgetList()
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
watch(
|
||||
() => projectOverviewForm.officeId,
|
||||
(officeId) => {
|
||||
projectEmployeeQuery.pageNo = 1
|
||||
projectEmployeeQuery.officeId = officeId
|
||||
getProjectEmployeeList()
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
onMounted(async () => {
|
||||
await getOfficeList()
|
||||
})
|
||||
</script>
|
||||
@@ -1,56 +1,215 @@
|
||||
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: '专业所',
|
||||
comprehensive: '综合所',
|
||||
subcontract: '专业分包'
|
||||
} as const
|
||||
|
||||
export const CALCULATION_METHOD = {
|
||||
guidancePrice: '指导价法',
|
||||
contractPrice: '合同价法',
|
||||
virtualOutput: '虚拟产值法'
|
||||
} as const
|
||||
|
||||
export const VIRTUAL_CALCULATION_METHOD = {
|
||||
guidancePrice: '指导单价法',
|
||||
guidanceTotalPrice: '指导总价法',
|
||||
workingDay: '工日法'
|
||||
} as const
|
||||
|
||||
export const DESIGN_STAGE = {
|
||||
scheme: '方案',
|
||||
constructionDrawing: '施工图',
|
||||
schemeAndConstructionDrawing: '方案+施工图'
|
||||
} as const
|
||||
|
||||
export const DESIGN_PART = {
|
||||
realEstate: '地上部分',
|
||||
underground: '地下部分'
|
||||
} as const
|
||||
|
||||
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: '进行中',
|
||||
completed: '完成',
|
||||
paused: '暂停',
|
||||
terminated: '中止'
|
||||
} as const
|
||||
|
||||
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.major, value: OWNERSHIP_TYPE.major },
|
||||
{ label: OWNERSHIP_TYPE.comprehensive, value: OWNERSHIP_TYPE.comprehensive },
|
||||
{ label: OWNERSHIP_TYPE.subcontract, value: OWNERSHIP_TYPE.subcontract }
|
||||
]
|
||||
|
||||
export const CALCULATION_METHOD_OPTIONS = [
|
||||
{ label: '指导价法', value: '指导价法' },
|
||||
{ label: '合同价法', value: '合同价法' },
|
||||
{ label: '虚拟产值法', value: '虚拟产值法' }
|
||||
export const CALCULATION_METHOD_OPTIONS: Option[] = [
|
||||
{ label: CALCULATION_METHOD.guidancePrice, value: CALCULATION_METHOD.guidancePrice },
|
||||
{ label: CALCULATION_METHOD.contractPrice, value: CALCULATION_METHOD.contractPrice },
|
||||
{ label: CALCULATION_METHOD.virtualOutput, value: CALCULATION_METHOD.virtualOutput }
|
||||
]
|
||||
|
||||
export const VIRTUAL_CALCULATION_METHOD_OPTIONS = [
|
||||
{ label: '指导单价法', value: '指导单价法' },
|
||||
{ label: '虚拟总价法', value: '虚拟总价法' },
|
||||
{ label: '工日法', value: '工日法' }
|
||||
export const VIRTUAL_CALCULATION_METHOD_OPTIONS: Option[] = [
|
||||
{
|
||||
label: VIRTUAL_CALCULATION_METHOD.guidancePrice,
|
||||
value: VIRTUAL_CALCULATION_METHOD.guidancePrice
|
||||
},
|
||||
{
|
||||
label: VIRTUAL_CALCULATION_METHOD.guidanceTotalPrice,
|
||||
value: VIRTUAL_CALCULATION_METHOD.guidanceTotalPrice
|
||||
},
|
||||
{ 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.scheme, value: DESIGN_STAGE.scheme },
|
||||
{ label: DESIGN_STAGE.constructionDrawing, value: DESIGN_STAGE.constructionDrawing },
|
||||
{
|
||||
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.realEstate, value: DESIGN_PART.realEstate },
|
||||
{ label: DESIGN_PART.underground, value: DESIGN_PART.underground }
|
||||
]
|
||||
|
||||
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.inProgress, value: PROJECT_STATUS.inProgress },
|
||||
{ label: PROJECT_STATUS.completed, value: PROJECT_STATUS.completed },
|
||||
{ label: PROJECT_STATUS.paused, value: PROJECT_STATUS.paused },
|
||||
{ label: PROJECT_STATUS.terminated, value: PROJECT_STATUS.terminated }
|
||||
]
|
||||
|
||||
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 = [
|
||||
export const OUTPUT_SPLIT_SPECIALTY_OPTIONS: Option[] = [
|
||||
{ label: '建筑', value: 'arch' },
|
||||
{ label: '装修', value: 'decor' },
|
||||
{ label: '装饰', value: 'decor' },
|
||||
{ label: '结构', value: 'struct' },
|
||||
{ label: '水', value: 'water' },
|
||||
{ label: '给排水', value: 'water' },
|
||||
{ label: '电气', value: 'elec' },
|
||||
{ label: '暖通', value: 'hvac' },
|
||||
{ label: '数字化设计', value: 'digital' }
|
||||
]
|
||||
|
||||
export const SPECIALTY_ROLE_OPTIONS = [
|
||||
export const SPECIALTY_ROLE_OPTIONS: Option[] = [
|
||||
{ label: '专业负责人', value: 'director' },
|
||||
{ label: '校对', value: 'check' },
|
||||
{ label: '审核', value: 'review' },
|
||||
@@ -58,27 +217,50 @@ export const SPECIALTY_ROLE_OPTIONS = [
|
||||
{ label: '设计', value: '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 isSubcontractOwnership = (value?: string) =>
|
||||
normalizeOwnershipType(value) === OWNERSHIP_TYPE.subcontract
|
||||
|
||||
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' }
|
||||
]
|
||||
@@ -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,11 +47,23 @@
|
||||
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
|
||||
: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="工程负责人"
|
||||
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"
|
||||
@@ -64,11 +76,8 @@
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="8">
|
||||
<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"
|
||||
@@ -77,23 +86,28 @@
|
||||
highlight-current-row
|
||||
@current-change="handleCurrentPlanningChange"
|
||||
>
|
||||
<el-table-column align="center" label="规划内容" min-width="180" prop="planningContent" />
|
||||
<el-table-column align="center" label="序号" type="index" width="70" />
|
||||
<el-table-column align="center" label="项目任务包" min-width="180" prop="planningContent" />
|
||||
<el-table-column align="center" label="归属类型" min-width="110">
|
||||
<template #default="scope">
|
||||
{{ getOwnershipTypeLabel(scope.row.ownershipType) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="开始年度" prop="planningStartYear" width="100" />
|
||||
<el-table-column align="center" label="考核产值(元)" width="120">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.assessmentOutputValue) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="排序" prop="sortNo" width="80" />
|
||||
</el-table>
|
||||
</ContentWrap>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="16">
|
||||
<ContentWrap v-if="currentPlanning && currentSpecialtyGroup">
|
||||
<ContentWrap 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>
|
||||
<div class="text-16px font-600">{{ currentPlanning.planningContent }}</div>
|
||||
<div class="flex items-center gap-12px">
|
||||
<el-button
|
||||
v-hasPermi="['tjt:specialty-role-split:update']"
|
||||
@@ -104,39 +118,27 @@
|
||||
<Icon class="mr-5px" icon="ep:edit" />
|
||||
编辑人员分配
|
||||
</el-button>
|
||||
<el-button @click="refreshCurrentPlanning">
|
||||
<Icon class="mr-5px" icon="ep:refresh" />
|
||||
刷新结果
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-16px flex flex-wrap items-start justify-between gap-12px">
|
||||
<el-radio-group v-model="selectedSpecialtyCode" size="small">
|
||||
<el-radio-button
|
||||
v-for="item in specialtyTabOptions"
|
||||
:key="item.value"
|
||||
:label="item.value"
|
||||
>
|
||||
<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 currentSpecialtySummaryCards" :key="item.label" :span="6">
|
||||
<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 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>
|
||||
|
||||
<el-table :data="currentSpecialtyGroup.rows" border>
|
||||
<el-table :data="currentGroup.rows" border>
|
||||
<el-table-column align="center" label="角色" min-width="110" prop="roleName" />
|
||||
<el-table-column align="center" label="角色比例" min-width="120">
|
||||
<template #default="scope">
|
||||
@@ -161,7 +163,7 @@
|
||||
:key="`${scope.row.specialtyCode}-${scope.row.roleCode}-display-${index}`"
|
||||
class="person-display-row"
|
||||
>
|
||||
<span class="person-display-name">{{ person.personName || '-' }}</span>
|
||||
<span class="person-display-name">{{ person.employeeName || '-' }}</span>
|
||||
<span>{{ formatPercentText(person.personRatio) }}</span>
|
||||
<span>{{ formatAmountText(person.personAmount) }} 元</span>
|
||||
</div>
|
||||
@@ -173,46 +175,38 @@
|
||||
</ContentWrap>
|
||||
|
||||
<ContentWrap v-else>
|
||||
<el-empty description="请选择专业所规划后查看页面5结果" />
|
||||
<el-empty description="请选择合约规划后查看人员分配" />
|
||||
</ContentWrap>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<Dialog v-model="dialogVisible" title="编辑专业人员角色分配" width="1180">
|
||||
<template v-if="currentEditSpecialtyGroup">
|
||||
|
||||
<div class="mb-16px flex flex-wrap items-start justify-between gap-12px">
|
||||
<el-radio-group v-model="editSpecialtyCode" size="small">
|
||||
<el-radio-button
|
||||
v-for="item in specialtyTabOptions"
|
||||
:key="`edit-${item.value}`"
|
||||
:label="item.value"
|
||||
>
|
||||
<template v-if="currentEditGroup">
|
||||
<div class="mb-16px">
|
||||
<el-radio-group v-model="editGroupCode" size="small">
|
||||
<el-radio-button v-for="item in editGroupTabOptions" :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 currentEditSpecialtySummaryCards" :key="item.label" :span="6">
|
||||
<el-col v-for="item in buildSummaryCards(currentEditGroup)" :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 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>
|
||||
|
||||
<el-table :data="currentEditSpecialtyGroup.rows" border>
|
||||
<el-table :data="currentEditGroup.rows" border>
|
||||
<el-table-column align="center" label="角色" min-width="110" prop="roleName" />
|
||||
<el-table-column align="center" label="角色比例" min-width="120">
|
||||
<template #default="scope">
|
||||
<el-input-number
|
||||
:model-value="toPercentValue(scope.row.roleRatio)"
|
||||
:max="100"
|
||||
:disabled="isAutoCalculatedRole(scope.row)"
|
||||
:max="getRoleRatioMax(scope.row)"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="0.1"
|
||||
@@ -238,7 +232,11 @@
|
||||
<template #default="scope">
|
||||
<div class="person-editor">
|
||||
<div v-if="!scope.row.persons?.length" class="person-empty">
|
||||
暂无人员,请点击“添加人员”
|
||||
{{
|
||||
isProjectLeadRow(scope.row)
|
||||
? '暂无人员,请先到页面1维护项目经理或工程负责人'
|
||||
: '暂无人员,请点击“添加人员”'
|
||||
}}
|
||||
</div>
|
||||
<div
|
||||
v-for="(person, index) in scope.row.persons"
|
||||
@@ -246,11 +244,35 @@
|
||||
class="person-row"
|
||||
>
|
||||
<el-input
|
||||
v-model="person.personName"
|
||||
clearable
|
||||
maxlength="64"
|
||||
placeholder="请输入人员名称"
|
||||
v-if="isProjectLeadRow(scope.row)"
|
||||
:model-value="person.employeeName || '-'"
|
||||
class="!w-1/1"
|
||||
disabled
|
||||
/>
|
||||
<el-select
|
||||
v-else
|
||||
:model-value="person.employeeId"
|
||||
class="!w-1/1"
|
||||
clearable
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
placeholder="请输入员工姓名搜索"
|
||||
:remote-method="searchEmployees"
|
||||
:loading="employeeLoading"
|
||||
@change="(value) => handleEmployeeChange(person, 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-input-number
|
||||
:model-value="toPercentValue(person.personRatio)"
|
||||
:max="getPersonRatioMax(scope.row, person)"
|
||||
@@ -259,15 +281,19 @@
|
||||
:step="0.1"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
placeholder="比例(%)"
|
||||
@update:model-value="(value) => updatePersonRatio(scope.row, person, value)"
|
||||
/>
|
||||
<div class="person-amount">{{ formatAmountText(person.personAmount) }} 元</div>
|
||||
<el-button text type="danger" @click="removePerson(scope.row, index)">
|
||||
<el-button
|
||||
v-if="!isProjectLeadRow(scope.row)"
|
||||
text
|
||||
type="danger"
|
||||
@click="removePerson(scope.row, index)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="person-toolbar">
|
||||
<div v-if="!isProjectLeadRow(scope.row)" class="person-toolbar">
|
||||
<el-button text type="primary" @click="addPerson(scope.row)">
|
||||
<Icon class="mr-5px" icon="ep:plus" />
|
||||
添加人员
|
||||
@@ -278,6 +304,7 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</template>
|
||||
|
||||
<template #footer>
|
||||
<el-button :loading="saveLoading" type="primary" @click="handleSave">保存</el-button>
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
@@ -286,6 +313,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import * as EmployeeApi from '@/api/tjt/employee'
|
||||
import * as ProjectApi from '@/api/tjt/project'
|
||||
import * as PlanningApi from '@/api/tjt/planning'
|
||||
import * as SpecialtyRoleSplitApi from '@/api/tjt/specialtyRoleSplit'
|
||||
@@ -293,14 +321,16 @@ import {
|
||||
formatAmountText,
|
||||
formatPercentText,
|
||||
fromPercentValue,
|
||||
isMajorOwnership,
|
||||
OUTPUT_SPLIT_SPECIALTY_OPTIONS,
|
||||
getOwnershipTypeLabel,
|
||||
toPercentValue
|
||||
} from '@/views/tjt/shared/planning'
|
||||
|
||||
defineOptions({ name: 'TjtStaffAssignment' })
|
||||
|
||||
const DESIGN_ROLE_CODE = 'design'
|
||||
const PROJECT_LEAD_GROUP_CODE = 'project_lead'
|
||||
const ROLE_PROJECT_MANAGER = 'project_manager'
|
||||
const ROLE_ENGINEERING_PRINCIPAL = 'engineering_principal'
|
||||
const EPSILON = 0.0001
|
||||
|
||||
type SpecialtyRolePersonVO = SpecialtyRoleSplitApi.SpecialtyRolePersonVO
|
||||
@@ -312,7 +342,6 @@ interface SpecialtyGroup {
|
||||
specialtyAmount: number
|
||||
rows: SpecialtyRoleSplitVO[]
|
||||
roleTotal: number
|
||||
designRatio: number
|
||||
personCount: number
|
||||
}
|
||||
|
||||
@@ -328,9 +357,11 @@ const currentProject = ref<ProjectApi.ProjectVO>()
|
||||
const currentPlanning = ref<PlanningApi.ProjectPlanningVO>()
|
||||
const roleList = ref<SpecialtyRoleSplitVO[]>([])
|
||||
const editRoleList = ref<SpecialtyRoleSplitVO[]>([])
|
||||
const selectedSpecialtyCode = ref('')
|
||||
const editSpecialtyCode = ref('')
|
||||
const selectedGroupCode = ref('')
|
||||
const editGroupCode = ref('')
|
||||
const dialogVisible = ref(false)
|
||||
const employeeOptions = ref<EmployeeApi.EmployeeSimpleVO[]>([])
|
||||
const employeeLoading = ref(false)
|
||||
const queryFormRef = ref()
|
||||
const projectTableRef = ref()
|
||||
const planningTableRef = ref()
|
||||
@@ -342,6 +373,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) => {
|
||||
@@ -351,28 +385,22 @@ const queryProjectStartYearValue = computed({
|
||||
|
||||
const roundRatio = (value?: number | string | null) => {
|
||||
const numericValue = Number(value || 0)
|
||||
if (Number.isNaN(numericValue)) {
|
||||
return 0
|
||||
}
|
||||
return Number(numericValue.toFixed(4))
|
||||
return Number.isNaN(numericValue) ? 0 : Number(numericValue.toFixed(4))
|
||||
}
|
||||
|
||||
const roundAmount = (value?: number | string | null) => {
|
||||
const numericValue = Number(value || 0)
|
||||
if (Number.isNaN(numericValue)) {
|
||||
return 0
|
||||
}
|
||||
return Number(numericValue.toFixed(2))
|
||||
return Number.isNaN(numericValue) ? 0 : Number(numericValue.toFixed(2))
|
||||
}
|
||||
|
||||
const multiplyAmount = (amount?: number | string | null, ratio?: number | string | null) => {
|
||||
return roundAmount(Number(amount || 0) * Number(ratio || 0))
|
||||
}
|
||||
const multiplyAmount = (amount?: number | string | null, ratio?: number | string | null) =>
|
||||
roundAmount(Number(amount || 0) * Number(ratio || 0))
|
||||
|
||||
const normalizePersonName = (value?: string) => value?.trim() || ''
|
||||
const normalizeEmployeeName = (value?: string) => value?.trim() || ''
|
||||
|
||||
const buildEditablePerson = (person?: SpecialtyRolePersonVO): SpecialtyRolePersonVO => ({
|
||||
personName: person?.personName || '',
|
||||
employeeId: person?.employeeId,
|
||||
employeeName: person?.employeeName || '',
|
||||
personRatio:
|
||||
person?.personRatio === undefined || person?.personRatio === null
|
||||
? undefined
|
||||
@@ -415,11 +443,45 @@ const getPersonRatioMax = (row: SpecialtyRoleSplitVO, currentPerson: SpecialtyRo
|
||||
const countConfiguredPersons = (persons?: SpecialtyRolePersonVO[]) =>
|
||||
(persons || []).filter(
|
||||
(person) =>
|
||||
normalizePersonName(person.personName) ||
|
||||
normalizeEmployeeName(person.employeeName) ||
|
||||
(person.personRatio !== undefined && person.personRatio !== null)
|
||||
).length
|
||||
|
||||
const syncSpecialtyRows = (source: SpecialtyRoleSplitVO[], specialtyCode: string) => {
|
||||
const ensureEmployeeOptions = (persons?: SpecialtyRolePersonVO[]) => {
|
||||
const existingIds = new Set(employeeOptions.value.map((item) => item.id))
|
||||
;(persons || []).forEach((person) => {
|
||||
if (!person.employeeId || existingIds.has(person.employeeId)) {
|
||||
return
|
||||
}
|
||||
employeeOptions.value.push({
|
||||
id: person.employeeId,
|
||||
employeeName: person.employeeName || '',
|
||||
officeId: undefined,
|
||||
officeName: undefined
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const searchEmployees = async (keyword: string) => {
|
||||
employeeLoading.value = true
|
||||
try {
|
||||
employeeOptions.value = await EmployeeApi.getEmployeeSimpleList({
|
||||
keyword,
|
||||
enabledFlag: true
|
||||
})
|
||||
editRoleList.value.forEach((row) => ensureEmployeeOptions(row.persons))
|
||||
} finally {
|
||||
employeeLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleEmployeeChange = (person: SpecialtyRolePersonVO, employeeId?: number) => {
|
||||
const employee = employeeOptions.value.find((item) => item.id === employeeId)
|
||||
person.employeeId = employeeId
|
||||
person.employeeName = employee?.employeeName || ''
|
||||
}
|
||||
|
||||
const syncGroupRows = (source: SpecialtyRoleSplitVO[], specialtyCode: string) => {
|
||||
const rows = source.filter((item) => item.specialtyCode === specialtyCode)
|
||||
rows.forEach((row) => {
|
||||
row.persons = (row.persons || []).map((person) => buildEditablePerson(person))
|
||||
@@ -434,84 +496,71 @@ const syncSpecialtyRows = (source: SpecialtyRoleSplitVO[], specialtyCode: string
|
||||
|
||||
const syncAllDerivedValues = (source: SpecialtyRoleSplitVO[]) => {
|
||||
const specialtyCodeSet = new Set(source.map((item) => item.specialtyCode))
|
||||
specialtyCodeSet.forEach((specialtyCode) => syncSpecialtyRows(source, specialtyCode))
|
||||
specialtyCodeSet.forEach((specialtyCode) => syncGroupRows(source, specialtyCode))
|
||||
}
|
||||
|
||||
const buildSpecialtyGroups = (source: SpecialtyRoleSplitVO[]): SpecialtyGroup[] => {
|
||||
const buildGroups = (source: SpecialtyRoleSplitVO[]): SpecialtyGroup[] => {
|
||||
const map = new Map<string, SpecialtyRoleSplitVO[]>()
|
||||
source.forEach((item) => {
|
||||
const list = map.get(item.specialtyCode) || []
|
||||
list.push(item)
|
||||
map.set(item.specialtyCode, list)
|
||||
})
|
||||
return OUTPUT_SPLIT_SPECIALTY_OPTIONS.map((option) => {
|
||||
const rows = map.get(option.value)
|
||||
if (!rows?.length) {
|
||||
return undefined
|
||||
}
|
||||
return Array.from(map.entries()).map(([specialtyCode, rows]) => {
|
||||
const sortedRows = [...rows].sort((a, b) => Number(a.sortNo || 0) - Number(b.sortNo || 0))
|
||||
const specialtyName = sortedRows[0]?.specialtyName || option.label
|
||||
const specialtyAmount = roundAmount(sortedRows[0]?.specialtyAmount)
|
||||
const roleTotal = roundRatio(
|
||||
sortedRows.reduce((sum, item) => sum + Number(item.roleRatio || 0), 0)
|
||||
)
|
||||
const designRow = sortedRows.find((item) => item.roleCode === DESIGN_ROLE_CODE)
|
||||
const personCount = sortedRows.reduce(
|
||||
(sum, row) => sum + countConfiguredPersons(row.persons),
|
||||
0
|
||||
)
|
||||
return {
|
||||
specialtyCode: option.value,
|
||||
specialtyName,
|
||||
specialtyAmount,
|
||||
specialtyCode,
|
||||
specialtyName: sortedRows[0]?.specialtyName || specialtyCode,
|
||||
specialtyAmount: roundAmount(sortedRows[0]?.specialtyAmount),
|
||||
rows: sortedRows,
|
||||
roleTotal,
|
||||
designRatio: roundRatio(designRow?.roleRatio),
|
||||
personCount
|
||||
roleTotal: roundRatio(sortedRows.reduce((sum, item) => sum + Number(item.roleRatio || 0), 0)),
|
||||
personCount: sortedRows.reduce((sum, row) => sum + countConfiguredPersons(row.persons), 0)
|
||||
}
|
||||
}).filter((item): item is SpecialtyGroup => !!item)
|
||||
})
|
||||
}
|
||||
|
||||
const specialtyGroups = computed(() => buildSpecialtyGroups(roleList.value))
|
||||
const editSpecialtyGroups = computed(() => buildSpecialtyGroups(editRoleList.value))
|
||||
const specialtyTabOptions = computed(() =>
|
||||
specialtyGroups.value.map((item) => ({
|
||||
const groups = computed(() => buildGroups(roleList.value))
|
||||
const editGroups = computed(() => buildGroups(editRoleList.value))
|
||||
const groupTabOptions = computed(() =>
|
||||
groups.value.map((item) => ({
|
||||
label: item.specialtyName,
|
||||
value: item.specialtyCode
|
||||
}))
|
||||
)
|
||||
const editGroupTabOptions = computed(() =>
|
||||
editGroups.value.map((item) => ({
|
||||
label: item.specialtyName,
|
||||
value: item.specialtyCode
|
||||
}))
|
||||
)
|
||||
|
||||
const currentSpecialtyGroup = computed(
|
||||
() =>
|
||||
specialtyGroups.value.find((item) => item.specialtyCode === selectedSpecialtyCode.value) ||
|
||||
specialtyGroups.value[0]
|
||||
const currentGroup = computed(
|
||||
() => groups.value.find((item) => item.specialtyCode === selectedGroupCode.value) || groups.value[0]
|
||||
)
|
||||
|
||||
const currentEditSpecialtyGroup = computed(
|
||||
const currentEditGroup = computed(
|
||||
() =>
|
||||
editSpecialtyGroups.value.find((item) => item.specialtyCode === editSpecialtyCode.value) ||
|
||||
editSpecialtyGroups.value[0]
|
||||
editGroups.value.find((item) => item.specialtyCode === editGroupCode.value) || editGroups.value[0]
|
||||
)
|
||||
const isProjectLeadRow = (row?: SpecialtyRoleSplitVO) => row?.specialtyCode === PROJECT_LEAD_GROUP_CODE
|
||||
const isEngineeringPrincipalRole = (row?: SpecialtyRoleSplitVO) =>
|
||||
row?.roleCode === ROLE_ENGINEERING_PRINCIPAL
|
||||
const isDesignRole = (row?: SpecialtyRoleSplitVO) => row?.roleCode === DESIGN_ROLE_CODE
|
||||
const isAutoCalculatedRole = (row?: SpecialtyRoleSplitVO) =>
|
||||
!!row &&
|
||||
(isProjectLeadRow(row) ? isEngineeringPrincipalRole(row) : isDesignRole(row))
|
||||
|
||||
const buildSpecialtySummaryCards = (group?: SpecialtyGroup) => {
|
||||
const buildSummaryCards = (group?: SpecialtyGroup) => {
|
||||
if (!group) {
|
||||
return []
|
||||
}
|
||||
return [
|
||||
{ label: '专业金额', value: `${formatAmountText(group.specialtyAmount)} 元` },
|
||||
{ label: '分组金额', value: `${formatAmountText(group.specialtyAmount)} 元` },
|
||||
{ label: '角色合计', value: formatPercentText(group.roleTotal) },
|
||||
{ label: '设计比例', value: formatPercentText(group.designRatio) },
|
||||
{ label: '已配置人数', value: `${group.personCount} 人` }
|
||||
{ label: '已配置人数', value: `${group.personCount} 人` },
|
||||
{ label: '角色数', value: `${group.rows.length} 个` }
|
||||
]
|
||||
}
|
||||
|
||||
const currentSpecialtySummaryCards = computed(() =>
|
||||
buildSpecialtySummaryCards(currentSpecialtyGroup.value)
|
||||
)
|
||||
const currentEditSpecialtySummaryCards = computed(() =>
|
||||
buildSpecialtySummaryCards(currentEditSpecialtyGroup.value)
|
||||
)
|
||||
|
||||
const ensureSelectedCode = (codes: string[], target: { value: string }) => {
|
||||
if (!codes.length) {
|
||||
target.value = ''
|
||||
@@ -522,39 +571,92 @@ const ensureSelectedCode = (codes: string[], target: { value: string }) => {
|
||||
}
|
||||
}
|
||||
|
||||
const syncRoleRatiosForGroup = (source: SpecialtyRoleSplitVO[], specialtyCode: string) => {
|
||||
const rows = source.filter((item) => item.specialtyCode === specialtyCode)
|
||||
if (!rows.length) {
|
||||
return
|
||||
}
|
||||
if (specialtyCode === PROJECT_LEAD_GROUP_CODE) {
|
||||
const projectManagerRow = rows.find((item) => item.roleCode === ROLE_PROJECT_MANAGER)
|
||||
const engineeringPrincipalRow = rows.find((item) => item.roleCode === ROLE_ENGINEERING_PRINCIPAL)
|
||||
if (projectManagerRow && engineeringPrincipalRow) {
|
||||
projectManagerRow.roleRatio = roundRatio(projectManagerRow.roleRatio)
|
||||
engineeringPrincipalRow.roleRatio = roundRatio(
|
||||
Math.max(0, 1 - Number(projectManagerRow.roleRatio || 0))
|
||||
)
|
||||
}
|
||||
return
|
||||
}
|
||||
const designRow = rows.find((item) => item.roleCode === DESIGN_ROLE_CODE)
|
||||
if (!designRow) {
|
||||
return
|
||||
}
|
||||
const otherTotal = roundRatio(
|
||||
rows.reduce((sum, item) => {
|
||||
if (item.roleCode === DESIGN_ROLE_CODE) {
|
||||
return sum
|
||||
}
|
||||
return sum + Number(item.roleRatio || 0)
|
||||
}, 0)
|
||||
)
|
||||
designRow.roleRatio = roundRatio(Math.max(0, 1 - otherTotal))
|
||||
}
|
||||
|
||||
const getRoleRatioMax = (row: SpecialtyRoleSplitVO) => {
|
||||
if (isAutoCalculatedRole(row)) {
|
||||
return 100
|
||||
}
|
||||
const rows = editRoleList.value.filter((item) => item.specialtyCode === row.specialtyCode)
|
||||
const otherEditableTotal = roundRatio(
|
||||
rows.reduce((sum, item) => {
|
||||
if (item === row || isAutoCalculatedRole(item)) {
|
||||
return sum
|
||||
}
|
||||
return sum + Number(item.roleRatio || 0)
|
||||
}, 0)
|
||||
)
|
||||
return toPercentValue(Math.max(0, 1 - otherEditableTotal)) ?? 100
|
||||
}
|
||||
|
||||
watch(
|
||||
specialtyGroups,
|
||||
(groups) => {
|
||||
groups,
|
||||
(value) => {
|
||||
ensureSelectedCode(
|
||||
groups.map((item) => item.specialtyCode),
|
||||
selectedSpecialtyCode
|
||||
value.map((item) => item.specialtyCode),
|
||||
selectedGroupCode
|
||||
)
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
watch(
|
||||
editSpecialtyGroups,
|
||||
(groups) => {
|
||||
editGroups,
|
||||
(value) => {
|
||||
ensureSelectedCode(
|
||||
groups.map((item) => item.specialtyCode),
|
||||
editSpecialtyCode
|
||||
value.map((item) => item.specialtyCode),
|
||||
editGroupCode
|
||||
)
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
const addPerson = (row: SpecialtyRoleSplitVO) => {
|
||||
if (isProjectLeadRow(row)) {
|
||||
return
|
||||
}
|
||||
if (!row.persons) {
|
||||
row.persons = []
|
||||
}
|
||||
row.persons.push(buildEditablePerson())
|
||||
syncSpecialtyRows(editRoleList.value, row.specialtyCode)
|
||||
syncGroupRows(editRoleList.value, row.specialtyCode)
|
||||
}
|
||||
|
||||
const removePerson = (row: SpecialtyRoleSplitVO, index: number) => {
|
||||
if (isProjectLeadRow(row)) {
|
||||
return
|
||||
}
|
||||
row.persons?.splice(index, 1)
|
||||
syncSpecialtyRows(editRoleList.value, row.specialtyCode)
|
||||
syncGroupRows(editRoleList.value, row.specialtyCode)
|
||||
}
|
||||
|
||||
const updatePersonRatio = (
|
||||
@@ -566,12 +668,16 @@ const updatePersonRatio = (
|
||||
const nextValue =
|
||||
value === undefined || value === null ? undefined : Math.min(Math.max(value, 0), maxValue)
|
||||
person.personRatio = fromPercentValue(nextValue) ?? undefined
|
||||
syncSpecialtyRows(editRoleList.value, row.specialtyCode)
|
||||
syncGroupRows(editRoleList.value, row.specialtyCode)
|
||||
}
|
||||
|
||||
const updateRoleRatio = (row: SpecialtyRoleSplitVO, value?: number) => {
|
||||
row.roleRatio = fromPercentValue(value) ?? 0
|
||||
syncSpecialtyRows(editRoleList.value, row.specialtyCode)
|
||||
const maxValue = getRoleRatioMax(row)
|
||||
const nextValue =
|
||||
value === undefined || value === null ? 0 : Math.min(Math.max(value, 0), maxValue)
|
||||
row.roleRatio = fromPercentValue(nextValue) ?? 0
|
||||
syncRoleRatiosForGroup(editRoleList.value, row.specialtyCode)
|
||||
syncGroupRows(editRoleList.value, row.specialtyCode)
|
||||
}
|
||||
|
||||
const buildSavePersons = (
|
||||
@@ -581,19 +687,18 @@ const buildSavePersons = (
|
||||
| { persons?: never; error: string } => {
|
||||
const persons: SpecialtyRolePersonVO[] = []
|
||||
for (const person of row.persons || []) {
|
||||
const personName = normalizePersonName(person.personName)
|
||||
const hasName = !!personName
|
||||
const employeeName = normalizeEmployeeName(person.employeeName)
|
||||
const hasEmployeeId = !!person.employeeId
|
||||
const hasRatio = person.personRatio !== undefined && person.personRatio !== null
|
||||
if (!hasName && !hasRatio) {
|
||||
if (!hasEmployeeId && !hasRatio) {
|
||||
continue
|
||||
}
|
||||
if (!hasName || !hasRatio) {
|
||||
return {
|
||||
error: `${row.specialtyName || row.specialtyCode}-${row.roleName || row.roleCode}的人员名称和比例必须同时填写`
|
||||
}
|
||||
if (!hasEmployeeId || !hasRatio) {
|
||||
return { error: `${row.roleName} 的员工和比例必须同时填写` }
|
||||
}
|
||||
persons.push({
|
||||
personName,
|
||||
employeeId: person.employeeId,
|
||||
employeeName: employeeName || undefined,
|
||||
personRatio: roundRatio(person.personRatio)
|
||||
})
|
||||
}
|
||||
@@ -602,7 +707,7 @@ const buildSavePersons = (
|
||||
|
||||
const validateAndBuildSaveItems = () => {
|
||||
const items: SpecialtyRoleSplitApi.SpecialtyRoleSplitSaveItemVO[] = []
|
||||
for (const group of editSpecialtyGroups.value) {
|
||||
for (const group of editGroups.value) {
|
||||
let roleTotal = 0
|
||||
for (const row of group.rows) {
|
||||
const result = buildSavePersons(row)
|
||||
@@ -613,13 +718,15 @@ const validateAndBuildSaveItems = () => {
|
||||
const persons = result.persons || []
|
||||
const personTotalRatio = sumPersonRatios(persons)
|
||||
if (personTotalRatio > 1 + EPSILON) {
|
||||
message.warning(
|
||||
`${row.specialtyName || row.specialtyCode}-${row.roleName || row.roleCode}的人员比例合计不能大于 100%`
|
||||
)
|
||||
message.warning(`${group.specialtyName}-${row.roleName} 的人员比例合计不能大于 100%`)
|
||||
return undefined
|
||||
}
|
||||
if ((row.roleCode === DESIGN_ROLE_CODE && Number(row.roleAmount || 0) > EPSILON) && persons.length === 0) {
|
||||
message.warning(`${group.specialtyName}的设计角色金额大于 0 时必须至少配置 1 个人员`)
|
||||
if (
|
||||
row.roleCode === DESIGN_ROLE_CODE &&
|
||||
Number(row.roleAmount || 0) > EPSILON &&
|
||||
persons.length === 0
|
||||
) {
|
||||
message.warning(`${group.specialtyName} 的设计角色金额大于 0 时必须配置人员`)
|
||||
return undefined
|
||||
}
|
||||
roleTotal = roundRatio(roleTotal + Number(row.roleRatio || 0))
|
||||
@@ -627,11 +734,11 @@ const validateAndBuildSaveItems = () => {
|
||||
specialtyCode: row.specialtyCode,
|
||||
roleCode: row.roleCode,
|
||||
roleRatio: roundRatio(row.roleRatio),
|
||||
persons
|
||||
persons: isProjectLeadRow(row) ? [] : persons
|
||||
})
|
||||
}
|
||||
if (Math.abs(roleTotal - 1) > EPSILON) {
|
||||
message.warning(`${group.specialtyName}五类角色比例合计必须等于 100%`)
|
||||
message.warning(`${group.specialtyName} 的角色比例合计必须等于 100%`)
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
@@ -673,7 +780,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
|
||||
roleList.value = []
|
||||
@@ -693,6 +800,7 @@ const getPlanningList = async () => {
|
||||
const loadRoleList = async (planningId: number) => {
|
||||
const data = await SpecialtyRoleSplitApi.getSpecialtyRoleSplitListByPlanningId(planningId)
|
||||
roleList.value = cloneRoleRows(data)
|
||||
roleList.value.forEach((row) => syncRoleRatiosForGroup(roleList.value, row.specialtyCode))
|
||||
syncAllDerivedValues(roleList.value)
|
||||
}
|
||||
|
||||
@@ -721,20 +829,15 @@ const handleCurrentPlanningChange = async (row?: PlanningApi.ProjectPlanningVO)
|
||||
await loadRoleList(row.id)
|
||||
}
|
||||
|
||||
const refreshCurrentPlanning = async () => {
|
||||
if (!currentPlanning.value?.id) {
|
||||
return
|
||||
}
|
||||
await loadRoleList(currentPlanning.value.id)
|
||||
}
|
||||
|
||||
const openEditDialog = () => {
|
||||
if (!roleList.value.length) {
|
||||
return
|
||||
}
|
||||
editRoleList.value = cloneRoleRows(roleList.value)
|
||||
editRoleList.value.forEach((row) => syncRoleRatiosForGroup(editRoleList.value, row.specialtyCode))
|
||||
syncAllDerivedValues(editRoleList.value)
|
||||
editSpecialtyCode.value = selectedSpecialtyCode.value || specialtyTabOptions.value[0]?.value || ''
|
||||
editRoleList.value.forEach((row) => ensureEmployeeOptions(row.persons))
|
||||
editGroupCode.value = selectedGroupCode.value || editGroupTabOptions.value[0]?.value || ''
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
@@ -812,10 +915,4 @@ onActivated(() => {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
@media (max-width: 1500px) {
|
||||
.person-row {
|
||||
grid-template-columns: minmax(140px, 1fr) 160px 110px 64px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
299
src/views/tjt/year-k-value/index.vue
Normal file
299
src/views/tjt/year-k-value/index.vue
Normal file
@@ -0,0 +1,299 @@
|
||||
<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 align="center" label="ID" prop="id" 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" />
|
||||
<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 { 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 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 {}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
|
||||
onActivated(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
Reference in New Issue
Block a user