Browse Source

新增导出

学习?学个屁 1 week ago
parent
commit
b06c9aeae0

+ 5 - 7
.env.development

@@ -7,26 +7,24 @@ VITE_PUBLIC_PATH = /
 
 
 # 跨域代理,您可以配置多个 ,请注意,没有换行符
-# VITE_PROXY = [["/jeecgboot","http://192.168.1.34:8080/jeecg-boot"],["/upload","http://192.168.1.34:8080/jeecg-boot"]]
-# VITE_PROXY = [["/jeecgboot","http://192.168.0.11:8080/jeecg-boot"],["/upload","http://192.168.0.11:8080/upload"]]
+# VITE_PROXY = [["/jeecgboot","http://192.168.0.217:8080/jeecg-boot"],["/upload","http://192.168.0.217:8080/jeecg-boot"]]
+VITE_PROXY = [["/jeecgboot","http://192.168.0.11:8080/jeecg-boot"],["/upload","http://192.168.0.11:8080/upload"]]
 # VITE_PROXY = [["/jeecgboot","http://192.168.1.253:8080/jeecg-boot"],["/upload","http://192.168.1.253:8080/upload"]]
 # VITE_PROXY = [["/jeecgboot","http://192.168.1.166:8080/jeecg-boot"],["/upload","http://192.168.1.166:8080/upload"]]
 # VITE_PROXY = [["/jeecgboot","http://47.109.18.141:8080/jeecg-boot"],["/upload","http://47.109.18.141:8080/upload"]]
-VITE_PROXY = [["/jeecgboot","https://api.qlapp.cn/jeecgboot"],["/upload","https://api.qlapp.cn/jeecgboot/upload"]]
 
 #后台接口全路径地址(必填)
-# VITE_GLOB_DOMAIN_URL=http://192.168.1.34:8080/jeecg-boot #//黄、
-# VITE_GLOB_DOMAIN_URL=http://192.168.0.11:8080/jeecg-boot  #李
+# VITE_GLOB_DOMAIN_URL=http://192.168.0.217:8080/jeecg-boot #//黄
+VITE_GLOB_DOMAIN_URL=http://192.168.0.11:8080/jeecg-boot  #李
 # VITE_GLOB_DOMAIN_URL=http://192.168.1.253:8080/jeecg-boot  #张
 # VITE_GLOB_DOMAIN_URL=http://192.168.1.166:8080/jeecg-boot  #张
 # VITE_GLOB_DOMAIN_URL=http://47.109.18.141:8080/jeecg-boot  #fwq
-VITE_GLOB_DOMAIN_URL=https://api.qlapp.cn/jeecgboot  #fwq
 
 
 #后台接口父地址(必填)
 VITE_GLOB_API_URL=/jeecgboot
 
-#  
+#
 VITE_GLOB_API_URL_PREFIX=
 
 #微前端qiankun应用,命名必须以VITE_APP_SUB_开头,jeecg-app-1为子应用的项目名称,也是子应用的路由父路径

+ 18 - 9
src/views/businessManagement/competition/index.vue

@@ -1,14 +1,14 @@
 <template>
-  <div class="p-4"
-    ><BasicTable @register="registerTable">
+  <div class="p-4">
+    <BasicTable @register="registerTable">
       <template #tableTitle>
         <a-button
           type="primary"
           preIcon="ant-design:plus-outlined"
           @click="router.push({ name: 'businessManagement-competitionCommon', query: { type: 0 } })"
         >
-          新增</a-button
-        >
+          新增
+        </a-button>
         <a-dropdown>
           <template #overlay>
             <a-menu>
@@ -22,13 +22,15 @@
       </template>
       <template #action="{ record }">
         <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
-      </template> </BasicTable
-  ></div>
+      </template>
+    </BasicTable>
+  </div>
   <Modal v-model:open="openCode" title="赛事二维码">
     <div class="p-20px flex items-center justify-center">
-      <div
-        ><QRCode :value="CodeText" ref="qrcodeCanvasRef" /> <a-button type="link" block class="mt20px" @click="downloadImage">下载图片</a-button></div
-      >
+      <div>
+        <QRCode :value="CodeText" ref="qrcodeCanvasRef" />
+        <a-button type="link" block class="mt20px" @click="downloadImage">下载图片</a-button>
+      </div>
     </div>
   </Modal>
   <competitionModal @register="registerModal" @success="reload"></competitionModal>
@@ -46,6 +48,7 @@
   import { ref } from 'vue';
   import { useRouteTabText } from '/@/hooks/web/useRouteTab';
   import { useModal } from '/@/components/Modal';
