Merge branch 'developer' of ssh://code.cyweb.top:30033/scj/zhxy/v3/cloud-ui into developer

This commit is contained in:
吴红兵
2026-03-11 22:14:47 +08:00
3 changed files with 333 additions and 289 deletions

View File

@@ -140,6 +140,13 @@
</el-tag>
<span v-else>-</span>
</template>
<!-- 学期班费结余列特殊模板 -->
<template v-else-if="col.prop === 'termBalance'" #default="scope">
<el-tag v-if="scope.row.termBalance !== null && scope.row.termBalance !== undefined" :type="scope.row.termBalance >= 0 ? 'success' : 'danger'" size="small" effect="plain" round>
¥{{ scope.row.termBalance.toFixed(2) }}
</el-tag>
<span v-else>-</span>
</template>
<!-- 附件列特殊模板 -->
<template v-else-if="col.prop === 'attachment'" #default="scope">
<el-button v-if="scope.row.attachment" icon="Document" link type="primary" size="small" @click="handleViewAttachment(scope.row)">
@@ -328,6 +335,7 @@ const tableColumns = [
{ prop: 'operatTime', label: '发生时间', icon: Calendar, width: 180 },
{ prop: 'type', label: '类型', icon: Collection },
{ prop: 'money', label: '金额', icon: Money },
{ prop: 'termBalance', label: '学期班费结余', icon: Money, width: 120 },
{ prop: 'operator', label: '经办人', icon: User },
{ prop: 'purpose', label: '用途', icon: Document, minWidth: 150 },
{ prop: 'attachment', label: '附件', width: 100 },
@@ -345,7 +353,41 @@ const state: BasicTableProps = reactive<BasicTableProps>({
classCode: '',
type: '',
},
pageList: fetchList,
pageList: async (params: any) => {
const res = await fetchList(params);
// 后端返回数据结构IPage<ClassFeeLogRelationVO>
// ClassFeeLogRelationVO 包含 moneyTotal 和 classFeeLogVOList
if (res.data && res.data.records) {
// 展开所有班级的班费记录
const allRecords: any[] = [];
let totalMoney: number = 0;
res.data.records.forEach((item: any) => {
if (item.classFeeLogVOList && Array.isArray(item.classFeeLogVOList)) {
item.classFeeLogVOList.forEach((log: any) => {
allRecords.push({
...log,
moneyTotal: item.moneyTotal // 添加班费结余到每条记录
});
});
}
// 记录总班费结余
if (item.moneyTotal !== undefined) {
totalMoney = item.moneyTotal;
}
});
return {
...res,
data: {
records: allRecords,
total: allRecords.length,
moneyTotal: totalMoney // 保留总结余
}
};
}
return res;
},
props: {
item: 'records',
totalCount: 'total',

View File

@@ -1,9 +1,17 @@
<template>
<div class="layout-padding">
<div class="layout-padding-auto layout-padding-view">
<!-- 搜索表单 -->
<el-row v-show="showSearch">
<el-form :model="queryForm" ref="searchFormRef" :inline="true" @keyup.enter="getDataList">
<div class="modern-page-container">
<div class="page-wrapper">
<!-- 搜索表单卡片 -->
<el-card v-show="showSearch" class="search-card" shadow="never">
<template #header>
<div class="card-header">
<span class="card-title">
<el-icon class="title-icon"><Search /></el-icon>
筛选条件
</span>
</div>
</template>
<el-form :model="queryForm" ref="searchFormRef" :inline="true" @keyup.enter="getDataList" class="search-form">
<el-form-item label="学年" prop="schoolYear">
<el-select
v-model="queryForm.schoolYear"
@@ -54,15 +62,25 @@
<el-button type="warning" icon="Bell" @click="handleSendWarning" :loading="warningLoading">发送预警</el-button>
</el-form-item>
</el-form>
</el-row>
</el-card>
<!-- 统计表格 -->
<el-row style="margin-bottom: 20px">
<!-- 内容卡片 -->
<el-card class="content-card" shadow="never">
<template #header>
<div class="card-header">
<span class="card-title">
<el-icon class="title-icon"><Document /></el-icon>
学期操行考核统计
</span>
</div>
</template>
<!-- 统计表格 -->
<el-table
:data="statisticsData"
v-loading="loading"
border
style="width: 100%"
stripe
style="width: 100%; margin-bottom: 20px"
:cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle"
>
@@ -73,50 +91,52 @@
<el-table-column prop="pass" label="及格" min-width="100" align="center" />
<el-table-column prop="fail" label="不及格" min-width="100" align="center" />
</el-table>
</el-row>
<!-- 学生列表表格 -->
<el-row>
<!-- 学生列表表格 -->
<el-table
:data="studentList"
v-loading="loading"
border
:max-height="600"
stripe
style="width: 100%"
:cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle"
>
<el-table-column type="index" label="序号" width="60" align="center" />
<el-table-column prop="stuNo" label="学号" show-overflow-tooltip align="center" />
<el-table-column prop="realName" label="姓名" show-overflow-tooltip align="center" />
<el-table-column prop="score" label="学期总评" show-overflow-tooltip align="center">
<el-table-column type="index" label="序号" width="70" align="center" />
<el-table-column prop="stuNo" label="学号" min-width="120" show-overflow-tooltip align="center" />
<el-table-column prop="realName" label="姓名" min-width="100" show-overflow-tooltip align="center" />
<!-- 各月份分数 -->
<el-table-column v-for="(month, index) in monthColumns" :key="index" :label="month.label" min-width="70" align="center">
<template #default="scope">
<span>{{ scope.row.score !== null && scope.row.score !== undefined ? scope.row.score.toFixed(2) : '-' }}</span>
<span>{{ formatScore(scope.row[month.prop]) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="150" align="center" fixed="right">
<!-- 学期总评 -->
<el-table-column prop="scoreOneTerm" label="学期总评" min-width="100" align="center">
<template #default="scope">
<el-button icon="View" text type="primary" @click="handleView(scope.row)"> 查看 </el-button>
<el-tag :type="getScoreType(scope.row.scoreOneTerm)" size="small" effect="plain">
{{ formatScore(scope.row.scoreOneTerm) }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="100" align="center" fixed="right">
<template #default="scope">
<el-button icon="View" link type="primary" @click="handleView(scope.row)">查看</el-button>
</template>
</el-table-column>
</el-table>
</el-row>
</el-card>
</div>
<!-- 查看详情弹窗接口queryDataByStuNo 通过学年学号查看详情按当前学期筛选 -->
<el-dialog
v-model="viewDialogVisible"
title="学期操行考核详情"
width="800px"
destroy-on-close
@close="viewDetailList = []">
<!-- 查看详情弹窗 -->
<el-dialog v-model="viewDialogVisible" title="学期操行考核详情" width="900px" destroy-on-close @close="viewDetailList = []">
<div v-if="viewRow" class="view-summary">
<el-descriptions :column="2" border size="small">
<el-descriptions :column="3" border size="small">
<el-descriptions-item label="学号">{{ viewRow.stuNo }}</el-descriptions-item>
<el-descriptions-item label="姓名">{{ viewRow.realName }}</el-descriptions-item>
<el-descriptions-item label="学">{{ queryForm.schoolYear }}</el-descriptions-item>
<el-descriptions-item label="学期">{{ formatSchoolTerm(queryForm.schoolTerm) }}</el-descriptions-item>
<el-descriptions-item label="学期总评" :span="2">
{{ viewRow.score != null && viewRow.score !== undefined ? Number(viewRow.score).toFixed(2) : '-' }}
<el-descriptions-item label="学期总评">
<el-tag :type="getScoreType(viewRow.scoreOneTerm)" size="small">
{{ formatScore(viewRow.scoreOneTerm) }}
</el-tag>
</el-descriptions-item>
</el-descriptions>
</div>
@@ -124,14 +144,13 @@
<el-table
:data="viewDetailList"
v-loading="viewLoading"
border
stripe
size="small"
max-height="400"
:cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle">
<el-table-column type="index" label="序号" width="60" align="center" />
<el-table-column prop="schoolTerm" label="期" width="80" align="center" show-overflow-tooltip />
<el-table-column prop="recordDate" label="考核日期" width="110" align="center" show-overflow-tooltip />
<el-table-column prop="recordDate" label="考核日期" width="120" align="center" show-overflow-tooltip />
<el-table-column prop="conductType" label="类型" width="80" align="center">
<template #default="scope">
<el-tag :type="scope.row.conductType === '1' ? 'success' : 'danger'" size="small">
@@ -144,8 +163,8 @@
{{ scope.row.score != null && scope.row.score !== undefined ? Number(scope.row.score) : '-' }}
</template>
</el-table-column>
<el-table-column prop="description" label="情况记录" min-width="140" show-overflow-tooltip />
<el-table-column prop="remarks" label="备注" min-width="100" show-overflow-tooltip />
<el-table-column prop="description" label="情况记录" min-width="150" show-overflow-tooltip />
<el-table-column prop="remarks" label="备注" min-width="120" show-overflow-tooltip />
</el-table>
<template v-if="viewDetailList.length === 0 && !viewLoading">
<el-empty description="暂无考核记录" :image-size="80" />
@@ -156,16 +175,17 @@
<script setup lang="ts" name="StuConductTerm">
import { reactive, ref, onMounted, computed } from 'vue'
import { getStuConductTerm, queryDataByStuNo, sendConductWarning } from "/@/api/stuwork/stuconduct";
import { getStuConductTerm, sendConductWarning, queryDataByStuNo } from "/@/api/stuwork/stuconduct";
import { getClassListByRole } from "/@/api/basic/basicclass";
import { queryAllSchoolYear } from "/@/api/basic/basicyear";
import { getDicts } from "/@/api/admin/dict";
import { useMessage, useMessageBox } from "/@/hooks/message";
import { Search, Document } from '@element-plus/icons-vue';
// 表格样式 - 在组件内部定义,不从外部导入
// 表格样式
const tableStyle = {
cellStyle: { padding: '8px 0' },
headerCellStyle: { background: '#f5f7fa', color: '#606266', fontWeight: 'bold' },
cellStyle: { padding: '8px 0', textAlign: 'center' },
headerCellStyle: { background: '#f5f7fa', color: '#606266', fontWeight: 'bold', textAlign: 'center' },
};
// 定义变量内容
@@ -189,28 +209,73 @@ const queryForm = reactive({
classCode: '',
});
// 根据学期动态生成月份列
const monthColumns = computed(() => {
// 第一学期9月、10月、11月、12月、1月
// 第二学期2月、3月、4月、5月、6月
if (queryForm.schoolTerm === '1') {
return [
{ label: '9月', prop: 'scoreOneMonth' },
{ label: '10月', prop: 'scoreTwoMonth' },
{ label: '11月', prop: 'scoreThreeMonth' },
{ label: '12月', prop: 'scoreFourMonth' },
{ label: '1月', prop: 'scoreFiveMonth' },
];
} else if (queryForm.schoolTerm === '2') {
return [
{ label: '2月', prop: 'scoreSixMonth' },
{ label: '3月', prop: 'scoreSevenMonth' },
{ label: '4月', prop: 'scoreEightMonth' },
{ label: '5月', prop: 'scoreNineMonth' },
{ label: '6月', prop: 'scoreTenMonth' },
];
}
// 默认返回第一学期
return [
{ label: '9月', prop: 'scoreOneMonth' },
{ label: '10月', prop: 'scoreTwoMonth' },
{ label: '11月', prop: 'scoreThreeMonth' },
{ label: '12月', prop: 'scoreFourMonth' },
{ label: '1月', prop: 'scoreFiveMonth' },
];
});
// 格式化分数
const formatScore = (score: any) => {
if (score === null || score === undefined || score === '') return '-';
return Number(score).toFixed(2);
};
// 根据分数获取标签类型
const getScoreType = (score: any) => {
if (score === null || score === undefined) return 'info';
const num = Number(score);
if (num >= 90) return 'success';
if (num >= 80) return 'primary';
if (num >= 60) return 'warning';
return 'danger';
};
// 统计表格数据
const statisticsData = computed(() => {
if (studentList.value.length === 0) {
return [];
}
// 计算各等级人数
// 优秀:>=90良好80-89及格60-79不及格<60
let excellent = 0; // 优秀
let good = 0; // 良好
let pass = 0; // 及格
let fail = 0; // 不及格
let excellent = 0;
let good = 0;
let pass = 0;
let fail = 0;
const total = studentList.value.length;
studentList.value.forEach((student: any) => {
const score = student.score;
const score = student.scoreOneTerm;
if (score !== null && score !== undefined) {
if (score >= 90) {
if (Number(score) >= 90) {
excellent++;
} else if (score >= 80) {
} else if (Number(score) >= 80) {
good++;
} else if (score >= 60) {
} else if (Number(score) >= 60) {
pass++;
} else {
fail++;
@@ -218,52 +283,19 @@ const statisticsData = computed(() => {
}
});
// 计算比率
const excellentRate = total > 0 ? ((excellent / total) * 100).toFixed(2) + '%' : '0%';
const goodRate = total > 0 ? ((good / total) * 100).toFixed(2) + '%' : '0%';
const passRate = total > 0 ? ((pass / total) * 100).toFixed(2) + '%' : '0%';
const failRate = total > 0 ? ((fail / total) * 100).toFixed(2) + '%' : '0%';
const excellentGoodRate = total > 0 ? (((excellent + good) / total) * 100).toFixed(2) + '%' : '0%';
// 优良率 = (优秀 + 良好) / 总人数
const excellentGoodCount = excellent + good;
const excellentGoodRate = total > 0 ? ((excellentGoodCount / total) * 100).toFixed(2) + '%' : '0%';
// 获取班级名称
const classNo = studentList.value.length > 0 ? studentList.value[0].classNo || '-' : '-';
return [
{
label: '人数',
classNo: classNo,
excellent: excellent,
good: good,
pass: pass,
fail: fail,
},
{
label: '比率',
classNo: classNo,
excellent: excellentRate,
good: goodRate,
pass: passRate,
fail: failRate,
},
{
label: '优良率',
classNo: classNo,
excellent: excellentGoodRate,
good: '-',
pass: '-',
fail: '-',
},
{
label: '备注',
classNo: classNo,
excellent: '-',
good: '-',
pass: '-',
fail: '-',
},
{ label: '人数', classNo, excellent, good, pass, fail },
{ label: '比率', classNo, excellent: excellentRate, good: goodRate, pass: passRate, fail: failRate },
{ label: '优良率', classNo, excellent: excellentGoodRate, good: '-', pass: '-', fail: '-' },
{ label: '备注', classNo, excellent: '-', good: '-', pass: '-', fail: '-' },
];
});
@@ -283,34 +315,19 @@ const getDataList = async () => {
});
if (res.data && Array.isArray(res.data)) {
// 处理返回数据提取学生列表
// 根据API文档返回的是StuConductTermVO数组
// 返回数据提取学生列表
const tempList: any[] = [];
res.data.forEach((item: any) => {
// 如果返回的数据结构中有basicStudentVOList需要展开
if (item.basicStudentVOList && Array.isArray(item.basicStudentVOList) && item.basicStudentVOList.length > 0) {
if (item.basicStudentVOList && Array.isArray(item.basicStudentVOList)) {
item.basicStudentVOList.forEach((student: any) => {
tempList.push({
stuNo: student.stuNo || item.stuNo,
realName: student.realName || item.realName,
score: item.score, // 学期总评分数
...student,
classNo: item.classNo,
classCode: item.classCode,
});
});
} else {
// 直接使用item作为学生信息
tempList.push({
stuNo: item.stuNo,
realName: item.realName,
score: item.score,
classNo: item.classNo,
classCode: item.classCode,
});
}
});
studentList.value = tempList;
} else {
studentList.value = [];
@@ -338,7 +355,7 @@ const handleReset = () => {
studentList.value = [];
};
// 查看详情接口GET /stuwork/stuconduct/queryDataByStuNo按当前学年+学号拉取后筛本学期记录)
// 查看详情
const handleView = async (row: any) => {
if (!queryForm.schoolYear || !row.stuNo) {
useMessage().warning('缺少学年或学号');
@@ -354,6 +371,7 @@ const handleView = async (row: any) => {
stuNo: row.stuNo,
});
const list = Array.isArray(res.data) ? res.data : [];
// 筛选当前学期的记录
const term = queryForm.schoolTerm;
viewDetailList.value = term ? list.filter((r: any) => String(r.schoolTerm) === String(term)) : list;
} catch (_err) {
@@ -373,9 +391,7 @@ const handleSendWarning = async () => {
const { confirm } = useMessageBox();
try {
await confirm(
`确定要发送${queryForm.schoolYear}学年第${
queryForm.schoolTerm === '1' ? '一' : '二'
}学期操行考核预警吗将向班主任推送不及格学生低于60分的预警通知。`
`确定要发送${queryForm.schoolYear}学年第${queryForm.schoolTerm === '1' ? '一' : '二'}学期操行考核预警吗将向班主任推送不及格学生低于60分的预警通知。`
);
warningLoading.value = true;
@@ -394,11 +410,7 @@ const handleSendWarning = async () => {
const getSchoolYearList = async () => {
try {
const res = await queryAllSchoolYear();
if (res.data && Array.isArray(res.data)) {
schoolYearList.value = res.data;
} else {
schoolYearList.value = [];
}
schoolYearList.value = res.data && Array.isArray(res.data) ? res.data : [];
} catch (err) {
schoolYearList.value = [];
}
@@ -425,11 +437,7 @@ const getSchoolTermDict = async () => {
const getClassListData = async () => {
try {
const res = await getClassListByRole();
if (res.data && Array.isArray(res.data)) {
classList.value = res.data;
} else {
classList.value = [];
}
classList.value = res.data && Array.isArray(res.data) ? res.data : [];
} catch (err) {
classList.value = [];
}
@@ -444,15 +452,7 @@ onMounted(() => {
</script>
<style scoped lang="scss">
.layout-padding {
.layout-padding-auto {
.layout-padding-view {
.el-row {
margin-bottom: 20px;
}
}
}
}
@import '/@/assets/styles/modern-page.scss';
.view-summary {
margin-bottom: 16px;
@@ -462,19 +462,4 @@ onMounted(() => {
font-weight: 600;
color: #303133;
}
// 确保页面可以滚动
.layout-padding {
height: 100%;
overflow-y: auto;
.layout-padding-auto {
height: 100%;
.layout-padding-view {
height: 100%;
overflow-y: auto;
}
}
}
</style>

View File

@@ -1,9 +1,17 @@
<template>
<div class="layout-padding">
<div class="layout-padding-auto layout-padding-view">
<!-- 搜索表单 -->
<el-row v-show="showSearch">
<el-form :model="queryForm" ref="searchFormRef" :inline="true" @keyup.enter="getDataList">
<div class="modern-page-container">
<div class="page-wrapper">
<!-- 搜索表单卡片 -->
<el-card v-show="showSearch" class="search-card" shadow="never">
<template #header>
<div class="card-header">
<span class="card-title">
<el-icon class="title-icon"><Search /></el-icon>
筛选条件
</span>
</div>
</template>
<el-form :model="queryForm" ref="searchFormRef" :inline="true" @keyup.enter="getDataList" class="search-form">
<el-form-item label="学年" prop="schoolYear">
<el-select v-model="queryForm.schoolYear" placeholder="请选择学年" clearable filterable style="width: 200px">
<el-option v-for="item in schoolYearList" :key="item.year" :label="item.year" :value="item.year"> </el-option>
@@ -19,15 +27,25 @@
<el-button icon="Refresh" @click="handleReset">重置</el-button>
</el-form-item>
</el-form>
</el-row>
</el-card>
<!-- 统计表格 -->
<el-row style="margin-bottom: 20px">
<!-- 内容卡片 -->
<el-card class="content-card" shadow="never">
<template #header>
<div class="card-header">
<span class="card-title">
<el-icon class="title-icon"><Document /></el-icon>
学年操行考核统计
</span>
</div>
</template>
<!-- 统计表格 -->
<el-table
:data="statisticsData"
v-loading="loading"
border
style="width: 100%"
stripe
style="width: 100%; margin-bottom: 20px"
:cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle"
>
@@ -38,60 +56,106 @@
<el-table-column prop="pass" label="及格" min-width="100" align="center" />
<el-table-column prop="fail" label="不及格" min-width="100" align="center" />
</el-table>
</el-row>
<!-- 学生列表表格 -->
<el-row>
<!-- 学生列表表格 -->
<el-table
:data="studentList"
v-loading="loading"
border
:max-height="600"
stripe
style="width: 100%"
:cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle"
>
<el-table-column type="index" label="序号" width="60" align="center" />
<el-table-column prop="stuNo" label="学号" show-overflow-tooltip align="center" />
<el-table-column prop="realName" label="姓名" show-overflow-tooltip align="center" />
<el-table-column prop="score" label="学年总评" show-overflow-tooltip align="center">
<el-table-column type="index" label="序号" width="70" align="center" fixed="left" />
<el-table-column prop="stuNo" label="学号" min-width="120" show-overflow-tooltip align="center" fixed="left" />
<el-table-column prop="realName" label="姓名" min-width="80" show-overflow-tooltip align="center" fixed="left" />
<!-- 第一学期月份 -->
<el-table-column label="第一学期" align="center">
<el-table-column v-for="(month, index) in firstTermMonths" :key="'first-' + index" :label="month.label" min-width="60" align="center">
<template #default="scope">
<span>{{ formatScore(scope.row[month.prop]) }}</span>
</template>
</el-table-column>
<el-table-column label="学期评" min-width="70" align="center">
<template #default="scope">
<el-tag :type="getScoreType(scope.row.scoreOneTerm)" size="small" effect="plain">
{{ formatScore(scope.row.scoreOneTerm) }}
</el-tag>
</template>
</el-table-column>
</el-table-column>
<!-- 第二学期月份 -->
<el-table-column label="第二学期" align="center">
<el-table-column v-for="(month, index) in secondTermMonths" :key="'second-' + index" :label="month.label" min-width="60" align="center">
<template #default="scope">
<span>{{ formatScore(scope.row[month.prop]) }}</span>
</template>
</el-table-column>
<el-table-column label="学期评" min-width="70" align="center">
<template #default="scope">
<el-tag :type="getScoreType(scope.row.scoreTwoTerm)" size="small" effect="plain">
{{ formatScore(scope.row.scoreTwoTerm) }}
</el-tag>
</template>
</el-table-column>
</el-table-column>
<!-- 学年总评 -->
<el-table-column prop="scoreYear" label="学年总评" min-width="100" align="center" fixed="right">
<template #default="scope">
<span>{{ scope.row.score !== null && scope.row.score !== undefined ? scope.row.score.toFixed(2) : '-' }}</span>
<el-tag :type="getScoreType(scope.row.scoreYear)" size="small" effect="dark">
{{ formatScore(scope.row.scoreYear) }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="150" align="center" fixed="right">
<el-table-column label="操作" width="100" align="center" fixed="right">
<template #default="scope">
<el-button icon="View" text type="primary" @click="handleView(scope.row)"> 查看 </el-button>
<el-button icon="View" link type="primary" @click="handleView(scope.row)">查看</el-button>
</template>
</el-table-column>
</el-table>
</el-row>
</el-card>
</div>
<!-- 查看详情弹窗接口queryDataByStuNo 通过学年学号查看详情 -->
<el-dialog v-model="viewDialogVisible" title="学年操行考核详情" width="800px" destroy-on-close @close="viewDetailList = []">
<!-- 查看详情弹窗 -->
<el-dialog v-model="viewDialogVisible" title="学年操行考核详情" width="900px" destroy-on-close @close="viewDetailList = []">
<div v-if="viewRow" class="view-summary">
<el-descriptions :column="2" border size="small">
<el-descriptions :column="3" border size="small">
<el-descriptions-item label="学号">{{ viewRow.stuNo }}</el-descriptions-item>
<el-descriptions-item label="姓名">{{ viewRow.realName }}</el-descriptions-item>
<el-descriptions-item label="学年">{{ queryForm.schoolYear }}</el-descriptions-item>
<el-descriptions-item label="学年总评">
{{ viewRow.score != null && viewRow.score !== undefined ? Number(viewRow.score).toFixed(2) : '-' }}
<el-tag :type="getScoreType(viewRow.scoreYear)" size="small">
{{ formatScore(viewRow.scoreYear) }}
</el-tag>
</el-descriptions-item>
<el-descriptions-item label="第一学期">
<el-tag :type="getScoreType(viewRow.scoreOneTerm)" size="small" effect="plain">
{{ formatScore(viewRow.scoreOneTerm) }}
</el-tag>
</el-descriptions-item>
<el-descriptions-item label="第二学期">
<el-tag :type="getScoreType(viewRow.scoreTwoTerm)" size="small" effect="plain">
{{ formatScore(viewRow.scoreTwoTerm) }}
</el-tag>
</el-descriptions-item>
<el-descriptions-item label="学年">{{ queryForm.schoolYear }}</el-descriptions-item>
</el-descriptions>
</div>
<div class="view-detail-title">考核记录</div>
<el-table
:data="viewDetailList"
v-loading="viewLoading"
border
stripe
size="small"
max-height="400"
:cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle"
>
:header-cell-style="tableStyle.headerCellStyle">
<el-table-column type="index" label="序号" width="60" align="center" />
<el-table-column prop="schoolTerm" label="学期" width="80" align="center" show-overflow-tooltip />
<el-table-column prop="recordDate" label="考核日期" width="110" align="center" show-overflow-tooltip />
<el-table-column prop="schoolTerm" label="学期" width="80" align="center">
<template #default="scope">
<el-tag size="small" effect="plain">{{ scope.row.schoolTerm === '1' ? '第一学期' : '第二学期' }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="recordDate" label="考核日期" width="120" align="center" show-overflow-tooltip />
<el-table-column prop="conductType" label="类型" width="80" align="center">
<template #default="scope">
<el-tag :type="scope.row.conductType === '1' ? 'success' : 'danger'" size="small">
@@ -104,8 +168,8 @@
{{ scope.row.score != null && scope.row.score !== undefined ? Number(scope.row.score) : '-' }}
</template>
</el-table-column>
<el-table-column prop="description" label="情况记录" min-width="140" show-overflow-tooltip />
<el-table-column prop="remarks" label="备注" min-width="100" show-overflow-tooltip />
<el-table-column prop="description" label="情况记录" min-width="150" show-overflow-tooltip />
<el-table-column prop="remarks" label="备注" min-width="120" show-overflow-tooltip />
</el-table>
<template v-if="viewDetailList.length === 0 && !viewLoading">
<el-empty description="暂无考核记录" :image-size="80" />
@@ -120,11 +184,12 @@ import { getStuConductYear, queryDataByStuNo } from '/@/api/stuwork/stuconduct';
import { getClassListByRole } from '/@/api/basic/basicclass';
import { queryAllSchoolYear } from '/@/api/basic/basicyear';
import { useMessage } from '/@/hooks/message';
import { Search, Document } from '@element-plus/icons-vue';
// 表格样式 - 在组件内部定义,不从外部导入
// 表格样式
const tableStyle = {
cellStyle: { padding: '8px 0' },
headerCellStyle: { background: '#f5f7fa', color: '#606266', fontWeight: 'bold' },
cellStyle: { padding: '8px 0', textAlign: 'center' },
headerCellStyle: { background: '#f5f7fa', color: '#606266', fontWeight: 'bold', textAlign: 'center' },
};
// 定义变量内容
@@ -145,28 +210,60 @@ const queryForm = reactive({
classCode: '',
});
// 第一学期月份列9月-1月
const firstTermMonths = [
{ label: '9月', prop: 'scoreOneMonth' },
{ label: '10月', prop: 'scoreTwoMonth' },
{ label: '11月', prop: 'scoreThreeMonth' },
{ label: '12月', prop: 'scoreFourMonth' },
{ label: '1月', prop: 'scoreFiveMonth' },
];
// 第二学期月份列2月-6月
const secondTermMonths = [
{ label: '2月', prop: 'scoreSixMonth' },
{ label: '3月', prop: 'scoreSevenMonth' },
{ label: '4月', prop: 'scoreEightMonth' },
{ label: '5月', prop: 'scoreNineMonth' },
{ label: '6月', prop: 'scoreTenMonth' },
];
// 格式化分数
const formatScore = (score: any) => {
if (score === null || score === undefined || score === '') return '-';
return Number(score).toFixed(2);
};
// 根据分数获取标签类型
const getScoreType = (score: any) => {
if (score === null || score === undefined) return 'info';
const num = Number(score);
if (num >= 90) return 'success';
if (num >= 80) return 'primary';
if (num >= 60) return 'warning';
return 'danger';
};
// 统计表格数据
const statisticsData = computed(() => {
if (studentList.value.length === 0) {
return [];
}
// 计算各等级人数
// 优秀:>=90良好80-89及格60-79不及格<60
let excellent = 0; // 优秀
let good = 0; // 良好
let pass = 0; // 及格
let fail = 0; // 不及格
let excellent = 0;
let good = 0;
let pass = 0;
let fail = 0;
const total = studentList.value.length;
studentList.value.forEach((student: any) => {
const score = student.score;
const score = student.scoreYear;
if (score !== null && score !== undefined) {
if (score >= 90) {
if (Number(score) >= 90) {
excellent++;
} else if (score >= 80) {
} else if (Number(score) >= 80) {
good++;
} else if (score >= 60) {
} else if (Number(score) >= 60) {
pass++;
} else {
fail++;
@@ -174,52 +271,19 @@ const statisticsData = computed(() => {
}
});
// 计算比率
const excellentRate = total > 0 ? ((excellent / total) * 100).toFixed(2) + '%' : '0%';
const goodRate = total > 0 ? ((good / total) * 100).toFixed(2) + '%' : '0%';
const passRate = total > 0 ? ((pass / total) * 100).toFixed(2) + '%' : '0%';
const failRate = total > 0 ? ((fail / total) * 100).toFixed(2) + '%' : '0%';
const excellentGoodRate = total > 0 ? (((excellent + good) / total) * 100).toFixed(2) + '%' : '0%';
// 优良率 = (优秀 + 良好) / 总人数
const excellentGoodCount = excellent + good;
const excellentGoodRate = total > 0 ? ((excellentGoodCount / total) * 100).toFixed(2) + '%' : '0%';
// 获取班级名称
const classNo = studentList.value.length > 0 ? studentList.value[0].classNo || '-' : '-';
return [
{
label: '人数',
classNo: classNo,
excellent: excellent,
good: good,
pass: pass,
fail: fail,
},
{
label: '比率',
classNo: classNo,
excellent: excellentRate,
good: goodRate,
pass: passRate,
fail: failRate,
},
{
label: '优良率',
classNo: classNo,
excellent: excellentGoodRate,
good: '-',
pass: '-',
fail: '-',
},
{
label: '备注',
classNo: classNo,
excellent: '-',
good: '-',
pass: '-',
fail: '-',
},
{ label: '人数', classNo, excellent, good, pass, fail },
{ label: '比率', classNo, excellent: excellentRate, good: goodRate, pass: passRate, fail: failRate },
{ label: '优良率', classNo, excellent: excellentGoodRate, good: '-', pass: '-', fail: '-' },
{ label: '备注', classNo, excellent: '-', good: '-', pass: '-', fail: '-' },
];
});
@@ -238,34 +302,18 @@ const getDataList = async () => {
});
if (res.data && Array.isArray(res.data)) {
// 处理返回的数据,提取学生列表
// 根据API文档返回的是StuConductYearVO数组
const tempList: any[] = [];
res.data.forEach((item: any) => {
// 如果返回的数据结构中有basicStudentVOList需要展开
if (item.basicStudentVOList && Array.isArray(item.basicStudentVOList) && item.basicStudentVOList.length > 0) {
if (item.basicStudentVOList && Array.isArray(item.basicStudentVOList)) {
item.basicStudentVOList.forEach((student: any) => {
tempList.push({
stuNo: student.stuNo || item.stuNo,
realName: student.realName || item.realName,
score: item.score, // 学年总评分数
...student,
classNo: item.classNo,
classCode: item.classCode,
});
});
} else {
// 直接使用item作为学生信息
tempList.push({
stuNo: item.stuNo,
realName: item.realName,
score: item.score,
classNo: item.classNo,
classCode: item.classCode,
});
}
});
studentList.value = tempList;
} else {
studentList.value = [];
@@ -285,7 +333,7 @@ const handleReset = () => {
studentList.value = [];
};
// 查看详情接口GET /stuwork/stuconduct/queryDataByStuNo通过学年学号查看详情
// 查看详情
const handleView = async (row: any) => {
if (!queryForm.schoolYear || !row.stuNo) {
useMessage().warning('缺少学年或学号');
@@ -312,11 +360,7 @@ const handleView = async (row: any) => {
const getSchoolYearList = async () => {
try {
const res = await queryAllSchoolYear();
if (res.data && Array.isArray(res.data)) {
schoolYearList.value = res.data;
} else {
schoolYearList.value = [];
}
schoolYearList.value = res.data && Array.isArray(res.data) ? res.data : [];
} catch (err) {
schoolYearList.value = [];
}
@@ -326,11 +370,7 @@ const getSchoolYearList = async () => {
const getClassListData = async () => {
try {
const res = await getClassListByRole();
if (res.data && Array.isArray(res.data)) {
classList.value = res.data;
} else {
classList.value = [];
}
classList.value = res.data && Array.isArray(res.data) ? res.data : [];
} catch (err) {
classList.value = [];
}
@@ -344,15 +384,7 @@ onMounted(() => {
</script>
<style scoped lang="scss">
.layout-padding {
.layout-padding-auto {
.layout-padding-view {
.el-row {
margin-bottom: 20px;
}
}
}
}
@import '/@/assets/styles/modern-page.scss';
.view-summary {
margin-bottom: 16px;
@@ -362,19 +394,4 @@ onMounted(() => {
font-weight: 600;
color: #303133;
}
// 确保页面可以滚动
.layout-padding {
height: 100%;
overflow-y: auto;
.layout-padding-auto {
height: 100%;
.layout-padding-view {
height: 100%;
overflow-y: auto;
}
}
}
</style>
</style>