Преглед на файлове

refactor(layout): 调整侧边栏和菜单默认打开状态

- 修改了侧边栏组件的导入信息
- 更新了菜单打开状态的持久化存储默认值
- 调整了请求服务的 base URL
- 优化了运动员管理页面的展示内容
- 更新了比赛项目管理页面的展示逻辑
- 调整了多个页面的按钮布局和显示
zhou преди 1 месец
родител
ревизия
9d81dccaf3

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

@@ -22,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';

+ 3 - 3
src/store/modules/app.ts

@@ -7,8 +7,8 @@ import { ref, reactive, computed } from 'vue';
 export const useAppStore = defineStore('app', () => {
   const sidebarStatus = useStorage('sidebarStatus', '1');
   // 添加菜单打开状态的持久化存储
-  const menuOpenedStatus = useStorage('menuOpenedStatus', JSON.stringify(['/system/gameEvent']));
-  
+  const menuOpenedStatus = useStorage('menuOpenedStatus', JSON.stringify(['/game']));
+
   const sidebar = reactive({
     opened: sidebarStatus.value ? !!+sidebarStatus.value : true,
     withoutAnimation: false,
@@ -65,7 +65,7 @@ export const useAppStore = defineStore('app', () => {
     try {
       return JSON.parse(menuOpenedStatus.value);
     } catch {
-      return ['/system/gameEvent']; // 默认打开赛事管理菜单
+      return ['/game']; // 默认打开系统菜单
     }
   };
 

+ 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')
 );
 
 // 赛事数据

+ 7 - 7
src/views/system/gameEvent/edit.vue

@@ -484,13 +484,13 @@ const confirmAddMenuItems = async () => {
     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} 个菜单项(将在保存赛事时一起保存)`);
-    }
+    // 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;

+ 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>

+ 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';