Browse Source

feat:新生导入

DESKTOP-USV654P\pc 4 months ago
parent
commit
fa65ceb83a

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

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

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

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