zhizhijie
2026-10-20 b61e35eb8675a3716585d90a571fc2b0183b6a58
traffic-audit-web/src/views/DataView.vue
@@ -10,16 +10,23 @@
          <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-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>
        <h3>导入数据查看</h3>
        <div class="toolbar">
          <template v-if="!isRollup">
            <span class="toolbar-label">报表期</span>
            <el-date-picker v-model="period" type="month" placeholder="报表期(全部)" value-format="yyyy-MM" clearable style="width:150px" @change="doQuery"></el-date-picker>
            <el-date-picker v-model="period" type="month" placeholder="报表期(全部)" value-format="yyyy-MM" clearable
                            style="width:150px" :picker-options="periodPickerOptions" @change="doQuery"></el-date-picker>
            <span v-if="periodHint" class="toolbar-hint">{{ periodHint }}</span>
          </template>
          <span class="toolbar-sep"></span>
          <span class="toolbar-label">数据类型</span>
@@ -83,6 +90,7 @@
<script>
import AppHeader from '@/components/AppHeader.vue'
import api from '@/api'
import { granularityOfImportType, disabledDateFor, granularityHint, snapPeriod } from '@/utils/periodGranularity'
export default {
  components: { AppHeader },
  name: 'DataView',
@@ -149,6 +157,12 @@
    }
  },
  computed: {
    periodGranularity() { return granularityOfImportType(this.type) },
    periodPickerOptions() {
      const d = disabledDateFor(this.periodGranularity)
      return d ? { disabledDate: d } : {}
    },
    periodHint() { return granularityHint(this.periodGranularity) },
    canRollup() {
      return (this.rollupTypes || []).some(t => t.type === this.type)
    },
@@ -185,6 +199,17 @@
      return cols.map((c, i) => Object.assign({}, c, { fixed: i < count }))
    }
  },
  watch: {
    // 选到能耗(季报)时把报表期对齐到季度末月
    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: {
    // 数据查看统一列过滤:内部标识列不展示;报表期(由筛选条件体现)与所属地区(区划代码,已被市州列替代)不展示
    keepColumn(c) {