Explorar el Código

feat:新生导入

DESKTOP-USV654P\pc hace 4 meses
padre
commit
2a45bb5a72

+ 4 - 1
src/services/apis/BaseNewStudentController.ts

@@ -23,7 +23,7 @@ export async function putStudentBaseNewStudent(params:API.UpdateBaseNewStudentDt
 export async function deleteStudentBaseNewStudent(params:string[],mode: ErrorMessageMode = 'modal'){ return defHttp.delete<any>
         ({url: '/student/baseNewStudent', data:params},{errorMessageMode:mode});}
 /** 导入 POST /student/baseNewStudent/import */
-export async function postBaseNewStudentImport(params:any,mode: ErrorMessageMode = 'modal'){ return defHttp.post<any>
+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});}
 /** 根据id查询新生维护信息信息 GET /student/baseNewStudent/info */
 export async function getBaseNewStudentInfo(params:any,mode: ErrorMessageMode = 'modal'){ return defHttp.get<API.BaseNewStudentVo>
@@ -31,6 +31,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});}
+/** 成绩导入 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});}
 /** 新生维护信息树 GET /student/baseNewStudent/tree */
 export async function getBaseNewStudentTree(params:any,mode: ErrorMessageMode = 'modal'){ return defHttp.get<API.BaseNewStudentTreeVo[]>
         ({url: '/student/baseNewStudent/tree', params:params},{errorMessageMode:mode});}

+ 24 - 2
src/services/typing.d.ts

