Browse Source

考生导入

zhangjie 1 year ago
parent
commit
0ff78f5b9a

+ 4 - 8
src/api/order.ts

@@ -68,17 +68,13 @@ export function ableTask(params: AbleParams): Promise<boolean> {
 // 考生信息导入
 // 考生信息导入
 // 考生信息导入分页
 // 考生信息导入分页
 export function studentImportListPage(): Promise<StudentExportListPageRes> {
 export function studentImportListPage(): Promise<StudentExportListPageRes> {
-  return axios.post('/api/admin/std/import/page', {});
+  return axios.post('/api/admin/std/page', {});
 }
 }
 // 考生信息导入-导入模板下载
 // 考生信息导入-导入模板下载
 export function studentInfoTemplate(): Promise<Blob> {
 export function studentInfoTemplate(): Promise<Blob> {
-  return axios.post(
-    '/api/admin/std/import/template',
-    {},
-    {
-      responseType: 'blob',
-    }
-  );
+  return axios.get('/api/admin/std/import/template', {
+    responseType: 'blob',
+  });
 }
 }
 
 
 // 预约名单
 // 预约名单

+ 5 - 1
src/api/types/order.ts

@@ -90,8 +90,12 @@ export interface OrderRecordListFilter {
 export type OrderRecordListPageParam = PageParams<OrderRecordListFilter>;
 export type OrderRecordListPageParam = PageParams<OrderRecordListFilter>;
 
 
 export interface StudentExportItem {
 export interface StudentExportItem {
-  id: string;
+  id: number;
   name: string;
   name: string;
+  fileName: string;
+  status: string;
+  message: string | null;
+  uploadTime: number;
 }
 }
 
 
 export type StudentExportListPageRes = PageResult<StudentExportItem>;
 export type StudentExportListPageRes = PageResult<StudentExportItem>;

+ 3 - 1
src/components/import-dialog/index.vue

@@ -212,7 +212,8 @@
     formData.append(props.uploadFileAlias, fileItem.file);
     formData.append(props.uploadFileAlias, fileItem.file);
     emit('uploading');
     emit('uploading');
 
 
-    const res = await axios
+    let res = true;
+    await axios
       .post(option.action, formData, {
       .post(option.action, formData, {
         headers: option.headers,
         headers: option.headers,
         onUploadProgress: ({ loaded, total }) => {
         onUploadProgress: ({ loaded, total }) => {
@@ -220,6 +221,7 @@
         },
         },
       })
       })
       .catch((error: Error) => {
       .catch((error: Error) => {
+        res = false;
         onError(error);
         onError(error);
       });
       });
     if (!res) return;
     if (!res) return;

+ 4 - 0
src/components/status-tag/index.vue

@@ -15,6 +15,10 @@
       themeDict: { true: 'green', false: 'red' },
       themeDict: { true: 'green', false: 'red' },
       valFilter: useDictOption('ABLE_TYPE').getLabel,
       valFilter: useDictOption('ABLE_TYPE').getLabel,
     },
     },
+    taskStatus: {
+      themeDict: { RUNNING: 'blue', SUCCESS: 'green', FAIL: 'red' },
+      valFilter: useDictOption('TASK_STATUS').getLabel,
+    },
   };
   };
   type ConfigKeyType = keyof typeof configs;
   type ConfigKeyType = keyof typeof configs;
 
 

+ 6 - 0
src/constants/enumerate.ts

@@ -16,4 +16,10 @@ export const ROLE_TYPE = {
   EXAM_TEACHER: '教学点管理员',
   EXAM_TEACHER: '教学点管理员',
 };
 };
 
 
+export const TASK_STATUS = {
+  RUNNING: '进行中',
+  SUCCESS: '成功',
+  FAIL: '失败',
+};
+
 export type RoleType = keyof typeof ROLE_TYPE;
 export type RoleType = keyof typeof ROLE_TYPE;

+ 7 - 1
src/hooks/dict-option.ts

