Răsfoiți Sursa

Merge branch 'dev_zlt' into dev

zhou 1 lună în urmă
părinte
comite
606da4178c

+ 8 - 0
src/layout/components/Sidebar/index.vue

@@ -5,6 +5,7 @@
       <transition :enter-active-class="proxy?.animate.menuSearchAnimate.enter" mode="out-in">
         <el-menu
           :default-active="activeMenu"
+          :default-opened="defaultOpenedMenus"
           :collapse="isCollapse"
           :background-color="bgColor"
           :text-color="textColor"
@@ -21,6 +22,8 @@
 </template>
 
 <script setup lang="ts">
+import { computed, getCurrentInstance } from 'vue';
+import { useRoute } from 'vue-router';
 import Logo from './Logo.vue';
 import SidebarItem from './SidebarItem.vue';
 import variables from '@/assets/styles/variables.module.scss';
@@ -50,6 +53,11 @@ const activeMenu = computed(() => {
   return path;
 });
 
+// 获取默认打开的菜单(从 store 中获取持久化状态)
+const defaultOpenedMenus = computed(() => {
+  return appStore.getDefaultOpenedMenus();
+});
+
 const bgColor = computed(() => (sideTheme.value === 'theme-dark' ? variables.menuBackground : variables.menuLightBackground));
 const textColor = computed(() => (sideTheme.value === 'theme-dark' ? variables.menuColor : variables.menuLightColor));
 </script>

+ 20 - 1
src/store/modules/app.ts

