|
|
@@ -702,7 +702,7 @@ const getStatusType = (row: any) => {
|
|
|
return 'warning';
|
|
|
};
|
|
|
|
|
|
-const exportScoresNames = () => {
|
|
|
+const exportScoresNames = async () => {
|
|
|
// 获取默认赛事ID
|
|
|
const event = gameEventStore.defaultEventInfo;
|
|
|
const eventId = event?.eventId;
|
|
|
@@ -712,14 +712,44 @@ const exportScoresNames = () => {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- // 使用 proxy?.download 方式导出
|
|
|
- proxy?.download(
|
|
|
- 'system/gameScore/exportScoresDetail',
|
|
|
- {
|
|
|
- eventId: eventId
|
|
|
- },
|
|
|
- `成绩详情表_${new Date().toLocaleDateString()}.xlsx`
|
|
|
- );
|
|
|
+ try {
|
|
|
+ // 弹出输入框询问名次
|
|
|
+ const { value } = await ElMessageBox.prompt(
|
|
|
+ '请输入导出各项目的前几名成绩(留空或输入0则导出全部)',
|
|
|
+ '导出成绩',
|
|
|
+ {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ inputPattern: /^\d*$/,
|
|
|
+ inputErrorMessage: '请输入有效的数字',
|
|
|
+ inputPlaceholder: '导出前N名,例如:3',
|
|
|
+ }
|
|
|
+ );
|
|
|
+
|
|
|
+ const topN = value ? parseInt(value) : 0;
|
|
|
+
|
|
|
+ // 构造请求参数
|
|
|
+ const params = {
|
|
|
+ eventId: eventId,
|
|
|
+ topN: topN > 0 ? topN : undefined,
|
|
|
+ projectIds: ids.value.length > 0 ? ids.value.join(',') : undefined
|
|
|
+ };
|
|
|
+
|
|
|
+ // 文件名动态调整
|
|
|
+ let fileName = `成绩详情表`;
|
|
|
+ if (topN > 0) fileName += `_前${topN}名`;
|
|
|
+ if (ids.value.length == 0) fileName += `_全部项目`;
|
|
|
+ fileName += '.xlsx';
|
|
|
+
|
|
|
+ // 执行导出
|
|
|
+ proxy?.download(
|
|
|
+ 'system/gameScore/exportScoresDetail',
|
|
|
+ params,
|
|
|
+ fileName
|
|
|
+ );
|
|
|
+ } catch (error) {
|
|
|
+ // 用户点击取消或关闭弹窗,不做处理
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
/**
|