xyc
2026-10-22 1baf49e6553d94e9ceca2622ed1c965e7930c38e
traffic-audit-web/src/views/AuditResult.vue
@@ -10,37 +10,59 @@
          <el-menu-item index="/explain">企业解释</el-menu-item>
          <el-menu-item index="/audit">审核结果</el-menu-item>
          <el-menu-item index="/report">报表生成</el-menu-item>
          <el-submenu index="/special-stats">
            <template slot="title">专项统计</template>
            <el-menu-item index="/holiday-stat">节假日</el-menu-item>
          </el-submenu>
          <el-menu-item index="/rules">规则管理</el-menu-item>
          <el-menu-item index="/users">用户管理</el-menu-item>
</el-menu>
          <el-menu-item v-if="operatorIsAdmin" index="/system-config">系统配置</el-menu-item>
        </el-menu>
      </el-aside>
      <el-main :class="{ 'main-focus': focusMode }" style="display:flex;flex-direction:column;min-height:0">
        <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>
        <!-- 问题概览统计卡 -->
@@ -50,7 +72,8 @@
          <div class="sev-card sev-pending"><b>{{ severityStats.pending }}</b> 待处理</div>
          <div class="sev-card sev-done"><b>{{ severityStats.done }}</b> 已处理</div>
        </div>
        <el-form v-if="!focusMode" :inline="true" style="margin-top:8px;flex:none">
        <div v-if="!focusMode" class="audit-filter-bar">
        <el-form :inline="true">
          <el-form-item label="企业名称">
            <el-input v-model="enterpriseFilter" placeholder="输入企业名称关键字" clearable style="width:200px" @keyup.enter.native="queryResults"></el-input>
          </el-form-item>
@@ -59,24 +82,32 @@
              <el-option v-for="rn in ruleOptions" :key="rn" :label="rn" :value="rn"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="问题范围">
            <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">
              <el-option label="全部" value="all"></el-option>
              <el-option label="待处理" value="pending"></el-option>
              <el-option label="已处理" value="handled"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="视图">
            <el-radio-group v-model="viewMode">
              <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>
            <el-button size="small" plain @click="statsCollapsed = !statsCollapsed">{{ statsCollapsed ? '展开' : '收起' }}规则统计</el-button>
          </el-form-item>
          <el-form-item>
            <span style="color:#909399;font-size:12px">共 {{ results.length }} 条问题,{{ mergedResults.length }} 家企业</span>
            <span style="color:#303133;font-size:13px;font-weight:600">当前筛选 {{ filteredResults.length }} 条 / {{ mergedResults.length }} 家企业</span>
            <span style="color:#909399;font-size:12px;margin-left:8px">(共 {{ results.length }} 条问题)</span>
          </el-form-item>
        </el-form>
        </div>
        <div v-if="ruleStats.length && !statsCollapsed && !focusMode" class="rule-stats" style="flex:none">
          <div class="stats-cards">
            <div v-for="rs in sortedRuleStats" :key="rs.ruleId" class="stat-card"
