提交
This commit is contained in:
1 parent
fb6d0aa63c
commit
ff1228873c
37 files changed
+11861
-1823
No files matched your search
@@ -0,0 +1,68 @@
|
||||
import request from '@/utils/request';
|
||||
import { AxiosPromise } from 'axios';
|
||||
import { XgStudentClassChangeVo, XgStudentClassChangeQuery, XgStudentClassChangeBo, R, TableDataInfo } from './types';
|
||||
|
||||
/**
|
||||
* 查询学生换班级列表
|
||||
*/
|
||||
export function listStudentClassChange(query?: XgStudentClassChangeQuery): AxiosPromise<R<TableDataInfo<XgStudentClassChangeVo[]>>> {
|
||||
return request({
|
||||
url: '/studentMsg/studentClassChange/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询学生换班级详细
|
||||
*/
|
||||
export function getStudentClassChange(id: string | number): AxiosPromise<R<XgStudentClassChangeVo>> {
|
||||
return request({
|
||||
url: `/studentMsg/studentClassChange/${id}`,
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增学生换班级
|
||||
*/
|
||||
export function addStudentClassChange(data: XgStudentClassChangeBo): AxiosPromise<R<any>> {
|
||||
return request({
|
||||
url: '/studentMsg/studentClassChange',
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改学生换班级
|
||||
*/
|
||||
export function updateStudentClassChange(data: XgStudentClassChangeBo): AxiosPromise<R<any>> {
|
||||
return request({
|
||||
url: '/studentMsg/studentClassChange',
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除学生换班级
|
||||
*/
|
||||
export function delStudentClassChange(ids: string | number | Array<string | number>): AxiosPromise<R<any>> {
|
||||
return request({
|
||||
url: `/studentMsg/studentClassChange/${ids}`,
|
||||
method: 'delete'
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出学生换班级
|
||||
*/
|
||||
export function exportStudentClassChange(query?: XgStudentClassChangeQuery): AxiosPromise<any> {
|
||||
return request({
|
||||
url: '/studentMsg/studentClassChange/export',
|
||||
method: 'post',
|
||||
params: query,
|
||||
responseType: 'blob'
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
export interface XgStudentClassChangeVo {
|
||||
id?: number;
|
||||
studentId?: number;
|
||||
studentNo?: string;
|
||||
studentName?: string;
|
||||
originalCollegeName?: string;
|
||||
originalMajorName?: string;
|
||||
originalClassName?: string;
|
||||
newCollegeName?: string;
|
||||
newMajorName?: string;
|
||||
newClassName?: string;
|
||||
changeReason?: string;
|
||||
effectiveTime?: Date;
|
||||
status?: string;
|
||||
createBy?: number;
|
||||
createTime?: Date;
|
||||
}
|
||||
|
||||
export interface XgStudentClassChangeQuery {
|
||||
pageNum?: number;
|
||||
pageSize?: number;
|
||||
studentNo?: string;
|
||||
studentName?: string;
|
||||
status?: string;
|
||||
params?: any;
|
||||
}
|
||||
|
||||
export interface XgStudentClassChangeBo {
|
||||
id?: number;
|
||||
studentId?: number;
|
||||
studentNo?: string;
|
||||
studentName?: string;
|
||||
originalCollegeId?: number;
|
||||
originalCollegeName?: string;
|
||||
originalMajorId?: number;
|
||||
originalMajorName?: string;
|
||||
originalClassId?: number;
|
||||
originalClassCode?: string;
|
||||
originalClassName?: string;
|
||||
newCollegeId?: number;
|
||||
newCollegeName?: string;
|
||||
newMajorId?: number;
|
||||
newMajorName?: string;
|
||||
newClassId?: number;
|
||||
newClassCode?: string;
|
||||
newClassName?: string;
|
||||
changeReason?: string;
|
||||
changeType?: string;
|
||||
changeTime?: Date;
|
||||
effectiveTime?: Date;
|
||||
status?: string;
|
||||
createDept?: number;
|
||||
remark?: string;
|
||||
}
|
||||
@@ -0,0 +1,328 @@
|
||||
<template>
|
||||
<div class="p-2 page-container">
|
||||
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
||||
<div v-show="showSearch" class="mb-[10px]">
|
||||
<el-card shadow="hover">
|
||||
<el-form ref="queryFormRef" :model="queryParams" label-width="100px">
|
||||
<el-row :gutter="20">
|
||||
<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-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-col :span="6">
|
||||
<el-form-item label="处理状态" prop="status">
|
||||
<el-select v-model="queryParams.status" placeholder="请选择处理状态" clearable>
|
||||
<el-option label="未处理" value="0" />
|
||||
<el-option label="已处理" value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="创建时间">
|
||||
<el-date-picker
|
||||
v-model="dateRange"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
type="daterange"
|
||||
range-separator="-"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:default-time="[new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 1, 1, 23, 59, 59)]"
|
||||
/>
|
||||
</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>
|
||||
</transition>
|
||||
|
||||
<el-card shadow="never">
|
||||
<template #header>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
:disabled="multiple || selectedRows.some((row) => row.status === '1')"
|
||||
@click="handleDelete()"
|
||||
v-hasPermi="['studentMsg:studentClassChange:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['studentMsg:studentClassChange:export']"
|
||||
>导出</el-button
|
||||
>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<el-table v-loading="loading" border :data="studentClassChangeList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="学号" align="center" prop="studentNo" />
|
||||
<el-table-column label="学生姓名" align="center" prop="studentName" />
|
||||
<el-table-column label="原学院" align="center" prop="originalCollegeName" />
|
||||
<el-table-column label="原专业" align="center" prop="originalMajorName" />
|
||||
<el-table-column label="原班级" align="center" prop="originalClassName" />
|
||||
<el-table-column label="新学院" align="center" prop="newCollegeName" />
|
||||
<el-table-column label="新专业" align="center" prop="newMajorName" />
|
||||
<el-table-column label="新班级" align="center" prop="newClassName" />
|
||||
<el-table-column label="换班级原因" align="center" prop="changeReason" width="200" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="生效时间" align="center" prop="effectiveTime" width="120">
|
||||
<template #default="scope">
|
||||
<span>{{ proxy?.parseTime(scope.row.effectiveTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="处理状态" align="center" prop="status">
|
||||
<template #default="scope">
|
||||
<el-tag v-if="scope.row.status === '0'" type="warning">未处理</el-tag>
|
||||
<el-tag v-else-if="scope.row.status === '1'" type="success">已处理</el-tag>
|
||||
<el-tag v-else type="info">未知</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="160">
|
||||
<template #default="scope">
|
||||
<span>{{ proxy?.parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="100" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['studentMsg:studentClassChange:remove']"
|
||||
:disabled="scope.row.status === '1'"
|
||||
></el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="StudentClassChange" lang="ts">
|
||||
import { ref, reactive, toRefs, onMounted, getCurrentInstance } from 'vue';
|
||||
import type { FormInstance as ElFormInstance } from 'element-plus';
|
||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
import { to } from 'await-to-js';
|
||||
import service from '@/utils/request';
|
||||
import type { XgStudentClassChangeVo, XgStudentClassChangeQuery } from '@/api/xg/xsjcxx/studentClassChange';
|
||||
|
||||
interface PageData<T, Q> {
|
||||
form: T;
|
||||
queryParams: Q;
|
||||
rules: Record<string, any[]>;
|
||||
}
|
||||
|
||||
interface ComponentInternalInstance {
|
||||
proxy?: any;
|
||||
}
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
// 表格数据
|
||||
const studentClassChangeList = ref<XgStudentClassChangeVo[]>([]);
|
||||
const loading = ref(true);
|
||||
const ids = ref<Array<number | string>>([]);
|
||||
const selectedRows = ref<XgStudentClassChangeVo[]>([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const dateRange = ref<[string, string]>(['', '']);
|
||||
const showSearch = ref(true);
|
||||
|
||||
// 分页参数
|
||||
const queryParams = reactive<XgStudentClassChangeQuery>({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
studentNo: '',
|
||||
studentName: '',
|
||||
status: '',
|
||||
params: {}
|
||||
});
|
||||
|
||||
// 表单引用
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
|
||||
try {
|
||||
// 构造请求参数
|
||||
const requestBody: any = {
|
||||
studentNo: queryParams.studentNo || '',
|
||||
studentName: queryParams.studentName || '',
|
||||
status: queryParams.status || ''
|
||||
};
|
||||
|
||||
// 处理时间范围查询
|
||||
if (dateRange.value && dateRange.value[0] && dateRange.value[1]) {
|
||||
requestBody.beginTime = dateRange.value[0];
|
||||
requestBody.endTime = dateRange.value[1];
|
||||
}
|
||||
|
||||
// 构造分页参数
|
||||
const pageQuery = {
|
||||
pageNum: queryParams.pageNum,
|
||||
pageSize: queryParams.pageSize
|
||||
};
|
||||
|
||||
// 调用后端接口(参考 StudentStatusChange 的写法)
|
||||
const res = await service.get('/studentMsg/studentClassChange/list', {
|
||||
params: { ...requestBody, ...pageQuery }
|
||||
});
|
||||
|
||||
loading.value = false;
|
||||
|
||||
if (res && res.code === 200) {
|
||||
studentClassChangeList.value = res.rows || [];
|
||||
total.value = res.total || 0;
|
||||
} else {
|
||||
// 仅在后端返回错误码或无响应时显示错误
|
||||
ElMessage.error(res?.msg || '查询失败');
|
||||
studentClassChangeList.value = [];
|
||||
total.value = 0;
|
||||
}
|
||||
} catch (error) {
|
||||
loading.value = false;
|
||||
console.error('查询失败:', error);
|
||||
ElMessage.error('查询失败,请重试');
|
||||
studentClassChangeList.value = [];
|
||||
total.value = 0;
|
||||
}
|
||||
};
|
||||
|
||||
/** 选择条数 */
|
||||
const handleSelectionChange = (selection: XgStudentClassChangeVo[]) => {
|
||||
ids.value = selection.map((item) => item.id!);
|
||||
selectedRows.value = selection;
|
||||
single.value = selection.length !== 1;
|
||||
multiple.value = !selection.length;
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
dateRange.value = ['', ''];
|
||||
proxy?.resetForm(queryFormRef.value);
|
||||
queryParams.pageNum = 1;
|
||||
queryParams.studentNo = '';
|
||||
queryParams.studentName = '';
|
||||
queryParams.status = '';
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: XgStudentClassChangeVo) => {
|
||||
if (row && row.status === '1') {
|
||||
ElMessage.warning('已处理的记录不能删除');
|
||||
return;
|
||||
}
|
||||
|
||||
const studentClassChangeIds = row?.id || ids.value;
|
||||
const [err] = await to(
|
||||
ElMessageBox.confirm(`是否确认删除选中的${Array.isArray(studentClassChangeIds) ? studentClassChangeIds.length : 1}条数据项?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
);
|
||||
|
||||
if (!err) {
|
||||
try {
|
||||
const res = await service.delete(`/studentMsg/studentClassChange/${studentClassChangeIds}`);
|
||||
if (res && res.code === 200) {
|
||||
await getList();
|
||||
ElMessage.success('删除成功');
|
||||
} else {
|
||||
ElMessage.error(res?.msg || '删除失败');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('删除失败:', error);
|
||||
ElMessage.error('删除失败,请重试');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = () => {
|
||||
ElMessage({
|
||||
message: '正在导出数据,请耐心等待...',
|
||||
type: 'info',
|
||||
duration: 0,
|
||||
zIndex: 4000
|
||||
});
|
||||
|
||||
proxy
|
||||
?.download(
|
||||
'studentMsg/studentClassChange/export',
|
||||
{
|
||||
...queryParams,
|
||||
...proxy?.addDateRange(queryParams, dateRange.value)
|
||||
},
|
||||
`student_class_change_${new Date().getTime()}.xlsx`
|
||||
)
|
||||
.then(() => {
|
||||
ElMessage.closeAll();
|
||||
ElMessage.success('导出成功');
|
||||
})
|
||||
.catch((error) => {
|
||||
ElMessage.closeAll();
|
||||
if (error.message && error.message.includes('timeout')) {
|
||||
ElMessage.error('导出超时,请尝试减少导出数据量或联系管理员');
|
||||
} else {
|
||||
ElMessage.error('导出失败,请稍后重试');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 页面初始化
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.page-container {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.search-btn-container {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.search-btn-container .el-form-item {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
</style>
|
||||
@@ -127,6 +127,9 @@
|
||||
<el-col :span="1.2">
|
||||
<el-button type="primary" :disabled="multiple" @click="openStatusChangeModal('BI_YE')">毕业</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.2">
|
||||
<el-button type="warning" :disabled="multiple" @click="openChangeClassModal">换班级</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-dropdown class="mt-[1px]">
|
||||
<el-button>
|
||||
@@ -915,6 +918,117 @@
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 换班级对话框 -->
|
||||
<el-dialog v-model="changeClassDialog.visible" :title="changeClassDialog.title" width="800px" append-to-body>
|
||||
<el-form ref="changeClassFormRef" :model="changeClassForm" :rules="changeClassRules" label-width="120px">
|
||||
<!-- 学生基本信息和原班级信息展示 -->
|
||||
<el-card shadow="never" class="mb-4">
|
||||
<template #header>
|
||||
<div class="text-lg font-medium">学生信息</div>
|
||||
</template>
|
||||
<div class="student-info-grid">
|
||||
<div class="info-row">
|
||||
<div class="info-item">
|
||||
<span class="info-label">学号:</span>
|
||||
<span class="info-value">{{ changeClassForm.studentNo }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="info-label">姓名:</span>
|
||||
<span class="info-value">{{ changeClassForm.studentName }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="info-label">性别:</span>
|
||||
<span class="info-value">{{ changeClassForm.gender === '0' ? '男' : changeClassForm.gender === '1' ? '女' : '未知' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="info-row">
|
||||
<div class="info-item">
|
||||
<span class="info-label">原学院:</span>
|
||||
<span class="info-value">{{ changeClassForm.originalCollegeName }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="info-label">原专业:</span>
|
||||
<span class="info-value">{{ changeClassForm.originalMajorName }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="info-label">原班级:</span>
|
||||
<span class="info-value">{{ changeClassForm.originalClassName }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<!-- 新班级信息选择 -->
|
||||
<el-card shadow="never">
|
||||
<template #header>
|
||||
<div class="text-lg font-medium">新班级信息</div>
|
||||
</template>
|
||||
<el-row :gutter="15">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="新学院" prop="newCollegeId">
|
||||
<el-select v-model="changeClassForm.newCollegeId" placeholder="请选择学院" @change="handleCollegeChange" style="width: 100%">
|
||||
<el-option v-for="college in collegeOptions" :key="college.id" :label="college.label" :value="college.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="新专业" prop="newMajorId">
|
||||
<el-select
|
||||
v-model="changeClassForm.newMajorId"
|
||||
placeholder="请选择专业"
|
||||
:disabled="!changeClassForm.newCollegeId"
|
||||
@change="handleChangeClassMajorChange"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option v-for="major in majorOptions" :key="major.id" :label="major.label" :value="major.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="15">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="新班级" prop="newClassId">
|
||||
<el-select v-model="changeClassForm.newClassId" placeholder="请选择班级" :disabled="!changeClassForm.newMajorId" style="width: 100%">
|
||||
<el-option v-for="classItem in classOptions" :key="classItem.id" :label="classItem.label" :value="classItem.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="生效时间" prop="effectiveTime">
|
||||
<el-date-picker
|
||||
v-model="changeClassForm.effectiveTime"
|
||||
type="date"
|
||||
placeholder="请选择生效时间"
|
||||
value-format="YYYY-MM-DD"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="换班级原因" prop="changeReason">
|
||||
<el-input
|
||||
v-model="changeClassForm.changeReason"
|
||||
type="textarea"
|
||||
placeholder="请输入换班级原因"
|
||||
:rows="3"
|
||||
maxlength="500"
|
||||
show-word-limit
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-card>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="changeClassDialog.visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="submitChangeClass">确定</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 学生详情对话框 -->
|
||||
<el-dialog v-model="detailDialog.visible" :title="detailDialog.title" width="1000px" append-to-body>
|
||||
<el-tabs v-model="activeDetailTab" type="border-card">
|
||||
@@ -1739,6 +1853,7 @@ const deptOptions = ref([]);
|
||||
const rawDeptOptions = ref<any[]>([]);
|
||||
const majorOptions = ref([]);
|
||||
const classOptions = ref([]);
|
||||
const collegeOptions = ref([]); // 学院选项
|
||||
const regionOptions = ref([]); // 行政区划选项
|
||||
const dormBuildingOptions = ref([]); // 宿舍楼栋选项
|
||||
const currentSelectedNode = ref<any>(null); // 当前选中的部门节点
|
||||
@@ -1749,6 +1864,29 @@ const classStatusMap = new Map<string | number, string>();
|
||||
let classStatusLoaded = false;
|
||||
let classStatusLoading = false;
|
||||
|
||||
// 换班级相关
|
||||
const changeClassDialog = reactive({
|
||||
visible: false,
|
||||
title: '换班级申请'
|
||||
});
|
||||
const changeClassForm = reactive({
|
||||
studentId: '',
|
||||
studentNo: '',
|
||||
studentName: '',
|
||||
gender: '',
|
||||
originalCollegeId: '',
|
||||
originalCollegeName: '',
|
||||
originalMajorId: '',
|
||||
originalMajorName: '',
|
||||
originalClassId: '',
|
||||
originalClassName: '',
|
||||
newCollegeId: '',
|
||||
newMajorId: '',
|
||||
newClassId: '',
|
||||
effectiveTime: '',
|
||||
changeReason: ''
|
||||
});
|
||||
|
||||
// 计算属性:判断是否显示新增按钮(只有班级节点才显示)
|
||||
const showAddButton = computed(() => {
|
||||
if (!currentSelectedNode.value) {
|
||||
@@ -1776,6 +1914,7 @@ const deptTreeRef = ref<any>();
|
||||
const queryFormRef = ref<any>();
|
||||
const studentFormRef = ref<any>();
|
||||
const statusChangeFormRef = ref<any>();
|
||||
const changeClassFormRef = ref<any>();
|
||||
const uploadRef = ref<any>();
|
||||
|
||||
const initPassword = ref('Hzdyjs123456!@#');
|
||||
@@ -1956,6 +2095,15 @@ const statusChangeRules = reactive({
|
||||
reason: [{ required: true, message: '异动原因不能为空', trigger: 'blur' }]
|
||||
});
|
||||
|
||||
// 换班级表单验证规则
|
||||
const changeClassRules = reactive({
|
||||
newCollegeId: [{ required: true, message: '请选择新学院', trigger: 'change' }],
|
||||
newMajorId: [{ required: true, message: '请选择新专业', trigger: 'change' }],
|
||||
newClassId: [{ required: true, message: '请选择新班级', trigger: 'change' }],
|
||||
effectiveTime: [{ required: true, message: '请选择生效时间', trigger: 'blur' }],
|
||||
changeReason: [{ required: true, message: '换班级原因不能为空', trigger: 'blur' }]
|
||||
});
|
||||
|
||||
// 异动类型选项通过字典表获取:xg_stu_status
|
||||
|
||||
const queryParams = reactive<StudentQuery>({
|
||||
@@ -2990,6 +3138,190 @@ const submitStatusChange = async () => {
|
||||
});
|
||||
};
|
||||
|
||||
/** 打开换班级弹窗 */
|
||||
const openChangeClassModal = async () => {
|
||||
if (ids.value.length !== 1) {
|
||||
ElMessage.warning('请选择一个学生进行换班级操作');
|
||||
return;
|
||||
}
|
||||
|
||||
const studentId = ids.value[0];
|
||||
const selectedStudent = studentList.value.find((student) => student.id === studentId);
|
||||
|
||||
if (!selectedStudent) {
|
||||
ElMessage.error('未找到选中的学生信息');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
// 获取学生详细信息
|
||||
const res = await service.get(`/studentMsg/studentMsg/${studentId}`);
|
||||
if (res && res.code === 200) {
|
||||
const studentData = res.data;
|
||||
|
||||
// 填充学生基本信息
|
||||
changeClassForm.studentId = studentData.id;
|
||||
changeClassForm.studentNo = studentData.studentNo;
|
||||
changeClassForm.studentName = studentData.name;
|
||||
changeClassForm.gender = studentData.gender;
|
||||
|
||||
// 填充原班级信息
|
||||
changeClassForm.originalCollegeId = studentData.collegeId;
|
||||
changeClassForm.originalCollegeName = studentData.collegeName;
|
||||
changeClassForm.originalMajorId = studentData.majorId;
|
||||
changeClassForm.originalMajorName = studentData.majorName;
|
||||
changeClassForm.originalClassId = studentData.classId;
|
||||
changeClassForm.originalClassName = studentData.className;
|
||||
|
||||
// 重置新班级选择
|
||||
changeClassForm.newCollegeId = '';
|
||||
changeClassForm.newMajorId = '';
|
||||
changeClassForm.newClassId = '';
|
||||
changeClassForm.effectiveTime = '';
|
||||
changeClassForm.changeReason = '';
|
||||
|
||||
// 获取学院选项
|
||||
await loadCollegeOptions();
|
||||
|
||||
changeClassDialog.visible = true;
|
||||
} else {
|
||||
ElMessage.error(res?.msg || '获取学生信息失败');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取学生信息失败:', error);
|
||||
ElMessage.error('获取学生信息失败,请重试');
|
||||
}
|
||||
};
|
||||
|
||||
/** 加载学院选项 */
|
||||
const loadCollegeOptions = async () => {
|
||||
try {
|
||||
const res = await service.get('/system/dept/list', {
|
||||
params: {
|
||||
parentId: 101, // 二级学院节点
|
||||
deptCategory: 'xy-' // 学院标识
|
||||
}
|
||||
});
|
||||
if (res && res.code === 200) {
|
||||
collegeOptions.value = (res.data || []).map((dept: any) => ({
|
||||
id: dept.deptId,
|
||||
label: dept.deptName
|
||||
}));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取学院列表失败:', error);
|
||||
collegeOptions.value = [];
|
||||
}
|
||||
};
|
||||
|
||||
/** 学院选择变更 */
|
||||
const handleCollegeChange = async (collegeId: string) => {
|
||||
changeClassForm.newMajorId = '';
|
||||
changeClassForm.newClassId = '';
|
||||
majorOptions.value = [];
|
||||
classOptions.value = [];
|
||||
|
||||
if (collegeId) {
|
||||
try {
|
||||
const res = await service.get('/system/dept/list', {
|
||||
params: {
|
||||
parentId: collegeId,
|
||||
deptCategory: 'zy-' // 专业标识
|
||||
}
|
||||
});
|
||||
if (res && res.code === 200) {
|
||||
majorOptions.value = (res.data || []).map((dept: any) => ({
|
||||
id: dept.deptId,
|
||||
label: dept.deptName
|
||||
}));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取专业列表失败:', error);
|
||||
majorOptions.value = [];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/** 换班级专业选择变更 */
|
||||
const handleChangeClassMajorChange = async (majorId: string) => {
|
||||
changeClassForm.newClassId = '';
|
||||
classOptions.value = [];
|
||||
|
||||
if (majorId) {
|
||||
try {
|
||||
const res = await service.get('/system/dept/list', {
|
||||
params: {
|
||||
parentId: majorId,
|
||||
deptCategory: 'bj-' // 班级标识
|
||||
}
|
||||
});
|
||||
if (res && res.code === 200) {
|
||||
classOptions.value = (res.data || []).map((dept: any) => ({
|
||||
id: dept.deptId,
|
||||
label: dept.deptName
|
||||
}));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取班级列表失败:', error);
|
||||
classOptions.value = [];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/** 提交换班级申请 */
|
||||
const submitChangeClass = async () => {
|
||||
const formRef = changeClassFormRef.value;
|
||||
if (!formRef) return;
|
||||
|
||||
await formRef.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
try {
|
||||
// 检查是否选择了不同的班级
|
||||
if (changeClassForm.newClassId === changeClassForm.originalClassId) {
|
||||
ElMessage.warning('请选择不同的班级进行换班');
|
||||
return;
|
||||
}
|
||||
|
||||
const submitData = {
|
||||
studentId: changeClassForm.studentId,
|
||||
studentNo: changeClassForm.studentNo,
|
||||
studentName: changeClassForm.studentName,
|
||||
originalCollegeId: changeClassForm.originalCollegeId,
|
||||
originalCollegeName: changeClassForm.originalCollegeName,
|
||||
originalMajorId: changeClassForm.originalMajorId,
|
||||
originalMajorName: changeClassForm.originalMajorName,
|
||||
originalClassId: changeClassForm.originalClassId,
|
||||
originalClassCode: '', // 可以根据需要获取
|
||||
originalClassName: changeClassForm.originalClassName,
|
||||
newCollegeId: changeClassForm.newCollegeId,
|
||||
newCollegeName: collegeOptions.value.find((c) => c.id === changeClassForm.newCollegeId)?.label || '',
|
||||
newMajorId: changeClassForm.newMajorId,
|
||||
newMajorName: majorOptions.value.find((m) => m.id === changeClassForm.newMajorId)?.label || '',
|
||||
newClassId: changeClassForm.newClassId,
|
||||
newClassName: classOptions.value.find((c) => c.id === changeClassForm.newClassId)?.label || '',
|
||||
changeReason: changeClassForm.changeReason,
|
||||
changeType: '1', // 主动申请
|
||||
changeTime: proxy?.parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}'),
|
||||
effectiveTime: changeClassForm.effectiveTime,
|
||||
status: '0' // 未处理状态
|
||||
};
|
||||
|
||||
const res = await service.post('/studentMsg/studentClassChange', submitData);
|
||||
if (res && res.code === 200) {
|
||||
ElMessage.success('换班级申请提交成功');
|
||||
changeClassDialog.visible = false;
|
||||
await getList(); // 刷新列表
|
||||
} else {
|
||||
ElMessage.error(res?.msg || '提交失败');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('提交换班级申请失败:', error);
|
||||
ElMessage.error('提交失败,请重试');
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 导入按钮操作 */
|
||||
const handleImport = () => {
|
||||
if (!showAddButton.value) {
|
||||
@@ -3780,4 +4112,36 @@ onMounted(() => {
|
||||
margin-bottom: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
/* 学生信息网格样式 */
|
||||
.student-info-grid {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.info-row {
|
||||
display: flex;
|
||||
gap: 24px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.info-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-width: 120px;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.info-label {
|
||||
font-weight: 500;
|
||||
color: #606266;
|
||||
margin-right: 8px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.info-value {
|
||||
color: #303133;
|
||||
font-weight: 400;
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user