From d5ca840e64d444705a83df9e393c5df9e085feff Mon Sep 17 00:00:00 2001
From: xyc <jc_xiong@hotmail.com>
Date: 星期三, 11 十一月 2026 19:46:20 +0800
Subject: [PATCH] fix(城市客运): 优化出租车运政车辆导入解析性能

---
 traffic-audit-web/src/views/AuditResult.vue |  222 ++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 168 insertions(+), 54 deletions(-)

diff --git a/traffic-audit-web/src/views/AuditResult.vue b/traffic-audit-web/src/views/AuditResult.vue
index e3b218a..7bc3c73 100644
--- a/traffic-audit-web/src/views/AuditResult.vue
+++ b/traffic-audit-web/src/views/AuditResult.vue
@@ -23,29 +23,46 @@
         <h3 v-show="!focusMode" style="flex:none;margin:0 0 10px">瀹℃牳缁撴灉</h3>
         <el-form :inline="true" style="flex:none">
           <el-form-item label="鎶ヨ〃鏈�">
-            <el-date-picker v-model="period" type="month" placeholder="閫夋嫨鏈堜唤" value-format="yyyy-MM" @change="onPeriodChange"></el-date-picker>
+            <el-date-picker v-model="period" type="month" placeholder="閫夋嫨鏈堜唤" value-format="yyyy-MM"
+                            :picker-options="periodPickerOptions" @change="onPeriodChange"></el-date-picker>
           </el-form-item>
-          <el-form-item label="鎶ヨ〃绫诲瀷">
-            <el-radio-group v-model="reportType" @change="onTypeChange">
-              <el-radio label="H2032">璐ц繍鏈堟姤</el-radio>
-              <el-radio label="H2031">鏃呭鏈堟姤</el-radio>
-              <el-radio label="CITY_BUS">鍩庡競鍏氦鏈堟姤</el-radio>
-              <el-radio label="CITY_TAXI">宸℃父鍑虹鏈堟姤</el-radio>
-              <el-radio label="INVEST">鎶曡祫鏈堟姤</el-radio>
-              <el-radio label="H204">鑳借�楀鎶�</el-radio>
-            
-            
-            
-            </el-radio-group>
+          <el-form-item label="鏁版嵁绫诲瀷">
+            <el-select v-model="reportType" size="small" style="width:230px" filterable placeholder="閫夋嫨鏁版嵁绫诲瀷"
+                       popper-class="data-type-select" :title="reportTypeLabel" @change="onTypeChange">
+              <el-option-group v-for="g in auditTypeGroups" :key="g.key" :label="g.name">
+                <el-option v-for="t in g.types" :key="t.value" :label="t.label" :value="t.value"></el-option>
+              </el-option-group>
+            </el-select>
           </el-form-item>
 
           <el-form-item>
