From 2b39c4eb64b194e23f338873e4467eda2b18ccc3 Mon Sep 17 00:00:00 2001
From: zhizhijie <zhizhijie@users.noreply.gitee.com>
Date: 星期二, 22 九月 2026 11:28:56 +0800
Subject: [PATCH] feat(报表生成): 汇总大表导出结果落盘缓存,无新导入即秒回复用

---
 traffic-audit-web/src/views/AuditResult.vue |   28 +++++++++++++++++++++++-----
 1 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/traffic-audit-web/src/views/AuditResult.vue b/traffic-audit-web/src/views/AuditResult.vue
index 9a78adf..f1a2bfd 100644
--- a/traffic-audit-web/src/views/AuditResult.vue
+++ b/traffic-audit-web/src/views/AuditResult.vue
@@ -389,9 +389,6 @@
       const list = this.filteredResults
       return list.some(r => r._selected) && !this.allSelected
     },
-    isReminderRow(r) {
-      return !!(r && r.ruleCode === 'RULE_004')
-    },
     filteredResults() {
       const kw = (this.enterpriseFilter || '').trim()
       const rule = this.ruleFilter
@@ -429,6 +426,9 @@
     }
   },
   methods: {
+    isReminderRow(r) {
+      return !!(r && r.ruleCode === 'RULE_004')
+    },
     dataType(t) { return DATA_TYPE_MAP[t] || '' },
     explainType(t) { return EXPLAIN_TYPES.indexOf(t) >= 0 },
     openMonthReport(row) {
@@ -609,8 +609,26 @@
     },
     exportExcel() {
       if (!this.period) { this.$message.warning('璇烽�夋嫨鎶ヨ〃鏈�'); return }
-      const q = 'period=' + this.period + '&reportType=' + this.reportType + '&onlyVerify=' + (this.issueScope !== 'all') + '&status=' + (this.statusScope || 'all')
-      window.open('/api/audit/export?' + q)
+      const params = {
+        period: this.period,
+        reportType: this.reportType,
+        onlyVerify: this.issueScope !== 'all',
+        status: this.statusScope || 'all'
+      }
+      api.get('/audit/export', { params, responseType: 'blob' })
+        .then(res => this.downloadBlob(res, '瀹℃牳缁撴灉_' + this.period + '.xlsx'))
+        .catch(() => this.$message.error('瀵煎嚭澶辫触锛氳纭璇ユ姤琛ㄦ湡宸叉湁瀹℃牳缁撴灉'))
+    },
+    downloadBlob(res, fileName) {
+      const blob = res instanceof Blob ? res : new Blob([res], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' })
+      const url = window.URL.createObjectURL(blob)
+      const a = document.createElement('a')
+      a.href = url
+      a.download = fileName
+      document.body.appendChild(a)
+      a.click()
+      window.URL.revokeObjectURL(url)
+      document.body.removeChild(a)
     },
     review(row, status) {
       if (status === 'IGNORED') {

--
Gitblit v1.9.1