提交代码

This commit is contained in:
zlwu committed 2025-11-14 06:49:39 +08:00
1 parent 970979b2c1
commit dfd5f361fa
2 files changed
+426 -348

No files matched your search

+361 -326
View File
@@ -7,39 +7,46 @@
<el-form :model="queryParams" ref="queryFormRef" label-width="100px"> <el-form :model="queryParams" ref="queryFormRef" label-width="100px">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="6"> <el-col :span="6">
<el-form-item label="项目名称" prop="projectName"> <el-form-item label="项目名称" prop="projectName">
<el-input v-model="queryParams.projectName" placeholder="请输入项目名称" clearable @keyup.enter="handleQuery" /> <el-input v-model="queryParams.projectName" placeholder="请输入项目名称" clearable @keyup.enter="handleQuery" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item label="自评年度" prop="evaluationYear"> <el-form-item label="自评年度" prop="evaluationYear">
<el-date-picker v-model="queryParams.evaluationYear" type="year" placeholder="选择年度" clearable value-format="YYYY" style="width: 100%" /> <el-date-picker
</el-form-item> v-model="queryParams.evaluationYear"
type="year"
placeholder="选择年度"
clearable
value-format="YYYY"
style="width: 100%"
/>
</el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item label="自评状态" prop="evaluationStatus"> <el-form-item label="自评状态" prop="evaluationStatus">
<el-select v-model="queryParams.evaluationStatus" placeholder="请选择自评状态" clearable style="width: 100%"> <el-select v-model="queryParams.evaluationStatus" placeholder="请选择自评状态" clearable style="width: 100%">
<el-option v-for="dict in cw_evaluation_status" :key="dict.value" :label="dict.label" :value="dict.value" /> <el-option v-for="dict in cw_evaluation_status" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item label="自评等级" prop="selfEvaluationLevel"> <el-form-item label="自评等级" prop="selfEvaluationLevel">
<el-select v-model="queryParams.selfEvaluationLevel" placeholder="请选择自评等级" clearable style="width: 100%"> <el-select v-model="queryParams.selfEvaluationLevel" placeholder="请选择自评等级" clearable style="width: 100%">
<el-option v-for="dict in cw_evaluation_level" :key="dict.value" :label="dict.label" :value="dict.value" /> <el-option v-for="dict in cw_evaluation_level" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="20"> <el-row>
<el-col :span="24"> <el-col :span="24" class="search-btn-container">
<el-form-item> <el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button> <el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
</el-card> </el-card>
</div> </div>
</transition> </transition>
@@ -47,15 +54,15 @@
<!-- 表格区域 --> <!-- 表格区域 -->
<el-card shadow="never" class="button-card table-card"> <el-card shadow="never" class="button-card table-card">
<template #header> <template #header>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['cw:evaluation:add']">新增自评</el-button> <el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['cw:evaluation:add']">新增自评</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button icon="Download" @click="handleExport" v-hasPermi="['cw:evaluation:export']">导出</el-button> <el-button icon="Download" @click="handleExport" v-hasPermi="['cw:evaluation:export']">导出</el-button>
</el-col> </el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
</template> </template>
<div class="table-container"> <div class="table-container">
@@ -68,32 +75,32 @@
class="scroll-table" class="scroll-table"
> >
<el-table-column type="selection" width="55" align="center" fixed="left" /> <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="projectName" show-overflow-tooltip min-width="200" />
<el-table-column label="申报编号" align="center" prop="applicationNo" width="150" /> <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="evaluationYear" width="100" />
<el-table-column label="自评总分" align="center" prop="totalScore" width="100"> <el-table-column label="自评总分" align="center" prop="totalScore" width="100">
<template #default="scope"> <template #default="scope">
<el-tag v-if="scope.row.totalScore >= 90" type="success" size="small">{{ scope.row.totalScore }}</el-tag> <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 >= 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 >= 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> <el-tag v-else-if="scope.row.totalScore" type="danger" size="small">{{ scope.row.totalScore }}</el-tag>
<span v-else>-</span> <span v-else>-</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="自评等级" align="center" prop="selfEvaluationLevel" width="100"> <el-table-column label="自评等级" align="center" prop="selfEvaluationLevel" width="100">
<template #default="scope"> <template #default="scope">
<el-tag v-if="scope.row.selfEvaluationLevel === '优秀'" type="success" size="small">优秀</el-tag> <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="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="warning" size="small">合格</el-tag>
<el-tag v-else-if="scope.row.selfEvaluationLevel === '不合格'" type="danger" size="small">不合格</el-tag> <el-tag v-else-if="scope.row.selfEvaluationLevel === '不合格'" type="danger" size="small">不合格</el-tag>
<span v-else>-</span> <span v-else>-</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="自评状态" align="center" prop="evaluationStatus" width="100"> <el-table-column label="自评状态" align="center" prop="evaluationStatus" width="100">
<template #default="scope"> <template #default="scope">
<dict-tag :options="cw_evaluation_status" :value="scope.row.evaluationStatus" /> <dict-tag :options="cw_evaluation_status" :value="scope.row.evaluationStatus" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="锁定状态" align="center" prop="isLocked" width="120"> <el-table-column label="锁定状态" align="center" prop="isLocked" width="120">
<template #default="scope"> <template #default="scope">
<el-tag v-if="scope.row.isLocked === 1" type="warning" effect="dark" size="small"> <el-tag v-if="scope.row.isLocked === 1" type="warning" effect="dark" size="small">
@@ -102,21 +109,43 @@
<el-tag v-else type="success" effect="plain" size="small">未锁定</el-tag> <el-tag v-else type="success" effect="plain" size="small">未锁定</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> <el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template #default="scope"> <template #default="scope">
<span>{{ parseTime(scope.row.createTime) }}</span> <span>{{ parseTime(scope.row.createTime) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" width="320" fixed="right" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" width="320" fixed="right" class-name="small-padding fixed-width">
<template #default="scope"> <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="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="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="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
<el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['cw:evaluation:remove']" v-if="scope.row.evaluationStatus === 'draft'"></el-button> link
</template> type="success"
</el-table-column> icon="Check"
</el-table> @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>
<!-- 分页组件 --> <!-- 分页组件 -->
@@ -126,44 +155,26 @@
</el-card> </el-card>
<!-- 新增/编辑/查看弹窗 - 使用表格样式 --> <!-- 新增/编辑/查看弹窗 - 使用表格样式 -->
<el-dialog <el-dialog v-model="dialogVisible" :title="dialogTitle" width="95%" top="5vh" :close-on-click-modal="false" destroy-on-close>
v-model="dialogVisible"
:title="dialogTitle"
width="95%"
top="5vh"
:close-on-click-modal="false"
destroy-on-close
>
<!-- 锁定状态提示 --> <!-- 锁定状态提示 -->
<el-alert <el-alert v-if="formData.isLocked === 1" type="warning" :closable="false" show-icon style="margin-bottom: 20px">
v-if="formData.isLocked === 1"
type="warning"
:closable="false"
show-icon
style="margin-bottom: 20px;"
>
<template #title> <template #title>
<span>该绩效自评已锁定,不允许修改。锁定时间:{{ formData.lockTime ? parseTime(formData.lockTime) : '-' }},锁定人:{{ formData.lockByName || '-' }}</span> <span
>该绩效自评已锁定,不允许修改。锁定时间:{{ formData.lockTime ? parseTime(formData.lockTime) : '-' }},锁定人:{{
formData.lockByName || '-'
}}</span
>
</template> </template>
</el-alert> </el-alert>
<!-- 使用表格样式组件 --> <!-- 使用表格样式组件 -->
<TableForm <TableForm ref="tableFormRef" :form-data="formData" :disabled="dialogMode === 'view' || formData.isLocked === 1" />
ref="tableFormRef"
:form-data="formData"
:disabled="dialogMode === 'view' || formData.isLocked === 1"
/>
<!-- 查看详情时显示运行监控数据 --> <!-- 查看详情时显示运行监控数据 -->
<div v-if="dialogMode === 'view'" style="margin-top: 30px;"> <div v-if="dialogMode === 'view'" style="margin-top: 30px">
<el-divider content-position="left"> <el-divider content-position="left">
<h3 style="margin: 0;">运行监控数据</h3> <h3 style="margin: 0">运行监控数据</h3>
</el-divider> </el-divider>
<el-table <el-table v-if="formData.monitoringList && formData.monitoringList.length > 0" :data="formData.monitoringList" border style="width: 100%">
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="序号" type="index" width="60" align="center" />
<el-table-column label="监控周期" align="center" prop="monitoringPeriod" width="150" /> <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="createTime" width="160">
@@ -177,12 +188,7 @@
<el-table-column label="绩效目标完成情况" align="center" prop="performanceTargetCompletion" 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"> <el-table-column label="操作" align="center" width="100" fixed="right">
<template #default="scope"> <template #default="scope">
<el-button <el-button link type="primary" icon="View" @click="handleViewMonitoringDetail(scope.row)">查看</el-button>
link
type="primary"
icon="View"
@click="handleViewMonitoringDetail(scope.row)"
>查看</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@@ -192,18 +198,8 @@
<template #footer> <template #footer>
<div class="dialog-footer"> <div class="dialog-footer">
<el-button @click="dialogVisible = false">{{ dialogMode === 'view' ? '关闭' : '取消' }}</el-button> <el-button @click="dialogVisible = false">{{ dialogMode === 'view' ? '关闭' : '取消' }}</el-button>
<el-button <el-button v-if="dialogMode !== 'view'" type="info" @click="handleSaveDraft" :disabled="formData.isLocked === 1">保存草稿</el-button>
v-if="dialogMode !== 'view'" <el-button v-if="dialogMode !== 'view'" type="primary" @click="handleFormSubmit" :disabled="formData.isLocked === 1">提交自评</el-button>
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> </div>
</template> </template>
</el-dialog> </el-dialog>
@@ -214,37 +210,49 @@
</template> </template>
<script setup name="CwEvaluation" lang="ts"> <script setup name="CwEvaluation" lang="ts">
import { Lock } from '@element-plus/icons-vue' import { Lock } from '@element-plus/icons-vue';
import { listEvaluation, getEvaluation, delEvaluation, addEvaluation, updateEvaluation, saveDraft, submitEvaluation, exportEvaluation, listPerformanceMonitoring } from '@/api/cw/performanceEvaluation' import {
import type { CwProjectPerformanceSelfEvaluationVO, CwProjectPerformanceSelfEvaluationQuery, CwProjectPerformanceSelfEvaluationForm } from '@/api/cw/performanceEvaluation' listEvaluation,
import TableForm from './table-form.vue' getEvaluation,
import MonitoringDialog from './components/MonitoringDialog.vue' 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 { proxy } = getCurrentInstance() as ComponentInternalInstance;
// 加载字典数据 // 加载字典数据
const { cw_evaluation_status, cw_evaluation_level } = toRefs<any>( const { cw_evaluation_status, cw_evaluation_level } = toRefs<any>(proxy?.useDict('cw_evaluation_status', 'cw_evaluation_level') || {});
proxy?.useDict('cw_evaluation_status', 'cw_evaluation_level') || {}
)
const evaluationList = ref<CwProjectPerformanceSelfEvaluationVO[]>([]) const evaluationList = ref<CwProjectPerformanceSelfEvaluationVO[]>([]);
const loading = ref(true) const loading = ref(true);
const showSearch = ref(true) const showSearch = ref(true);
const ids = ref<Array<number>>([]) const ids = ref<Array<number>>([]);
const single = ref(true) const single = ref(true);
const multiple = ref(true) const multiple = ref(true);
const total = ref(0) const total = ref(0);
const queryFormRef = ref<ElFormInstance>() const queryFormRef = ref<ElFormInstance>();
const formRef = ref<ElFormInstance>() const formRef = ref<ElFormInstance>();
const tableFormRef = ref<any>() const tableFormRef = ref<any>();
const monitoringDialogRef = ref<any>() const monitoringDialogRef = ref<any>();
// 弹窗相关状态 // 弹窗相关状态
const dialogVisible = ref(false) const dialogVisible = ref(false);
const dialogTitle = ref('') const dialogTitle = ref('');
const dialogMode = ref<'add' | 'edit' | 'view'>('add') const dialogMode = ref<'add' | 'edit' | 'view'>('add');
const dateRange = ref<string[]>([]) const dateRange = ref<string[]>([]);
// 表单数据 // 表单数据
// 🔧 修复:初始化完整的表单对象,包含所有字段 // 🔧 修复:初始化完整的表单对象,包含所有字段
@@ -378,7 +386,7 @@ const formData = ref<CwProjectPerformanceSelfEvaluationForm>({
// 运行监控数据列表(查看详情时返回) // 运行监控数据列表(查看详情时返回)
monitoringList: [] as any[] monitoringList: [] as any[]
}) });
// 表单验证规则 // 表单验证规则
const rules = ref({ const rules = ref({
@@ -400,10 +408,10 @@ const rules = ref({
{ required: true, message: '项目效益得分不能为空', trigger: 'blur' }, { required: true, message: '项目效益得分不能为空', trigger: 'blur' },
{ type: 'number', min: 0, max: 30, message: '得分范围0-30分', trigger: 'blur' } { type: 'number', min: 0, max: 30, message: '得分范围0-30分', trigger: 'blur' }
] ]
}) });
const data = reactive<{ const data = reactive<{
queryParams: CwProjectPerformanceSelfEvaluationQuery queryParams: CwProjectPerformanceSelfEvaluationQuery;
}>({ }>({
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
@@ -413,78 +421,72 @@ const data = reactive<{
evaluationStatus: undefined, evaluationStatus: undefined,
selfEvaluationLevel: undefined selfEvaluationLevel: undefined
} }
}) });
const { queryParams } = toRefs(data) const { queryParams } = toRefs(data);
// 计算总分 // 计算总分
const totalScore = computed(() => { const totalScore = computed(() => {
return (formData.value.decisionScore || 0) + return (
(formData.value.processScore || 0) + (formData.value.decisionScore || 0) + (formData.value.processScore || 0) + (formData.value.outputScore || 0) + (formData.value.benefitScore || 0)
(formData.value.outputScore || 0) + );
(formData.value.benefitScore || 0) });
})
const totalScoreDisplay = computed(() => totalScore.value.toFixed(2)) const totalScoreDisplay = computed(() => totalScore.value.toFixed(2));
// 自动计算等级 // 自动计算等级
const evaluationLevel = computed(() => { const evaluationLevel = computed(() => {
const score = totalScore.value const score = totalScore.value;
if (score >= 90) return '优秀' if (score >= 90) return '优秀';
if (score >= 80) return '良好' if (score >= 80) return '良好';
if (score >= 60) return '合格' if (score >= 60) return '合格';
return '不合格' return '不合格';
}) });
const evaluationLevelDisplay = computed(() => evaluationLevel.value) const evaluationLevelDisplay = computed(() => evaluationLevel.value);
const levelTagType = computed(() => { const levelTagType = computed(() => {
const level = evaluationLevel.value const level = evaluationLevel.value;
if (level === '优秀') return 'success' if (level === '优秀') return 'success';
if (level === '良好') return 'primary' if (level === '良好') return 'primary';
if (level === '合格') return 'warning' if (level === '合格') return 'warning';
return 'danger' return 'danger';
}) });
// 计算预算执行率 // 计算预算执行率
const budgetExecutionRate = computed(() => { const budgetExecutionRate = computed(() => {
if (formData.value.annualBudget && formData.value.actualExpenditure) { if (formData.value.annualBudget && formData.value.actualExpenditure) {
return (formData.value.actualExpenditure / formData.value.annualBudget * 100).toFixed(2) return ((formData.value.actualExpenditure / formData.value.annualBudget) * 100).toFixed(2);
} }
return '0.00' return '0.00';
}) });
const budgetExecutionRateDisplay = computed(() => budgetExecutionRate.value) const budgetExecutionRateDisplay = computed(() => budgetExecutionRate.value);
// 监听评分变化,自动更新总分和等级 // 监听评分变化,自动更新总分和等级
watch([ watch(
() => formData.value.decisionScore, [() => formData.value.decisionScore, () => formData.value.processScore, () => formData.value.outputScore, () => formData.value.benefitScore],
() => formData.value.processScore, () => {
() => formData.value.outputScore, formData.value.totalScore = totalScore.value;
() => formData.value.benefitScore formData.value.selfEvaluationLevel = evaluationLevel.value;
], () => { }
formData.value.totalScore = totalScore.value );
formData.value.selfEvaluationLevel = evaluationLevel.value
})
// 监听预算和支出变化,自动更新执行率 // 监听预算和支出变化,自动更新执行率
watch([ watch([() => formData.value.annualBudget, () => formData.value.actualExpenditure], () => {
() => formData.value.annualBudget,
() => formData.value.actualExpenditure
], () => {
if (formData.value.annualBudget && formData.value.actualExpenditure) { if (formData.value.annualBudget && formData.value.actualExpenditure) {
formData.value.budgetExecutionRate = parseFloat(budgetExecutionRate.value) formData.value.budgetExecutionRate = parseFloat(budgetExecutionRate.value);
} }
}) });
// 处理日期范围变化 // 处理日期范围变化
function handleDateRangeChange(dates: string[]) { function handleDateRangeChange(dates: string[]) {
if (dates && dates.length === 2) { if (dates && dates.length === 2) {
formData.value.startDate = dates[0] formData.value.startDate = dates[0];
formData.value.endDate = dates[1] formData.value.endDate = dates[1];
} else { } else {
formData.value.startDate = undefined formData.value.startDate = undefined;
formData.value.endDate = undefined formData.value.endDate = undefined;
} }
} }
@@ -618,14 +620,14 @@ function resetForm() {
improvementMeasures: '', improvementMeasures: '',
evaluationStatus: 'draft', evaluationStatus: 'draft',
remark: '' remark: ''
} };
dateRange.value = [] dateRange.value = [];
formRef.value?.resetFields() formRef.value?.resetFields();
} }
/** 转换后端返回的字符串数字为真实数字类型 */ /** 转换后端返回的字符串数字为真实数字类型 */
function convertNumberFields(data: any) { function convertNumberFields(data: any) {
if (!data) return data if (!data) return data;
// 需要转换为数字的字段列表 // 需要转换为数字的字段列表
const numberFields = [ const numberFields = [
@@ -676,201 +678,203 @@ function convertNumberFields(data: any) {
'socialValue', 'socialValue',
'ecologicalValue', 'ecologicalValue',
'satisfactionValue' 'satisfactionValue'
] ];
// 转换字段类型:将字符串数字转为真实数字 // 转换字段类型:将字符串数字转为真实数字
numberFields.forEach(field => { numberFields.forEach((field) => {
if (data[field] !== null && data[field] !== undefined && data[field] !== '') { if (data[field] !== null && data[field] !== undefined && data[field] !== '') {
// 如果是字符串,转为数字 // 如果是字符串,转为数字
if (typeof data[field] === 'string') { if (typeof data[field] === 'string') {
data[field] = Number(data[field]) data[field] = Number(data[field]);
} }
} }
}) });
return data return data;
} }
/** 查询项目绩效自评列表 */ /** 查询项目绩效自评列表 */
async function getList() { async function getList() {
loading.value = true loading.value = true;
try { try {
const response = await listEvaluation(queryParams.value) const response = await listEvaluation(queryParams.value);
evaluationList.value = response.rows evaluationList.value = response.rows;
// 并行查询所有项目的运行监控数据 // 并行查询所有项目的运行监控数据
const monitoringPromises = evaluationList.value const monitoringPromises = evaluationList.value
.filter(item => item.id) .filter((item) => item.id)
.map(async (item) => { .map(async (item) => {
try { try {
const monitoringResponse = await listPerformanceMonitoring(item.id!) const monitoringResponse = await listPerformanceMonitoring(item.id!);
// 如果有运行监控数据,设置hasMonitoringData为true;否则为false // 如果有运行监控数据,设置hasMonitoringData为true;否则为false
item.hasMonitoringData = monitoringResponse.data && monitoringResponse.data.length > 0 item.hasMonitoringData = monitoringResponse.data && monitoringResponse.data.length > 0;
} catch (error) { } catch (error) {
// 如果查询失败,默认不显示运行监控按钮 // 如果查询失败,默认不显示运行监控按钮
item.hasMonitoringData = false item.hasMonitoringData = false;
} }
}) });
// 等待所有查询完成 // 等待所有查询完成
await Promise.all(monitoringPromises) await Promise.all(monitoringPromises);
// 为没有ID的项目设置默认值 // 为没有ID的项目设置默认值
evaluationList.value.forEach(item => { evaluationList.value.forEach((item) => {
if (!item.id) { if (!item.id) {
item.hasMonitoringData = false item.hasMonitoringData = false;
} }
}) });
total.value = response.total total.value = response.total;
} catch (error) { } catch (error) {
console.error('查询列表失败:', error) console.error('查询列表失败:', error);
} finally { } finally {
loading.value = false loading.value = false;
} }
} }
/** 搜索按钮操作 */ /** 搜索按钮操作 */
function handleQuery() { function handleQuery() {
queryParams.value.pageNum = 1 queryParams.value.pageNum = 1;
getList() getList();
} }
/** 重置按钮操作 */ /** 重置按钮操作 */
function resetQuery() { function resetQuery() {
queryFormRef.value?.resetFields() queryFormRef.value?.resetFields();
handleQuery() handleQuery();
} }
/** 多选框选中数据 */ /** 多选框选中数据 */
function handleSelectionChange(selection: CwProjectPerformanceSelfEvaluationVO[]) { function handleSelectionChange(selection: CwProjectPerformanceSelfEvaluationVO[]) {
ids.value = selection.map(item => item.id!) ids.value = selection.map((item) => item.id!);
single.value = selection.length !== 1 single.value = selection.length !== 1;
multiple.value = !selection.length multiple.value = !selection.length;
} }
/** 新增按钮操作 */ /** 新增按钮操作 */
async function handleAdd() { async function handleAdd() {
resetForm() resetForm();
dialogMode.value = 'add' dialogMode.value = 'add';
dialogTitle.value = '新增项目绩效自评' dialogTitle.value = '新增项目绩效自评';
// 等待下一个tick,确保formData完全初始化后再打开对话框 // 等待下一个tick,确保formData完全初始化后再打开对话框
await nextTick() await nextTick();
dialogVisible.value = true dialogVisible.value = true;
} }
/** 查看按钮操作 */ /** 查看按钮操作 */
async function handleView(row: CwProjectPerformanceSelfEvaluationVO) { async function handleView(row: CwProjectPerformanceSelfEvaluationVO) {
resetForm() resetForm();
dialogMode.value = 'view' dialogMode.value = 'view';
dialogTitle.value = '查看项目绩效自评' dialogTitle.value = '查看项目绩效自评';
const response = await getEvaluation(row.id!) const response = await getEvaluation(row.id!);
// 🔍 调试:打印后端返回的原始数据 // 🔍 调试:打印后端返回的原始数据
console.log('🔍 后端返回的原始数据:', response.data) console.log('🔍 后端返回的原始数据:', response.data);
console.log('🔍 检查关键字段是否存在:') console.log('🔍 检查关键字段是否存在:');
console.log(' - quantityIndicator:', response.data.quantityIndicator) console.log(' - quantityIndicator:', response.data.quantityIndicator);
console.log(' - qualityIndicator:', response.data.qualityIndicator) console.log(' - qualityIndicator:', response.data.qualityIndicator);
console.log(' - performanceGoal:', response.data.performanceGoal) console.log(' - performanceGoal:', response.data.performanceGoal);
console.log(' - existingProblems:', response.data.existingProblems) console.log(' - existingProblems:', response.data.existingProblems);
console.log(' - monitoringList:', response.data.monitoringList) console.log(' - monitoringList:', response.data.monitoringList);
console.log(' - monitoringList长度:', response.data.monitoringList?.length) console.log(' - monitoringList长度:', response.data.monitoringList?.length);
// 🔧 修复:转换后端返回的字符串数字为真实数字类型 // 🔧 修复:转换后端返回的字符串数字为真实数字类型
formData.value = convertNumberFields(response.data) formData.value = convertNumberFields(response.data);
// 🔍 调试:打印转换后的数据 // 🔍 调试:打印转换后的数据
console.log('🔍 转换后的formData:', formData.value) console.log('🔍 转换后的formData:', formData.value);
console.log('🔍 转换后的monitoringList:', formData.value.monitoringList) console.log('🔍 转换后的monitoringList:', formData.value.monitoringList);
if (response.data.startDate && response.data.endDate) { if (response.data.startDate && response.data.endDate) {
dateRange.value = [response.data.startDate, response.data.endDate] dateRange.value = [response.data.startDate, response.data.endDate];
} }
// 等待下一个tick,确保formData完全更新后再打开对话框 // 等待下一个tick,确保formData完全更新后再打开对话框
await nextTick() await nextTick();
dialogVisible.value = true dialogVisible.value = true;
} }
/** 修改按钮操作 */ /** 修改按钮操作 */
async function handleUpdate(row: CwProjectPerformanceSelfEvaluationVO) { async function handleUpdate(row: CwProjectPerformanceSelfEvaluationVO) {
// 🔒 检查是否已锁定 // 🔒 检查是否已锁定
if (row.isLocked === 1) { if (row.isLocked === 1) {
proxy?.$modal.msgWarning('该绩效自评已锁定,不允许修改。如需修改,请联系财务管理员或学校领导解锁') proxy?.$modal.msgWarning('该绩效自评已锁定,不允许修改。如需修改,请联系财务管理员或学校领导解锁');
return return;
} }
resetForm() resetForm();
dialogMode.value = 'edit' dialogMode.value = 'edit';
dialogTitle.value = '编辑项目绩效自评' dialogTitle.value = '编辑项目绩效自评';
const response = await getEvaluation(row.id!) const response = await getEvaluation(row.id!);
// 🔧 修复:转换后端返回的字符串数字为真实数字类型 // 🔧 修复:转换后端返回的字符串数字为真实数字类型
formData.value = convertNumberFields(response.data) formData.value = convertNumberFields(response.data);
// 🔒 再次检查锁定状态(防止数据被锁定) // 🔒 再次检查锁定状态(防止数据被锁定)
if (formData.value.isLocked === 1) { if (formData.value.isLocked === 1) {
proxy?.$modal.msgWarning('该绩效自评已锁定,不允许修改。如需修改,请联系财务管理员或学校领导解锁') proxy?.$modal.msgWarning('该绩效自评已锁定,不允许修改。如需修改,请联系财务管理员或学校领导解锁');
return return;
} }
if (response.data.startDate && response.data.endDate) { if (response.data.startDate && response.data.endDate) {
dateRange.value = [response.data.startDate, response.data.endDate] dateRange.value = [response.data.startDate, response.data.endDate];
} }
// 等待下一个tick,确保formData完全更新后再打开对话框 // 等待下一个tick,确保formData完全更新后再打开对话框
await nextTick() await nextTick();
dialogVisible.value = true dialogVisible.value = true;
} }
/** 运行监控按钮操作 */ /** 运行监控按钮操作 */
function handleMonitoring(row: CwProjectPerformanceSelfEvaluationVO) { function handleMonitoring(row: CwProjectPerformanceSelfEvaluationVO) {
monitoringDialogRef.value?.open(row.id) monitoringDialogRef.value?.open(row.id);
} }
/** 查看运行监控详情 */ /** 查看运行监控详情 */
function handleViewMonitoringDetail(row: any) { function handleViewMonitoringDetail(row: any) {
if (!row.id || !row.evaluationId) { if (!row.id || !row.evaluationId) {
proxy?.$modal.msgError('数据异常,无法查看详情') proxy?.$modal.msgError('数据异常,无法查看详情');
return return;
} }
monitoringDialogRef.value?.viewDetail(row.id, row.evaluationId) monitoringDialogRef.value?.viewDetail(row.id, row.evaluationId);
} }
/** 保存草稿 */ /** 保存草稿 */
function handleSaveDraft() { function handleSaveDraft() {
// 🔒 检查是否已锁定 // 🔒 检查是否已锁定
if (formData.value.isLocked === 1) { if (formData.value.isLocked === 1) {
proxy?.$modal.msgWarning('该绩效自评已锁定,不允许修改。如需修改,请联系财务管理员或学校领导解锁') proxy?.$modal.msgWarning('该绩效自评已锁定,不允许修改。如需修改,请联系财务管理员或学校领导解锁');
return return;
} }
saveDraft(formData.value).then(() => { saveDraft(formData.value)
proxy?.$modal.msgSuccess('保存草稿成功') .then(() => {
dialogVisible.value = false proxy?.$modal.msgSuccess('保存草稿成功');
getList() dialogVisible.value = false;
}).catch((error: any) => { getList();
// 后端也会检查锁定状态,这里捕获错误提示 })
if (error?.msg?.includes('锁定')) { .catch((error: any) => {
proxy?.$modal.msgError(error.msg) // 后端也会检查锁定状态,这里捕获错误提示
} if (error?.msg?.includes('锁定')) {
}) proxy?.$modal.msgError(error.msg);
}
});
} }
/** 提交自评 */ /** 提交自评 */
function handleFormSubmit() { function handleFormSubmit() {
// 🔒 检查是否已锁定 // 🔒 检查是否已锁定
if (formData.value.isLocked === 1) { if (formData.value.isLocked === 1) {
proxy?.$modal.msgWarning('该绩效自评已锁定,不允许提交。如需提交,请联系财务管理员或学校领导解锁') proxy?.$modal.msgWarning('该绩效自评已锁定,不允许提交。如需提交,请联系财务管理员或学校领导解锁');
return return;
} }
// 先调用表格表单的分值校验(提示性质,不阻止提交) // 先调用表格表单的分值校验(提示性质,不阻止提交)
if (tableFormRef.value?.validateTotalValue) { if (tableFormRef.value?.validateTotalValue) {
tableFormRef.value.validateTotalValue() tableFormRef.value.validateTotalValue();
} }
// 🔍 调试:打印提交前的完整数据 // 🔍 调试:打印提交前的完整数据
console.log('=== 提交前的formData.value ===', JSON.stringify(formData.value, null, 2)) console.log('=== 提交前的formData.value ===', JSON.stringify(formData.value, null, 2));
console.log('=== 关键字段检查 ===', { console.log('=== 关键字段检查 ===', {
totalScore: formData.value.totalScore, totalScore: formData.value.totalScore,
decisionScore: formData.value.decisionScore, decisionScore: formData.value.decisionScore,
@@ -879,94 +883,113 @@ function handleFormSubmit() {
benefitScore: formData.value.benefitScore, benefitScore: formData.value.benefitScore,
selfEvaluationLevel: formData.value.selfEvaluationLevel, selfEvaluationLevel: formData.value.selfEvaluationLevel,
budgetExecutionRate: formData.value.budgetExecutionRate budgetExecutionRate: formData.value.budgetExecutionRate
}) });
// 提交数据(不再需要表单校验,因为是表格式填写) // 提交数据(不再需要表单校验,因为是表格式填写)
proxy?.$modal.confirm('确认要提交该自评吗?').then(() => { proxy?.$modal
const submitData = { ...formData.value } .confirm('确认要提交该自评吗?')
submitData.evaluationStatus = 'submitted' .then(() => {
const submitData = { ...formData.value };
submitData.evaluationStatus = 'submitted';
// 🔍 调试:打印即将提交的数据 // 🔍 调试:打印即将提交的数据
console.log('=== 即将提交的数据 ===', JSON.stringify(submitData, null, 2)) console.log('=== 即将提交的数据 ===', JSON.stringify(submitData, null, 2));
if (formData.value.id) { if (formData.value.id) {
// 编辑模式:直接更新 // 编辑模式:直接更新
return updateEvaluation(submitData).then((response) => { return updateEvaluation(submitData)
proxy?.$modal.msgSuccess('提交成功') .then((response) => {
dialogVisible.value = false proxy?.$modal.msgSuccess('提交成功');
getList() dialogVisible.value = false;
}).catch((error: any) => { getList();
// 后端也会检查锁定状态,这里捕获错误提示 })
if (error?.msg?.includes('锁定')) { .catch((error: any) => {
proxy?.$modal.msgError(error.msg) // 后端也会检查锁定状态,这里捕获错误提示
} else { if (error?.msg?.includes('锁定')) {
console.error('提交失败:', error) proxy?.$modal.msgError(error.msg);
} } else {
}) console.error('提交失败:', error);
} else { }
// 新增模式:先保存获取ID,再更新状态 });
return addEvaluation(submitData).then((response) => { } else {
console.log('新增返回结果:', response) // 新增模式:先保存获取ID,再更新状态
if (response.data) { return addEvaluation(submitData)
formData.value.id = response.data .then((response) => {
console.log('新增成功,获得ID:', formData.value.id) console.log('新增返回结果:', response);
} if (response.data) {
proxy?.$modal.msgSuccess('提交成功') formData.value.id = response.data;
dialogVisible.value = false console.log('新增成功,获得ID:', formData.value.id);
getList() }
}).catch((error: any) => { proxy?.$modal.msgSuccess('提交成功');
// 后端也会检查锁定状态,这里捕获错误提示 dialogVisible.value = false;
if (error?.msg?.includes('锁定')) { getList();
proxy?.$modal.msgError(error.msg) })
} else { .catch((error: any) => {
console.error('提交失败:', error) // 后端也会检查锁定状态,这里捕获错误提示
} if (error?.msg?.includes('锁定')) {
}) proxy?.$modal.msgError(error.msg);
} } else {
}).catch((error) => { console.error('提交失败:', error);
console.error('提交失败:', error) }
}) });
}
})
.catch((error) => {
console.error('提交失败:', error);
});
} }
/** 提交按钮操作 */ /** 提交按钮操作 */
function handleSubmit(row: CwProjectPerformanceSelfEvaluationVO) { function handleSubmit(row: CwProjectPerformanceSelfEvaluationVO) {
// 🔒 检查是否已锁定 // 🔒 检查是否已锁定
if (row.isLocked === 1) { if (row.isLocked === 1) {
proxy?.$modal.msgWarning('该绩效自评已锁定,不允许提交。如需提交,请联系财务管理员或学校领导解锁') proxy?.$modal.msgWarning('该绩效自评已锁定,不允许提交。如需提交,请联系财务管理员或学校领导解锁');
return return;
} }
proxy?.$modal.confirm('确认要提交该自评吗?提交后将不能修改。').then(() => { proxy?.$modal
return submitEvaluation(row.id!) .confirm('确认要提交该自评吗?提交后将不能修改。')
}).then(() => { .then(() => {
getList() return submitEvaluation(row.id!);
proxy?.$modal.msgSuccess('提交成功') })
}).catch(() => {}) .then(() => {
getList();
proxy?.$modal.msgSuccess('提交成功');
})
.catch(() => {});
} }
/** 删除按钮操作 */ /** 删除按钮操作 */
function handleDelete(row?: CwProjectPerformanceSelfEvaluationVO) { function handleDelete(row?: CwProjectPerformanceSelfEvaluationVO) {
const evaluationIds = row?.id || ids.value const evaluationIds = row?.id || ids.value;
proxy?.$modal.confirm('是否确认删除选中的项目绩效自评?').then(() => { proxy?.$modal
return delEvaluation(evaluationIds) .confirm('是否确认删除选中的项目绩效自评?')
}).then(() => { .then(() => {
getList() return delEvaluation(evaluationIds);
proxy?.$modal.msgSuccess('删除成功') })
}).catch(() => {}) .then(() => {
getList();
proxy?.$modal.msgSuccess('删除成功');
})
.catch(() => {});
} }
/** 导出按钮操作 */ /** 导出按钮操作 */
function handleExport() { function handleExport() {
proxy?.$modal.confirm('是否确认导出所有项目绩效自评数据?').then(() => { proxy?.$modal
return exportEvaluation(queryParams.value) .confirm('是否确认导出所有项目绩效自评数据?')
}).then((response: any) => { .then(() => {
proxy?.$download.saveAs(response, '项目绩效自评.xlsx') return exportEvaluation(queryParams.value);
}).catch(() => {}) })
.then((response: any) => {
proxy?.$download.saveAs(response, '项目绩效自评.xlsx');
})
.catch(() => {});
} }
onMounted(() => { onMounted(() => {
getList() getList();
}) });
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@@ -994,4 +1017,16 @@ onMounted(() => {
max-height: 70vh; max-height: 70vh;
overflow-y: auto; overflow-y: auto;
} }
/* 搜索按钮容器样式 */
.search-btn-container {
display: flex;
justify-content: flex-end;
margin-top: 10px;
.el-form-item {
margin-bottom: 0 !important;
}
}
</style> </style>
+65 -22
View File
@@ -3,28 +3,60 @@
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave"> <transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div ref="searchRef" v-show="showSearch" class="mb-[10px]"> <div ref="searchRef" v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover"> <el-card shadow="hover">
<el-form ref="queryFormRef" :model="queryParams" :inline="true"> <el-form ref="queryFormRef" :model="queryParams" label-width="100px">
<el-form-item label="问卷编号" prop="surveyCode"> <el-row :gutter="20">
<el-input v-model="queryParams.surveyCode" placeholder="请输入问卷编号" clearable @keyup.enter="handleQuery" /> <el-col :span="6">
</el-form-item> <el-form-item label="问卷编号" prop="surveyCode">
<el-form-item label="问卷标题" prop="surveyTitle"> <el-input v-model="queryParams.surveyCode" placeholder="请输入问卷编号" clearable @keyup.enter="handleQuery" />
<el-input v-model="queryParams.surveyTitle" placeholder="请输入问卷标题" clearable @keyup.enter="handleQuery" /> </el-form-item>
</el-form-item> </el-col>
<el-form-item label="开始时间" prop="startTime"> <el-col :span="6">
<el-date-picker clearable v-model="queryParams.startTime" type="date" value-format="YYYY-MM-DD" placeholder="请选择开始时间" /> <el-form-item label="问卷标题" prop="surveyTitle">
</el-form-item> <el-input v-model="queryParams.surveyTitle" placeholder="请输入问卷标题" clearable @keyup.enter="handleQuery" />
<el-form-item label="结束时间" prop="endTime"> </el-form-item>
<el-date-picker clearable v-model="queryParams.endTime" type="date" value-format="YYYY-MM-DD" placeholder="请选择结束时间" /> </el-col>
</el-form-item> <el-col :span="6">
<el-form-item label="是否匿名" prop="isAnonymous"> <el-form-item label="开始时间" prop="startTime">
<el-select v-model="queryParams.isAnonymous" placeholder="请选择是否匿名" clearable> <el-date-picker
<el-option v-for="dict in sys_yesno" :key="dict.value" :label="dict.label" :value="dict.value" /> clearable
</el-select> v-model="queryParams.startTime"
</el-form-item> type="date"
<el-form-item> value-format="YYYY-MM-DD"
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button> placeholder="请选择开始时间"
<el-button icon="Refresh" @click="resetQuery">重置</el-button> style="width: 100%"
</el-form-item> />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="结束时间" prop="endTime">
<el-date-picker
clearable
v-model="queryParams.endTime"
type="date"
value-format="YYYY-MM-DD"
placeholder="请选择结束时间"
style="width: 100%"
/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="6">
<el-form-item label="是否匿名" prop="isAnonymous">
<el-select v-model="queryParams.isAnonymous" placeholder="请选择是否匿名" clearable>
<el-option v-for="dict in sys_yesno" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24" class="search-btn-container">
<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-form>
</el-card> </el-card>
</div> </div>
@@ -2028,6 +2060,17 @@ onMounted(() => {
padding: 0px 20px 20px 20px !important; padding: 0px 20px 20px 20px !important;
} }
/* 检索栏按钮容器样式 */
.search-btn-container {
display: flex;
justify-content: flex-end;
margin-top: 10px;
.el-form-item {
margin-bottom: 0 !important;
}
}
/* 表格容器 - 支持横向滚动 */ /* 表格容器 - 支持横向滚动 */
.table-container { .table-container {
width: 100%; width: 100%;