From f241309ef7b1750a1a6e899f09eb8c2c3c761860 Mon Sep 17 00:00:00 2001
From: xyc <jc_xiong@hotmail.com>
Date: 星期三, 11 十一月 2026 20:07:39 +0800
Subject: [PATCH] fix(公路旅客): 修正个体客运模板路径和月份匹配
---
traffic-audit-web/src/views/DataView.vue | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/traffic-audit-web/src/views/DataView.vue b/traffic-audit-web/src/views/DataView.vue
index 120590d..092ee9f 100644
--- a/traffic-audit-web/src/views/DataView.vue
+++ b/traffic-audit-web/src/views/DataView.vue
@@ -100,6 +100,7 @@
{
key: 'freight', name: '閬撹矾璐ц繍', types: [
{ value: 'h2032', label: '閬撹矾璐х墿杩愯緭鏈堝害鐢熶骇鎯呭喌' },
+ { value: 'h202', label: '鍏矾璐х墿钀ヨ繍杞﹁締鎷ユ湁鎯呭喌(H202)' },
{ value: 'transportAuth', label: '杩愭斂杞﹁締' },
{ value: 'trackMileage', label: '杞ㄨ抗閲岀▼' },
{ value: 'scaleSplit', label: '瑙勪笂瑙勪笅鎷嗗垎' },
@@ -405,6 +406,7 @@
// - 鍏朵綑鏁板�煎崈鍒嗕綅銆佷繚鐣欎袱浣嶅皬鏁帮紱鏁存暟鍘熸牱銆�
formatCell(v, prop) {
if (v === null || v === undefined || v === '') return '-'
+ if (this.type === 'h202' && /Value$/.test(String(prop || ''))) return this.formatExactDecimal(v)
const s = typeof v === 'string' ? v.trim() : v
if (typeof v !== 'number' && !/^-?\d+(\.\d+)?$/.test(String(s))) return v
const n = Number(s)
@@ -414,6 +416,17 @@
if (/(rate|yoy|mom|growth|ratio|percent|share)/.test(key)) return (n * 100).toFixed(2) + '%'
if (Number.isInteger(n)) return n.toLocaleString('zh-CN')
return n.toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })
+ },
+ // H202 values arrive as exact decimal strings. Format without Number() to preserve source precision.
+ formatExactDecimal(v) {
+ const text = String(v === null || v === undefined ? '' : v).trim()
+ if (!/^-?\d+(?:\.\d+)?$/.test(text)) return v
+ const negative = text.charAt(0) === '-'
+ const unsigned = negative ? text.slice(1) : text
+ const parts = unsigned.split('.')
+ const integer = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',')
+ const fraction = (parts[1] || '').replace(/0+$/, '')
+ return (negative ? '-' : '') + integer + (fraction ? '.' + fraction : '')
}
},
mounted() {
--
Gitblit v1.9.1