-            <el-button type="primary" @click="executeAudit" :loading="loading">鎵ц瀹℃牳</el-button>
-            <el-button type="success" plain @click="markAudited" :loading="marking">鏍囪宸插鏍�</el-button>
-            <el-button @click="queryResults">鏌ヨ缁撴灉</el-button>
-            <el-button type="success" icon="el-icon-download" @click="exportExcel">瀵煎嚭 Excel</el-button>
-            <el-button v-if="!focusMode" size="small" icon="el-icon-full-screen" @click="focusMode = true">鑱氱劍鏌ョ湅</el-button>
-            <el-button v-else type="primary" size="small" icon="el-icon-crop" @click="focusMode = false">閫�鍑鸿仛鐒�</el-button>
+            <el-button icon="el-icon-refresh" @click="queryResults">鍒锋柊缁撴灉</el-button>
+          </el-form-item>
+        </el-form>
+        <div v-if="periodHint" class="period-hint-line">{{ periodHint }}</div>
+        <!-- 鎿嶄綔鍗★細鎸夌敤閫斿垎缁勶紙甯冨眬鍙傝��"涓撻」缁熻-鑺傚亣鏃�"锛� -->
+        <el-card v-if="!focusMode" shadow="never" class="audit-ops-card" style="flex:none">
+          <div class="operation-row">
+            <div class="operation-item">
+              <span class="label">瀹℃牳</span>
+              <el-button type="primary" size="small" @click="executeAudit" :loading="loading">鎵ц瀹℃牳</el-button>
+              <el-button type="success" size="small" plain @click="markAudited" :loading="marking">鏍囪宸插鏍�</el-button>
+            </div>
+            <div class="operation-item">
+              <span class="label">缁撴灉</span>
+              <el-button type="success" size="small" icon="el-icon-download" @click="exportExcel">瀵煎嚭 Excel</el-button>
+              <el-button size="small" icon="el-icon-full-screen" @click="focusMode = true">鑱氱劍鏌ョ湅</el-button>
+            </div>
+            <div class="operation-item" v-if="viewMode === 'detail'">
+              <span class="label">鎵归噺</span>
+              <el-button size="small" type="success" :disabled="!batchPending.length" @click="reviewBatch('CONFIRMED')">鎵归噺纭({{ batchPending.length }})</el-button>
+              <el-button size="small" type="info" :disabled="!batchPending.length" @click="reviewBatch('IGNORED')">鎵归噺蹇界暐({{ batchPending.length }})</el-button>
+            </div>
+          </div>
+        </el-card>
+        <el-form v-else :inline="true" style="flex:none">
+          <el-form-item>
+            <el-button type="primary" size="small" icon="el-icon-crop" @click="focusMode = false">閫�鍑鸿仛鐒�</el-button>
           </el-form-item>
         </el-form>
         <!-- 闂姒傝缁熻鍗� -->
@@ -57,7 +74,6 @@
         </div>
         <div v-if="!focusMode" class="audit-filter-bar">
         <el-form :inline="true">
-          <el-form-item label="绛涢��"></el-form-item>
           <el-form-item label="浼佷笟鍚嶇О">
             <el-input v-model="enterpriseFilter" placeholder="杈撳叆浼佷笟鍚嶇О鍏抽敭瀛�" clearable style="width:200px" @keyup.enter.native="queryResults"></el-input>
           </el-form-item>
@@ -67,11 +83,7 @@
             </el-select>
           </el-form-item>
           <el-form-item label="闂鑼冨洿">
-            <el-radio-group v-model="issueScope" size="small" @change="updateBatchSelection">
-              <el-radio-button label="verify">浠呴渶鏍稿疄</el-radio-button>
-              <el-radio-button label="all">鍚彁閱掑瀷</el-radio-button>
-            </el-radio-group>
-            <span class="hint">鎻愰啋鍨嬩粎鎻愮ず鍙樺寲銆佷笉闇�澶勭悊锛屽鍑洪粯璁や笉鍚�</span>
+            <el-checkbox v-model="includeReminder" @change="updateBatchSelection">鍚彁閱掑瀷锛堜粎鎻愮ず鍙樺寲銆佷笉闇�澶勭悊锛屽鍑洪粯璁や笉鍚級</el-checkbox>
           </el-form-item>
           <el-form-item label="鐘舵��">
             <el-select v-model="statusScope" style="width:110px" @change="updateBatchSelection">
@@ -85,10 +97,6 @@
               <el-radio label="detail">鎸夋潯鏄庣粏</el-radio>
               <el-radio label="merged">鎸変紒涓氬悎骞�</el-radio>
             </el-radio-group>
-          </el-form-item>
-          <el-form-item v-if="viewMode === 'detail'">
-            <el-button size="small" type="success" :disabled="!batchPending.length" @click="reviewBatch('CONFIRMED')">鎵归噺纭({{ batchPending.length }})</el-button>
-            <el-button size="small" type="info" :disabled="!batchPending.length" @click="reviewBatch('IGNORED')">鎵归噺蹇界暐({{ batchPending.length }})</el-button>
           </el-form-item>
           <el-form-item>
             <el-button size="small" @click="clearFilters">娓呯┖杩囨护</el-button>
@@ -177,32 +185,32 @@
               <div style="color:#909399;font-size:12px;margin-top:2px">鍏� {{ scope.row.items.length }} 鏉¢棶棰�</div>
             </template>
           </el-table-column>
-          <el-table-column label="瀹℃牳闂鏄庣粏" min-width="520">
+          <el-table-column label="瀹℃牳闂鏄庣粏" min-width="640">
             <template slot-scope="scope">
