| | |
| | | <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-menu-item index="/ledger-audit">事后核查</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> |
| | | <!-- 问题概览统计卡 --> |
| | |
| | | </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> |
| | |
| | | </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"> |
| | |
| | | <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> |
| | |
| | | <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> |
| | |
| | | </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"> |
| | |
| | | <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 = { |
| | |
| | | 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: '货运月报(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) }) |
| | |
| | | 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: { |
| | |
| | | }, |
| | | exportExcel() { |
| | | if (!this.period) { this.$message.warning('请选择报表期'); return } |
| | | const q = 'period=' + this.period + '&reportType=' + this.reportType + '&onlyVerify=' + (this.issueScope !== 'all') + '&status=' + (this.statusScope || 'all') |
| | | window.open('/api/audit/export?' + q) |
| | | 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') { |
| | |
| | | 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) { |
| | |
| | | .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> |