提交代码
This commit is contained in:
1 parent
8fa9be8f9d
commit
daae3039ab
23 files changed
+2760
-10
No files matched your search
@@ -229,3 +229,7 @@ aside {
|
||||
.el-overlay .el-overlay-dialog .el-dialog .el-dialog__header {
|
||||
padding: 10px 10px !important;
|
||||
}
|
||||
|
||||
.el-message {
|
||||
z-index: 4000 !important;
|
||||
}
|
||||
@@ -28,7 +28,7 @@ axios.defaults.headers['clientid'] = import.meta.env.VITE_APP_CLIENT_ID;
|
||||
// 创建 axios 实例
|
||||
const service = axios.create({
|
||||
baseURL: import.meta.env.VITE_APP_BASE_API,
|
||||
timeout: 50000
|
||||
timeout: 300000 // 增加到5分钟,适合大数据量导出
|
||||
});
|
||||
|
||||
// 请求拦截器
|
||||
@@ -194,7 +194,8 @@ export function download(url: string, params: any, fileName: string) {
|
||||
}
|
||||
],
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
responseType: 'blob'
|
||||
responseType: 'blob',
|
||||
timeout: 1200000 // 导出接口单独设置20分钟超时
|
||||
}).then(async (resp: any) => {
|
||||
const isLogin = blobValidate(resp);
|
||||
if (isLogin) {
|
||||
|
||||
@@ -2135,14 +2135,42 @@ const handleImport = () => {
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = () => {
|
||||
// 实际项目中需要调用导出API
|
||||
ElMessage.success('导出成功');
|
||||
// 显示导出进度提示
|
||||
ElMessage({
|
||||
message: '正在导出数据,请耐心等待...',
|
||||
type: 'info',
|
||||
duration: 0,
|
||||
zIndex: 4000 // 这里手动指定
|
||||
});
|
||||
|
||||
proxy
|
||||
?.download(
|
||||
'studentMsg/studentMsg/export',
|
||||
{
|
||||
...queryParams,
|
||||
...proxy?.addDateRange(queryParams, dateRange.value)
|
||||
},
|
||||
`student_${new Date().getTime()}.xlsx`
|
||||
)
|
||||
.then(() => {
|
||||
// 导出成功后关闭提示
|
||||
ElMessage.closeAll();
|
||||
ElMessage.success('导出成功');
|
||||
})
|
||||
.catch((error) => {
|
||||
// 导出失败时关闭提示
|
||||
ElMessage.closeAll();
|
||||
if (error.message && error.message.includes('timeout')) {
|
||||
ElMessage.error('导出超时,请尝试减少导出数据量或联系管理员');
|
||||
} else {
|
||||
ElMessage.error('导出失败,请稍后重试');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 下载模板操作 */
|
||||
const importTemplate = () => {
|
||||
// 实际项目中需要调用下载模板API
|
||||
ElMessage.success('下载模板成功');
|
||||
proxy?.download('studentMsg/studentMsg/importTemplate', {}, `student_template_${new Date().getTime()}.xlsx`);
|
||||
};
|
||||
|
||||
/**文件上传中处理 */
|
||||
@@ -2652,4 +2680,9 @@ onMounted(() => {
|
||||
border: none;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
/* 解决 ElMessage 被遮罩层覆盖问题,提升 z-index */
|
||||
:deep(.el-message) {
|
||||
z-index: 4000 !important;
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user