-              <div v-for="(item, i) in scope.row.items" :key="item.id"
-                   style="padding:6px 0;border-bottom:1px dashed #EBEEF5"
-                   :class="{ 'no-border': i === scope.row.items.length - 1 }">
-                <div style="display:flex;align-items:center;flex-wrap:wrap;gap:6px">
-                  <b>{{ item.ruleName }}</b>
-                  <el-tag :type="item.alertLevel === 'RED' ? 'danger' : 'warning'" size="mini">{{ item.alertLevel }}</el-tag>
-                  <el-tag :type="statusType(item.status)" size="mini">{{ statusText(item.status) }}</el-tag>
-                  <el-link v-if="dataType(reportType)" type="primary" :underline="false" size="mini" @click="openMonthReport(item)">鏁版嵁</el-link>
+              <!-- 鍚屼竴浼佷笟鍐呭啀鎸�"瀹℃牳瑙勫垯"褰掑苟锛氬悓涓�瑙勫垯鐨勫鏉� = 璇ヤ紒涓氬鍙拌溅閮芥湁杩欎釜闂 -->
+              <div v-for="(gp, gi) in scope.row.groups" :key="gp.key" class="mr-group"
+                   :class="{ 'no-border': gi === scope.row.groups.length - 1 }">
+                <div class="mr-group-head">
+                  <b>{{ gp.ruleName }}</b>
+                  <span class="mr-code">{{ gp.ruleCode }}</span>
+                  <el-tag :type="gp.alertLevel === 'RED' ? 'danger' : 'warning'" size="mini">{{ gp.alertLevel }}</el-tag>
+                  <el-tag size="mini" type="info">{{ groupCountText(gp) }}</el-tag>
+                  <el-tag v-if="gp.pending > 0" size="mini" type="warning">{{ gp.pending }} 鍙板緟澶勭悊</el-tag>
+                  <el-tag v-else size="mini" type="success">宸插鐞�</el-tag>
+                  <el-link v-if="dataType(reportType)" type="primary" :underline="false" size="mini" @click="openMonthReport(gp.items[0])">鏁版嵁</el-link>
                   <span style="flex:1"></span>
-                  <el-button v-if="item.status === 'PENDING'" size="mini" type="success" @click="review(item, 'CONFIRMED')">纭</el-button>
-                  <el-button v-if="item.status === 'PENDING'" size="mini" type="info" @click="review(item, 'IGNORED')">蹇界暐</el-button>
+                  <el-button v-if="gp.pending > 0" size="mini" type="success" @click="reviewMany(gp.items, 'CONFIRMED')">{{ gp.items.length > 1 ? '鏈粍鍏ㄩ儴纭' : '纭' }}</el-button>
+                  <el-button v-if="gp.pending > 0" size="mini" type="info" @click="reviewMany(gp.items, 'IGNORED')">{{ gp.items.length > 1 ? '鏈粍鍏ㄩ儴蹇界暐' : '蹇界暐' }}</el-button>
                 </div>
-                <div style="color:#606266;font-size:12px;line-height:1.6;margin-top:2px">
-                  <span>瀹為檯锛歿{ item.actualValue }}</span>
-                  <span style="margin:0 8px">鍩哄噯锛歿{ item.thresholdValue }}</span>
-                  <span>宸紓锛歿{ item.deviation }}</span>
+                <div class="mr-items">
+                  <div v-for="item in gp.items" :key="item.id" class="mr-item">
+                    <el-tag :type="statusType(item.status)" size="mini">{{ statusText(item.status) }}</el-tag>
+                    <span>瀹為檯锛歿{ item.actualValue }}</span>
+                    <span class="mr-sep">鍩哄噯锛歿{ item.thresholdValue }}</span>
+                    <span>宸紓锛歿{ item.deviation }}</span>
+                  </div>
                 </div>
               </div>
