Browse Source

频繁往返导出功能

wukai 3 months ago
parent
commit
92d491975a
1 changed files with 27 additions and 3 deletions
  1. 27 3
      src/views/biz/anal/rapid.vue

+ 27 - 3
src/views/biz/anal/rapid.vue

@@ -53,6 +53,13 @@
       </el-col>
     </el-row>
 
+    <!-- 操作按钮 -->
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button type="success" plain icon="Download" @click="handleExport">导出</el-button>
+      </el-col>
+    </el-row>
+
     <!-- 明细数据表格 -->
     <el-table v-loading="loading" :data="detailsList" style="margin-top: 20px;" @row-click="handleRowClick">
       <el-table-column label="序号" type="index" align="center" width="80"/>
@@ -75,10 +82,8 @@
 </template>
 
 <script setup name="Rapid">
-import { getRapid } from "@/api/biz/anal";
+import { getRapid} from "@/api/biz/anal";
 import { getCurrentInstance, onMounted, reactive, ref, toRefs } from 'vue';
-import { parseTime, resetForm } from "@/utils/ruoyi";
-import { Pointer } from "@element-plus/icons-vue";
 import RecordListDetailDialog from '@/components/RecordListDetailDialog.vue';
 
 const { proxy } = getCurrentInstance();
@@ -206,6 +211,21 @@ function handleRowClick(row) {
   // 打开记录列表对话框
   recordListOpen.value = true;
 }
+
+/** 导出按钮操作 */
+function handleExport() {
+  // 准备查询参数
+  const params = {};
+  if (queryParams.value.dateRange && queryParams.value.dateRange.length === 2) {
+    params.startDate = queryParams.value.dateRange[0];
+    params.endDate = queryParams.value.dateRange[1];
+  }
+  params.minTimes = queryParams.value.times;  // 添加次数参数,后端参数名为minTimes
+
+  proxy.download('biz/anal/rapid/export', {
+    ...params
+  }, `短期往返数据_${new Date().getTime()}.xlsx`)
+}
 </script>
 
 <style lang="scss" scoped>
@@ -237,6 +257,10 @@ function handleRowClick(row) {
   &.max-frequency { .stat-number { color: #f56c6c; } }
 }
 
+.mb8 {
+  margin-bottom: 8px;
+}
+
 .mb20 {
   margin-bottom: 20px;
 }