@@ -1,11 +1,17 @@
 import { ref } from 'vue';
 import { ref } from 'vue';
-import { DEFAULT_LABEL, ABLE_TYPE, ROLE_TYPE } from '@/constants/enumerate';
+import {
+  DEFAULT_LABEL,
+  ABLE_TYPE,
+  ROLE_TYPE,
+  TASK_STATUS,
+} from '@/constants/enumerate';
 import { dictToOption } from '@/utils/utils';
 import { dictToOption } from '@/utils/utils';
 import { Options } from '@/types/global';
 import { Options } from '@/types/global';
 
 
 const dicts = {
 const dicts = {
   ABLE_TYPE,
   ABLE_TYPE,
   ROLE_TYPE,
   ROLE_TYPE,
+  TASK_STATUS,
 };
 };
 
 
 type DictTypeType = keyof typeof dicts;
 type DictTypeType = keyof typeof dicts;

+ 1 - 1
src/layout/default-layout.vue

@@ -117,7 +117,7 @@
 
 
   function initData() {
   function initData() {
     curRouteName.value = route.name;
     curRouteName.value = route.name;
-    console.log(route.name);
+    // console.log(route.name);
   }
   }
 
 
   function toMenuItem(val) {
   function toMenuItem(val) {

+ 1 - 1
src/store/modules/app/menuData.ts

@@ -26,7 +26,7 @@ export const menus = [
     parentId: '1',
     parentId: '1',
     sequence: 2,
     sequence: 2,
     enable: true,
     enable: true,
-    roles: [],
+    roles: ['ADMIN'],
   },
   },
   {
   {
     id: '4',
     id: '4',

+ 15 - 17
src/views/order/student-import/index.vue

@@ -17,10 +17,10 @@
       :bordered="false"
       :bordered="false"
     >
     >
       <template #status="{ record }">
       <template #status="{ record }">
-        {{ record.cancel ? '已取消' : '正常' }}
+        <status-tag type="taskStatus" :value="record.status" />
       </template>
       </template>
-      <template #updateTime="{ record }">
-        {{ timestampFilter(record.updateTime) }}
+      <template #uploadTime="{ record }">
+        {{ timestampFilter(record.uploadTime) }}
       </template>
       </template>
       <template #action="{ record }">
       <template #action="{ record }">
         <a-button type="text" class="btn-danger" @click="toDownload(record)"
         <a-button type="text" class="btn-danger" @click="toDownload(record)"
@@ -78,35 +78,33 @@
   const columns: TableColumnData[] = [
   const columns: TableColumnData[] = [
     {
     {
       title: '任务名称',
       title: '任务名称',
-      dataIndex: 'taskName',
+      dataIndex: 'name',
     },
     },
     {
     {
       title: '文件名',
       title: '文件名',
-      dataIndex: 'identityNumber',
+      dataIndex: 'fileName',
     },
     },
     {
     {
       title: '状态',
       title: '状态',
-      dataIndex: 'studentCode',
+      slotName: 'status',
       width: 100,
       width: 100,
     },
     },
     {
     {
       title: '异常',
       title: '异常',
-      dataIndex: 'teachingName',
-      width: 100,
+      dataIndex: 'message',
     },
     },
     {
     {
       title: '上传时间',
       title: '上传时间',
-      slotName: 'updateTime',
+      slotName: 'uploadTime',
       width: 170,
       width: 170,
     },
     },
-
-    {
-      title: '操作',
-      slotName: 'action',
-      width: 80,
-      fixed: 'right',
-      cellClass: 'action-column',
-    },
+    // {
+    //   title: '操作',
+    //   slotName: 'action',
+    //   width: 160,
+    //   fixed: 'right',
+    //   cellClass: 'action-column',
+    // },
   ];
   ];
   const { dataList, pagination, getList } = useTable<StudentExportItem[]>(
   const { dataList, pagination, getList } = useTable<StudentExportItem[]>(
     studentImportListPage,
     studentImportListPage,