xyc
1 天以前 3d684b1b053a2401e0cc924ea85e43a6c17fedc4
traffic-audit-web/src/views/DataView.vue
@@ -36,6 +36,14 @@
              <el-option v-for="t in g.types" :key="t.value" :label="t.label" :value="t.value"></el-option>
            </el-option-group>
          </el-select>
          <template v-if="!isRollup && type === 'trackMileage'">
            <span class="toolbar-label">企业类别</span>
            <el-select v-model="enterpriseCategory" size="small" style="width:140px" @change="doQuery">
              <el-option label="全部" value=""></el-option>
              <el-option label="规上企业" value="ABOVE_SCALE"></el-option>
              <el-option label="两客企业" value="PASSENGER"></el-option>
            </el-select>
          </template>
          <template v-if="canRollup">
            <span class="toolbar-label">视图</span>
            <el-radio-group v-model="viewMode" size="small" @change="onViewChange">
@@ -100,6 +108,7 @@
        {
          key: 'freight', name: '道路货运', types: [
            { value: 'h2032', label: '道路货物运输月度生产情况' },
            { value: 'h202', label: '公路货物营运车辆拥有情况(H202)' },
            { value: 'transportAuth', label: '运政车辆' },
            { value: 'trackMileage', label: '轨迹里程' },
            { value: 'scaleSplit', label: '规上规下拆分' },
@@ -140,6 +149,7 @@
      type: 'h2032',
      period: '',
      periodType: '',
      enterpriseCategory: '',
      viewMode: 'detail',
      rollupTypes: [],
      from: '',
@@ -288,6 +298,7 @@
      const g = this.modules.find(x => x.types.some(t => t.value === this.type))
      if (g) this.activeModule = g.key
      this.periodType = ''
      this.enterpriseCategory = ''
      this.viewMode = 'detail'
      this.summaryHint = ''
      this.doQuery()
@@ -306,6 +317,7 @@
          period: this.period || undefined,
          keyword: this.keyword || undefined,
          periodType: this.periodType || undefined,
          enterpriseCategory: this.type === 'trackMileage' ? (this.enterpriseCategory || undefined) : undefined,
          page: this.page,
          size: this.size
        }
@@ -349,6 +361,7 @@
          period: this.period || undefined,
          keyword: this.keyword || undefined,
          periodType: this.periodType || undefined,
          enterpriseCategory: this.type === 'trackMileage' ? (this.enterpriseCategory || undefined) : undefined,
          page: nextPage,
          size: this.size
        }
@@ -405,6 +418,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 +428,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() {