From 0d6de6b34d78061c725be6523df69fc7cf44401b Mon Sep 17 00:00:00 2001
From: zhizhijie <zhizhijie@users.noreply.gitee.com>
Date: 星期二, 08 九月 2026 09:48:21 +0800
Subject: [PATCH] feat: 汇总大表数据驱动 M1-货运——新增 FreightCalc 计算服务(B1 口径)与 7 月回归测试报告

---
 traffic-audit-web/src/views/DataImport.vue |  149 +++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 118 insertions(+), 31 deletions(-)

diff --git a/traffic-audit-web/src/views/DataImport.vue b/traffic-audit-web/src/views/DataImport.vue
index 3699071..a36ee76 100644
--- a/traffic-audit-web/src/views/DataImport.vue
+++ b/traffic-audit-web/src/views/DataImport.vue
@@ -1,4 +1,4 @@
-<template>
+SKIP/CHECK (0): TYPE_LABELS upper <template>
   <el-container direction="vertical">
     <app-header title="浜ら�氱粺璁℃姤琛ㄥ鏍哥郴缁� - 鏁版嵁瀵煎叆"></app-header>
     <el-container>
@@ -29,10 +29,10 @@
             <div class="card-head">閫夋嫨鏁版嵁绫诲瀷</div>
             <div class="module-tabs-head">
               <el-radio-group v-model="activeModule" size="small" @change="onModuleSwitch">
-                <el-radio-button v-for="g in groups" :key="g.key" :label="g.key">{{ g.name }}</el-radio-button>
+                <el-radio-button v-for="g in visibleGroups" :key="g.key" :label="g.key">{{ g.name }}</el-radio-button>
               </el-radio-group>
             </div>
-            <div v-for="g in groups" :key="g.key" v-show="activeModule === g.key" class="module-tab-pane">
+            <div v-for="g in visibleGroups" :key="g.key" v-show="activeModule === g.key" class="module-tab-pane">
               <div class="module-sel">
                                 <div class="module-sel-row">
                   <el-select v-model="moduleSel[g.key]" placeholder="閫夋嫨鏁版嵁绫诲瀷" style="width:260px"
@@ -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-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="!files[moduleSel[g.key]]"
-                               @click="importNow(g.key)">绔嬪嵆瀵煎叆</el-button>
+                    <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>
               </div>
@@ -107,7 +107,7 @@
                 </div>
                 <div v-if="!period" class="tip">璇峰厛鍦ㄤ笂鏂归�夋嫨鎶ヨ〃鏈�</div>
                 <div v-else class="overview-grid">
-                  <div class="ov-row" v-for="g in groups" :key="g.key">
+                  <div class="ov-row" v-for="g in visibleGroups" :key="g.key">
                     <div class="ov-group">{{ g.name }}</div>
                     <div class="ov-item" v-for="t in g.types" :key="t.value" :class="overviewState(t.value).cls">
                       <div class="ov-name">{{ t.label }}</div>
@@ -134,10 +134,11 @@
   investCityPassenger: '甯傚窞鍗曡〃锛堝杩愮珯鍦猴級', investCityLogistics: '甯傚窞鍗曡〃锛堢墿娴佸洯鍖猴級',
   'INVEST_瀹㈣繍绔欏満_CITY': '甯傚窞鍗曡〃锛堝杩愮珯鍦猴級', 'INVEST_鐗╂祦鍥尯_CITY': '甯傚窞鍗曡〃锛堢墿娴佸洯鍖猴級',
   cityBus: '鍩庡競鍏氦鏈堟姤', cityTaxi: '宸℃父鍑虹鏈堟姤', cityTaxiAuth: '鍑虹杞﹁繍鏀胯溅杈�',
+  wycTotal: '缃戠害杞︽�绘暟', wycOrder: '缃戠害杞﹁鍗曞強鍏ㄧ渷鎬婚噺',
   H2032: 'H203-2鏈堟姤', H2031: 'H203-1鏃呭鏈堟姤', H204: 'H204鑳借�楀鎶�', PASSENGER_AUTH: '鏃呭杩愭斂杞﹁締鏁�',
   PASSENGER_INDIVIDUAL: '涓綋瀹㈣繍閲�/鍛ㄨ浆閲�', ENERGY_AUTH: '鑳借�楄溅杈嗚繍鏀夸俊鎭�', TRANSPORT_AUTH: '杩愭斂杞﹁締',
   TRACK_MILEAGE: '杞ㄨ抗閲岀▼', SCALE_SPLIT: '瑙勪笂瑙勪笅鎷嗗垎', FREIGHT_TURNOVER: '璐ц繍閲忓懆杞噺',
