<template>
|
<el-container direction="vertical">
|
<app-header title="交通统计报表审核系统 - 规上货运台账核查"></app-header>
|
<el-container>
|
<el-aside width="200px">
|
<el-menu ref="sideMenu" router :default-active="$route.path" @select="onMenuSelect">
|
<el-menu-item index="/dashboard">工作台</el-menu-item>
|
<el-menu-item index="/import">数据导入</el-menu-item>
|
<el-menu-item index="/data">数据查看</el-menu-item>
|
<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-item v-if="operatorIsAdmin" index="/system-config">系统配置</el-menu-item>
|
</el-menu>
|
</el-aside>
|
|
<el-main>
|
<div class="page-scroll">
|
<div class="page-title-row">
|
<div>
|
<h3>规上货运台账核查</h3>
|
<div class="subline">月报、运政车辆与运单明细交叉核对</div>
|
</div>
|
<el-tag :type="mapConfigured ? 'success' : 'info'" size="small">
|
{{ mapLabel }}
|
</el-tag>
|
</div>
|
|
<div v-if="mapProvider && !mapConfigured" class="map-banner">
|
<i class="el-icon-warning-outline"></i>
|
<span>地图里程是核查必选项。{{ mapProvider.message }}。地图服务未就绪时不能发起核查。</span>
|
</div>
|
|
<section class="check-panel">
|
<div class="mode-row">
|
<el-radio-group v-model="mode" size="small" @change="onModeChange">
|
<el-radio-button label="single">单个运单文件</el-radio-button>
|
<el-radio-button label="batch">文件夹批量</el-radio-button>
|
</el-radio-group>
|
</div>
|
|
<el-form :inline="true" class="selector-form" label-position="top">
|
<el-form-item label="报表期">
|
<el-date-picker v-model="period" type="month" value-format="yyyy-MM" placeholder="选择报表期"
|
style="width:180px" @change="onPeriodChange"></el-date-picker>
|
</el-form-item>
|
<el-form-item v-if="mode === 'single'" label="市州">
|
<el-select v-model="city" filterable placeholder="选择市州" style="width:180px"
|
@change="onCityChange">
|
<el-option v-for="item in cities" :key="item" :label="item" :value="item"></el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item v-if="mode === 'single'" label="企业数据库全称">
|
<el-select v-model="enterpriseName" filterable remote clearable
|
:remote-method="filterEnterprises" :loading="enterpriseLoading"
|
placeholder="选择市州和报表期后加载" style="width:360px" :disabled="!city || !period">
|
<el-option v-for="item in enterpriseOptions" :key="item.enterpriseName"
|
:label="item.enterpriseName" :value="item.enterpriseName">
|
<span class="option-main">{{ item.enterpriseName }}</span>
|
<span class="option-meta">{{ item.regionCode }} · 车辆 {{ item.vehicleTotal || 0 }}</span>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item v-if="mode === 'single'" label="原始运单文件">
|
<el-upload action="#" :auto-upload="false" :show-file-list="false" accept=".xls,.xlsx,.xlsm"
|
:on-change="onSingleFilePicked">
|
<el-button icon="el-icon-folder-opened">选择文件</el-button>
|
</el-upload>
|
<div class="picked-file" :title="singleFile ? singleFile.name : ''">
|
{{ singleFile ? singleFile.name : '未选择文件' }}
|
</div>
|
</el-form-item>
|
<el-form-item v-if="mode === 'batch'" label="运单文件夹">
|
<el-button icon="el-icon-folder-opened" @click="pickFolder">选择文件夹</el-button>
|
<div class="picked-file">{{ batchFiles.length ? '已选择 ' + batchFiles.length + ' 个运单文件' : '未选择文件夹' }}</div>
|
<input ref="folderInput" type="file" webkitdirectory directory multiple
|
accept=".xls,.xlsx,.xlsm" class="hidden-input" @change="onFolderPicked">
|
</el-form-item>
|
<el-form-item label="操作">
|
<el-button type="primary" icon="el-icon-search" :loading="checking" :disabled="!canCheck"
|
@click="runCheck">检查</el-button>
|
<el-button v-if="currentResult || batchResult" icon="el-icon-refresh" @click="clearResults">清空结果</el-button>
|
</el-form-item>
|
</el-form>
|
|
<div v-if="mode === 'batch' && batchFiles.length" class="batch-file-strip">
|
<span v-for="name in batchPreview" :key="name" class="file-chip">{{ name }}</span>
|
<span v-if="batchFiles.length > batchPreview.length" class="more-chip">+{{ batchFiles.length - batchPreview.length }}</span>
|
</div>
|
</section>
|
|
<section v-if="batchResult" class="result-band">
|
<div class="band-head">
|
<div class="band-title">批量核查结果</div>
|
<div class="band-actions">
|
<span class="result-meta">{{ batchResult.reportPeriod }} · {{ batchResult.checkedAt | dateTime }}</span>
|
<el-button size="mini" icon="el-icon-download" @click="exportBatchCsv">导出汇总</el-button>
|
</div>
|
</div>
|
<div class="metric-grid">
|
<div class="metric"><span>文件总数</span><b>{{ batchResult.totalCount }}</b></div>
|
<div class="metric ok"><span>核查完成</span><b>{{ batchResult.successCount }}</b></div>
|
<div class="metric bad"><span>核查失败</span><b>{{ batchResult.failCount }}</b></div>
|
<div class="metric ok"><span>地图完整覆盖</span><b>{{ batchResult.completeCount }}</b></div>
|
<div class="metric"><span>地图覆盖不完整</span><b>{{ batchResult.incompleteCount }}</b></div>
|
<div class="metric bad"><span>多报周转量</span><b>{{ fmt(batchTotals.overreported) }}</b><small>吨公里</small></div>
|
<div class="metric"><span>错误项</span><b>{{ batchTotals.errors }}</b></div>
|
<div class="metric"><span>待核实</span><b>{{ batchTotals.warnings }}</b></div>
|
<div class="metric"><span>无法核查</span><b>{{ batchTotals.unable }}</b></div>
|
</div>
|
<el-table :data="batchResult.items" border size="small" max-height="360"
|
:row-class-name="batchRowClass" @row-click="openBatchItem">
|
<el-table-column prop="fileName" label="文件名" min-width="280" show-overflow-tooltip></el-table-column>
|
<el-table-column prop="enterpriseName" label="识别企业" min-width="270" show-overflow-tooltip></el-table-column>
|
<el-table-column label="状态" width="100">
|
<template slot-scope="s">
|
<el-tag :type="batchStatusType(s.row.status)" size="mini">
|
{{ batchStatusText(s.row.status) }}
|
</el-tag>
|
</template>
|
</el-table-column>
|
<el-table-column label="多报周转量" width="130" align="right">
|
<template slot-scope="s">{{ s.row.result ? fmt(s.row.result.ledger.overreportedTurnoverTotal) : '—' }}</template>
|
</el-table-column>
|
<el-table-column label="错误" width="76" align="center">
|
<template slot-scope="s">{{ s.row.result ? s.row.result.errorCount : '—' }}</template>
|
</el-table-column>
|
<el-table-column label="待核实" width="82" align="center">
|
<template slot-scope="s">{{ s.row.result ? s.row.result.warningCount : '—' }}</template>
|
</el-table-column>
|
<el-table-column label="无法核查" width="88" align="center">
|
<template slot-scope="s">{{ s.row.result ? s.row.result.unableCount : '—' }}</template>
|
</el-table-column>
|
<el-table-column prop="message" label="说明" min-width="260" show-overflow-tooltip></el-table-column>
|
<el-table-column label="" width="70" align="right">
|
<template slot-scope="s">
|
<el-button v-if="s.row.result" type="text" size="mini">查看</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
</section>
|
|
<section v-if="currentResult" class="result-band">
|
<div class="band-head">
|
<div>
|
<div class="band-title">{{ currentResult.enterpriseName }}</div>
|
<div class="result-meta">{{ currentResult.city }} · {{ currentResult.reportPeriod }} · {{ currentResult.fileName }}</div>
|
</div>
|
<div class="severity-summary">
|
<span class="sev error">错误 {{ currentResult.errorCount }}</span>
|
<span class="sev warning">待核实 {{ currentResult.warningCount }}</span>
|
<span class="sev unable">无法核查 {{ currentResult.unableCount }}</span>
|
</div>
|
</div>
|
|
<div class="metric-grid">
|
<div class="metric"><span>运单行数</span><b>{{ currentResult.ledger.rowCount }}</b></div>
|
<div class="metric"><span>湖北籍主车</span><b>{{ currentResult.ledger.hubeiVehicleCount }}</b></div>
|
<div class="metric"><span>台账货运量</span><b>{{ fmt(currentResult.ledger.freightTotal) }}</b><small>吨</small></div>
|
<div class="metric"><span>月报货运量</span><b>{{ fmt(currentResult.monthlyReport.freightTotal) }}</b><small>吨</small></div>
|
<div class="metric"><span>台账周转量</span><b>{{ fmt(currentResult.ledger.turnoverTotal) }}</b><small>吨公里</small></div>
|
<div class="metric"><span>月报周转量</span><b>{{ fmt(currentResult.monthlyReport.turnoverTotal) }}</b><small>吨公里</small></div>
|
<div class="metric"><span>运政牵引车+其他</span><b>{{ fmt(currentResult.authVehicles.comparableCount) }}</b><small>台</small></div>
|
<div class="metric"><span>地图已核路线</span><b>{{ currentResult.ledger.routeMeasuredCount }}</b><small>/ 无法 {{ currentResult.ledger.routeUnableCount }}</small></div>
|
<div class="metric"><span>地图核查行数</span><b>{{ currentResult.ledger.routeMeasuredRowCount }}</b><small>/ {{ currentResult.ledger.routeRowCount }}</small></div>
|
<div class="metric"><span>地图测算周转量</span><b>{{ fmt(currentResult.ledger.mapTurnoverTotal) }}</b><small>吨公里</small></div>
|
<div class="metric"><span>地图测算周转量×1.3</span><b>{{ fmt(currentResult.ledger.allowedMapTurnoverTotal) }}</b><small>吨公里</small></div>
|
<div class="metric bad"><span>应核减多报周转量</span><b>{{ fmt(currentResult.ledger.overreportedTurnoverTotal) }}</b><small>吨公里</small></div>
|
<div class="metric"><span>未完成地图核查量</span><b>{{ fmt(currentResult.ledger.unmeasuredTurnoverTotal) }}</b><small>吨公里</small></div>
|
</div>
|
|
<div v-if="!currentResult.auditComplete" class="incomplete-banner">
|
<i class="el-icon-warning-outline"></i>
|
<span>地图里程未覆盖全部运单行,本结果不能作为完整的多报周转量核减结论。未完成核查的申报周转量为 {{ fmt(currentResult.ledger.unmeasuredTurnoverTotal) }} 吨公里。</span>
|
</div>
|
|
<div class="section-title">规则结果</div>
|
<el-table :data="currentResult.rules" border size="small" class="rule-table">
|
<el-table-column prop="ruleCode" label="编码" width="78"></el-table-column>
|
<el-table-column prop="ruleName" label="核查项" min-width="190"></el-table-column>
|
<el-table-column label="结论" width="100">
|
<template slot-scope="s">
|
<el-tag :type="ruleTagType(s.row.status)" size="mini">{{ ruleStatusText(s.row.status) }}</el-tag>
|
</template>
|
</el-table-column>
|
<el-table-column prop="checkedCount" label="核查数" width="80" align="right"></el-table-column>
|
<el-table-column prop="issueCount" label="问题数" width="80" align="right"></el-table-column>
|
<el-table-column prop="message" label="说明" min-width="230"></el-table-column>
|
</el-table>
|
|
<div class="issue-head">
|
<div class="section-title">问题明细</div>
|
<div class="issue-filters">
|
<el-select v-model="severityFilter" size="small" style="width:120px">
|
<el-option label="全部等级" value=""></el-option>
|
<el-option label="错误" value="ERROR"></el-option>
|
<el-option label="待核实" value="WARNING"></el-option>
|
<el-option label="无法核查" value="UNABLE"></el-option>
|
</el-select>
|
<el-select v-model="ruleFilter" size="small" clearable placeholder="全部规则" style="width:190px">
|
<el-option v-for="r in issueRuleOptions" :key="r.code" :label="r.name" :value="r.code"></el-option>
|
</el-select>
|
<span class="filter-count">{{ filteredIssues.length }} / {{ currentResult.issues.length }}</span>
|
</div>
|
</div>
|
<el-table :data="filteredIssues" border size="small" max-height="520"
|
:row-class-name="issueRowClass">
|
<el-table-column label="等级" width="86">
|
<template slot-scope="s">
|
<el-tag :type="issueTagType(s.row.severity)" size="mini">{{ severityText(s.row.severity) }}</el-tag>
|
</template>
|
</el-table-column>
|
<el-table-column prop="ruleCode" label="规则" width="72"></el-table-column>
|
<el-table-column label="位置" width="120">
|
<template slot-scope="s">{{ locationText(s.row) }}</template>
|
</el-table-column>
|
<el-table-column prop="vehiclePlate" label="主车" width="110"></el-table-column>
|
<el-table-column prop="fieldName" label="字段" width="140" show-overflow-tooltip></el-table-column>
|
<el-table-column prop="actualValue" label="实际值" min-width="130" show-overflow-tooltip></el-table-column>
|
<el-table-column prop="expectedValue" label="基准值" min-width="130" show-overflow-tooltip></el-table-column>
|
<el-table-column prop="difference" label="差额" width="100"></el-table-column>
|
<el-table-column label="核减多报周转量" width="145" align="right">
|
<template slot-scope="s">{{ fmt(s.row.impactTurnover) }}</template>
|
</el-table-column>
|
<el-table-column prop="message" label="说明" min-width="300" show-overflow-tooltip></el-table-column>
|
<el-table-column prop="suggestion" label="处理建议" min-width="260" show-overflow-tooltip></el-table-column>
|
<div slot="empty" class="empty-line">
|
{{ currentResult.truncated ? '问题明细超过上限,仅显示前 ' + currentResult.issues.length + ' 条' : '当前筛选条件下无问题明细' }}
|
</div>
|
</el-table>
|
<div class="disclaimer">{{ currentResult.disclaimer }}</div>
|
</section>
|
</div>
|
</el-main>
|
</el-container>
|
|
<el-dialog :title="batchDialogTitle" :visible.sync="batchDialogVisible" width="94%" top="3vh"
|
append-to-body custom-class="ledger-result-dialog" @closed="batchSelected = null">
|
<div v-if="batchSelected && batchSelected.result" class="dialog-result">
|
<div class="dialog-meta">
|
<span>{{ batchSelected.result.fileName }}</span>
|
<span>{{ batchSelected.result.city }} · {{ batchSelected.result.reportPeriod }}</span>
|
</div>
|
<div class="severity-summary">
|
<span class="sev error">错误 {{ batchSelected.result.errorCount }}</span>
|
<span class="sev warning">待核实 {{ batchSelected.result.warningCount }}</span>
|
<span class="sev unable">无法核查 {{ batchSelected.result.unableCount }}</span>
|
<span class="sev error">应核减 {{ fmt(batchSelected.result.ledger.overreportedTurnoverTotal) }} 吨公里</span>
|
</div>
|
<el-table :data="batchSelected.result.rules" border size="small" max-height="240">
|
<el-table-column prop="ruleCode" label="编码" width="78"></el-table-column>
|
<el-table-column prop="ruleName" label="核查项" min-width="190"></el-table-column>
|
<el-table-column label="结论" width="100">
|
<template slot-scope="s"><el-tag :type="ruleTagType(s.row.status)" size="mini">{{ ruleStatusText(s.row.status) }}</el-tag></template>
|
</el-table-column>
|
<el-table-column prop="issueCount" label="问题" width="70" align="right"></el-table-column>
|
<el-table-column prop="message" label="说明" min-width="220"></el-table-column>
|
</el-table>
|
<el-table :data="batchSelected.result.issues" border size="small" max-height="500" style="margin-top:10px">
|
<el-table-column label="等级" width="86">
|
<template slot-scope="s"><el-tag :type="issueTagType(s.row.severity)" size="mini">{{ severityText(s.row.severity) }}</el-tag></template>
|
</el-table-column>
|
<el-table-column prop="ruleCode" label="规则" width="72"></el-table-column>
|
<el-table-column label="位置" width="120">
|
<template slot-scope="s">{{ locationText(s.row) }}</template>
|
</el-table-column>
|
<el-table-column prop="vehiclePlate" label="主车" width="110"></el-table-column>
|
<el-table-column prop="fieldName" label="字段" width="140" show-overflow-tooltip></el-table-column>
|
<el-table-column prop="actualValue" label="实际值" min-width="120" show-overflow-tooltip></el-table-column>
|
<el-table-column prop="expectedValue" label="基准值" min-width="120" show-overflow-tooltip></el-table-column>
|
<el-table-column label="核减周转量" width="130" align="right">
|
<template slot-scope="s">{{ fmt(s.row.impactTurnover) }}</template>
|
</el-table-column>
|
<el-table-column prop="message" label="说明" min-width="280" show-overflow-tooltip></el-table-column>
|
<el-table-column prop="suggestion" label="处理建议" min-width="240" show-overflow-tooltip></el-table-column>
|
</el-table>
|
<div class="disclaimer">{{ batchSelected.result.disclaimer }}</div>
|
</div>
|
</el-dialog>
|
</el-container>
|
</template>
|
|
<script>
|
import AppHeader from '@/components/AppHeader.vue'
|
import api from '@/api'
|
|
export default {
|
components: { AppHeader },
|
name: 'LedgerAudit',
|
filters: {
|
dateTime(value) {
|
if (!value) return ''
|
return String(value).replace('T', ' ').slice(0, 19)
|
}
|
},
|
data() {
|
return {
|
mode: 'single',
|
cities: [],
|
city: '',
|
period: '',
|
enterpriseName: '',
|
enterpriseOptions: [],
|
enterpriseAll: [],
|
enterpriseLoading: false,
|
singleFile: null,
|
batchFiles: [],
|
checking: false,
|
currentResult: null,
|
batchResult: null,
|
batchSelected: null,
|
batchDialogVisible: false,
|
severityFilter: '',
|
ruleFilter: '',
|
mapProvider: null,
|
mapRequired: true
|
}
|
},
|
computed: {
|
mapConfigured() {
|
return !!(this.mapProvider && this.mapProvider.configured)
|
},
|
mapLabel() {
|
if (!this.mapProvider) return '地图服务未加载'
|
return this.mapProvider.label || this.mapProvider.code || '地图服务'
|
},
|
canCheck() {
|
if (!this.period || this.checking) return false
|
if (this.mapRequired && !this.mapConfigured) return false
|
if (this.mode === 'single') return !!(this.city && this.enterpriseName && this.singleFile)
|
return this.batchFiles.length > 0
|
},
|
batchPreview() {
|
return this.batchFiles.slice(0, 8).map(f => f.name)
|
},
|
filteredIssues() {
|
if (!this.currentResult) return []
|
return this.currentResult.issues.filter(i =>
|
(!this.severityFilter || i.severity === this.severityFilter) &&
|
(!this.ruleFilter || i.ruleCode === this.ruleFilter)
|
)
|
},
|
issueRuleOptions() {
|
if (!this.currentResult) return []
|
const map = {}
|
this.currentResult.issues.forEach(i => { map[i.ruleCode] = i.ruleName })
|
return Object.keys(map).map(code => ({ code, name: map[code] }))
|
},
|
batchTotals() {
|
const total = { errors: 0, warnings: 0, unable: 0, overreported: 0 }
|
if (!this.batchResult) return total
|
this.batchResult.items.forEach(i => {
|
if (!i.result) return
|
total.errors += i.result.errorCount || 0
|
total.warnings += i.result.warningCount || 0
|
total.unable += i.result.unableCount || 0
|
total.overreported += Number((i.result.ledger && i.result.ledger.overreportedTurnoverTotal) || 0)
|
})
|
return total
|
},
|
batchDialogTitle() {
|
return this.batchSelected ? this.batchSelected.enterpriseName : '批量核查明细'
|
}
|
},
|
mounted() {
|
this.loadMetadata()
|
},
|
methods: {
|
loadMetadata() {
|
api.get('/ledger-audit/metadata')
|
.then(res => {
|
const data = (res && res.data) || {}
|
this.cities = data.cities || []
|
this.mapProvider = data.mapProvider || null
|
this.mapRequired = data.mapRequired !== false
|
})
|
.catch(e => {
|
if (e && e._toast) return
|
this.$message.error('台账核查基础信息加载失败')
|
})
|
},
|
onModeChange() {
|
this.clearResults()
|
this.enterpriseName = ''
|
this.singleFile = null
|
this.batchFiles = []
|
if (this.mode === 'single' && this.city && this.period) this.loadEnterprises()
|
},
|
onCityChange() {
|
this.enterpriseName = ''
|
this.loadEnterprises()
|
},
|
onPeriodChange() {
|
this.enterpriseName = ''
|
this.clearResults()
|
if (this.mode === 'single' && this.city && this.period) this.loadEnterprises()
|
},
|
loadEnterprises() {
|
if (!this.city || !this.period) {
|
this.enterpriseAll = []
|
this.enterpriseOptions = []
|
return
|
}
|
this.enterpriseLoading = true
|
api.get('/ledger-audit/enterprises', { params: { city: this.city, period: this.period } })
|
.then(res => {
|
if (res && res.code !== undefined && res.code !== 200) throw new Error(res.message || '企业加载失败')
|
this.enterpriseAll = (res && res.data) || []
|
this.enterpriseOptions = this.enterpriseAll
|
})
|
.catch(e => {
|
if (e && e._toast) return
|
this.$message.error((e && e.message) || '企业列表加载失败')
|
})
|
.finally(() => { this.enterpriseLoading = false })
|
},
|
filterEnterprises(query) {
|
const keyword = String(query || '').trim()
|
this.enterpriseOptions = keyword
|
? this.enterpriseAll.filter(x => x.enterpriseName.indexOf(keyword) >= 0)
|
: this.enterpriseAll
|
},
|
onSingleFilePicked(file) {
|
this.singleFile = file && file.raw ? file.raw : null
|
this.clearResults()
|
},
|
pickFolder() {
|
this.$refs.folderInput.click()
|
},
|
onFolderPicked(event) {
|
const files = Array.from((event.target && event.target.files) || [])
|
.filter(f => /\.(xls|xlsx|xlsm)$/i.test(f.name))
|
this.batchFiles = files
|
this.clearResults()
|
event.target.value = ''
|
},
|
runCheck() {
|
if (!this.canCheck) return
|
if (this.mode === 'single') this.runSingleCheck()
|
else this.runBatchCheck()
|
},
|
runSingleCheck() {
|
const fd = new FormData()
|
fd.append('city', this.city)
|
fd.append('period', this.period)
|
fd.append('enterpriseName', this.enterpriseName)
|
fd.append('file', this.singleFile)
|
this.checking = true
|
api.post('/ledger-audit/check', fd, { headers: { 'Content-Type': 'multipart/form-data' }, timeout: 600000 })
|
.then(res => {
|
if (res && res.code !== undefined && res.code !== 200) throw new Error(res.message || '核查失败')
|
this.currentResult = res.data
|
this.severityFilter = ''
|
this.ruleFilter = ''
|
this.$message.success('台账核查完成')
|
})
|
.catch(e => {
|
if (e && e._toast) return
|
const msg = (e.response && e.response.data && e.response.data.message) || (e && e.message) || '台账核查失败'
|
this.$message.error(msg)
|
})
|
.finally(() => { this.checking = false })
|
},
|
runBatchCheck() {
|
const fd = new FormData()
|
fd.append('period', this.period)
|
this.batchFiles.forEach(f => fd.append('files', f, f.name))
|
this.checking = true
|
api.post('/ledger-audit/batch-check', fd, { headers: { 'Content-Type': 'multipart/form-data' }, timeout: 1800000 })
|
.then(res => {
|
if (res && res.code !== undefined && res.code !== 200) throw new Error(res.message || '批量核查失败')
|
this.batchResult = res.data
|
this.$message.success('批量核查完成:成功 ' + this.batchResult.successCount + ' 个,失败 ' + this.batchResult.failCount + ' 个')
|
})
|
.catch(e => {
|
if (e && e._toast) return
|
const msg = (e.response && e.response.data && e.response.data.message) || (e && e.message) || '批量核查失败'
|
this.$message.error(msg)
|
})
|
.finally(() => { this.checking = false })
|
},
|
clearResults() {
|
this.currentResult = null
|
this.batchResult = null
|
this.batchSelected = null
|
this.severityFilter = ''
|
this.ruleFilter = ''
|
},
|
openBatchItem(row) {
|
if (!row || !row.result) return
|
this.batchSelected = row
|
this.batchDialogVisible = true
|
},
|
exportBatchCsv() {
|
if (!this.batchResult) return
|
const rows = [['文件名', '识别企业', '状态', '应核减多报周转量(吨公里)', '错误数', '待核实数', '无法核查数', '说明']]
|
this.batchResult.items.forEach(i => rows.push([
|
i.fileName, i.enterpriseName, this.batchStatusText(i.status),
|
i.result ? i.result.ledger.overreportedTurnoverTotal : '',
|
i.result ? i.result.errorCount : '', i.result ? i.result.warningCount : '',
|
i.result ? i.result.unableCount : '', i.message || ''
|
]))
|
const esc = v => '"' + String(v === null || v === undefined ? '' : v).replace(/"/g, '""') + '"'
|
const csv = '\ufeff' + rows.map(r => r.map(esc).join(',')).join('\r\n')
|
const blob = new Blob([csv], { type: 'text/csv;charset=utf-8' })
|
const url = URL.createObjectURL(blob)
|
const a = document.createElement('a')
|
a.href = url
|
a.download = '台账批量核查_' + this.batchResult.reportPeriod + '.csv'
|
document.body.appendChild(a)
|
a.click()
|
document.body.removeChild(a)
|
URL.revokeObjectURL(url)
|
},
|
fmt(value) {
|
if (value === null || value === undefined || value === '') return '—'
|
const number = Number(value)
|
if (Number.isNaN(number)) return String(value)
|
return number.toLocaleString('zh-CN', { maximumFractionDigits: 2 })
|
},
|
locationText(row) {
|
if (!row) return ''
|
const sheet = row.sheetName || ''
|
return row.excelRow ? sheet + ' 第' + row.excelRow + '行' : sheet
|
},
|
ruleTagType(status) {
|
if (status === 'ERROR') return 'danger'
|
if (status === 'WARNING') return 'warning'
|
if (status === 'UNABLE') return 'info'
|
return 'success'
|
},
|
ruleStatusText(status) {
|
if (status === 'ERROR') return '有问题'
|
if (status === 'WARNING') return '待核实'
|
if (status === 'UNABLE') return '无法核查'
|
return '通过'
|
},
|
issueTagType(severity) {
|
if (severity === 'ERROR') return 'danger'
|
if (severity === 'WARNING') return 'warning'
|
return 'info'
|
},
|
severityText(severity) {
|
if (severity === 'ERROR') return '错误'
|
if (severity === 'WARNING') return '待核实'
|
return '无法核查'
|
},
|
issueRowClass({ row }) {
|
return 'issue-' + String(row.severity || '').toLowerCase()
|
},
|
batchRowClass({ row }) {
|
if (row.status === 'FAILED') return 'batch-failed-row'
|
if (row.status === 'INCOMPLETE') return 'batch-incomplete-row'
|
return 'batch-success-row'
|
},
|
batchStatusType(status) {
|
if (status === 'SUCCESS') return 'success'
|
if (status === 'INCOMPLETE') return 'warning'
|
return 'danger'
|
},
|
batchStatusText(status) {
|
if (status === 'SUCCESS') return '完整核查'
|
if (status === 'INCOMPLETE') return '地图未覆盖'
|
return '失败'
|
}
|
}
|
}
|
</script>
|
|
<style scoped>
|
.page-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
|
.page-title-row h3 { margin: 0; font-size: 20px; color: #303133; }
|
.subline { margin-top: 4px; color: #909399; font-size: 12px; }
|
.map-banner { display: flex; align-items: center; gap: 8px; padding: 8px 12px; margin-bottom: 10px; border: 1px solid #FAECD8; background: #FDF6EC; color: #8a6d3b; border-radius: 6px; font-size: 12px; }
|
.check-panel { background: #fff; border: 1px solid #EBEEF5; border-radius: 8px; padding: 12px 14px 4px; margin-bottom: 12px; }
|
.mode-row { margin-bottom: 6px; }
|
.selector-form { display: flex; flex-wrap: wrap; gap: 0 10px; align-items: flex-end; }
|
.selector-form .el-form-item { margin-bottom: 10px; }
|
.selector-form ::v-deep .el-form-item__label { padding-bottom: 2px; line-height: 22px; color: #606266; font-weight: 600; }
|
.picked-file { max-width: 280px; margin-top: 4px; color: #909399; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
.hidden-input { display: none; }
|
.option-main { float: left; max-width: 300px; overflow: hidden; text-overflow: ellipsis; }
|
.option-meta { float: right; color: #909399; font-size: 12px; margin-left: 12px; }
|
.batch-file-strip { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0 10px; }
|
.file-chip, .more-chip { padding: 2px 8px; border-radius: 12px; background: #F4F4F5; color: #606266; font-size: 12px; }
|
.result-band { background: #fff; border: 1px solid #EBEEF5; border-radius: 8px; padding: 12px 14px; margin-bottom: 14px; }
|
.band-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
|
.band-title { font-size: 16px; font-weight: 700; color: #303133; }
|
.band-actions { display: flex; align-items: center; gap: 10px; }
|
.result-meta { color: #909399; font-size: 12px; margin-top: 3px; }
|
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 8px; margin-bottom: 12px; }
|
.metric { border-left: 3px solid #DCDFE6; background: #FAFAFA; padding: 7px 10px; min-height: 48px; }
|
.metric.ok { border-left-color: #67C23A; }
|
.metric.bad { border-left-color: #F56C6C; }
|
.metric span { display: block; color: #909399; font-size: 12px; }
|
.metric b { display: inline-block; color: #303133; font-size: 18px; margin-top: 2px; }
|
.metric small { color: #909399; margin-left: 5px; }
|
.severity-summary { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
|
.sev { padding: 3px 9px; border-radius: 12px; font-size: 12px; }
|
.sev.error { color: #F56C6C; background: #FEF0F0; }
|
.sev.warning { color: #E6A23C; background: #FDF6EC; }
|
.sev.unable { color: #909399; background: #F4F4F5; }
|
.section-title { font-weight: 700; color: #303133; margin: 12px 0 7px; }
|
.rule-table { margin-bottom: 4px; }
|
.issue-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
|
.issue-filters { display: flex; align-items: center; gap: 8px; }
|
.filter-count { color: #909399; font-size: 12px; }
|
.disclaimer { margin-top: 10px; padding: 7px 10px; background: #F4F4F5; border-radius: 4px; color: #909399; font-size: 12px; }
|
.empty-line { padding: 20px; color: #909399; font-size: 12px; }
|
.dialog-result { max-height: 82vh; overflow-y: auto; }
|
.dialog-meta { display: flex; justify-content: space-between; gap: 12px; color: #606266; margin-bottom: 8px; }
|
:deep(.el-table .issue-error td:first-child) { box-shadow: inset 3px 0 #F56C6C; }
|
:deep(.el-table .issue-warning td:first-child) { box-shadow: inset 3px 0 #E6A23C; }
|
:deep(.el-table .issue-unable td:first-child) { box-shadow: inset 3px 0 #909399; }
|
:deep(.el-table .batch-failed-row) { cursor: default; }
|
:deep(.el-table .batch-success-row) { cursor: pointer; }
|
:deep(.el-table .batch-incomplete-row) { cursor: pointer; background: #FDF6EC; }
|
@media (max-width: 1200px) {
|
.metric-grid { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
|
}
|
</style>
|
|
<style>
|
.ledger-result-dialog .el-dialog__body { max-height: calc(100vh - 150px); overflow-y: auto; padding: 12px 18px; }
|
</style>
|