+
   const openCode = ref(false);
   const qrcodeCanvasRef = ref();
   const CodeText = ref('');
@@ -85,6 +88,7 @@
   });
   const [registerTable, { reload }] = tableContext;
   const [registerModal, { openModal }] = useModal();
+
   function getTableAction(record) {
     return [
       {
@@ -99,6 +103,7 @@
       },
     ];
   }
+
   /**
    * 下拉操作栏
    */
@@ -125,12 +130,14 @@
       },
     ];
   }
+
   function handleViewCode(record) {
     console.log(record.id, '');
 
     CodeText.value = `https://api.qlapp.cn/useprogram/?id=${record.id}`;
     openCode.value = true;
   }
+
   async function handleDelete(record) {
     await deleteOne({ id: record.id }, reload);
   }
@@ -138,6 +145,7 @@
   function handleView(record) {
     router.push({ name: 'businessManagement-competitionCommon', query: { type: 2, id: record.id } });
   }
+
   function handleEdit(record) {
     router.push({ name: 'businessManagement-competitionCommon', query: { type: 1, id: record.id } });
   }
@@ -149,6 +157,7 @@
       showFooter: true,
     });
   }
+
   async function downloadImage() {
     const url = await qrcodeCanvasRef.value.toDataURL();
     const a = document.createElement('a');

+ 110 - 5
src/views/orderManagement/order/index.vue

@@ -18,7 +18,7 @@
           >店铺名称:
 
           <a-tooltip>
-            <template #title>{{ record.orderType == 3 || record.orderType == 4 ? record.departName : record.siteName }}</template>
+            <template #title>{{ record.orderType == 3 || record.orderType == 4 ? record.departName : record.siteName }} </template>
             {{ record.orderType == 3 || record.orderType == 4 ? record.departName : record.siteName }}
           </a-tooltip>
         </div>
@@ -61,18 +61,23 @@
     </template>
   </BasicTable>
   <orderModelView @register="registerModal"></orderModelView>
+  <a-modal v-model:open="openExportData" title="导出赛事名单" @ok="handleExportData" :confirmLoading="exportLoading">
+    <BasicForm :showActionButtonGroup="false" @register="registerForm" style="margin: 50px 50px 0 50px" />
+  </a-modal>
 </template>
 
 <script setup lang="ts">
   import orderModelView from './components/orderModelView.vue';
-  import { Image, message } from 'ant-design-vue';
+  import { Image, message, Modal, QRCode } from 'ant-design-vue';
   import { ref, reactive, computed, unref } from 'vue';
-  import { BasicTable, useTable, TableAction, TableImg } from '/@/components/Table';
+  import { BasicTable, TableAction } from '/@/components/Table';
+  import { useForm, BasicForm, FormSchema } from '/@/components/Form';
   import { useModal } from '/@/components/Modal';
   import { useListPage } from '/@/hooks/system/useListPage';
   import { columns, searchFormSchema, afterSaleStatus, orderStatus } from './order.data';
-  import { list } from './order.api';
+  import { list, exportData, queryEvents, queryProject } from './order.api';
   import { useUserStore } from '/@/store/modules/user';
+
   const queryParam = reactive<any>({});
   const userStore = useUserStore();
   //注册model
@@ -101,6 +106,69 @@
   });
 
   const [registerTable, { reload }, { selectedRowKeys }] = tableContext;
+  //自定义表单字段
+  const formSchemas: FormSchema[] = [
+    {
+      label: '赛事名称',
+      field: 'name',
+      component: 'ApiSelect',
+      required: true,
+      labelWidth: 100,
+      componentProps: {
+        api: queryEvents,
+        fieldNames: {
+          label: 'name',
+          value: 'id',
+        },
+        onChange: (value) => {
+          exportQueryParam.gameId = value;
+        },
+      },
+    },
+    {
+      label: '比赛项目',
+      field: 'project',
+      component: 'ApiSelect',
+      required: true,
+      labelWidth: 100,
+      componentProps: {
+        api: queryProject,
+        fieldNames: {
+          label: 'name',
+          value: 'id',
+        },
+        onChange: (value) => {
+          exportQueryParam.projectId = value;
+        },
+      },
+    },
+    {
+      label: '报名结束时间',
+      field: 'entryTime',
+      component: 'RangePicker',
+      labelWidth: 100,
+      required: true,
+      componentProps: {
+        onChange: (value) => {
+          exportQueryParam.startTime = value[0];
+          exportQueryParam.endTime = value[1];
+          console.log(value);
+        },
+      },
+    },
+  ];
+
+  /**
+   * BasicForm绑定注册;
+   */
+  const [registerForm] = useForm({
+    //注册表单列
+    schemas: formSchemas,
+    showResetButton: false,
+    submitButtonOptions: { text: '提交', preIcon: '' },
+    actionColOptions: { span: 17 },
+  });
+
   /**
    * 编辑事件
    */
