From fbc1c1590e7e81a550beb50c7cf65c663c7c5b41 Mon Sep 17 00:00:00 2001
From: zhizhijie <zhizhijie@users.noreply.gitee.com>
Date: 星期二, 01 九月 2026 16:42:06 +0800
Subject: [PATCH] 数据导入与报表生成多项改进
---
traffic-audit-web/src/views/ExplainReview.vue | 137 +++++++++++++++++++++++++++++++++++++--------
1 files changed, 111 insertions(+), 26 deletions(-)
diff --git a/traffic-audit-web/src/views/ExplainReview.vue b/traffic-audit-web/src/views/ExplainReview.vue
index 767be34..f622ecc 100644
--- a/traffic-audit-web/src/views/ExplainReview.vue
+++ b/traffic-audit-web/src/views/ExplainReview.vue
@@ -1,9 +1,9 @@
<template>
- <el-container>
- <el-header>浜ら�氱粺璁℃姤琛ㄥ鏍哥郴缁� - 浼佷笟瑙i噴</el-header>
+ <el-container direction="vertical">
+ <app-header title="浜ら�氱粺璁℃姤琛ㄥ鏍哥郴缁� - 浼佷笟瑙i噴"></app-header>
<el-container>
<el-aside width="200px">
- <el-menu router default-active="/explain">
+ <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>
@@ -12,37 +12,47 @@
<el-menu-item index="/report">鎶ヨ〃鐢熸垚</el-menu-item>
<el-menu-item index="/rules">瑙勫垯绠$悊</el-menu-item>
<el-menu-item index="/users">鐢ㄦ埛绠$悊</el-menu-item>
- </el-menu>
+</el-menu>
</el-aside>
<el-main>
<h3>浼佷笟瑙i噴</h3>
- <el-form :inline="true">
+ <el-form :inline="true" @submit.native.prevent>
+ <el-form-item label="鎶ヨ〃绫诲瀷">
+ <el-select v-model="reportType" style="width:190px" @change="onTypeChange">
+ <el-option label="璐ц繍锛圚203-2锛�" value="H2032"></el-option>
+ <el-option label="鍏矾鏃呭锛圚203-1锛�" value="H2031"></el-option>
+ <el-option label="鍩庡競鍏氦锛圕ITY_BUS锛�" value="CITY_BUS"></el-option>
+ <el-option label="宸℃父鍑虹锛圕ITY_TAXI锛�" value="CITY_TAXI"></el-option>
+ </el-select>
+ </el-form-item>
<el-form-item label="鎶ヨ〃鏈�">
<el-date-picker v-model="period" type="month" placeholder="鍏ㄩ儴" value-format="yyyy-MM" clearable style="width:140px" @change="loadData"></el-date-picker>
</el-form-item>
- <el-form-item label="浼佷笟鍚嶇О">
- <el-input v-model="keyword" placeholder="杈撳叆浼佷笟鍚嶇О鍏抽敭瀛�" clearable style="width:220px" @keyup.enter.native="loadData"></el-input>
+ <el-form-item :label="keywordLabel">
+ <el-input v-model="keyword" :placeholder="keywordPlaceholder" clearable style="width:220px" @keyup.enter.native="loadData"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="loadData">鏌ヨ</el-button>
</el-form-item>
+ <el-form-item label="浠呮樉绀哄凡濉啓">
+ <el-switch v-model="hasExplanation" @change="onFilterChange"></el-switch>
+ </el-form-item>
<el-form-item>
- <span style="color:#909399;font-size:12px">鍏� {{ total }} 鏉¤В閲�</span>
+ <span style="color:#909399;font-size:12px">鍏� {{ total }} 鏉¤褰�<template v-if="hasExplanation">锛堝凡濉啓瑙i噴锛�</template></span>
</el-form-item>
</el-form>
<div class="table-area">
- <el-table :data="records" border v-loading="loading" size="small" style="width:100%" height="100%">
- <el-table-column prop="reportPeriod" label="鎶ヨ〃鏈�" width="100"></el-table-column>
- <el-table-column prop="regionCode" label="鎵�灞炲湴鍖�" width="100"></el-table-column>
- <el-table-column prop="enterpriseCode" label="浼佷笟浠g爜" min-width="140" show-overflow-tooltip></el-table-column>
- <el-table-column prop="enterpriseName" label="浼佷笟鍚嶇О" min-width="200" show-overflow-tooltip></el-table-column>
- <el-table-column prop="vehicleTotal" label="杞﹁締鏁�" width="90"></el-table-column>
- <el-table-column prop="tonsTotal" label="鍚ㄤ綅" width="100"></el-table-column>
- <el-table-column prop="freightTotal" label="璐ц繍閲�" width="110"></el-table-column>
- <el-table-column prop="turnoverTotal" label="鍛ㄨ浆閲�" width="120"></el-table-column>
- <el-table-column prop="avgDistance" label="骞冲潎杩愯窛" width="100"></el-table-column>
- <el-table-column prop="verifyExplanation" label="浼佷笟瑙i噴" min-width="280" show-overflow-tooltip></el-table-column>
- <el-table-column label="鎿嶄綔" width="100" fixed="right">
+ <el-table :data="records" border v-loading="loading" size="mini" :row-style="{ height: '32px' }" style="width:100%" height="100%">
+ <el-table-column v-for="col in columns" :key="col.prop" v-bind="col">
+ <template slot-scope="scope">
+ <template v-if="col.prop === 'verifyExplanation'">
+ <span v-if="scope.row.verifyExplanation" class="expl-text">{{ scope.row.verifyExplanation }}</span>
+ <el-tag v-else size="mini" type="warning" effect="plain">鏈~鍐�</el-tag>
+ </template>
+ <span v-else>{{ scope.row[col.prop] }}</span>
+ </template>
+ </el-table-column>
+ <el-table-column label="鎿嶄綔" width="110" fixed="right">
<template slot-scope="scope">
<el-button size="mini" type="primary" @click="analyze(scope.row)">AI 鍒嗘瀽</el-button>
</template>
@@ -61,24 +71,89 @@
</el-container>
</template>
<script>
+import AppHeader from '@/components/AppHeader.vue'
import api from '@/api'
import AiChatDialog from '@/components/AiChatDialog'
+const COLS = {
+ H2032: [
+ { prop: 'reportPeriod', label: '鎶ヨ〃鏈�', width: 100 },
+ { prop: 'regionCode', label: '鎵�灞炲湴鍖�', width: 100 },
+ { prop: 'enterpriseCode', label: '浼佷笟浠g爜', minWidth: 140, showOverflowTooltip: true },
+ { prop: 'enterpriseName', label: '浼佷笟鍚嶇О', minWidth: 200, showOverflowTooltip: true },
+ { prop: 'vehicleTotal', label: '杞﹁締鏁�', width: 90 },
+ { prop: 'tonsTotal', label: '鍚ㄤ綅', width: 100 },
+ { prop: 'freightTotal', label: '璐ц繍閲�(鍚�)', width: 110 },
+ { prop: 'turnoverTotal', label: '鍛ㄨ浆閲�(鍚ㄥ叕閲�)', width: 130 },
+ { prop: 'avgDistance', label: '骞冲潎杩愯窛(鍏噷)', width: 120 },
+ { prop: 'verifyExplanation', label: '浼佷笟瑙i噴', minWidth: 260, showOverflowTooltip: true }
+ ],
+ H2031: [
+ { prop: 'reportPeriod', label: '鎶ヨ〃鏈�', width: 100 },
+ { prop: 'regionCode', label: '鎵�灞炲湴鍖�', width: 100 },
+ { prop: 'enterpriseCode', label: '浼佷笟浠g爜', minWidth: 140, showOverflowTooltip: true },
+ { prop: 'enterpriseName', label: '浼佷笟鍚嶇О', minWidth: 200, showOverflowTooltip: true },
+ { prop: 'vehicleTotal', label: '杞﹁締鏁�', width: 90 },
+ { prop: 'seatTotal', label: '杞藉浣嶆暟', width: 100 },
+ { prop: 'passengerTotal', label: '瀹㈣繍閲�(涓囦汉)', width: 110 },
+ { prop: 'turnoverTotal', label: '鍛ㄨ浆閲�(涓囦汉鍏噷)', width: 130 },
+ { prop: 'avgDistance', label: '骞冲潎杩愯窛(鍏噷)', width: 120 },
+ { prop: 'verifyExplanation', label: '浼佷笟瑙i噴', minWidth: 260, showOverflowTooltip: true }
+ ],
+ CITY_BUS: [
+ { prop: 'reportPeriod', label: '鎶ヨ〃鏈�', width: 100 },
+ { prop: 'regionCode', label: '鎵�灞炲湴鍖�', width: 100 },
+ { prop: 'city', label: '甯傚窞', width: 100 },
+ { prop: 'enterpriseName', label: '浼佷笟鍚嶇О', minWidth: 220, showOverflowTooltip: true },
+ { prop: 'opVehicles', label: '杩愯惀杞︽暟', width: 90 },
+ { prop: 'passengerVolume', label: '瀹㈣繍閲�(涓囦汉娆�)', width: 120 },
+ { prop: 'turnover', label: '鍛ㄨ浆閲�(涓囦汉鍏噷)', width: 130 },
+ { prop: 'avgDistance', label: '骞冲潎杩愯窛(鍏噷)', width: 120 },
+ { prop: 'verifyExplanation', label: '浼佷笟瑙i噴', minWidth: 260, showOverflowTooltip: true }
+ ],
+ CITY_TAXI: [
+ { prop: 'reportPeriod', label: '鎶ヨ〃鏈�', width: 100 },
+ { prop: 'regionCode', label: '鎵�灞炲湴鍖�', width: 100 },
+ { prop: 'city', label: '甯傚窞', width: 110 },
+ { prop: 'tripTotal', label: '杞藉杞︽鎬绘暟', width: 110 },
+ { prop: 'passengerVolume', label: '瀹㈣繍閲�(涓囦汉娆�)', width: 120 },
+ { prop: 'turnover', label: '鍛ㄨ浆閲�(涓囦汉鍏噷)', width: 130 },
+ { prop: 'opVehicles', label: '杩愯惀杞﹁締鏁�', width: 100 },
+ { prop: 'avgDistance', label: '骞冲潎杩愯窛(鍏噷)', width: 120 },
+ { prop: 'verifyExplanation', label: '浼佷笟瑙i噴', minWidth: 260, showOverflowTooltip: true }
+ ]
+}
+const TABLE_NAME = {
+ H2032: 'h2032_enterprise_monthly',
+ H2031: 'h2031_enterprise_monthly',
+ CITY_BUS: 'city_bus_monthly',
+ CITY_TAXI: 'city_taxi_monthly'
+}
export default {
+ components: { AppHeader, AiChatDialog },
name: 'ExplainReview',
- components: { AiChatDialog },
data() {
return {
- period: '', keyword: '', page: 1, size: 20, total: 0, records: [], loading: false,
+ reportType: 'H2032',
+ period: '', keyword: '', hasExplanation: false, page: 1, size: 20, total: 0, records: [], loading: false,
chatVisible: false, chatContext: {}
}
},
+ computed: {
+ columns() { return COLS[this.reportType] || COLS.H2032 },
+ keywordLabel() { return this.reportType === 'CITY_TAXI' ? '甯傚窞鍚嶇О' : '浼佷笟鍚嶇О' },
+ keywordPlaceholder() { return this.reportType === 'CITY_TAXI' ? '杈撳叆甯傚窞鍚嶇О鍏抽敭瀛�' : '杈撳叆浼佷笟鍚嶇О鍏抽敭瀛�' }
+ },
methods: {
+ onTypeChange() { this.page = 1; this.loadData() },
+ onFilterChange() { this.page = 1; this.loadData() },
loadData() {
this.loading = true
api.get('/explain/list', {
params: {
+ reportType: this.reportType,
period: this.period || undefined,
keyword: this.keyword || undefined,
+ hasExplanation: this.hasExplanation || undefined,
page: this.page,
size: this.size
}
@@ -90,7 +165,8 @@
this.page = 1
this.loadData()
}
- }).catch(() => {
+ }).catch(e => {
+ if (e && e._toast) return
this.$message.error('瑙i噴鏌ヨ澶辫触')
}).finally(() => {
this.loading = false
@@ -102,17 +178,26 @@
this.chatContext = {
reportId: row.id,
reportPeriod: row.reportPeriod || this.period,
- enterpriseName: row.enterpriseName || '',
- verifyExplanation: explanation
+ enterpriseName: row.enterpriseName || row.city || '',
+ verifyExplanation: explanation,
+ reportType: this.reportType,
+ tableName: TABLE_NAME[this.reportType] || ''
}
this.chatVisible = true
}
},
mounted() {
+ const q = this.$route.query
+ if (q.reportType && COLS[q.reportType]) this.reportType = q.reportType
+ if (q.period) this.period = q.period
+ if (q.keyword) this.keyword = q.keyword
this.loadData()
}
}
</script>
<style scoped>
.el-header { background: #409EFF; color: white; line-height: 60px; font-size: 18px; }
-</style>
\ No newline at end of file
+.el-table td { padding: 3px 0; }
+.el-table th { padding: 4px 0; }
+.expl-text { display: inline-block; max-height: 62px; overflow-y: auto; white-space: pre-wrap; word-break: break-all; line-height: 1.4; }
+</style>
--
Gitblit v1.9.1