From fbc1c1590e7e81a550beb50c7cf65c663c7c5b41 Mon Sep 17 00:00:00 2001
From: zhizhijie <zhizhijie@users.noreply.gitee.com>
Date: 星期二, 01 九月 2026 16:42:06 +0800
Subject: [PATCH] 数据导入与报表生成多项改进

---
 traffic-audit-web/src/views/DataImport.vue |  109 +++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 90 insertions(+), 19 deletions(-)

diff --git a/traffic-audit-web/src/views/DataImport.vue b/traffic-audit-web/src/views/DataImport.vue
index 3699071..8e277e2 100644
--- a/traffic-audit-web/src/views/DataImport.vue
+++ b/traffic-audit-web/src/views/DataImport.vue
@@ -51,15 +51,15 @@
                   <el-button size="mini" type="primary" icon="el-icon-upload2" :loading="cityDirLoading"
                              @click="importCityDir(moduleSel[g.key])">浠庣洰褰曟壒閲忓鍏�</el-button>
                 </div>
-                <div v-else-if="moduleSel[g.key]" class="module-file">
-                  <div class="file-name" :title="fileNames[moduleSel[g.key]]">{{ fileNames[moduleSel[g.key]] || '鏈�夋嫨鏂囦欢' }}</div>
+                <div v-else-if="moduleSel[g.key] && !isDirOnlyType(moduleSel[g.key])" class="module-file">
+                  <div class="file-name" :title="fileNamesText(moduleSel[g.key])">{{ fileNamesText(moduleSel[g.key]) || '鏈�夋嫨鏂囦欢' }}</div>
                   <div class="file-btns">
-                    <el-upload action="#" :auto-upload="false" :show-file-list="false" accept=".xlsx,.xls"
+                    <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-upload>
-                    <el-button size="mini" type="primary" icon="el-icon-upload2" :disabled="!files[moduleSel[g.key]]"
-                               @click="importNow(g.key)">绔嬪嵆瀵煎叆</el-button>
+                    <el-button size="mini" type="primary" icon="el-icon-upload2" :disabled="!fileCount(moduleSel[g.key])"
+                               @click="importNow(g.key)">{{ fileCount(moduleSel[g.key]) > 1 ? '鎵归噺瀵煎叆 ' + fileCount(moduleSel[g.key]) + ' 涓枃浠�' : '绔嬪嵆瀵煎叆' }}</el-button>
                   </div>
                 </div>
               </div>
