+
+
+
+
+
+
+
@@ -19,15 +27,25 @@
重置
-
+
-
-
+
+
+
+
+
+
+
@@ -38,60 +56,106 @@
-
-
-
+
-
-
-
-
+
+
+
+
+
+
+
+ {{ formatScore(scope.row[month.prop]) }}
+
+
+
+
+
+ {{ formatScore(scope.row.scoreOneTerm) }}
+
+
+
+
+
+
+
+
+ {{ formatScore(scope.row[month.prop]) }}
+
+
+
+
+
+ {{ formatScore(scope.row.scoreTwoTerm) }}
+
+
+
+
+
+
- {{ scope.row.score !== null && scope.row.score !== undefined ? scope.row.score.toFixed(2) : '-' }}
+
+ {{ formatScore(scope.row.scoreYear) }}
+
-
+
- 查看
+ 查看
-
+
-
-
+
+
-
+
{{ viewRow.stuNo }}
{{ viewRow.realName }}
- {{ queryForm.schoolYear }}
- {{ viewRow.score != null && viewRow.score !== undefined ? Number(viewRow.score).toFixed(2) : '-' }}
+
+ {{ formatScore(viewRow.scoreYear) }}
+
+
+
+ {{ formatScore(viewRow.scoreOneTerm) }}
+
+
+
+
+ {{ formatScore(viewRow.scoreTwoTerm) }}
+
+
+ {{ queryForm.schoolYear }}
考核记录
+ :header-cell-style="tableStyle.headerCellStyle">
-
-
+
+
+ {{ scope.row.schoolTerm === '1' ? '第一学期' : '第二学期' }}
+
+
+
@@ -104,8 +168,8 @@
{{ scope.row.score != null && scope.row.score !== undefined ? Number(scope.row.score) : '-' }}
-
-
+
+
@@ -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(() => {
+
\ No newline at end of file