From 799ec6799ad9e994f7d369f059ca7682962f648f Mon Sep 17 00:00:00 2001
From: zhizhijie <zhizhijie@users.noreply.gitee.com>
Date: 星期三, 02 九月 2026 00:08:30 +0800
Subject: [PATCH] fix: 能耗导入同报表期并发重导互斥锁 + 空车牌(0)过滤 + 前端导入按钮防连点

---
 traffic-audit-web/src/views/DataImport.vue |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/traffic-audit-web/src/views/DataImport.vue b/traffic-audit-web/src/views/DataImport.vue
index 8e277e2..12d46de 100644
--- a/traffic-audit-web/src/views/DataImport.vue
+++ b/traffic-audit-web/src/views/DataImport.vue
@@ -56,9 +56,9 @@
                   <div class="file-btns">
                     <el-upload action="#" :auto-upload="false" :show-file-list="false" multiple accept=".xlsx,.xls,.et"
                                :ref="'up' + g.key" :on-change="f => onFilePicked(g.key, f)" style="display:inline-block">
-                      <el-button size="mini" type="primary" plain icon="el-icon-folder-opened">閫夋嫨鏂囦欢</el-button>
+                      <el-button size="mini" type="primary" plain icon="el-icon-folder-opened" :disabled="importing">閫夋嫨鏂囦欢</el-button>
                     </el-upload>
-                    <el-button size="mini" type="primary" icon="el-icon-upload2" :disabled="!fileCount(moduleSel[g.key])"
+                    <el-button size="mini" type="primary" icon="el-icon-upload2" :loading="importing" :disabled="importing || !fileCount(moduleSel[g.key])"
                                @click="importNow(g.key)">{{ fileCount(moduleSel[g.key]) > 1 ? '鎵归噺瀵煎叆 ' + fileCount(moduleSel[g.key]) + ' 涓枃浠�' : '绔嬪嵆瀵煎叆' }}</el-button>
                   </div>
                 </div>
@@ -155,6 +155,7 @@
       importType: 'h2032',
       period: (() => { const d = new Date(); return d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0') })(),
       cityDirLoading: false,
+      importing: false,
       sideOpen: false,
       result: '',
       error: '',
@@ -318,6 +319,7 @@
     onFilePicked(key, file) {
       const type = this.moduleSel[key]
       if (!type) return
+      if (this.importing) { this.$message.warning('姝e湪瀵煎叆涓紝璇风◢鍊欏啀閫夋嫨鏂囦欢'); return }
       const list = (this.files[type] || []).filter(f => f.name !== file.name)
       list.push(file.raw)
       this.$set(this.files, type, list)
@@ -336,12 +338,14 @@
       }
       const fileList = this.files[type] || []
       if (!fileList.length) { this.$message.warning('璇峰厛涓鸿绫诲瀷閫夋嫨鏂囦欢'); return }
+      if (!this.period) { this.$message.warning('璇峰厛閫夋嫨鎶ヨ〃鏈�'); return }
+      if (this.importing) { this.$message.warning('姝e湪瀵煎叆涓紝璇风◢鍊欌��'); return }
+      this.importing = true
       if (fileList.length > 1 || type === 'investment' || type === 'investmentLogistics') {
-        this.batchImport(type, key, fileList)
+        this.batchImport(type, key, fileList).finally(() => { this.importing = false })
         return
       }
       const file = fileList[0]
-      if (!this.period) { this.$message.warning('璇峰厛閫夋嫨鎶ヨ〃鏈�'); return }
       const g = this.groups.find(x => x.key === key)
       const t = g.types.find(x => x.value === type)
       const row = {
@@ -364,7 +368,7 @@
         this.importType = ''
         this.files[type] = null
         this.$delete(this.fileNames, type)
-      })
+      }).finally(() => { this.importing = false })
     },
     fileCount(type) { return (this.files[type] || []).length },
     fileNamesText(type) {
@@ -380,7 +384,7 @@
       const g = this.groups.find(x => x.key === key)
       const label = g ? g.name : type
       this.$message({ message: '姝e湪鎵归噺瀵煎叆 ' + fileList.length + ' 涓枃浠垛��', duration: 3000 })
-      api.post('/import/batch', fd, { timeout: 600000 })
+      return api.post('/import/batch', fd, { timeout: 600000 })
         .then(res => {
           const d = (res && res.data) || {}
           if (!d.files) {

--
Gitblit v1.9.1