修改代码
This commit is contained in:
4
.env
4
.env
@@ -1,5 +1,5 @@
|
||||
# 标题
|
||||
VITE_APP_TITLE=abcd管理系统
|
||||
VITE_APP_TITLE=产值管理系统
|
||||
|
||||
# 项目本地运行端口号
|
||||
VITE_PORT=80
|
||||
@@ -34,4 +34,4 @@ VITE_APP_API_ENCRYPT_RESPONSE_KEY = 96103715984234343991809655248883
|
||||
# VITE_APP_API_ENCRYPT_RESPONSE_KEY = MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAOH8IfIFxL/MR9XIg1UDv5z1fGXQI93E8wrU4iPFovL/sEt9uSgSkjyidC2O7N+m7EKtoN6b1u7cEwXSkwf3kfK0jdWLSQaNpX5YshqXCBzbDfugDaxuyYrNA4/tIMs7mzZAk0APuRXB35Dmupou7Yw7TFW/7QhQmGfzeEKULQvnAgMBAAECgYAw8LqlQGyQoPv5p3gRxEMOCfgL0JzD3XBJKztiRd35RDh40Nx1ejgjW4dPioFwGiVWd2W8cAGHLzALdcQT2KDJh+T/tsd4SPmI6uSBBK6Ff2DkO+kFFcuYvfclQQKqxma5CaZOSqhgenacmgTMFeg2eKlY3symV6JlFNu/IKU42QJBAOhxAK/Eq3e61aYQV2JSguhMR3b8NXJJRroRs/QHEanksJtl+M+2qhkC9nQVXBmBkndnkU/l2tYcHfSBlAyFySMCQQD445tgm/J2b6qMQmuUGQAYDN8FIkHjeKmha+l/fv0igWm8NDlBAem91lNDIPBUzHL1X1+pcts5bjmq99YdOnhtAkAg2J8dN3B3idpZDiQbC8fd5bGPmdI/pSUudAP27uzLEjr2qrE/QPPGdwm2m7IZFJtK7kK1hKio6u48t/bg0iL7AkEAuUUs94h+v702Fnym+jJ2CHEkXvz2US8UDs52nWrZYiM1o1y4tfSHm8H8bv8JCAa9GHyriEawfBraILOmllFdLQJAQSRZy4wmlaG48MhVXodB85X+VZ9krGXZ2TLhz7kz9iuToy53l9jTkESt6L5BfBDCVdIwcXLYgK+8KFdHN5W7HQ==
|
||||
|
||||
# 百度地图
|
||||
VITE_BAIDU_MAP_KEY = 'efHIw2qmH8RzHPxK0z0rbCgzDVLup9LD'
|
||||
VITE_BAIDU_MAP_KEY = 'efHIw2qmH8RzHPxK0z0rbCgzDVLup9LD'
|
||||
|
||||
153
README.md
153
README.md
@@ -0,0 +1,153 @@
|
||||
# tjt_czjs-ui
|
||||
|
||||
`tjt_czjs-ui` 是特建投设计产值统计平台的管理后台前端工程。当前底座基于 `Lyzsys` 前端后台框架,整体属于芋道源码体系上的二次开发版本。
|
||||
|
||||
这个项目负责后台页面、路由、权限按钮、统一请求封装、表格与表单交互等前端能力。后续特建投页面 1 到页面 3,建议统一落在独立业务域 `tjt` 下。
|
||||
|
||||
## 技术栈
|
||||
|
||||
- Vue 3
|
||||
|
||||
- TypeScript
|
||||
|
||||
- Vite
|
||||
|
||||
- Element Plus
|
||||
|
||||
- Pinia
|
||||
|
||||
- Vue Router
|
||||
|
||||
- Axios
|
||||
|
||||
- Vue I18n
|
||||
|
||||
- UnoCSS
|
||||
|
||||
## 快速开始
|
||||
|
||||
环境要求:
|
||||
|
||||
- Node.js `>= 16`
|
||||
|
||||
- 推荐使用 `npm` 或 `pnpm`
|
||||
|
||||
安装依赖:
|
||||
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
如果你本地长期使用 `pnpm`,也可以执行:
|
||||
|
||||
```bash
|
||||
pnpm install
|
||||
```
|
||||
|
||||
本地启动:
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
使用 `dev` 环境变量启动:
|
||||
|
||||
```bash
|
||||
npm run dev-server
|
||||
```
|
||||
|
||||
构建:
|
||||
|
||||
```bash
|
||||
npm run build:dev
|
||||
npm run build:test
|
||||
npm run build:stage
|
||||
npm run build:prod
|
||||
```
|
||||
|
||||
类型检查与代码整理:
|
||||
|
||||
```bash
|
||||
npm run ts:check
|
||||
npm run lint:eslint
|
||||
npm run lint:format
|
||||
npm run lint:style
|
||||
```
|
||||
|
||||
## 配置说明
|
||||
|
||||
当前请求基地址由 `src/config/axios/config.ts` 中的 `VITE_BASE_URL + VITE_API_URL` 组合而成。
|
||||
|
||||
本地环境文件位于项目根目录的 `.env*` 文件中。启动前请确认前端请求地址已经指向可用的后端服务。
|
||||
|
||||
## 关键目录
|
||||
|
||||
- `src/api`
|
||||
业务接口封装目录,建议后续新增 `src/api/tjt/*`
|
||||
|
||||
- `src/views`
|
||||
页面目录,建议后续新增 `src/views/tjt/*`
|
||||
|
||||
- `src/config`
|
||||
全局配置目录,包含请求封装与主题等配置
|
||||
|
||||
- `src/router`
|
||||
路由配置目录
|
||||
|
||||
- `src/store`
|
||||
Pinia 状态管理目录
|
||||
|
||||
- `src/main.ts`
|
||||
应用入口,统一接入 i18n、Pinia、Element Plus、路由与权限控制
|
||||
|
||||
## 特建投业务建议落位
|
||||
|
||||
建议按以下方式组织特建投页面:
|
||||
|
||||
- 页面 1 项目概况 + 合同规划:`src/views/tjt/project`
|
||||
|
||||
- 页面 2 单项目产值计算:`src/views/tjt/output`
|
||||
|
||||
- 页面 3 项目盈亏表:`src/views/tjt/profit`
|
||||
|
||||
与之对应的接口建议放在:
|
||||
|
||||
- `src/api/tjt/project`
|
||||
|
||||
- `src/api/tjt/planning`
|
||||
|
||||
- `src/api/tjt/output`
|
||||
|
||||
- `src/api/tjt/profit`
|
||||
|
||||
## 推荐参考代码
|
||||
|
||||
如果要按现有规范快速开发新页面,建议优先参考:
|
||||
|
||||
- `src/api/demo/project/index.ts`
|
||||
|
||||
- `src/views/demo/project/index.vue`
|
||||
|
||||
- `src/views/demo/project/ProjectForm.vue`
|
||||
|
||||
- `src/config/axios/service.ts`
|
||||
|
||||
- `src/main.ts`
|
||||
|
||||
这套示例已经包含列表分页、搜索筛选、新增编辑删除、批量删除、Excel 导出和权限按钮控制。
|
||||
|
||||
## 与后端联调
|
||||
|
||||
后端默认本地 Profile 为 `local`,当前本地端口配置为 `48080`。
|
||||
|
||||
联调前建议确认接口地址、登录态、租户头和加密配置是否与当前环境一致。
|
||||
|
||||
## 文档入口
|
||||
|
||||
特建投业务分析与计划文档:
|
||||
|
||||
- [`../doc/特建投业务分析与计划.md`](../doc/特建投业务分析与计划.md)
|
||||
|
||||
主需求文档:
|
||||
|
||||
- [`../tejiantou_ai_requirements_20260410_v2.md`](../tejiantou_ai_requirements_20260410_v2.md)
|
||||
|
||||
@@ -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>
|
||||
|
||||
56
src/api/tjt/outputSplit/index.ts
Normal file
56
src/api/tjt/outputSplit/index.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
export interface ProjectOutputSplitVO {
|
||||
id?: number
|
||||
projectId?: number
|
||||
planningId: number
|
||||
projectName?: string
|
||||
planningContent?: string
|
||||
year?: number
|
||||
assessmentOutputValue?: number
|
||||
projectManagerName?: string
|
||||
projectManagerRatio: number
|
||||
projectManagerAmount?: number
|
||||
engineeringLeaderName?: string
|
||||
engineeringLeaderRatio: number
|
||||
engineeringLeaderAmount?: number
|
||||
officeRatio: number
|
||||
officeAmount?: number
|
||||
archRatio: number
|
||||
archAmount?: number
|
||||
decorRatio: number
|
||||
decorAmount?: number
|
||||
structRatio: number
|
||||
structAmount?: number
|
||||
waterRatio: number
|
||||
waterAmount?: number
|
||||
elecRatio: number
|
||||
elecAmount?: number
|
||||
hvacRatio: number
|
||||
hvacAmount?: number
|
||||
digitalRatio: number
|
||||
digitalAmount?: number
|
||||
}
|
||||
|
||||
export type ProjectOutputSplitSaveVO = Pick<
|
||||
ProjectOutputSplitVO,
|
||||
| 'planningId'
|
||||
| 'projectManagerRatio'
|
||||
| 'engineeringLeaderRatio'
|
||||
| 'officeRatio'
|
||||
| 'archRatio'
|
||||
| 'decorRatio'
|
||||
| 'structRatio'
|
||||
| 'waterRatio'
|
||||
| 'elecRatio'
|
||||
| 'hvacRatio'
|
||||
| 'digitalRatio'
|
||||
>
|
||||
|
||||
export const getProjectOutputSplitByPlanningId = (planningId: number) => {
|
||||
return request.get({ url: '/tjt/output-split/get-by-planning', params: { planningId } })
|
||||
}
|
||||
|
||||
export const saveProjectOutputSplit = (data: ProjectOutputSplitSaveVO) => {
|
||||
return request.put({ url: '/tjt/output-split/save', data })
|
||||
}
|
||||
92
src/api/tjt/planning/index.ts
Normal file
92
src/api/tjt/planning/index.ts
Normal file
@@ -0,0 +1,92 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
export interface ProjectPlanningVO {
|
||||
id?: number
|
||||
projectId: number
|
||||
ownershipType: string
|
||||
calculationMethod: string
|
||||
planningContent: string
|
||||
planningAmount?: number
|
||||
managementFeeRate?: number
|
||||
managementFee?: number
|
||||
implementationTeam?: string
|
||||
planningStartYear?: number
|
||||
planningArea?: number
|
||||
designStage?: string
|
||||
currentDesignStageRatio?: number
|
||||
reviewOutsourceFlag?: boolean
|
||||
reviewOutsourceRatio?: number
|
||||
totalDistributionAmount?: number
|
||||
progressRemark?: string
|
||||
allocatedAmount?: number
|
||||
pendingAmount?: number
|
||||
buildingOrUnitCount?: number
|
||||
drawingSetFactor?: number
|
||||
scaleFactor?: number
|
||||
modificationFactor?: number
|
||||
complexityFactor?: number
|
||||
internalGuidanceUnitPrice?: number
|
||||
virtualCalculationMethod?: string
|
||||
workingDayCount?: number
|
||||
workingDayUnitPrice?: number
|
||||
guidanceUnitPrice?: number
|
||||
guidanceTotalPrice?: number
|
||||
virtualTotalPrice?: number
|
||||
calculationRatio?: number
|
||||
contractUnitPrice?: number
|
||||
totalAdjustmentFactor?: number
|
||||
assessmentArea?: number
|
||||
virtualOutputValue?: number
|
||||
assessmentOutputValue?: number
|
||||
createTime?: string
|
||||
}
|
||||
|
||||
export type ProjectPlanningSaveVO = Omit<
|
||||
ProjectPlanningVO,
|
||||
| 'allocatedAmount'
|
||||
| 'pendingAmount'
|
||||
| 'managementFee'
|
||||
| 'contractUnitPrice'
|
||||
| 'totalAdjustmentFactor'
|
||||
| 'assessmentArea'
|
||||
| 'virtualOutputValue'
|
||||
| 'assessmentOutputValue'
|
||||
| 'createTime'
|
||||
>
|
||||
|
||||
export interface ProjectPlanningPageReqVO extends PageParam {
|
||||
projectId?: number
|
||||
ownershipType?: string
|
||||
calculationMethod?: string
|
||||
planningContent?: string
|
||||
planningStartYear?: number
|
||||
createTime?: string[]
|
||||
}
|
||||
|
||||
export const getProjectPlanningPage = (params: ProjectPlanningPageReqVO) => {
|
||||
return request.get({ url: '/tjt/planning/page', params })
|
||||
}
|
||||
|
||||
export const getProjectPlanning = (id: number) => {
|
||||
return request.get({ url: '/tjt/planning/get', params: { id } })
|
||||
}
|
||||
|
||||
export const getProjectPlanningListByProjectId = (projectId: number) => {
|
||||
return request.get({ url: '/tjt/planning/list-by-project', params: { projectId } })
|
||||
}
|
||||
|
||||
export const createProjectPlanning = (data: ProjectPlanningSaveVO) => {
|
||||
return request.post({ url: '/tjt/planning/create', data })
|
||||
}
|
||||
|
||||
export const updateProjectPlanning = (data: ProjectPlanningSaveVO) => {
|
||||
return request.put({ url: '/tjt/planning/update', data })
|
||||
}
|
||||
|
||||
export const deleteProjectPlanning = (id: number) => {
|
||||
return request.delete({ url: '/tjt/planning/delete', params: { id } })
|
||||
}
|
||||
|
||||
export const deleteProjectPlanningList = (ids: number[]) => {
|
||||
return request.delete({ url: '/tjt/planning/delete-list', params: { ids: ids.join(',') } })
|
||||
}
|
||||
43
src/api/tjt/planningQuarter/index.ts
Normal file
43
src/api/tjt/planningQuarter/index.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
export interface ProjectPlanningQuarterVO {
|
||||
id?: number
|
||||
planningId: number
|
||||
distributionYear: number
|
||||
quarterNo: number
|
||||
distributionRatio?: number
|
||||
distributionAmount?: number
|
||||
createTime?: string
|
||||
}
|
||||
|
||||
export type ProjectPlanningQuarterSaveVO = Omit<
|
||||
ProjectPlanningQuarterVO,
|
||||
'distributionAmount' | 'createTime'
|
||||
>
|
||||
|
||||
export const getProjectPlanningQuarter = (id: number) => {
|
||||
return request.get({ url: '/tjt/planning-quarter/get', params: { id } })
|
||||
}
|
||||
|
||||
export const getProjectPlanningQuarterListByPlanningId = (planningId: number) => {
|
||||
return request.get({ url: '/tjt/planning-quarter/list-by-planning', params: { planningId } })
|
||||
}
|
||||
|
||||
export const createProjectPlanningQuarter = (data: ProjectPlanningQuarterSaveVO) => {
|
||||
return request.post({ url: '/tjt/planning-quarter/create', data })
|
||||
}
|
||||
|
||||
export const updateProjectPlanningQuarter = (data: ProjectPlanningQuarterSaveVO) => {
|
||||
return request.put({ url: '/tjt/planning-quarter/update', data })
|
||||
}
|
||||
|
||||
export const deleteProjectPlanningQuarter = (id: number) => {
|
||||
return request.delete({ url: '/tjt/planning-quarter/delete', params: { id } })
|
||||
}
|
||||
|
||||
export const deleteProjectPlanningQuarterList = (ids: number[]) => {
|
||||
return request.delete({
|
||||
url: '/tjt/planning-quarter/delete-list',
|
||||
params: { ids: ids.join(',') }
|
||||
})
|
||||
}
|
||||
33
src/api/tjt/profit/index.ts
Normal file
33
src/api/tjt/profit/index.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
export interface ProjectProfitVO {
|
||||
projectId: number
|
||||
projectName: string
|
||||
contractSignedFlag: boolean
|
||||
contractAmount?: number
|
||||
finalSettlementAmount?: number
|
||||
comprehensivePlanningAmount?: number
|
||||
subcontractPlanningAmount?: number
|
||||
majorOutputValue?: number
|
||||
expectedKValue?: number
|
||||
majorExpectedPerformance?: number
|
||||
profitLossValue?: number
|
||||
profitLossRate?: number
|
||||
projectStartYear?: number
|
||||
createTime?: string
|
||||
}
|
||||
|
||||
export interface ProjectProfitPageReqVO extends PageParam {
|
||||
projectName?: string
|
||||
contractSignedFlag?: boolean
|
||||
projectStartYear?: number
|
||||
createTime?: string[]
|
||||
}
|
||||
|
||||
export const getProjectProfitPage = (params: ProjectProfitPageReqVO) => {
|
||||
return request.get({ url: '/tjt/profit/page', params })
|
||||
}
|
||||
|
||||
export const getProjectProfit = (projectId: number) => {
|
||||
return request.get({ url: '/tjt/profit/get', params: { projectId } })
|
||||
}
|
||||
53
src/api/tjt/project/index.ts
Normal file
53
src/api/tjt/project/index.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
export interface ProjectVO {
|
||||
id?: number
|
||||
projectName: string
|
||||
contractSignedFlag: boolean
|
||||
contractAmount?: number
|
||||
totalConstructionArea?: number
|
||||
constructionUnitName?: string
|
||||
contactName?: string
|
||||
contactPhone?: string
|
||||
contractSigningDate?: string
|
||||
projectManagerName?: string
|
||||
engineeringPrincipalName?: string
|
||||
projectType?: string
|
||||
projectStartYear?: number
|
||||
finalSettlementAmount?: number
|
||||
expectedKValue?: number
|
||||
createTime?: string
|
||||
}
|
||||
|
||||
export type ProjectSaveVO = Omit<ProjectVO, 'createTime'>
|
||||
|
||||
export interface ProjectPageReqVO extends PageParam {
|
||||
projectName?: string
|
||||
contractSignedFlag?: boolean
|
||||
projectStartYear?: number
|
||||
createTime?: string[]
|
||||
}
|
||||
|
||||
export const getProjectPage = (params: ProjectPageReqVO) => {
|
||||
return request.get({ url: '/tjt/project/page', params })
|
||||
}
|
||||
|
||||
export const getProject = (id: number) => {
|
||||
return request.get({ url: '/tjt/project/get', params: { id } })
|
||||
}
|
||||
|
||||
export const createProject = (data: ProjectSaveVO) => {
|
||||
return request.post({ url: '/tjt/project/create', data })
|
||||
}
|
||||
|
||||
export const updateProject = (data: ProjectSaveVO) => {
|
||||
return request.put({ url: '/tjt/project/update', data })
|
||||
}
|
||||
|
||||
export const deleteProject = (id: number) => {
|
||||
return request.delete({ url: '/tjt/project/delete', params: { id } })
|
||||
}
|
||||
|
||||
export const deleteProjectList = (ids: number[]) => {
|
||||
return request.delete({ url: '/tjt/project/delete-list', params: { ids: ids.join(',') } })
|
||||
}
|
||||
44
src/api/tjt/specialtyRoleSplit/index.ts
Normal file
44
src/api/tjt/specialtyRoleSplit/index.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
export interface SpecialtyRolePersonVO {
|
||||
personName?: string
|
||||
personRatio?: number
|
||||
personAmount?: number
|
||||
}
|
||||
|
||||
export interface SpecialtyRoleSplitVO {
|
||||
id?: number
|
||||
outputSplitId?: number
|
||||
planningId?: number
|
||||
projectName?: string
|
||||
planningContent?: string
|
||||
specialtyCode: string
|
||||
specialtyName?: string
|
||||
specialtyAmount?: number
|
||||
roleCode: string
|
||||
roleName?: string
|
||||
roleRatio: number
|
||||
roleAmount?: number
|
||||
persons?: SpecialtyRolePersonVO[]
|
||||
sortNo?: number
|
||||
}
|
||||
|
||||
export interface SpecialtyRoleSplitSaveItemVO {
|
||||
specialtyCode: string
|
||||
roleCode: string
|
||||
roleRatio: number
|
||||
persons: SpecialtyRolePersonVO[]
|
||||
}
|
||||
|
||||
export interface SpecialtyRoleSplitBatchSaveVO {
|
||||
planningId: number
|
||||
items: SpecialtyRoleSplitSaveItemVO[]
|
||||
}
|
||||
|
||||
export const getSpecialtyRoleSplitListByPlanningId = (planningId: number) => {
|
||||
return request.get({ url: '/tjt/specialty-role-split/list-by-planning', params: { planningId } })
|
||||
}
|
||||
|
||||
export const saveSpecialtyRoleSplitBatch = (data: SpecialtyRoleSplitBatchSaveVO) => {
|
||||
return request.put({ url: '/tjt/specialty-role-split/save-batch', data })
|
||||
}
|
||||
@@ -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: `扫码后点击"确认",即可完成登录`,
|
||||
|
||||
828
src/views/tjt/output-split/index.vue
Normal file
828
src/views/tjt/output-split/index.vue
Normal file
@@ -0,0 +1,828 @@
|
||||
<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 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
|
||||
align="center"
|
||||
label="工程负责人"
|
||||
min-width="120"
|
||||
prop="engineeringPrincipalName"
|
||||
/>
|
||||
<el-table-column align="center" label="项目开始年度" prop="projectStartYear" width="120" />
|
||||
</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 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
|
||||
ref="planningTableRef"
|
||||
v-loading="planningLoading"
|
||||
:data="planningList"
|
||||
highlight-current-row
|
||||
@current-change="handleCurrentPlanningChange"
|
||||
>
|
||||
<el-table-column align="center" label="规划内容" min-width="180" prop="planningContent" />
|
||||
<el-table-column align="center" label="开始年度" 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>
|
||||
</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 class="mt-4px text-13px text-[var(--el-text-color-secondary)]">
|
||||
年度:{{ formData.year || '-' }},考核产值:{{ formatAmountText(formData.assessmentOutputValue) }} 元
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center gap-12px">
|
||||
<el-button
|
||||
v-hasPermi="['tjt:output-split:update']"
|
||||
plain
|
||||
type="primary"
|
||||
@click="openEditDialog"
|
||||
>
|
||||
<Icon class="mr-5px" icon="ep:edit" />
|
||||
编辑比例
|
||||
</el-button>
|
||||
<el-button @click="refreshCurrentPlanning">
|
||||
<Icon class="mr-5px" icon="ep:refresh" />
|
||||
刷新结果
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-descriptions :column="2" border title="基础信息">
|
||||
<el-descriptions-item label="项目名称">{{ formData.projectName || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="规划内容">{{ formData.planningContent || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="项目经理">{{ formData.projectManagerName || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="项目负责人">{{ formData.engineeringLeaderName || '-' }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<el-divider content-position="left">项目层结果</el-divider>
|
||||
<el-table :data="projectResultRows" border>
|
||||
<el-table-column align="center" label="类别" min-width="140" prop="label" />
|
||||
<el-table-column align="center" label="比例" min-width="120">
|
||||
<template #default="scope">
|
||||
{{ scope.row.percentText }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="金额(元)" min-width="140">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.amount) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-divider content-position="left">专业层结果</el-divider>
|
||||
<el-table :data="specialtyResultRows" border>
|
||||
<el-table-column align="center" label="专业" min-width="140" prop="label" />
|
||||
<el-table-column align="center" label="比例" min-width="120">
|
||||
<template #default="scope">
|
||||
{{ scope.row.percentText }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="金额(元)" min-width="140">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.amount) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-divider content-position="left">年度分配信息</el-divider>
|
||||
<div class="mb-12px flex flex-wrap items-start justify-between gap-12px">
|
||||
<el-radio-group v-model="selectedAnnualCategory" size="small">
|
||||
<el-radio-button
|
||||
v-for="item in annualCategoryOptions"
|
||||
:key="item.value"
|
||||
:label="item.value"
|
||||
>
|
||||
{{ item.label }}
|
||||
</el-radio-button>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
<el-row :gutter="16" class="mb-16px">
|
||||
<el-col v-for="item in annualSummaryCards" :key="item.label" :span="8">
|
||||
<div class="rounded-8px bg-[var(--el-fill-color-light)] px-16px py-12px">
|
||||
<div class="text-12px text-[var(--el-text-color-secondary)]">
|
||||
{{ item.label }}
|
||||
</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="请选择专业所规划后查看页面4结果" />
|
||||
</ContentWrap>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<Dialog v-model="dialogVisible" title="编辑专业及项目总分配比例" width="900">
|
||||
<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-input-number
|
||||
:model-value="item.percent"
|
||||
:disabled="item.key === 'officeRatio'"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="0.1"
|
||||
class="!w-1/1"
|
||||
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>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div class="mt-8px text-12px" :class="projectRatioTotalClass">
|
||||
项目层比例合计:{{ projectRatioTotalText }}
|
||||
</div>
|
||||
|
||||
<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>
|
||||
<el-input-number
|
||||
:model-value="item.percent"
|
||||
:disabled="item.key === 'archRatio'"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="0.1"
|
||||
class="!w-1/1"
|
||||
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>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div class="mt-8px text-12px" :class="specialtyRatioTotalClass">
|
||||
专业层比例合计:{{ specialtyRatioTotalText }}
|
||||
</div>
|
||||
</template>
|
||||
<template #footer>
|
||||
<el-button :loading="saveLoading" type="primary" @click="handleSave">保存</el-button>
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import * as ProjectApi from '@/api/tjt/project'
|
||||
import * as PlanningApi from '@/api/tjt/planning'
|
||||
import * as PlanningQuarterApi from '@/api/tjt/planningQuarter'
|
||||
import * as OutputSplitApi from '@/api/tjt/outputSplit'
|
||||
import {
|
||||
formatAmountText,
|
||||
fromPercentValue,
|
||||
isMajorOwnership,
|
||||
OUTPUT_SPLIT_SPECIALTY_OPTIONS,
|
||||
QUARTER_OPTIONS,
|
||||
toPercentValue
|
||||
} from '@/views/tjt/shared/planning'
|
||||
|
||||
defineOptions({ name: 'TjtOutputSplit' })
|
||||
|
||||
type AnnualCategoryKey =
|
||||
| 'projectManager'
|
||||
| 'engineeringLeader'
|
||||
| 'arch'
|
||||
| 'decor'
|
||||
| 'struct'
|
||||
| 'water'
|
||||
| 'elec'
|
||||
| 'hvac'
|
||||
| 'digital'
|
||||
|
||||
interface QuarterYearRow {
|
||||
distributionYear: number
|
||||
quarters: PlanningQuarterApi.ProjectPlanningQuarterVO[]
|
||||
}
|
||||
|
||||
const annualCategoryOptions: { label: string; value: AnnualCategoryKey }[] = [
|
||||
{ label: '项目经理', value: 'projectManager' },
|
||||
{ label: '项目负责人', value: 'engineeringLeader' },
|
||||
{ label: '建筑专业', value: 'arch' },
|
||||
{ label: '装修专业', value: 'decor' },
|
||||
{ label: '结构专业', value: 'struct' },
|
||||
{ label: '水专业', value: 'water' },
|
||||
{ label: '电气专业', value: 'elec' },
|
||||
{ label: '暖通专业', value: 'hvac' },
|
||||
{ label: '数字化设计专业', value: 'digital' }
|
||||
]
|
||||
|
||||
const message = useMessage()
|
||||
|
||||
const loading = ref(false)
|
||||
const planningLoading = ref(false)
|
||||
const quarterLoading = ref(false)
|
||||
const saveLoading = ref(false)
|
||||
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 editForm = ref<OutputSplitApi.ProjectOutputSplitVO>()
|
||||
const quarterRows = ref<QuarterYearRow[]>([])
|
||||
const selectedAnnualCategory = ref<AnnualCategoryKey>('projectManager')
|
||||
const dialogVisible = ref(false)
|
||||
const queryFormRef = ref()
|
||||
const projectTableRef = ref()
|
||||
const planningTableRef = ref()
|
||||
|
||||
const queryParams = reactive<ProjectApi.ProjectPageReqVO>({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
projectName: undefined,
|
||||
projectStartYear: undefined
|
||||
})
|
||||
|
||||
const queryProjectStartYearValue = computed({
|
||||
get: () => (queryParams.projectStartYear ? String(queryParams.projectStartYear) : undefined),
|
||||
set: (value?: string) => {
|
||||
queryParams.projectStartYear = 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>) =>
|
||||
Number(values.reduce((result, value) => result * toNumeric(value), 1).toFixed(2))
|
||||
|
||||
const formatRatioText = (value?: number | string | null) => `${(toPercentValue(value) ?? 0).toFixed(2)}%`
|
||||
|
||||
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: 'officeRatio',
|
||||
label: '专业所',
|
||||
percentText: formatRatioText(model.officeRatio),
|
||||
percent: toPercentValue(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) => ({
|
||||
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`]),
|
||||
amount: amountMap[item.value]
|
||||
}))
|
||||
}
|
||||
|
||||
const projectResultRows = computed(() => buildProjectRows(formData.value))
|
||||
const specialtyResultRows = computed(() => buildSpecialtyRows(formData.value))
|
||||
const editProjectRatioItems = computed(() => buildProjectRows(editForm.value))
|
||||
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) {
|
||||
return {
|
||||
label: currentOption.label,
|
||||
ratio: 0,
|
||||
percentText: '0.00%',
|
||||
totalAmount: 0,
|
||||
formulaText: '-'
|
||||
}
|
||||
}
|
||||
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 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
|
||||
),
|
||||
percentText: formatRatioText(currentPlanning.value?.totalDistributionAmount)
|
||||
},
|
||||
{
|
||||
label: '已分配',
|
||||
amount: multiplyAmount(
|
||||
currentPlanning.value?.assessmentOutputValue,
|
||||
currentPlanning.value?.allocatedAmount,
|
||||
annualCategoryMeta.value.ratio
|
||||
),
|
||||
percentText: formatRatioText(currentPlanning.value?.allocatedAmount)
|
||||
},
|
||||
{
|
||||
label: '待分配',
|
||||
amount: multiplyAmount(
|
||||
currentPlanning.value?.assessmentOutputValue,
|
||||
currentPlanning.value?.pendingAmount,
|
||||
annualCategoryMeta.value.ratio
|
||||
),
|
||||
percentText: formatRatioText(currentPlanning.value?.pendingAmount)
|
||||
}
|
||||
])
|
||||
|
||||
const projectRatioTotal = computed(() =>
|
||||
editProjectRatioItems.value.reduce((sum, item) => sum + Number(item.percent || 0), 0)
|
||||
)
|
||||
const specialtyRatioTotal = computed(() =>
|
||||
editSpecialtyRatioItems.value.reduce((sum, item) => sum + Number(item.percent || 0), 0)
|
||||
)
|
||||
const projectRatioTotalText = computed(() => `${projectRatioTotal.value.toFixed(2)}%`)
|
||||
const specialtyRatioTotalText = computed(() => `${specialtyRatioTotal.value.toFixed(2)}%`)
|
||||
const projectRatioTotalClass = computed(() =>
|
||||
Math.abs(projectRatioTotal.value - 100) < 0.001
|
||||
? 'text-[var(--el-color-success)]'
|
||||
: 'text-[var(--el-color-danger)]'
|
||||
)
|
||||
const specialtyRatioTotalClass = computed(() =>
|
||||
Math.abs(specialtyRatioTotal.value - 100) < 0.001
|
||||
? 'text-[var(--el-color-success)]'
|
||||
: 'text-[var(--el-color-danger)]'
|
||||
)
|
||||
|
||||
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)
|
||||
)
|
||||
}
|
||||
|
||||
const recalculateArchRatio = () => {
|
||||
if (!editForm.value) {
|
||||
return
|
||||
}
|
||||
const otherSpecialtyTotal =
|
||||
Number(editForm.value.decorRatio || 0) +
|
||||
Number(editForm.value.structRatio || 0) +
|
||||
Number(editForm.value.waterRatio || 0) +
|
||||
Number(editForm.value.elecRatio || 0) +
|
||||
Number(editForm.value.hvacRatio || 0) +
|
||||
Number(editForm.value.digitalRatio || 0)
|
||||
editForm.value.archRatio = Number(Math.max(0, 1 - otherSpecialtyTotal).toFixed(4))
|
||||
}
|
||||
|
||||
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.filter((item) => isMajorOwnership(item.ownershipType))
|
||||
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 refreshCurrentPlanning = async () => {
|
||||
if (!currentPlanning.value?.id) {
|
||||
return
|
||||
}
|
||||
await loadPlanningRelatedData(currentPlanning.value)
|
||||
}
|
||||
|
||||
const openEditDialog = () => {
|
||||
if (!formData.value) {
|
||||
return
|
||||
}
|
||||
editForm.value = { ...formData.value }
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
const updateProjectRatio = (key: string, value?: number) => {
|
||||
if (!editForm.value || key === 'officeRatio') {
|
||||
return
|
||||
}
|
||||
;(editForm.value as Record<string, number | undefined>)[key] = fromPercentValue(value) ?? 0
|
||||
recalculateOfficeRatio()
|
||||
}
|
||||
|
||||
const updateSpecialtyRatio = (key: string, value?: number) => {
|
||||
if (!editForm.value || key === 'archRatio') {
|
||||
return
|
||||
}
|
||||
;(editForm.value as Record<string, number | undefined>)[key] = fromPercentValue(value) ?? 0
|
||||
recalculateArchRatio()
|
||||
}
|
||||
|
||||
const handleSave = async () => {
|
||||
if (!editForm.value) {
|
||||
return
|
||||
}
|
||||
if (Math.abs(projectRatioTotal.value - 100) >= 0.001) {
|
||||
message.warning('项目层比例合计必须等于100%')
|
||||
return
|
||||
}
|
||||
if (Math.abs(specialtyRatioTotal.value - 100) >= 0.001) {
|
||||
message.warning('专业层比例合计必须等于100%')
|
||||
return
|
||||
}
|
||||
saveLoading.value = true
|
||||
try {
|
||||
await OutputSplitApi.saveProjectOutputSplit({
|
||||
planningId: editForm.value.planningId,
|
||||
projectManagerRatio: editForm.value.projectManagerRatio,
|
||||
engineeringLeaderRatio: editForm.value.engineeringLeaderRatio,
|
||||
officeRatio: editForm.value.officeRatio,
|
||||
archRatio: editForm.value.archRatio,
|
||||
decorRatio: editForm.value.decorRatio,
|
||||
structRatio: editForm.value.structRatio,
|
||||
waterRatio: editForm.value.waterRatio,
|
||||
elecRatio: editForm.value.elecRatio,
|
||||
hvacRatio: editForm.value.hvacRatio,
|
||||
digitalRatio: editForm.value.digitalRatio
|
||||
})
|
||||
message.success('保存成功')
|
||||
dialogVisible.value = false
|
||||
await refreshCurrentPlanning()
|
||||
} finally {
|
||||
saveLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getProjectList()
|
||||
})
|
||||
|
||||
onActivated(() => {
|
||||
getProjectList()
|
||||
})
|
||||
</script>
|
||||
600
src/views/tjt/output/PlanningOutputForm.vue
Normal file
600
src/views/tjt/output/PlanningOutputForm.vue
Normal file
@@ -0,0 +1,600 @@
|
||||
<template>
|
||||
<Dialog v-model="dialogVisible" title="合约规划编辑" width="1120">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
v-loading="formLoading"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="150px"
|
||||
>
|
||||
<el-divider content-position="left">规划头信息</el-divider>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="归属类型">
|
||||
<el-input :model-value="formData.ownershipType" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="产值计算方式">
|
||||
<el-input :model-value="formData.calculationMethod" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="规划内容">
|
||||
<el-input :model-value="formData.planningContent" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="规划金额(元)">
|
||||
<el-input :model-value="formatAmountText(formData.planningAmount)" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="管理费费率(%)">
|
||||
<el-input :model-value="formatPercentText(formData.managementFeeRate)" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="实施团队">
|
||||
<el-input :model-value="formData.implementationTeam || '-'" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-divider content-position="left">测算参数</el-divider>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="开始年度" prop="planningStartYear">
|
||||
<el-date-picker
|
||||
v-model="planningStartYearValue"
|
||||
class="!w-1/1"
|
||||
placeholder="请选择开始年度"
|
||||
type="year"
|
||||
value-format="YYYY"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="面积(㎡)" prop="planningArea">
|
||||
<el-input-number
|
||||
v-model="formData.planningArea"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="100"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="合同单价(元/㎡)">
|
||||
<el-input :model-value="contractUnitPricePreview" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="设计阶段" prop="designStage">
|
||||
<el-select
|
||||
v-model="formData.designStage"
|
||||
class="!w-1/1"
|
||||
placeholder="请选择设计阶段"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in DESIGN_STAGE_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="8">
|
||||
<el-form-item label="本次设计阶段比例(%)" prop="currentDesignStageRatio">
|
||||
<el-input-number
|
||||
v-model="currentDesignStageRatioPercent"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="0.01"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="审核审定是否外包" prop="reviewOutsourceFlag">
|
||||
<el-switch
|
||||
v-model="formData.reviewOutsourceFlag"
|
||||
active-text="是"
|
||||
inactive-text="否"
|
||||
@change="handleReviewOutsourceFlagChange"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="审核审定占比(%)" prop="reviewOutsourceRatio">
|
||||
<el-input-number
|
||||
v-model="reviewOutsourceRatioPercent"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="0.01"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col v-if="showCalculationRatioField" :span="8">
|
||||
<el-form-item :label="`${calculationRatioLabel}(%)`" prop="calculationRatio">
|
||||
<el-input-number
|
||||
v-model="calculationRatioPercent"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="0.01"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="showCalculationRatioField ? 8 : 12">
|
||||
<el-form-item label="总分配(%)" prop="totalDistributionAmount">
|
||||
<el-input-number
|
||||
v-model="totalDistributionAmountPercent"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="0.01"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!-- <el-row :gutter="16">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="提取进度备注" prop="progressRemark">
|
||||
<el-input
|
||||
v-model="formData.progressRemark"
|
||||
:rows="3"
|
||||
maxlength="500"
|
||||
placeholder="请输入合约规划层级的提取进度备注"
|
||||
show-word-limit
|
||||
type="textarea"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row> -->
|
||||
|
||||
<template v-if="showMajorFactorFields">
|
||||
<el-divider content-position="left">专业所测算参数</el-divider>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="楼栋数/户型数" prop="buildingOrUnitCount">
|
||||
<el-input-number
|
||||
v-model="formData.buildingOrUnitCount"
|
||||
:min="0"
|
||||
:precision="0"
|
||||
:step="1"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="套图系数" prop="drawingSetFactor">
|
||||
<el-input-number
|
||||
v-model="formData.drawingSetFactor"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="0.01"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="规模系数" prop="scaleFactor">
|
||||
<el-input-number
|
||||
v-model="formData.scaleFactor"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="0.01"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="修改系数" prop="modificationFactor">
|
||||
<el-input-number
|
||||
v-model="formData.modificationFactor"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="0.01"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="复杂系数/复杂等级(%)" prop="complexityFactor">
|
||||
<el-input-number
|
||||
v-model="complexityFactorPercent"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="0.01"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<template v-if="showInternalGuidanceUnitPriceField">
|
||||
<el-divider content-position="left">指导价法参数</el-divider>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="内部指导单价(元/㎡)" prop="internalGuidanceUnitPrice">
|
||||
<el-input-number
|
||||
v-model="formData.internalGuidanceUnitPrice"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="1"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<template v-if="showVirtualOutputSection">
|
||||
<el-divider content-position="left">虚拟产值法参数</el-divider>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="虚拟产值计算方式" prop="virtualCalculationMethod">
|
||||
<el-select
|
||||
v-model="formData.virtualCalculationMethod"
|
||||
class="!w-1/1"
|
||||
placeholder="请选择虚拟产值计算方式"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in VIRTUAL_CALCULATION_METHOD_OPTIONS"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-if="showWorkingDayFields" :span="8">
|
||||
<el-form-item label="工日" prop="workingDayCount">
|
||||
<el-input-number
|
||||
v-model="formData.workingDayCount"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="1"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-if="showWorkingDayFields" :span="8">
|
||||
<el-form-item label="工日单价(元)" prop="workingDayUnitPrice">
|
||||
<el-input-number
|
||||
v-model="formData.workingDayUnitPrice"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="100"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row v-if="showVirtualGuidanceFields" :gutter="16">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="指导单价(元)" prop="guidanceUnitPrice">
|
||||
<el-input-number
|
||||
v-model="formData.guidanceUnitPrice"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="1"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="指导总价(元)" prop="guidanceTotalPrice">
|
||||
<el-input-number
|
||||
v-model="formData.guidanceTotalPrice"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="1000"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row v-if="showVirtualTotalPriceFields" :gutter="16">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="虚拟总价(元)" prop="virtualTotalPrice">
|
||||
<el-input-number
|
||||
v-model="formData.virtualTotalPrice"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="1000"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button :disabled="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 PlanningApi from '@/api/tjt/planning'
|
||||
import {
|
||||
DESIGN_STAGE_OPTIONS,
|
||||
VIRTUAL_CALCULATION_METHOD_OPTIONS,
|
||||
formatAmountText,
|
||||
formatPercentText,
|
||||
fromPercentValue,
|
||||
getCalculationRatioDefaultPercent,
|
||||
getCalculationRatioLabel,
|
||||
getReviewOutsourceDefaultPercent,
|
||||
isComprehensiveOwnership,
|
||||
isContractPriceMethod,
|
||||
isGuidancePriceMethod,
|
||||
isMajorOwnership,
|
||||
isSubcontractOwnership,
|
||||
isVirtualGuidanceMethod,
|
||||
isVirtualOutputMethod,
|
||||
isVirtualTotalPriceMethod,
|
||||
isWorkingDayMethod,
|
||||
toPercentValue
|
||||
} from '@/views/tjt/shared/planning'
|
||||
|
||||
defineOptions({ name: 'TjtPlanningOutputForm' })
|
||||
|
||||
const { t } = useI18n()
|
||||
const message = useMessage()
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const dialogTitle = ref('')
|
||||
const formLoading = ref(false)
|
||||
const formRef = ref()
|
||||
const formData = ref<PlanningApi.ProjectPlanningVO>({
|
||||
projectId: 0,
|
||||
ownershipType: '',
|
||||
calculationMethod: '',
|
||||
planningContent: ''
|
||||
})
|
||||
|
||||
const normalizeFormData = (data: PlanningApi.ProjectPlanningVO): PlanningApi.ProjectPlanningVO => ({
|
||||
...data,
|
||||
reviewOutsourceFlag: data.reviewOutsourceFlag ?? false,
|
||||
totalDistributionAmount: data.totalDistributionAmount ?? 1,
|
||||
progressRemark: data.progressRemark ?? '',
|
||||
drawingSetFactor: data.drawingSetFactor ?? 1,
|
||||
scaleFactor: data.scaleFactor ?? 1,
|
||||
modificationFactor: data.modificationFactor ?? 1,
|
||||
complexityFactor: data.complexityFactor ?? 1
|
||||
})
|
||||
|
||||
const planningStartYearValue = computed({
|
||||
get: () =>
|
||||
formData.value.planningStartYear ? String(formData.value.planningStartYear) : undefined,
|
||||
set: (value?: string) => {
|
||||
formData.value.planningStartYear = value ? Number(value) : undefined
|
||||
}
|
||||
})
|
||||
|
||||
const contractUnitPricePreview = computed(() => {
|
||||
const planningAmount = Number(formData.value.planningAmount || 0)
|
||||
const planningArea = Number(formData.value.planningArea || 0)
|
||||
if (!planningArea) {
|
||||
return formatAmountText(0)
|
||||
}
|
||||
return formatAmountText(planningAmount / planningArea)
|
||||
})
|
||||
|
||||
const createPercentModel = (field: keyof PlanningApi.ProjectPlanningVO, digits = 2) =>
|
||||
computed({
|
||||
get: () => toPercentValue(formData.value[field] as number | undefined, digits),
|
||||
set: (value) => {
|
||||
formData.value[field] = fromPercentValue(value, 4) as never
|
||||
}
|
||||
})
|
||||
|
||||
const currentDesignStageRatioPercent = createPercentModel('currentDesignStageRatio')
|
||||
const reviewOutsourceRatioPercent = createPercentModel('reviewOutsourceRatio')
|
||||
const calculationRatioPercent = createPercentModel('calculationRatio')
|
||||
const totalDistributionAmountPercent = createPercentModel('totalDistributionAmount')
|
||||
const complexityFactorPercent = createPercentModel('complexityFactor')
|
||||
|
||||
const showCalculationRatioField = computed(
|
||||
() =>
|
||||
isComprehensiveOwnership(formData.value.ownershipType) ||
|
||||
isSubcontractOwnership(formData.value.ownershipType)
|
||||
)
|
||||
const calculationRatioLabel = computed(() => getCalculationRatioLabel(formData.value.ownershipType))
|
||||
const showMajorFactorFields = computed(
|
||||
() =>
|
||||
isMajorOwnership(formData.value.ownershipType) &&
|
||||
(isGuidancePriceMethod(formData.value.calculationMethod) ||
|
||||
isContractPriceMethod(formData.value.calculationMethod))
|
||||
)
|
||||
const showInternalGuidanceUnitPriceField = computed(
|
||||
() =>
|
||||
isMajorOwnership(formData.value.ownershipType) &&
|
||||
isGuidancePriceMethod(formData.value.calculationMethod)
|
||||
)
|
||||
const showVirtualOutputSection = computed(
|
||||
() =>
|
||||
isMajorOwnership(formData.value.ownershipType) &&
|
||||
isVirtualOutputMethod(formData.value.calculationMethod)
|
||||
)
|
||||
const showWorkingDayFields = computed(() => isWorkingDayMethod(formData.value.virtualCalculationMethod))
|
||||
const showVirtualGuidanceFields = computed(
|
||||
() => isVirtualGuidanceMethod(formData.value.virtualCalculationMethod)
|
||||
)
|
||||
const showVirtualTotalPriceFields = computed(
|
||||
() => isVirtualTotalPriceMethod(formData.value.virtualCalculationMethod)
|
||||
)
|
||||
|
||||
const formRules = reactive<FormRules>({
|
||||
planningStartYear: [{ required: true, message: '开始年度不能为空', trigger: 'change' }],
|
||||
planningArea: [{ required: true, message: '面积不能为空', trigger: 'blur' }],
|
||||
designStage: [{ required: true, message: '设计阶段不能为空', trigger: 'change' }],
|
||||
currentDesignStageRatio: [
|
||||
{ required: true, message: '本次设计阶段比例不能为空', trigger: 'blur' }
|
||||
],
|
||||
totalDistributionAmount: [{ required: true, message: '总分配不能为空', trigger: 'blur' }],
|
||||
calculationRatio: [
|
||||
{
|
||||
validator: (_rule, value, callback) => {
|
||||
if (showCalculationRatioField.value && (value === undefined || value === null || value === '')) {
|
||||
callback(new Error(`${calculationRatioLabel.value}不能为空`))
|
||||
return
|
||||
}
|
||||
callback()
|
||||
},
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
internalGuidanceUnitPrice: [
|
||||
{
|
||||
validator: (_rule, value, callback) => {
|
||||
if (showInternalGuidanceUnitPriceField.value && (value === undefined || value === null || value === '')) {
|
||||
callback(new Error('内部指导单价不能为空'))
|
||||
return
|
||||
}
|
||||
callback()
|
||||
},
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
virtualCalculationMethod: [
|
||||
{
|
||||
validator: (_rule, value, callback) => {
|
||||
if (showVirtualOutputSection.value && !value) {
|
||||
callback(new Error('请选择虚拟产值计算方式'))
|
||||
return
|
||||
}
|
||||
callback()
|
||||
},
|
||||
trigger: 'change'
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
const applyReviewOutsourceDefault = () => {
|
||||
formData.value.reviewOutsourceRatio = fromPercentValue(
|
||||
getReviewOutsourceDefaultPercent(
|
||||
formData.value.ownershipType,
|
||||
formData.value.reviewOutsourceFlag
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
const applyCalculationRatioDefault = () => {
|
||||
const defaultPercent = getCalculationRatioDefaultPercent(formData.value.ownershipType)
|
||||
if (defaultPercent === undefined) {
|
||||
return
|
||||
}
|
||||
if (formData.value.calculationRatio === undefined || formData.value.calculationRatio === null) {
|
||||
formData.value.calculationRatio = fromPercentValue(defaultPercent)
|
||||
}
|
||||
}
|
||||
|
||||
const handleReviewOutsourceFlagChange = () => {
|
||||
applyReviewOutsourceDefault()
|
||||
}
|
||||
|
||||
const buildSavePayload = (): PlanningApi.ProjectPlanningSaveVO => ({
|
||||
id: formData.value.id,
|
||||
projectId: formData.value.projectId,
|
||||
ownershipType: formData.value.ownershipType,
|
||||
calculationMethod: formData.value.calculationMethod,
|
||||
planningContent: formData.value.planningContent,
|
||||
planningAmount: formData.value.planningAmount,
|
||||
managementFeeRate: formData.value.managementFeeRate,
|
||||
implementationTeam: formData.value.implementationTeam,
|
||||
planningStartYear: formData.value.planningStartYear,
|
||||
planningArea: formData.value.planningArea,
|
||||
designStage: formData.value.designStage,
|
||||
currentDesignStageRatio: formData.value.currentDesignStageRatio,
|
||||
reviewOutsourceFlag: formData.value.reviewOutsourceFlag,
|
||||
reviewOutsourceRatio: formData.value.reviewOutsourceRatio,
|
||||
totalDistributionAmount: formData.value.totalDistributionAmount,
|
||||
progressRemark: formData.value.progressRemark,
|
||||
buildingOrUnitCount: formData.value.buildingOrUnitCount,
|
||||
drawingSetFactor: formData.value.drawingSetFactor,
|
||||
scaleFactor: formData.value.scaleFactor,
|
||||
modificationFactor: formData.value.modificationFactor,
|
||||
complexityFactor: formData.value.complexityFactor,
|
||||
internalGuidanceUnitPrice: formData.value.internalGuidanceUnitPrice,
|
||||
virtualCalculationMethod: formData.value.virtualCalculationMethod,
|
||||
workingDayCount: formData.value.workingDayCount,
|
||||
workingDayUnitPrice: formData.value.workingDayUnitPrice,
|
||||
guidanceUnitPrice: formData.value.guidanceUnitPrice,
|
||||
guidanceTotalPrice: formData.value.guidanceTotalPrice,
|
||||
virtualTotalPrice: formData.value.virtualTotalPrice,
|
||||
calculationRatio: formData.value.calculationRatio
|
||||
})
|
||||
|
||||
const open = async (id: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = t('action.update')
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = await PlanningApi.getProjectPlanning(id)
|
||||
formData.value = normalizeFormData(data)
|
||||
applyCalculationRatioDefault()
|
||||
if (formData.value.reviewOutsourceRatio === undefined || formData.value.reviewOutsourceRatio === null) {
|
||||
applyReviewOutsourceDefault()
|
||||
}
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
defineExpose({ open })
|
||||
|
||||
const emit = defineEmits(['success'])
|
||||
|
||||
const submitForm = async () => {
|
||||
if (!formRef.value) {
|
||||
return
|
||||
}
|
||||
const valid = await formRef.value.validate()
|
||||
if (!valid) {
|
||||
return
|
||||
}
|
||||
formLoading.value = true
|
||||
try {
|
||||
await PlanningApi.updateProjectPlanning(buildSavePayload())
|
||||
message.success(t('common.updateSuccess'))
|
||||
dialogVisible.value = false
|
||||
emit('success')
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
356
src/views/tjt/output/QuarterDistributionForm.vue
Normal file
356
src/views/tjt/output/QuarterDistributionForm.vue
Normal file
@@ -0,0 +1,356 @@
|
||||
<template>
|
||||
<Dialog v-model="dialogVisible" title="季度分配编辑" width="1280">
|
||||
<div class="mb-16px rounded-8px bg-[var(--el-fill-color-light)] px-16px py-12px text-13px leading-22px text-[var(--el-text-color-secondary)]">
|
||||
在这里维护合约规划的分配总控信息和季度分配明细。新增年度默认各季度为 0%,没有比例或比例为 0 的季度不会落库。
|
||||
</div>
|
||||
|
||||
<el-form
|
||||
ref="formRef"
|
||||
v-loading="loading"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="130px"
|
||||
>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="总分配(%)" prop="totalDistributionAmount">
|
||||
<el-input-number
|
||||
v-model="totalDistributionAmountPercent"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="0.01"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="已分配">
|
||||
<el-input :model-value="formatPercentText(formData.allocatedAmount)" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="待分配">
|
||||
<el-input :model-value="formatPercentText(formData.pendingAmount)" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="提取进度备注" prop="progressRemark">
|
||||
<el-input
|
||||
v-model="formData.progressRemark"
|
||||
:rows="3"
|
||||
maxlength="500"
|
||||
placeholder="请输入这条合约规划整体的季度分配说明"
|
||||
show-word-limit
|
||||
type="textarea"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<div class="mb-16px flex items-center justify-between">
|
||||
<div class="text-14px font-600">季度分配明细</div>
|
||||
<el-button plain @click="addDistributionYear">
|
||||
<Icon class="mr-5px" icon="ep:plus" />
|
||||
新增年度
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<el-table v-loading="loading" :data="quarterRows" border>
|
||||
<el-table-column align="center" label="分配年度" width="150">
|
||||
<template #default="scope">
|
||||
<el-date-picker
|
||||
:model-value="toYearPickerValue(scope.row.distributionYear)"
|
||||
class="!w-1/1"
|
||||
placeholder="请选择年度"
|
||||
type="year"
|
||||
value-format="YYYY"
|
||||
@update:model-value="(value) => updateDistributionYear(scope.row, value)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="操作" width="90" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button link type="danger" @click="removeDistributionYear(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-for="quarter in QUARTER_OPTIONS"
|
||||
:key="quarter.value"
|
||||
:label="quarter.label"
|
||||
min-width="180"
|
||||
>
|
||||
<template #default="scope">
|
||||
<div class="flex flex-col gap-8px">
|
||||
<el-input-number
|
||||
:model-value="toQuarterPercent(scope.row, quarter.value)"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="0.01"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
placeholder="比例(%)"
|
||||
@update:model-value="(value) => updateQuarterRatio(scope.row, quarter.value, value)"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<template #footer>
|
||||
<el-button :disabled="loading" 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 PlanningApi from '@/api/tjt/planning'
|
||||
import * as PlanningQuarterApi from '@/api/tjt/planningQuarter'
|
||||
import {
|
||||
QUARTER_OPTIONS,
|
||||
formatPercentText,
|
||||
fromPercentValue,
|
||||
toPercentValue
|
||||
} from '@/views/tjt/shared/planning'
|
||||
|
||||
defineOptions({ name: 'TjtQuarterDistributionForm' })
|
||||
|
||||
interface QuarterYearRow {
|
||||
distributionYear: number
|
||||
quarters: PlanningQuarterApi.ProjectPlanningQuarterVO[]
|
||||
}
|
||||
|
||||
const message = useMessage()
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const loading = ref(false)
|
||||
const formRef = ref()
|
||||
const planningId = ref<number>()
|
||||
const deletedQuarterIds = ref<number[]>([])
|
||||
const formData = ref<PlanningApi.ProjectPlanningVO>({
|
||||
projectId: 0,
|
||||
ownershipType: '',
|
||||
calculationMethod: '',
|
||||
planningContent: '',
|
||||
totalDistributionAmount: 1,
|
||||
progressRemark: ''
|
||||
})
|
||||
const quarterRows = ref<QuarterYearRow[]>([])
|
||||
|
||||
const totalDistributionAmountPercent = computed({
|
||||
get: () => toPercentValue(formData.value.totalDistributionAmount),
|
||||
set: (value) => {
|
||||
formData.value.totalDistributionAmount = fromPercentValue(value)
|
||||
}
|
||||
})
|
||||
|
||||
const formRules = reactive<FormRules>({
|
||||
totalDistributionAmount: [{ required: true, message: '总分配不能为空', trigger: 'blur' }],
|
||||
progressRemark: [{ max: 500, message: '提取进度备注长度不能超过 500 个字符', trigger: 'blur' }]
|
||||
})
|
||||
|
||||
const buildQuarterCell = (
|
||||
currentPlanningId: number,
|
||||
distributionYear: number,
|
||||
quarterNo: number
|
||||
): PlanningQuarterApi.ProjectPlanningQuarterVO => ({
|
||||
planningId: currentPlanningId,
|
||||
distributionYear,
|
||||
quarterNo,
|
||||
distributionRatio: undefined,
|
||||
distributionAmount: undefined
|
||||
})
|
||||
|
||||
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 match = quarters.find(
|
||||
(item) =>
|
||||
item.distributionYear === distributionYear && item.quarterNo === option.value
|
||||
)
|
||||
return match
|
||||
? { ...match }
|
||||
: buildQuarterCell(planning.id!, distributionYear, option.value)
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
const open = async (id: number) => {
|
||||
planningId.value = id
|
||||
dialogVisible.value = true
|
||||
loading.value = true
|
||||
deletedQuarterIds.value = []
|
||||
try {
|
||||
const planning = await PlanningApi.getProjectPlanning(id)
|
||||
formData.value = {
|
||||
...planning,
|
||||
totalDistributionAmount: planning.totalDistributionAmount ?? 1,
|
||||
progressRemark: planning.progressRemark ?? ''
|
||||
}
|
||||
const quarterList = await PlanningQuarterApi.getProjectPlanningQuarterListByPlanningId(id)
|
||||
quarterRows.value = buildQuarterRows(formData.value, quarterList)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({ open })
|
||||
|
||||
const emit = defineEmits(['success'])
|
||||
|
||||
const addDistributionYear = () => {
|
||||
if (!planningId.value) {
|
||||
return
|
||||
}
|
||||
const maxYear = quarterRows.value.length
|
||||
? Math.max(...quarterRows.value.map((item) => item.distributionYear))
|
||||
: formData.value.planningStartYear || new Date().getFullYear()
|
||||
const distributionYear = maxYear + 1
|
||||
quarterRows.value.push({
|
||||
distributionYear,
|
||||
quarters: QUARTER_OPTIONS.map((item) =>
|
||||
buildQuarterCell(planningId.value!, distributionYear, item.value)
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
const removeDistributionYear = (row: QuarterYearRow) => {
|
||||
const removableIds = row.quarters
|
||||
.map((item) => item.id)
|
||||
.filter((id): id is number => typeof id === 'number')
|
||||
if (removableIds.length) {
|
||||
deletedQuarterIds.value.push(...removableIds)
|
||||
}
|
||||
quarterRows.value = quarterRows.value.filter((item) => item !== row)
|
||||
}
|
||||
|
||||
const toYearPickerValue = (value?: number) => (value ? String(value) : undefined)
|
||||
|
||||
const updateDistributionYear = (row: QuarterYearRow, value?: string) => {
|
||||
row.distributionYear = value ? Number(value) : new Date().getFullYear()
|
||||
row.quarters.forEach((quarter) => {
|
||||
quarter.distributionYear = row.distributionYear
|
||||
})
|
||||
}
|
||||
|
||||
const toQuarterPercent = (row: QuarterYearRow, quarterNo: number) => {
|
||||
return toPercentValue(row.quarters[quarterNo - 1].distributionRatio)
|
||||
}
|
||||
|
||||
const updateQuarterRatio = (row: QuarterYearRow, quarterNo: number, value?: number) => {
|
||||
const quarter = row.quarters[quarterNo - 1]
|
||||
quarter.distributionRatio = fromPercentValue(value)
|
||||
quarter.distributionAmount = undefined
|
||||
}
|
||||
|
||||
const isZeroQuarter = (quarter: PlanningQuarterApi.ProjectPlanningQuarterVO) => {
|
||||
return Number(quarter.distributionRatio || 0) === 0
|
||||
}
|
||||
|
||||
const buildQuarterSavePayload = (
|
||||
row: QuarterYearRow,
|
||||
quarter: PlanningQuarterApi.ProjectPlanningQuarterVO
|
||||
): PlanningQuarterApi.ProjectPlanningQuarterSaveVO => ({
|
||||
id: quarter.id,
|
||||
planningId: planningId.value!,
|
||||
distributionYear: row.distributionYear,
|
||||
quarterNo: quarter.quarterNo,
|
||||
distributionRatio: quarter.distributionRatio
|
||||
})
|
||||
|
||||
const submitForm = async () => {
|
||||
if (!formRef.value || !planningId.value) {
|
||||
return
|
||||
}
|
||||
const valid = await formRef.value.validate()
|
||||
if (!valid) {
|
||||
return
|
||||
}
|
||||
const yearList = quarterRows.value.map((item) => item.distributionYear)
|
||||
if (yearList.some((item) => !item)) {
|
||||
message.warning('分配年度不能为空')
|
||||
return
|
||||
}
|
||||
if (new Set(yearList).size !== yearList.length) {
|
||||
message.warning('分配年度不能重复')
|
||||
return
|
||||
}
|
||||
|
||||
loading.value = true
|
||||
try {
|
||||
await PlanningApi.updateProjectPlanning({
|
||||
id: formData.value.id,
|
||||
projectId: formData.value.projectId,
|
||||
ownershipType: formData.value.ownershipType,
|
||||
calculationMethod: formData.value.calculationMethod,
|
||||
planningContent: formData.value.planningContent,
|
||||
planningAmount: formData.value.planningAmount,
|
||||
managementFeeRate: formData.value.managementFeeRate,
|
||||
implementationTeam: formData.value.implementationTeam,
|
||||
planningStartYear: formData.value.planningStartYear,
|
||||
planningArea: formData.value.planningArea,
|
||||
designStage: formData.value.designStage,
|
||||
currentDesignStageRatio: formData.value.currentDesignStageRatio,
|
||||
reviewOutsourceFlag: formData.value.reviewOutsourceFlag,
|
||||
reviewOutsourceRatio: formData.value.reviewOutsourceRatio,
|
||||
totalDistributionAmount: formData.value.totalDistributionAmount,
|
||||
progressRemark: formData.value.progressRemark,
|
||||
buildingOrUnitCount: formData.value.buildingOrUnitCount,
|
||||
drawingSetFactor: formData.value.drawingSetFactor,
|
||||
scaleFactor: formData.value.scaleFactor,
|
||||
modificationFactor: formData.value.modificationFactor,
|
||||
complexityFactor: formData.value.complexityFactor,
|
||||
internalGuidanceUnitPrice: formData.value.internalGuidanceUnitPrice,
|
||||
virtualCalculationMethod: formData.value.virtualCalculationMethod,
|
||||
workingDayCount: formData.value.workingDayCount,
|
||||
workingDayUnitPrice: formData.value.workingDayUnitPrice,
|
||||
guidanceUnitPrice: formData.value.guidanceUnitPrice,
|
||||
guidanceTotalPrice: formData.value.guidanceTotalPrice,
|
||||
virtualTotalPrice: formData.value.virtualTotalPrice,
|
||||
calculationRatio: formData.value.calculationRatio
|
||||
})
|
||||
|
||||
if (deletedQuarterIds.value.length) {
|
||||
await PlanningQuarterApi.deleteProjectPlanningQuarterList(Array.from(new Set(deletedQuarterIds.value)))
|
||||
deletedQuarterIds.value = []
|
||||
}
|
||||
|
||||
for (const row of quarterRows.value) {
|
||||
for (const quarter of row.quarters) {
|
||||
const payload = buildQuarterSavePayload(row, quarter)
|
||||
if (payload.id) {
|
||||
await PlanningQuarterApi.updateProjectPlanningQuarter(payload)
|
||||
} else if (!isZeroQuarter(quarter)) {
|
||||
await PlanningQuarterApi.createProjectPlanningQuarter(payload)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
message.success('季度分配保存成功')
|
||||
dialogVisible.value = false
|
||||
emit('success')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
616
src/views/tjt/output/index.vue
Normal file
616
src/views/tjt/output/index.vue
Normal file
@@ -0,0 +1,616 @@
|
||||
<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 align="center" label="项目 ID" prop="id" width="88" />
|
||||
<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="项目开始年度" 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
|
||||
:formatter="dateFormatter"
|
||||
align="center"
|
||||
label="创建时间"
|
||||
prop="createTime"
|
||||
width="180"
|
||||
/>
|
||||
</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="9">
|
||||
<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
|
||||
ref="planningTableRef"
|
||||
v-loading="planningLoading"
|
||||
:data="planningList"
|
||||
highlight-current-row
|
||||
@current-change="handleCurrentPlanningChange"
|
||||
>
|
||||
<el-table-column
|
||||
align="center"
|
||||
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">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.planningAmount) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="总分配" width="100">
|
||||
<template #default="scope">
|
||||
{{ formatPercentText(scope.row.totalDistributionAmount) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="考核产值(元)" width="120">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.assessmentOutputValue) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</ContentWrap>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="15">
|
||||
<ContentWrap v-if="currentPlanning">
|
||||
<div class="mb-16px flex items-center justify-between gap-16px">
|
||||
<div>
|
||||
<div class="text-16px font-600">{{ currentPlanning.planningContent }}</div>
|
||||
<div class="mt-4px text-13px text-[var(--el-text-color-secondary)]">
|
||||
{{ currentPlanning.ownershipType }} / {{ currentPlanning.calculationMethod }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center gap-12px">
|
||||
<el-button
|
||||
v-hasPermi="['tjt:planning:update']"
|
||||
plain
|
||||
type="primary"
|
||||
@click="openPlanningOutputForm"
|
||||
>
|
||||
<Icon class="mr-5px" icon="ep:edit" />
|
||||
编辑测算参数
|
||||
</el-button>
|
||||
<el-button
|
||||
v-hasPermi="['tjt:planning:update', 'tjt:planning-quarter:update', 'tjt:planning-quarter:create']"
|
||||
v-if="false"
|
||||
plain
|
||||
type="primary"
|
||||
@click="openQuarterDistributionForm"
|
||||
>
|
||||
<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="规划金额(元)">
|
||||
{{ formatAmountText(currentPlanning.planningAmount) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="管理费费率">
|
||||
{{ formatPercentText(currentPlanning.managementFeeRate) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="管理费(元)">
|
||||
{{ formatAmountText(currentPlanning.managementFee) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="实施团队">
|
||||
{{ currentPlanning.implementationTeam || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="开始年度">
|
||||
{{ currentPlanning.planningStartYear || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="面积(㎡)">
|
||||
{{ formatAreaText(currentPlanning.planningArea) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="合同单价(元/㎡)">
|
||||
{{ formatAmountText(currentPlanning.contractUnitPrice) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="设计阶段">
|
||||
{{ currentPlanning.designStage || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="本次设计阶段比例">
|
||||
{{ formatPercentText(currentPlanning.currentDesignStageRatio) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="审核审定是否外包">
|
||||
{{ currentPlanning.reviewOutsourceFlag ? '是' : '否' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="审核审定占比">
|
||||
{{ formatPercentText(currentPlanning.reviewOutsourceRatio) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item v-if="showCalculationRatioField" :label="calculationRatioLabel">
|
||||
{{ formatPercentText(currentPlanning.calculationRatio) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item
|
||||
v-if="currentPlanning.buildingOrUnitCount"
|
||||
label="楼栋数/户型数"
|
||||
>
|
||||
{{ currentPlanning.buildingOrUnitCount }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item v-if="showMajorFactorFields" label="套图系数">
|
||||
{{ formatFactorText(currentPlanning.drawingSetFactor, 2) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item v-if="showMajorFactorFields" label="规模系数">
|
||||
{{ formatFactorText(currentPlanning.scaleFactor, 2) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item v-if="showMajorFactorFields" label="修改系数">
|
||||
{{ formatFactorText(currentPlanning.modificationFactor, 2) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item v-if="showMajorFactorFields" label="复杂系数/复杂等级">
|
||||
{{ formatPercentText(currentPlanning.complexityFactor) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item
|
||||
v-if="currentPlanning.internalGuidanceUnitPrice"
|
||||
label="内部指导单价(元/㎡)"
|
||||
>
|
||||
{{ formatAmountText(currentPlanning.internalGuidanceUnitPrice) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item
|
||||
v-if="currentPlanning.virtualCalculationMethod"
|
||||
label="虚拟产值计算方式"
|
||||
>
|
||||
{{ currentPlanning.virtualCalculationMethod }}
|
||||
</el-descriptions-item>
|
||||
<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>
|
||||
<el-descriptions-item v-if="currentPlanning.workingDayUnitPrice" label="工日单价(元)">
|
||||
{{ formatAmountText(currentPlanning.workingDayUnitPrice) }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<el-descriptions :column="2" border class="mt-16px" title="计算结果">
|
||||
<el-descriptions-item label="合计调整系数">
|
||||
{{ formatFactorText(currentPlanning.totalAdjustmentFactor) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="考核面积(㎡)">
|
||||
{{ formatAreaText(currentPlanning.assessmentArea) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="虚拟产值(元)">
|
||||
{{ formatAmountText(currentPlanning.virtualOutputValue) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="考核产值(元)">
|
||||
{{ formatAmountText(currentPlanning.assessmentOutputValue) }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</ContentWrap>
|
||||
|
||||
<ContentWrap v-if="currentPlanning">
|
||||
<div class="mb-16px flex items-center justify-between gap-16px">
|
||||
<div>
|
||||
<div class="text-14px font-600">季度分配</div>
|
||||
<div class="mt-4px text-12px text-[var(--el-text-color-secondary)]">
|
||||
总分配、已分配、待分配和提取进度备注属于合约规划的总体分配控制;季度分配表只展示年度、季度和分配比例明细。
|
||||
</div>
|
||||
</div>
|
||||
<el-button
|
||||
v-hasPermi="['tjt:planning:update', 'tjt:planning-quarter:update', 'tjt:planning-quarter:create']"
|
||||
plain
|
||||
type="primary"
|
||||
@click="openQuarterDistributionForm"
|
||||
>
|
||||
编辑季度分配
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<el-row :gutter="16" class="mb-16px">
|
||||
<el-col :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)]">总分配</div>
|
||||
<div class="mt-6px text-18px font-600">
|
||||
{{ formatPercentText(currentPlanning.totalDistributionAmount) }}
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :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)]">已分配</div>
|
||||
<div class="mt-6px text-18px font-600">
|
||||
{{ formatPercentText(currentPlanning.allocatedAmount) }}
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :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)]">待分配</div>
|
||||
<div class="mt-6px text-18px font-600">
|
||||
{{ formatPercentText(currentPlanning.pendingAmount) }}
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :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)]">提取进度备注</div>
|
||||
<div class="mt-6px min-h-44px text-13px leading-20px">
|
||||
{{ currentPlanning.progressRemark || '-' }}
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="quarterLoading" :data="quarterRows" border>
|
||||
<el-table-column align="center" label="分配年度" width="150" prop="distributionYear" />
|
||||
<el-table-column
|
||||
v-for="quarter in QUARTER_OPTIONS"
|
||||
:key="quarter.value"
|
||||
:label="quarter.label"
|
||||
min-width="220"
|
||||
>
|
||||
<template #default="scope">
|
||||
<div class="flex flex-col gap-8px">
|
||||
<div class="rounded-6px bg-[var(--el-fill-color-light)] px-10px py-8px text-12px">
|
||||
分配比例:{{ formatQuarterRatio(scope.row, quarter.value) }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</ContentWrap>
|
||||
|
||||
<ContentWrap v-else>
|
||||
<el-empty description="请选择合约规划后查看测算结果和季度分配" />
|
||||
</ContentWrap>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<PlanningOutputForm ref="planningOutputFormRef" @success="handlePlanningOutputFormSuccess" />
|
||||
<QuarterDistributionForm
|
||||
ref="quarterDistributionFormRef"
|
||||
@success="handlePlanningOutputFormSuccess"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import * as ProjectApi from '@/api/tjt/project'
|
||||
import * as PlanningApi from '@/api/tjt/planning'
|
||||
import * as PlanningQuarterApi from '@/api/tjt/planningQuarter'
|
||||
import PlanningOutputForm from './PlanningOutputForm.vue'
|
||||
import QuarterDistributionForm from './QuarterDistributionForm.vue'
|
||||
import {
|
||||
CONTRACT_SIGN_OPTIONS,
|
||||
QUARTER_OPTIONS,
|
||||
formatAmountText,
|
||||
formatAreaText,
|
||||
formatPercentText,
|
||||
getCalculationRatioLabel,
|
||||
isComprehensiveOwnership,
|
||||
isContractPriceMethod,
|
||||
isGuidancePriceMethod,
|
||||
isMajorOwnership,
|
||||
isSubcontractOwnership
|
||||
} from '@/views/tjt/shared/planning'
|
||||
|
||||
defineOptions({ name: 'TjtOutput' })
|
||||
|
||||
interface QuarterYearRow {
|
||||
distributionYear: number
|
||||
quarters: PlanningQuarterApi.ProjectPlanningQuarterVO[]
|
||||
}
|
||||
|
||||
const message = useMessage()
|
||||
|
||||
const loading = ref(false)
|
||||
const planningLoading = ref(false)
|
||||
const quarterLoading = ref(false)
|
||||
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 quarterRows = ref<QuarterYearRow[]>([])
|
||||
const queryFormRef = ref()
|
||||
const projectTableRef = ref()
|
||||
const planningTableRef = ref()
|
||||
|
||||
const queryParams = reactive<ProjectApi.ProjectPageReqVO>({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
projectName: undefined,
|
||||
contractSignedFlag: undefined,
|
||||
projectStartYear: undefined
|
||||
})
|
||||
|
||||
const queryProjectStartYearValue = computed({
|
||||
get: () => (queryParams.projectStartYear ? String(queryParams.projectStartYear) : undefined),
|
||||
set: (value?: string) => {
|
||||
queryParams.projectStartYear = value ? Number(value) : undefined
|
||||
}
|
||||
})
|
||||
|
||||
const calculationRatioLabel = computed(() =>
|
||||
getCalculationRatioLabel(currentPlanning.value?.ownershipType)
|
||||
)
|
||||
const showCalculationRatioField = computed(
|
||||
() =>
|
||||
isComprehensiveOwnership(currentPlanning.value?.ownershipType) ||
|
||||
isSubcontractOwnership(currentPlanning.value?.ownershipType)
|
||||
)
|
||||
const showMajorFactorFields = computed(
|
||||
() =>
|
||||
isMajorOwnership(currentPlanning.value?.ownershipType) &&
|
||||
(isGuidancePriceMethod(currentPlanning.value?.calculationMethod) ||
|
||||
isContractPriceMethod(currentPlanning.value?.calculationMethod))
|
||||
)
|
||||
|
||||
const formatFactorText = (value?: number, digits = 4) => {
|
||||
if (value === undefined || value === null) {
|
||||
return Number(0).toFixed(digits)
|
||||
}
|
||||
return Number(value).toFixed(digits)
|
||||
}
|
||||
|
||||
const formatQuarterRatio = (row: QuarterYearRow, quarterNo: number) => {
|
||||
return formatPercentText(row.quarters[quarterNo - 1]?.distributionRatio)
|
||||
}
|
||||
|
||||
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 match = quarters.find(
|
||||
(item) =>
|
||||
item.distributionYear === distributionYear && item.quarterNo === option.value
|
||||
)
|
||||
return (
|
||||
match || {
|
||||
planningId: planning.id!,
|
||||
distributionYear,
|
||||
quarterNo: option.value,
|
||||
distributionRatio: undefined,
|
||||
distributionAmount: undefined
|
||||
}
|
||||
)
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
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
|
||||
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
|
||||
quarterRows.value = []
|
||||
return
|
||||
}
|
||||
planningLoading.value = true
|
||||
try {
|
||||
planningList.value = await PlanningApi.getProjectPlanningListByProjectId(currentProject.value.id)
|
||||
if (!planningList.value.length) {
|
||||
currentPlanning.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 loadPlanningDetail = async (planningId: number) => {
|
||||
const planning = await PlanningApi.getProjectPlanning(planningId)
|
||||
currentPlanning.value = planning
|
||||
quarterLoading.value = true
|
||||
try {
|
||||
const quarterList = await PlanningQuarterApi.getProjectPlanningQuarterListByPlanningId(planningId)
|
||||
quarterRows.value = buildQuarterRows(planning, 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) => {
|
||||
if (!row?.id) {
|
||||
currentPlanning.value = undefined
|
||||
quarterRows.value = []
|
||||
return
|
||||
}
|
||||
await loadPlanningDetail(row.id)
|
||||
}
|
||||
|
||||
const refreshCurrentPlanning = async () => {
|
||||
if (!currentPlanning.value?.id) {
|
||||
return
|
||||
}
|
||||
await loadPlanningDetail(currentPlanning.value.id)
|
||||
await getPlanningList()
|
||||
}
|
||||
|
||||
const planningOutputFormRef = ref()
|
||||
const quarterDistributionFormRef = ref()
|
||||
|
||||
const openPlanningOutputForm = () => {
|
||||
if (!currentPlanning.value?.id) {
|
||||
message.warning('请先选择合约规划')
|
||||
return
|
||||
}
|
||||
planningOutputFormRef.value.open(currentPlanning.value.id)
|
||||
}
|
||||
|
||||
const openQuarterDistributionForm = () => {
|
||||
if (!currentPlanning.value?.id) {
|
||||
message.warning('请先选择合约规划')
|
||||
return
|
||||
}
|
||||
quarterDistributionFormRef.value.open(currentPlanning.value.id)
|
||||
}
|
||||
|
||||
const handlePlanningOutputFormSuccess = async () => {
|
||||
const currentPlanningId = currentPlanning.value?.id
|
||||
await getPlanningList()
|
||||
if (currentPlanningId) {
|
||||
await loadPlanningDetail(currentPlanningId)
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getProjectList()
|
||||
})
|
||||
|
||||
onActivated(() => {
|
||||
getProjectList()
|
||||
})
|
||||
</script>
|
||||
399
src/views/tjt/profit/index.vue
Normal file
399
src/views/tjt/profit/index.vue
Normal file
@@ -0,0 +1,399 @@
|
||||
<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="profitTableRef"
|
||||
v-loading="loading"
|
||||
:data="list"
|
||||
highlight-current-row
|
||||
@current-change="handleCurrentProfitChange"
|
||||
>
|
||||
<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="开始年度" prop="projectStartYear" width="100" />
|
||||
<el-table-column align="center" label="合同金额(元)" width="120">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.contractAmount) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="最终结算金额(元)" width="140">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.finalSettlementAmount) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="综合所协作金额(元)" width="150">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.comprehensivePlanningAmount) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="专业分包金额(元)" width="150">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.subcontractPlanningAmount) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="专业所产值(元)" width="130">
|
||||
<template #default="scope">
|
||||
{{ 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="120">
|
||||
<template #default="scope">
|
||||
<span :class="profitLossClass(scope.row.profitLossValue)">
|
||||
{{ formatAmountText(scope.row.profitLossValue) }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="盈亏百分比" width="120">
|
||||
<template #default="scope">
|
||||
<span :class="profitLossClass(scope.row.profitLossValue)">
|
||||
{{ formatPercentText(scope.row.profitLossRate) }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<Pagination
|
||||
v-model:limit="queryParams.pageSize"
|
||||
v-model:page="queryParams.pageNo"
|
||||
:total="total"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
|
||||
<ContentWrap v-if="currentProfit">
|
||||
<div class="mb-16px flex items-center justify-between gap-16px">
|
||||
<div>
|
||||
<div class="text-16px font-600">{{ currentProfit.projectName }}</div>
|
||||
</div>
|
||||
<div class="flex items-center gap-12px">
|
||||
<el-button plain type="primary" @click="openProfitEditDialog">
|
||||
<Icon class="mr-5px" icon="ep:edit" />
|
||||
编辑盈亏参数
|
||||
</el-button>
|
||||
<el-button @click="refreshCurrentProfit">
|
||||
<Icon class="mr-5px" icon="ep:refresh" />
|
||||
刷新详情
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-descriptions :column="3" border>
|
||||
<el-descriptions-item label="合同金额(元)">
|
||||
{{ formatAmountText(currentProfit.contractAmount) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="最终结算金额(元)">
|
||||
{{ formatAmountText(currentProfit.finalSettlementAmount) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="项目开始年度">
|
||||
{{ currentProfit.projectStartYear || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="综合所协作金额(元)">
|
||||
{{ formatAmountText(currentProfit.comprehensivePlanningAmount) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="专业分包金额(元)">
|
||||
{{ formatAmountText(currentProfit.subcontractPlanningAmount) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="专业所产值(元)">
|
||||
{{ formatAmountText(currentProfit.majorOutputValue) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="预计 K 值">
|
||||
{{ formatPercentText(currentProfit.expectedKValue) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="专业所预计绩效(元)">
|
||||
{{ formatAmountText(currentProfit.majorExpectedPerformance) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="盈亏值(元)">
|
||||
<span :class="profitLossClass(currentProfit.profitLossValue)">
|
||||
{{ formatAmountText(currentProfit.profitLossValue) }}
|
||||
</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="盈亏百分比">
|
||||
<span :class="profitLossClass(currentProfit.profitLossValue)">
|
||||
{{ formatPercentText(currentProfit.profitLossRate) }}
|
||||
</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="创建时间">
|
||||
{{ currentProfit.createTime || '-' }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</ContentWrap>
|
||||
|
||||
<ContentWrap v-else>
|
||||
<el-empty description="请选择项目后查看盈亏详情" />
|
||||
</ContentWrap>
|
||||
|
||||
<Dialog v-model="dialogVisible" title="编辑盈亏参数" width="520">
|
||||
<el-form ref="formRef" v-loading="dialogLoading" :model="formData" :rules="formRules" label-width="140px">
|
||||
<el-form-item label="最终结算金额(元)" prop="finalSettlementAmount">
|
||||
<el-input-number
|
||||
v-model="formData.finalSettlementAmount"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="1000"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="预计 K 值(%)" prop="expectedKValue">
|
||||
<el-input-number
|
||||
v-model="expectedKValuePercent"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="0.01"
|
||||
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>
|
||||
</template>
|
||||
</Dialog>
|
||||
</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,
|
||||
formatAmountText,
|
||||
formatPercentText,
|
||||
fromPercentValue,
|
||||
toPercentValue
|
||||
} from '@/views/tjt/shared/planning'
|
||||
|
||||
defineOptions({ name: 'TjtProfit' })
|
||||
|
||||
const message = useMessage()
|
||||
const { t } = useI18n()
|
||||
|
||||
const loading = ref(false)
|
||||
const total = ref(0)
|
||||
const list = ref<ProfitApi.ProjectProfitVO[]>([])
|
||||
const currentProfit = ref<ProfitApi.ProjectProfitVO>()
|
||||
const queryFormRef = ref()
|
||||
const profitTableRef = ref()
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const dialogLoading = ref(false)
|
||||
const formRef = ref()
|
||||
const formData = ref<ProjectApi.ProjectVO>({
|
||||
projectName: '',
|
||||
contractSignedFlag: true
|
||||
})
|
||||
|
||||
const expectedKValuePercent = computed({
|
||||
get: () => toPercentValue(formData.value.expectedKValue),
|
||||
set: (value) => {
|
||||
formData.value.expectedKValue = fromPercentValue(value)
|
||||
}
|
||||
})
|
||||
|
||||
const formRules = reactive<FormRules>({})
|
||||
|
||||
const queryParams = reactive<ProfitApi.ProjectProfitPageReqVO>({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
projectName: undefined,
|
||||
contractSignedFlag: undefined,
|
||||
projectStartYear: undefined
|
||||
})
|
||||
|
||||
const queryProjectStartYearValue = computed({
|
||||
get: () => (queryParams.projectStartYear ? String(queryParams.projectStartYear) : undefined),
|
||||
set: (value?: string) => {
|
||||
queryParams.projectStartYear = value ? Number(value) : undefined
|
||||
}
|
||||
})
|
||||
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await ProfitApi.getProjectProfitPage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
if (!list.value.length) {
|
||||
currentProfit.value = undefined
|
||||
return
|
||||
}
|
||||
const targetProjectId = currentProfit.value?.projectId || list.value[0].projectId
|
||||
const targetProfit =
|
||||
list.value.find((item) => item.projectId === targetProjectId) || list.value[0]
|
||||
await nextTick()
|
||||
profitTableRef.value?.setCurrentRow(targetProfit)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
const handleCurrentProfitChange = async (row?: ProfitApi.ProjectProfitVO) => {
|
||||
if (!row?.projectId) {
|
||||
currentProfit.value = undefined
|
||||
return
|
||||
}
|
||||
currentProfit.value = await ProfitApi.getProjectProfit(row.projectId)
|
||||
}
|
||||
|
||||
const refreshCurrentProfit = async () => {
|
||||
if (!currentProfit.value?.projectId) {
|
||||
return
|
||||
}
|
||||
currentProfit.value = await ProfitApi.getProjectProfit(currentProfit.value.projectId)
|
||||
await getList()
|
||||
}
|
||||
|
||||
const openProfitEditDialog = async () => {
|
||||
if (!currentProfit.value?.projectId) {
|
||||
return
|
||||
}
|
||||
dialogVisible.value = true
|
||||
dialogLoading.value = true
|
||||
try {
|
||||
formData.value = await ProjectApi.getProject(currentProfit.value.projectId)
|
||||
} finally {
|
||||
dialogLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const buildProjectSavePayload = (): ProjectApi.ProjectSaveVO => ({
|
||||
id: formData.value.id,
|
||||
projectName: formData.value.projectName,
|
||||
contractSignedFlag: formData.value.contractSignedFlag,
|
||||
contractAmount: formData.value.contractAmount,
|
||||
totalConstructionArea: formData.value.totalConstructionArea,
|
||||
constructionUnitName: formData.value.constructionUnitName,
|
||||
contactName: formData.value.contactName,
|
||||
contactPhone: formData.value.contactPhone,
|
||||
contractSigningDate: formData.value.contractSigningDate,
|
||||
projectManagerName: formData.value.projectManagerName,
|
||||
engineeringPrincipalName: formData.value.engineeringPrincipalName,
|
||||
projectType: formData.value.projectType,
|
||||
projectStartYear: formData.value.projectStartYear,
|
||||
finalSettlementAmount: formData.value.finalSettlementAmount,
|
||||
expectedKValue: formData.value.expectedKValue
|
||||
})
|
||||
|
||||
const submitProfitForm = async () => {
|
||||
if (!formRef.value) {
|
||||
return
|
||||
}
|
||||
const valid = await formRef.value.validate()
|
||||
if (!valid) {
|
||||
return
|
||||
}
|
||||
dialogLoading.value = true
|
||||
try {
|
||||
await ProjectApi.updateProject(buildProjectSavePayload())
|
||||
message.success(t('common.updateSuccess'))
|
||||
dialogVisible.value = false
|
||||
await refreshCurrentProfit()
|
||||
} finally {
|
||||
dialogLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const profitLossClass = (value?: number) => {
|
||||
if ((value || 0) > 0) {
|
||||
return 'text-[var(--el-color-success)] font-600'
|
||||
}
|
||||
if ((value || 0) < 0) {
|
||||
return 'text-[var(--el-color-danger)] font-600'
|
||||
}
|
||||
return 'text-[var(--el-text-color-primary)]'
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
|
||||
onActivated(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
280
src/views/tjt/project/PlanningForm.vue
Normal file
280
src/views/tjt/project/PlanningForm.vue
Normal file
@@ -0,0 +1,280 @@
|
||||
<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>
|
||||
<el-form
|
||||
ref="formRef"
|
||||
v-loading="formLoading"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="128px"
|
||||
>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="归属类型" prop="ownershipType">
|
||||
<el-select
|
||||
v-model="formData.ownershipType"
|
||||
:disabled="formType === 'update'"
|
||||
class="!w-1/1"
|
||||
placeholder="请选择归属类型"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in OWNERSHIP_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="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-input
|
||||
v-model="formData.planningContent"
|
||||
maxlength="255"
|
||||
placeholder="请输入规划内容"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="规划金额(元)" prop="planningAmount">
|
||||
<el-input-number
|
||||
v-model="formData.planningAmount"
|
||||
: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="managementFeeRate">
|
||||
<el-input-number
|
||||
v-model="managementFeeRatePercent"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="0.01"
|
||||
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="managementFeePreview" 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-form>
|
||||
<template #footer>
|
||||
<el-button :disabled="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 PlanningApi from '@/api/tjt/planning'
|
||||
import {
|
||||
CALCULATION_METHOD_OPTIONS,
|
||||
OWNERSHIP_TYPE_OPTIONS,
|
||||
formatAmountText,
|
||||
fromPercentValue,
|
||||
toPercentValue
|
||||
} from '@/views/tjt/shared/planning'
|
||||
|
||||
defineOptions({ name: 'TjtPlanningForm' })
|
||||
|
||||
const { t } = useI18n()
|
||||
const message = useMessage()
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const dialogTitle = ref('')
|
||||
const formLoading = ref(false)
|
||||
const formType = ref('')
|
||||
const formRef = ref()
|
||||
|
||||
const createFormData = (
|
||||
projectId?: number,
|
||||
planningAmount?: number
|
||||
): PlanningApi.ProjectPlanningVO => ({
|
||||
projectId: projectId || 0,
|
||||
ownershipType: OWNERSHIP_TYPE_OPTIONS[0].value,
|
||||
calculationMethod: CALCULATION_METHOD_OPTIONS[0].value,
|
||||
planningContent: '',
|
||||
planningAmount,
|
||||
managementFeeRate: undefined,
|
||||
implementationTeam: '',
|
||||
planningStartYear: undefined,
|
||||
planningArea: undefined,
|
||||
designStage: undefined,
|
||||
currentDesignStageRatio: undefined,
|
||||
reviewOutsourceFlag: false,
|
||||
reviewOutsourceRatio: undefined,
|
||||
totalDistributionAmount: 1,
|
||||
progressRemark: '',
|
||||
buildingOrUnitCount: undefined,
|
||||
drawingSetFactor: 1,
|
||||
scaleFactor: 1,
|
||||
modificationFactor: 1,
|
||||
complexityFactor: 1,
|
||||
internalGuidanceUnitPrice: undefined,
|
||||
virtualCalculationMethod: undefined,
|
||||
workingDayCount: undefined,
|
||||
workingDayUnitPrice: undefined,
|
||||
guidanceUnitPrice: undefined,
|
||||
guidanceTotalPrice: undefined,
|
||||
virtualTotalPrice: undefined,
|
||||
calculationRatio: undefined
|
||||
})
|
||||
|
||||
const formData = ref<PlanningApi.ProjectPlanningVO>(createFormData())
|
||||
|
||||
const managementFeeRatePercent = computed({
|
||||
get: () => toPercentValue(formData.value.managementFeeRate),
|
||||
set: (value) => {
|
||||
formData.value.managementFeeRate = fromPercentValue(value)
|
||||
}
|
||||
})
|
||||
|
||||
const managementFeePreview = computed(() => {
|
||||
const planningAmount = Number(formData.value.planningAmount || 0)
|
||||
const managementFeeRate = Number(formData.value.managementFeeRate || 0)
|
||||
return formatAmountText(planningAmount * managementFeeRate)
|
||||
})
|
||||
|
||||
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' }]
|
||||
})
|
||||
|
||||
const buildSavePayload = (): PlanningApi.ProjectPlanningSaveVO => ({
|
||||
id: formData.value.id,
|
||||
projectId: formData.value.projectId,
|
||||
ownershipType: formData.value.ownershipType,
|
||||
calculationMethod: formData.value.calculationMethod,
|
||||
planningContent: formData.value.planningContent,
|
||||
planningAmount: formData.value.planningAmount,
|
||||
managementFeeRate: formData.value.managementFeeRate,
|
||||
implementationTeam: formData.value.implementationTeam,
|
||||
planningStartYear: formData.value.planningStartYear,
|
||||
planningArea: formData.value.planningArea,
|
||||
designStage: formData.value.designStage,
|
||||
currentDesignStageRatio: formData.value.currentDesignStageRatio,
|
||||
reviewOutsourceFlag: formData.value.reviewOutsourceFlag,
|
||||
reviewOutsourceRatio: formData.value.reviewOutsourceRatio,
|
||||
totalDistributionAmount: formData.value.totalDistributionAmount,
|
||||
progressRemark: formData.value.progressRemark,
|
||||
buildingOrUnitCount: formData.value.buildingOrUnitCount,
|
||||
drawingSetFactor: formData.value.drawingSetFactor,
|
||||
scaleFactor: formData.value.scaleFactor,
|
||||
modificationFactor: formData.value.modificationFactor,
|
||||
complexityFactor: formData.value.complexityFactor,
|
||||
internalGuidanceUnitPrice: formData.value.internalGuidanceUnitPrice,
|
||||
virtualCalculationMethod: formData.value.virtualCalculationMethod,
|
||||
workingDayCount: formData.value.workingDayCount,
|
||||
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,
|
||||
options: {
|
||||
id?: number
|
||||
projectId?: number
|
||||
defaultPlanningAmount?: number
|
||||
} = {}
|
||||
) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
resetForm(options.projectId, options.defaultPlanningAmount)
|
||||
if (!options.id) {
|
||||
return
|
||||
}
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await PlanningApi.getProjectPlanning(options.id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
defineExpose({ open })
|
||||
|
||||
const emit = defineEmits(['success'])
|
||||
|
||||
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 PlanningApi.createProjectPlanning(payload)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await PlanningApi.updateProjectPlanning(payload)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
emit('success')
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const resetForm = (projectId?: number, planningAmount?: number) => {
|
||||
formData.value = createFormData(projectId, planningAmount)
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
</script>
|
||||
257
src/views/tjt/project/ProjectForm.vue
Normal file
257
src/views/tjt/project/ProjectForm.vue
Normal file
@@ -0,0 +1,257 @@
|
||||
<template>
|
||||
<Dialog v-model="dialogVisible" :title="dialogTitle" width="1080">
|
||||
<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="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"
|
||||
/>
|
||||
</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>
|
||||
<template #footer>
|
||||
<el-button :disabled="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 ProjectApi from '@/api/tjt/project'
|
||||
import { PROJECT_TYPE_OPTIONS } from '@/views/tjt/shared/planning'
|
||||
|
||||
defineOptions({ name: 'TjtProjectForm' })
|
||||
|
||||
const { t } = useI18n()
|
||||
const message = useMessage()
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const dialogTitle = ref('')
|
||||
const formLoading = ref(false)
|
||||
const formType = ref('')
|
||||
const formRef = ref()
|
||||
|
||||
const createFormData = (): ProjectApi.ProjectVO => ({
|
||||
projectName: '',
|
||||
contractSignedFlag: true,
|
||||
contractAmount: undefined,
|
||||
totalConstructionArea: undefined,
|
||||
constructionUnitName: '',
|
||||
contactName: '',
|
||||
contactPhone: '',
|
||||
contractSigningDate: undefined,
|
||||
projectManagerName: '',
|
||||
engineeringPrincipalName: '',
|
||||
projectType: '',
|
||||
projectStartYear: new Date().getFullYear()
|
||||
})
|
||||
|
||||
const formData = ref<ProjectApi.ProjectVO>(createFormData())
|
||||
|
||||
const projectStartYearValue = computed({
|
||||
get: () => (formData.value.projectStartYear ? String(formData.value.projectStartYear) : undefined),
|
||||
set: (value?: string) => {
|
||||
formData.value.projectStartYear = value ? Number(value) : undefined
|
||||
}
|
||||
})
|
||||
|
||||
const formRules = reactive<FormRules>({
|
||||
projectName: [{ required: true, message: '工程名称不能为空', trigger: 'blur' }],
|
||||
contractAmount: [{ required: true, message: '合同金额不能为空', trigger: 'blur' }],
|
||||
totalConstructionArea: [{ required: true, message: '工程总面积不能为空', trigger: 'blur' }],
|
||||
projectStartYear: [{ required: true, message: '项目开始年度不能为空', trigger: 'change' }]
|
||||
})
|
||||
|
||||
const open = async (type: string, id?: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
resetForm()
|
||||
if (!id) {
|
||||
return
|
||||
}
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await ProjectApi.getProject(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
defineExpose({ open })
|
||||
|
||||
const emit = defineEmits(['success'])
|
||||
|
||||
const buildSavePayload = (): ProjectApi.ProjectSaveVO => ({
|
||||
id: formData.value.id,
|
||||
projectName: formData.value.projectName,
|
||||
contractSignedFlag: formData.value.contractSignedFlag,
|
||||
contractAmount: formData.value.contractAmount,
|
||||
totalConstructionArea: formData.value.totalConstructionArea,
|
||||
constructionUnitName: formData.value.constructionUnitName,
|
||||
contactName: formData.value.contactName,
|
||||
contactPhone: formData.value.contactPhone,
|
||||
contractSigningDate: formData.value.contractSigningDate,
|
||||
projectManagerName: formData.value.projectManagerName,
|
||||
engineeringPrincipalName: formData.value.engineeringPrincipalName,
|
||||
projectType: formData.value.projectType,
|
||||
projectStartYear: formData.value.projectStartYear,
|
||||
finalSettlementAmount: formData.value.finalSettlementAmount,
|
||||
expectedKValue: formData.value.expectedKValue
|
||||
})
|
||||
|
||||
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 ProjectApi.createProject(payload)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await ProjectApi.updateProject(payload)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
emit('success')
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const resetForm = () => {
|
||||
formData.value = createFormData()
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
</script>
|
||||
414
src/views/tjt/project/index.vue
Normal file
414
src/views/tjt/project/index.vue
Normal file
@@ -0,0 +1,414 @@
|
||||
<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 label="创建时间" prop="createTime">
|
||||
<el-date-picker
|
||||
v-model="queryParams.createTime"
|
||||
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
||||
class="!w-260px"
|
||||
end-placeholder="结束时间"
|
||||
start-placeholder="开始时间"
|
||||
type="datetimerange"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
/>
|
||||
</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:project:create']"
|
||||
plain
|
||||
type="primary"
|
||||
@click="openProjectForm('create')"
|
||||
>
|
||||
<Icon class="mr-5px" icon="ep:plus" />
|
||||
新增项目
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
|
||||
<ContentWrap>
|
||||
<el-table
|
||||
ref="projectTableRef"
|
||||
v-loading="loading"
|
||||
:data="list"
|
||||
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"
|
||||
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="合同金额(元)" 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="projectStartYear" width="120" />
|
||||
<el-table-column
|
||||
:formatter="dateFormatter"
|
||||
align="center"
|
||||
label="创建时间"
|
||||
prop="createTime"
|
||||
width="180"
|
||||
/>
|
||||
<el-table-column align="center" fixed="right" label="操作" width="150">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
v-hasPermi="['tjt:project:update']"
|
||||
link
|
||||
type="primary"
|
||||
@click="openProjectForm('update', scope.row.id)"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-hasPermi="['tjt:project:delete']"
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDeleteProject(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>
|
||||
|
||||
<ContentWrap v-if="currentProject">
|
||||
<div class="mb-16px flex items-center justify-between gap-16px">
|
||||
<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 || '-' }}
|
||||
</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>
|
||||
</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.projectType || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="合同签订日期">
|
||||
{{ currentProject.contractSigningDate || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="联系人">
|
||||
{{ currentProject.contactName || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="联系方式">
|
||||
{{ currentProject.contactPhone || '-' }}
|
||||
</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>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="16">
|
||||
<el-table v-loading="planningLoading" :data="planningList">
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="规划内容"
|
||||
min-width="200"
|
||||
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">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.planningAmount) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="管理费费率" width="110">
|
||||
<template #default="scope">
|
||||
{{ formatPercentText(scope.row.managementFeeRate) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="管理费(元)" width="120">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.managementFee) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="实施团队"
|
||||
min-width="140"
|
||||
prop="implementationTeam"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column align="center" fixed="right" label="操作" width="140">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
v-hasPermi="['tjt:planning:update']"
|
||||
link
|
||||
type="primary"
|
||||
@click="openPlanningForm('update', scope.row.id)"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-hasPermi="['tjt:planning:delete']"
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDeletePlanning(scope.row.id)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</ContentWrap>
|
||||
|
||||
<ContentWrap v-else>
|
||||
<el-empty description="请选择项目后查看合约规划" />
|
||||
</ContentWrap>
|
||||
|
||||
<ProjectForm ref="projectFormRef" @success="handleProjectFormSuccess" />
|
||||
<PlanningForm ref="planningFormRef" @success="handlePlanningFormSuccess" />
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { dateFormatter } 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,
|
||||
formatAmountText,
|
||||
formatAreaText,
|
||||
formatPercentText
|
||||
} from '@/views/tjt/shared/planning'
|
||||
|
||||
defineOptions({ name: 'TjtProject' })
|
||||
|
||||
const message = useMessage()
|
||||
const { t } = useI18n()
|
||||
|
||||
const loading = ref(false)
|
||||
const planningLoading = ref(false)
|
||||
const total = ref(0)
|
||||
const list = 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,
|
||||
createTime: []
|
||||
})
|
||||
|
||||
const queryProjectStartYearValue = computed({
|
||||
get: () => (queryParams.projectStartYear ? String(queryParams.projectStartYear) : undefined),
|
||||
set: (value?: string) => {
|
||||
queryParams.projectStartYear = value ? Number(value) : undefined
|
||||
}
|
||||
})
|
||||
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await ProjectApi.getProjectPage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
if (!list.value.length) {
|
||||
currentProject.value = undefined
|
||||
planningList.value = []
|
||||
return
|
||||
}
|
||||
const targetProjectId = currentProject.value?.id || list.value[0].id
|
||||
const targetProject = list.value.find((item) => item.id === targetProjectId) || list.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
|
||||
getList()
|
||||
}
|
||||
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
const handleCurrentProjectChange = async (row?: ProjectApi.ProjectVO) => {
|
||||
currentProject.value = row || undefined
|
||||
await getPlanningList()
|
||||
}
|
||||
|
||||
const projectFormRef = ref()
|
||||
const openProjectForm = (type: string, id?: number) => {
|
||||
projectFormRef.value.open(type, id)
|
||||
}
|
||||
|
||||
const planningFormRef = ref()
|
||||
const openPlanningForm = (type: string, id?: number) => {
|
||||
if (type === 'create') {
|
||||
if (!currentProject.value?.id) {
|
||||
message.warning('请先选择项目')
|
||||
return
|
||||
}
|
||||
planningFormRef.value.open(type, {
|
||||
projectId: currentProject.value.id,
|
||||
defaultPlanningAmount: currentProject.value.contractAmount
|
||||
})
|
||||
return
|
||||
}
|
||||
planningFormRef.value.open(type, { id })
|
||||
}
|
||||
|
||||
const handleDeleteProject = async (id: number) => {
|
||||
try {
|
||||
await message.delConfirm()
|
||||
await ProjectApi.deleteProject(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
const handleDeletePlanning = async (id: number) => {
|
||||
try {
|
||||
await message.delConfirm()
|
||||
await PlanningApi.deleteProjectPlanning(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
await getPlanningList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
const handleProjectFormSuccess = async () => {
|
||||
await getList()
|
||||
}
|
||||
|
||||
const handlePlanningFormSuccess = async () => {
|
||||
await getPlanningList()
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await getList()
|
||||
await getPlanningList()
|
||||
})
|
||||
|
||||
onActivated(async () => {
|
||||
await getList()
|
||||
await getPlanningList()
|
||||
})
|
||||
</script>
|
||||
154
src/views/tjt/shared/planning.ts
Normal file
154
src/views/tjt/shared/planning.ts
Normal file
@@ -0,0 +1,154 @@
|
||||
export const OWNERSHIP_TYPE_OPTIONS = [
|
||||
{ label: '专业所', value: '专业所' },
|
||||
{ label: '综合所', value: '综合所' },
|
||||
{ label: '专业分包', value: '专业分包' }
|
||||
]
|
||||
|
||||
export const CALCULATION_METHOD_OPTIONS = [
|
||||
{ label: '指导价法', value: '指导价法' },
|
||||
{ label: '合同价法', value: '合同价法' },
|
||||
{ label: '虚拟产值法', value: '虚拟产值法' }
|
||||
]
|
||||
|
||||
export const VIRTUAL_CALCULATION_METHOD_OPTIONS = [
|
||||
{ label: '指导单价法', value: '指导单价法' },
|
||||
{ label: '虚拟总价法', value: '虚拟总价法' },
|
||||
{ label: '工日法', value: '工日法' }
|
||||
]
|
||||
|
||||
export const DESIGN_STAGE_OPTIONS = [
|
||||
{ label: '方案', value: '方案' },
|
||||
{ label: '施工图', value: '施工图' },
|
||||
{ label: '方案+施工图', value: '方案+施工图' }
|
||||
]
|
||||
|
||||
export const CONTRACT_SIGN_OPTIONS = [
|
||||
{ label: '已签订', value: true },
|
||||
{ label: '未签订', value: false }
|
||||
]
|
||||
|
||||
export const PROJECT_TYPE_OPTIONS = [
|
||||
{ label: '建筑工程', value: '建筑工程' },
|
||||
{ label: '精装工程', value: '精装工程' },
|
||||
{ label: '综合工程', value: '综合工程' }
|
||||
]
|
||||
|
||||
export const QUARTER_OPTIONS = [
|
||||
{ label: '一季度', value: 1 },
|
||||
{ label: '二季度', value: 2 },
|
||||
{ label: '三季度', value: 3 },
|
||||
{ label: '四季度', value: 4 }
|
||||
]
|
||||
|
||||
export const OUTPUT_SPLIT_SPECIALTY_OPTIONS = [
|
||||
{ label: '建筑', value: 'arch' },
|
||||
{ label: '装修', value: 'decor' },
|
||||
{ label: '结构', value: 'struct' },
|
||||
{ label: '水', value: 'water' },
|
||||
{ label: '电气', value: 'elec' },
|
||||
{ label: '暖通', value: 'hvac' },
|
||||
{ label: '数字化设计', value: 'digital' }
|
||||
]
|
||||
|
||||
export const SPECIALTY_ROLE_OPTIONS = [
|
||||
{ label: '专业负责人', value: 'director' },
|
||||
{ label: '校对', value: 'check' },
|
||||
{ label: '审核', value: 'review' },
|
||||
{ label: '审定', value: 'approve' },
|
||||
{ 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) => 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) => 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) => 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 getCalculationRatioLabel = (ownershipType?: string) => {
|
||||
if (isComprehensiveOwnership(ownershipType)) {
|
||||
return '协作比例'
|
||||
}
|
||||
if (isSubcontractOwnership(ownershipType)) {
|
||||
return '分包比例'
|
||||
}
|
||||
return '比例'
|
||||
}
|
||||
|
||||
export const getReviewOutsourceDefaultPercent = (
|
||||
ownershipType?: string,
|
||||
reviewOutsourceFlag?: boolean
|
||||
) => {
|
||||
if (!reviewOutsourceFlag) {
|
||||
return 0
|
||||
}
|
||||
if (isMajorOwnership(ownershipType)) {
|
||||
return 6
|
||||
}
|
||||
return 25
|
||||
}
|
||||
|
||||
export const getCalculationRatioDefaultPercent = (ownershipType?: string) => {
|
||||
if (isComprehensiveOwnership(ownershipType)) {
|
||||
return 8
|
||||
}
|
||||
if (isSubcontractOwnership(ownershipType)) {
|
||||
return 4
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
export const toPercentValue = (value?: number | string | null, digits = 2) => {
|
||||
if (value === undefined || value === null || value === '') {
|
||||
return undefined
|
||||
}
|
||||
const numericValue = Number(value)
|
||||
if (Number.isNaN(numericValue)) {
|
||||
return undefined
|
||||
}
|
||||
return Number((numericValue * 100).toFixed(digits))
|
||||
}
|
||||
|
||||
export const fromPercentValue = (value?: number | string | null, digits = 4) => {
|
||||
if (value === undefined || value === null || value === '') {
|
||||
return undefined
|
||||
}
|
||||
const numericValue = Number(value)
|
||||
if (Number.isNaN(numericValue)) {
|
||||
return undefined
|
||||
}
|
||||
return Number((numericValue / 100).toFixed(digits))
|
||||
}
|
||||
|
||||
export const formatAmountText = (value?: number | string | null) => {
|
||||
if (value === undefined || value === null || value === '') {
|
||||
return '0.00'
|
||||
}
|
||||
const numericValue = Number(value)
|
||||
if (Number.isNaN(numericValue)) {
|
||||
return '0.00'
|
||||
}
|
||||
return numericValue.toFixed(2)
|
||||
}
|
||||
|
||||
export const formatAreaText = (value?: number | string | null) => `${formatAmountText(value)} ㎡`
|
||||
|
||||
export const formatPercentText = (value?: number | string | null, digits = 2) => {
|
||||
const percentValue = toPercentValue(value, digits)
|
||||
return `${(percentValue ?? 0).toFixed(digits)}%`
|
||||
}
|
||||
821
src/views/tjt/staff-assignment/index.vue
Normal file
821
src/views/tjt/staff-assignment/index.vue
Normal file
@@ -0,0 +1,821 @@
|
||||
<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 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 align="center" label="工程负责人" min-width="120" prop="engineeringPrincipalName" />
|
||||
<el-table-column align="center" label="项目开始年度" prop="projectStartYear" width="120" />
|
||||
</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 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
|
||||
ref="planningTableRef"
|
||||
v-loading="planningLoading"
|
||||
:data="planningList"
|
||||
highlight-current-row
|
||||
@current-change="handleCurrentPlanningChange"
|
||||
>
|
||||
<el-table-column align="center" label="规划内容" min-width="180" prop="planningContent" />
|
||||
<el-table-column align="center" label="开始年度" 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>
|
||||
</ContentWrap>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="16">
|
||||
<ContentWrap v-if="currentPlanning && currentSpecialtyGroup">
|
||||
<div class="mb-16px flex items-center justify-between gap-12px">
|
||||
<div>
|
||||
<div class="text-16px font-600">{{ currentPlanning.planningContent }}</div>
|
||||
</div>
|
||||
<div class="flex items-center gap-12px">
|
||||
<el-button
|
||||
v-hasPermi="['tjt:specialty-role-split:update']"
|
||||
plain
|
||||
type="primary"
|
||||
@click="openEditDialog"
|
||||
>
|
||||
<Icon class="mr-5px" icon="ep:edit" />
|
||||
编辑人员分配
|
||||
</el-button>
|
||||
<el-button @click="refreshCurrentPlanning">
|
||||
<Icon class="mr-5px" icon="ep:refresh" />
|
||||
刷新结果
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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"
|
||||
>
|
||||
{{ 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">
|
||||
<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="currentSpecialtyGroup.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.personName || '-' }}</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="请选择专业所规划后查看页面5结果" />
|
||||
</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"
|
||||
>
|
||||
{{ 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">
|
||||
<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="currentEditSpecialtyGroup.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"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="0.1"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
@update:model-value="(value) => updateRoleRatio(scope.row, value)"
|
||||
/>
|
||||
</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">
|
||||
<span :class="getPersonTotalClass(scope.row)">
|
||||
{{ formatPercentText(getPersonTotalRatio(scope.row)) }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="人员配置" min-width="520">
|
||||
<template #default="scope">
|
||||
<div class="person-editor">
|
||||
<div v-if="!scope.row.persons?.length" class="person-empty">
|
||||
暂无人员,请点击“添加人员”
|
||||
</div>
|
||||
<div
|
||||
v-for="(person, index) in scope.row.persons"
|
||||
:key="`${scope.row.specialtyCode}-${scope.row.roleCode}-${index}`"
|
||||
class="person-row"
|
||||
>
|
||||
<el-input
|
||||
v-model="person.personName"
|
||||
clearable
|
||||
maxlength="64"
|
||||
placeholder="请输入人员名称"
|
||||
/>
|
||||
<el-input-number
|
||||
:model-value="toPercentValue(person.personRatio)"
|
||||
:max="getPersonRatioMax(scope.row, person)"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
: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>
|
||||
</div>
|
||||
<div class="person-toolbar">
|
||||
<el-button text type="primary" @click="addPerson(scope.row)">
|
||||
<Icon class="mr-5px" icon="ep:plus" />
|
||||
添加人员
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</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>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import * as ProjectApi from '@/api/tjt/project'
|
||||
import * as PlanningApi from '@/api/tjt/planning'
|
||||
import * as SpecialtyRoleSplitApi from '@/api/tjt/specialtyRoleSplit'
|
||||
import {
|
||||
formatAmountText,
|
||||
formatPercentText,
|
||||
fromPercentValue,
|
||||
isMajorOwnership,
|
||||
OUTPUT_SPLIT_SPECIALTY_OPTIONS,
|
||||
toPercentValue
|
||||
} from '@/views/tjt/shared/planning'
|
||||
|
||||
defineOptions({ name: 'TjtStaffAssignment' })
|
||||
|
||||
const DESIGN_ROLE_CODE = 'design'
|
||||
const EPSILON = 0.0001
|
||||
|
||||
type SpecialtyRolePersonVO = SpecialtyRoleSplitApi.SpecialtyRolePersonVO
|
||||
type SpecialtyRoleSplitVO = SpecialtyRoleSplitApi.SpecialtyRoleSplitVO
|
||||
|
||||
interface SpecialtyGroup {
|
||||
specialtyCode: string
|
||||
specialtyName: string
|
||||
specialtyAmount: number
|
||||
rows: SpecialtyRoleSplitVO[]
|
||||
roleTotal: number
|
||||
designRatio: number
|
||||
personCount: number
|
||||
}
|
||||
|
||||
const message = useMessage()
|
||||
|
||||
const loading = ref(false)
|
||||
const planningLoading = ref(false)
|
||||
const saveLoading = ref(false)
|
||||
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 editRoleList = ref<SpecialtyRoleSplitVO[]>([])
|
||||
const selectedSpecialtyCode = ref('')
|
||||
const editSpecialtyCode = ref('')
|
||||
const dialogVisible = ref(false)
|
||||
const queryFormRef = ref()
|
||||
const projectTableRef = ref()
|
||||
const planningTableRef = ref()
|
||||
|
||||
const queryParams = reactive<ProjectApi.ProjectPageReqVO>({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
projectName: undefined,
|
||||
projectStartYear: undefined
|
||||
})
|
||||
|
||||
const queryProjectStartYearValue = computed({
|
||||
get: () => (queryParams.projectStartYear ? String(queryParams.projectStartYear) : undefined),
|
||||
set: (value?: string) => {
|
||||
queryParams.projectStartYear = value ? Number(value) : undefined
|
||||
}
|
||||
})
|
||||
|
||||
const roundRatio = (value?: number | string | null) => {
|
||||
const numericValue = Number(value || 0)
|
||||
if (Number.isNaN(numericValue)) {
|
||||
return 0
|
||||
}
|
||||
return 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))
|
||||
}
|
||||
|
||||
const multiplyAmount = (amount?: number | string | null, ratio?: number | string | null) => {
|
||||
return roundAmount(Number(amount || 0) * Number(ratio || 0))
|
||||
}
|
||||
|
||||
const normalizePersonName = (value?: string) => value?.trim() || ''
|
||||
|
||||
const buildEditablePerson = (person?: SpecialtyRolePersonVO): SpecialtyRolePersonVO => ({
|
||||
personName: person?.personName || '',
|
||||
personRatio:
|
||||
person?.personRatio === undefined || person?.personRatio === null
|
||||
? undefined
|
||||
: roundRatio(person.personRatio),
|
||||
personAmount: roundAmount(person?.personAmount)
|
||||
})
|
||||
|
||||
const buildEditableRow = (row: SpecialtyRoleSplitVO): SpecialtyRoleSplitVO => ({
|
||||
...row,
|
||||
specialtyAmount: roundAmount(row.specialtyAmount),
|
||||
roleRatio: roundRatio(row.roleRatio),
|
||||
roleAmount: roundAmount(row.roleAmount),
|
||||
persons: (row.persons || []).map((person) => buildEditablePerson(person))
|
||||
})
|
||||
|
||||
const cloneRoleRows = (rows: SpecialtyRoleSplitVO[]) => rows.map((item) => buildEditableRow(item))
|
||||
|
||||
const sumPersonRatios = (persons?: SpecialtyRolePersonVO[]) =>
|
||||
roundRatio((persons || []).reduce((sum, person) => sum + Number(person?.personRatio || 0), 0))
|
||||
|
||||
const getPersonTotalRatio = (row: SpecialtyRoleSplitVO) => sumPersonRatios(row.persons)
|
||||
|
||||
const getPersonTotalClass = (row: SpecialtyRoleSplitVO) =>
|
||||
getPersonTotalRatio(row) > 1 + EPSILON ? 'text-[var(--el-color-danger)]' : ''
|
||||
|
||||
const getPersonRatioMax = (row: SpecialtyRoleSplitVO, currentPerson: SpecialtyRolePersonVO) => {
|
||||
const otherTotalRatio = roundRatio(
|
||||
(row.persons || []).reduce((sum, person) => {
|
||||
if (person === currentPerson) {
|
||||
return sum
|
||||
}
|
||||
return sum + Number(person?.personRatio || 0)
|
||||
}, 0)
|
||||
)
|
||||
const currentPercent = toPercentValue(currentPerson.personRatio) ?? 0
|
||||
const remainPercent = toPercentValue(Math.max(0, 1 - otherTotalRatio)) ?? 0
|
||||
return Math.min(100, Math.max(currentPercent, remainPercent))
|
||||
}
|
||||
|
||||
const countConfiguredPersons = (persons?: SpecialtyRolePersonVO[]) =>
|
||||
(persons || []).filter(
|
||||
(person) =>
|
||||
normalizePersonName(person.personName) ||
|
||||
(person.personRatio !== undefined && person.personRatio !== null)
|
||||
).length
|
||||
|
||||
const syncSpecialtyRows = (source: SpecialtyRoleSplitVO[], specialtyCode: string) => {
|
||||
const rows = source.filter((item) => item.specialtyCode === specialtyCode)
|
||||
rows.forEach((row) => {
|
||||
row.persons = (row.persons || []).map((person) => buildEditablePerson(person))
|
||||
row.roleRatio = roundRatio(row.roleRatio)
|
||||
row.roleAmount = multiplyAmount(row.specialtyAmount, row.roleRatio)
|
||||
row.persons = (row.persons || []).map((person) => ({
|
||||
...person,
|
||||
personAmount: multiplyAmount(row.roleAmount, person.personRatio)
|
||||
}))
|
||||
})
|
||||
}
|
||||
|
||||
const syncAllDerivedValues = (source: SpecialtyRoleSplitVO[]) => {
|
||||
const specialtyCodeSet = new Set(source.map((item) => item.specialtyCode))
|
||||
specialtyCodeSet.forEach((specialtyCode) => syncSpecialtyRows(source, specialtyCode))
|
||||
}
|
||||
|
||||
const buildSpecialtyGroups = (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
|
||||
}
|
||||
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,
|
||||
rows: sortedRows,
|
||||
roleTotal,
|
||||
designRatio: roundRatio(designRow?.roleRatio),
|
||||
personCount
|
||||
}
|
||||
}).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) => ({
|
||||
label: item.specialtyName,
|
||||
value: item.specialtyCode
|
||||
}))
|
||||
)
|
||||
|
||||
const currentSpecialtyGroup = computed(
|
||||
() =>
|
||||
specialtyGroups.value.find((item) => item.specialtyCode === selectedSpecialtyCode.value) ||
|
||||
specialtyGroups.value[0]
|
||||
)
|
||||
|
||||
const currentEditSpecialtyGroup = computed(
|
||||
() =>
|
||||
editSpecialtyGroups.value.find((item) => item.specialtyCode === editSpecialtyCode.value) ||
|
||||
editSpecialtyGroups.value[0]
|
||||
)
|
||||
|
||||
const buildSpecialtySummaryCards = (group?: SpecialtyGroup) => {
|
||||
if (!group) {
|
||||
return []
|
||||
}
|
||||
return [
|
||||
{ label: '专业金额', value: `${formatAmountText(group.specialtyAmount)} 元` },
|
||||
{ label: '角色合计', value: formatPercentText(group.roleTotal) },
|
||||
{ label: '设计比例', value: formatPercentText(group.designRatio) },
|
||||
{ label: '已配置人数', value: `${group.personCount} 人` }
|
||||
]
|
||||
}
|
||||
|
||||
const currentSpecialtySummaryCards = computed(() =>
|
||||
buildSpecialtySummaryCards(currentSpecialtyGroup.value)
|
||||
)
|
||||
const currentEditSpecialtySummaryCards = computed(() =>
|
||||
buildSpecialtySummaryCards(currentEditSpecialtyGroup.value)
|
||||
)
|
||||
|
||||
const ensureSelectedCode = (codes: string[], target: { value: string }) => {
|
||||
if (!codes.length) {
|
||||
target.value = ''
|
||||
return
|
||||
}
|
||||
if (!codes.includes(target.value)) {
|
||||
target.value = codes[0]
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
specialtyGroups,
|
||||
(groups) => {
|
||||
ensureSelectedCode(
|
||||
groups.map((item) => item.specialtyCode),
|
||||
selectedSpecialtyCode
|
||||
)
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
watch(
|
||||
editSpecialtyGroups,
|
||||
(groups) => {
|
||||
ensureSelectedCode(
|
||||
groups.map((item) => item.specialtyCode),
|
||||
editSpecialtyCode
|
||||
)
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
const addPerson = (row: SpecialtyRoleSplitVO) => {
|
||||
if (!row.persons) {
|
||||
row.persons = []
|
||||
}
|
||||
row.persons.push(buildEditablePerson())
|
||||
syncSpecialtyRows(editRoleList.value, row.specialtyCode)
|
||||
}
|
||||
|
||||
const removePerson = (row: SpecialtyRoleSplitVO, index: number) => {
|
||||
row.persons?.splice(index, 1)
|
||||
syncSpecialtyRows(editRoleList.value, row.specialtyCode)
|
||||
}
|
||||
|
||||
const updatePersonRatio = (
|
||||
row: SpecialtyRoleSplitVO,
|
||||
person: SpecialtyRolePersonVO,
|
||||
value?: number
|
||||
) => {
|
||||
const maxValue = getPersonRatioMax(row, person)
|
||||
const nextValue =
|
||||
value === undefined || value === null ? undefined : Math.min(Math.max(value, 0), maxValue)
|
||||
person.personRatio = fromPercentValue(nextValue) ?? undefined
|
||||
syncSpecialtyRows(editRoleList.value, row.specialtyCode)
|
||||
}
|
||||
|
||||
const updateRoleRatio = (row: SpecialtyRoleSplitVO, value?: number) => {
|
||||
row.roleRatio = fromPercentValue(value) ?? 0
|
||||
syncSpecialtyRows(editRoleList.value, row.specialtyCode)
|
||||
}
|
||||
|
||||
const buildSavePersons = (
|
||||
row: SpecialtyRoleSplitVO
|
||||
):
|
||||
| { persons: SpecialtyRolePersonVO[]; error?: never }
|
||||
| { persons?: never; error: string } => {
|
||||
const persons: SpecialtyRolePersonVO[] = []
|
||||
for (const person of row.persons || []) {
|
||||
const personName = normalizePersonName(person.personName)
|
||||
const hasName = !!personName
|
||||
const hasRatio = person.personRatio !== undefined && person.personRatio !== null
|
||||
if (!hasName && !hasRatio) {
|
||||
continue
|
||||
}
|
||||
if (!hasName || !hasRatio) {
|
||||
return {
|
||||
error: `${row.specialtyName || row.specialtyCode}-${row.roleName || row.roleCode}的人员名称和比例必须同时填写`
|
||||
}
|
||||
}
|
||||
persons.push({
|
||||
personName,
|
||||
personRatio: roundRatio(person.personRatio)
|
||||
})
|
||||
}
|
||||
return { persons }
|
||||
}
|
||||
|
||||
const validateAndBuildSaveItems = () => {
|
||||
const items: SpecialtyRoleSplitApi.SpecialtyRoleSplitSaveItemVO[] = []
|
||||
for (const group of editSpecialtyGroups.value) {
|
||||
let roleTotal = 0
|
||||
for (const row of group.rows) {
|
||||
const result = buildSavePersons(row)
|
||||
if (result.error) {
|
||||
message.warning(result.error)
|
||||
return undefined
|
||||
}
|
||||
const persons = result.persons || []
|
||||
const personTotalRatio = sumPersonRatios(persons)
|
||||
if (personTotalRatio > 1 + EPSILON) {
|
||||
message.warning(
|
||||
`${row.specialtyName || row.specialtyCode}-${row.roleName || row.roleCode}的人员比例合计不能大于 100%`
|
||||
)
|
||||
return undefined
|
||||
}
|
||||
if ((row.roleCode === DESIGN_ROLE_CODE && Number(row.roleAmount || 0) > EPSILON) && persons.length === 0) {
|
||||
message.warning(`${group.specialtyName}的设计角色金额大于 0 时必须至少配置 1 个人员`)
|
||||
return undefined
|
||||
}
|
||||
roleTotal = roundRatio(roleTotal + Number(row.roleRatio || 0))
|
||||
items.push({
|
||||
specialtyCode: row.specialtyCode,
|
||||
roleCode: row.roleCode,
|
||||
roleRatio: roundRatio(row.roleRatio),
|
||||
persons
|
||||
})
|
||||
}
|
||||
if (Math.abs(roleTotal - 1) > EPSILON) {
|
||||
message.warning(`${group.specialtyName}五类角色比例合计必须等于 100%`)
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
return items
|
||||
}
|
||||
|
||||
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 = []
|
||||
editRoleList.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 = []
|
||||
editRoleList.value = []
|
||||
return
|
||||
}
|
||||
planningLoading.value = true
|
||||
try {
|
||||
const list = await PlanningApi.getProjectPlanningListByProjectId(currentProject.value.id)
|
||||
planningList.value = list.filter((item) => isMajorOwnership(item.ownershipType))
|
||||
if (!planningList.value.length) {
|
||||
currentPlanning.value = undefined
|
||||
roleList.value = []
|
||||
editRoleList.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) => {
|
||||
const data = await SpecialtyRoleSplitApi.getSpecialtyRoleSplitListByPlanningId(planningId)
|
||||
roleList.value = cloneRoleRows(data)
|
||||
syncAllDerivedValues(roleList.value)
|
||||
}
|
||||
|
||||
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 = []
|
||||
editRoleList.value = []
|
||||
return
|
||||
}
|
||||
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)
|
||||
syncAllDerivedValues(editRoleList.value)
|
||||
editSpecialtyCode.value = selectedSpecialtyCode.value || specialtyTabOptions.value[0]?.value || ''
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
const handleSave = async () => {
|
||||
if (!currentPlanning.value?.id) {
|
||||
return
|
||||
}
|
||||
const items = validateAndBuildSaveItems()
|
||||
if (!items) {
|
||||
return
|
||||
}
|
||||
saveLoading.value = true
|
||||
try {
|
||||
await SpecialtyRoleSplitApi.saveSpecialtyRoleSplitBatch({
|
||||
planningId: currentPlanning.value.id,
|
||||
items
|
||||
})
|
||||
message.success('保存成功')
|
||||
dialogVisible.value = false
|
||||
await loadRoleList(currentPlanning.value.id)
|
||||
} finally {
|
||||
saveLoading.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,
|
||||
.person-editor {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.person-display-row,
|
||||
.person-row {
|
||||
display: grid;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.person-display-row {
|
||||
grid-template-columns: minmax(120px, 1fr) 100px 120px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.person-display-name {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.person-row {
|
||||
grid-template-columns: minmax(160px, 1fr) 180px 120px 64px;
|
||||
}
|
||||
|
||||
.person-amount {
|
||||
color: var(--el-text-color-regular);
|
||||
text-align: right;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.person-toolbar {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
@media (max-width: 1500px) {
|
||||
.person-row {
|
||||
grid-template-columns: minmax(140px, 1fr) 160px 110px 64px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user