DESKTOP-USV654P\pc пре 6 месеци
родитељ
комит
838c010156

+ 7 - 0
src/services/apis/BaseNewStudentController.ts

@@ -26,6 +26,10 @@ export async function deleteStudentBaseNewStudent(params:string[],mode: ErrorMes
 export async function postBaseNewStudentActiveAccount(params:API.ActiveAccountDto
 ,mode: ErrorMessageMode = 'modal'){ return defHttp.post<any>
         ({url: '/student/baseNewStudent/active-account', data:params},{errorMessageMode:mode});}
+/** 删除新生(保留新生信息,删除基础信息) DELETE /student/baseNewStudent/deleteByUserIds */
+export async function deleteBaseNewStudentDeleteByUserIds(params:API.DeleteNewStudentDto
+,mode: ErrorMessageMode = 'modal'){ return defHttp.delete<any>
+        ({url: '/student/baseNewStudent/deleteByUserIds', data:params},{errorMessageMode:mode});}
 /** 导入 POST /student/baseNewStudent/import */
 export async function postBaseNewStudentImport(params:any,mode: ErrorMessageMode = 'modal'){ return defHttp.post<API.Map[]>
         ({url: '/student/baseNewStudent/import',headers:{'Content-Type':'multipart/form-data'}, data:params},{errorMessageMode:mode});}
@@ -35,6 +39,9 @@ export async function getBaseNewStudentInfo(params:any,mode: ErrorMessageMode =
 /** 新生维护信息列表(分页) GET /student/baseNewStudent/page */
 export async function getBaseNewStudentPage(params:any,mode: ErrorMessageMode = 'modal'){ return defHttp.get<API.PageOutput<API.BaseNewStudentPageVo>>
         ({url: '/student/baseNewStudent/page', params:params},{errorMessageMode:mode});}
+/** 新生报到(分页) GET /student/baseNewStudent/report-page */
+export async function getBaseNewStudentReportPage(params:any,mode: ErrorMessageMode = 'modal'){ return defHttp.get<API.PageOutput<API.BaseNewStudentPageVo>>
+        ({url: '/student/baseNewStudent/report-page', params:params},{errorMessageMode:mode});}
 /** 成绩导入 POST /student/baseNewStudent/score-import */
 export async function postBaseNewStudentScoreImport(params:any,mode: ErrorMessageMode = 'modal'){ return defHttp.post<API.Map[]>
         ({url: '/student/baseNewStudent/score-import',headers:{'Content-Type':'multipart/form-data'}, data:params},{errorMessageMode:mode});}

+ 15 - 0
src/services/typing.d.ts

@@ -5435,6 +5435,8 @@ isAdjust?: number;
 mobile?: string;
 /** 学生姓名 */
 name?: string;
+/** 报到时间 */
+reportTime?: string;
 /** 成绩 */
 score?: number;
 /** 第二志愿 */
@@ -5451,6 +5453,8 @@ stduyStatus?: string;
 stduyStatusCn?: string;
 /** 班主任 */
 teacherName?: string;
+/** 学生userId */
+userId?: string;
 /** 体重 */
 weight?: number;
 }
@@ -8430,6 +8434,15 @@ type DeleteAppPageDesignDto = {
 id?: string;
 }
 
+type DeleteNewStudentDto = {
+/** 删除原因 */
+deleteReason?: string;
+/** 新生信息id */
+ids?: string[];
+/** 学生userIds */
+userIds?: string[];
+}
+
 type DeleteNewsRelationDto = {
 /** 新闻主键 */
 newsId?: string;
@@ -11012,6 +11025,8 @@ size?: number;
 startDate?: string;
 /** 班级状态(0:未分配, 1:已分配) */
 status?: number;
+/** 班主任id */
+teacherId?: string;
 /** 树id */
 treeId?: string;
 /** 树类型(1:年级,2:春秋季) */

+ 14 - 8
src/views/educational/studentReport/data.config.ts

@@ -5,6 +5,8 @@ import { Switch } from 'ant-design-vue';
 import { h } from 'vue';
 import { useMessage } from '/@/hooks/web/useMessage';
 import { deleteStudentStudentReportRecord, postStudentStudentReportRecord } from '/@/services/apis/StudentReportRecordController';
+import { formatToDate } from '/@/utils/dateUtil';
+
 export const tableColumns: BasicColumn[] = [
   {
     title: '班级',
@@ -39,19 +41,19 @@ export const tableColumns: BasicColumn[] = [
     title: '手机号',
     dataIndex: 'mobile',
     align: 'left',
-    width: 150,
+    width: 120,
   },
   {
     title: '家长联系电话',
-    dataIndex: 'parentMobile',
+    dataIndex: 'familyMobile',
     align: 'left',
-    width: 100,
+    width: 120,
   },
   {
     title: '学生来源',
     dataIndex: 'sourceCn',
     align: 'left',
-    width: 100,
+    width: 120,
   },
   {
     title: '就读方式',
@@ -84,7 +86,8 @@ export const tableColumns: BasicColumn[] = [
               await deleteStudentStudentReportRecord([record.userId]);
             }
             record.isReport = newStatus;
-            createMessage.error('修改成功');
+            record.reportTime = formatToDate(new Date());
+            createMessage.success('修改成功');
           } finally {
             record.pendingStatus = false;
           }
@@ -94,9 +97,12 @@ export const tableColumns: BasicColumn[] = [
   },
   {
     title: '报到日期',
-    dataIndex: 'graduateClass',
+    dataIndex: 'reportTime',
     align: 'left',
-    width: 80,
+    width: 150,
+    customRender: ({ record }) => {
+      return record.isReport === 1 ? '' : record.reportTime;
+    },
   },
 ];
 
@@ -126,7 +132,7 @@ export const searchFormSchema: FormSchema[] = [
     colProps: { span: 8 },
   },
   {
-    field: 'studentSource',
+    field: 'source',
     label: '学生来源',
     component: 'ApiSelect',
     colProps: { span: 8 },

+ 93 - 0
src/views/educational/studentReport/edit.vue

@@ -0,0 +1,93 @@
+<template>
+  <BasicModal
+    @ok="handleSubmit"
+    :destroyOnClose="true"
+    :maskClosable="false"
+    v-bind="$attrs"
+    @register="registerModal"
+    :title="getTitle"
+    :width="1002"
+  >
+    <BasicForm @register="registerForm">
+      <template #studentIds>
+        <div class="flex" style="flex-wrap: wrap">
+          <div v-for="(item, index) in modelRef" :key="index">
+            <div style="margin: 4px" v-if="index < 6"> {{ item.name }}</div>
+          </div>
+          <div style="margin: 4px" v-if="modelRef.length > 6"> ... 等{{ modelRef.length }}个 </div>
+        </div>
+      </template>
+    </BasicForm>
+  </BasicModal>
+</template>
+<script setup lang="ts">
+  import { ref, computed, unref } from 'vue';
+  import { useMessage } from '/@/hooks/web/useMessage';
+  import { BasicModal, useModalInner } from '/@/components/Modal';
+  import { BasicForm, useForm } from '/@/components/Form/index';
+
+  import { deleteBaseNewStudentDeleteByUserIds } from '/@/services/apis/BaseNewStudentController';
+
+  const isUpdate = ref(true);
+  const modelRef = ref<Recordable[]>([]);
+  const emit = defineEmits(['success', 'register']);
+  const { createMessage } = useMessage();
+  const [registerForm, { validate, resetFields }] = useForm({
+    labelWidth: 100,
+    schemas: [
+      {
+        field: 'studentIds',
+        label: '删除学生',
+        component: 'Input',
+        colProps: { span: 24 },
+        slot: 'studentIds',
+      },
+      {
+        field: 'deleteReason',
+        label: '删除原因',
+        component: 'Input',
+        colProps: { span: 24 },
+      },
+    ],
+    showActionButtonGroup: false,
+  });
+
+  const [registerModal, { closeModal, setModalProps }] = useModalInner(async (data) => {
+    resetFields();
+    setModalProps({ confirmLoading: false });
+    isUpdate.value = !!data?.isUpdate;
+    modelRef.value = [...data.baseData];
+  });
+
+  const getTitle = computed(() => (!unref(isUpdate) ? '删除' : '删除'));
+  const handleSubmit = async () => {
+    try {
+      const values = await validate();
+      setModalProps({ confirmLoading: true });
+
+      const ids: string[] = [];
+      const userIds: string[] = [];
+
+      modelRef.value.forEach((item) => {
+        ids.push(item.id);
+        userIds.push(item.userId);
+      });
+
+      const postParams = {
+        ids: ids,
+        userIds: userIds,
+      };
+      Object.assign(postParams, values);
+
+      await deleteBaseNewStudentDeleteByUserIds(postParams);
+
+      createMessage.success('操作成功');
+      closeModal();
+      emit('success');
+    } finally {
+      setModalProps({ confirmLoading: false });
+    }
+  };
+</script>
+
+<style scoped lang="less"></style>

+ 35 - 24
src/views/educational/studentReport/index.vue

@@ -4,19 +4,19 @@
   import { searchFormSchema, tableColumns } from './data.config';
   import ClassTree from '/@/views/educational/basicInformation/components/tree.vue';
   import { reactive } from 'vue';
-  import {
-    deleteStudentBaseNewStudent,
-    getBaseNewStudentPage,
-  } from '/@/services/apis/BaseNewStudentController';
-  import { useMessage } from '/@/hooks/web/useMessage';
+  import { 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';
 
   const searchInfo = reactive<Recordable>({});
 
-  const { createConfirm, createMessage } = useMessage();
+  const [registerModal, { openModal }] = useModal();
+  const { createMessage } = useMessage();
 
-  const [registerTable, { reload }] = useTable({
-    api: getBaseNewStudentPage,
+  const [registerTable, { reload, getSelectRows }] = useTable({
+    api: getBaseNewStudentReportPage,
     title: '新生列表',
     rowKey: 'id',
     columns: tableColumns,
@@ -47,30 +47,40 @@
   }
 
   const handleDelete = (record: any) => {
-    createConfirm({
-      iconType: 'warning',
-      title: '温馨提醒',
-      content: '是否删除该记录?',
-      onOk: async () => {
-        try {
-          await deleteStudentBaseNewStudent([record.id]);
-          createMessage.success('删除成功');
-          await reload();
-        } catch (e) {
-          createMessage.error('删除失败');
-        }
-      },
-      okText: '确认',
-      cancelText: '取消',
+    openModal(true, {
+      isUpdate: false,
+      baseData: [
+        {
+          ...record,
+        },
+      ],
+    });
+  };
+
+  const handleDeleteBatch = () => {
+    const selectRows = getSelectRows();
+    if (selectRows.length === 0) {
+      createMessage.warning('选择删除的学生');
+      return;
+    }
+    openModal(true, {
+      isUpdate: false,
+      baseData: [...selectRows],
     });
   };
+
+  const handleSuccess = () => {
+    reload();
+  };
 </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> </template>
+      <template #toolbar>
+        <a-button type="primary" @click="handleDeleteBatch">批量删除</a-button>
+      </template>
       <template #action="{ record }">
         <div style="display: flex; justify-content: center">
           <TableAction
@@ -85,6 +95,7 @@
         </div>
       </template>
     </BasicTable>
+    <FormEdit @register="registerModal" @success="handleSuccess" />
   </PageWrapper>
 </template>