@@ -438,6 +438,10 @@ type AddBaseNewStudentDto = {
 credentialNumber?: string;
 /** 招生计划id(enrollment_plan) */
 enrollmentPlanId?: string;
+/** 家庭地址 */
+familyAddress?: string;
+/** 家庭电话 */
+familyMobile?: string;
 /** 第一志愿 */
 firstAmbition?: string;
 /** 性别 */
@@ -4675,6 +4679,10 @@ type BaseNewStudentPageVo = {
 createDate?: string;
 /** 身份证号 */
 credentialNumber?: string;
+/** 家庭地址 */
+familyAddress?: string;
+/** 家庭电话 */
+familyMobile?: string;
 /** 第一志愿 */
 firstAmbition?: string;
 /** 性别 */
@@ -14321,8 +14329,12 @@ classIds?: string;
 courseName?: string;
 /** 课程编号(base_course_subject) */
 courseSubjectId?: string;
+/** 主编 */
+editorInChief?: string;
 /** 主键编号 */
 id?: string;
+/** 国际标准刊号 */
+issn?: string;
 /** 出版社 */
 publishingHouse?: string;
 /** 学生用书征订数量 */
@@ -14335,6 +14347,8 @@ textbookType?: string;
 textbookTypeCn?: string;
 /** 使用类型(单位:学期) */
 useType?: number;
+/** 版本 */
+version?: string;
 }
 
 type TextbookSubscriptionRecordVo = {
@@ -14879,6 +14893,10 @@ type UpdateBaseNewStudentDto = {
 credentialNumber?: string;
 /** 招生计划id(enrollment_plan) */
 enrollmentPlanId?: string;
+/** 家庭地址 */
+familyAddress?: string;
+/** 家庭电话 */
+familyMobile?: string;
 /** 第一志愿 */
 firstAmbition?: string;
 /** 性别 */
@@ -18982,6 +19000,10 @@ teacherReferenceNumber?: number;
 teacherSubscriptionNumber?: number;
 /** 教材id */
 textbookId?: string;
+/** 教材类型(xjr_dictionary_item[textbook_type]) */
+textbookType?: string;
+/** 教材类型(xjr_dictionary_item[textbook_type]) */
+textbookTypeCn?: string;
 /** 版本 */
 version?: string;
 /** 教材教辅征订编号 */
@@ -19078,8 +19100,8 @@ sortCode?: number;
 studentSubscriptionNumber?: number;
 /** 征订类型(xjr_dictionary_item[subscription_type]) */
 subscriptionType?: string;
-/** 教师教参用书征订数量 */
-teacherReferenceNumber?: number;
+/** 征订数量 */
+sumNumber?: number;
 /** 教师教材征订数量 */
 teacherSubscriptionNumber?: number;
 /** 教材编号 */

+ 43 - 35
src/views/educational/basicInformation/components/import.vue

@@ -1,70 +1,78 @@
 <script setup lang="ts">
   import BasicModal from '/@/components/Modal/src/BasicModal.vue';
-  import { useModal } from '/@/components/Modal';
-  import Upload from '/@/components/Form/src/components/Upload.vue';
+  import { useModalInner } from '/@/components/Modal';
+  import { Upload } from 'ant-design-vue';
   import { ref } from 'vue';
-  import { postBaseClassCourseImport } from '/@/services/apis/BaseClassCourseController';
   import { useMessage } from '/@/hooks/web/useMessage';
   import { baseDownloadFileUrl } from '/@/utils/file/download';
-  const [modalRegister, { closeModal }] = useModal();
+  import { useLoading } from '/@/components/Loading';
+  import { postBaseNewStudentScoreImport } from '/@/services/apis/BaseNewStudentController';
+
   const errMsg = ref('');
-  const folderId = ref('');
   const { createMessage } = useMessage();
-  const data = ref('');
-  const handleUpdate = async (e) => {
-    data.value = e[0];
-  };
+  const modelRef = ref<Recordable>({});
 
   const emit = defineEmits(['success', 'register']);
-  const handleSubmit = async () => {
+
+  const [openFullLoading, closeFullLoading] = useLoading({
+    tip: '处理中...',
+  });
+
+  const [registerModal, { setModalProps }] = useModalInner((data) => {
+    setModalProps({ confirmLoading: false });
+    modelRef.value = { ...data.baseData };
+  });
+
+  const beforeUpload = async (e) => {
     try {
-      await postBaseClassCourseImport({ file: data.value }, 'none');
+      openFullLoading();
+      await postBaseNewStudentScoreImport({
+        file: e,
+        enrollmentPlanId: modelRef.value.enrollmentPlanId,
+      });
       createMessage.success('导入成功');
-      folderId.value = '';
-      closeModal();
     } catch (err: any) {
       errMsg.value = err;
+    } finally {
+      closeFullLoading();
     }
   };
+
   const handleCancel = () => {
-    folderId.value = '';
-    errMsg.value = '';
-    closeModal();
+    emit('success');
   };
+
   const handleDonwmLoad = async () => {
     await baseDownloadFileUrl(
-      'https://zhxy.cqtlzjzx.com/minio/static/resources/%E7%8F%AD%E7%BA%A7%E8%AF%BE%E7%A8%8B%E5%AF%BC%E5%85%A5%E6%A8%A1%E6%9D%BF.xlsx',
-      '班级课表导入模板.xlsx',
+      'https://zhxy.cqtlzjzx.com/minio/static/resources/%E5%AD%A6%E7%94%9F%E6%88%90%E7%BB%A9%E5%AF%BC%E5%85%A5%E6%A8%A1%E6%9D%BF.xlsx',
+      '学生成绩导入模板.xlsx',
     );
   };
 </script>
 
 <template>
   <BasicModal
-    @cancel="handleCancel"
-    @ok="handleSubmit"
-    @register="modalRegister"
-    destroyOnClose
+    :destroyOnClose="true"
+    :maskClosable="false"
     v-bind="$attrs"
+    @register="registerModal"
+    :width="1002"
     title="新生成绩导入"
+    :footer="null"
+    @cancel="handleCancel"
   >
-    <div class="flex flex-col mt-[24px]">
-      <div class="flex flex-col">
-        <span class="text-[16px] text-[1000]">1、 下载导入模板</span>
-        <a-button type="primary" class="w-[110px] mt-[12px]" @click="handleDonwmLoad">
+    <div class="flex flex-col">
+      <div class="flex items-center">
+        <div class="text-[16px] text-[1000]">1、 下载导入模板</div>
+        <a-button type="primary" class="w-[110px] ml-[12px]" @click="handleDonwmLoad">
           下载模板
         </a-button>
       </div>
       <div class="mt-[12px]">
-        <span class="text-[16px] text-[1000]">2、 上传文件</span>
-        <Upload
-          class="mt-[12px]"
-          accept="xlsx,xls"
-          :maxNumber="1"
-          v-model:value="folderId"
-          :multiple="false"
-          @success="handleUpdate"
-        />
+        <div class="text-[16px] text-[1000] mb-2">2、 上传文件</div>
+        <Upload.Dragger :showUploadList="false" :before-upload="beforeUpload" accept=".xlsx,.xls">
+          <p class="ant-upload-text">单击或拖动文件到此区域进行上传 </p>
+        </Upload.Dragger>
       </div>
       <span class="mt-[24px]">导入反馈:</span>
       <div style="border: 1px solid #ccc; width: 100%; height: 300px; overflow: auto; color: red">

+ 8 - 3
src/views/educational/basicInformation/components/import1.vue

@@ -10,6 +10,7 @@
 
   const errMsg = ref('');
   const { createMessage } = useMessage();
+  const modelRef = ref<Recordable>({});
 
   const emit = defineEmits(['success', 'register']);
 
@@ -17,14 +18,18 @@
     tip: '处理中...',
   });
 
-  const [registerModal, { setModalProps }] = useModalInner(() => {
+  const [registerModal, { setModalProps }] = useModalInner((data) => {
     setModalProps({ confirmLoading: false });
+    modelRef.value = { ...data.baseData };
   });
 
   const beforeUpload = async (e) => {
     try {
       openFullLoading();
-      await postBaseNewStudentImport({ file: e });
+      await postBaseNewStudentImport({
+        file: e,
+        enrollmentPlanId: modelRef.value.enrollmentPlanId,
+      });
       createMessage.success('导入成功');
     } catch (err: any) {
       errMsg.value = err;
@@ -52,7 +57,7 @@
     v-bind="$attrs"
     @register="registerModal"
     :width="1002"
-    title="新生成绩导入"
+    title="新生导入"
     :footer="null"
     @cancel="handleCancel"
   >

+ 1 - 1
src/views/educational/basicInformation/components/tree.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="mr-2 overflow-hidden bg-white h-full">
     <BasicTree
-      :title="t('年级列表')"
+      :title="t('招生计划')"
       toolbar
       search
       :clickRowToExpand="true"

+ 22 - 3
src/views/educational/basicInformation/index.vue

@@ -9,11 +9,14 @@
   import { useModal } from '/@/components/Modal';
   import { reactive } from 'vue';
   import { getBaseNewStudentPage } from '/@/services/apis/BaseNewStudentController';
+  import { useMessage } from '/@/hooks/web/useMessage';
 
   const searchInfo = reactive<Recordable>({});
 
   const [registerModal, { openModal }] = useModal();
 
+  const { createMessage } = useMessage();
+
   const [registerImportModal, { openModal: openImportModal }] = useModal();
 
   const [registerStudentImportModal, { openModal: openStudentImportModal }] = useModal();
@@ -41,6 +44,14 @@
     },
   });
   const handleEdit = (record: any, isUpdate: boolean) => {
+    if (isUpdate === false) {
+      if (searchInfo.enrollmentPlanId) {
+        record.enrollmentPlanId = searchInfo.enrollmentPlanId;
+      } else {
+        createMessage.warning('请选择招生计划');
+        return;
+      }
+    }
     openModal(true, {
       isUpdate: isUpdate,
       baseData: {
@@ -50,7 +61,7 @@
   };
 
   function handleSelect(id) {
-    searchInfo.classId = id;
+    searchInfo.enrollmentPlanId = id;
     reload();
   }
 
@@ -59,10 +70,18 @@
   };
 
   const handelStudenImport = () => {
-    openStudentImportModal(true, {});
+    if (searchInfo.enrollmentPlanId) {
+      openStudentImportModal(true, { baseData: { enrollmentPlanId: searchInfo.enrollmentPlanId } });
+    } else {
+      createMessage.warning('请选择招生计划');
+    }
   };
   const handelImport = () => {
-    openImportModal(true, {});
+    if (searchInfo.enrollmentPlanId) {
+      openImportModal(true, { baseData: { enrollmentPlanId: searchInfo.enrollmentPlanId } });
+    } else {
+      createMessage.warning('请选择招生计划');
+    }
   };
 </script>