-  INVEST_SYSTEM: '鎶曡祫绯荤粺瀵煎嚭', CITY_BUS: '鍩庡競鍏氦鏈堟姤', CITY_TAXI: '宸℃父鍑虹鏈堟姤', CITY_TAXI_AUTH: '鍑虹杞﹁繍鏀胯溅杈�'
+  INVEST_SYSTEM: '鎶曡祫绯荤粺瀵煎嚭', CITY_BUS: '鍩庡競鍏氦鏈堟姤', CITY_TAXI: '宸℃父鍑虹鏈堟姤', CITY_TAXI_AUTH: '鍑虹杞﹁繍鏀胯溅杈�', WYC_TOTAL: '缃戠害杞︽�绘暟', WYC_ORDER: '缃戠害杞﹁鍗曞強鍏ㄧ渷鎬婚噺'
 }
 const BATCH_TYPE_MAP = {
   H2032: 'h2032', TRANSPORT_AUTH: 'transportAuth', TRACK_MILEAGE: 'trackMileage',
@@ -145,6 +146,7 @@
   H2031: 'passengerMonthly', PASSENGER_AUTH: 'passengerAuth', PASSENGER_INDIVIDUAL: 'passengerIndividual',
   H204: 'energyMonthly', ENERGY_AUTH: 'energyAuth',
   CITY_BUS: 'cityBus', CITY_TAXI: 'cityTaxi', CITY_TAXI_AUTH: 'cityTaxiAuth',
+  WYC_TOTAL: 'wycTotal', WYC_ORDER: 'wycOrder',
   INVEST_SYSTEM: 'investmentSystem'
 }
 export default {
@@ -155,6 +157,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: '',
@@ -167,8 +170,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 +180,22 @@
         },
         {
           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: 'cityTaxiAuth', label: '鍑虹杞﹁繍鏀胯溅杈�' }
+            { value: 'cityBus', label: '鍩庡競鍏叡浜ら�氭湀搴﹁繍钀ユ儏鍐�' },
+            { value: 'cityTaxi', label: '宸℃父鍑虹姹借溅杩愯惀鏈嶅姟鎯呭喌鏈堟姤' },
+            { value: 'cityTaxiAuth', label: '鍑虹杞﹁繍鏀胯溅杈�' },
+            { value: 'wycTotal', label: '缃戠害杞︽�绘暟' },
+            { value: 'wycOrder', label: '缃戠害杞﹁鍗曞強鍏ㄧ渷鎬婚噺' }
           ]
         },
         {
-          key: 'invest', name: '鎶曡祫', types: [
+          key: 'invest', name: '绔欏満鎶曡祫', types: [
             { value: 'investment', label: '鎶曡祫鏈堟姤锛堝杩愮珯鍦猴級' },
             { value: 'investmentLogistics', label: '鎶曡祫鏈堟姤锛堢墿娴佸洯鍖猴級' },
             { value: 'investmentSystem', label: '鎶曡祫绯荤粺瀵煎嚭' },
@@ -199,15 +204,32 @@
           ]
         },
         {
-          key: 'energy', name: '鑳借��', types: [
-            { value: 'energyMonthly', label: 'H204鑳借�楀鎶�' },
+          key: 'energy', name: '璐ц繍鑳借�楀鎶�', types: [
+            { value: 'energyMonthly', label: '閬撹矾璐ц繍杞﹁締鑳芥簮娑堣�楁儏鍐�' },
             { value: 'energyAuth', label: '鑳借�楄溅杈嗚繍鏀夸俊鎭�' }
+          ]
+        },
+        {
+          key: 'annual', hidden: true, 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: '宸℃父鍑虹姹借溅杩愯緭鐢熶骇鎯呭喌' }
           ]
         }
       ]
     }
   },
   computed: {
+    // 骞存姤鏆備笉寮�鏀撅細闅愯棌鍏ュ彛锛堟暟鎹繚鐣欙紝鍚庣瀹炵幇鍚庡彲绉婚櫎 hidden锛�
+    visibleGroups() { return this.groups.filter(g => !g.hidden) },
     failBatches() { return this.batches.filter(b => b.failRows > 0) },
     failRowsFlat() {
       const out = []
@@ -240,7 +262,9 @@
         investCityLogistics: '鈥旓紙鎵归噺鎵弿鐩綍锛屾棤闇�妯℃澘锛�',
         cityBus: '瀵煎叆_鍩庡競鍏叡浜ら�氭湀搴﹁繍钀ユ儏鍐碉紙YYYY骞碝鏈堬級.xls/.xlsx锛堜紒涓氱骇鏄庣粏锛屽彇鍏叡姹界數杞﹀瓧娈碉級',
         cityTaxi: '瀵煎叆_宸℃父鍑虹姹借溅杩愯惀鏈嶅姟鎯呭喌鏈堟姤锛圷YYY骞碝鏈堬級.xls锛堝競宸炵骇17琛岋級',
-        cityTaxiAuth: '瀵煎叆妯℃澘_鍑虹杞︿俊鎭�(杩愭斂杞﹁締淇℃伅).xlsx锛堣溅杈嗙骇鏄庣粏锛岀敤浜庤繍钀ヨ溅鏁板姣旓級'
+        cityTaxiAuth: '瀵煎叆妯℃澘_鍑虹杞︿俊鎭�(杩愭斂杞﹁締淇℃伅).xlsx锛堣溅杈嗙骇鏄庣粏锛岀敤浜庤繍钀ヨ溅鏁板姣旓級',
+        wycTotal: '妯℃澘_缃戠害杞︽�绘暟.xlsx锛圓鍒�=鏈堜唤锛孊-E=鍏ㄧ渷瀹㈣繍閲�/鍩庡競鍐�/鍛ㄨ浆閲�/鍩庡競鍐呭懆杞噺锛�',
+        wycOrder: '妯℃澘_缃戠害杞﹁鍗曞強鍏ㄧ渷鎬婚噺.xlsx锛圓鍒�=鏈堜唤锛孊-E=鍏ㄧ渷pin锛孎=璁㈠崟鍚堣锛孏-W=17甯傚窞璁㈠崟锛�'
       }
       return map[this.importType] || ''
     },
