From 24b4c282a1e91143d66f1eeed2cabffa654c7c13 Mon Sep 17 00:00:00 2001
From: zhizhijie <zhizhijie@users.noreply.gitee.com>
Date: 星期三, 16 九月 2026 13:41:57 +0800
Subject: [PATCH] feat(h2031): 适配模板新增「统一社会信用代码/填报单位」两列并入库;fix(import): 补录 2023 年货运量周转量;fix(login/report): 验证码容错、预览指标对齐、弹窗可拖动圆角、失败提示细分;docs: 新增问题与注意事项汇总

---
 traffic-audit-web/src/views/ReportExport.vue |   59 ++++++++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 50 insertions(+), 9 deletions(-)

diff --git a/traffic-audit-web/src/views/ReportExport.vue b/traffic-audit-web/src/views/ReportExport.vue
index f313a49..12f42d0 100644
--- a/traffic-audit-web/src/views/ReportExport.vue
+++ b/traffic-audit-web/src/views/ReportExport.vue
@@ -99,7 +99,8 @@
             </div>
           </el-alert>
         </div>
-        <el-dialog :title="'棰勮鏁版嵁 - ' + previewModule + '锛�' + previewPeriod + '锛�'" :visible.sync="previewVisible" width="760px">
+        <el-dialog :title="'棰勮鏁版嵁 - ' + previewModule + '锛�' + previewPeriod + '锛�'" :visible.sync="previewVisible" width="760px"
+                   top="5vh" custom-class="pv-dialog" v-dialog-drag>
           <div class="preview-body">
             <div v-for="it in previewItems" :key="it.key" class="preview-item">
               <div class="preview-head">
@@ -114,7 +115,7 @@
               </div>
               <table class="preview-summary wb-table" v-if="it.key === 'summaryWorkbook' && it.summary && it.summary.length">
                 <thead>
-                  <tr><th style="width:44%">鎸囨爣</th><th style="width:30%">鏁版嵁</th><th>鍚屾瘮</th></tr>
+                  <tr><th style="width:12%">鍒嗙被</th><th style="width:40%">鎸囨爣</th><th style="width:28%">鏁版嵁</th><th>鍚屾瘮</th></tr>
                 </thead>
                 <tbody>
                   <template v-for="(sec, si) in wbRows(it.summary)">
@@ -388,7 +389,7 @@
           this.previewVisible = true
           this.loading = ''
         })
-        .catch(err => this.failWith(err))
+        .catch(err => this.failWith(err, '棰勮'))
     },
     fmtVal(v) {
       if (v === null || v === undefined || v === '') return '鈥�'
@@ -505,13 +506,45 @@
         })
         .catch(() => doExport())
     },
-    failWith(err) {
+    // 棰勮/瀵煎嚭澶辫触缁熶竴鎻愮ず锛氬尯鍒嗏�滆繛涓嶄笂鏈嶅姟鍣ㄢ�濅笌鈥滃悗绔繑鍥炵殑閿欒鍘熷洜鈥濄��
+    // 瀵煎嚭鎺ュ彛鐢� responseType: 'blob'锛屾姤閿欐椂 data 涔熸槸 Blob锛屽繀椤诲厛璇绘枃鏈啀瑙f瀽锛�
+    // 鍚﹀垯鎷夸笉鍒板悗绔湡瀹炲師鍥狅紝鍙細鏄剧ず绗肩粺鐨勨�滆纭宸插鍏ュ搴旀暟鎹�濄��
+    failWith(err, action) {
       if (err && err._toast) { this.loading = ''; return }
-      let msg = ''
-      const d = err && err.response && err.response.data
-      if (d && typeof d === 'object' && d.message) msg = d.message
-      this.$message.error('瀵煎嚭澶辫触锛�' + (msg || '璇风‘璁ゅ凡瀵煎叆瀵瑰簲鏁版嵁锛屾垨鏌ョ湅鍚庣鏃ュ織'))
-      this.loading = ''
+      const act = action || '瀵煎嚭'
+      const finish = (reason) => {
+        this.$message.error(act + '澶辫触锛�' + reason)
+        this.loading = ''
+      }
+      if (!err || !err.response) {
+        if (err && err.code === 'ECONNABORTED') { finish('璇锋眰瓒呮椂锛岃绋嶅悗閲嶈瘯'); return }
+        finish('鏃犳硶杩炴帴鏈嶅姟鍣紝璇锋鏌ョ綉缁滆繛鎺ワ紝鎴栫‘璁ゅ悗绔湇鍔℃槸鍚﹀凡鍚姩')
+        return
+      }
+      const d = err.response.data
+      const fallback = '璇风‘璁ゅ凡瀵煎叆瀵瑰簲鏁版嵁锛屾垨鏌ョ湅鍚庣鏃ュ織'
+      if (d && typeof d.text === 'function') {
+        Promise.resolve(d.text()).then(txt => finish(this.errReason(txt) || fallback)).catch(() => finish(fallback))
+        return
+      }
+      finish(this.errReason(typeof d === 'string' ? d : (d && d.message)) || fallback)
+    },
+    // 鍚庣寮傚父鍝嶅簲鍙兘鏄� JSON/HTML/绾枃鏈紝灏介噺鎻愬彇鍑哄彲璇荤殑鍘熷洜
+    errReason(raw) {
+      if (!raw) return ''
+      let text = String(raw).trim()
+      if (text.charAt(0) === '{' || text.charAt(0) === '[') {
+        try {
+          const j = JSON.parse(text)
+          if (j && j.message) return j.message
+        } catch (e) { /* 闈� JSON锛屾寜绾枃鏈鐞� */ }
+      }
+      text = text.replace(/<[^>]+>/g, ' ').replace(/\s+/g, ' ').trim()
+      // 寮�鍙戜唬鐞�/缃戠粶灞傛姤閿欒浆鎴愪汉璇濓紝閬垮厤鐩存帴鎶� ECONNREFUSED 涔嬬被鎶涚粰鐢ㄦ埛
+      if (/ECONNREFUSED|ECONNRESET|Proxy error|socket hang up|Network Error|Failed to fetch/i.test(text)) {
+        return '鏃犳硶杩炴帴鏈嶅姟鍣紝璇锋鏌ョ綉缁滆繛鎺ワ紝鎴栫‘璁ゅ悗绔湇鍔℃槸鍚﹀凡鍚姩'
+      }
+      return text.length > 200 ? text.slice(0, 200) + '鈥�' : text
     },
     downloadBlob(res, fileName) {
       const isZip = /\.zip$/.test(fileName)
@@ -579,3 +612,11 @@
 .wb-yoy.yoy-empty { color:#C0C4CC; }
 .wb-note { color:#E6A23C; font-size:12px; margin:2px 0 8px; }
 </style>
+
+<style>
+/* 棰勮鏁版嵁寮圭獥锛氬渾瑙� + 鍙�氳繃鏍囬鏍忔嫋鍔紙v-dialog-drag 鎸囦护锛夈��
+   涓嶈兘鍐欒繘 scoped锛歟l-dialog 榛樿 append-to-body锛孌OM 鎸傚湪 body 涓婏紝scoped 閫夋嫨鍣ㄥ尮閰嶄笉鍒般�� */
+.pv-dialog { border-radius: 10px; overflow: hidden; }
+.pv-dialog .el-dialog__header { cursor: move; user-select: none; -webkit-user-select: none; }
+.pv-dialog .el-dialog__headerbtn { cursor: pointer; }
+</style>
\ No newline at end of file

--
Gitblit v1.9.1