|
@@ -23,24 +23,37 @@
|
|
|
<template #header>
|
|
|
<el-row :gutter="10" class="mb8">
|
|
|
<el-col :span="1.5">
|
|
|
- <el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['system:gameTeam:add']">新增 </el-button>
|
|
|
+ <el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['system:gameTeam:add']">新增</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
- <el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['system:gameTeam:edit']"
|
|
|
- >修改
|
|
|
- </el-button>
|
|
|
+ <el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['system:gameTeam:edit']">修改</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
- <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['system:gameTeam:remove']"
|
|
|
- >删除
|
|
|
- </el-button>
|
|
|
+ <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['system:gameTeam:remove']">删除</el-button>
|
|
|
</el-col>
|
|
|
- <!-- <el-col :span="1.5">
|
|
|
- <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['system:gameTeam:export']">导出 </el-button>
|
|
|
- </el-col> -->
|
|
|
<el-col :span="1.5">
|
|
|
- <el-button type="info" plain icon="Upload" @click="handleImport" v-hasPermi="['system:gameTeam:import']"> 导入 </el-button>
|
|
|
+ <el-button type="info" plain icon="Upload" @click="handleImport" v-hasPermi="['system:gameTeam:import']">导入</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6" >
|
|
|
+ <el-select v-model="selectedRankGroupId" placeholder="选择分组" clearable style="width: 100px;">
|
|
|
+ <el-option
|
|
|
+ v-for="item in rankGroupOptions"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ <el-button
|
|
|
+ type="warning"
|
|
|
+ icon="Switch"
|
|
|
+ :disabled="!selectedRankGroupId"
|
|
|
+ @click="handleMoveGroup"
|
|
|
+ v-hasPermi="['system:gameTeam:edit']"
|
|
|
+ >
|
|
|
+ 移动分组
|
|
|
+ </el-button>
|
|
|
</el-col>
|
|
|
+
|
|
|
<right-toolbar v-model:showSearch="showSearch" :columns="columns" @queryTable="getList"></right-toolbar>
|
|
|
</el-row>
|
|
|
</template>
|
|
@@ -51,21 +64,28 @@
|
|
|
<el-table-column label="队伍编号" align="center" prop="teamCode" v-if="columns[1].visible" />
|
|
|
<el-table-column label="赛事名称" align="center" prop="eventName" v-if="columns[2].visible" />
|
|
|
<el-table-column label="队伍名称" align="center" prop="teamName" v-if="columns[3].visible" />
|
|
|
- <el-table-column label="团队描述" align="center" prop="teamDescribe" v-if="columns[4].visible">
|
|
|
+ <el-table-column label="分组名" align="center" prop="rgId" v-if="columns[4].visible">
|
|
|
+ <template #default="scope">
|
|
|
+ <span v-if="scope.row.rgId">{{ rankGroupMap.get(scope.row.rgId) }}</span>
|
|
|
+ <span v-else style="color: #999;">未分组</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="团队描述" align="center" prop="teamDescribe" v-if="columns[5].visible">
|
|
|
<template #default="scope">
|
|
|
<span v-if="scope.row.teamDescribe">{{ scope.row.teamDescribe }}</span>
|
|
|
<span v-else>该团队暂无描述</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="领队" align="center" prop="leader" v-if="columns[5].visible" />
|
|
|
- <el-table-column label="人数" align="center" prop="athleteNum" v-if="columns[6].visible" />
|
|
|
- <el-table-column label="号码段" align="center" prop="numberRange" v-if="columns[7].visible" />
|
|
|
- <el-table-column label="状态" align="center" prop="status" v-if="columns[8].visible">
|
|
|
+ <el-table-column label="领队" align="center" prop="leader" v-if="columns[6].visible" />
|
|
|
+ <el-table-column label="人数" align="center" prop="athleteNum" v-if="columns[7].visible" />
|
|
|
+ <el-table-column label="号码段" align="center" prop="numberRange" v-if="columns[8].visible" />
|
|
|
+ <el-table-column label="状态" align="center" prop="status" v-if="columns[9].visible">
|
|
|
<template #default="scope">
|
|
|
<dict-tag :options="sys_normal_disable" :value="scope.row.status" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="备注" align="center" prop="remark" v-if="columns[9].visible" />
|
|
|
+ <el-table-column label="备注" align="center" prop="remark" v-if="columns[10].visible" />
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
<template #default="scope">
|
|
|
<el-tooltip content="修改" placement="top">
|
|
@@ -146,11 +166,13 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup name="GameTeam" lang="ts">
|
|
|
-import { listGameTeam, getGameTeam, delGameTeam, addGameTeam, updateGameTeam } from '@/api/system/gameTeam';
|
|
|
-// import { getDefaultEvent } from '@/api/system/gameEvent';
|
|
|
+import { listGameTeam, getGameTeam, delGameTeam, addGameTeam, updateGameTeam, moveGroup } from '@/api/system/gameTeam';
|
|
|
+import { listRankGroup } from '@/api/system/rankGroup';
|
|
|
import { GameTeamVO, GameTeamQuery, GameTeamForm } from '@/api/system/gameTeam/types';
|
|
|
+import { RankGroupVO } from '@/api/system/rankGroup/types';
|
|
|
import { globalHeaders } from '@/utils/request';
|
|
|
import { GameEventVO } from '@/api/system/gameEvent/types';
|
|
|
+import { orderBy } from 'element-plus/es/components/table/src/util';
|
|
|
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
const { sys_normal_disable } = toRefs<any>(proxy?.useDict('sys_normal_disable'));
|
|
@@ -166,18 +188,23 @@ const multiple = ref(true);
|
|
|
const total = ref(0);
|
|
|
const eventOptions = ref<Array<{ label: string; value: string | number }>>([]);
|
|
|
|
|
|
+// 新增:排名分组相关
|
|
|
+const rankGroupOptions = ref<Array<{ label: string; value: string | number }>>([]);
|
|
|
+const selectedRankGroupId = ref<number | null>(null);
|
|
|
+
|
|
|
// 列显隐数据
|
|
|
const columns = ref<FieldOption[]>([
|
|
|
{ key: 0, label: '队伍id', visible: false },
|
|
|
{ key: 1, label: '队伍编号', visible: false },
|
|
|
{ key: 2, label: '赛事名称', visible: false },
|
|
|
{ key: 3, label: '队伍名称', visible: true },
|
|
|
- { key: 4, label: '团队描述', visible: true },
|
|
|
- { key: 5, label: '领队', visible: true },
|
|
|
- { key: 6, label: '人数', visible: true },
|
|
|
- { key: 7, label: '号码段', visible: true },
|
|
|
- { key: 8, label: '状态', visible: false },
|
|
|
- { key: 9, label: '备注', visible: false }
|
|
|
+ { key: 4, label: '排名分组名', visible: true }, // 新增
|
|
|
+ { key: 5, label: '团队描述', visible: true },
|
|
|
+ { key: 6, label: '领队', visible: true },
|
|
|
+ { key: 7, label: '人数', visible: true },
|
|
|
+ { key: 8, label: '号码段', visible: true },
|
|
|
+ { key: 9, label: '状态', visible: false },
|
|
|
+ { key: 10, label: '备注', visible: false }
|
|
|
]);
|
|
|
|
|
|
const queryFormRef = ref<ElFormInstance>();
|
|
@@ -206,6 +233,7 @@ const upload = reactive<ImportOption>({
|
|
|
});
|
|
|
const initFormData: GameTeamForm = {
|
|
|
eventId: undefined,
|
|
|
+ rgId:undefined,
|
|
|
teamName: undefined,
|
|
|
teamCode: undefined,
|
|
|
leader: undefined,
|
|
@@ -247,15 +275,15 @@ const data = reactive<PageData<GameTeamForm, GameTeamQuery>>({
|
|
|
|
|
|
const { queryParams, form, rules } = toRefs(data);
|
|
|
|
|
|
-// 添加额外的ref用于处理默认事件ID
|
|
|
-const defaultEventId = computed(() => defaultEvent.value?.eventId);
|
|
|
-// 监听默认事件变化
|
|
|
-watchEffect(() => {
|
|
|
- if (defaultEventId.value) {
|
|
|
- form.value.eventId = defaultEventId.value;
|
|
|
- queryParams.value.eventId = defaultEventId.value;
|
|
|
- }
|
|
|
-});
|
|
|
+// // 添加额外的ref用于处理默认事件ID
|
|
|
+// const defaultEventId = computed(() => defaultEvent.value?.eventId);
|
|
|
+// // 监听默认事件变化
|
|
|
+// watchEffect(() => {
|
|
|
+// if (defaultEventId.value) {
|
|
|
+// form.value.eventId = defaultEventId.value;
|
|
|
+// queryParams.value.eventId = defaultEventId.value;
|
|
|
+// }
|
|
|
+// });
|
|
|
|
|
|
/** 获取默认赛事 */
|
|
|
// const getDefaultEventInfo = async () => {
|
|
@@ -267,6 +295,13 @@ watchEffect(() => {
|
|
|
// }
|
|
|
// };
|
|
|
|
|
|
+const rankGroupMap = computed(() => {
|
|
|
+ const map = new Map();
|
|
|
+ rankGroupOptions.value.forEach(option => {
|
|
|
+ map.set(option.value, option.label);
|
|
|
+ });
|
|
|
+ return map;
|
|
|
+});
|
|
|
/** 查询参赛队伍列表 */
|
|
|
const getList = async () => {
|
|
|
// if (!queryParams.value.eventId) {
|
|
@@ -326,6 +361,61 @@ const handleSelectionChange = (selection: GameTeamVO[]) => {
|
|
|
ids.value = selection.map((item) => item.teamId);
|
|
|
single.value = selection.length != 1;
|
|
|
multiple.value = !selection.length;
|
|
|
+
|
|
|
+ // 如果没有选中队伍,清空选择的分组
|
|
|
+ if (selection.length === 0) {
|
|
|
+ selectedRankGroupId.value = null;
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+/** 新增:获取排名分组选项列表 */
|
|
|
+const getRankGroupOptions = async () => {
|
|
|
+ try {
|
|
|
+ const res = await listRankGroup({
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 1000, // 获取所有排名分组
|
|
|
+ eventId: queryParams.value.eventId,
|
|
|
+ orderByColumn: undefined,
|
|
|
+ isAsc: undefined,
|
|
|
+ });
|
|
|
+ rankGroupOptions.value = res.rows.map(item => ({
|
|
|
+ label: item.rgName,
|
|
|
+ value: item.rgId
|
|
|
+ }));
|
|
|
+ } catch (error) {
|
|
|
+ console.error('获取排名分组列表失败:', error);
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+/** 新增:移动分组操作 */
|
|
|
+const handleMoveGroup = async () => {
|
|
|
+ if (!selectedRankGroupId.value) {
|
|
|
+ proxy?.$modal.msgWarning('请选择目标排名分组');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (ids.value.length === 0) {
|
|
|
+ proxy?.$modal.msgWarning('请选择要移动的队伍');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ await proxy?.$modal.confirm(`确认将选中的 ${ids.value.length} 个队伍移动到选定的排名分组吗?`);
|
|
|
+
|
|
|
+ loading.value = true;
|
|
|
+ await moveGroup({
|
|
|
+ teamIds: ids.value,
|
|
|
+ rgId: selectedRankGroupId.value
|
|
|
+ });
|
|
|
+
|
|
|
+ proxy?.$modal.msgSuccess('移动分组成功');
|
|
|
+ selectedRankGroupId.value = null;
|
|
|
+ await getList();
|
|
|
+ } catch (error) {
|
|
|
+ console.error('移动分组失败:', error);
|
|
|
+ } finally {
|
|
|
+ loading.value = false;
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
/** 新增按钮操作 */
|
|
@@ -416,6 +506,6 @@ const importTemplate = () => {
|
|
|
|
|
|
onMounted(() => {
|
|
|
getList();
|
|
|
- // getEventOptions();
|
|
|
+ getRankGroupOptions(); // 新增
|
|
|
});
|
|
|
</script>
|