-            </template>
-          </el-table-column>
-          <el-table-column label="鎿嶄綔" width="130">
-            <template slot-scope="scope">
-              <el-button v-if="hasPending(scope.row)" size="mini" type="success" plain @click="reviewAll(scope.row, 'CONFIRMED')">鍏ㄩ儴纭</el-button>
-              <el-button v-if="hasPending(scope.row)" size="mini" type="info" plain @click="reviewAll(scope.row, 'IGNORED')">鍏ㄩ儴蹇界暐</el-button>
             </template>
           </el-table-column>
         </el-table>
@@ -210,10 +218,17 @@
       </el-main>
     </el-container>
 
-        <el-dialog title="鏁版嵁鏌ョ湅锛堟湀鎶ユ牱寮忥級" :visible.sync="monthVisible" width="880px" top="4vh" custom-class="mr-dialog">
+        <el-dialog :title="monthConfig ? '鏁版嵁鏌ョ湅锛堟湀鎶ユ牱寮忥級' : '鏁版嵁鏌ョ湅'" :visible.sync="monthVisible" width="880px" top="4vh" custom-class="mr-dialog">
           <div v-if="monthLoading" style="padding:40px 0;text-align:center;color:#909399">鍔犺浇涓��</div>
           <div v-else-if="!monthRecords.length" style="padding:30px 0;text-align:center;color:#909399">
             鏈煡璇㈠埌璇ヤ紒涓氥�佽鎶ヨ〃鏈熺殑濉姤鏁版嵁锛堝彲鑳借繕鏈鍏ワ級
+          </div>
+          <!-- 娌℃湁涓撳睘"鏈堟姤鏍峰紡"閰嶇疆鐨勭被鍨嬶紙濡傝兘鑰楀鎶ワ級锛氱洿鎺ユ寜鎺ュ彛杩斿洖鐨勫垪娓叉煋琛ㄦ牸 -->
+          <div v-else-if="!monthConfig" class="mr-body" style="max-height:72vh;overflow:auto">
+            <el-table :data="monthRecords" border size="small" style="width:100%">
+              <el-table-column v-for="c in monthColumns" :key="c.prop" :prop="c.prop" :label="c.label"
+                               min-width="110" show-overflow-tooltip></el-table-column>
+            </el-table>
           </div>
           <div v-else class="mr-body">
             <div v-for="(rec, ri) in monthRecords" :key="ri" class="mr-card">
@@ -258,7 +273,13 @@
 <script>
 import AppHeader from '@/components/AppHeader.vue'
 import api from '@/api'
