|
@@ -363,6 +363,35 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
+
|
|
|
+ <!-- 导入结果对话框 -->
|
|
|
+ <el-dialog v-model="showImportResult" title="导入结果详情" width="800px" append-to-body>
|
|
|
+ <div v-if="importResult">
|
|
|
+ <el-alert
|
|
|
+ :title="`共处理 ${importResult.totalCount} 条数据,成功 ${importResult.validCount} 条,失败 ${importResult.errorCount} 条`"
|
|
|
+ :type="importResult.success ? 'success' : 'warning'"
|
|
|
+ :closable="false"
|
|
|
+ class="mb-4"
|
|
|
+ />
|
|
|
+
|
|
|
+ <div v-if="importResult.validationResult && importResult.validationResult.errors.length > 0">
|
|
|
+ <h4>失败原因详情:</h4>
|
|
|
+ <el-table :data="importResult.validationResult.errors" border max-height="400">
|
|
|
+ <el-table-column prop="rowIndex" label="行号" width="80" align="center" />
|
|
|
+ <el-table-column prop="athleteName" label="运动员姓名" width="120" />
|
|
|
+ <el-table-column prop="teamName" label="队伍名称" width="150" />
|
|
|
+ <el-table-column prop="projectName" label="相关项目" width="150" />
|
|
|
+ <el-table-column prop="errorMessage" label="失败原因" />
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <template #footer>
|
|
|
+ <div class="dialog-footer">
|
|
|
+ <el-button type="primary" @click="showImportResult = false">确定</el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+</el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -448,6 +477,9 @@ const upload = reactive<ImportOption>({
|
|
|
url: import.meta.env.VITE_APP_BASE_API + '/system/enroll/importData'
|
|
|
});
|
|
|
|
|
|
+const importResult = ref(null);
|
|
|
+const showImportResult = ref(false);
|
|
|
+
|
|
|
const initFormData: GameEventForm = {
|
|
|
eventId: undefined,
|
|
|
eventCode: undefined,
|
|
@@ -652,7 +684,7 @@ const handleDownloadTemplate = (row: GameEventVO) => {
|
|
|
|
|
|
// 导入报名表逻辑
|
|
|
const handleImportRegistration = (row) => {
|
|
|
- upload.url = import.meta.env.VITE_APP_BASE_API + `/system/enroll/importData/${row.eventId}`;
|
|
|
+ upload.url = import.meta.env.VITE_APP_BASE_API + `/system/enroll/importDataWithValidation/${row.eventId}`;
|
|
|
upload.title = '报名表导入';
|
|
|
upload.open = true;
|
|
|
};
|
|
@@ -666,9 +698,22 @@ const handleFileSuccess = (response: any, file: UploadFile) => {
|
|
|
upload.open = false;
|
|
|
upload.isUploading = false;
|
|
|
uploadRef.value?.handleRemove(file);
|
|
|
- ElMessageBox.alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + '</div>', '导入结果', {
|
|
|
- dangerouslyUseHTMLString: true
|
|
|
- });
|
|
|
+
|
|
|
+ if (response.code === 200) {
|
|
|
+ const result = response.data;
|
|
|
+ importResult.value = result;
|
|
|
+ showImportResult.value = true;
|
|
|
+
|
|
|
+ // 显示导入结果
|
|
|
+ if (result.success) {
|
|
|
+ proxy?.$modal.msgSuccess(`导入成功!共处理${result.totalCount}条数据,成功${result.validCount}条,失败${result.errorCount}条`);
|
|
|
+ } else {
|
|
|
+ proxy?.$modal.msgWarning(`导入完成!共处理${result.totalCount}条数据,成功${result.validCount}条,失败${result.errorCount}条`);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ proxy?.$modal.msgError('导入失败:' + response.msg);
|
|
|
+ }
|
|
|
+
|
|
|
getList();
|
|
|
};
|
|
|
|