提交
This commit is contained in:
1 parent
48f15745be
commit
e421030ada
72 files changed
+17064
-35
No files matched your search
@@ -0,0 +1,125 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询操行分列表
|
||||
export function conductScoreList(query: any) {
|
||||
return request({
|
||||
url: '/xg/conduct-score/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 根据部门ID查询操行分列表(带权限过滤)
|
||||
export function conductScoreListByDeptId(query: any) {
|
||||
return request({
|
||||
url: '/xg/conduct-score/listByDeptId',
|
||||
method: 'post',
|
||||
data: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询操行分详细
|
||||
export function conductScoreInfo(id: any) {
|
||||
return request({
|
||||
url: '/xg/conduct-score/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增操行分
|
||||
export function conductScoreAdd(data: any) {
|
||||
return request({
|
||||
url: '/xg/conduct-score',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改操行分
|
||||
export function conductScoreEdit(data: any) {
|
||||
return request({
|
||||
url: '/xg/conduct-score/' + data.id,
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除操行分
|
||||
export function conductScoreRemove(ids: any) {
|
||||
return request({
|
||||
url: '/xg/conduct-score/' + ids,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 导出操行分
|
||||
export function conductScoreExport(query: any) {
|
||||
return request({
|
||||
url: '/xg/conduct-score/export',
|
||||
method: 'post',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 批量录入操行分
|
||||
export function conductScoreBatchAdd(data: any) {
|
||||
return request({
|
||||
url: '/xg/conduct-score/batch',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 获取班主任负责的班级学生列表
|
||||
export function conductScoreClassStudents(query: any) {
|
||||
return request({
|
||||
url: '/xg/conduct-score/class-students',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询学期平均分统计
|
||||
export function conductScoreSemesterAverage(query: any) {
|
||||
return request({
|
||||
url: '/xg/conduct-score/semester-average',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 根据部门ID查询学期平均分统计(带权限过滤)
|
||||
export function conductScoreSemesterAverageByDeptId(query: any) {
|
||||
return request({
|
||||
url: '/xg/conduct-score/semester-average-by-dept-id',
|
||||
method: 'post',
|
||||
data: query
|
||||
})
|
||||
}
|
||||
|
||||
// 导出学期统计数据
|
||||
export function conductScoreExportSemester(query: any) {
|
||||
return request({
|
||||
url: '/xg/conduct-score/export-semester',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 验证录入权限
|
||||
export function conductScoreCheckPermission(query: any) {
|
||||
return request({
|
||||
url: '/xg/conduct-score/check-permission',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 获取学生详细记录(按月份)
|
||||
export function conductScoreGetStudentRecords(studentId: any, academicYear: any, semester: any, tenantId: any) {
|
||||
return request({
|
||||
url: `/xg/conduct-score/student-records/${studentId}`,
|
||||
method: 'get',
|
||||
params: { academicYear, semester, tenantId }
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,792 @@
|
||||
<template>
|
||||
<div class="p-2 page-container">
|
||||
<div class="layout-container">
|
||||
<!-- 班级Tab页(最上面) -->
|
||||
<el-tabs v-if="classTabs.length > 0" v-model="activeTab" type="card" class="mb-[10px] tabs-top" @tab-click="handleTabClick">
|
||||
<el-tab-pane v-for="tab in classTabs" :key="tab.classId" :label="tab.className" :name="tab.classId.toString()">
|
||||
<!-- 录入统计(在检索栏上方) -->
|
||||
<div v-if="summary" class="mb-[10px]">
|
||||
<div class="grid grid-cols-4 gap-3">
|
||||
<div class="stat-item-mini">
|
||||
<div class="stat-label-mini">总学生数</div>
|
||||
<div class="stat-value-mini text-blue-600">{{ summary.totalStudents }}</div>
|
||||
</div>
|
||||
<div class="stat-item-mini">
|
||||
<div class="stat-label-mini">已录入</div>
|
||||
<div class="stat-value-mini text-green-600">{{ summary.recordedStudents }}</div>
|
||||
</div>
|
||||
<div class="stat-item-mini">
|
||||
<div class="stat-label-mini">待录入</div>
|
||||
<div class="stat-value-mini text-orange-600">{{ summary.pendingStudents }}</div>
|
||||
</div>
|
||||
<div class="stat-item-mini">
|
||||
<div class="stat-label-mini">完成度</div>
|
||||
<div class="stat-value-mini text-purple-600">{{ summary.completionRate }}%</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 检索条件区域 -->
|
||||
<div v-show="showSearch" class="mb-[10px]">
|
||||
<el-card shadow="hover">
|
||||
<el-form ref="queryFormRef" :model="queryParams" label-width="80px">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="6">
|
||||
<el-form-item label="学年" prop="academicYear">
|
||||
<el-select v-model="queryParams.academicYear" placeholder="选择学年" clearable @change="handleQuery">
|
||||
<el-option v-for="year in yearOptions" :key="year.value" :label="year.label" :value="year.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="学期" prop="semester">
|
||||
<el-select v-model="queryParams.semester" placeholder="选择学期" clearable @change="handleQuery">
|
||||
<el-option v-for="semester in semesterOptions" :key="semester.value" :label="semester.label" :value="semester.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="月份" prop="month">
|
||||
<el-select v-model="queryParams.month" placeholder="选择月份" clearable @change="handleQuery">
|
||||
<el-option v-for="month in monthOptions" :key="month.value" :label="month.label" :value="month.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="学号" prop="studentNo">
|
||||
<el-input v-model="queryParams.studentNo" placeholder="请输入学号" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="6">
|
||||
<el-form-item label="学生姓名" prop="studentName">
|
||||
<el-input v-model="queryParams.studentName" placeholder="请输入学生姓名" clearable @keyup.enter="handleQuery" />
|
||||
</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-card>
|
||||
</div>
|
||||
|
||||
<!-- 列表区域 -->
|
||||
<el-card shadow="never" class="list-card">
|
||||
<template #header>
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleBatchInput">批量打分</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" icon="Check" @click="handleSaveAll">保存全部</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button icon="Refresh" @click="handleRefresh">刷新</el-button>
|
||||
</el-col>
|
||||
<RightToolbar v-model:show-search="showSearch" :columns="columns" :search="true" @query-table="getList"></RightToolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<!-- 批量录入弹窗 -->
|
||||
<el-dialog v-model="batchModalVisible" title="批量打分" width="420px" append-to-body :close-on-click-modal="false" destroy-on-close>
|
||||
<el-form :model="batchModalForm" label-width="80px">
|
||||
<el-form-item label="分数" prop="score">
|
||||
<el-input-number
|
||||
v-model="batchModalForm.score"
|
||||
:min="0"
|
||||
:max="100"
|
||||
:precision="2"
|
||||
:step="0.5"
|
||||
size="small"
|
||||
placeholder="输入分数"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input
|
||||
v-model="batchModalForm.remark"
|
||||
type="textarea"
|
||||
size="small"
|
||||
placeholder="输入备注(可选)"
|
||||
maxlength="500"
|
||||
show-word-limit
|
||||
:rows="3"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="batchModalVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="confirmBatchModalSave">保存</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-table
|
||||
v-if="currentClassStudents && currentClassStudents.length > 0"
|
||||
v-loading="tabLoading"
|
||||
border
|
||||
:data="filteredStudents"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="50" align="center" />
|
||||
<el-table-column
|
||||
v-if="columns[0].visible"
|
||||
key="studentNo"
|
||||
label="学号"
|
||||
align="center"
|
||||
prop="studentNo"
|
||||
width="120"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="columns[1].visible"
|
||||
key="studentName"
|
||||
label="姓名"
|
||||
align="center"
|
||||
prop="studentName"
|
||||
width="100"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column v-if="columns[2].visible" key="gender" label="性别" align="center" width="80">
|
||||
<template #default="scope">
|
||||
<el-tag :type="scope.row.gender === '0' ? 'primary' : 'success'" size="small">
|
||||
{{ scope.row.gender === '0' ? '男' : '女' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="columns[3].visible" key="score" label="分数" align="center" width="150">
|
||||
<template #default="scope">
|
||||
<el-input-number v-model="scope.row.score" :min="0" :max="100" :precision="2" :step="0.5" size="small" placeholder="输入分数" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="columns[4].visible" key="evaluation" label="评判结果" align="center" width="100">
|
||||
<template #default="scope">
|
||||
<el-tag v-if="getEvaluationResult(scope.row.score)" :type="getEvaluationResult(scope.row.score) === '优秀' ? 'success' :
|
||||
getEvaluationResult(scope.row.score) === '良好' ? 'primary' :
|
||||
getEvaluationResult(scope.row.score) === '合格' ? 'warning' : 'danger'" size="small">
|
||||
{{ getEvaluationResult(scope.row.score) }}
|
||||
</el-tag>
|
||||
<span v-else class="text-gray-400">-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="columns[5].visible" key="remark" label="备注" align="center" min-width="200">
|
||||
<template #default="scope">
|
||||
<el-input v-model="scope.row.remark" size="small" placeholder="输入备注(可选)" maxlength="500" show-word-limit />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="columns[6].visible" key="status" label="状态" align="center" width="100">
|
||||
<template #default="scope">
|
||||
<el-tag v-if="scope.row.existingScore" type="success" size="small">已录入</el-tag>
|
||||
<el-tag v-else-if="scope.row.score" type="warning" size="small">待保存</el-tag>
|
||||
<el-tag v-else type="info" size="small">未录入</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="columns[7].visible" key="lastScore" label="上月分数" align="center" width="100">
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.lastScore" class="text-primary">{{ scope.row.lastScore }}</span>
|
||||
<span v-else class="text-gray-400">-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" fixed="right" width="120" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-tooltip content="录入分数" placement="top">
|
||||
<el-button link type="primary" icon="Edit" @click="handleSingleInput(scope.row)"></el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div v-else class="no-data-placeholder" style="padding: 40px; text-align: center; color: #909399">暂无学生数据</div>
|
||||
</el-card>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
||||
<!-- 调试信息(开发环境显示) -->
|
||||
<div v-else style="padding: 20px; text-align: center; color: #909399">正在加载班级数据...</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="ConductScoreInput">
|
||||
import { ref, reactive, onMounted, computed } from 'vue';
|
||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
|
||||
// API接口
|
||||
import { conductScoreClassStudents, conductScoreBatchAdd } from '@/api/xg/conductScore';
|
||||
|
||||
// 响应式数据
|
||||
const queryParams = reactive({
|
||||
academicYear: new Date().getFullYear(),
|
||||
semester: 1,
|
||||
month: new Date().getMonth() + 1,
|
||||
studentNo: '',
|
||||
studentName: ''
|
||||
});
|
||||
|
||||
// 班级Tab页数据
|
||||
const classTabs = ref([]);
|
||||
const activeTab = ref('');
|
||||
const classStudentData = ref(new Map());
|
||||
|
||||
// 当前班级学生列表
|
||||
const currentClassStudents = computed(() => {
|
||||
if (!activeTab.value) return [];
|
||||
return classStudentData.value.get(activeTab.value) || [];
|
||||
});
|
||||
|
||||
// 过滤后的学生列表
|
||||
const filteredStudents = computed(() => {
|
||||
let data = [...currentClassStudents.value];
|
||||
|
||||
// 学号筛选
|
||||
if (queryParams.studentNo) {
|
||||
data = data.filter((item) => item.studentNo?.includes(queryParams.studentNo));
|
||||
}
|
||||
|
||||
// 姓名筛选
|
||||
if (queryParams.studentName) {
|
||||
data = data.filter((item) => item.studentName?.includes(queryParams.studentName));
|
||||
}
|
||||
|
||||
return data;
|
||||
});
|
||||
|
||||
// 汇总统计 - 基于当前班级计算
|
||||
const summary = computed(() => {
|
||||
if (!currentClassStudents.value || currentClassStudents.value.length === 0) {
|
||||
return {
|
||||
totalStudents: 0,
|
||||
recordedStudents: 0,
|
||||
pendingStudents: 0,
|
||||
completionRate: 0
|
||||
};
|
||||
}
|
||||
|
||||
const students = currentClassStudents.value;
|
||||
const totalStudents = students.length;
|
||||
const recordedStudents = students.filter((student) => student.existingScore !== null && student.existingScore !== undefined).length;
|
||||
const pendingStudents = totalStudents - recordedStudents;
|
||||
const completionRate = totalStudents > 0 ? Math.round((recordedStudents / totalStudents) * 100) : 0;
|
||||
|
||||
return {
|
||||
totalStudents,
|
||||
recordedStudents,
|
||||
pendingStudents,
|
||||
completionRate
|
||||
};
|
||||
});
|
||||
|
||||
// 加载状态
|
||||
const loading = ref(false);
|
||||
const tabLoading = ref(false);
|
||||
|
||||
// 选择相关
|
||||
const selectedStudents = ref([]);
|
||||
|
||||
// 表格列配置
|
||||
const columns = ref([
|
||||
{ key: 0, label: `学号`, visible: true },
|
||||
{ key: 1, label: `姓名`, visible: true },
|
||||
{ key: 2, label: `性别`, visible: true },
|
||||
{ key: 3, label: `分数`, visible: true },
|
||||
{ key: 4, label: `评判结果`, visible: true },
|
||||
{ key: 5, label: `备注`, visible: true },
|
||||
{ key: 6, label: `状态`, visible: true },
|
||||
{ key: 7, label: `上月分数`, visible: true }
|
||||
]);
|
||||
|
||||
// 搜索显示控制
|
||||
const showSearch = ref(true);
|
||||
|
||||
// 表单引用
|
||||
const queryFormRef = ref();
|
||||
|
||||
// 选项数据
|
||||
const yearOptions = computed(() => {
|
||||
const currentYear = new Date().getFullYear();
|
||||
return Array.from({ length: 8 }, (_, i) => ({
|
||||
label: `${currentYear - 7 + i}年`,
|
||||
value: currentYear - 7 + i
|
||||
}));
|
||||
});
|
||||
|
||||
const semesterOptions = [
|
||||
{ label: '第一学期', value: 1 },
|
||||
{ label: '第二学期', value: 2 }
|
||||
];
|
||||
|
||||
const monthOptions = Array.from({ length: 12 }, (_, i) => ({
|
||||
label: `${i + 1}月`,
|
||||
value: i + 1
|
||||
}));
|
||||
|
||||
// 评判结果计算方法
|
||||
const getEvaluationResult = (score) => {
|
||||
if (score === null || score === undefined) {
|
||||
return '';
|
||||
}
|
||||
if (score >= 85) {
|
||||
return '优秀';
|
||||
} else if (score >= 75) {
|
||||
return '良好';
|
||||
} else if (score >= 60) {
|
||||
return '合格';
|
||||
} else {
|
||||
return '不合格';
|
||||
}
|
||||
};
|
||||
|
||||
// 方法
|
||||
const handleQuery = () => {
|
||||
getList();
|
||||
};
|
||||
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
getList();
|
||||
};
|
||||
|
||||
const handleTabClick = (tab) => {
|
||||
activeTab.value = tab.props.name;
|
||||
// 可以在这里添加切换Tab时的保存逻辑
|
||||
};
|
||||
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
try {
|
||||
const response = await conductScoreClassStudents(queryParams);
|
||||
|
||||
if (response.code !== 200) {
|
||||
throw new Error(response.msg || '获取数据失败');
|
||||
}
|
||||
|
||||
const data = response.data;
|
||||
|
||||
console.log('获取到的数据:', data); // 调试信息
|
||||
|
||||
if (!data || !data.classes || data.classes.length === 0) {
|
||||
console.log('没有班级数据:', data); // 调试信息
|
||||
ElMessage.warning('暂无班级数据,请检查是否已分配班主任权限或联系管理员');
|
||||
classTabs.value = [];
|
||||
classStudentData.value.clear();
|
||||
summary.value = null;
|
||||
return;
|
||||
}
|
||||
|
||||
// 设置Tab页,按年级倒序排列
|
||||
classTabs.value = data.classes
|
||||
.sort((a, b) => {
|
||||
// 年级倒序排列(高年级在前,如2024级排在2023级前面)
|
||||
const gradeA = a.grade || '';
|
||||
const gradeB = b.grade || '';
|
||||
if (!gradeA && !gradeB) return 0;
|
||||
if (!gradeA) return 1; // 空值排在后面
|
||||
if (!gradeB) return -1; // 空值排在后面
|
||||
return gradeB.localeCompare(gradeA); // 降序排列
|
||||
})
|
||||
.map((cls) => ({
|
||||
classId: cls.classId,
|
||||
className: cls.className,
|
||||
studentCount: cls.studentCount || 0
|
||||
}));
|
||||
|
||||
console.log('创建的Tab页:', classTabs.value); // 调试信息
|
||||
|
||||
// 设置学生数据
|
||||
classStudentData.value.clear();
|
||||
data.classes.forEach((cls) => {
|
||||
if (cls.students && Array.isArray(cls.students)) {
|
||||
const students = cls.students.map((student) => {
|
||||
// 更严格的已录入判断:existingScore必须是对象且包含score字段
|
||||
const hasExistingScore =
|
||||
student.existingScore &&
|
||||
typeof student.existingScore === 'object' &&
|
||||
student.existingScore.score !== null &&
|
||||
student.existingScore.score !== undefined;
|
||||
|
||||
return {
|
||||
...student,
|
||||
studentId: student.studentId,
|
||||
studentNo: student.studentNo || '',
|
||||
studentName: student.studentName || '',
|
||||
gender: student.gender || '0',
|
||||
lastScore: student.lastScore || null,
|
||||
existingScore: hasExistingScore ? student.existingScore : null,
|
||||
score: hasExistingScore ? student.existingScore.score : null,
|
||||
remark: hasExistingScore ? student.existingScore.remark || '' : ''
|
||||
};
|
||||
});
|
||||
classStudentData.value.set(cls.classId.toString(), students);
|
||||
} else {
|
||||
classStudentData.value.set(cls.classId.toString(), []);
|
||||
}
|
||||
});
|
||||
|
||||
// 设置默认激活Tab
|
||||
if (classTabs.value.length > 0) {
|
||||
if (!activeTab.value || !classStudentData.value.has(activeTab.value)) {
|
||||
activeTab.value = classTabs.value[0].classId.toString();
|
||||
}
|
||||
} else {
|
||||
activeTab.value = '';
|
||||
}
|
||||
|
||||
// 汇总统计现在通过计算属性动态计算,无需手动设置
|
||||
|
||||
if (classTabs.value.length > 0) {
|
||||
ElMessage.success(`成功加载 ${classTabs.value.length} 个班级数据`);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载班级学生数据失败:', error);
|
||||
const errorMessage = error.response?.data?.msg || error.message || '加载数据失败,请稍后重试';
|
||||
ElMessage.error(errorMessage);
|
||||
|
||||
classTabs.value = [];
|
||||
classStudentData.value.clear();
|
||||
activeTab.value = '';
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 批量操作方法
|
||||
const handleBatchInput = () => {
|
||||
// 打开批量录入弹窗(弹窗中输入分数和备注,保存时应用到所选学生)
|
||||
console.log('handleBatchInput selectedStudents:', selectedStudents.value);
|
||||
if (!selectedStudents.value || selectedStudents.value.length === 0) {
|
||||
ElMessage.warning('请先选择要批量录入的学生');
|
||||
return;
|
||||
}
|
||||
|
||||
// reset form and show dialog
|
||||
batchModalForm.score = null;
|
||||
batchModalForm.remark = '';
|
||||
batchModalVisible.value = true;
|
||||
// debug info for users to see modal opening
|
||||
ElMessage.info('已打开批量录入弹窗');
|
||||
};
|
||||
|
||||
const handleSaveAll = () => {
|
||||
const validStudents = filteredStudents.value.filter(
|
||||
(student) => student.score !== null && student.score !== undefined && student.existingScore === null
|
||||
);
|
||||
|
||||
if (validStudents.length === 0) {
|
||||
ElMessage.warning('没有需要保存的数据');
|
||||
return;
|
||||
}
|
||||
|
||||
ElMessageBox.confirm(`确定要保存当前班级的 ${validStudents.length} 个学生的操行分吗?`, '保存确认', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
saveBatchData(validStudents);
|
||||
});
|
||||
};
|
||||
|
||||
const saveBatchData = async (students) => {
|
||||
try {
|
||||
const batchData = {
|
||||
academicYear: queryParams.academicYear,
|
||||
semester: queryParams.semester,
|
||||
month: queryParams.month,
|
||||
classId: activeTab.value, // 直接传递字符串,避免JavaScript大整数精度丢失
|
||||
scores: students.map((student) => ({
|
||||
studentId: student.studentId,
|
||||
score: student.score,
|
||||
remark: student.remark || ''
|
||||
}))
|
||||
};
|
||||
|
||||
const response = await conductScoreBatchAdd(batchData);
|
||||
|
||||
if (response.code === 200) {
|
||||
ElMessage.success(`成功保存 ${response.data.successCount} 条记录`);
|
||||
if (response.data.failCount > 0) {
|
||||
ElMessage.warning(`失败 ${response.data.failCount} 条记录`);
|
||||
}
|
||||
getList();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('保存数据失败:', error);
|
||||
ElMessage.error('保存失败');
|
||||
}
|
||||
};
|
||||
|
||||
// 批量录入弹窗数据与确认保存
|
||||
const batchModalVisible = ref(false);
|
||||
const batchModalForm = reactive({
|
||||
score: null,
|
||||
remark: ''
|
||||
});
|
||||
|
||||
const confirmBatchModalSave = () => {
|
||||
// 批量录入弹窗填写的分数/备注将应用到所有已勾选的学生(包含已录入的,视为覆盖)
|
||||
const targets = selectedStudents.value || [];
|
||||
|
||||
if (targets.length === 0) {
|
||||
ElMessage.warning('请先选择要批量录入的学生');
|
||||
batchModalVisible.value = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (batchModalForm.score === null || batchModalForm.score === undefined) {
|
||||
ElMessage.warning('请在弹窗中填写分数');
|
||||
return;
|
||||
}
|
||||
|
||||
const studentsToSave = targets.map((stu) => ({
|
||||
studentId: stu.studentId,
|
||||
score: batchModalForm.score,
|
||||
remark: batchModalForm.remark || ''
|
||||
}));
|
||||
|
||||
batchModalVisible.value = false;
|
||||
// 保存时会覆盖已有分数(后端应支持更新)
|
||||
saveBatchData(studentsToSave);
|
||||
};
|
||||
|
||||
const handleRefresh = () => {
|
||||
getList();
|
||||
};
|
||||
|
||||
const handleSingleInput = (row) => {
|
||||
// 单条保存:支持覆盖已录入的分数。根据是否已有分数,调整提示文案。
|
||||
if (row.score === null || row.score === undefined) {
|
||||
ElMessage.warning('请先输入分数');
|
||||
return;
|
||||
}
|
||||
|
||||
const confirmMessage = row.existingScore
|
||||
? `该学生已有分数,确定要覆盖 ${row.studentName} 的分数为 ${row.score} 吗?`
|
||||
: `确定保存 ${row.studentName} 的分数 ${row.score} 吗?`;
|
||||
|
||||
ElMessageBox.confirm(confirmMessage, '保存确认', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
// 传入简化对象以避免多余字段
|
||||
saveBatchData([
|
||||
{
|
||||
studentId: row.studentId,
|
||||
score: row.score,
|
||||
remark: row.remark || ''
|
||||
}
|
||||
]);
|
||||
});
|
||||
};
|
||||
|
||||
const handleSelectionChange = (selection) => {
|
||||
selectedStudents.value = selection;
|
||||
};
|
||||
|
||||
// 生命周期
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.layout-container {
|
||||
/* allow content to determine height to avoid forcing large blank areas */
|
||||
min-height: auto;
|
||||
}
|
||||
|
||||
/* 搜索按钮容器样式 */
|
||||
.search-btn-container {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.search-btn-container .el-form-item {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
||||
.stat-item {
|
||||
padding: 20px;
|
||||
background: #f8f9fa;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.stat-item-small {
|
||||
padding: 12px;
|
||||
background: #f8f9fa;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.stat-item-mini {
|
||||
padding: 8px 12px;
|
||||
background: #f8f9fa;
|
||||
border-radius: 6px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: 28px;
|
||||
font-weight: 700;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.stat-value-small {
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.stat-value-mini {
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
color: #606266;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.stat-label-small {
|
||||
color: #606266;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.stat-label-mini {
|
||||
color: #000000;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.no-data-placeholder {
|
||||
padding: 40px;
|
||||
text-align: center;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
/* 列表卡片自适应高度,避免底部留白 */
|
||||
.list-card {
|
||||
/* give the list card room; removed fixed max-height per request */
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
/* 增加 tab 区域高度,保证表格有足够可视空间 */
|
||||
.tabs-top ::deep(.el-tabs__header) {
|
||||
min-height: 56px;
|
||||
padding-top: 6px;
|
||||
padding-bottom: 6px;
|
||||
}
|
||||
|
||||
.tabs-top ::deep(.el-tabs__nav) {
|
||||
min-height: 56px;
|
||||
}
|
||||
|
||||
.tabs-top ::deep(.el-tab-pane) {
|
||||
/* ensure tab pane scrolls when needed; removed fixed min/max heights */
|
||||
overflow-y: auto !important;
|
||||
overflow-x: hidden !important;
|
||||
padding-right: 8px !important;
|
||||
}
|
||||
|
||||
.tabs-top ::deep(.el-tabs__content) {
|
||||
max-height: calc(100vh - 160px) !important;
|
||||
overflow: auto !important;
|
||||
}
|
||||
|
||||
/* 覆盖底层残留的固定高度规则,防止页面产生空白区域 */
|
||||
::deep(.el-tab-pane),
|
||||
.tabs-top ::deep(.el-tab-pane) {
|
||||
min-height: 0 !important;
|
||||
max-height: none !important;
|
||||
overflow-y: auto !important;
|
||||
overflow-x: hidden !important;
|
||||
padding-right: 8px !important;
|
||||
}
|
||||
|
||||
::deep(.el-tabs__content),
|
||||
.tabs-top ::deep(.el-tabs__content) {
|
||||
height: auto !important;
|
||||
max-height: none !important;
|
||||
overflow: auto !important;
|
||||
padding-right: 1px !important;
|
||||
padding-left: 1px !important;
|
||||
}
|
||||
|
||||
/* 自定义颜色类 */
|
||||
.text-primary {
|
||||
color: #409eff;
|
||||
}
|
||||
|
||||
.text-blue-600 {
|
||||
color: #409eff;
|
||||
}
|
||||
|
||||
.text-green-600 {
|
||||
color: #67c23a;
|
||||
}
|
||||
|
||||
.text-orange-600 {
|
||||
color: #e6a23c;
|
||||
}
|
||||
|
||||
.text-purple-600 {
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.text-gray-400 {
|
||||
color: #c0c4cc;
|
||||
}
|
||||
|
||||
.text-success {
|
||||
color: #67c23a;
|
||||
}
|
||||
|
||||
.text-danger {
|
||||
color: #f56c6c;
|
||||
}
|
||||
|
||||
.text-warning {
|
||||
color: #e6a23c;
|
||||
}
|
||||
|
||||
/* Tab 页通用样式:移除固定高度,允许自然伸缩 */
|
||||
::deep(.el-tab-pane) {
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
padding-right: 8px;
|
||||
}
|
||||
|
||||
::deep(.el-tabs__content) {
|
||||
overflow: hidden;
|
||||
padding-right: 1px !important;
|
||||
padding-left: 1px !important;
|
||||
}
|
||||
|
||||
/* 自定义滚动条样式 */
|
||||
::deep(.el-tab-pane::-webkit-scrollbar) {
|
||||
width: 6px;
|
||||
}
|
||||
|
||||
::deep(.el-tab-pane::-webkit-scrollbar-track) {
|
||||
background: #f1f1f1;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
::deep(.el-tab-pane::-webkit-scrollbar-thumb) {
|
||||
background: #c1c1c1;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
::deep(.el-tab-pane::-webkit-scrollbar-thumb:hover) {
|
||||
background: #a8a8a8;
|
||||
}
|
||||
</style>
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -115,19 +115,19 @@
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button :disabled="multiple" icon="Delete" @click="handleDelete()"> 删除 </el-button>
|
||||
</el-col> -->
|
||||
<el-col :span="1.2">
|
||||
<el-col :span="1.2" v-hasPerm="['studentMsg:status:tuixue']">
|
||||
<el-button type="danger" :disabled="multiple" @click="openStatusChangeModal('TUI_XUE')">退学</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.2">
|
||||
<el-col :span="1.2" v-hasPerm="['studentMsg:status:xiuxue']">
|
||||
<el-button type="warning" :disabled="multiple" @click="openStatusChangeModal('XIU_XUE')">休学</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.2">
|
||||
<el-col :span="1.2" v-hasPerm="['studentMsg:status:fuxue']">
|
||||
<el-button type="success" :disabled="multiple" @click="openStatusChangeModal('FU_XUE')">复学</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.2">
|
||||
<el-col :span="1.2" v-hasPerm="['studentMsg:status:biye']">
|
||||
<el-button type="primary" :disabled="multiple" @click="openStatusChangeModal('BI_YE')">毕业</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.2">
|
||||
<el-col :span="1.2" v-hasPerm="['studentMsg:class:change']">
|
||||
<el-button type="warning" :disabled="multiple" @click="openChangeClassModal">换班级</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
|
||||
Reference in new issue
Block a user