@@ -98,45 +129,52 @@
          共 {{ results.length }} 条问题,{{ mergedResults.length }} 家企业
        </div>
        <div class="table-area" style="flex:1;min-height:0">
        <!-- 明细视图:一条问题一张卡片 -->
        <!-- 明细视图:一条问题一行(与导出模板 Sheet“审核结果”同款) -->
        <div v-if="viewMode === 'detail'" class="detail-cards-wrap" v-loading="loading">
          <div class="detail-toolbar">
            <el-checkbox :value="allSelected" :indeterminate="someSelected" @change="toggleSelectAll">全选当前 {{ filteredResults.length }} 条</el-checkbox>
            <span class="toolbar-tip">勾选后可批量确认 / 忽略</span>
          </div>
          <div v-for="row in filteredResults" :key="row.id" class="detail-card"
               :class="{ 'card-red': row.alertLevel === 'RED', 'card-yellow': row.alertLevel === 'YELLOW', 'card-done': row.status !== 'PENDING' }">
            <div class="card-head">
              <el-checkbox v-model="row._selected" @change="updateBatchSelection"></el-checkbox>
              <div class="card-ent">
                <div class="ent-name">{{ row.enterpriseName || row.city || '未知企业' }}</div>
                <div class="ent-sub">{{ row.reportPeriod }}</div>
              </div>
              <el-tag :type="row.alertLevel === 'RED' ? 'danger' : 'warning'" size="small" effect="dark">{{ row.alertLevel }}</el-tag>
              <el-tag :type="statusType(row.status)" size="small" effect="plain" class="status-tag">
                <i :class="statusIcon(row.status)"></i> {{ statusText(row.status) }}
              </el-tag>
              <span class="spacer"></span>
              <el-link v-if="dataType(reportType)" type="primary" :underline="false" size="mini" @click="openMonthReport(row)">数据</el-link>
              <el-button v-if="row.status === 'PENDING'" size="mini" type="success" icon="el-icon-check" round @click="review(row, 'CONFIRMED')">确认</el-button>
              <el-button v-if="row.status === 'PENDING'" size="mini" type="info" icon="el-icon-close" round plain @click="review(row, 'IGNORED')">忽略</el-button>
              <span v-else class="done-text">已处理</span>
          <el-table :data="filteredResults" border stripe height="100%"
            :header-cell-style="{ background: '#F5F7FA', color: '#303133', fontWeight: 600 }">
            <el-table-column width="40">
              <template slot-scope="{ row }">
                <el-checkbox v-model="row._selected" @change="updateBatchSelection"></el-checkbox>
              </template>
            </el-table-column>
            <el-table-column prop="reportPeriod" label="报表期" width="90"></el-table-column>
            <el-table-column label="企业/市州" min-width="200" show-overflow-tooltip>
              <template slot-scope="{ row }">{{ row.enterpriseName || row.city || '未知企业' }}</template>
            </el-table-column>
            <el-table-column prop="ruleCode" label="规则编码" width="100"></el-table-column>
            <el-table-column prop="ruleName" label="审核规则" min-width="150" show-overflow-tooltip></el-table-column>
            <el-table-column label="等级" width="76">
              <template slot-scope="{ row }">
                <el-tag :type="row.alertLevel === 'RED' ? 'danger' : 'warning'" size="mini">{{ row.alertLevel }}</el-tag>
              </template>
            </el-table-column>
            <el-table-column prop="actualValue" label="实际值" min-width="230" show-overflow-tooltip></el-table-column>
            <el-table-column prop="thresholdValue" label="阈值/基准" min-width="140" show-overflow-tooltip></el-table-column>
            <el-table-column prop="deviation" label="偏差说明" min-width="170" show-overflow-tooltip></el-table-column>
            <el-table-column label="状态" width="92">
              <template slot-scope="{ row }">
                <el-tag :type="statusType(row.status)" size="mini">
                  <i :class="statusIcon(row.status)"></i> {{ statusText(row.status) }}
                </el-tag>
              </template>
            </el-table-column>
            <el-table-column label="操作" width="185" align="right">
              <template slot-scope="{ row }">
                <el-link v-if="dataType(reportType)" type="primary" :underline="false" size="mini" @click="openMonthReport(row)">数据</el-link>
                <el-button v-if="row.status === 'PENDING'" size="mini" type="success" icon="el-icon-check" round @click="review(row, 'CONFIRMED')">确认</el-button>
                <el-button v-if="row.status === 'PENDING'" size="mini" type="info" icon="el-icon-close" round plain @click="review(row, 'IGNORED')">忽略</el-button>
                <span v-else class="done-text">已处理</span>
              </template>
            </el-table-column>
            <div slot="empty">
              <el-empty description="当前筛选条件下没有问题数据"></el-empty>
            </div>
            <div class="card-body">
              <div class="rule-title">
                <b>{{ row.ruleName }}</b>
                <span class="rule-code">{{ row.ruleCode }}</span>
              </div>
              <div class="card-details">
                <div class="detail-line"><span class="dt-label">实际</span><span class="dt-val">{{ row.actualValue }}</span></div>
                <div class="detail-line"><span class="dt-label">基准</span><span class="dt-val">{{ row.thresholdValue }}</span></div>
                <div class="detail-line"><span class="dt-label">差异</span><span class="dt-val dt-warn">{{ row.deviation }}</span></div>
              </div>
            </div>
          </div>
          <div v-if="!filteredResults.length" class="empty-tip">
            <el-empty description="当前筛选条件下没有问题数据"></el-empty>
          </div>
          </el-table>
        </div>
        <!-- 合并视图 -->
        <el-table v-else :data="mergedResults" border stripe v-loading="loading" height="100%"