-const DATA_TYPE_MAP = { H2032: 'h2032', H2031: 'h2031', CITY_BUS: 'cityBus', CITY_TAXI: 'cityTaxi' }
+import { granularityOfReportType, disabledDateFor, granularityHint, snapPeriod } from '@/utils/periodGranularity'
+// 鎶ヨ〃绫诲瀷 -> 鏁版嵁鏌ョ湅閲岀殑鏁版嵁绫诲瀷锛�"鏁版嵁"閾炬帴鐐瑰紑鍚庣湅璇ヤ紒涓氳鏈熺殑濉姤鏁版嵁锛�
+// H204 璧�"杞﹁締鑳借�楀搴︽暟鎹�"锛堣兘鑰楁槑缁嗭級锛屼笌鍏跺畠绫诲瀷涓�鏍风湅鐨勬槸鏈被鍨嬭嚜宸辩殑鏁版嵁
+const DATA_TYPE_MAP = {
+  H2032: 'h2032', H2031: 'h2031', CITY_BUS: 'cityBus', CITY_TAXI: 'cityTaxi',
+  H204: 'energyVehicle'
+}
 const EXPLAIN_TYPES = ['H2032', 'H2031', 'CITY_BUS', 'CITY_TAXI']
 
 const MONTH_CFG = {
@@ -364,12 +385,42 @@
   data() {
     return {
       period: '', reportType: 'H2032', loading: false, marking: false, results: [], ruleStats: [], statsCollapsed: false,
-      enterpriseFilter: '', ruleFilter: '', viewMode: 'merged', issueScope: 'verify', statusScope: 'all', batchSelection: [], focusMode: false,
+      enterpriseFilter: '', ruleFilter: '', viewMode: 'merged', includeReminder: false, statusScope: 'all', batchSelection: [], focusMode: false,
       explainDrafts: {}, savingExplainId: null, expandedExplain: null,
       monthVisible: false, monthLoading: false, monthType: '', monthPeriod: '', monthKeyword: '', monthRecords: [], monthColumns: []
     }
   },
   computed: {
+    // 鎶ヨ〃绫诲瀷涓嬫媺锛堝垎缁勶紝浠�"鏁版嵁鏌ョ湅"鐨勫仛娉曪級
+    auditTypeGroups() {
+      return [
+        { key: 'freight', name: '閬撹矾璐ц繍', types: [{ value: 'H2032', label: '璐ц繍鏈堟姤锛圚203-2锛�' }] },
+        { key: 'passenger', name: '鍏矾鏃呭', types: [{ value: 'H2031', label: '鏃呭鏈堟姤锛圚203-1锛�' }] },
+        { key: 'city', name: '鍩庡競瀹㈣繍', types: [
+          { value: 'CITY_BUS', label: '鍩庡競鍏氦鏈堟姤' },
+          { value: 'CITY_TAXI', label: '宸℃父鍑虹鏈堟姤' }
+        ] },
+        { key: 'invest', name: '鎶曡祫', types: [{ value: 'INVEST', label: '鎶曡祫鏈堟姤' }] },
+        { key: 'energy', name: '璐ц繍鑳借�楀鎶�', types: [{ value: 'H204', label: '鑳借�楀鎶�' }] }
+      ]
+    },
+    // 褰撳墠鏁版嵁绫诲瀷鏄惁鏈�"鏈堟姤鏍峰紡"閰嶇疆锛堣兘鑰楃瓑娌℃湁 鈫� 鐢ㄩ�氱敤琛ㄦ牸娓叉煋锛�
+    monthConfig() { return MONTH_CFG[this.monthType] || null },
+    reportTypeLabel() {
+      for (const g of this.auditTypeGroups) {
+        const t = g.types.find(x => x.value === this.reportType)
+        if (t) return t.label
+      }
+      return this.reportType
+    },
+    // 闂鑼冨洿锛氫笉鍕�"鍚彁閱掑瀷"鏃剁瓑鍚屽師鏉ョ殑"浠呴渶鏍稿疄"锛堝鍑洪粯璁や笉鍚彁閱掑瀷锛�
+    issueScope() { return this.includeReminder ? 'all' : 'verify' },
+    periodGranularity() { return granularityOfReportType(this.reportType) },
+    periodPickerOptions() {
+      const d = disabledDateFor(this.periodGranularity)
+      return d ? { disabledDate: d } : {}
+    },
+    periodHint() { return granularityHint(this.periodGranularity) },
     ruleOptions() {
       const names = []
       this.results.forEach(r => { if (r.ruleName && names.indexOf(r.ruleName) < 0) names.push(r.ruleName) })
@@ -426,8 +477,36 @@
         map.get(key).push(r)
       })
       return Array.from(map.entries())
-        .map(([name, items]) => ({ enterpriseName: name, items }))
+        .map(([name, items]) => {
+          // 浼佷笟鍐呮寜瑙勫垯褰掑苟锛堝悓瑙勫垯澶氭潯锛濆鍙拌溅鍚屼竴闂锛�
+          const gmap = new Map()
+          items.forEach(it => {
+            const k = it.ruleCode || it.ruleName || '鏈煡瑙勫垯'
+            if (!gmap.has(k)) gmap.set(k, [])
+            gmap.get(k).push(it)
+          })
+          const groups = Array.from(gmap.entries()).map(([k, list]) => ({
+            key: k,
+            ruleName: list[0].ruleName,
+            ruleCode: list[0].ruleCode,
+            alertLevel: list[0].alertLevel,
+            items: list,
+            pending: list.filter(x => x.status === 'PENDING').length
+          })).sort((a, b) => b.items.length - a.items.length)
+          return { enterpriseName: name, items, groups }
+        })
         .sort((a, b) => b.items.length - a.items.length)
+    }
+  },
+  watch: {
+    // 鑳借�楋紙H204锛夋槸瀛f姤锛氬垏鍒拌兘鑰楁椂鎶婃姤琛ㄦ湡瀵归綈鍒板搴︽湯鏈�
+    periodGranularity() {
+      const snapped = snapPeriod(this.period, this.periodGranularity)
+      if (snapped && snapped !== this.period) {
+        this.period = snapped
+        const hint = granularityHint(this.periodGranularity)
+        if (hint) this.$message.warning(hint + '锛堝凡鑷姩璋冩暣涓� ' + snapped + '锛�')
+      }
     }
   },
   methods: {
@@ -654,6 +733,25 @@
         .then(() => { row.status = status; this.$message.success(status === 'CONFIRMED' ? '宸茬‘璁�' : '宸插拷鐣�') })
         .catch(e => { if (e && e._toast) return; this.$message.error('鎿嶄綔澶辫触') })
     },
