wuzhen 新增财务项目绩效填报模块

This commit is contained in:
wuzhen committed 2025-11-10 15:53:32 +08:00
1 parent 058a4d1cdd
commit 4815b4b3cd
56 files changed
+11914 -8

No files matched your search

+79
View File
@@ -0,0 +1,79 @@
import request from '@/utils/request'
import type { AxiosPromise } from 'axios'
import type { CwProjectPerformanceSelfEvaluationVO, CwProjectPerformanceSelfEvaluationQuery } from './performanceEvaluation'
/**
* 运行监控管理API
* 财务管理员和学校领导使用,用于查看所有人提交的绩效自评,并进行锁定/解锁操作
*/
/**
* 运行监控管理查询对象
*/
export interface MonitoringManagementQuery extends CwProjectPerformanceSelfEvaluationQuery {
isLocked?: number
}
/**
* 查询绩效自评列表(运行监控管理)
*/
export function listMonitoringManagement(query: MonitoringManagementQuery): AxiosPromise<any> {
return request({
url: '/cw/monitoringManagement/list',
method: 'get',
params: query
})
}
/**
* 查询绩效自评详细(运行监控管理)
*/
export function getMonitoringManagement(id: number): AxiosPromise<CwProjectPerformanceSelfEvaluationVO> {
return request({
url: `/cw/monitoringManagement/${id}`,
method: 'get'
})
}
/**
* 锁定绩效自评(单个)
*/
export function lockEvaluation(id: number): AxiosPromise<any> {
return request({
url: `/cw/monitoringManagement/lock/${id}`,
method: 'post'
})
}
/**
* 解锁绩效自评(单个)
*/
export function unlockEvaluation(id: number): AxiosPromise<any> {
return request({
url: `/cw/monitoringManagement/unlock/${id}`,
method: 'post'
})
}
/**
* 批量锁定绩效自评
*/
export function lockBatchEvaluation(ids: number[]): AxiosPromise<any> {
return request({
url: '/cw/monitoringManagement/lock/batch',
method: 'post',
data: ids
})
}
/**
* 批量解锁绩效自评
*/
export function unlockBatchEvaluation(ids: number[]): AxiosPromise<any> {
return request({
url: '/cw/monitoringManagement/unlock/batch',
method: 'post',
data: ids
})
}
+629
View File
@@ -0,0 +1,629 @@
import request from '@/utils/request'
import type { AxiosPromise } from 'axios'
// ========== 绩效自评API ==========
/**
* 项目绩效自评视图对象
*/
export interface CwProjectPerformanceSelfEvaluationVO {
id?: number
tenantId?: string
projectApplicationId: number
applicationNo: string
projectName: string
supervisoryDept?: string
implementUnit?: string
evaluationYear: number
initialBudget?: number
principal?: string
contactPhone?: string
startDate?: string
endDate?: string
totalInvestment?: number
annualBudget?: number
actualExpenditure?: number
budgetExecutionRate?: number
// 资金到位(年度资金总额)
fundValue?: number
fundExecutionRate?: number
fundScore?: number
// 当年财政拨款
currentYearBudgetInitial?: number
currentYearBudgetAnnual?: number
currentYearBudgetActual?: number
currentYearBudgetValue?: number
currentYearBudgetExecutionRate?: number
currentYearBudgetScore?: number
// 上年结转资金
lastYearCarryoverInitial?: number
lastYearCarryoverAnnual?: number
lastYearCarryoverActual?: number
lastYearCarryoverValue?: number
lastYearCarryoverExecutionRate?: number
lastYearCarryoverScore?: number
// 其他资金
otherFundsInitial?: number
otherFundsAnnual?: number
otherFundsActual?: number
otherFundsValue?: number
otherFundsExecutionRate?: number
otherFundsScore?: number
performanceGoal?: string
targetCompletion?: string
// 数量指标
quantityIndicator?: string
quantityTarget?: string
quantityActual?: string
quantityValue?: number
quantityScore?: number
quantityDeviation?: string
// 质量指标
qualityIndicator?: string
qualityTarget?: string
qualityActual?: string
qualityValue?: number
qualityScore?: number
qualityDeviation?: string
// 时效指标
timelinessIndicator?: string
timelinessTarget?: string
timelinessActual?: string
timelinessValue?: number
timelinessScore?: number
timelinessDeviation?: string
// 成本指标
costIndicator?: string
costTarget?: string
costActual?: string
costValue?: number
costScore?: number
costDeviation?: string
// 经济效益指标
economicIndicator?: string
economicTarget?: string
economicActual?: string
economicValue?: number
economicScore?: number
economicDeviation?: string
// 社会效益指标
socialIndicator?: string
socialTarget?: string
socialActual?: string
socialValue?: number
socialScore?: number
socialDeviation?: string
// 生态效益指标
ecologicalIndicator?: string
ecologicalTarget?: string
ecologicalActual?: string
ecologicalValue?: number
ecologicalScore?: number
ecologicalDeviation?: string
// 满意度指标
satisfactionIndicator?: string
satisfactionTarget?: string
satisfactionActual?: string
satisfactionValue?: number
satisfactionScore?: number
satisfactionDeviation?: string
decisionScore?: number
decisionContent?: string
processScore?: number
processContent?: string
outputScore?: number
outputContent?: string
benefitScore?: number
benefitContent?: string
totalScore?: number
selfEvaluationLevel?: string
existingProblems?: string
improvementMeasures?: string
evaluationStatus: string
allowEditAfterSubmit?: number
submitTime?: string
submitBy?: number
submitByName?: string
approveTime?: string
approveBy?: number
approveByName?: string
approveOpinion?: string
remark?: string
// 锁定相关字段
isLocked?: number
lockTime?: string
lockBy?: number
lockByName?: string
createTime?: string
updateTime?: string
// 前端使用的字段,用于标记是否有运行监控数据
hasMonitoringData?: boolean
// 运行监控数据列表
monitoringList?: CwPerformanceMonitoringVO[]
}
/**
* 项目绩效自评表单对象
*/
export interface CwProjectPerformanceSelfEvaluationForm {
id?: number
projectApplicationId: number
applicationNo?: string
projectName: string
supervisoryDept?: string
implementUnit?: string
evaluationYear: number
initialBudget?: number
principal?: string
contactPhone?: string
startDate?: string
endDate?: string
totalInvestment?: number
annualBudget?: number
actualExpenditure?: number
budgetExecutionRate?: number
// 资金到位(年度资金总额)
fundValue?: number
fundExecutionRate?: number
fundScore?: number
// 当年财政拨款
currentYearBudgetInitial?: number
currentYearBudgetAnnual?: number
currentYearBudgetActual?: number
currentYearBudgetValue?: number
currentYearBudgetExecutionRate?: number
currentYearBudgetScore?: number
// 上年结转资金
lastYearCarryoverInitial?: number
lastYearCarryoverAnnual?: number
lastYearCarryoverActual?: number
lastYearCarryoverValue?: number
lastYearCarryoverExecutionRate?: number
lastYearCarryoverScore?: number
// 其他资金
otherFundsInitial?: number
otherFundsAnnual?: number
otherFundsActual?: number
otherFundsValue?: number
otherFundsExecutionRate?: number
otherFundsScore?: number
performanceGoal?: string
targetCompletion?: string
// 数量指标
quantityIndicator?: string
quantityTarget?: string
quantityActual?: string
quantityValue?: number
quantityScore?: number
quantityDeviation?: string
// 质量指标
qualityIndicator?: string
qualityTarget?: string
qualityActual?: string
qualityValue?: number
qualityScore?: number
qualityDeviation?: string
// 时效指标
timelinessIndicator?: string
timelinessTarget?: string
timelinessActual?: string
timelinessValue?: number
timelinessScore?: number
timelinessDeviation?: string
// 成本指标
costIndicator?: string
costTarget?: string
costActual?: string
costValue?: number
costScore?: number
costDeviation?: string
// 经济效益指标
economicIndicator?: string
economicTarget?: string
economicActual?: string
economicValue?: number
economicScore?: number
economicDeviation?: string
// 社会效益指标
socialIndicator?: string
socialTarget?: string
socialActual?: string
socialValue?: number
socialScore?: number
socialDeviation?: string
// 生态效益指标
ecologicalIndicator?: string
ecologicalTarget?: string
ecologicalActual?: string
ecologicalValue?: number
ecologicalScore?: number
ecologicalDeviation?: string
// 满意度指标
satisfactionIndicator?: string
satisfactionTarget?: string
satisfactionActual?: string
satisfactionValue?: number
satisfactionScore?: number
satisfactionDeviation?: string
decisionScore?: number
decisionContent?: string
processScore?: number
processContent?: string
outputScore?: number
outputContent?: string
benefitScore?: number
benefitContent?: string
totalScore?: number
selfEvaluationLevel?: string
existingProblems?: string
improvementMeasures?: string
evaluationStatus?: string
remark?: string
}
/**
* 项目绩效自评查询对象
*/
export interface CwProjectPerformanceSelfEvaluationQuery {
pageNum?: number
pageSize?: number
projectApplicationId?: number
applicationNo?: string
projectName?: string
evaluationYear?: number
evaluationStatus?: string
selfEvaluationLevel?: string
}
/**
* 查询项目绩效自评列表
*/
export function listEvaluation(query: CwProjectPerformanceSelfEvaluationQuery): AxiosPromise<any> {
return request({
url: '/cw/evaluation/list',
method: 'get',
params: query
})
}
/**
* 查询项目绩效自评详细
*/
export function getEvaluation(id: number): AxiosPromise<CwProjectPerformanceSelfEvaluationVO> {
return request({
url: `/cw/evaluation/${id}`,
method: 'get'
})
}
/**
* 新增项目绩效自评
*/
export function addEvaluation(data: CwProjectPerformanceSelfEvaluationForm): AxiosPromise<any> {
return request({
url: '/cw/evaluation',
method: 'post',
data
})
}
/**
* 修改项目绩效自评
*/
export function updateEvaluation(data: CwProjectPerformanceSelfEvaluationForm): AxiosPromise<any> {
return request({
url: '/cw/evaluation',
method: 'put',
data
})
}
/**
* 保存自评草稿
*/
export function saveDraft(data: CwProjectPerformanceSelfEvaluationForm): AxiosPromise<any> {
return request({
url: '/cw/evaluation/saveDraft',
method: 'post',
data
})
}
/**
* 提交自评
*/
export function submitEvaluation(id: number): AxiosPromise<any> {
return request({
url: `/cw/evaluation/submit/${id}`,
method: 'post'
})
}
/**
* 审核自评
*/
export function approveEvaluation(id: number, opinion: string, approved: boolean): AxiosPromise<any> {
return request({
url: `/cw/evaluation/approve/${id}`,
method: 'post',
params: { opinion, approved }
})
}
/**
* 删除项目绩效自评
*/
export function delEvaluation(ids: number | number[]): AxiosPromise<any> {
return request({
url: `/cw/evaluation/${ids}`,
method: 'delete'
})
}
/**
* 查询我的自评列表
*/
export function getMyEvaluations(): AxiosPromise<CwProjectPerformanceSelfEvaluationVO[]> {
return request({
url: '/cw/evaluation/my',
method: 'get'
})
}
/**
* 查询待审核自评列表
*/
export function getPendingApprovals(): AxiosPromise<CwProjectPerformanceSelfEvaluationVO[]> {
return request({
url: '/cw/evaluation/pending',
method: 'get'
})
}
/**
* 导出项目绩效自评
*/
export function exportEvaluation(query: CwProjectPerformanceSelfEvaluationQuery): AxiosPromise<any> {
return request({
url: '/cw/evaluation/export',
method: 'post',
data: query,
responseType: 'blob'
})
}
// ========== 月度运行监控API ==========
/**
* 项目月度运行监控视图对象
*/
export interface CwProjectMonthlyMonitoringVO {
id?: number
evaluationId: number
projectApplicationId: number
monitoringYear: number
monitoringMonth: number
plannedProgress?: number
actualProgress?: number
progressVariance?: number
monthlyBudget?: number
monthlyExpenditure?: number
cumulativeBudget?: number
cumulativeExpenditure?: number
fundExecutionRate?: number
keyMilestones?: string
milestoneCompletion?: string
problemsEncountered?: string
riskDescription?: string
countermeasures?: string
nextMonthPlan?: string
fillStatus: string
fillTime?: string
fillBy?: number
fillByName?: string
remark?: string
createTime?: string
updateTime?: string
}
/**
* 项目月度运行监控表单对象
*/
export interface CwProjectMonthlyMonitoringForm {
id?: number
evaluationId: number
projectApplicationId: number
monitoringYear: number
monitoringMonth: number
plannedProgress?: number
actualProgress?: number
progressVariance?: number
monthlyBudget?: number
monthlyExpenditure?: number
cumulativeBudget?: number
cumulativeExpenditure?: number
fundExecutionRate?: number
keyMilestones?: string
milestoneCompletion?: string
problemsEncountered?: string
riskDescription?: string
countermeasures?: string
nextMonthPlan?: string
fillStatus?: string
remark?: string
}
/**
* 查询某个自评的全年监控数据
*/
export function getYearlyMonitoring(evaluationId: number, year: number): AxiosPromise<Record<number, CwProjectMonthlyMonitoringVO>> {
return request({
url: `/cw/monitoring/year/${evaluationId}/${year}`,
method: 'get'
})
}
/**
* 根据自评ID查询月度监控列表
*/
export function getMonitoringByEvaluationId(evaluationId: number): AxiosPromise<CwProjectMonthlyMonitoringVO[]> {
return request({
url: `/cw/monitoring/evaluation/${evaluationId}`,
method: 'get'
})
}
/**
* 填报月度数据
*/
export function fillMonthlyData(data: CwProjectMonthlyMonitoringForm): AxiosPromise<any> {
return request({
url: '/cw/monitoring/fill',
method: 'post',
data
})
}
/**
* 批量保存月度数据
*/
export function batchSaveMonitoring(evaluationId: number, list: CwProjectMonthlyMonitoringForm[]): AxiosPromise<any> {
return request({
url: '/cw/monitoring/batch',
method: 'post',
data: {
evaluationId,
list
}
})
}
/**
* 修改月度监控
*/
export function updateMonitoring(data: CwProjectMonthlyMonitoringForm): AxiosPromise<any> {
return request({
url: '/cw/monitoring',
method: 'put',
data
})
}
// ========== 绩效运行监控API ==========
/**
* 绩效运行监控视图对象
*/
export interface CwPerformanceMonitoringVO {
id?: number
evaluationId: number
monitoringPeriod: string
fundUsage: string
performanceTargetCompletion: string
indicators?: string // JSON字符串,存储指标数组
existingProblems?: string
indicatorVarianceAnalysis?: string
nextStepSuggestions?: string
fillBy?: number
fillByName?: string
createTime?: string
updateTime?: string
}
/**
* 绩效运行监控表单数据结构
*/
export interface PerformanceMonitoringForm {
id?: number
evaluationId: number
monitoringPeriod: string
fundUsage: string
performanceTargetCompletion: string
indicators: string // JSON字符串,存储指标数组
existingProblems?: string
indicatorVarianceAnalysis?: string
nextStepSuggestions?: string
fillByName?: string
createTime?: string
}
/**
* 查询绩效运行监控列表
*/
export function listPerformanceMonitoring(evaluationId: number): AxiosPromise<PerformanceMonitoringForm[]> {
return request({
url: `/cw/performanceMonitoring/list/${evaluationId}`,
method: 'get'
})
}
/**
* 获取绩效运行监控详情
*/
export function getPerformanceMonitoring(id: number): AxiosPromise<PerformanceMonitoringForm> {
return request({
url: `/cw/performanceMonitoring/${id}`,
method: 'get'
})
}
/**
* 新增绩效运行监控
*/
export function addPerformanceMonitoring(data: PerformanceMonitoringForm): AxiosPromise<any> {
return request({
url: '/cw/performanceMonitoring',
method: 'post',
data
})
}
/**
* 修改绩效运行监控
*/
export function updatePerformanceMonitoring(data: PerformanceMonitoringForm): AxiosPromise<any> {
return request({
url: '/cw/performanceMonitoring',
method: 'put',
data
})
}
/**
* 删除绩效运行监控
*/
export function delPerformanceMonitoring(id: number): AxiosPromise<any> {
return request({
url: `/cw/performanceMonitoring/${id}`,
method: 'delete'
})
}
+202
View File
@@ -0,0 +1,202 @@
/* 社团管理通用样式 - 参考后勤管理模块 */
/* 页面容器 */
.page-container {
height: 100%;
display: flex;
flex-direction: column;
}
/* 搜索按钮容器 */
.search-btn-container {
display: flex;
justify-content: flex-end;
padding-top: 10px;
}
/* 卡片样式 */
.button-card,
.table-card {
border-radius: 8px;
border: 1px solid #e4e7ed;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
margin-bottom: 16px;
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
}
}
.button-card {
:deep(.el-card__body) {
padding: 16px !important;
}
}
.table-card {
:deep(.el-card__body) {
padding: 0 !important;
}
}
/* 表格容器 */
.table-container {
width: 100%;
}
/* 表格样式 */
.scroll-table {
:deep(.el-table__header-wrapper) {
.el-table__header {
th {
background-color: #f8f9fa;
color: #333;
font-weight: 600;
}
}
}
:deep(.el-table__body-wrapper) {
.el-table__row {
&:hover {
background-color: #f5f7fa;
}
}
}
}
/* 统计卡片样式 */
.stat-card {
border-radius: 8px;
transition: all 0.3s ease;
height: 90px;
&:hover {
transform: translateY(-2px);
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}
.stat-content {
display: flex;
align-items: center;
padding: 5px 12px;
height: 100%;
box-sizing: border-box;
.stat-icon {
font-size: 24px;
margin-right: 12px;
opacity: 0.8;
}
.stat-info {
flex: 1;
.stat-value {
font-size: 20px;
font-weight: bold;
line-height: 1;
margin-bottom: 3px;
}
.stat-label {
font-size: 13px;
opacity: 0.7;
line-height: 1;
}
}
}
&.stat-card-primary {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
}
&.stat-card-success {
background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
color: white;
}
&.stat-card-warning {
background: linear-gradient(135deg, #ff9a56 0%, #ffad56 100%);
color: white;
}
&.stat-card-info {
background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
color: #333;
}
}
/* 分页容器样式 */
.pagination-container {
display: flex;
justify-content: flex-end;
padding: 16px 20px 0 0 !important;
background-color: #fff;
margin-top: 0px !important;
}
/* 移除按钮栏底部边框 */
.button-card :deep(.el-card__header) {
border-bottom: none !important;
}
/* 工具栏标题样式 */
.toolbar-title {
font-size: 16px;
font-weight: 600;
color: #303133;
line-height: 32px;
}
/* 操作按钮样式 */
.action-buttons {
display: flex;
gap: 8px;
justify-content: center;
align-items: center;
white-space: nowrap;
}
/* 确保操作按钮宽度一致 */
.action-buttons .el-button {
width: 27px !important;
height: 27px !important;
padding: 0 !important;
display: flex;
align-items: center;
justify-content: center;
}
/* 对话框样式 */
.dialog-footer-right {
display: flex;
justify-content: flex-end;
gap: 10px;
}
/* 信息框样式 */
.info-box {
width: 100%;
box-sizing: border-box;
background-color: #f8f9fa;
padding: 16px;
border-radius: 8px;
border-left: 4px solid #409eff;
p {
margin: 8px 0;
line-height: 1.5;
&:first-child {
margin-top: 0;
}
&:last-child {
margin-bottom: 0;
}
}
}
@@ -0,0 +1,668 @@
<template>
<el-dialog
v-model="dialogVisible"
:title="dialogTitle"
width="95%"
top="5vh"
:close-on-click-modal="false"
destroy-on-close
>
<!-- 运行监控数据列表 -->
<div class="monitoring-list" v-if="!showForm">
<div class="list-header">
<el-button
type="primary"
icon="Plus"
@click="handleAdd"
v-hasPermi="['cw:monitoring:fill']"
>新增运行监控</el-button>
</div>
<el-table
:data="monitoringList"
border
style="width: 100%; margin-top: 15px;"
>
<el-table-column label="序号" type="index" width="60" align="center" />
<el-table-column label="监控周期" align="center" prop="monitoringPeriod" width="150" />
<el-table-column label="填报时间" align="center" prop="createTime" width="160" />
<el-table-column label="填报人" align="center" prop="fillByName" width="120" />
<el-table-column label="资金使用情况" align="center" prop="fundUsage" show-overflow-tooltip min-width="200" />
<el-table-column label="操作" align="center" width="200" fixed="right">
<template #default="scope">
<el-button
link
type="primary"
icon="View"
@click="handleView(scope.row)"
>查看</el-button>
<el-button
link
type="primary"
icon="Edit"
@click="handleEdit(scope.row)"
v-hasPermi="['cw:monitoring:edit']"
>编辑</el-button>
<el-button
link
type="danger"
icon="Delete"
@click="handleDelete(scope.row)"
v-hasPermi="['cw:monitoring:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
<!-- 运行监控表单 -->
<div class="monitoring-form" v-else>
<el-form
ref="monitoringFormRef"
:model="formData"
:rules="rules"
label-width="150px"
:disabled="formMode === 'view'"
>
<!-- 项目基本信息 -->
<div class="table-section">
<div class="section-title">
<h3>绩效运行监控表(20**年度 1-6 月)</h3>
</div>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="项目名称">
<el-input v-model="projectInfo.projectName" disabled />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="项目性质">
<el-input v-model="projectInfo.projectNature" disabled />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="监控周期" prop="monitoringPeriod">
<div style="display: flex; align-items: center; gap: 10px;">
<el-select
v-model="formData.startMonth"
placeholder="起始月份"
style="width: 120px"
@change="updateMonitoringPeriod"
>
<el-option
v-for="month in 12"
:key="month"
:label="`${month}月`"
:value="month"
/>
</el-select>
<span>至</span>
<el-select
v-model="formData.endMonth"
placeholder="结束月份"
style="width: 120px"
@change="updateMonitoringPeriod"
>
<el-option
v-for="month in 12"
:key="month"
:label="`${month}月`"
:value="month"
/>
</el-select>
<span style="color: #909399; margin-left: 10px;">
{{ formData.monitoringPeriod || '请选择监控周期' }}
</span>
</div>
</el-form-item>
</el-col>
</el-row>
</div>
<!-- 项目概况 -->
<div class="table-section">
<div class="section-title">
<h4>项目概况</h4>
</div>
<el-form-item label="资金使用情况" prop="fundUsage">
<el-input
v-model="formData.fundUsage"
type="textarea"
:rows="3"
placeholder="请描述资金使用情况"
/>
</el-form-item>
<el-form-item label="绩效目标完成情况" prop="performanceTargetCompletion">
<el-input
v-model="formData.performanceTargetCompletion"
type="textarea"
:rows="3"
placeholder="请描述绩效目标完成情况"
/>
</el-form-item>
</div>
<!-- 绩效指标完成情况 -->
<div class="table-section">
<div class="section-title">
<h4>绩效指标完成情况</h4>
</div>
<div class="indicator-table">
<el-button
type="primary"
icon="Plus"
size="small"
@click="addIndicatorRow"
v-if="formMode !== 'view'"
style="margin-bottom: 10px"
>添加指标</el-button>
<el-table
:data="formData.indicators"
border
style="width: 100%"
max-height="400"
>
<el-table-column label="一级指标" align="center" width="120">
<template #default="scope">
<el-select
v-model="scope.row.level1Indicator"
placeholder="请选择"
style="width: 100%"
>
<el-option label="产出指标" value="产出指标" />
<el-option label="效益指标" value="效益指标" />
<el-option label="满意度指标" value="满意度指标" />
</el-select>
</template>
</el-table-column>
<el-table-column label="二级指标" align="center" width="120">
<template #default="scope">
<el-select
v-model="scope.row.level2Indicator"
placeholder="请选择"
style="width: 100%"
>
<template v-if="scope.row.level1Indicator === '产出指标'">
<el-option label="数量指标" value="数量指标" />
<el-option label="质量指标" value="质量指标" />
<el-option label="时效指标" value="时效指标" />
<el-option label="成本指标" value="成本指标" />
</template>
<template v-else-if="scope.row.level1Indicator === '效益指标'">
<el-option label="经济效益指标" value="经济效益指标" />
<el-option label="社会效益指标" value="社会效益指标" />
<el-option label="生态效益指标" value="生态效益指标" />
<el-option label="可持续性指标" value="可持续性指标" />
</template>
<template v-else-if="scope.row.level1Indicator === '满意度指标'">
<el-option label="服务对象满意度指标" value="服务对象满意度指标" />
</template>
</el-select>
</template>
</el-table-column>
<el-table-column label="指标名称" align="center" min-width="150">
<template #default="scope">
<el-input v-model="scope.row.indicatorName" placeholder="请输入" />
</template>
</el-table-column>
<el-table-column label="年度预期值" align="center" width="120">
<template #default="scope">
<el-input v-model="scope.row.annualExpectedValue" placeholder="请输入" />
</template>
</el-table-column>
<el-table-column :label="completedValueLabel" align="center" width="130">
<template #default="scope">
<el-input v-model="scope.row.completedValue" placeholder="请输入" />
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="80" v-if="formMode !== 'view'">
<template #default="scope">
<el-button
link
type="danger"
icon="Delete"
@click="removeIndicatorRow(scope.$index)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
<!-- 绩效运行分析 -->
<div class="table-section">
<div class="section-title">
<h4>绩效运行分析</h4>
</div>
<el-form-item label="存在问题">
<el-input
v-model="formData.existingProblems"
type="textarea"
:rows="3"
placeholder="请输入存在的问题"
/>
</el-form-item>
<el-form-item label="指标差异率分析">
<el-input
v-model="formData.indicatorVarianceAnalysis"
type="textarea"
:rows="3"
placeholder="请输入指标差异率分析和说明"
/>
</el-form-item>
<el-form-item label="下一步工作建议">
<el-input
v-model="formData.nextStepSuggestions"
type="textarea"
:rows="3"
placeholder="请输入下一步工作建议和打算"
/>
</el-form-item>
</div>
</el-form>
<!-- 表单操作按钮 -->
<div class="form-footer" v-if="formMode !== 'view'">
<el-button @click="cancelForm">取消</el-button>
<el-button type="primary" @click="submitForm">保存</el-button>
</div>
<div class="form-footer" v-else>
<el-button @click="cancelForm">关闭</el-button>
</div>
</div>
<template #footer v-if="!showForm">
<el-button @click="closeDialog">关闭</el-button>
</template>
</el-dialog>
</template>
<script setup lang="ts" name="MonitoringDialog">
import { ref, reactive, computed, getCurrentInstance, ComponentInternalInstance } from 'vue'
import type { FormInstance, FormRules } from 'element-plus'
import { getEvaluation, listPerformanceMonitoring, getPerformanceMonitoring, addPerformanceMonitoring, updatePerformanceMonitoring, delPerformanceMonitoring } from '@/api/cw/performanceEvaluation'
import type { PerformanceMonitoringForm } from '@/api/cw/performanceEvaluation'
const { proxy } = getCurrentInstance() as ComponentInternalInstance
// ========== 对话框状态 ==========
const dialogVisible = ref(false)
const dialogTitle = ref('运行监控管理')
const showForm = ref(false)
const formMode = ref<'add' | 'edit' | 'view'>('add')
// ========== 项目信息 ==========
const projectInfo = ref({
projectName: '',
projectNature: '',
evaluationId: 0
})
// ========== 监控数据列表 ==========
const monitoringList = ref<any[]>([])
// ========== 表单数据 ==========
interface IndicatorRow {
level1Indicator: string
level2Indicator: string
indicatorName: string
annualExpectedValue: string
completedValue: string
}
interface MonitoringFormData {
id?: number
evaluationId?: number
startMonth?: number
endMonth?: number
monitoringPeriod: string
fundUsage: string
performanceTargetCompletion: string
indicators: IndicatorRow[]
existingProblems: string
indicatorVarianceAnalysis: string
nextStepSuggestions: string
}
const defaultFormData: MonitoringFormData = {
startMonth: undefined,
endMonth: undefined,
monitoringPeriod: '',
fundUsage: '',
performanceTargetCompletion: '',
indicators: [],
existingProblems: '',
indicatorVarianceAnalysis: '',
nextStepSuggestions: ''
}
const formData = ref<MonitoringFormData>({ ...defaultFormData })
const monitoringFormRef = ref<FormInstance>()
// ========== 表单验证规则 ==========
const rules = reactive<FormRules>({
monitoringPeriod: [
{ required: true, message: '请输入监控周期', trigger: 'blur' }
],
fundUsage: [
{ required: true, message: '请输入资金使用情况', trigger: 'blur' }
],
performanceTargetCompletion: [
{ required: true, message: '请输入绩效目标完成情况', trigger: 'blur' }
]
})
// ========== 计算属性 ==========
/** 完成值列标题 */
const completedValueLabel = computed(() => {
if (formData.value.startMonth && formData.value.endMonth) {
return `${formData.value.startMonth}至${formData.value.endMonth}月份完成值`
}
return '完成值'
})
// ========== 监控周期相关方法 ==========
/** 更新监控周期 */
function updateMonitoringPeriod() {
const currentYear = new Date().getFullYear()
if (formData.value.startMonth && formData.value.endMonth) {
formData.value.monitoringPeriod = `${currentYear}年度${formData.value.startMonth}-${formData.value.endMonth}月`
} else {
formData.value.monitoringPeriod = ''
}
}
/** 从监控周期字符串解析起止月份 */
function parseMonitoringPeriod(period: string) {
if (!period) return
// 匹配格式:2024年度1-6月
const match = period.match(/(\d+)年度(\d+)-(\d+)月/)
if (match) {
formData.value.startMonth = parseInt(match[2])
formData.value.endMonth = parseInt(match[3])
}
}
// ========== 指标表格操作 ==========
/** 添加指标行 */
function addIndicatorRow() {
formData.value.indicators.push({
level1Indicator: '',
level2Indicator: '',
indicatorName: '',
annualExpectedValue: '',
completedValue: ''
})
}
/** 删除指标行 */
function removeIndicatorRow(index: number) {
formData.value.indicators.splice(index, 1)
}
// ========== 对外暴露方法 ==========
/** 打开对话框 */
async function open(evaluationId: number) {
dialogVisible.value = true
showForm.value = false
// 加载项目信息
const response = await getEvaluation(evaluationId)
projectInfo.value = {
projectName: response.data.projectName || '',
projectNature: response.data.projectNature || '',
evaluationId: evaluationId
}
// 加载运行监控数据列表
loadMonitoringList(evaluationId)
}
/** 加载监控数据列表 */
async function loadMonitoringList(evaluationId: number) {
try {
const response = await listPerformanceMonitoring(evaluationId)
monitoringList.value = response.data.map((item: PerformanceMonitoringForm) => {
// 解析JSON字符串为对象
return {
...item,
indicators: item.indicators ? JSON.parse(item.indicators) : []
}
})
} catch (error) {
console.error('加载运行监控数据失败:', error)
monitoringList.value = []
}
}
/** 新增运行监控 */
function handleAdd() {
formMode.value = 'add'
formData.value = {
...defaultFormData,
evaluationId: projectInfo.value.evaluationId,
indicators: []
}
showForm.value = true
}
/** 编辑运行监控 */
function handleEdit(row: any) {
formMode.value = 'edit'
formData.value = { ...row }
if (!formData.value.indicators || !Array.isArray(formData.value.indicators)) {
formData.value.indicators = []
}
// 解析监控周期,回显起止月份
parseMonitoringPeriod(formData.value.monitoringPeriod)
showForm.value = true
}
/** 查看运行监控 */
function handleView(row: any) {
formMode.value = 'view'
formData.value = { ...row }
if (!formData.value.indicators || !Array.isArray(formData.value.indicators)) {
formData.value.indicators = []
}
// 解析监控周期,回显起止月份
parseMonitoringPeriod(formData.value.monitoringPeriod)
showForm.value = true
}
/** 删除运行监控 */
function handleDelete(row: any) {
proxy?.$modal.confirm('确认删除该运行监控数据吗?').then(async () => {
try {
await delPerformanceMonitoring(row.id)
proxy?.$modal.msgSuccess('删除成功')
loadMonitoringList(projectInfo.value.evaluationId)
} catch (error) {
console.error('删除失败:', error)
}
}).catch(() => {})
}
/** 提交表单 */
function submitForm() {
monitoringFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
try {
// 准备提交数据,将indicators数组转换为JSON字符串
const data: PerformanceMonitoringForm = {
...formData.value,
evaluationId: projectInfo.value.evaluationId,
indicators: JSON.stringify(formData.value.indicators)
}
if (formMode.value === 'add') {
await addPerformanceMonitoring(data)
proxy?.$modal.msgSuccess('新增成功')
} else {
await updatePerformanceMonitoring(data)
proxy?.$modal.msgSuccess('修改成功')
}
cancelForm()
loadMonitoringList(projectInfo.value.evaluationId)
} catch (error) {
console.error('保存失败:', error)
}
}
})
}
/** 取消表单 */
function cancelForm() {
showForm.value = false
formData.value = { ...defaultFormData }
}
/** 关闭对话框 */
function closeDialog() {
dialogVisible.value = false
}
/** 查看单条运行监控数据详情 */
async function viewDetail(monitoringId: number, evaluationId: number) {
dialogVisible.value = true
showForm.value = true
formMode.value = 'view'
// 加载项目信息
const response = await getEvaluation(evaluationId)
projectInfo.value = {
projectName: response.data.projectName || '',
projectNature: response.data.projectNature || '',
evaluationId: evaluationId
}
// 加载运行监控数据详情
try {
const monitoringResponse = await getPerformanceMonitoring(monitoringId)
const data = monitoringResponse.data
formData.value = { ...data }
// 处理indicators字段:如果是JSON字符串,需要解析为数组
if (data.indicators) {
if (typeof data.indicators === 'string') {
try {
formData.value.indicators = JSON.parse(data.indicators)
} catch (e) {
console.error('解析indicators失败:', e)
formData.value.indicators = []
}
} else if (Array.isArray(data.indicators)) {
formData.value.indicators = data.indicators
} else {
formData.value.indicators = []
}
} else {
formData.value.indicators = []
}
// 解析监控周期,回显起止月份
parseMonitoringPeriod(formData.value.monitoringPeriod)
} catch (error) {
console.error('加载运行监控详情失败:', error)
proxy?.$modal.msgError('加载运行监控详情失败')
}
}
// 暴露方法给父组件
defineExpose({
open,
viewDetail
})
</script>
<style scoped lang="scss">
.monitoring-list {
padding: 10px;
.list-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 15px;
}
}
.monitoring-form {
max-height: 70vh;
overflow-y: auto;
padding: 20px;
}
.table-section {
margin-bottom: 30px;
border: 1px solid #dcdfe6;
border-radius: 4px;
padding: 20px;
background-color: #f9f9f9;
.section-title {
margin-bottom: 20px;
padding-bottom: 10px;
border-bottom: 2px solid #409eff;
h3 {
margin: 0;
font-size: 18px;
font-weight: bold;
color: #303133;
text-align: center;
}
h4 {
margin: 0;
font-size: 16px;
font-weight: bold;
color: #606266;
}
}
}
.indicator-table {
margin-top: 15px;
}
.form-footer {
display: flex;
justify-content: center;
gap: 20px;
margin-top: 30px;
padding-top: 20px;
border-top: 1px solid #dcdfe6;
}
:deep(.el-form-item__label) {
font-weight: 500;
}
:deep(.el-table) {
font-size: 14px;
}
:deep(.el-input__inner) {
font-size: 14px;
}
</style>
+1000
View File
@@ -0,0 +1,1000 @@
<template>
<div class="p-2 page-container">
<!-- 搜索区域 -->
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form :model="queryParams" ref="queryFormRef" label-width="100px">
<el-row :gutter="20">
<el-col :span="6">
<el-form-item label="项目名称" prop="projectName">
<el-input v-model="queryParams.projectName" placeholder="请输入项目名称" clearable @keyup.enter="handleQuery" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="自评年度" prop="evaluationYear">
<el-date-picker v-model="queryParams.evaluationYear" type="year" placeholder="选择年度" clearable value-format="YYYY" style="width: 100%" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="自评状态" prop="evaluationStatus">
<el-select v-model="queryParams.evaluationStatus" placeholder="请选择自评状态" clearable style="width: 100%">
<el-option label="草稿" value="draft" />
<el-option label="已提交" value="submitted" />
<el-option label="已审核" value="approved" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="自评等级" prop="selfEvaluationLevel">
<el-select v-model="queryParams.selfEvaluationLevel" placeholder="请选择自评等级" clearable style="width: 100%">
<el-option label="优秀" value="优秀" />
<el-option label="良好" value="良好" />
<el-option label="合格" value="合格" />
<el-option label="不合格" value="不合格" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="24">
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
</div>
</transition>
<!-- 表格区域 -->
<el-card shadow="never" class="button-card table-card">
<template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['cw:evaluation:add']">新增自评</el-button>
</el-col>
<el-col :span="1.5">
<el-button icon="Download" @click="handleExport" v-hasPermi="['cw:evaluation:export']">导出</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
</template>
<div class="table-container">
<el-table
v-loading="loading"
border
:data="evaluationList"
@selection-change="handleSelectionChange"
style="width: 100%"
class="scroll-table"
>
<el-table-column type="selection" width="55" align="center" fixed="left" />
<el-table-column label="项目名称" align="center" prop="projectName" show-overflow-tooltip min-width="200" />
<el-table-column label="申报编号" align="center" prop="applicationNo" width="150" />
<el-table-column label="自评年度" align="center" prop="evaluationYear" width="100" />
<el-table-column label="自评总分" align="center" prop="totalScore" width="100">
<template #default="scope">
<el-tag v-if="scope.row.totalScore >= 90" type="success" size="small">{{ scope.row.totalScore }}</el-tag>
<el-tag v-else-if="scope.row.totalScore >= 80" type="primary" size="small">{{ scope.row.totalScore }}</el-tag>
<el-tag v-else-if="scope.row.totalScore >= 60" type="warning" size="small">{{ scope.row.totalScore }}</el-tag>
<el-tag v-else-if="scope.row.totalScore" type="danger" size="small">{{ scope.row.totalScore }}</el-tag>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="自评等级" align="center" prop="selfEvaluationLevel" width="100">
<template #default="scope">
<el-tag v-if="scope.row.selfEvaluationLevel === '优秀'" type="success" size="small">优秀</el-tag>
<el-tag v-else-if="scope.row.selfEvaluationLevel === '良好'" type="primary" size="small">良好</el-tag>
<el-tag v-else-if="scope.row.selfEvaluationLevel === '合格'" type="warning" size="small">合格</el-tag>
<el-tag v-else-if="scope.row.selfEvaluationLevel === '不合格'" type="danger" size="small">不合格</el-tag>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="自评状态" align="center" prop="evaluationStatus" width="100">
<template #default="scope">
<dict-tag :options="cw_evaluation_status" :value="scope.row.evaluationStatus" />
</template>
</el-table-column>
<el-table-column label="锁定状态" align="center" prop="isLocked" width="120">
<template #default="scope">
<el-tag v-if="scope.row.isLocked === 1" type="warning" effect="dark" size="small">
<el-icon><Lock /></el-icon> 已锁定
</el-tag>
<el-tag v-else type="success" effect="plain" size="small">未锁定</el-tag>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template #default="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="320" fixed="right" class-name="small-padding fixed-width">
<template #default="scope">
<el-button link type="primary" icon="View" @click="handleView(scope.row)" v-hasPermi="['cw:evaluation:query']"></el-button>
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['cw:evaluation:edit']" :disabled="scope.row.isLocked === 1"></el-button>
<el-button link type="warning" icon="Monitor" @click="handleMonitoring(scope.row)" v-hasPermi="['cw:monitoring:query']"></el-button>
<el-button link type="success" icon="Check" @click="handleSubmit(scope.row)" v-hasPermi="['cw:evaluation:submit']" v-if="scope.row.evaluationStatus === 'draft'" :disabled="scope.row.isLocked === 1"></el-button>
<el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['cw:evaluation:remove']" v-if="scope.row.evaluationStatus === 'draft'"></el-button>
</template>
</el-table-column>
</el-table>
</div>
<!-- 分页组件 -->
<div class="pagination-container">
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
</div>
</el-card>
<!-- 新增/编辑/查看弹窗 - 使用表格样式 -->
<el-dialog
v-model="dialogVisible"
:title="dialogTitle"
width="95%"
top="5vh"
:close-on-click-modal="false"
destroy-on-close
>
<!-- 锁定状态提示 -->
<el-alert
v-if="formData.isLocked === 1"
type="warning"
:closable="false"
show-icon
style="margin-bottom: 20px;"
>
<template #title>
<span>该绩效自评已锁定,不允许修改。锁定时间:{{ formData.lockTime ? parseTime(formData.lockTime) : '-' }},锁定人:{{ formData.lockByName || '-' }}</span>
</template>
</el-alert>
<!-- 使用表格样式组件 -->
<TableForm
ref="tableFormRef"
:form-data="formData"
:disabled="dialogMode === 'view' || formData.isLocked === 1"
/>
<!-- 查看详情时显示运行监控数据 -->
<div v-if="dialogMode === 'view'" style="margin-top: 30px;">
<el-divider content-position="left">
<h3 style="margin: 0;">运行监控数据</h3>
</el-divider>
<el-table
v-if="formData.monitoringList && formData.monitoringList.length > 0"
:data="formData.monitoringList"
border
style="width: 100%;"
>
<el-table-column label="序号" type="index" width="60" align="center" />
<el-table-column label="监控周期" align="center" prop="monitoringPeriod" width="150" />
<el-table-column label="填报时间" align="center" prop="createTime" width="160">
<template #default="scope">
<span v-if="scope.row.createTime">{{ proxy.parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}') }}</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="填报人" align="center" prop="fillByName" width="120" />
<el-table-column label="资金使用情况" align="center" prop="fundUsage" show-overflow-tooltip min-width="200" />
<el-table-column label="绩效目标完成情况" align="center" prop="performanceTargetCompletion" show-overflow-tooltip min-width="200" />
<el-table-column label="操作" align="center" width="100" fixed="right">
<template #default="scope">
<el-button
link
type="primary"
icon="View"
@click="handleViewMonitoringDetail(scope.row)"
>查看</el-button>
</template>
</el-table-column>
</el-table>
<el-empty v-else description="暂无运行监控数据" :image-size="100" />
</div>
<template #footer>
<div class="dialog-footer">
<el-button @click="dialogVisible = false">{{ dialogMode === 'view' ? '关闭' : '取消' }}</el-button>
<el-button
v-if="dialogMode !== 'view'"
type="info"
@click="handleSaveDraft"
:disabled="formData.isLocked === 1"
>保存草稿</el-button>
<el-button
v-if="dialogMode !== 'view'"
type="primary"
@click="handleFormSubmit"
:disabled="formData.isLocked === 1"
>提交自评</el-button>
</div>
</template>
</el-dialog>
<!-- 运行监控弹窗 -->
<MonitoringDialog ref="monitoringDialogRef" />
</div>
</template>
<script setup name="CwEvaluation" lang="ts">
import { Lock } from '@element-plus/icons-vue'
import { listEvaluation, getEvaluation, delEvaluation, addEvaluation, updateEvaluation, saveDraft, submitEvaluation, exportEvaluation, listPerformanceMonitoring } from '@/api/cw/performanceEvaluation'
import type { CwProjectPerformanceSelfEvaluationVO, CwProjectPerformanceSelfEvaluationQuery, CwProjectPerformanceSelfEvaluationForm } from '@/api/cw/performanceEvaluation'
import TableForm from './table-form.vue'
import MonitoringDialog from './components/MonitoringDialog.vue'
const { proxy } = getCurrentInstance() as ComponentInternalInstance
// 加载字典数据
const { cw_evaluation_status } = toRefs<any>(proxy?.useDict('cw_evaluation_status') || {})
const evaluationList = ref<CwProjectPerformanceSelfEvaluationVO[]>([])
const loading = ref(true)
const showSearch = ref(true)
const ids = ref<Array<number>>([])
const single = ref(true)
const multiple = ref(true)
const total = ref(0)
const queryFormRef = ref<ElFormInstance>()
const formRef = ref<ElFormInstance>()
const tableFormRef = ref<any>()
const monitoringDialogRef = ref<any>()
// 弹窗相关状态
const dialogVisible = ref(false)
const dialogTitle = ref('')
const dialogMode = ref<'add' | 'edit' | 'view'>('add')
const dateRange = ref<string[]>([])
// 表单数据
// 🔧 修复:初始化完整的表单对象,包含所有字段
// Vue 3的响应式系统需要在创建时就定义所有属性,否则后续添加的属性可能不响应
const formData = ref<CwProjectPerformanceSelfEvaluationForm>({
// 基本信息
projectName: '',
evaluationYear: new Date().getFullYear(),
projectApplicationId: 0,
applicationNo: '',
supervisoryDept: '',
implementUnit: '',
principal: '',
contactPhone: '',
startDate: undefined,
endDate: undefined,
// 项目资金
initialBudget: undefined,
annualBudget: undefined,
actualExpenditure: undefined,
fundValue: undefined,
fundExecutionRate: undefined,
fundScore: undefined,
// 当年预算资金
currentYearBudgetInitial: undefined,
currentYearBudgetAnnual: undefined,
currentYearBudgetActual: undefined,
currentYearBudgetValue: undefined,
currentYearBudgetExecutionRate: undefined,
currentYearBudgetScore: undefined,
// 上年结转资金
lastYearCarryoverInitial: undefined,
lastYearCarryoverAnnual: undefined,
lastYearCarryoverActual: undefined,
lastYearCarryoverValue: undefined,
lastYearCarryoverExecutionRate: undefined,
lastYearCarryoverScore: undefined,
// 其他资金
otherFundsInitial: undefined,
otherFundsAnnual: undefined,
otherFundsActual: undefined,
otherFundsValue: undefined,
otherFundsExecutionRate: undefined,
otherFundsScore: undefined,
// 绩效目标
performanceGoal: '',
targetCompletion: '',
// 产出指标
quantityIndicator: '',
quantityTarget: '',
quantityActual: '',
quantityValue: undefined,
quantityScore: undefined,
quantityDeviation: '',
qualityIndicator: '',
qualityTarget: '',
qualityActual: '',
qualityValue: undefined,
qualityScore: undefined,
qualityDeviation: '',
timelinessIndicator: '',
timelinessTarget: '',
timelinessActual: '',
timelinessValue: undefined,
timelinessScore: undefined,
timelinessDeviation: '',
costIndicator: '',
costTarget: '',
costActual: '',
costValue: undefined,
costScore: undefined,
costDeviation: '',
// 效益指标
economicIndicator: '',
economicTarget: '',
economicActual: '',
economicValue: undefined,
economicScore: undefined,
economicDeviation: '',
socialIndicator: '',
socialTarget: '',
socialActual: '',
socialValue: undefined,
socialScore: undefined,
socialDeviation: '',
ecologicalIndicator: '',
ecologicalTarget: '',
ecologicalActual: '',
ecologicalValue: undefined,
ecologicalScore: undefined,
ecologicalDeviation: '',
satisfactionIndicator: '',
satisfactionTarget: '',
satisfactionActual: '',
satisfactionValue: undefined,
satisfactionScore: undefined,
satisfactionDeviation: '',
// 综合评分
decisionScore: 0,
decisionContent: '',
processScore: 0,
processContent: '',
outputScore: 0,
outputContent: '',
benefitScore: 0,
benefitContent: '',
// 总分和等级
totalScore: undefined,
selfEvaluationLevel: '',
// 其他信息
existingProblems: '',
improvementMeasures: '',
evaluationStatus: 'draft',
remark: '',
// 运行监控数据列表(查看详情时返回)
monitoringList: [] as any[]
})
// 表单验证规则
const rules = ref({
projectName: [{ required: true, message: '项目名称不能为空', trigger: 'blur' }],
evaluationYear: [{ required: true, message: '自评年度不能为空', trigger: 'change' }],
decisionScore: [
{ required: true, message: '项目决策得分不能为空', trigger: 'blur' },
{ type: 'number', min: 0, max: 20, message: '得分范围0-20分', trigger: 'blur' }
],
processScore: [
{ required: true, message: '项目过程得分不能为空', trigger: 'blur' },
{ type: 'number', min: 0, max: 20, message: '得分范围0-20分', trigger: 'blur' }
],
outputScore: [
{ required: true, message: '项目产出得分不能为空', trigger: 'blur' },
{ type: 'number', min: 0, max: 30, message: '得分范围0-30分', trigger: 'blur' }
],
benefitScore: [
{ required: true, message: '项目效益得分不能为空', trigger: 'blur' },
{ type: 'number', min: 0, max: 30, message: '得分范围0-30分', trigger: 'blur' }
]
})
const data = reactive<{
queryParams: CwProjectPerformanceSelfEvaluationQuery
}>({
queryParams: {
pageNum: 1,
pageSize: 10,
projectName: undefined,
evaluationYear: undefined,
evaluationStatus: undefined,
selfEvaluationLevel: undefined
}
})
const { queryParams } = toRefs(data)
// 计算总分
const totalScore = computed(() => {
return (formData.value.decisionScore || 0) +
(formData.value.processScore || 0) +
(formData.value.outputScore || 0) +
(formData.value.benefitScore || 0)
})
const totalScoreDisplay = computed(() => totalScore.value.toFixed(2))
// 自动计算等级
const evaluationLevel = computed(() => {
const score = totalScore.value
if (score >= 90) return '优秀'
if (score >= 80) return '良好'
if (score >= 60) return '合格'
return '不合格'
})
const evaluationLevelDisplay = computed(() => evaluationLevel.value)
const levelTagType = computed(() => {
const level = evaluationLevel.value
if (level === '优秀') return 'success'
if (level === '良好') return 'primary'
if (level === '合格') return 'warning'
return 'danger'
})
// 计算预算执行率
const budgetExecutionRate = computed(() => {
if (formData.value.annualBudget && formData.value.actualExpenditure) {
return (formData.value.actualExpenditure / formData.value.annualBudget * 100).toFixed(2)
}
return '0.00'
})
const budgetExecutionRateDisplay = computed(() => budgetExecutionRate.value)
// 监听评分变化,自动更新总分和等级
watch([
() => formData.value.decisionScore,
() => formData.value.processScore,
() => formData.value.outputScore,
() => formData.value.benefitScore
], () => {
formData.value.totalScore = totalScore.value
formData.value.selfEvaluationLevel = evaluationLevel.value
})
// 监听预算和支出变化,自动更新执行率
watch([
() => formData.value.annualBudget,
() => formData.value.actualExpenditure
], () => {
if (formData.value.annualBudget && formData.value.actualExpenditure) {
formData.value.budgetExecutionRate = parseFloat(budgetExecutionRate.value)
}
})
// 处理日期范围变化
function handleDateRangeChange(dates: string[]) {
if (dates && dates.length === 2) {
formData.value.startDate = dates[0]
formData.value.endDate = dates[1]
} else {
formData.value.startDate = undefined
formData.value.endDate = undefined
}
}
// 重置表单
function resetForm() {
// 🔧 修复:初始化完整的表单字段对象,确保所有字段都有初始值
// 这样Vue的响应式系统才能正确追踪所有字段的变化
formData.value = {
// 基本信息
projectName: '',
evaluationYear: new Date().getFullYear(),
projectApplicationId: 0,
applicationNo: '',
supervisoryDept: '',
implementUnit: '',
principal: '',
contactPhone: '',
startDate: undefined,
endDate: undefined,
// 项目资金
initialBudget: undefined,
annualBudget: undefined,
actualExpenditure: undefined,
fundValue: undefined,
fundExecutionRate: undefined,
fundScore: undefined,
// 当年预算资金
currentYearBudgetInitial: undefined,
currentYearBudgetAnnual: undefined,
currentYearBudgetActual: undefined,
currentYearBudgetValue: undefined,
currentYearBudgetExecutionRate: undefined,
currentYearBudgetScore: undefined,
// 上年结转资金
lastYearCarryoverInitial: undefined,
lastYearCarryoverAnnual: undefined,
lastYearCarryoverActual: undefined,
lastYearCarryoverValue: undefined,
lastYearCarryoverExecutionRate: undefined,
lastYearCarryoverScore: undefined,
// 其他资金
otherFundsInitial: undefined,
otherFundsAnnual: undefined,
otherFundsActual: undefined,
otherFundsValue: undefined,
otherFundsExecutionRate: undefined,
otherFundsScore: undefined,
// 绩效目标
performanceGoal: '',
targetCompletion: '',
// 产出指标
quantityIndicator: '',
quantityTarget: '',
quantityActual: '',
quantityValue: undefined,
quantityScore: undefined,
quantityDeviation: '',
qualityIndicator: '',
qualityTarget: '',
qualityActual: '',
qualityValue: undefined,
qualityScore: undefined,
qualityDeviation: '',
timelinessIndicator: '',
timelinessTarget: '',
timelinessActual: '',
timelinessValue: undefined,
timelinessScore: undefined,
timelinessDeviation: '',
costIndicator: '',
costTarget: '',
costActual: '',
costValue: undefined,
costScore: undefined,
costDeviation: '',
// 效益指标
economicIndicator: '',
economicTarget: '',
economicActual: '',
economicValue: undefined,
economicScore: undefined,
economicDeviation: '',
socialIndicator: '',
socialTarget: '',
socialActual: '',
socialValue: undefined,
socialScore: undefined,
socialDeviation: '',
ecologicalIndicator: '',
ecologicalTarget: '',
ecologicalActual: '',
ecologicalValue: undefined,
ecologicalScore: undefined,
ecologicalDeviation: '',
satisfactionIndicator: '',
satisfactionTarget: '',
satisfactionActual: '',
satisfactionValue: undefined,
satisfactionScore: undefined,
satisfactionDeviation: '',
// 综合评分
decisionScore: 0,
decisionContent: '',
processScore: 0,
processContent: '',
outputScore: 0,
outputContent: '',
benefitScore: 0,
benefitContent: '',
// 总分和等级
totalScore: undefined,
selfEvaluationLevel: '',
// 其他信息
existingProblems: '',
improvementMeasures: '',
evaluationStatus: 'draft',
remark: ''
}
dateRange.value = []
formRef.value?.resetFields()
}
/** 转换后端返回的字符串数字为真实数字类型 */
function convertNumberFields(data: any) {
if (!data) return data
// 需要转换为数字的字段列表
const numberFields = [
'evaluationYear',
'annualBudget',
'actualExpenditure',
'budgetExecutionRate',
'fundScore',
'quantityScore',
'qualityScore',
'timelinessScore',
'costScore',
'economicScore',
'socialScore',
'ecologicalScore',
'satisfactionScore',
'decisionScore',
'processScore',
'outputScore',
'benefitScore',
'totalScore',
'initialBudget',
'fundValue',
'fundExecutionRate',
'currentYearBudgetInitial',
'currentYearBudgetAnnual',
'currentYearBudgetActual',
'currentYearBudgetValue',
'currentYearBudgetExecutionRate',
'currentYearBudgetScore',
'lastYearCarryoverInitial',
'lastYearCarryoverAnnual',
'lastYearCarryoverActual',
'lastYearCarryoverValue',
'lastYearCarryoverExecutionRate',
'lastYearCarryoverScore',
'otherFundsInitial',
'otherFundsAnnual',
'otherFundsActual',
'otherFundsValue',
'otherFundsExecutionRate',
'otherFundsScore',
'quantityValue',
'qualityValue',
'timelinessValue',
'costValue',
'economicValue',
'socialValue',
'ecologicalValue',
'satisfactionValue'
]
// 转换字段类型:将字符串数字转为真实数字
numberFields.forEach(field => {
if (data[field] !== null && data[field] !== undefined && data[field] !== '') {
// 如果是字符串,转为数字
if (typeof data[field] === 'string') {
data[field] = Number(data[field])
}
}
})
return data
}
/** 查询项目绩效自评列表 */
async function getList() {
loading.value = true
try {
const response = await listEvaluation(queryParams.value)
evaluationList.value = response.rows
// 并行查询所有项目的运行监控数据
const monitoringPromises = evaluationList.value
.filter(item => item.id)
.map(async (item) => {
try {
const monitoringResponse = await listPerformanceMonitoring(item.id!)
// 如果有运行监控数据,设置hasMonitoringData为true;否则为false
item.hasMonitoringData = monitoringResponse.data && monitoringResponse.data.length > 0
} catch (error) {
// 如果查询失败,默认不显示运行监控按钮
item.hasMonitoringData = false
}
})
// 等待所有查询完成
await Promise.all(monitoringPromises)
// 为没有ID的项目设置默认值
evaluationList.value.forEach(item => {
if (!item.id) {
item.hasMonitoringData = false
}
})
total.value = response.total
} catch (error) {
console.error('查询列表失败:', error)
} finally {
loading.value = false
}
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1
getList()
}
/** 重置按钮操作 */
function resetQuery() {
queryFormRef.value?.resetFields()
handleQuery()
}
/** 多选框选中数据 */
function handleSelectionChange(selection: CwProjectPerformanceSelfEvaluationVO[]) {
ids.value = selection.map(item => item.id!)
single.value = selection.length !== 1
multiple.value = !selection.length
}
/** 新增按钮操作 */
async function handleAdd() {
resetForm()
dialogMode.value = 'add'
dialogTitle.value = '新增项目绩效自评'
// 等待下一个tick,确保formData完全初始化后再打开对话框
await nextTick()
dialogVisible.value = true
}
/** 查看按钮操作 */
async function handleView(row: CwProjectPerformanceSelfEvaluationVO) {
resetForm()
dialogMode.value = 'view'
dialogTitle.value = '查看项目绩效自评'
const response = await getEvaluation(row.id!)
// 🔍 调试:打印后端返回的原始数据
console.log('🔍 后端返回的原始数据:', response.data)
console.log('🔍 检查关键字段是否存在:')
console.log(' - quantityIndicator:', response.data.quantityIndicator)
console.log(' - qualityIndicator:', response.data.qualityIndicator)
console.log(' - performanceGoal:', response.data.performanceGoal)
console.log(' - existingProblems:', response.data.existingProblems)
console.log(' - monitoringList:', response.data.monitoringList)
console.log(' - monitoringList长度:', response.data.monitoringList?.length)
// 🔧 修复:转换后端返回的字符串数字为真实数字类型
formData.value = convertNumberFields(response.data)
// 🔍 调试:打印转换后的数据
console.log('🔍 转换后的formData:', formData.value)
console.log('🔍 转换后的monitoringList:', formData.value.monitoringList)
if (response.data.startDate && response.data.endDate) {
dateRange.value = [response.data.startDate, response.data.endDate]
}
// 等待下一个tick,确保formData完全更新后再打开对话框
await nextTick()
dialogVisible.value = true
}
/** 修改按钮操作 */
async function handleUpdate(row: CwProjectPerformanceSelfEvaluationVO) {
// 🔒 检查是否已锁定
if (row.isLocked === 1) {
proxy?.$modal.msgWarning('该绩效自评已锁定,不允许修改。如需修改,请联系财务管理员或学校领导解锁')
return
}
resetForm()
dialogMode.value = 'edit'
dialogTitle.value = '编辑项目绩效自评'
const response = await getEvaluation(row.id!)
// 🔧 修复:转换后端返回的字符串数字为真实数字类型
formData.value = convertNumberFields(response.data)
// 🔒 再次检查锁定状态(防止数据被锁定)
if (formData.value.isLocked === 1) {
proxy?.$modal.msgWarning('该绩效自评已锁定,不允许修改。如需修改,请联系财务管理员或学校领导解锁')
return
}
if (response.data.startDate && response.data.endDate) {
dateRange.value = [response.data.startDate, response.data.endDate]
}
// 等待下一个tick,确保formData完全更新后再打开对话框
await nextTick()
dialogVisible.value = true
}
/** 运行监控按钮操作 */
function handleMonitoring(row: CwProjectPerformanceSelfEvaluationVO) {
monitoringDialogRef.value?.open(row.id)
}
/** 查看运行监控详情 */
function handleViewMonitoringDetail(row: any) {
if (!row.id || !row.evaluationId) {
proxy?.$modal.msgError('数据异常,无法查看详情')
return
}
monitoringDialogRef.value?.viewDetail(row.id, row.evaluationId)
}
/** 保存草稿 */
function handleSaveDraft() {
// 🔒 检查是否已锁定
if (formData.value.isLocked === 1) {
proxy?.$modal.msgWarning('该绩效自评已锁定,不允许修改。如需修改,请联系财务管理员或学校领导解锁')
return
}
saveDraft(formData.value).then(() => {
proxy?.$modal.msgSuccess('保存草稿成功')
dialogVisible.value = false
getList()
}).catch((error: any) => {
// 后端也会检查锁定状态,这里捕获错误提示
if (error?.msg?.includes('锁定')) {
proxy?.$modal.msgError(error.msg)
}
})
}
/** 提交自评 */
function handleFormSubmit() {
// 🔒 检查是否已锁定
if (formData.value.isLocked === 1) {
proxy?.$modal.msgWarning('该绩效自评已锁定,不允许提交。如需提交,请联系财务管理员或学校领导解锁')
return
}
// 先调用表格表单的分值校验(提示性质,不阻止提交)
if (tableFormRef.value?.validateTotalValue) {
tableFormRef.value.validateTotalValue()
}
// 🔍 调试:打印提交前的完整数据
console.log('=== 提交前的formData.value ===', JSON.stringify(formData.value, null, 2))
console.log('=== 关键字段检查 ===', {
totalScore: formData.value.totalScore,
decisionScore: formData.value.decisionScore,
processScore: formData.value.processScore,
outputScore: formData.value.outputScore,
benefitScore: formData.value.benefitScore,
selfEvaluationLevel: formData.value.selfEvaluationLevel,
budgetExecutionRate: formData.value.budgetExecutionRate
})
// 提交数据(不再需要表单校验,因为是表格式填写)
proxy?.$modal.confirm('确认要提交该自评吗?').then(() => {
const submitData = { ...formData.value }
submitData.evaluationStatus = 'submitted'
// 🔍 调试:打印即将提交的数据
console.log('=== 即将提交的数据 ===', JSON.stringify(submitData, null, 2))
if (formData.value.id) {
// 编辑模式:直接更新
return updateEvaluation(submitData).then((response) => {
proxy?.$modal.msgSuccess('提交成功')
dialogVisible.value = false
getList()
}).catch((error: any) => {
// 后端也会检查锁定状态,这里捕获错误提示
if (error?.msg?.includes('锁定')) {
proxy?.$modal.msgError(error.msg)
} else {
console.error('提交失败:', error)
}
})
} else {
// 新增模式:先保存获取ID,再更新状态
return addEvaluation(submitData).then((response) => {
console.log('新增返回结果:', response)
if (response.data) {
formData.value.id = response.data
console.log('新增成功,获得ID:', formData.value.id)
}
proxy?.$modal.msgSuccess('提交成功')
dialogVisible.value = false
getList()
}).catch((error: any) => {
// 后端也会检查锁定状态,这里捕获错误提示
if (error?.msg?.includes('锁定')) {
proxy?.$modal.msgError(error.msg)
} else {
console.error('提交失败:', error)
}
})
}
}).catch((error) => {
console.error('提交失败:', error)
})
}
/** 提交按钮操作 */
function handleSubmit(row: CwProjectPerformanceSelfEvaluationVO) {
// 🔒 检查是否已锁定
if (row.isLocked === 1) {
proxy?.$modal.msgWarning('该绩效自评已锁定,不允许提交。如需提交,请联系财务管理员或学校领导解锁')
return
}
proxy?.$modal.confirm('确认要提交该自评吗?提交后将不能修改。').then(() => {
return submitEvaluation(row.id!)
}).then(() => {
getList()
proxy?.$modal.msgSuccess('提交成功')
}).catch(() => {})
}
/** 删除按钮操作 */
function handleDelete(row?: CwProjectPerformanceSelfEvaluationVO) {
const evaluationIds = row?.id || ids.value
proxy?.$modal.confirm('是否确认删除选中的项目绩效自评?').then(() => {
return delEvaluation(evaluationIds)
}).then(() => {
getList()
proxy?.$modal.msgSuccess('删除成功')
}).catch(() => {})
}
/** 导出按钮操作 */
function handleExport() {
proxy?.$modal.confirm('是否确认导出所有项目绩效自评数据?').then(() => {
return exportEvaluation(queryParams.value)
}).then((response: any) => {
proxy?.$download.saveAs(response, '项目绩效自评.xlsx')
}).catch(() => {})
}
onMounted(() => {
getList()
})
</script>
<style scoped lang="scss">
.score-card {
margin-bottom: 20px;
}
.score-header {
display: flex;
justify-content: space-between;
align-items: center;
font-weight: bold;
}
.total-score-card {
margin: 20px 0;
background: #f5f7fa;
}
:deep(.el-divider__text) {
background: #fff;
}
:deep(.el-dialog__body) {
max-height: 70vh;
overflow-y: auto;
}
</style>
File diff suppressed because it is too large. Load diff
+446
View File
@@ -0,0 +1,446 @@
<template>
<div class="app-container">
<el-card class="box-card">
<template #header>
<div class="card-header">
<span class="card-title">项目月度运行监控</span>
<div>
<el-button type="primary" icon="Document" @click="handleBatchSave">批量保存</el-button>
<el-button icon="Back" @click="handleBack">返回</el-button>
</div>
</div>
</template>
<!-- 项目信息 -->
<el-descriptions :column="3" border class="project-info">
<el-descriptions-item label="项目名称">{{ projectInfo.projectName }}</el-descriptions-item>
<el-descriptions-item label="申报编号">{{ projectInfo.applicationNo }}</el-descriptions-item>
<el-descriptions-item label="自评年度">{{ projectInfo.evaluationYear }}</el-descriptions-item>
<el-descriptions-item label="项目负责人">{{ projectInfo.principal }}</el-descriptions-item>
<el-descriptions-item label="联系电话">{{ projectInfo.contactPhone }}</el-descriptions-item>
<el-descriptions-item label="本年度预算">{{ projectInfo.annualBudget }} 万元</el-descriptions-item>
</el-descriptions>
<!-- 月度监控Tab -->
<el-tabs v-model="activeMonth" class="monitoring-tabs">
<el-tab-pane
v-for="month in 12"
:key="month"
:label="monthLabel(month)"
:name="month.toString()"
>
<el-form
:ref="(el: any) => setFormRef(month, el)"
:model="monthlyData[month]"
:rules="rules"
label-width="150px"
class="monitoring-form"
>
<!-- 进度信息 -->
<el-divider content-position="left"><h4>进度信息</h4></el-divider>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="计划进度(%)" prop="plannedProgress">
<el-input-number
v-model="monthlyData[month].plannedProgress"
:precision="2"
:min="0"
:max="100"
style="width: 100%"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="实际进度(%)" prop="actualProgress">
<el-input-number
v-model="monthlyData[month].actualProgress"
:precision="2"
:min="0"
:max="100"
style="width: 100%"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="进度偏差(%)">
<el-input :value="calculateProgressVariance(month)" disabled>
<template #append>
<el-tag :type="getVarianceTagType(calculateProgressVariance(month))" size="small">
{{ getVarianceStatus(calculateProgressVariance(month)) }}
</el-tag>
</template>
</el-input>
</el-form-item>
</el-col>
</el-row>
<!-- 资金信息 -->
<el-divider content-position="left"><h4>资金信息</h4></el-divider>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="本月预算(万元)" prop="monthlyBudget">
<el-input-number
v-model="monthlyData[month].monthlyBudget"
:precision="2"
:min="0"
style="width: 100%"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="本月支出(万元)" prop="monthlyExpenditure">
<el-input-number
v-model="monthlyData[month].monthlyExpenditure"
:precision="2"
:min="0"
style="width: 100%"
/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="累计预算(万元)" prop="cumulativeBudget">
<el-input-number
v-model="monthlyData[month].cumulativeBudget"
:precision="2"
:min="0"
style="width: 100%"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="累计支出(万元)" prop="cumulativeExpenditure">
<el-input-number
v-model="monthlyData[month].cumulativeExpenditure"
:precision="2"
:min="0"
style="width: 100%"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="资金执行率(%)">
<el-input :value="calculateFundExecutionRate(month)" disabled>
<template #append>
<el-tag :type="getRateTagType(calculateFundExecutionRate(month))" size="small">
{{ getRateStatus(calculateFundExecutionRate(month)) }}
</el-tag>
</template>
</el-input>
</el-form-item>
</el-col>
</el-row>
<!-- 里程碑 -->
<el-divider content-position="left"><h4>里程碑管理</h4></el-divider>
<el-form-item label="关键里程碑">
<el-input
v-model="monthlyData[month].keyMilestones"
type="textarea"
:rows="2"
placeholder="请输入本月关键里程碑"
/>
</el-form-item>
<el-form-item label="里程碑完成情况">
<el-input
v-model="monthlyData[month].milestoneCompletion"
type="textarea"
:rows="2"
placeholder="请输入里程碑完成情况"
/>
</el-form-item>
<!-- 问题与对策 -->
<el-divider content-position="left"><h4>问题与对策</h4></el-divider>
<el-form-item label="遇到的问题">
<el-input
v-model="monthlyData[month].problemsEncountered"
type="textarea"
:rows="3"
placeholder="请输入本月遇到的问题"
/>
</el-form-item>
<el-form-item label="风险描述">
<el-input
v-model="monthlyData[month].riskDescription"
type="textarea"
:rows="2"
placeholder="请输入风险描述"
/>
</el-form-item>
<el-form-item label="应对措施">
<el-input
v-model="monthlyData[month].countermeasures"
type="textarea"
:rows="3"
placeholder="请输入应对措施"
/>
</el-form-item>
<!-- 下月计划 -->
<el-divider content-position="left"><h4>下月计划</h4></el-divider>
<el-form-item label="下月工作计划">
<el-input
v-model="monthlyData[month].nextMonthPlan"
type="textarea"
:rows="4"
placeholder="请输入下月工作计划"
/>
</el-form-item>
<el-form-item label="备注">
<el-input
v-model="monthlyData[month].remark"
type="textarea"
:rows="2"
placeholder="请输入备注信息"
/>
</el-form-item>
<!-- 填报状态 -->
<el-form-item label="填报状态">
<el-tag :type="monthlyData[month].fillStatus === 'filled' ? 'success' : 'info'">
{{ monthlyData[month].fillStatus === 'filled' ? '已填报' : '未填报' }}
</el-tag>
<span v-if="monthlyData[month].fillTime" style="margin-left: 10px">
填报时间:{{ monthlyData[month].fillTime }}
</span>
</el-form-item>
<!-- 操作按钮 -->
<el-form-item>
<el-button type="primary" @click="handleSaveMonth(month)">保存{{ month }}月数据</el-button>
</el-form-item>
</el-form>
</el-tab-pane>
</el-tabs>
</el-card>
</div>
</template>
<script setup name="CwMonitoring" lang="ts">
import { getEvaluation } from '@/api/cw/performanceEvaluation'
import { getYearlyMonitoring, fillMonthlyData, batchSaveMonitoring } from '@/api/cw/performanceEvaluation'
import type { CwProjectPerformanceSelfEvaluationVO, CwProjectMonthlyMonitoringForm } from '@/api/cw/performanceEvaluation'
const route = useRoute()
const router = useRouter()
const { proxy } = getCurrentInstance() as ComponentInternalInstance
const activeMonth = ref('1')
const evaluationId = ref<number>(0)
const projectInfo = ref<CwProjectPerformanceSelfEvaluationVO>({} as CwProjectPerformanceSelfEvaluationVO)
const monthlyData = ref<Record<number, CwProjectMonthlyMonitoringForm>>({})
const formRefs = ref<Record<number, any>>({})
// 初始化月度数据
function initMonthlyData() {
for (let month = 1; month <= 12; month++) {
monthlyData.value[month] = {
evaluationId: evaluationId.value,
projectApplicationId: projectInfo.value.projectApplicationId,
monitoringYear: projectInfo.value.evaluationYear,
monitoringMonth: month,
fillStatus: 'unfilled'
}
}
}
// 设置表单引用
function setFormRef(month: number, el: any) {
if (el) {
formRefs.value[month] = el
}
}
// 月份标签
function monthLabel(month: number): string {
const status = monthlyData.value[month]?.fillStatus === 'filled' ? '✓' : ''
return `${month}月 ${status}`
}
// 计算进度偏差
function calculateProgressVariance(month: number): string {
const data = monthlyData.value[month]
if (data.plannedProgress !== undefined && data.actualProgress !== undefined) {
const variance = data.actualProgress - data.plannedProgress
return variance.toFixed(2)
}
return '0.00'
}
// 计算资金执行率
function calculateFundExecutionRate(month: number): string {
const data = monthlyData.value[month]
if (data.cumulativeBudget && data.cumulativeExpenditure && data.cumulativeBudget > 0) {
const rate = (data.cumulativeExpenditure / data.cumulativeBudget) * 100
return rate.toFixed(2)
}
return '0.00'
}
// 获取偏差标签类型
function getVarianceTagType(variance: string): string {
const val = parseFloat(variance)
if (val > 0) return 'success'
if (val < -5) return 'danger'
return 'warning'
}
// 获取偏差状态
function getVarianceStatus(variance: string): string {
const val = parseFloat(variance)
if (val > 0) return '超前'
if (val < -5) return '滞后'
return '正常'
}
// 获取执行率标签类型
function getRateTagType(rate: string): string {
const val = parseFloat(rate)
if (val >= 90 && val <= 110) return 'success'
if (val < 80 || val > 120) return 'danger'
return 'warning'
}
// 获取执行率状态
function getRateStatus(rate: string): string {
const val = parseFloat(rate)
if (val >= 90 && val <= 110) return '良好'
if (val < 80) return '偏低'
if (val > 120) return '偏高'
return '正常'
}
// 表单验证规则
const rules = ref({
plannedProgress: [
{ type: 'number', min: 0, max: 100, message: '计划进度范围0-100', trigger: 'blur' }
],
actualProgress: [
{ type: 'number', min: 0, max: 100, message: '实际进度范围0-100', trigger: 'blur' }
]
})
// 保存单月数据
function handleSaveMonth(month: number) {
const formRef = formRefs.value[month]
if (!formRef) return
formRef.validate((valid: boolean) => {
if (valid) {
const data = { ...monthlyData.value[month] }
fillMonthlyData(data).then(() => {
proxy?.$modal.msgSuccess(`${month}月数据保存成功`)
// 重新加载数据
loadMonitoringData()
})
}
})
}
// 批量保存
function handleBatchSave() {
proxy?.$modal.confirm('确认批量保存所有已填写的月度数据?').then(() => {
const dataList = Object.values(monthlyData.value).filter(data => {
// 过滤掉完全空白的数据
return data.plannedProgress !== undefined ||
data.actualProgress !== undefined ||
data.monthlyBudget !== undefined ||
data.monthlyExpenditure !== undefined
})
if (dataList.length === 0) {
proxy?.$modal.msgWarning('没有可保存的数据')
return
}
batchSaveMonitoring(evaluationId.value, dataList).then(() => {
proxy?.$modal.msgSuccess('批量保存成功')
loadMonitoringData()
})
}).catch(() => {})
}
// 返回
function handleBack() {
router.back()
}
// 加载监控数据
function loadMonitoringData() {
const year = projectInfo.value.evaluationYear
getYearlyMonitoring(evaluationId.value, year).then(response => {
const dataMap = response.data
// 合并已有数据
for (let month = 1; month <= 12; month++) {
if (dataMap[month]) {
monthlyData.value[month] = { ...monthlyData.value[month], ...dataMap[month] }
}
}
})
}
// 初始化
onMounted(() => {
evaluationId.value = parseInt(route.query.evaluationId as string)
// 加载项目信息
getEvaluation(evaluationId.value).then(response => {
projectInfo.value = response.data
// 初始化月度数据
initMonthlyData()
// 加载已有的监控数据
loadMonitoringData()
})
})
</script>
<style scoped lang="scss">
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
}
.card-title {
font-size: 18px;
font-weight: bold;
}
.project-info {
margin-bottom: 20px;
}
.monitoring-tabs {
margin-top: 20px;
}
.monitoring-form {
padding: 20px;
}
:deep(.el-divider__text) {
background: #fff;
}
:deep(.el-tabs__item) {
font-weight: 500;
}
:deep(.el-tabs__item.is-active) {
color: #409eff;
font-weight: bold;
}
</style>
@@ -0,0 +1,488 @@
<template>
<div class="p-2 page-container">
<!-- 搜索区域 -->
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form :model="queryParams" ref="queryFormRef" label-width="100px">
<el-row :gutter="20">
<el-col :span="6">
<el-form-item label="项目名称" prop="projectName">
<el-input v-model="queryParams.projectName" placeholder="请输入项目名称" clearable @keyup.enter="handleQuery" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="申报编号" prop="applicationNo">
<el-input v-model="queryParams.applicationNo" placeholder="请输入申报编号" clearable @keyup.enter="handleQuery" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="自评年度" prop="evaluationYear">
<el-date-picker v-model="queryParams.evaluationYear" type="year" placeholder="选择年度" clearable value-format="YYYY" style="width: 100%" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="自评状态" prop="evaluationStatus">
<el-select v-model="queryParams.evaluationStatus" placeholder="请选择自评状态" clearable style="width: 100%">
<el-option label="草稿" value="draft" />
<el-option label="已提交" value="submitted" />
<el-option label="已审核" value="approved" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="6">
<el-form-item label="自评等级" prop="selfEvaluationLevel">
<el-select v-model="queryParams.selfEvaluationLevel" placeholder="请选择自评等级" clearable style="width: 100%">
<el-option label="优秀" value="优秀" />
<el-option label="良好" value="良好" />
<el-option label="合格" value="合格" />
<el-option label="不合格" value="不合格" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="锁定状态" prop="isLocked">
<el-select v-model="queryParams.isLocked" placeholder="请选择锁定状态" clearable style="width: 100%">
<el-option label="未锁定" :value="0" />
<el-option label="已锁定" :value="1" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
</div>
</transition>
<!-- 表格区域 -->
<el-card shadow="never" class="button-card table-card">
<template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="warning" plain icon="Lock" :disabled="multiple" @click="handleBatchLock" v-hasPermi="['cw:monitoringManagement:lock']">批量锁定</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="Unlock" :disabled="multiple" @click="handleBatchUnlock" v-hasPermi="['cw:monitoringManagement:unlock']">批量解锁</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
</template>
<div class="table-container">
<el-table
v-loading="loading"
border
:data="evaluationList"
@selection-change="handleSelectionChange"
style="width: 100%"
class="scroll-table"
>
<el-table-column type="selection" width="55" align="center" fixed="left" />
<el-table-column label="项目名称" align="center" prop="projectName" show-overflow-tooltip min-width="200" />
<el-table-column label="申报编号" align="center" prop="applicationNo" width="150" />
<el-table-column label="自评年度" align="center" prop="evaluationYear" width="100" />
<el-table-column label="自评总分" align="center" prop="totalScore" width="100">
<template #default="scope">
<el-tag v-if="scope.row.totalScore >= 90" type="success" size="small">{{ scope.row.totalScore }}</el-tag>
<el-tag v-else-if="scope.row.totalScore >= 80" type="primary" size="small">{{ scope.row.totalScore }}</el-tag>
<el-tag v-else-if="scope.row.totalScore >= 60" type="warning" size="small">{{ scope.row.totalScore }}</el-tag>
<el-tag v-else-if="scope.row.totalScore" type="danger" size="small">{{ scope.row.totalScore }}</el-tag>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="自评等级" align="center" prop="selfEvaluationLevel" width="100">
<template #default="scope">
<el-tag v-if="scope.row.selfEvaluationLevel === '优秀'" type="success" size="small">优秀</el-tag>
<el-tag v-else-if="scope.row.selfEvaluationLevel === '良好'" type="primary" size="small">良好</el-tag>
<el-tag v-else-if="scope.row.selfEvaluationLevel === '合格'" type="warning" size="small">合格</el-tag>
<el-tag v-else-if="scope.row.selfEvaluationLevel === '不合格'" type="danger" size="small">不合格</el-tag>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="自评状态" align="center" prop="evaluationStatus" width="100">
<template #default="scope">
<dict-tag :options="cw_evaluation_status" :value="scope.row.evaluationStatus" />
</template>
</el-table-column>
<el-table-column label="锁定状态" align="center" prop="isLocked" width="120">
<template #default="scope">
<el-tag v-if="scope.row.isLocked === 1" type="warning" size="small">已锁定</el-tag>
<el-tag v-else type="success" size="small">未锁定</el-tag>
</template>
</el-table-column>
<el-table-column label="锁定人" align="center" prop="lockByName" width="120" />
<el-table-column label="锁定时间" align="center" prop="lockTime" width="180">
<template #default="scope">
<span v-if="scope.row.lockTime">{{ parseTime(scope.row.lockTime) }}</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="创建人" align="center" prop="createBy" width="120" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template #default="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="300" fixed="right" class-name="small-padding fixed-width">
<template #default="scope">
<el-button link type="primary" icon="View" @click="handleView(scope.row)" v-hasPermi="['cw:monitoringManagement:query']"></el-button>
<el-button
v-if="scope.row.isLocked !== 1"
link
type="primary"
icon="Edit"
@click="handleEdit(scope.row)"
v-hasPermi="['cw:monitoringManagement:editEvaluation']"
></el-button>
<el-button v-if="scope.row.isLocked !== 1" link type="warning" icon="Lock" @click="handleLock(scope.row)" v-hasPermi="['cw:monitoringManagement:lock']"></el-button>
<el-button v-if="scope.row.isLocked === 1" link type="success" icon="Unlock" @click="handleUnlock(scope.row)" v-hasPermi="['cw:monitoringManagement:unlock']"></el-button>
</template>
</el-table-column>
</el-table>
</div>
<!-- 分页组件 -->
<div class="pagination-container">
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
</div>
</el-card>
<!-- 查看详情弹窗 -->
<el-dialog
v-model="dialogVisible"
:title="dialogTitle"
width="95%"
top="5vh"
:close-on-click-modal="false"
destroy-on-close
>
<!-- 使用表格样式组件 -->
<TableForm
ref="tableFormRef"
:form-data="formData"
:disabled="dialogMode === 'view' || formData.isLocked === 1"
/>
<!-- 显示运行监控数据 -->
<div style="margin-top: 30px;">
<el-divider content-position="left">
<h3 style="margin: 0;">运行监控数据</h3>
</el-divider>
<el-table
v-if="formData.monitoringList && formData.monitoringList.length > 0"
:data="formData.monitoringList"
border
style="width: 100%;"
>
<el-table-column label="序号" type="index" width="60" align="center" />
<el-table-column label="监控周期" align="center" prop="monitoringPeriod" width="150" />
<el-table-column label="填报时间" align="center" prop="createTime" width="160">
<template #default="scope">
<span v-if="scope.row.createTime">{{ proxy.parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}') }}</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="填报人" align="center" prop="fillByName" width="120" />
<el-table-column label="资金使用情况" align="center" prop="fundUsage" show-overflow-tooltip min-width="200" />
<el-table-column label="绩效目标完成情况" align="center" prop="performanceTargetCompletion" show-overflow-tooltip min-width="200" />
</el-table>
<el-empty v-else description="暂无运行监控数据" :image-size="100" />
</div>
<template #footer>
<div class="dialog-footer">
<el-button @click="dialogVisible = false">{{ dialogMode === 'view' ? '关闭' : '取消' }}</el-button>
<el-button
v-if="dialogMode !== 'view'"
type="info"
@click="handleSaveDraft"
:disabled="formData.isLocked === 1"
>保存草稿</el-button>
<el-button
v-if="dialogMode !== 'view'"
type="primary"
@click="handleFormSubmit"
:disabled="formData.isLocked === 1"
>提交自评</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup name="CwMonitoringManagement" lang="ts">
import { listMonitoringManagement, getMonitoringManagement, lockEvaluation, unlockEvaluation, lockBatchEvaluation, unlockBatchEvaluation, type MonitoringManagementQuery } from '@/api/cw/monitoringManagement'
import { saveDraft, updateEvaluation, submitEvaluation } from '@/api/cw/performanceEvaluation'
import type { CwProjectPerformanceSelfEvaluationVO } from '@/api/cw/performanceEvaluation'
import TableForm from '../evaluation/table-form.vue'
const { proxy } = getCurrentInstance() as ComponentInternalInstance
// 加载字典数据
const { cw_evaluation_status } = toRefs<any>(proxy?.useDict('cw_evaluation_status') || {})
const evaluationList = ref<CwProjectPerformanceSelfEvaluationVO[]>([])
const loading = ref(true)
const showSearch = ref(true)
const ids = ref<Array<number>>([])
const single = ref(true)
const multiple = ref(true)
const total = ref(0)
const queryFormRef = ref<ElFormInstance>()
const tableFormRef = ref<any>()
// 弹窗相关状态
const dialogVisible = ref(false)
const formData = ref<any>({})
const dialogMode = ref<'view' | 'edit'>('view')
const dialogTitle = ref('查看绩效自评详情')
// 查询参数
const data = reactive<{
queryParams: MonitoringManagementQuery
}>({
queryParams: {
pageNum: 1,
pageSize: 10,
projectName: undefined,
applicationNo: undefined,
evaluationYear: undefined,
evaluationStatus: undefined,
selfEvaluationLevel: undefined,
isLocked: undefined
}
})
const { queryParams } = toRefs(data)
/** 查询绩效自评列表 */
async function getList() {
loading.value = true
try {
const response = await listMonitoringManagement(queryParams.value)
evaluationList.value = response.rows
total.value = response.total
} catch (error) {
console.error('查询列表失败:', error)
} finally {
loading.value = false
}
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1
getList()
}
/** 重置按钮操作 */
function resetQuery() {
queryFormRef.value?.resetFields()
handleQuery()
}
/** 多选框选中数据 */
function handleSelectionChange(selection: CwProjectPerformanceSelfEvaluationVO[]) {
ids.value = selection.map(item => item.id!)
single.value = selection.length !== 1
multiple.value = !selection.length
}
/** 查看按钮操作 */
async function handleView(row: CwProjectPerformanceSelfEvaluationVO) {
const response = await getMonitoringManagement(row.id!)
formData.value = response.data
dialogMode.value = 'view'
dialogTitle.value = '查看绩效自评详情'
dialogVisible.value = true
}
/** 编辑按钮操作(受权限控制) */
async function handleEdit(row: CwProjectPerformanceSelfEvaluationVO) {
if (row.isLocked === 1) {
proxy.$modal.msgWarning('该绩效自评已锁定,不允许修改。如需修改,请联系财务管理员或学校领导解锁')
return
}
const response = await getMonitoringManagement(row.id!)
formData.value = convertNumberFields(response.data || {})
dialogMode.value = 'edit'
dialogTitle.value = '编辑绩效自评'
dialogVisible.value = true
}
/** 转换后端返回的字符串数字为真实数字类型(与自评页一致) */
function convertNumberFields(data: any) {
if (!data) return data
const numberFields = [
'evaluationYear',
'annualBudget',
'actualExpenditure',
'budgetExecutionRate',
'fundScore',
'quantityScore',
'qualityScore',
'timelinessScore',
'costScore',
'economicScore',
'socialScore',
'ecologicalScore',
'satisfactionScore',
'decisionScore',
'processScore',
'outputScore',
'benefitScore',
'totalScore',
'initialBudget',
'fundValue',
'fundExecutionRate',
'currentYearBudgetInitial',
'currentYearBudgetAnnual',
'currentYearBudgetActual',
'currentYearBudgetValue',
'currentYearBudgetExecutionRate',
'currentYearBudgetScore',
'lastYearCarryoverInitial',
'lastYearCarryoverAnnual',
'lastYearCarryoverActual',
'lastYearCarryoverValue',
'lastYearCarryoverExecutionRate',
'lastYearCarryoverScore',
'otherFundsInitial',
'otherFundsAnnual',
'otherFundsActual',
'otherFundsValue',
'otherFundsExecutionRate',
'otherFundsScore',
'quantityValue',
'qualityValue',
'timelinessValue',
'costValue',
'economicValue',
'socialValue',
'ecologicalValue',
'satisfactionValue'
]
numberFields.forEach((field) => {
if (data[field] !== null && data[field] !== undefined && data[field] !== '' && typeof data[field] === 'string') {
data[field] = Number(data[field])
}
})
return data
}
/** 保存草稿(编辑弹窗内) */
function handleSaveDraft() {
if (formData.value.isLocked === 1) {
proxy.$modal.msgWarning('该绩效自评已锁定,不允许修改。如需修改,请联系财务管理员或学校领导解锁')
return
}
saveDraft(formData.value).then(() => {
proxy.$modal.msgSuccess('保存草稿成功')
dialogVisible.value = false
getList()
})
}
/** 提交自评(编辑弹窗内) */
function handleFormSubmit() {
if (formData.value.isLocked === 1) {
proxy.$modal.msgWarning('该绩效自评已锁定,不允许提交。如需提交,请联系财务管理员或学校领导解锁')
return
}
if (tableFormRef.value?.validateTotalValue) {
tableFormRef.value.validateTotalValue()
}
proxy.$modal.confirm('确认要提交该自评吗?').then(() => {
const submitData = { ...formData.value }
submitData.evaluationStatus = 'submitted'
if (submitData.id) {
return updateEvaluation(submitData).then(() => {
proxy.$modal.msgSuccess('提交成功')
dialogVisible.value = false
getList()
})
} else {
// 若无ID则作为独立提交入口兜底:走提交接口(按需)
return submitEvaluation(submitData.id)
.then(() => {
proxy.$modal.msgSuccess('提交成功')
dialogVisible.value = false
getList()
})
}
}).catch(() => {})
}
/** 锁定按钮操作 */
async function handleLock(row: CwProjectPerformanceSelfEvaluationVO) {
try {
await proxy.$modal.confirm('确定要锁定该绩效自评吗?锁定后将不允许修改。')
await lockEvaluation(row.id!)
proxy.$modal.msgSuccess('锁定成功')
getList()
} catch (error) {
console.error('锁定失败:', error)
}
}
/** 解锁按钮操作 */
async function handleUnlock(row: CwProjectPerformanceSelfEvaluationVO) {
try {
await proxy.$modal.confirm('确定要解锁该绩效自评吗?')
await unlockEvaluation(row.id!)
proxy.$modal.msgSuccess('解锁成功')
getList()
} catch (error) {
console.error('解锁失败:', error)
}
}
/** 批量锁定 */
async function handleBatchLock() {
if (ids.value.length === 0) {
proxy.$modal.msgWarning('请选择要锁定的数据')
return
}
try {
await proxy.$modal.confirm('确定要批量锁定选中的绩效自评吗?锁定后将不允许修改。')
await lockBatchEvaluation(ids.value)
proxy.$modal.msgSuccess('批量锁定成功')
getList()
} catch (error) {
console.error('批量锁定失败:', error)
}
}
/** 批量解锁 */
async function handleBatchUnlock() {
if (ids.value.length === 0) {
proxy.$modal.msgWarning('请选择要解锁的数据')
return
}
try {
await proxy.$modal.confirm('确定要批量解锁选中的绩效自评吗?')
await unlockBatchEvaluation(ids.value)
proxy.$modal.msgSuccess('批量解锁成功')
getList()
} catch (error) {
console.error('批量解锁失败:', error)
}
}
onMounted(() => {
getList()
})
</script>
<style scoped lang="scss">
</style>