|
@@ -0,0 +1,177 @@
|
|
|
+<script setup lang="ts">
|
|
|
+ import { PageWrapper } from '/@/components/Page';
|
|
|
+ import { useTable, BasicTable, TableAction } from '/@/components/Table';
|
|
|
+ import { searchFormSchema, tableColumns } from './data.config';
|
|
|
+ import ClassTree from '/@/views/educational/basicInformation/components/tree.vue';
|
|
|
+ import { computed, reactive } from 'vue';
|
|
|
+ import {
|
|
|
+ postBaseNewStudentReportExportQuery,
|
|
|
+ getBaseNewStudentReportPage,
|
|
|
+ } from '/@/services/apis/BaseNewStudentController';
|
|
|
+ import { Recordable } from 'vite-plugin-mock';
|
|
|
+ import { useModal } from '/@/components/Modal';
|
|
|
+ import FormEdit from './edit.vue';
|
|
|
+ import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
+ import { formatToDate } from '/@/utils/dateUtil';
|
|
|
+ import { downloadByData } from '/@/utils/file/download';
|
|
|
+ import { useLoading } from '/@/components/Loading';
|
|
|
+ import { postStudentReportRecordUpdateStduyStatus } from '/@/services/apis/StudentReportRecordController';
|
|
|
+ import FormAdjust from './adjust.vue';
|
|
|
+
|
|
|
+ const searchInfo = reactive<Recordable>({});
|
|
|
+
|
|
|
+ const [registerModal, { openModal }] = useModal();
|
|
|
+ const [registerAdjustModal, { openModal: openAdjustModal }] = useModal();
|
|
|
+ const { createMessage, createConfirm } = useMessage();
|
|
|
+ const [openFullLoading, closeFullLoading] = useLoading({
|
|
|
+ tip: '处理中...',
|
|
|
+ });
|
|
|
+
|
|
|
+ const [registerTable, { reload, getSelectRowKeys, getForm, clearSelectedRowKeys }] = useTable({
|
|
|
+ api: getBaseNewStudentReportPage,
|
|
|
+ title: '学生列表',
|
|
|
+ rowKey: 'id',
|
|
|
+ columns: tableColumns,
|
|
|
+ formConfig: {
|
|
|
+ labelWidth: 120,
|
|
|
+ schemas: searchFormSchema,
|
|
|
+ },
|
|
|
+ useSearchForm: true,
|
|
|
+ showTableSetting: true,
|
|
|
+ bordered: true,
|
|
|
+ immediate: true,
|
|
|
+ canResize: true,
|
|
|
+ actionColumn: {
|
|
|
+ width: 200,
|
|
|
+ title: '操作',
|
|
|
+ dataIndex: 'action',
|
|
|
+ slots: { customRender: 'action' },
|
|
|
+ fixed: 'right',
|
|
|
+ },
|
|
|
+ rowSelection: {
|
|
|
+ type: 'checkbox',
|
|
|
+ getCheckboxProps: (record: Recordable) => ({
|
|
|
+ disabled: record.isReport === 1,
|
|
|
+ }),
|
|
|
+ },
|
|
|
+ });
|
|
|
+
|
|
|
+ const hasSelected = computed(() => getSelectRowKeys().length > 0);
|
|
|
+
|
|
|
+ function handleSelect(id) {
|
|
|
+ searchInfo.enrollmentPlanId = id;
|
|
|
+ reload();
|
|
|
+ }
|
|
|
+
|
|
|
+ const handleDelete = (record: any) => {
|
|
|
+ openModal(true, {
|
|
|
+ isUpdate: false,
|
|
|
+ baseData: [
|
|
|
+ {
|
|
|
+ ...record,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ const handleDeleteBatch = () => {
|
|
|
+ openModal(true, {
|
|
|
+ isUpdate: false,
|
|
|
+ baseData: {},
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ const handleSuccess = () => {
|
|
|
+ reload();
|
|
|
+ };
|
|
|
+ const handleExport = async () => {
|
|
|
+ const postData = getForm().getFieldsValue();
|
|
|
+ downloadByData(
|
|
|
+ (await postBaseNewStudentReportExportQuery({ ...postData, ...searchInfo })).data,
|
|
|
+ `新生列表${formatToDate(new Date())}.xlsx`,
|
|
|
+ );
|
|
|
+ };
|
|
|
+
|
|
|
+ const handleChangeReport = async () => {
|
|
|
+ try {
|
|
|
+ openFullLoading();
|
|
|
+ const keys: Recordable[] = [];
|
|
|
+ getSelectRowKeys().forEach((item) => {
|
|
|
+ keys.push({ id: item });
|
|
|
+ });
|
|
|
+ if (keys.length > 0) {
|
|
|
+ // await postStudentReportRecordAllSign(keys);
|
|
|
+ clearSelectedRowKeys();
|
|
|
+ await reload();
|
|
|
+ }
|
|
|
+ } finally {
|
|
|
+ closeFullLoading();
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ const handleChangeStduyStatus = (record: any) => {
|
|
|
+ createConfirm({
|
|
|
+ iconType: 'warning',
|
|
|
+ title: '温馨提醒',
|
|
|
+ content: '确认切换当前学生就读方式?',
|
|
|
+ onOk: async () => {
|
|
|
+ try {
|
|
|
+ await postStudentReportRecordUpdateStduyStatus({ id: record.id });
|
|
|
+ createMessage.success('切换成功');
|
|
|
+ await reload();
|
|
|
+ } catch (e) {
|
|
|
+ createMessage.error('切换失败');
|
|
|
+ }
|
|
|
+ },
|
|
|
+ okText: '确认',
|
|
|
+ cancelText: '取消',
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ const handleAjdust = (record: any) => {
|
|
|
+ openAdjustModal(true, {
|
|
|
+ isUpdate: false,
|
|
|
+ baseData: { ...record },
|
|
|
+ });
|
|
|
+ };
|
|
|
+</script>
|
|
|
+
|
|
|
+<template>
|
|
|
+ <PageWrapper dense contentFullHeight fixedHeight contentClass="flex">
|
|
|
+ <ClassTree class="w-1/3 xl:w-1/4" @select="handleSelect" />
|
|
|
+ <BasicTable class="w-2/3 xl:w-3/4" @register="registerTable" :searchInfo="searchInfo">
|
|
|
+ <template #toolbar>
|
|
|
+ <a-button type="primary" @click="handleDeleteBatch">报到日期设置</a-button>
|
|
|
+ <a-button type="primary" @click="handleChangeReport" :disabled="!hasSelected">
|
|
|
+ 变更为已报到
|
|
|
+ </a-button>
|
|
|
+ <a-button type="primary" @click="handleExport">导出</a-button>
|
|
|
+ </template>
|
|
|
+ <template #action="{ record }">
|
|
|
+ <TableAction
|
|
|
+ :actions="[
|
|
|
+ {
|
|
|
+ label: '切换就读方式',
|
|
|
+ onClick: handleChangeStduyStatus.bind(null, record),
|
|
|
+ ifShow: record.className,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '非本班学生',
|
|
|
+ onClick: handleDelete.bind(null, record),
|
|
|
+ ifShow: record.className,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '调整班级',
|
|
|
+ onClick: handleAjdust.bind(null, record),
|
|
|
+ ifShow: !record.className,
|
|
|
+ },
|
|
|
+ ]"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ </BasicTable>
|
|
|
+ <FormEdit @register="registerModal" @success="handleSuccess" />
|
|
|
+ <FormAdjust @register="registerAdjustModal" @success="handleSuccess" />
|
|
|
+ </PageWrapper>
|
|
|
+</template>
|
|
|
+
|
|
|
+<style scoped lang="less"></style>
|