|
@@ -1,70 +1,78 @@
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
import BasicModal from '/@/components/Modal/src/BasicModal.vue';
|
|
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 { ref } from 'vue';
|
|
- import { postBaseClassCourseImport } from '/@/services/apis/BaseClassCourseController';
|
|
|
|
import { useMessage } from '/@/hooks/web/useMessage';
|
|
import { useMessage } from '/@/hooks/web/useMessage';
|
|
import { baseDownloadFileUrl } from '/@/utils/file/download';
|
|
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 errMsg = ref('');
|
|
- const folderId = ref('');
|
|
|
|
const { createMessage } = useMessage();
|
|
const { createMessage } = useMessage();
|
|
- const data = ref('');
|
|
|
|
- const handleUpdate = async (e) => {
|
|
|
|
- data.value = e[0];
|
|
|
|
- };
|
|
|
|
|
|
+ const modelRef = ref<Recordable>({});
|
|
|
|
|
|
const emit = defineEmits(['success', 'register']);
|
|
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 {
|
|
try {
|
|
- await postBaseClassCourseImport({ file: data.value }, 'none');
|
|
|
|
|
|
+ openFullLoading();
|
|
|
|
+ await postBaseNewStudentScoreImport({
|
|
|
|
+ file: e,
|
|
|
|
+ enrollmentPlanId: modelRef.value.enrollmentPlanId,
|
|
|
|
+ });
|
|
createMessage.success('导入成功');
|
|
createMessage.success('导入成功');
|
|
- folderId.value = '';
|
|
|
|
- closeModal();
|
|
|
|
} catch (err: any) {
|
|
} catch (err: any) {
|
|
errMsg.value = err;
|
|
errMsg.value = err;
|
|
|
|
+ } finally {
|
|
|
|
+ closeFullLoading();
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
+
|
|
const handleCancel = () => {
|
|
const handleCancel = () => {
|
|
- folderId.value = '';
|
|
|
|
- errMsg.value = '';
|
|
|
|
- closeModal();
|
|
|
|
|
|
+ emit('success');
|
|
};
|
|
};
|
|
|
|
+
|
|
const handleDonwmLoad = async () => {
|
|
const handleDonwmLoad = async () => {
|
|
await baseDownloadFileUrl(
|
|
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>
|
|
</script>
|
|
|
|
|
|
<template>
|
|
<template>
|
|
<BasicModal
|
|
<BasicModal
|
|
- @cancel="handleCancel"
|
|
|
|
- @ok="handleSubmit"
|
|
|
|
- @register="modalRegister"
|
|
|
|
- destroyOnClose
|
|
|
|
|
|
+ :destroyOnClose="true"
|
|
|
|
+ :maskClosable="false"
|
|
v-bind="$attrs"
|
|
v-bind="$attrs"
|
|
|
|
+ @register="registerModal"
|
|
|
|
+ :width="1002"
|
|
title="新生成绩导入"
|
|
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>
|
|
</a-button>
|
|
</div>
|
|
</div>
|
|
<div class="mt-[12px]">
|
|
<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>
|
|
</div>
|
|
<span class="mt-[24px]">导入反馈:</span>
|
|
<span class="mt-[24px]">导入反馈:</span>
|
|
<div style="border: 1px solid #ccc; width: 100%; height: 300px; overflow: auto; color: red">
|
|
<div style="border: 1px solid #ccc; width: 100%; height: 300px; overflow: auto; color: red">
|