瀏覽代碼

feat(business): 添加导出功能并优化文件命名格式

为多个业务模块添加了导出功能,包括用户管理、道具使用记录、充值订单、赛事列表等,并统一使用 `parseTime` 工具函数格式化导出文件名,提升用户体验。同时修复部分路径引用及权限标识错误,完善按钮显示逻辑和表单校验规则。

主要变更:
- 新增导出按钮及对应权限控制
- 使用日期时间格式化导出文件名-修正路由跳转路径与权限标识- 补充 `parseTime` 引用及调整部分表单默认值
fugui001 3 月之前
父節點
當前提交
b1c7d5c016

+ 11 - 3
src/views/system/business/apiUsers/index.vue

@@ -46,6 +46,14 @@
     </transition>
 
     <el-card shadow="never">
+      <template #header>
+        <el-row :gutter="10" class="mb8">
+          <el-col :span="1.5">
+            <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['business:user:export']">导出</el-button>
+          </el-col>
+        </el-row>
+      </template>
+
       <!--      <template #header>
         <el-row :gutter="10" class="mb8">
           &lt;!&ndash;          <el-col :span="1.5">
@@ -297,7 +305,7 @@ import { listUser, getUser, delUser, addUser, updateUser, sendRewardToos, getSms
 import { UserVO, UserQuery, UserForm } from '@/api/system/business/apiUsers/types';
 import { selectItemsSelList } from '@/api/system/business/items';
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
-
+import { parseTime } from '@/utils/dateUtils';
 const userList = ref<UserVO[]>([]);
 const buttonLoading = ref(false);
 const loading = ref(true);
@@ -542,7 +550,7 @@ const handleExport = () => {
     {
       ...queryParams.value
     },
-    `user_${new Date().getTime()}.xlsx`
+    `用户管理${parseTime(new Date(), '{y}{m}{d}{h}{i}{s}')}.xlsx`
   );
 };
 const handlePhoneInput = (value: string) => {
@@ -647,7 +655,7 @@ const router = useRouter(); // 获取 router 实例
 const viewPointsLog = (row: UserVO) => {
   // 跳转到积分流水页面,并传递用户ID作为查询参数
   router.push({
-    path: '/business/itemsLog',
+    path: '/service/itemsLog',
     query: {
       userId: row.id,
       t: Date.now() // 添加时间戳确保URL变化,触发页面刷新

+ 1 - 1
src/views/system/business/info/index.vue

@@ -30,7 +30,7 @@
           </el-col>
           <el-col :span="1.5">
             <el-button type="warning" plain icon="Operation" v-hasPermi="['business:info:edit']">
-              <router-link to="/business/category">分类管理</router-link>
+              <router-link to="/service/category">分类管理</router-link>
             </el-button>
           </el-col>
 

+ 8 - 8
src/views/system/business/itemsLog/index.vue

@@ -32,9 +32,9 @@
     </transition>-->
 
     <el-card shadow="never">
-<!--      <template #header>
+      <template #header>
         <el-row :gutter="10" class="mb8">
-          <el-col :span="1.5">
+<!--          <el-col :span="1.5">
             <el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['system:itemsLog:add']">新增</el-button>
           </el-col>
           <el-col :span="1.5">
@@ -46,13 +46,13 @@
             <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['system:itemsLog:remove']"
               >删除</el-button
             >
-          </el-col>
+          </el-col>-->
           <el-col :span="1.5">
-            <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['system:itemsLog:export']">导出</el-button>
+            <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['business:itemsLog:export']">导出</el-button>
           </el-col>
           <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
         </el-row>
-      </template>-->
+      </template>
 
       <el-table v-loading="loading" border :data="itemsLogList" @selection-change="handleSelectionChange">
         <!--        <el-table-column type="selection" width="55" align="center" />-->
@@ -176,7 +176,7 @@ const data = reactive<PageData<ItemsLogForm, ItemsLogQuery>>({
 });
 
 const { queryParams, form, rules } = toRefs(data);
-
+import { parseTime } from '@/utils/dateUtils';
 /** 查询道具使用记录列表 */
 const getList = async () => {
   loading.value = true;
@@ -263,11 +263,11 @@ const handleDelete = async (row?: ItemsLogVO) => {
 /** 导出按钮操作 */
 const handleExport = () => {
   proxy?.download(
-    'system/itemsLog/export',
+    'business/itemsLog/export',
     {
       ...queryParams.value
     },
-    `itemsLog_${new Date().getTime()}.xlsx`
+    `道具使用记录${parseTime(new Date(), '{y}{m}{d}{h}{i}{s}')}.xlsx`
   );
 };
 

+ 6 - 7
src/views/system/business/order/index.vue

@@ -37,10 +37,9 @@
     </transition>
 
     <el-card shadow="never">
-      <!--
       <template #header>
         <el-row :gutter="10" class="mb8">
-          <el-col :span="1.5">
+<!--          <el-col :span="1.5">
             <el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['system:order:add']">新增</el-button>
           </el-col>
           <el-col :span="1.5">
@@ -50,14 +49,13 @@
             <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['system:order:remove']"
               >删除</el-button
             >
-          </el-col>
+          </el-col>-->
           <el-col :span="1.5">
-            <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['system:order:export']">导出</el-button>
+            <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['business:order:export']">导出</el-button>
           </el-col>
           <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
         </el-row>
       </template>
--->
 
       <el-table v-loading="loading" border :data="orderList" @selection-change="handleSelectionChange">
         <!-- 序号列 -->
@@ -338,14 +336,15 @@ const handleDelete = async (row?: OrderVO) => {
   await getList();
 };
 
+import { parseTime } from '@/utils/dateUtils';
 /** 导出按钮操作 */
 const handleExport = () => {
   proxy?.download(
-    'system/order/export',
+    'business/order/export',
     {
       ...queryParams.value
     },
-    `order_${new Date().getTime()}.xlsx`
+    `充值订单${parseTime(new Date(), '{y}{m}{d}{h}{i}{s}')}.xlsx`
   );
 };
 

+ 7 - 5
src/views/system/business/products/index.vue

@@ -32,9 +32,9 @@
       <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:products:add']">新增充值项目</el-button>
+            <el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['business:products:add']">新增充值项目</el-button>
           </el-col>
-<!--          <el-col :span="1.5">
+          <!--          <el-col :span="1.5">
             <el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['system:products:edit']"
               >修改</el-button
             >
@@ -44,9 +44,10 @@
               >删除</el-button
             >
           </el-col>
+       -->
           <el-col :span="1.5">
-            <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['system:products:export']">导出</el-button>
-          </el-col>-->
+            <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['business:products:export']">导出</el-button>
+          </el-col>
           <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
         </el-row>
       </template>
@@ -257,6 +258,7 @@ const handleDelete = async (row?: ProductsVO) => {
   await getList();
 };
 
+import { parseTime } from '@/utils/dateUtils';
 /** 导出按钮操作 */
 const handleExport = () => {
   proxy?.download(
@@ -264,7 +266,7 @@ const handleExport = () => {
     {
       ...queryParams.value
     },
-    `products_${new Date().getTime()}.xlsx`
+    `充值管理${parseTime(new Date(), '{y}{m}{d}{h}{i}{s}')}.xlsx`
   );
 };
 

+ 1 - 1
src/views/system/business/terms/index.vue

@@ -95,7 +95,7 @@
 </template>
 
 <script setup name="Terms" lang="ts">
-import { listTerms, getTerms, delTerms, addTerms, updateTerms } from 'src/api/system/business/terms';
+import { listTerms, getTerms, delTerms, addTerms, updateTerms } from '@/api/system/business/terms';
 import { TermsVO, TermsQuery, TermsForm } from '@/api/system/business/terms/types';
 
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;

+ 10 - 10
src/views/system/business/tournaments/index.vue

@@ -41,19 +41,19 @@
               >删除</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="['business:tournaments:export']">导出</el-button>
-          </el-col>-->
+          </el-col>
 
           <!-- 新增的 “盲注管理” 按钮 -->
           <el-col :span="1.5">
             <el-button type="warning" plain icon="Operation" v-hasPermi="['business:tournaments:manager']">
-              <router-link to="/business/structures">盲注表管理</router-link>
+              <router-link to="/tournament/structures">盲注表管理</router-link>
             </el-button>
           </el-col>
           <el-col :span="1.5">
             <el-button type="success" plain icon="Operation" v-hasPermi="['business:tournaments:manager']">
-              <router-link to="/business/config">自动比赛管理</router-link>
+              <router-link to="/tournament/config">自动比赛管理</router-link>
             </el-button>
           </el-col>
           <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
@@ -735,7 +735,7 @@ const removeReward = (index: number) => {
 const iconPreviewUrl = ref('');
 const competitionIcon = ref('');
 const fileList = ref([]);
-
+import { parseTime } from '@/utils/dateUtils';
 // 单选控制变量(用于绑定 el-radio)
 const selectedRadio = ref<number | null>(null);
 
@@ -771,8 +771,8 @@ const initFormData: TournamentsForm = {
   itemsNum: null,
   blindStructureId: null,
   itemsPrizeList: [],
-  delayCardNum: 4,
-  delayCardTime: 15
+  delayCardNum: null,
+  delayCardTime: null
 };
 const data = reactive<PageData<TournamentsForm, TournamentsQuery>>({
   form: { ...initFormData },
@@ -1084,7 +1084,7 @@ const handleExport = () => {
     {
       ...queryParams.value
     },
-    `赛事列表_${new Date().getTime()}.xlsx`
+    `赛事列表${parseTime(new Date(), '{y}{m}{d}{h}{i}{s}')}.xlsx`
   );
 };
 
@@ -1466,7 +1466,7 @@ const handleViewHistory = (row: ClaimsVO) => {
   // 判断 playerId 是否有效(非 null、undefined)
   const playerIdStr = playerId != null ? String(playerId) : '';
   proxy?.$router.push({
-    path: '/business/history',
+    path: '/service/history',
     query: { tournamentId: String(tournamentId), playerId: playerIdStr }
   });
   auditDialog.value.visible = false;
@@ -1478,7 +1478,7 @@ const handleViewPublicHistory = (row: TournamentsVO) => {
   // 判断 playerId 是否有效(非 null、undefined)
   const playerIdStr = playerId != null ? String(playerId) : '';
   proxy?.$router.push({
-    path: '/business/history',
+    path: '/service/history',
     query: { tournamentId: String(tournamentId), playerId: playerIdStr }
   });
 };

+ 5 - 3
src/views/system/business/versionManagement/index.vue

@@ -347,9 +347,11 @@ const submitForm = () => {
         }
         await updateVersionManagement(form.value).finally(() => (buttonLoading.value = false));
       } else {
-        if (fileList.value.length === 0) {
-          proxy?.$modal.msgError('请先选择并上传文件');
-          return;
+        if (form.value.osType == 'Android') {
+          if (fileList.value.length === 0) {
+            proxy?.$modal.msgError('请先选择并上传文件');
+            return;
+          }
         }
         await addVersionManagement(form.value).finally(() => (buttonLoading.value = false));
       }