Przeglądaj źródła

feat:新生导入

DESKTOP-USV654P\pc 4 miesięcy temu
rodzic
commit
fa65ceb83a

+ 10 - 2
src/views/educational/basicInformation/components/import.vue

@@ -7,6 +7,7 @@
   import { baseDownloadFileUrl } from '/@/utils/file/download';
   import { useLoading } from '/@/components/Loading';
   import { postBaseNewStudentScoreImport } from '/@/services/apis/BaseNewStudentController';
+  import { jsonToSheetXlsx } from '/@/components/Excel';
 
   const errMsg = ref('');
   const { createMessage } = useMessage();
@@ -26,11 +27,18 @@
   const beforeUpload = async (e) => {
     try {
       openFullLoading();
-      await postBaseNewStudentScoreImport({
+      const data = await postBaseNewStudentScoreImport({
         file: e,
-        enrollmentPlanId: modelRef.value.enrollmentPlanId,
+        treeId: modelRef.value.enrollmentPlanId,
       });
       createMessage.success('导入成功');
+      if (data && data.length > 0) {
+        jsonToSheetXlsx({
+          data,
+          filename: '成绩出错记录.xlsx',
+        });
+        errMsg.value = '导入数据有误,请查看附件';
+      }
     } catch (err: any) {
       errMsg.value = err;
     } finally {

+ 10 - 2
src/views/educational/basicInformation/components/import1.vue

@@ -7,6 +7,7 @@
   import { baseDownloadFileUrl } from '/@/utils/file/download';
   import { useLoading } from '/@/components/Loading';
   import { postBaseNewStudentImport } from '/@/services/apis/BaseNewStudentController';
+  import { jsonToSheetXlsx } from '/@/components/Excel';
 
   const errMsg = ref('');
   const { createMessage } = useMessage();
@@ -26,11 +27,18 @@
   const beforeUpload = async (e) => {
     try {
       openFullLoading();
-      await postBaseNewStudentImport({
+      const data = await postBaseNewStudentImport({
         file: e,
-        enrollmentPlanId: modelRef.value.enrollmentPlanId,
+        treeId: modelRef.value.enrollmentPlanId,
       });
       createMessage.success('导入成功');
+      if (data && data.length > 0) {
+        jsonToSheetXlsx({
+          data,
+          filename: '新生出错记录.xlsx',
+        });
+        errMsg.value = '导入数据有误,请查看附件';
+      }
     } catch (err: any) {
       errMsg.value = err;
     } finally {