Просмотр исходного кода

feat(gameEvent): 添加赛事文章编辑页面导出秩序册功能

- 在赛事文章编辑页面头部添加导出秩序册按钮
- 引入getCurrentInstance和ComponentInternalInstance类型定义
- 实现handleExportOrderBook方法用于调用下载接口
- 使用proxy调用download方法导出赛事秩序册word文档
zhou 4 дней назад
Родитель
Сommit
7b7e30c852
1 измененных файлов с 21 добавлено и 4 удалено
  1. 21 4
      src/views/system/gameEvent/components/ArticleEditor.vue

+ 21 - 4
src/views/system/gameEvent/components/ArticleEditor.vue

@@ -3,9 +3,16 @@
       <el-card shadow="never">
       <el-card shadow="never">
         <template #header>
         <template #header>
           <div class="flex items-center justify-between">
           <div class="flex items-center justify-between">
-            <div class="text-lg font-600">
-              赛事文章编辑 
-              <!-- - {{ pageTitle }} -->
+            <div class="text-lg font-600 flex items-center">
+              <span>赛事文章编辑</span>
+              <el-button 
+                type="success" 
+                plain 
+                icon="Download" 
+                @click="handleExportOrderBook" 
+                class="ml-4">
+                导出秩序册
+              </el-button>
             </div>
             </div>
             <div>
             <div>
               <el-button @click="handleBack">返回</el-button>
               <el-button @click="handleBack">返回</el-button>
@@ -184,7 +191,7 @@
   
   
   <script setup lang="ts" name="GameEventArticleEditor">
   <script setup lang="ts" name="GameEventArticleEditor">
   import { useRouter, useRoute } from 'vue-router';
   import { useRouter, useRoute } from 'vue-router';
-  import { ref, reactive, computed, onMounted, onUpdated } from 'vue';
+  import { ref, reactive, computed, onMounted, onUpdated, getCurrentInstance, ComponentInternalInstance } from 'vue';
   import { ElMessage } from 'element-plus';
   import { ElMessage } from 'element-plus';
   import Editor from '@/components/Editor/index.vue';
   import Editor from '@/components/Editor/index.vue';
   import { getEventMdByEventAndType, editEventMd } from '@/api/system/eventMd';
   import { getEventMdByEventAndType, editEventMd } from '@/api/system/eventMd';
@@ -194,6 +201,8 @@
   
   
   const router = useRouter();
   const router = useRouter();
   const route = useRoute();
   const route = useRoute();
+  
+  const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 
 
   //从pinia中获取默认赛事信息
   //从pinia中获取默认赛事信息
   const gameEventStore = useGameEventStore();
   const gameEventStore = useGameEventStore();
@@ -330,6 +339,14 @@
     }
     }
   };
   };
   
   
+  const handleExportOrderBook = () => {
+    proxy?.download(
+      '/system/markdown/exportEventWord',
+      {},
+      `赛事秩序册_${new Date().getTime()}.docx`
+    );
+  };
+
   const handleBack = () => {
   const handleBack = () => {
     router.back();
     router.back();
   };
   };