新增 学生批量转班/退班功能

This commit is contained in:
小肥羊 2025-12-09 18:06:55 +08:00
parent 9134466139
commit ed9fc0634d
3 changed files with 107 additions and 22 deletions

View File

@ -2,6 +2,49 @@ import { ComboModel } from "@/components/hTable/hTable";
import { http } from "@/utils/http";
import type { Res, ResPage } from "@/utils/http/types";
import { Ref } from "vue";
/**
* @description
* @return {void}
*/
export function ImportTransferStudent(data) {
return http.request<Res<any>>(
"post",
`userCenter/back/users/importtransferstudent`,
{
data
},
{
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
responseType: "blob"
}
);
}
/**
* @description 退
* @return {void}
*/
export function ImportStudentOut(data: any) {
return http.request<Res<any>>(
"post",
`userCenter/back/users/importstudentout`,
{
data
},
{
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
responseType: "blob"
}
);
}
/**
* @description
* @param {string} type type=StatusEnum

View File

@ -24,7 +24,7 @@
</el-select>
</el-form-item>
<el-form-item v-show="search.schoolId" style="width: 145px">
<el-form-item v-show="search.schoolId" :style="{ width: '145px' }">
<el-select
v-model="search.grade"
placeholder="年级"
@ -41,7 +41,7 @@
</el-select>
</el-form-item>
<el-form-item v-show="search.schoolId" style="width: 100px">
<el-form-item v-show="search.schoolId" :style="{ width: '100px' }">
<el-select v-model="search.classId" placeholder="班级" clearable filterable>
<el-option
v-for="item in classList"
@ -63,16 +63,35 @@
</div>
<div v-show="!selectUser" class="toolbar-container">
<!-- 按钮组 -->
<el-button type="success" @click="importData(ImportStudent)">导入用户</el-button>
<el-button type="default" @click="downLoadImportUsersTemplate"
>下载学生模板</el-button
>
<!-- <el-button title="根据当前筛选条件导出" type="primary" @click="exportUser"
>导出用户</el-button
> -->
<el-button type="success" @click="importUpdateStudent"
>使用Excel模板更新用户</el-button
>
<el-button-group style="padding-right: 1rem">
<el-button type="success" @click="importData(ImportStudent)">新增学生</el-button>
<el-button type="primary" @click="importUpdateStudent">更新学生</el-button>
<el-button
title="模板"
:icon="Tickets"
type="default"
@click="downLoadImportUsersTemplate"
>模板</el-button
>
</el-button-group>
<el-button-group style="padding-right: 1rem">
<el-button type="success" @click="importData(ImportTransferStudent)"
>批量转班学生</el-button
>
<el-button title="模板" :icon="Tickets" type="default" @click="下载转班模板()"
>模板</el-button
>
</el-button-group>
<el-button-group>
<el-button type="success" @click="importData(ImportStudentOut)"
>批量退班</el-button
>
<el-button title="模板" :icon="Tickets" type="default" @click="下载退班模板()"
>模板</el-button
>
</el-button-group>
</div>
<div v-show="!selectUser" class="toolbar-container">
<!-- 按钮组 -->
@ -81,9 +100,9 @@
<el-table
ref="selectUserTable"
:data="table.data"
style="width: 100%"
:max-height="maxTableHeight"
@row-dblclick="setCurrent"
:style="{ width: '100%' }"
@row-click="selectUserClick"
@selection-change="handleSelectionChange"
>
@ -151,7 +170,7 @@
<el-table-column prop="remark" label="备注" />
</el-table>
<el-pagination
style="display: flex; justify-content: center; padding-top: 10px"
:style="{ display: 'flex', justifyContent: 'center', paddingTop: '10px' }"
:current-page="pagination.now"
:page-sizes="[10, 20, 40, 80, 100]"
:page-size="pagination.size"
@ -178,6 +197,7 @@
</template>
<script setup lang="ts">
import { ImportTransferStudent, ImportStudentOut } from "@/api/userCenter";
import { ref, reactive, onMounted } from "vue";
import { ElMessage, ElMessageBox } from "element-plus";
import type { UploadProps } from "element-plus";
@ -201,6 +221,7 @@ import {
Message,
ArrowDownBold,
Search,
Tickets,
Star,
} from "@element-plus/icons-vue";
import { ComboModel, gradeComboModel } from "@/components/hTable/hTable";
@ -741,6 +762,22 @@ const readerBlob = (data: Blob): Promise<any> => {
};
});
};
/**
* 退班模板
*/
const 下载退班模板 = () => {
let impUrl =
import.meta.env.VITE_API_USERCENTER_URL + "/back/users/dwstudentoutinfotemplate";
window.open(impUrl, "_blank");
};
/**
* 转班模板
*/
const 下载转班模板 = () => {
let impUrl =
import.meta.env.VITE_API_USERCENTER_URL + "/back/users/dwtransferuserinfotemplate";
window.open(impUrl, "_blank");
};
const downLoadImportUsersTemplate = () => {
let impUrl = import.meta.env.VITE_API_BASEURL + "/Student/DwImportTemplate";

View File

@ -109,13 +109,17 @@
</div>
<div v-show="!selectUser" class="toolbar-container">
<!-- 按钮组 -->
<el-button type="success" @click="importData">导入用户</el-button>
<el-button type="default" @click="downLoadImportUsersTemplate"
>下载导入用户模板</el-button
>
<!-- <el-button title="根据当前筛选条件导出" type="primary" @click="exportUser"
>导出用户</el-button
> -->
<el-button-group style="padding-right: 1rem">
<el-button
title="模板"
:icon="Tickets"
type="default"
@click="downLoadImportUsersTemplate"
>模板</el-button
>
<el-button type="success" @click="importData">导入用户</el-button>
</el-button-group>
</div>
<div v-show="!selectUser" class="toolbar-container">
<!-- 按钮组 -->
@ -124,7 +128,7 @@
<el-table
ref="selectUserTable"
:data="table.data"
style="width: 100%"
:style="{ width: '100%' }"
:max-height="maxTableHeight"
@row-dblclick="setCurrent"
@row-click="selectUserClick"
@ -247,6 +251,7 @@ import {
Message,
ArrowDownBold,
Search,
Tickets,
Star,
Phone,
} from "@element-plus/icons-vue";