@@ -167,8 +167,8 @@
       overview: {},
       groups: [
         {
-          key: 'freight', name: '璐ц繍', types: [
-            { value: 'h2032', label: 'H203-2鏈堟姤' },
+          key: 'freight', name: '閬撹矾璐ц繍', types: [
+            { value: 'h2032', label: '閬撹矾璐х墿杩愯緭鏈堝害鐢熶骇鎯呭喌' },
             { value: 'transportAuth', label: '杩愭斂杞﹁締' },
             { value: 'trackMileage', label: '杞ㄨ抗閲岀▼' },
             { value: 'scaleSplit', label: '瑙勪笂瑙勪笅鎷嗗垎' },
@@ -177,20 +177,20 @@
         },
         {
           key: 'passenger', name: '鍏矾鏃呭', types: [
-            { value: 'passengerMonthly', label: 'H203-1鏃呭鏈堟姤' },
+            { value: 'passengerMonthly', label: '鍏矾鏃呭杩愯緭鏈堝害鐢熶骇鎯呭喌' },
             { value: 'passengerAuth', label: '杩愭斂杞﹁締鏁�' },
             { value: 'passengerIndividual', label: '涓綋瀹㈣繍閲�/鍛ㄨ浆閲�' }
           ]
         },
         {
           key: 'city', name: '鍩庡競瀹㈣繍', types: [
-            { value: 'cityBus', label: '鍩庡競鍏氦鏈堟姤' },
-            { value: 'cityTaxi', label: '宸℃父鍑虹鏈堟姤' },
+            { value: 'cityBus', label: '鍩庡競鍏叡浜ら�氭湀搴﹁繍钀ユ儏鍐�' },
+            { value: 'cityTaxi', label: '宸℃父鍑虹姹借溅杩愯惀鏈嶅姟鎯呭喌鏈堟姤' },
             { value: 'cityTaxiAuth', label: '鍑虹杞﹁繍鏀胯溅杈�' }
           ]
         },
         {
-          key: 'invest', name: '鎶曡祫', types: [
+          key: 'invest', name: '绔欏満鎶曡祫', types: [
             { value: 'investment', label: '鎶曡祫鏈堟姤锛堝杩愮珯鍦猴級' },
             { value: 'investmentLogistics', label: '鎶曡祫鏈堟姤锛堢墿娴佸洯鍖猴級' },
             { value: 'investmentSystem', label: '鎶曡祫绯荤粺瀵煎嚭' },
@@ -199,9 +199,24 @@
           ]
         },
         {
-          key: 'energy', name: '鑳借��', types: [
-            { value: 'energyMonthly', label: 'H204鑳借�楀鎶�' },
+          key: 'energy', name: '璐ц繍鑳借�楀鎶�', types: [
+            { value: 'energyMonthly', label: '閬撹矾璐ц繍杞﹁締鑳芥簮娑堣�楁儏鍐�' },
             { value: 'energyAuth', label: '鑳借�楄溅杈嗚繍鏀夸俊鎭�' }
+          ]
+        },
+        {
+          key: 'annual', name: '骞存姤', types: [
+            { value: 'annualCompanyBasic', label: '鍗曚綅鍩烘湰鎯呭喌' },
+            { value: 'annualEnterpriseFinance', label: '娉曚汉浼佷笟璐㈠姟鐘跺喌' },
+            { value: 'annualPassengerEnergy', label: '鍏矾鏃呭杩愯緭鑳芥簮娑堣�楁儏鍐�' },
+            { value: 'annualBusOperation', label: '鍏叡姹界數杞﹁繍钀ユ儏鍐�' },
+            { value: 'annualMetroVehicles', label: '鍩庡競杞ㄩ亾浜ら�氳溅杈嗗強绾胯矾鎯呭喌' },
+            { value: 'annualMetroStaff', label: '鍩庡競杞ㄩ亾浜ら�氫汉鍛樺強杩愯惀鎯呭喌' },
+            { value: 'annualFerry', label: '鍩庡競瀹㈣繍杞浮杩愯惀鎯呭喌' },
+            { value: 'annualPublicEnergy', label: '鍏叡浜ら�氳兘婧愭秷鑰楁儏鍐�' },
+            { value: 'annualCityInfrastructureOperators', label: '鍩庡競瀹㈣繍鍩虹璁炬柦鎯呭喌銆佸煄甯傚杩愮粡钀ヤ笟鎴锋儏鍐�' },
+            { value: 'annualTaxiOwnership', label: '宸℃父鍑虹姹借溅钀ヨ繍杞﹁締鎷ユ湁鎯呭喌' },
+            { value: 'annualTaxiProduction', label: '宸℃父鍑虹姹借溅杩愯緭鐢熶骇鎯呭喌' }
           ]
         }
       ]
@@ -301,22 +316,31 @@
       return map[t] || ''
     },
     onFilePicked(key, file) {
-      this.$set(this.files, this.moduleSel[key], file.raw)
-      this.$set(this.fileNames, this.moduleSel[key], file.name)
+      const type = this.moduleSel[key]
+      if (!type) return
+      const list = (this.files[type] || []).filter(f => f.name !== file.name)
+      list.push(file.raw)
+      this.$set(this.files, type, list)
+      this.$set(this.fileNames, type, list.map(f => f.name))
       const up = this.$refs['up' + key]
       if (up && up.clearFiles) up.clearFiles()
     },
     importNow(key) {
       const type = this.moduleSel[key]
       if (!type) return
-      if (this.isCityDirType(type)) {
+      if (this.isDirOnlyType(type)) {
         this.importCityDir(type)
         this.moduleSel[key] = ''
         this.importType = ''
         return
       }
-      const file = this.files[type]
-      if (!file) { this.$message.warning('璇峰厛涓鸿绫诲瀷閫夋嫨鏂囦欢'); return }
+      const fileList = this.files[type] || []
+      if (!fileList.length) { this.$message.warning('璇峰厛涓鸿绫诲瀷閫夋嫨鏂囦欢'); return }
+      if (fileList.length > 1 || type === 'investment' || type === 'investmentLogistics') {
+        this.batchImport(type, key, fileList)
+        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)
@@ -342,10 +366,57 @@
         this.$delete(this.fileNames, type)
       })
     },
+    fileCount(type) { return (this.files[type] || []).length },
+    fileNamesText(type) {
+      const list = this.fileNames[type] || []
+      return list.length ? '宸查�� ' + list.length + ' 涓枃浠讹細' + list.join('銆�') : ''
+    },
+    batchImport(type, key, fileList) {
+      if (!this.period) { this.$message.warning('璇峰厛閫夋嫨鎶ヨ〃鏈�'); return }
+      const fd = new FormData()
+      fd.append('type', type)
+      fd.append('period', this.period)
+      fileList.forEach(f => fd.append('files', f))
+      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 })
+        .then(res => {
+          const d = (res && res.data) || {}
+          if (!d.files) {
+            this.$message.error((res && res.message) || '鎵归噺瀵煎叆澶辫触')
+            return
+          }
+          const files = d.files || []
+          const errCount = files.filter(f => f.error || f.success === 0).length
+          const html = files.map(f =>
+            '<div style="margin:6px 0;line-height:1.6"><b>' + (f.fileName || '') + '</b>' +
+            (f.city ? '锛�' + f.city + '锛�' : '') + '锛氳В鏋� ' + (f.success || 0) + ' 鏉�' +
+            (f.error ? ' <span style="color:#F56C6C">' + f.error + '</span>' : '') + '</div>'
+          ).join('')
+          this.$alert(html, (label || type) + ' 鎵归噺瀵煎叆瀹屾垚锛氬叡 ' + d.total + ' 涓枃浠�' +
+            (d.fail > 0 ? '锛屽け璐� ' + d.fail + ' 鏉�' : '') + '锛堟垚鍔� ' + d.success + ' 鏉★級', {
+            dangerouslyUseHTMLString: true,
+            type: errCount > 0 ? 'warning' : 'success',
+            confirmButtonText: '鐭ラ亾浜�'
+          })
+          if (type === 'investment' || type === 'investmentLogistics') {
+            this.checkInvest(this.period)
+          }
+          this.afterImport()
+          this.files[type] = null
+          this.$delete(this.fileNames, type)
+        })
+        .catch(e => {
+          if (e && e._toast) return
+          this.$message.error((e.response && e.response.data && e.response.data.message) || '鎵归噺瀵煎叆澶辫触')
+        })
+    },
     isCityDirType(t) { return t === 'investCityPassenger' || t === 'investCityLogistics' },
+    isDirOnlyType(t) { return t === 'investCityPassenger' || t === 'investCityLogistics' },
     importCityDir(type) {
       if (!this.period) { this.$message.warning('璇峰厛閫夋嫨鎶ヨ〃鏈�'); return }
-      const category = type === 'investCityPassenger' ? '瀹㈣繍绔欏満' : '鐗╂祦鍥尯'
+      const category = (type === 'investCityPassenger' || type === 'investment') ? '瀹㈣繍绔欏満' : '鐗╂祦鍥尯'
       const fd = new FormData()
       fd.append('period', this.period)
       fd.append('category', category)

--
Gitblit v1.9.1