|
@@ -4,9 +4,10 @@ import dayjs from 'dayjs';
|
|
|
import { dict } from '@fast-crud/fast-crud';
|
|
|
import axios from 'axios';
|
|
|
import { usePermission } from '@/composables';
|
|
|
+import { localStg } from '@/utils';
|
|
|
import { getServiceEnvConfig } from '~/.env-config';
|
|
|
import type { AddArchivesParams } from './api';
|
|
|
-import { getArchives, getFile, addArchives, deleteArchives, downloadArchives } from './api';
|
|
|
+import { getArchives, getFile, addArchives, deleteArchives, downloadArchives, refreshArchive } from './api';
|
|
|
const { url, proxyPattern } = getServiceEnvConfig(import.meta.env);
|
|
|
const isHttpProxy = import.meta.env.VITE_HTTP_PROXY === 'Y';
|
|
|
const { hasPermission } = usePermission();
|
|
@@ -116,6 +117,31 @@ export default function createCrudOptions(crudOptionsProps: CreateCrudOptionsPro
|
|
|
window.location.href = fileUrl;
|
|
|
}
|
|
|
}
|
|
|
+ },
|
|
|
+ refreshArchive: {
|
|
|
+ text: '刷新档案',
|
|
|
+ title: '刷新当前学员档案',
|
|
|
+ circle: false,
|
|
|
+ tooltip: {
|
|
|
+ slots: {
|
|
|
+ default() {
|
|
|
+ return '刷新当前学员档案';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ click: async () => {
|
|
|
+ if (!crudOptionsProps.context) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!crudOptionsProps.context.studentNumber) {
|
|
|
+ crudOptionsProps.context.message.info('没有筛选人员的情况下 , 不允许刷新档案!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const { status } = await refreshArchive(crudOptionsProps.context.studentNumber);
|
|
|
+ if (status) {
|
|
|
+ window.$message?.success('操作成功!');
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -196,17 +222,17 @@ export default function createCrudOptions(crudOptionsProps: CreateCrudOptionsPro
|
|
|
crudOptionsProps.context.message.info('请先选择类别, 在上传档案!');
|
|
|
throw new Error('请先选择类别, 在上传档案!');
|
|
|
}
|
|
|
- const action = isHttpProxy
|
|
|
- ? `${proxyPattern}/student/upload?fileType`
|
|
|
- : `${url}/student/upload?fileType`;
|
|
|
+ const action = isHttpProxy ? `${proxyPattern}/student/upload` : `${url}/student/upload`;
|
|
|
const { file, onProgress } = props;
|
|
|
+ const token = localStg.get('token');
|
|
|
const data = new FormData();
|
|
|
data.append('file', file);
|
|
|
data.append('fileType', crudOptionsProps.context.archivesForm.filetype);
|
|
|
data.append('studentNumber', crudOptionsProps.context.archivesForm.studentNumber);
|
|
|
const res = await axios.post(action, data, {
|
|
|
headers: {
|
|
|
- 'Content-Type': 'multipart/form-data'
|
|
|
+ 'Content-Type': 'multipart/form-data',
|
|
|
+ Authorization: token
|
|
|
},
|
|
|
timeout: 60000,
|
|
|
onUploadProgress(progress) {
|