wengan01 2 долоо хоног өмнө
parent
commit
3fcda47a40

+ 11 - 0
src/api/system/physical/participants/index.ts

@@ -94,3 +94,14 @@ export const cancelRegistration = (data: ParticipantsForm) => {
     data: data
   });
 };
+/**
+ * 帮他报名(恢复已取消的报名)
+ * @param data
+ */
+export const reRegister = (data: ParticipantsForm) => {
+  return request({
+    url: '/physical/participants/reRegister',
+    method: 'post',
+    data: data
+  });
+};

+ 25 - 3
src/views/system/physical/participants/index.vue

@@ -91,8 +91,9 @@
         <el-table-column label="操作" align="center" width="200" class-name="small-padding fixed-width">
           <template #default="scope">
             <div style="display: flex; align-items: center; justify-content: center; gap: 12px;">
-              <el-button link type="primary" icon="Printer" @click="handlePrintTicket(scope.row)">手动取票</el-button>
-              <el-button v-if="scope.row.tournamentType === 0" link type="danger" icon="CircleClose" @click="handleCancelRegistration(scope.row)">取消报名</el-button>
+              <el-button v-if="scope.row.status !== 2" link type="primary" icon="Printer" @click="handlePrintTicket(scope.row)">手动取票</el-button>
+              <el-button v-if="scope.row.tournamentType === 0 && scope.row.status !== 2" link type="danger" icon="CircleClose" @click="handleCancelRegistration(scope.row)">取消报名</el-button>
+              <el-button v-if="scope.row.status === 2" link type="success" icon="Refresh" @click="handleReRegister(scope.row)">帮他报名</el-button>
             </div>
           </template>
         </el-table-column>
@@ -211,7 +212,8 @@ import {
   updateParticipants,
   promoteTournament,
   printTicketInfo,
-  cancelRegistration
+  cancelRegistration,
+  reRegister
 } from '@/api/system/physical/participants';
 import { ParticipantsVO, ParticipantsQuery, ParticipantsForm, TicketTournamentsVo } from '@/api/system/physical/participants/types';
 import { parseTime } from '@/utils/dateUtils';
@@ -541,6 +543,26 @@ const handleCancelRegistration = async (row: ParticipantsVO) => {
     }
   }
 };
+/** 帮他报名(恢复已取消的报名) */
+const handleReRegister = async (row: ParticipantsVO) => {
+  try {
+    await proxy?.$modal.confirm('确认替该选手重新报名吗?恢复后该报名记录将重新生效。');
+    const res = await reRegister({
+      id: row.id,
+      tournamentId: row.tournamentId
+    } as ParticipantsForm);
+    if (res.code === 200) {
+      proxy?.$modal.msgSuccess('已帮他重新报名');
+      await getList();
+    } else {
+      proxy?.$modal.msgError(res.msg || '帮他报名失败');
+    }
+  } catch (error) {
+    if (error !== 'cancel') {
+      proxy?.$modal.msgError('帮他报名失败:' + (error as Error).message);
+    }
+  }
+};
 // 监听路由变化
 watch(
   () => route.query,