feat: localize shared business labels across 33 views

This commit is contained in:
biss committed 2026-10-31 19:14:30 +08:00
1 parent 17f7ac3e00
commit ed1f861708
35 files changed
+567 -499

No files matched your search

+29 -27
View File
@@ -1,4 +1,6 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
import { nextTick, onMounted, onUnmounted, reactive, ref, watch } from 'vue'
import { Download, Search } from '@element-plus/icons-vue'
import * as echarts from 'echarts/core'
@@ -393,17 +395,17 @@ onMounted(async () => {
<el-tab-pane label="学生统计" name="students">
<section class="data-card" v-loading="studentLoading">
<div class="filter-bar">
<el-select v-model="studentFilter.collegeId" clearable placeholder="学院" @change="onStudentCollegeChange">
<el-select v-model="studentFilter.collegeId" clearable :placeholder="t('businessLabels.college')" @change="onStudentCollegeChange">
<el-option v-for="c in colleges" :key="c.id" :label="c.name" :value="c.id" />
</el-select>
<el-select v-model="studentFilter.majorId" clearable placeholder="专业" @change="onStudentMajorChange">
<el-select v-model="studentFilter.majorId" clearable :placeholder="t('businessLabels.major')" @change="onStudentMajorChange">
<el-option v-for="m in studentMajors" :key="m.id" :label="m.name" :value="m.id" />
</el-select>
<el-select v-model="studentFilter.classId" clearable placeholder="班级">
<el-select v-model="studentFilter.classId" clearable :placeholder="t('businessLabels.class')">
<el-option v-for="cl in studentClasses" :key="cl.id" :label="cl.name" :value="cl.id" />
</el-select>
<el-input-number v-model="studentFilter.grade" :min="2010" :max="2030" placeholder="年级" controls-position="right" style="width:140px" />
<el-button type="primary" :icon="Search" @click="loadStudentStats">查询</el-button>
<el-input-number v-model="studentFilter.grade" :min="2010" :max="2030" :placeholder="t('businessLabels.grade')" controls-position="right" style="width:140px" />
<el-button type="primary" :icon="Search" @click="loadStudentStats">{{ t('businessLabels.search') }}</el-button>
<el-button :icon="Download" @click="exportStats('students')">导出Excel</el-button>
</div>
<div class="chart-grid">
@@ -415,7 +417,7 @@ onMounted(async () => {
<el-collapse v-if="studentStats">
<el-collapse-item title="明细数据">
<el-table :data="studentStats.byCollege ?? []" size="small" max-height="300">
<el-table-column prop="collegeName" label="学院" />
<el-table-column prop="collegeName" :label="t('businessLabels.college')" />
<el-table-column prop="count" label="学生数" sortable />
</el-table>
</el-collapse-item>
@@ -427,7 +429,7 @@ onMounted(async () => {
<el-tab-pane label="课程统计" name="courses">
<section class="data-card" v-loading="courseLoading">
<div class="filter-bar">
<el-select v-model="courseFilter.collegeId" clearable placeholder="学院">
<el-select v-model="courseFilter.collegeId" clearable :placeholder="t('businessLabels.college')">
<el-option v-for="c in colleges" :key="c.id" :label="c.name" :value="c.id" />
</el-select>
<el-select v-model="courseFilter.categoryId" clearable placeholder="课程类别">
@@ -440,7 +442,7 @@ onMounted(async () => {
<el-option label="通识选修" value="GeneralElective" />
<el-option label="实践环节" value="Practice" />
</el-select>
<el-button type="primary" :icon="Search" @click="loadCourseStats">查询</el-button>
<el-button type="primary" :icon="Search" @click="loadCourseStats">{{ t('businessLabels.search') }}</el-button>
<el-button :icon="Download" @click="exportStats('courses')">导出Excel</el-button>
</div>
<div class="chart-grid">
@@ -452,7 +454,7 @@ onMounted(async () => {
<el-collapse v-if="courseStats">
<el-collapse-item title="明细数据">
<el-table :data="courseStats.byCollege ?? []" size="small" max-height="300">
<el-table-column prop="collegeName" label="学院" />
<el-table-column prop="collegeName" :label="t('businessLabels.college')" />
<el-table-column prop="count" label="课程数" sortable />
</el-table>
</el-collapse-item>
@@ -464,16 +466,16 @@ onMounted(async () => {
<el-tab-pane label="成绩统计" name="grades">
<section class="data-card" v-loading="gradeLoading">
<div class="filter-bar">
<el-select v-model="gradeFilter.collegeId" clearable placeholder="学院" @change="onGradeCollegeChange">
<el-select v-model="gradeFilter.collegeId" clearable :placeholder="t('businessLabels.college')" @change="onGradeCollegeChange">
<el-option v-for="c in colleges" :key="c.id" :label="c.name" :value="c.id" />
</el-select>
<el-select v-model="gradeFilter.majorId" clearable placeholder="专业" @change="onGradeMajorChange">
<el-select v-model="gradeFilter.majorId" clearable :placeholder="t('businessLabels.major')" @change="onGradeMajorChange">
<el-option v-for="m in gradeMajors" :key="m.id" :label="m.name" :value="m.id" />
</el-select>
<el-select v-model="gradeFilter.classId" clearable placeholder="班级">
<el-select v-model="gradeFilter.classId" clearable :placeholder="t('businessLabels.class')">
<el-option v-for="cl in gradeClasses" :key="cl.id" :label="cl.name" :value="cl.id" />
</el-select>
<el-button type="primary" :icon="Search" @click="loadGradeStats">查询</el-button>
<el-button type="primary" :icon="Search" @click="loadGradeStats">{{ t('businessLabels.search') }}</el-button>
<el-button :icon="Download" @click="exportStats('grades')">导出Excel</el-button>
</div>
<div v-if="gradeStats?.overall" class="metrics-strip">
@@ -490,7 +492,7 @@ onMounted(async () => {
<el-collapse v-if="gradeStats">
<el-collapse-item title="各学院通过率明细">
<el-table :data="gradeStats.passRateByCollege ?? []" size="small" max-height="300">
<el-table-column prop="collegeName" label="学院" />
<el-table-column prop="collegeName" :label="t('businessLabels.college')" />
<el-table-column label="通过率" sortable="custom">
<template #default="{ row }">{{ (row.passRate * 100).toFixed(1) }}%</template>
</el-table-column>
@@ -506,10 +508,10 @@ onMounted(async () => {
<el-tab-pane label="通过率统计" name="pass-rates">
<section class="data-card" v-loading="passRateLoading">
<div class="filter-bar">
<el-select v-model="passRateFilter.collegeId" clearable placeholder="学院">
<el-select v-model="passRateFilter.collegeId" clearable :placeholder="t('businessLabels.college')">
<el-option v-for="c in colleges" :key="c.id" :label="c.name" :value="c.id" />
</el-select>
<el-button type="primary" :icon="Search" @click="loadPassRateStats">查询</el-button>
<el-button type="primary" :icon="Search" @click="loadPassRateStats">{{ t('businessLabels.search') }}</el-button>
<el-button :icon="Download" @click="exportStats('pass-rates')">导出Excel</el-button>
</div>
<div v-if="passRateStats" class="metrics-strip">
@@ -525,8 +527,8 @@ onMounted(async () => {
<el-collapse v-if="passRateStats">
<el-collapse-item title="低通过率课程 (底10)">
<el-table :data="passRateStats.byCourseTopFail ?? []" size="small" max-height="300">
<el-table-column prop="courseCode" label="课程代码" />
<el-table-column prop="courseName" label="课程名称" />
<el-table-column prop="courseCode" :label="t('businessLabels.courseCode')" />
<el-table-column prop="courseName" :label="t('businessLabels.courseName')" />
<el-table-column label="通过率" sortable="custom">
<template #default="{ row }">{{ (row.passRate * 100).toFixed(1) }}%</template>
</el-table-column>
@@ -541,10 +543,10 @@ onMounted(async () => {
<el-tab-pane label="教师工作量" name="teacher-workload">
<section class="data-card" v-loading="workloadLoading">
<div class="filter-bar">
<el-select v-model="workloadFilter.collegeId" clearable placeholder="学院">
<el-select v-model="workloadFilter.collegeId" clearable :placeholder="t('businessLabels.college')">
<el-option v-for="c in colleges" :key="c.id" :label="c.name" :value="c.id" />
</el-select>
<el-button type="primary" :icon="Search" @click="loadWorkloadStats">查询</el-button>
<el-button type="primary" :icon="Search" @click="loadWorkloadStats">{{ t('businessLabels.search') }}</el-button>
<el-button :icon="Download" @click="exportStats('teacher-workload')">导出Excel</el-button>
</div>
<div v-if="workloadStats?.totals" class="metrics-strip">
@@ -561,10 +563,10 @@ onMounted(async () => {
<el-collapse v-if="workloadStats">
<el-collapse-item title="教师工作量明细 (Top50)">
<el-table :data="(workloadStats.byTeacher ?? []).slice(0, 50)" size="small" max-height="400">
<el-table-column prop="teacherName" label="姓名" />
<el-table-column prop="teacherNumber" label="工号" />
<el-table-column prop="collegeName" label="学院" />
<el-table-column prop="title" label="职称" />
<el-table-column prop="teacherName" :label="t('businessLabels.name')" />
<el-table-column prop="teacherNumber" :label="t('businessLabels.employeeNumber')" />
<el-table-column prop="collegeName" :label="t('businessLabels.college')" />
<el-table-column prop="title" :label="t('businessLabels.title')" />
<el-table-column prop="totalHours" label="总学时" sortable />
<el-table-column prop="courseCount" label="课程数" sortable />
<el-table-column prop="taskCount" label="教学班数" sortable />
@@ -581,10 +583,10 @@ onMounted(async () => {
<el-select v-model="classroomFilter.campusId" clearable placeholder="校区">
<el-option v-for="c in classroomCampuses" :key="c.id" :label="c.name" :value="c.id" />
</el-select>
<el-select v-model="classroomFilter.buildingId" clearable placeholder="教学楼">
<el-select v-model="classroomFilter.buildingId" clearable :placeholder="t('businessLabels.building')">
<el-option v-for="b in classroomBuildings" :key="b.id" :label="b.name" :value="b.id" />
</el-select>
<el-button type="primary" :icon="Search" @click="loadClassroomStats">查询</el-button>
<el-button type="primary" :icon="Search" @click="loadClassroomStats">{{ t('businessLabels.search') }}</el-button>
<el-button :icon="Download" @click="exportStats('classroom-utilization')">导出Excel</el-button>
</div>
<div v-if="classroomStats?.totals" class="metrics-strip">
@@ -600,7 +602,7 @@ onMounted(async () => {
<el-collapse v-if="classroomStats">
<el-collapse-item title="各教学楼利用率明细">
<el-table :data="classroomStats.byBuilding ?? []" size="small" max-height="300">
<el-table-column prop="buildingName" label="教学楼" />
<el-table-column prop="buildingName" :label="t('businessLabels.building')" />
<el-table-column prop="totalClassrooms" label="教室数" sortable />
<el-table-column label="利用率" sortable="custom">
<template #default="{ row }">{{ (row.utilizationRate * 100).toFixed(1) }}%</template>