Просмотр исходного кода

feat(config): 新增生成未来七天赛事数据功能

- 新增 API 接口 generateMatchesForNextSevenDays 用于生成赛事数据
- 在配置列表页面添加“生成”按钮,支持触发生成逻辑- 更新路由链接指向新的 tournamentsTemplate 页面路径
- 引入 generateMatchesForNextSevenDays 方法到组件中并实现调用逻辑
- 添加确认提示框以防止误操作
- 成功生成后显示提示信息并刷新列表数据
fugui001 2 месяцев назад
Родитель
Сommit
58ceec2398
2 измененных файлов с 35 добавлено и 2 удалено
  1. 11 0
      src/api/system/business/config/index.ts
  2. 24 2
      src/views/system/business/config/index.vue

+ 11 - 0
src/api/system/business/config/index.ts

@@ -129,3 +129,14 @@ export const startScheduleConfig = (id: string | number): AxiosPromise<ConfigVO>
     method: 'post'
   });
 };
+
+/**
+ * 生成未来七天数据
+ * @param id
+ */
+export const generateMatchesForNextSevenDays = (id: string | number): AxiosPromise<ConfigVO> => {
+  return request({
+    url: '/business/job/generateMatchesForNextSevenDays',
+    method: 'post'
+  });
+};

+ 24 - 2
src/views/system/business/config/index.vue

@@ -38,7 +38,7 @@
           <el-col :span="1.5">
             <el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['system:config:add']">新增投放方案</el-button>
           </el-col>
-          <router-link to="/business/tournamentsTemplate">
+          <router-link to="/tournament/tournamentsTemplate">
             <el-button type="success" plain icon="Edit">自动比赛模版</el-button>
           </router-link>
           <!--          <el-col :span="1.5">
@@ -146,6 +146,19 @@
                 删除
               </el-button>
             </el-tooltip>
+
+            <el-tooltip content="生成" placement="top">
+              <el-button
+                link
+                type="success"
+                size="small"
+                @click="handleGenerateMatchesForNextSevenDays(scope.row)"
+                v-hasPermi="['system:config:remove']"
+              >
+                <el-icon><VideoPlay /></el-icon>
+                生成
+              </el-button>
+            </el-tooltip>
           </template>
         </el-table-column>
       </el-table>
@@ -232,7 +245,7 @@ import {
   updateScheduleConfig,
   deleteScheduleConfig,
   stopScheduleConfig,
-  startScheduleConfig
+  startScheduleConfig, generateMatchesForNextSevenDays
 } from '@/api/system/business/config';
 import { selectAllCreationSchemesAllList } from '@/api/system/business/scheme';
 import { ConfigVO, ConfigQuery, ConfigForm } from '@/api/system/business/config/types';
@@ -400,6 +413,15 @@ const handleDelete = async (row?: ConfigVO) => {
   await getList();
 };
 
+/** 删除按钮操作 */
+const handleGenerateMatchesForNextSevenDays = async (row?: ConfigVO) => {
+  const _ids = row?.id || ids.value;
+  await proxy?.$modal.confirm('是否确认生成对应赛事数据项?').finally(() => (loading.value = false));
+  await generateMatchesForNextSevenDays(null);
+  proxy?.$modal.msgSuccess('生成成功');
+  await getList();
+};
+
 //停止操作
 const handleStop = async (row?: ConfigVO) => {
   const _ids = row?.id || ids.value;