@@ -147,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>
@@ -180,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">
@@ -228,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 = {
@@ -334,12 +385,42 @@
  data() {
    return {
      period: '', reportType: 'H2032', loading: false, marking: false, results: [], ruleStats: [], statsCollapsed: false,
      enterpriseFilter: '', ruleFilter: '', viewMode: 'merged', 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: '货运月报(H203-2)' }] },
        { key: 'passenger', name: '公路旅客', types: [{ value: 'H2031', label: '旅客月报(H203-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) })
@@ -347,7 +428,7 @@
    },
    severityStats() {
      const s = { red: 0, yellow: 0, pending: 0, done: 0 }
      this.results.forEach(r => {
      this.filteredResults.forEach(r => {
        if (r.alertLevel === 'RED') s.red++
        else if (r.alertLevel === 'YELLOW') s.yellow++
        if (r.status === 'PENDING') s.pending++
@@ -367,10 +448,14 @@
    filteredResults() {
      const kw = (this.enterpriseFilter || '').trim()
      const rule = this.ruleFilter
      if (!kw && !rule) return this.results
      const scope = this.issueScope || 'verify'
      const st = this.statusScope || 'all'
      return this.results.filter(r => {
        if (kw && !(r.enterpriseName || '').includes(kw)) return false
        if (rule && r.ruleName !== rule) return false
        if (scope === 'verify' && this.isReminderRow(r)) return false
        if (st === 'pending' && r.status !== 'PENDING') return false
        if (st === 'handled' && (!r.status || r.status === 'PENDING')) return false
        return true
      })
    },
@@ -392,11 +477,42 @@
        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)是季报:切到能耗时把报表期对齐到季度末月
    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: {
    isReminderRow(r) {
      return !!(r && r.ruleCode === 'RULE_004')
    },
    dataType(t) { return DATA_TYPE_MAP[t] || '' },
    explainType(t) { return EXPLAIN_TYPES.indexOf(t) >= 0 },
    openMonthReport(row) {
@@ -577,7 +693,26 @@
    },
    exportExcel() {
      if (!this.period) { this.$message.warning('请选择报表期'); return }
      window.open('/api/audit/export?period=' + this.period + '&reportType=' + this.reportType)
      const params = {
        period: this.period,
        reportType: this.reportType,
        onlyVerify: this.issueScope !== 'all',
        status: this.statusScope || 'all'
      }
      api.get('/audit/export', { params, responseType: 'blob' })
        .then(res => this.downloadBlob(res, '审核结果_' + this.period + '.xlsx'))
        .catch(() => this.$message.error('导出失败:请确认该报表期已有审核结果'))
    },
    downloadBlob(res, fileName) {
      const blob = res instanceof Blob ? res : new Blob([res], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' })
      const url = window.URL.createObjectURL(blob)
      const a = document.createElement('a')
      a.href = url
      a.download = fileName
      document.body.appendChild(a)
      a.click()
      window.URL.revokeObjectURL(url)
      document.body.removeChild(a)
    },
    review(row, status) {
      if (status === 'IGNORED') {
@@ -597,6 +732,25 @@
      api.post('/audit/review', fd, { timeout: 60000 })
        .then(() => { row.status = status; this.$message.success(status === 'CONFIRMED' ? '已确认' : '已忽略') })
        .catch(e => { if (e && e._toast) return; this.$message.error('操作失败') })
    },
    /** 组内条数文案:车辆级规则 1 条=1 台车;E008 是企业级(按企业汇总判一次),不能写"几台车" */
    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) {
@@ -741,4 +895,25 @@
.mr-sec-tab th { background: #F5F7FA; font-weight: 600; }
.mr-note { margin: 6px 12px 12px; background: #FDF6EC; border: 1px solid #FAECD8; border-radius: 4px; padding: 8px 10px; font-size: 12px; color: #8a6d3b; white-space: pre-wrap; word-break: break-all; }
.mr-note-line { margin: 2px 0; }
.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>