@@ -6,6 +6,9 @@ import { ref, reactive, computed } from 'vue';
 
 export const useAppStore = defineStore('app', () => {
   const sidebarStatus = useStorage('sidebarStatus', '1');
+  // 添加菜单打开状态的持久化存储
+  const menuOpenedStatus = useStorage('menuOpenedStatus', JSON.stringify(['/game']));
+
   const sidebar = reactive({
     opened: sidebarStatus.value ? !!+sidebarStatus.value : true,
     withoutAnimation: false,
@@ -57,6 +60,20 @@ export const useAppStore = defineStore('app', () => {
     language.value = val;
   };
 
+  // 获取默认打开的菜单
+  const getDefaultOpenedMenus = (): string[] => {
+    try {
+      return JSON.parse(menuOpenedStatus.value);
+    } catch {
+      return ['/game']; // 默认打开系统菜单
+    }
+  };
+
+  // 设置菜单打开状态
+  const setMenuOpenedStatus = (openedMenus: string[]): void => {
+    menuOpenedStatus.value = JSON.stringify(openedMenus);
+  };
+
   return {
     device,
     sidebar,
@@ -68,6 +85,8 @@ export const useAppStore = defineStore('app', () => {
     closeSideBar,
     toggleDevice,
     setSize,
-    toggleSideBarHide
+    toggleSideBarHide,
+    getDefaultOpenedMenus,
+    setMenuOpenedStatus
   };
 });

+ 2 - 2
src/utils/request.ts

@@ -27,9 +27,9 @@ axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8';
 axios.defaults.headers['clientid'] = import.meta.env.VITE_APP_CLIENT_ID;
 // 创建 axios 实例
 const service = axios.create({
-  // baseURL: import.meta.env.VITE_APP_BASE_API,
+  baseURL: import.meta.env.VITE_APP_BASE_API,
   // baseURL: 'http://192.168.1.126:8080',
-  baseURL: 'http://meet2.sportsrobo.club:8080',
+  // baseURL: 'http://meet2.sportsrobo.club:8080',
   // baseURL: 'http://localhost:8080',
   timeout: 300000 // 增加默认超时时间到5分钟
 });

+ 3 - 1
src/views/system/advice/index.vue

@@ -111,7 +111,9 @@ const data = reactive<PageData<AdviceForm, AdviceQuery>>({
     pageSize: 10,
     name: undefined,
     content: undefined,
-    params: {}
+    params: {},
+    orderByColumn: undefined,
+    isAsc: undefined,
   },
   rules: {
     name: [{ required: true, message: '姓名不能为空', trigger: 'blur' }],

+ 21 - 24
src/views/system/gameAthlete/index.vue

@@ -44,9 +44,9 @@
               >删除
             </el-button>
           </el-col>
-          <el-col :span="1.5">
+          <!-- <el-col :span="1.5">
             <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['system:gameAthlete:export']">导出 </el-button>
-          </el-col>
+          </el-col> -->
           <el-col :span="1.5">
             <el-button type="info" plain icon="Upload" @click="handleImport" v-hasPermi="['system:gameAthlete:import']"> 导入 </el-button>
           </el-col>
@@ -58,7 +58,7 @@
         <el-table-column type="selection" width="55" align="center" />
         <el-table-column label="主键" align="center" prop="athleteId" v-if="columns[0].visible" />
         <el-table-column label="赛事名称" align="center" prop="eventName" width="120px" v-if="columns[1].visible" />
-        <el-table-column label="运动员编号" align="center" prop="athleteCode" width="100px" v-if="columns[2].visible" />
+        <el-table-column label="号" align="center" prop="athleteCode" width="100px" v-if="columns[2].visible" />
         <el-table-column label="姓名" align="center" prop="name" v-if="columns[3].visible" />
         <el-table-column label="性别" align="center" prop="gender" v-if="columns[4].visible">
           <template #default="scope">
@@ -77,14 +77,14 @@
             {{ getTeamNameById(scope.row.teamId) }}
           </template>
         </el-table-column>
-        <el-table-column label="芯片号" align="center" prop="chipCode" v-if="columns[9].visible" />
-        <el-table-column label="手机号" align="center" prop="phone" v-if="columns[10].visible" />
-        <el-table-column label="居住地址" align="center" prop="location" v-if="columns[11].visible" />
-        <el-table-column label="T恤尺码" align="center" prop="tshirtSize" v-if="columns[12].visible" />
-        <el-table-column label="组别" align="center" prop="groupType" v-if="columns[13].visible" />
-        <el-table-column label="号码" align="center" prop="number" v-if="columns[14].visible" />
-        <el-table-column label="状态" align="center" prop="status" v-if="columns[15].visible" />
-        <el-table-column label="备注" align="center" prop="remark" v-if="columns[16].visible" />
+        <!-- <el-table-column label="芯片号" align="center" prop="chipCode" v-if="columns[9].visible" /> -->
+        <!-- <el-table-column label="手机号" align="center" prop="phone" v-if="columns[10].visible" /> -->
+        <!-- <el-table-column label="居住地址" align="center" prop="location" v-if="columns[11].visible" /> -->
+        <!-- <el-table-column label="T恤尺码" align="center" prop="tshirtSize" v-if="columns[12].visible" /> -->
+        <!-- <el-table-column label="组别" align="center" prop="groupType" v-if="columns[13].visible" /> -->
+        <!-- <el-table-column label="号码" align="center" prop="number" v-if="columns[14].visible" /> -->
+        <el-table-column label="状态" align="center" prop="status" 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" fixed="right">
           <template #default="scope">
             <el-tooltip content="修改" placement="top">
@@ -102,15 +102,12 @@
     <!-- 添加或修改参赛队员对话框 -->
     <el-dialog :title="dialog.title" v-model="dialog.visible" width="800px" append-to-body>
       <el-form ref="gameAthleteFormRef" :model="form" :rules="rules" label-width="80px">
-        <!-- <el-form-item label="用户ID" prop="userId">
-          <el-input v-model="form.userId" placeholder="请输入用户ID" />
-        </el-form-item> -->
         <el-form-item label="队伍" prop="teamId">
           <el-select v-model="form.teamId" placeholder="请选择队伍">
             <el-option v-for="team in gameTeamList" :key="team.teamId" :label="team.teamName" :value="team.teamId" />
           </el-select>
         </el-form-item>
-        <el-form-item label="运动员编号" prop="athleteCode">
+        <el-form-item label="号" prop="athleteCode">
           <el-input v-model="form.athleteCode" placeholder="请输入运动员编号" />
         </el-form-item>
         <el-form-item label="姓名" prop="name">
@@ -214,21 +211,21 @@ const total = ref(0);
 const columns = ref<FieldOption[]>([
   { key: 0, label: '主键', visible: false },
   { key: 1, label: '赛事名称', visible: false },
-  { key: 2, 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: '队伍', visible: true },
-  { key: 9, label: '芯片号', visible: true },
-  { key: 10, label: '手机号', visible: true },
-  { key: 11, label: '居住地址', visible: true },
-  { key: 12, label: 'T恤尺码', visible: true },
-  { key: 13, label: '组别', visible: true },
-  { key: 14, label: '号码', visible: true },
-  { key: 15, label: '状态', visible: true },
-  { key: 16, label: '备注', visible: true },
+  // { key: 9, label: '芯片号', visible: true },
+  // { key: 10, label: '手机号', visible: true },
+  // { key: 11, label: '居住地址', visible: true },
+  // { key: 12, label: 'T恤尺码', visible: true },
+  // { key: 13, label: '组别', visible: true },
+  // { key: 14, label: '号码', visible: true },
+  { key: 9, label: '状态', visible: true },
+  { key: 10, label: '备注', visible: true },
 ]);
 
 const queryFormRef = ref<ElFormInstance>();

+ 6 - 2
src/views/system/gameEvent/athlete.vue

@@ -29,7 +29,7 @@
             </el-form-item>
           </el-col>
           <el-col :span="12">
-            <el-form-item label="号" prop="athleteCode">
+            <el-form-item label="号" prop="athleteCode">
               <el-input v-model="athleteForm.athleteCode" placeholder="输入号码" />
             </el-form-item>
           </el-col>
@@ -105,6 +105,9 @@ const athleteRules = {
   ],
   age: [
     { required: true, message: '请输入年龄', trigger: 'blur' }
+  ],
+  gender: [
+    { required: true, message: '请选择性别', trigger: 'change' }
   ]
 };
 
@@ -152,7 +155,8 @@ const submitForm = () => {
         athleteCode: athleteForm.athleteCode,
         age: athleteForm.age,
         gender: athleteForm.gender,
-        projectValue: `${projectValue.join(',')}`,  // 安全地进行 join 操作
+        projectValue: `${projectValue.join(',')}`,
+        projectList: projectValue,
       };
       console.log(athleteForm.projectValue);
       try {

+ 5 - 5
src/views/system/gameEvent/detail.vue

@@ -57,13 +57,13 @@
         </template>
 
         <el-table :data="projectData" border>
-          <el-table-column label="项目名称" prop="projectName" align="center" />
           <el-table-column label="项目类型" prop="projectType" align="center">
             <template #default="scope">
-              {{ scope.row.projectType === '0' ? '个人' : '团体' }}
+              <dict-tag :options="game_project_type" :value="scope.row.projectType" />
             </template>
           </el-table-column>
-          <el-table-column label="项目组别" prop="groupType" align="center" />
+          <el-table-column label="项目名称" prop="projectName" align="center" />
+          <!-- <el-table-column label="项目组别" prop="groupType" align="center" /> -->
           <el-table-column label="比赛场地" prop="location" align="center" />
           <el-table-column label="开始时间" prop="startTime" align="center" width="180">
             <template #default="scope">
@@ -102,8 +102,8 @@ const router = useRouter();
 
 // 获取字典数据
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
-const { game_event_type, game_event_status, sys_normal_disable } = toRefs<any>(
-  proxy?.useDict('game_event_type', 'game_event_status', 'sys_normal_disable')
+const { game_event_type, game_event_status, sys_normal_disable, game_project_type } = toRefs<any>(
+  proxy?.useDict('game_event_type', 'game_event_status', 'sys_normal_disable', 'game_project_type')
 );
 
 // 赛事数据

+ 23 - 8
src/views/system/gameEvent/edit.vue

@@ -472,19 +472,34 @@ const handleMenuSelectionChange = (selection: any[]) => {
 };
 
 // 确认添加菜单项
-const confirmAddMenuItems = () => {
+const confirmAddMenuItems = async () => {
   console.log('selectedMenus:', selectedMenus.value);
   if (selectedMenus.value.length === 0) {
     proxy?.$modal.msgWarning('请选择要添加的菜单');
     return;
   }
 
-  // 将选中的菜单添加到菜单列表中(无需重复检查,因为列表已经过滤掉了重复项)
-  menuItems.value.push(...selectedMenus.value);
-
-  console.log('menuItems:', menuItems.value);
-  menuSelectDialogVisible.value = false;
-  proxy?.$modal.msgSuccess(`成功添加 ${selectedMenus.value.length} 个菜单项`);
+  try {
+    // 将选中的菜单添加到菜单列表中(无需重复检查,因为列表已经过滤掉了重复项)
+    menuItems.value.push(...selectedMenus.value);
+
+    // 如果是编辑模式,立即保存菜单数据到数据库
+    // if (isEdit.value && currentEventId.value) {
+    //   await saveMenuData(currentEventId.value);
+    //   proxy?.$modal.msgSuccess(`成功添加 ${selectedMenus.value.length} 个菜单项并保存到数据库`);
+    // } else {
+    //   // 新增模式下,菜单数据会在最终保存赛事时一起保存
+    //   proxy?.$modal.msgSuccess(`成功添加 ${selectedMenus.value.length} 个菜单项(将在保存赛事时一起保存)`);
+    // }
+
+    console.log('menuItems:', menuItems.value);
+    menuSelectDialogVisible.value = false;
+  } catch (error) {
+    console.error('添加菜单项失败:', error);
+    // 如果保存失败,回滚本地数组的更改
+    menuItems.value.splice(-selectedMenus.value.length, selectedMenus.value.length);
+    proxy?.$modal.msgError('添加菜单项失败,请重试');
+  }
 };
 
 // 获取跳转类型标签
@@ -667,7 +682,7 @@ const loadConfigData = async (eventId: string | number) => {
     const res = await listGameEventConfig({
       eventId: eventId === '' ? '' : eventId,
       pageNum: 1,
-      pageSize: 10,
+      pageSize: 1000,
       orderByColumn: '',
       isAsc: ''
     });

+ 6 - 10
src/views/system/gameEvent/index.vue

@@ -38,21 +38,17 @@
       <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:gameEvent:add']">新增 </el-button>
+            <el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['system:gameEvent:add']">新增</el-button>
           </el-col>
           <el-col :span="1.5">
-            <el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['system:gameEvent:edit']"
-              >修改
-            </el-button>
-          </el-col>
-          <el-col :span="1.5">
-            <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['system:gameEvent:remove']"
-              >删除
-            </el-button>
+            <el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['system:gameEvent:edit']">修改</el-button>
           </el-col>
           <el-col :span="1.5">
-            <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['system:gameEvent:export']">导出 </el-button>
+            <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['system:gameEvent:remove']">删除</el-button>
           </el-col>
+          <!-- <el-col :span="1.5">
+            <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['system:gameEvent:export']">导出</el-button>
+          </el-col> -->
           <!-- 新增的操作按钮,基于默认赛事 -->
           <el-col :span="1.5">
             <el-button type="warning" plain icon="Download" @click="handleDownloadTemplateDefault" v-hasPermi="['system:gameEvent:download']"

+ 2 - 2
src/views/system/gameEventConfig/index.vue

@@ -41,9 +41,9 @@
           <el-col :span="1.5">
             <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['system:gameEventConfig:remove']">删除</el-button>
           </el-col>
-          <el-col :span="1.5">
+          <!-- <el-col :span="1.5">
             <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['system:gameEventConfig:export']">导出</el-button>
-          </el-col>
+          </el-col> -->
           <right-toolbar v-model:showSearch="showSearch" :columns="columns" @queryTable="getList"></right-toolbar>
         </el-row>
       </template>

+ 2 - 2
src/views/system/gameEventConfigType/index.vue

@@ -42,9 +42,9 @@
           <el-col :span="1.5">
             <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['system:gameEventConfigType:remove']">删除</el-button>
           </el-col>
-          <el-col :span="1.5">
+          <!-- <el-col :span="1.5">
             <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['system:gameEventConfigType:export']">导出</el-button>
-          </el-col>
+          </el-col> -->
           <right-toolbar v-model:showSearch="showSearch" :columns="columns" @queryTable="getList"></right-toolbar>
         </el-row>
       </template>

+ 2 - 2
src/views/system/gameEventMenu/index.vue

@@ -33,9 +33,9 @@
           <el-col :span="1.5">
             <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['system:menu:remove']">删除</el-button>
           </el-col>
-          <el-col :span="1.5">
+          <!-- <el-col :span="1.5">
             <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['system:menu:export']">导出</el-button>
-          </el-col>
+          </el-col> -->
           <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
         </el-row>
       </template>

+ 2 - 2
src/views/system/gameReferee/index.vue

@@ -28,9 +28,9 @@
           <el-col :span="1.5">
             <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['system:gameReferee:remove']">删除</el-button>
           </el-col>
-          <el-col :span="1.5">
+          <!-- <el-col :span="1.5">
             <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['system:gameReferee:export']">导出</el-button>
-          </el-col>
+          </el-col> -->
           <right-toolbar v-model:showSearch="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
         </el-row>
       </template>

+ 2 - 2
src/views/system/gameScore/gameScoreEdit.vue

@@ -143,7 +143,7 @@ const queryParams = reactive({
 //刷新数据方法
 const refreshData = () => {
   searchValue.value = '';
-  loadData(true); // 刷新时自动计算排名
+  loadData(false); // 刷新时不自动计算排名,需要手动点击计算排名按钮
 };
 
 // 计算排名方法
@@ -412,6 +412,6 @@ const handlePagination = (paginationData: { page: number, limit: number }) => {
 };
 
 onMounted(() => {
-  loadData(true); // 页面初始化时自动计算排名
+  loadData(false); // 页面初始化时不自动计算排名,需要手动点击计算排名按钮
 });
 </script>

+ 0 - 6
src/views/system/gameScore/index.vue

@@ -69,7 +69,6 @@
           </template>
         </el-table-column>
         <el-table-column label="项目" align="center" prop="projectName" v-if="columns[1].visible" />
-        <!-- <el-table-column label="分组" align="center" prop="groupType" v-if="columns[2].visible" /> -->
 
         <el-table-column label="状态" align="center" prop="status" v-if="columns[4].visible">
           <template #default="scope">
@@ -97,16 +96,11 @@
 
 <script setup name="GameScore" lang="ts">
 import { listGameScore, getGameScore, delGameScore, addGameScore, updateGameScore, getProjectScoreData } from '@/api/system/gameScore';
-import { getDefaultEvent } from '@/api/system/gameEvent'
 import { listGameEventProject } from '@/api/system/gameEventProject';
 import { getGameTeam } from '@/api/system/gameTeam';
 import { getGameAthlete } from '@/api/system/gameAthlete';
 import { GameScoreVO, GameScoreQuery, GameScoreForm } from '@/api/system/gameScore/types';
-import { GameEventVO, GameEventQuery } from '@/api/system/gameEvent/types';
 import { GameEventProjectVO, GameEventProjectQuery } from '@/api/system/gameEventProject/types';
-import { GameTeamVO } from '@/api/system/gameTeam/types';
-import { GameAthleteVO } from '@/api/system/gameAthlete/types';
-import { ElMessage } from 'element-plus';
 import { useGameEventStore } from '@/store/modules/gameEvent';
 
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;

+ 2 - 3
src/views/system/gameTeam/index.vue

@@ -35,9 +35,9 @@
               >删除
             </el-button>
           </el-col>
-          <el-col :span="1.5">
+          <!-- <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> -->
           <el-col :span="1.5">
             <el-button type="info" plain icon="Upload" @click="handleImport" v-hasPermi="['system:gameTeam:import']"> 导入 </el-button>
           </el-col>
@@ -149,7 +149,6 @@
 import { listGameTeam, getGameTeam, delGameTeam, addGameTeam, updateGameTeam } from '@/api/system/gameTeam';
 // import { getDefaultEvent } from '@/api/system/gameEvent';
 import { GameTeamVO, GameTeamQuery, GameTeamForm } from '@/api/system/gameTeam/types';
-import { getEventIdNameMap } from '@/api/system/gameEvent';
 import { globalHeaders } from '@/utils/request';
 import { GameEventVO } from '@/api/system/gameEvent/types';