浏览代码

feat(game): 增加赛事报名表导入结果详情展示功能

- 移除运动员列表中的居住地址查询条件
- 隐藏运动员列表中不必要的显示字段
- 调整运动员列表字段顺序并更新对应键值
- 新增导入结果弹窗用于展示详细的导入信息
- 添加导入结果的数据结构定义和状态管理
- 更新报名表导入接口路径以支持验证逻辑
- 优化文件上传成功后的结果提示与处理流程
- 在导入结果对话框中展示总记录数、成功数和失败数
- 展示校验失败的具体原因及关联的运动员和项目信息
zhou 2 周之前
父节点
当前提交
27ae24b922
共有 2 个文件被更改,包括 49 次插入13 次删除
  1. 0 9
      src/views/system/gameAthlete/index.vue
  2. 49 4
      src/views/system/gameEvent/index.vue

+ 0 - 9
src/views/system/gameAthlete/index.vue

@@ -16,9 +16,6 @@
             <el-form-item label="手机号" prop="phone">
               <el-input v-model="queryParams.phone" placeholder="请输入手机号" clearable @keyup.enter="handleQuery" />
             </el-form-item>
-            <!-- <el-form-item label="居住地址" prop="location">
-              <el-input v-model="queryParams.location" placeholder="请输入居住地址" clearable @keyup.enter="handleQuery" />
-            </el-form-item> -->
             <el-form-item>
               <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
               <el-button icon="Refresh" @click="resetQuery">重置</el-button>
@@ -248,12 +245,6 @@ const columns = ref<FieldOption[]>([
   { key: 6, label: '参与项目', visible: true },
   { key: 7, label: '证件号', visible: true },
   { key: 8, label: '队伍', visible: true },
-  // { key: 9, label: '芯片号', visible: true },
-  // { key: 10, label: '手机号', visible: true },
-  // { key: 11, label: '居住地址', visible: true },
-  // { key: 12, label: 'T恤尺码', visible: true },
-  // { key: 13, label: '组别', visible: true },
-  // { key: 14, label: '号码', visible: true },
   { key: 9, label: '状态', visible: true },
   { key: 10, label: '备注', visible: true },
   { key: 11, label: '手机号', visible: true },

+ 49 - 4
src/views/system/gameEvent/index.vue

@@ -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();
 };