|
@@ -40,46 +40,46 @@
|
|
|
<el-col :span="1.5">
|
|
|
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['system:gameEventProject:export']">导出 </el-button>
|
|
|
</el-col>
|
|
|
- <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
+ <right-toolbar v-model:showSearch="showSearch" :columns="columns" @queryTable="getList"></right-toolbar>
|
|
|
</el-row>
|
|
|
</template>
|
|
|
|
|
|
<el-table v-loading="loading" border :data="gameEventProjectList" @selection-change="handleSelectionChange">
|
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
|
- <el-table-column label="主键" align="center" prop="projectId" v-if="false" />
|
|
|
- <el-table-column label="项目名称" align="center" prop="projectName" />
|
|
|
- <el-table-column label="项目类型" align="center" prop="projectType">
|
|
|
+ <el-table-column label="主键" align="center" prop="projectId" v-if="columns[0].visible" />
|
|
|
+ <el-table-column label="项目名称" align="center" prop="projectName" v-if="columns[1].visible" />
|
|
|
+ <el-table-column label="项目类型" align="center" prop="projectType" v-if="columns[2].visible">
|
|
|
<template #default="scope">
|
|
|
<dict-tag :options="game_project_type" :value="scope.row.projectType || ''" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="项目组别" align="center" prop="groupType" />
|
|
|
- <el-table-column label="比赛场地" align="center" prop="location" />
|
|
|
- <el-table-column label="计算规则" align="center" prop="scoreRule">
|
|
|
+ <el-table-column label="项目组别" align="center" prop="groupType" v-if="columns[3].visible" />
|
|
|
+ <el-table-column label="比赛场地" align="center" prop="location" v-if="columns[4].visible" />
|
|
|
+ <el-table-column label="计算规则" align="center" prop="scoreRule" v-if="columns[5].visible">
|
|
|
<template #default="scope">
|
|
|
<dict-tag :options="game_score_type" :value="scope.row.scoreRule || ''" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="开始时间" align="center" prop="startTime" width="180">
|
|
|
+ <el-table-column label="开始时间" align="center" prop="startTime" width="180" v-if="columns[6].visible">
|
|
|
<template #default="scope">
|
|
|
<span>{{ parseTime(scope.row.startTime, '{y}-{m}-{d}') }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="结束时间" align="center" prop="endTime" width="180">
|
|
|
+ <el-table-column label="结束时间" align="center" prop="endTime" width="180" v-if="columns[7].visible">
|
|
|
<template #default="scope">
|
|
|
<span>{{ parseTime(scope.row.endTime, '{y}-{m}-{d}') }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="裁判员ID" align="center" prop="refereeId" />
|
|
|
+ <el-table-column label="裁判员ID" align="center" prop="refereeId" v-if="columns[8].visible" />
|
|
|
<!-- <el-table-column label="参赛组数" align="center" prop="groupNum" />
|
|
|
<el-table-column label="参赛人数" align="center" prop="participateNum" /> -->
|
|
|
- <el-table-column label="轮次" align="center" prop="roundType" />
|
|
|
- <el-table-column label="排序方式" align="center" prop="orderType">
|
|
|
+ <el-table-column label="轮次" align="center" prop="roundType" v-if="columns[9].visible" />
|
|
|
+ <el-table-column label="排序方式" align="center" prop="orderType" v-if="columns[10].visible">
|
|
|
<template #default="scope">
|
|
|
{{ scope.row.orderType === '0' ? '升序' : '降序' }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="积分分值" align="center" prop="scoreValue" />
|
|
|
+ <el-table-column label="积分分值" align="center" prop="scoreValue" v-if="columns[11].visible" />
|
|
|
<!-- <el-table-column label="奖项" align="center" prop="award" />
|
|
|
<el-table-column label="计时点名称" align="center" prop="timePoint" />
|
|
|
<el-table-column label="控制盒编号" align="center" prop="boxCode" />
|
|
@@ -187,12 +187,10 @@ import {
|
|
|
updateGameEventProject
|
|
|
} from '@/api/system/gameEventProject';
|
|
|
import { listGameEventGroup } from '@/api/system/gameEventGroup';
|
|
|
-import { getDefaultEvent } from '@/api/system/gameEvent';
|
|
|
import { GameEventProjectVO, GameEventProjectQuery, GameEventProjectForm } from '@/api/system/gameEventProject/types';
|
|
|
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
const { game_score_type, game_project_type } = toRefs<any>(proxy?.useDict('game_score_type', 'game_project_type'));
|
|
|
-const defaultEvent = ref<any | null>(null); // 默认赛事信息
|
|
|
|
|
|
const gameEventGroupList = ref<any[]>([]); // 赛事分组列表
|
|
|
|
|
@@ -213,6 +211,22 @@ const dialog = reactive<DialogOption>({
|
|
|
title: ''
|
|
|
});
|
|
|
|
|
|
+// 列显隐数据
|
|
|
+const columns = ref<FieldOption[]>([
|
|
|
+ { key: 0, label: '主键', visible: false },
|
|
|
+ { key: 1, label: '项目名称', visible: true },
|
|
|
+ { key: 2, label: '项目类型', visible: true },
|
|
|
+ { 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: '裁判员ID', visible: true },
|
|
|
+ { key: 9, label: '轮次', visible: true },
|
|
|
+ { key: 10, label: '排序方式', visible: true },
|
|
|
+ { key: 11, label: '积分分值', visible: true },
|
|
|
+]);
|
|
|
+
|
|
|
const initFormData: GameEventProjectForm = {
|
|
|
projectId: undefined,
|
|
|
eventId: undefined,
|
|
@@ -240,18 +254,11 @@ const data = reactive<PageData<GameEventProjectForm, GameEventProjectQuery>>({
|
|
|
queryParams: {
|
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
|
- eventId: undefined
|
|
|
- // projectName: undefined,
|
|
|
- // projectType: undefined,
|
|
|
- // groupType: undefined,
|
|
|
- // startTime: undefined,
|
|
|
- // orderType: undefined,
|
|
|
- // status: undefined,
|
|
|
- // params: {
|
|
|
- // }
|
|
|
+ eventId: undefined,
|
|
|
+ orderByColumn: '',
|
|
|
+ isAsc: ''
|
|
|
},
|
|
|
rules: {
|
|
|
- eventId: [{ required: true, message: '赛事ID不能为空', trigger: 'blur' }],
|
|
|
projectName: [{ required: true, message: '项目名称不能为空', trigger: 'blur' }],
|
|
|
projectType: [{ required: true, message: '项目类型不能为空', trigger: 'change' }],
|
|
|
groupType: [{ required: true, message: '项目组别不能为空', trigger: 'change' }],
|
|
@@ -261,35 +268,8 @@ const data = reactive<PageData<GameEventProjectForm, GameEventProjectQuery>>({
|
|
|
|
|
|
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;
|
|
|
- }
|
|
|
-});
|
|
|
-
|
|
|
-/** 获取默认赛事 */
|
|
|
-const getDefaultEventInfo = async () => {
|
|
|
- try {
|
|
|
- const res = await getDefaultEvent();
|
|
|
- defaultEvent.value = res.data;
|
|
|
- } catch (error) {
|
|
|
- proxy?.$modal.msgError('获取默认赛事信息失败');
|
|
|
- }
|
|
|
-};
|
|
|
-
|
|
|
/** 查询赛事项目列表 */
|
|
|
const getList = async () => {
|
|
|
- if (!queryParams.value.eventId) {
|
|
|
- proxy?.$modal.msgWarning('未获取到默认赛事信息');
|
|
|
- loading.value = false;
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
loading.value = true;
|
|
|
const res = await listGameEventProject(queryParams.value);
|
|
|
gameEventProjectList.value = res.rows;
|
|
@@ -297,13 +277,15 @@ const getList = async () => {
|
|
|
loading.value = false;
|
|
|
};
|
|
|
|
|
|
-// 获取赛事分组列表
|
|
|
-const getGroupList = async () => {
|
|
|
+/** 查询赛事分组列表 */
|
|
|
+const getGameEventGroupList = async () => {
|
|
|
const res = await listGameEventGroup({
|
|
|
pageNum: 1,
|
|
|
- pageSize: 1000
|
|
|
+ pageSize: 1000,
|
|
|
+ orderByColumn: '',
|
|
|
+ isAsc: ''
|
|
|
});
|
|
|
- gameEventGroupList.value = res.rows || [];
|
|
|
+ gameEventGroupList.value = res.data;
|
|
|
};
|
|
|
|
|
|
/** 取消按钮 */
|
|
@@ -314,7 +296,7 @@ const cancel = () => {
|
|
|
|
|
|
/** 表单重置 */
|
|
|
const reset = () => {
|
|
|
- form.value = { ...initFormData, eventId: defaultEvent.value?.eventId };
|
|
|
+ form.value = { ...initFormData };
|
|
|
gameEventProjectFormRef.value?.resetFields();
|
|
|
};
|
|
|
|
|
@@ -327,15 +309,13 @@ const handleQuery = () => {
|
|
|
/** 重置按钮操作 */
|
|
|
const resetQuery = () => {
|
|
|
queryFormRef.value?.resetFields();
|
|
|
- // 保留默认赛事ID
|
|
|
- queryParams.value.eventId = defaultEvent.value?.eventId;
|
|
|
handleQuery();
|
|
|
};
|
|
|
|
|
|
/** 多选框选中数据 */
|
|
|
-const handleSelectionChange = (selection: GameEventProjectVO[]) => {
|
|
|
- ids.value = selection.map((item) => item.projectId);
|
|
|
- single.value = selection.length != 1;
|
|
|
+const handleSelectionChange = (selection: any[]) => {
|
|
|
+ ids.value = selection.map(item => item.projectId);
|
|
|
+ single.value = selection.length !== 1;
|
|
|
multiple.value = !selection.length;
|
|
|
};
|
|
|
|
|
@@ -347,39 +327,51 @@ const handleAdd = () => {
|
|
|
};
|
|
|
|
|
|
/** 修改按钮操作 */
|
|
|
-const handleUpdate = async (row?: GameEventProjectVO) => {
|
|
|
+const handleUpdate = (row?: GameEventProjectVO) => {
|
|
|
reset();
|
|
|
- const _projectId = row?.projectId || ids.value[0];
|
|
|
- const res = await getGameEventProject(_projectId);
|
|
|
- Object.assign(form.value, res.data);
|
|
|
- dialog.visible = true;
|
|
|
- dialog.title = '修改赛事项目';
|
|
|
+ const projectId = row?.projectId || ids.value.at(0);
|
|
|
+ getGameEventProject(projectId).then(response => {
|
|
|
+ Object.assign(form.value, response.data);
|
|
|
+ dialog.visible = true;
|
|
|
+ dialog.title = '修改赛事项目';
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
/** 提交按钮 */
|
|
|
const submitForm = () => {
|
|
|
- gameEventProjectFormRef.value?.validate(async (valid: boolean) => {
|
|
|
+ gameEventProjectFormRef.value?.validate(valid => {
|
|
|
if (valid) {
|
|
|
buttonLoading.value = true;
|
|
|
- if (form.value.projectId) {
|
|
|
- await updateGameEventProject(form.value).finally(() => (buttonLoading.value = false));
|
|
|
+ if (form.value.projectId !== undefined) {
|
|
|
+ updateGameEventProject(form.value).then(response => {
|
|
|
+ proxy?.$modal.msgSuccess('修改成功');
|
|
|
+ dialog.visible = false;
|
|
|
+ getList();
|
|
|
+ }).finally(() => {
|
|
|
+ buttonLoading.value = false;
|
|
|
+ });
|
|
|
} else {
|
|
|
- await addGameEventProject(form.value).finally(() => (buttonLoading.value = false));
|
|
|
+ addGameEventProject(form.value).then(response => {
|
|
|
+ proxy?.$modal.msgSuccess('新增成功');
|
|
|
+ dialog.visible = false;
|
|
|
+ getList();
|
|
|
+ }).finally(() => {
|
|
|
+ buttonLoading.value = false;
|
|
|
+ });
|
|
|
}
|
|
|
- proxy?.$modal.msgSuccess('操作成功');
|
|
|
- dialog.visible = false;
|
|
|
- await getList();
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
|
|
|
/** 删除按钮操作 */
|
|
|
-const handleDelete = async (row?: GameEventProjectVO) => {
|
|
|
- const _projectIds = row?.projectId || ids.value;
|
|
|
- await proxy?.$modal.confirm('是否确认删除赛事项目编号为"' + _projectIds + '"的数据项?').finally(() => (loading.value = false));
|
|
|
- await delGameEventProject(_projectIds);
|
|
|
- proxy?.$modal.msgSuccess('删除成功');
|
|
|
- await getList();
|
|
|
+const handleDelete = (row?: GameEventProjectVO) => {
|
|
|
+ const projectIds = row?.projectId || ids.value;
|
|
|
+ proxy?.$modal.confirm('是否确认删除赛事项目编号为"' + projectIds + '"的数据项?').then(function () {
|
|
|
+ return delGameEventProject(projectIds);
|
|
|
+ }).then(() => {
|
|
|
+ getList();
|
|
|
+ proxy?.$modal.msgSuccess('删除成功');
|
|
|
+ }).catch(() => {proxy?.$modal.msgSuccess('删除失败');});
|
|
|
};
|
|
|
|
|
|
/** 导出按钮操作 */
|
|
@@ -394,9 +386,8 @@ const handleExport = () => {
|
|
|
};
|
|
|
|
|
|
onMounted(() => {
|
|
|
- getDefaultEventInfo().then(() => {
|
|
|
- getList();
|
|
|
- getGroupList();
|
|
|
- });
|
|
|
+ getList();
|
|
|
+ getGameEventGroupList();
|
|
|
});
|
|
|
+
|
|
|
</script>
|