|
@@ -13,7 +13,7 @@
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
|
|
|
<el-form-item label="比赛状态" prop="gameType">
|
|
<el-form-item label="比赛状态" prop="gameType">
|
|
|
- <el-select aria-required="true" v-model="queryParams.status" placeholder="请选择" :disabled="dialog.mode === 'view'">
|
|
|
|
|
|
|
+ <el-select aria-required="true" v-model="queryParams.status" placeholder="请选择" :disabled="dialog.mode === 'view'" @change="handleStatusSelectChange">
|
|
|
<!-- 添加"全部"选项 -->
|
|
<!-- 添加"全部"选项 -->
|
|
|
<el-option :value="null" :label="'全部'" />
|
|
<el-option :value="null" :label="'全部'" />
|
|
|
<el-option v-for="dict in tournaments_status" :key="dict.value" :label="dict.label" :value="dict.value"> </el-option>
|
|
<el-option v-for="dict in tournaments_status" :key="dict.value" :label="dict.label" :value="dict.value"> </el-option>
|
|
@@ -77,6 +77,14 @@
|
|
|
</el-row>
|
|
</el-row>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
|
|
+ <el-tabs v-model="activeTab" @tab-change="handleTabChange" style="margin-bottom: 10px">
|
|
|
|
|
+ <el-tab-pane :label="`全部(${tabCounts.all})`" name="0" />
|
|
|
|
|
+ <el-tab-pane :label="`草稿(${tabCounts.draft})`" name="1" />
|
|
|
|
|
+ <el-tab-pane :label="`已发布(${tabCounts.published})`" name="2" />
|
|
|
|
|
+ <el-tab-pane :label="`进行中(${tabCounts.ongoing})`" name="3" />
|
|
|
|
|
+ <el-tab-pane :label="`已结束(${tabCounts.ended})`" name="4" />
|
|
|
|
|
+ </el-tabs>
|
|
|
|
|
+
|
|
|
<el-table
|
|
<el-table
|
|
|
v-loading="loading"
|
|
v-loading="loading"
|
|
|
border
|
|
border
|
|
@@ -231,7 +239,7 @@
|
|
|
>
|
|
>
|
|
|
</el-tooltip>
|
|
</el-tooltip>
|
|
|
|
|
|
|
|
- <el-tooltip content="编辑" v-if="scope.row.status === 0" placement="top" v-hasPermi="['business:tournaments:query']">
|
|
|
|
|
|
|
+ <el-tooltip content="编辑" v-if="scope.row.status === -1" placement="top" v-hasPermi="['business:tournaments:query']">
|
|
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row, 'edit')">编辑</el-button>
|
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row, 'edit')">编辑</el-button>
|
|
|
</el-tooltip>
|
|
</el-tooltip>
|
|
|
|
|
|
|
@@ -816,6 +824,14 @@ const ids = ref<Array<string | number>>([]);
|
|
|
const single = ref(true);
|
|
const single = ref(true);
|
|
|
const multiple = ref(true);
|
|
const multiple = ref(true);
|
|
|
const total = ref(0);
|
|
const total = ref(0);
|
|
|
|
|
+const activeTab = ref('0');
|
|
|
|
|
+const tabCounts = reactive({
|
|
|
|
|
+ all: 0,
|
|
|
|
|
+ draft: 0,
|
|
|
|
|
+ published: 0,
|
|
|
|
|
+ ongoing: 0,
|
|
|
|
|
+ ended: 0
|
|
|
|
|
+});
|
|
|
|
|
|
|
|
const queryFormRef = ref<ElFormInstance>();
|
|
const queryFormRef = ref<ElFormInstance>();
|
|
|
const tournamentsFormRef = ref<ElFormInstance>();
|
|
const tournamentsFormRef = ref<ElFormInstance>();
|
|
@@ -1225,6 +1241,55 @@ const getList = async () => {
|
|
|
tournamentsList.value = res.rows;
|
|
tournamentsList.value = res.rows;
|
|
|
total.value = res.total;
|
|
total.value = res.total;
|
|
|
loading.value = false;
|
|
loading.value = false;
|
|
|
|
|
+ await getTabCounts();
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+/** tab与状态过滤映射:进行中含进行中/同步发牌/暂停,已结束含完成/异常 */
|
|
|
|
|
+const TAB_FILTER: Record<string, { status?: number; statusList?: number[] }> = {
|
|
|
|
|
+ '0': {},
|
|
|
|
|
+ '1': { status: -1 },
|
|
|
|
|
+ '2': { status: 0 },
|
|
|
|
|
+ '3': { statusList: [1, 2, 3] },
|
|
|
|
|
+ '4': { statusList: [4, 5] }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+/** 获取各状态tab数量统计 */
|
|
|
|
|
+const getTabCounts = async () => {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const base = { ...queryParams.value, pageNum: 1, pageSize: 1 };
|
|
|
|
|
+ const fetchCount = (conf: { status?: number; statusList?: number[] }) =>
|
|
|
|
|
+ listTournaments({ ...base, status: conf.status, statusList: conf.statusList });
|
|
|
|
|
+ const [allRes, draftRes, publishedRes, ongoingRes, endedRes] = await Promise.all([
|
|
|
|
|
+ fetchCount(TAB_FILTER['0']),
|
|
|
|
|
+ fetchCount(TAB_FILTER['1']),
|
|
|
|
|
+ fetchCount(TAB_FILTER['2']),
|
|
|
|
|
+ fetchCount(TAB_FILTER['3']),
|
|
|
|
|
+ fetchCount(TAB_FILTER['4'])
|
|
|
|
|
+ ]);
|
|
|
|
|
+ tabCounts.all = allRes.total || 0;
|
|
|
|
|
+ tabCounts.draft = draftRes.total || 0;
|
|
|
|
|
+ tabCounts.published = publishedRes.total || 0;
|
|
|
|
|
+ tabCounts.ongoing = ongoingRes.total || 0;
|
|
|
|
|
+ tabCounts.ended = endedRes.total || 0;
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('获取tab数量失败:', error);
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+/** tab切换 */
|
|
|
|
|
+const handleTabChange = (tabName: string) => {
|
|
|
|
|
+ const conf = TAB_FILTER[tabName] || {};
|
|
|
|
|
+ queryParams.value.status = conf.status;
|
|
|
|
|
+ queryParams.value.statusList = conf.statusList;
|
|
|
|
|
+ queryParams.value.pageNum = 1;
|
|
|
|
|
+ getList();
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+/** 比赛状态下拉变化时同步高亮对应tab */
|
|
|
|
|
+const handleStatusSelectChange = (val: any) => {
|
|
|
|
|
+ const tabMap: Record<string, string> = { '-1': '1', '0': '2', '1': '3', '2': '3', '3': '3', '4': '4', '5': '4' };
|
|
|
|
|
+ activeTab.value = val === null || val === undefined || val === '' ? '0' : tabMap[String(val)] || '0';
|
|
|
|
|
+ queryParams.value.statusList = undefined;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
/** 取消按钮 */
|
|
/** 取消按钮 */
|
|
@@ -1259,6 +1324,8 @@ const resetQuery = () => {
|
|
|
queryParams.value.id = '';
|
|
queryParams.value.id = '';
|
|
|
queryParams.value.name = '';
|
|
queryParams.value.name = '';
|
|
|
queryParams.value.status = '';
|
|
queryParams.value.status = '';
|
|
|
|
|
+ queryParams.value.statusList = undefined;
|
|
|
|
|
+ activeTab.value = '0';
|
|
|
queryParams.value.startTime = '';
|
|
queryParams.value.startTime = '';
|
|
|
// 重置页码
|
|
// 重置页码
|
|
|
queryParams.value.pageNum = 1;
|
|
queryParams.value.pageNum = 1;
|
|
@@ -1302,6 +1369,11 @@ const handleUpdate = async (row?: TournamentsVO, mode: 'edit' | 'view' = 'edit')
|
|
|
reset(); // 重置表单
|
|
reset(); // 重置表单
|
|
|
const _id = row?.id || ids.value[0];
|
|
const _id = row?.id || ids.value[0];
|
|
|
const res = await getTournaments(_id);
|
|
const res = await getTournaments(_id);
|
|
|
|
|
+ // 已发布的赛事(status != -1)禁止编辑,只允许查看
|
|
|
|
|
+ if (mode === 'edit' && res.data.status !== -1) {
|
|
|
|
|
+ proxy?.$modal.msgError('线上赛事一旦发布不可编辑修改');
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
// 设置表单数据
|
|
// 设置表单数据
|
|
|
Object.assign(form.value, res.data);
|
|
Object.assign(form.value, res.data);
|
|
|
form.value.signTime = String(res.data.signTime);
|
|
form.value.signTime = String(res.data.signTime);
|