+    /** 缁勫唴鏉℃暟鏂囨锛氳溅杈嗙骇瑙勫垯 1 鏉�=1 鍙拌溅锛汦008 鏄紒涓氱骇锛堟寜浼佷笟姹囨�诲垽涓�娆★級锛屼笉鑳藉啓"鍑犲彴杞�" */
+    groupCountText(gp) {
+      if (!gp) return ''
+      if (gp.ruleCode === 'RULE_E008') return '浼佷笟姹囨�� 1 鏉�'
+      return gp.items.length + ' 鍙拌溅'
+    },
+    /** 鍚堝苟瑙嗗浘閲�"涓�鏉¤鍒欎竴缁�"鐨勬壒閲忕‘璁�/蹇界暐 */
+    reviewMany(items, status) {
+      const list = (items || []).filter(x => x.status === 'PENDING')
+      if (!list.length) return
+      if (status === 'IGNORED') {
+        this.$prompt('璇疯緭鍏ュ拷鐣ュ師鍥狅紙搴旂敤浜庤缁� ' + list.length + ' 鏉★級', '蹇界暐闂', {
+          inputPlaceholder: '鍘熷洜锛堝彲閫夛級', inputType: 'textarea', confirmButtonText: '纭畾蹇界暐', cancelButtonText: '鍙栨秷'
+        }).then(({ value }) => this.doReviewBatch(list, status, (value || '').trim()))
+          .catch(() => {})
+      } else {
+        this.doReviewBatch(list, status)
+      }
+    },
     updateBatchSelection() { this.batchSelection = this.filteredResults.filter(r => r._selected) },
     toggleSelectAll(value) {
       this.filteredResults.forEach(r => { r._selected = value })
@@ -801,5 +899,21 @@
 .audit-filter-bar { background:#FAFAFA; border:1px solid #EBEEF5; border-radius:8px; padding:2px 12px 0; margin-top:8px; flex:none; }
 .audit-filter-bar .el-form-item { margin-bottom:6px; }
 .audit-filter-bar .el-form-item__label { color:#606266; font-weight:600; }
+.audit-ops-card { margin-bottom:8px; }
+.audit-ops-card .el-card__body { padding:10px 12px; }
+.operation-row { display:flex; flex-wrap:wrap; gap:28px; align-items:center; }
+.operation-item { display:flex; align-items:center; gap:8px; }
+.operation-item .label { color:#606266; font-weight:600; font-size:13px; }
+.mr-group { padding:8px 0; border-bottom:1px dashed #EBEEF5; }
+.mr-group.no-border { border-bottom:none; }
+.mr-group-head { display:flex; align-items:center; flex-wrap:wrap; gap:6px; }
+.mr-code { color:#909399; font-size:12px; }
+.mr-items { margin-top:4px; padding-left:10px; border-left:2px solid #EBEEF5; }
+.mr-item { color:#606266; font-size:12px; line-height:1.9; display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
+.mr-sep { color:#909399; }
+.period-hint-line { flex:none; margin:-4px 0 6px; color:#E6A23C; font-size:12px; }
+/* 鎿嶄綔鍒楋細涓や釜鎸夐挳涓婁笅鎺掑垪銆佺瓑瀹姐�佸眳涓紝琛屽唴鍨傜洿灞呬腑 */
+.row-ops { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:6px; }
+.row-ops .el-button { width:92px; margin:0 !important; }
 .hint { color:#909399; font-size:12px; margin-left:6px; white-space:nowrap; }
 </style>

--
Gitblit v1.9.1