Browse Source

高级搜索-导出

zhongxiaoyu 2 years ago
parent
commit
afa94ee35d

+ 3 - 0
src/components/SimpleTable/index.vue

@@ -239,6 +239,9 @@ export default {
       immediate: true
     }
   },
+  mounted() {
+    this.$emit('mounted', 'table', this.$refs['table'])
+  },
   updated() {
     this.$refs['table']?.doLayout()
   },

+ 18 - 1
src/views/advancedQuery/views/advancedNew.vue

@@ -28,6 +28,10 @@
             class="btnAn"
             @click="dialogShow"
           >高级搜索</button>
+          <button
+            class="btnAn"
+            @click="exportHandler('table', '高级查询结果')"
+          >导出</button>
           <button
             class="btnAn"
             @click="toOldAdvance"
@@ -51,6 +55,7 @@
         :cell-class-name="cellClass"
         :formatter="tableFormatter"
         show-summary
+        @mounted="tableMountedHandler"
         @load="load"
         @cell-click="cellClickHandler"
       />
@@ -222,9 +227,9 @@
 import Search from '@/components/SearchWithTooltip'
 import SimpleTable from '@/components/SimpleTable'
 import Dialog from '@/layout/components/Dialog'
-import { mapGetters } from 'vuex'
 import { parseTime } from '@/utils/index'
 import { Query } from '@/api/dataIntegration'
+import { throttledExportToExcel } from '@/utils/table'
 
 const comparisonOperatorOptions = [
   {
@@ -922,6 +927,18 @@ export default {
         this.$message.error('失败')
       }
       this.loading = false
+    },
+    tableMountedHandler(refName, ref) {
+      this.$refs[refName] = ref
+    },
+    exportHandler(refName, tableName) {
+      if (!this.tableData.length) {
+        this.$message.info('无数据')
+        return
+      }
+      const table = this.$refs[refName].$el.cloneNode(true)
+      const fileName = `${tableName}.xlsx`
+      throttledExportToExcel(table, tableName, fileName)
     }
   }
 }

+ 1 - 1
src/views/statisticsCharts/views/flightClassification/flightClassificationStatisticsCharts.vue

@@ -3,7 +3,7 @@
     charts-title="航班量"
     :query-settings="querySettings"
     :categories="categories"
-    pie-title="航班数"
+    pie-title="航班数"
   />
 </template>
 

+ 1 - 1
src/views/statisticsCharts/views/flightClassification/passengerClassificationStatisticsCharts.vue

@@ -3,7 +3,7 @@
     charts-title="行李旅客量"
     :query-settings="querySettings"
     :categories="categories"
-    pie-title="旅客数"
+    pie-title="旅客数"
   />
 </template>