兵马未动 粮草先行
This commit is contained in:
@@ -104,12 +104,62 @@
|
||||
</el-table>
|
||||
</el-row>
|
||||
</div>
|
||||
|
||||
<!-- 查看详情弹窗(接口:queryDataByStuNo 通过学年学号查看详情,按当前学期筛选) -->
|
||||
<el-dialog
|
||||
v-model="viewDialogVisible"
|
||||
title="学期操行考核详情"
|
||||
width="800px"
|
||||
destroy-on-close
|
||||
@close="viewDetailList = []">
|
||||
<div v-if="viewRow" class="view-summary">
|
||||
<el-descriptions :column="2" 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>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
<div class="view-detail-title">考核记录</div>
|
||||
<el-table
|
||||
:data="viewDetailList"
|
||||
v-loading="viewLoading"
|
||||
border
|
||||
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="conductType" label="类型" width="80" align="center">
|
||||
<template #default="scope">
|
||||
<el-tag :type="scope.row.conductType === '1' ? 'success' : 'danger'" size="small">
|
||||
{{ scope.row.conductType === '1' ? '加分' : scope.row.conductType === '0' ? '扣分' : scope.row.conductType || '-' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="score" label="分数" width="80" align="center">
|
||||
<template #default="scope">
|
||||
{{ 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>
|
||||
<template v-if="viewDetailList.length === 0 && !viewLoading">
|
||||
<el-empty description="暂无考核记录" :image-size="80" />
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="StuConductTerm">
|
||||
import { reactive, ref, onMounted, computed } from 'vue'
|
||||
import { getStuConductTerm } from "/@/api/stuwork/stuconduct";
|
||||
import { getStuConductTerm, queryDataByStuNo } from "/@/api/stuwork/stuconduct";
|
||||
import { getClassListByRole } from "/@/api/basic/basicclass";
|
||||
import { queryAllSchoolYear } from "/@/api/basic/basicyear";
|
||||
import { getDicts } from "/@/api/admin/dict";
|
||||
@@ -129,6 +179,10 @@ const schoolYearList = ref<any[]>([])
|
||||
const schoolTermList = ref<any[]>([])
|
||||
const classList = ref<any[]>([])
|
||||
const studentList = ref<any[]>([])
|
||||
const viewDialogVisible = ref(false)
|
||||
const viewLoading = ref(false)
|
||||
const viewRow = ref<any>(null)
|
||||
const viewDetailList = ref<any[]>([])
|
||||
|
||||
// 查询表单
|
||||
const queryForm = reactive({
|
||||
@@ -263,14 +317,20 @@ const getDataList = async () => {
|
||||
} else {
|
||||
studentList.value = []
|
||||
}
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || '获取数据列表失败')
|
||||
} catch (_err) {
|
||||
studentList.value = []
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 格式化学期显示
|
||||
const formatSchoolTerm = (value: string | number) => {
|
||||
if (value === null || value === undefined || value === '') return '-'
|
||||
const dictItem = schoolTermList.value.find((item: any) => item.value == value)
|
||||
return dictItem ? dictItem.label : value
|
||||
}
|
||||
|
||||
// 重置
|
||||
const handleReset = () => {
|
||||
searchFormRef.value?.resetFields()
|
||||
@@ -280,10 +340,29 @@ const handleReset = () => {
|
||||
studentList.value = []
|
||||
}
|
||||
|
||||
// 查看详情
|
||||
const handleView = (row: any) => {
|
||||
// 可以跳转到详情页面或打开详情弹窗
|
||||
useMessage().info('查看详情功能待实现')
|
||||
// 查看详情(接口:GET /stuwork/stuconduct/queryDataByStuNo,按当前学年+学号拉取后筛本学期记录)
|
||||
const handleView = async (row: any) => {
|
||||
if (!queryForm.schoolYear || !row.stuNo) {
|
||||
useMessage().warning('缺少学年或学号')
|
||||
return
|
||||
}
|
||||
viewRow.value = row
|
||||
viewDialogVisible.value = true
|
||||
viewDetailList.value = []
|
||||
viewLoading.value = true
|
||||
try {
|
||||
const res = await queryDataByStuNo({
|
||||
schoolYear: queryForm.schoolYear,
|
||||
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) {
|
||||
viewDetailList.value = []
|
||||
} finally {
|
||||
viewLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 获取学年列表
|
||||
@@ -350,6 +429,15 @@ onMounted(() => {
|
||||
}
|
||||
}
|
||||
|
||||
.view-summary {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.view-detail-title {
|
||||
margin-bottom: 8px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
// 确保页面可以滚动
|
||||
.layout-padding {
|
||||
height: 100%;
|
||||
|
||||
Reference in New Issue
Block a user