This commit is contained in:
zlwu committed 2026-09-02 09:58:57 +08:00
1 parent 8f99ac7482
commit f231386592
44 files changed
+800734 -2509

No files matched your search

@@ -55,6 +55,15 @@ export function updateClassStatusBatch(data: { ids: Array<string | number>; clas
});
}
// 批量设置班级所在校区
export function updateClassCampusBatch(data: { ids: Array<string | number>; campusId: string | number }) {
return request({
url: '/classMsg/classMsg/campus/batch',
method: 'put',
data
});
}
// 删除班级信息-新版
export function delClassMsg(id: string | number) {
return request({
@@ -14,6 +14,16 @@ export interface ClassMsgVO {
*/
majorId: string | number;
/**
* 所在校区ID
*/
campusId?: string | number;
/**
* 所在校区名称
*/
campusName?: string;
/**
* 班级名称
*/
@@ -76,6 +86,16 @@ export interface ClassMsgForm extends BaseEntity {
*/
majorName?: string;
/**
* 所在校区ID
*/
campusId?: string | number;
/**
* 所在校区名称
*/
campusName?: string;
/**
* 班级代码
*/
@@ -303,6 +323,11 @@ export interface ClassMsgQuery extends PageQuery {
*/
majorId?: string | number;
/**
* 所在校区ID
*/
campusId?: string | number;
/**
* 班级名称
*/
+6
View File
@@ -38,6 +38,8 @@ export interface ClassMsgQuery {
collegeId?: number | string;
/** 专业代码 */
majorId?: number | string;
/** 所在校区ID */
campusId?: number | string;
/** 班级名称 */
className?: string;
/** 班级类型 */
@@ -66,6 +68,10 @@ export interface ClassMsgVO {
majorId?: string | number;
/** 专业名称 */
majorName?: string;
/** 所在校区ID */
campusId?: string | number;
/** 所在校区名称 */
campusName?: string;
/** 班级代码 */
classCode?: string;
/** 班级名称 */
@@ -30,6 +30,15 @@
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="6">
<el-form-item label="所在校区" prop="campusId">
<el-select v-model="queryParams.campusId" placeholder="请选择校区" clearable filterable>
<el-option v-for="item in campusOptions" :key="item.id" :label="item.campusName" :value="item.id" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24" class="search-btn-container">
<el-form-item>
@@ -91,6 +100,17 @@
>解散</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="OfficeBuilding"
:disabled="multiple"
@click="handleBatchSetCampus"
v-hasPermi="['classMsg:classMsg:edit']"
>批量设置校区</el-button
>
</el-col>
<!-- <el-col :span="1.5">
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['classMsg:classMsg:export']">导出</el-button>
</el-col> -->
@@ -105,6 +125,7 @@
<el-table-column label="专业代码" align="center" prop="majorId" v-if="false" />
<el-table-column label="学院名称" align="center" prop="collegeName" />
<el-table-column label="专业名称" align="center" prop="majorName" />
<el-table-column label="所在校区" align="center" prop="campusName" min-width="110" />
<el-table-column label="班级名称" align="center" prop="className" />
<el-table-column label="学历层次" align="center" prop="classType">
<template #default="scope">
@@ -185,6 +206,11 @@
<el-form-item label="专业名称" prop="majorName" v-if="false">
<el-input v-model="form.majorName" placeholder="请输入专业名称" readonly />
</el-form-item>
<el-form-item label="所在校区" prop="campusId">
<el-select v-model="form.campusId" placeholder="请选择校区(选填)" clearable filterable style="width: 100%" @change="handleFormCampusChange">
<el-option v-for="item in campusOptions" :key="item.id" :label="item.campusName" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="班级代码" prop="classCode" v-if="false">
<el-input v-model="form.classCode" placeholder="请输入班级代码" />
</el-form-item>
@@ -476,6 +502,26 @@
</div>
</template>
</el-dialog>
<!-- 批量设置所在校区 -->
<el-dialog title="批量设置校区" v-model="campusBatchDialog.visible" width="420px" append-to-body>
<el-form label-width="90px">
<el-form-item label="所在校区" required>
<el-select v-model="campusBatchDialog.campusId" placeholder="请选择校区" filterable style="width: 100%">
<el-option v-for="item in campusOptions" :key="item.id" :label="item.campusName" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="已选班级">
<span>{{ ids.length }} 个</span>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitBatchSetCampus">确 定</el-button>
<el-button @click="campusBatchDialog.visible = false">取 消</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
@@ -487,10 +533,13 @@ import {
addClassMsg,
updateClassMsg,
updateClassStatus,
updateClassStatusBatch
updateClassStatusBatch,
updateClassCampusBatch
} from '@/api/xg/xsjcxx/classmsg/classMsg';
import { listColleges, collegeTree, listMajorsByCollegeId } from '@/api/xg/xsjcxx/classmsg/college';
import { ClassMsgVO, ClassMsgQuery, ClassMsgForm, SysDeptVo } from '@/api/xg/xsjcxx/classmsg/types';
import { listDormCampus } from '@/api/xg/xgss/xqxx/dormCampus';
import type { DormCampusVO } from '@/api/xg/xgss/xqxx/dormCampus/types';
import { ComponentInternalInstance, ref, reactive, toRefs, onMounted, getCurrentInstance, watch } from 'vue';
import type { FormInstance as ElFormInstance, UploadFile, UploadInstance } from 'element-plus';
import { ElMessageBox } from 'element-plus';
@@ -571,6 +620,7 @@ const collegeOptions = ref<SysDeptVo[]>([]); // 学院选项
const majorOptions = ref<SysDeptVo[]>([]); // 检索时的专业选项
const formMajorOptions = ref<SysDeptVo[]>([]); // 表单中的专业选项
const collegeTreeData = ref<SysDeptVo[]>([]); // 学院专业树形数据
const campusOptions = ref<DormCampusVO[]>([]); // 校区选项
const queryFormRef = ref<ElFormInstance>();
const classMsgFormRef = ref<ElFormInstance>();
@@ -590,12 +640,19 @@ const dialog = reactive<DialogOption>({
title: ''
});
const campusBatchDialog = reactive<{ visible: boolean; campusId?: string | number }>({
visible: false,
campusId: undefined
});
const initFormData: ClassMsgForm = {
id: undefined,
collegeId: undefined,
collegeName: undefined,
majorId: undefined,
majorName: undefined,
campusId: undefined,
campusName: undefined,
classCode: undefined,
className: undefined,
classType: '4',
@@ -648,6 +705,7 @@ const data = reactive<PageData<ClassMsgForm, ClassMsgQuery>>({
pageSize: 10,
collegeId: undefined,
majorId: undefined,
campusId: undefined,
className: undefined,
classType: undefined,
grade: undefined,
@@ -686,6 +744,16 @@ const getCollegeList = async () => {
collegeOptions.value = res.data;
};
/** 查询校区列表 */
const getCampusList = async () => {
try {
const res = await listDormCampus({ pageNum: 1, pageSize: 1000 });
campusOptions.value = (res as any).rows || res.data || [];
} catch (e) {
campusOptions.value = [];
}
};
/** 查询学院专业树形结构 */
const getCollegeTree = async () => {
const res = await collegeTree();
@@ -752,6 +820,17 @@ const handleFormMajorChange = (value: number) => {
}
};
/** 表单校区变更:同步名称 */
const handleFormCampusChange = (campusId?: string | number | null) => {
if (campusId === undefined || campusId === null || campusId === '') {
form.value.campusId = undefined;
form.value.campusName = undefined;
return;
}
const campus = campusOptions.value.find((item) => String(item.id) === String(campusId));
form.value.campusName = campus?.campusName;
};
// 监听班级名称变化,自动同步到班级代码
watch(
() => form.value.className,
@@ -977,6 +1056,33 @@ const handleBatchDissolve = async () => {
await handleBatchChangeStatus('4', '解散');
};
/** 打开批量设置校区弹窗 */
const handleBatchSetCampus = () => {
if (!ids.value || ids.value.length === 0) {
proxy?.$modal.msgWarning('请先勾选需要操作的班级');
return;
}
campusBatchDialog.campusId = undefined;
campusBatchDialog.visible = true;
};
/** 提交批量设置校区 */
const submitBatchSetCampus = async () => {
if (campusBatchDialog.campusId === undefined || campusBatchDialog.campusId === null || campusBatchDialog.campusId === '') {
proxy?.$modal.msgWarning('请选择校区');
return;
}
buttonLoading.value = true;
try {
await updateClassCampusBatch({ ids: ids.value, campusId: campusBatchDialog.campusId });
proxy?.$modal.msgSuccess('批量设置校区成功');
campusBatchDialog.visible = false;
await getList();
} finally {
buttonLoading.value = false;
}
};
/** 导出按钮操作 */
const handleExport = () => {
proxy?.download(
@@ -1281,6 +1387,7 @@ onMounted(() => {
getList();
getCollegeList();
getCollegeTree();
getCampusList();
});
</script>
<style scoped>