@@ -109,6 +177,7 @@
       record,
     });
   }
+
   /**
    * 操作栏
    */
@@ -121,15 +190,51 @@
       },
     ];
   }
+
   /**
    * 下拉操作栏
    */
   function getDropDownAction(record) {
     return [];
   }
+
+  const openExportData = ref(false);
+
   function handleExport() {
-    message.error('记得提醒搞导出,现在暂时没有这个功能!');
+    openExportData.value = true;
+    // message.error('记得提醒搞导出,现在暂时没有这个功能!');
   }
+
+  // 提交导出
+  const exportQueryParam = reactive<any>({
+    gameId: null,
+    projectId: null,
+    startTime: null,
+    endTime: null,
+  });
+  const exportLoading = ref(false);
+  const handleExportData = async () => {
+    exportLoading.value = true;
+    try {
+      const response = await exportData(exportQueryParam);
+      const blob = new Blob([response], { type: 'application/vnd.ms-excel' });
+      const downloadUrl = window.URL.createObjectURL(blob);
+      const link = document.createElement('a');
+      link.href = downloadUrl;
+      link.download = '赛事名单.xlsx';
+      document.body.appendChild(link);
+      link.click();
+      document.body.removeChild(link);
+      window.URL.revokeObjectURL(downloadUrl);
+      message.success('导出成功!');
+    } catch (error) {
+      console.error('导出失败:', error);
+      message.error('导出失败,请稍后重试');
+    } finally {
+      exportLoading.value = false;
+      openExportData.value = false;
+    }
+  };
 </script>
 
 <style scoped></style>

+ 24 - 0
src/views/orderManagement/order/order.api.ts

@@ -3,7 +3,11 @@ import { defHttp } from '/@/utils/http/axios';
 enum Api {
   list = '/app/appOrder/queryPage',
   queryByid = '/app/appOrder/queryInfoById',
+  queryEvents = '/app/appOrder/exportConditionByName',
+  queryProject = '/app/appOrder/exportConditionByProjectName',
+  exportData = '/app/appOrder/exportCondition',
 }
+
 /**
  * 列表接口
  * @param params
@@ -11,6 +15,19 @@ enum Api {
 export const list = (params) => defHttp.post({ url: Api.list, params });
 
 export const queryByid = (orderId) => defHttp.get<AppOrderInfoVO>({ url: `${Api.queryByid}/${orderId}` });
+export const queryEvents = (params) => defHttp.get({ url: Api.queryEvents, params });
+export const queryProject = (params) => defHttp.get({ url: Api.queryProject, params });
+export const exportData = (params) =>
+  defHttp.post(
+    {
+      url: Api.exportData,
+      params,
+      responseType: 'blob',
+    },
+    {
+      isTransformResponse: false, // 禁用默认的响应转换
+    }
+  );
 
 /**
  * 返回数据对象 data
@@ -93,6 +110,7 @@ export interface AppOrderInfoVO {
    * 核销记录
    */
   verificationRecordDTOList?: VerificationRecordDTO[];
+
   [property: string]: any;
 }
 
@@ -130,6 +148,7 @@ export interface AppGameScheduleVO {
    * 开始时间
    */
   startTime?: string;
+
   [property: string]: any;
 }
 
@@ -159,6 +178,7 @@ export interface AppIsinVO {
    * 手机号码
    */
   UserPhone?: string;
+
   [property: string]: any;
 }
 
@@ -260,6 +280,7 @@ export interface AppIsin {
    * 核验人名称
    */
   verifyUserName?: string;
+
   [property: string]: any;
 }
 
@@ -382,6 +403,7 @@ export interface AppOrderProInfo {
    * 手机号
    */
   userPhone?: string;
+
   [property: string]: any;
 }
 
@@ -399,6 +421,7 @@ export interface VerificationRecordDTO {
    * 核销记录
    */
   verificationRecordList?: AppCoursesVerificationRecord[];
+
   [property: string]: any;
 }
 
@@ -515,5 +538,6 @@ export interface AppCoursesVerificationRecord {
    * 核验人名称
    */
   verifyUserName?: string;
+
   [property: string]: any;
 }