@@ -256,9 +280,11 @@
         passengerIndividual: '鍏矾鏃呭/涓綋瀹㈣繍閲忔眹鎬�.xlsx',
         energyMonthly: '鑳借��/妯℃澘_閬撹矾璐ц繍杞﹁締鑳芥簮娑堣�楁儏鍐碉紙2026锛�.xlsx',
         energyAuth: '鑳借��/妯℃澘_鑳借�楄溅杈嗚繍鏀夸俊鎭�.xlsx',
-        cityBus: '鍩庡競瀹㈣繍/瀵煎叆妯℃澘_鍩庡競鍏氦.xlsx',
-        cityTaxi: '鍩庡競瀹㈣繍/瀵煎叆妯℃澘_宸℃父鍑虹.xlsx',
+        cityBus: '鍩庡競瀹㈣繍/鐢熸垚_鍩庡競鍏氦瀹㈣繍閲忓垎甯傚窞鏄庣粏.xlsx',
+        cityTaxi: '鍩庡競瀹㈣繍/鐢熸垚_宸℃父鍑虹瀹㈣繍閲忓垎甯傚窞鏄庣粏.xlsx',
         cityTaxiAuth: '鍩庡競瀹㈣繍/瀵煎叆妯℃澘_鍑虹杞︿俊鎭�(杩愭斂杞﹁締淇℃伅).xlsx',
+        wycTotal: '鍩庡競瀹㈣繍/妯℃澘_缃戠害杞︽�绘暟.xlsx',
+        wycOrder: '鍩庡競瀹㈣繍/妯℃澘_缃戠害杞﹁鍗曞強鍏ㄧ渷鎬婚噺.xlsx',
         investment: '鎶曡祫/杈撳叆/瀹㈣繍锛堝杩愮珯锛�/鏇存柊_7鏈堝杩愮珯鎶曡祫鏄庣粏琛紙甯傚窞姹囨�诲ぇ琛紝缁欓瀵硷級.xlsx',
         investmentLogistics: '鎶曡祫/杈撳叆/鐗╂祦锛堢墿娴佸洯鍖猴級/鏇存柊_7鏈堢墿娴佺珯鍦烘姇璧勬槑缁�.xls',
         investmentSystem: '鎶曡祫/妯℃澘_鏌ヨ缁撴灉(鎶曡祫绯荤粺-瀹㈣繍+鐗╂祦 2026.7).xls'
@@ -296,28 +322,42 @@
         investmentSystem: '/import/investmentSystem',
         cityBus: '/import/cityBus',
         cityTaxi: '/import/cityTaxi',
-        cityTaxiAuth: '/import/cityTaxiAuth'
+        cityTaxiAuth: '/import/cityTaxiAuth',
+        wycTotal: '/import/wycTotal',
+        wycOrder: '/import/wycOrder'
       }
       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
+      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)
+      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 (!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).finally(() => { this.importing = false })
+        return
+      }
+      const file = fileList[0]
       const g = this.groups.find(x => x.key === key)
       const t = g.types.find(x => x.value === type)
       const row = {
@@ -340,12 +380,59 @@
         this.importType = ''
         this.files[type] = null
         this.$delete(this.fileNames, type)
-      })
+      }).finally(() => { this.importing = false })
+    },
+    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 })
+      return 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