xyc
7 小时以前 5b41c8896ef7850be2672e45b69bb58e149729ec
traffic-audit-web/src/views/DataView.vue
@@ -10,6 +10,7 @@
          <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>
@@ -37,12 +38,26 @@
            </el-option-group>
          </el-select>
          <template v-if="!isRollup && type === 'trackMileage'">
            <span class="toolbar-label">数据来源</span>
            <el-select v-model="dataSource" size="small" style="width:150px" @change="doQuery">
              <el-option label="全部来源" value=""></el-option>
              <el-option label="省重载平台" value="PROVINCIAL"></el-option>
              <el-option label="市州第三方" value="CITY_THIRD_PARTY"></el-option>
            </el-select>
            <span class="toolbar-label">市州</span>
            <el-select v-model="cityName" size="small" style="width:130px" filterable clearable @change="doQuery">
              <el-option label="全部市州" value=""></el-option>
              <el-option v-for="city in cities" :key="city" :label="city" :value="city"></el-option>
            </el-select>
            <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-option label="未入规企业" value="UNREGISTERED"></el-option>
            </el-select>
            <el-button type="success" size="small" icon="el-icon-download" :loading="exportingCityTrack"
                       @click="exportTrackMileageCity">生成分市州轨迹</el-button>
          </template>
          <template v-if="canRollup">
            <span class="toolbar-label">视图</span>
@@ -149,7 +164,11 @@
      type: 'h2032',
      period: '',
      periodType: '',
      dataSource: '',
      cityName: '',
      enterpriseCategory: '',
      cities: ['武汉市', '黄石市', '十堰市', '宜昌市', '襄阳市', '鄂州市', '荆门市', '孝感市', '荆州市', '黄冈市',
        '咸宁市', '随州市', '恩施州', '仙桃市', '潜江市', '天门市', '神农架林区'],
      viewMode: 'detail',
      rollupTypes: [],
      from: '',
@@ -163,7 +182,8 @@
      records: [],
      columns: [],
      loading: false,
      loadingMore: false
      loadingMore: false,
      exportingCityTrack: false
    }
  },
  computed: {
@@ -294,11 +314,35 @@
        this.$message.success('汇总表已导出')
      }).catch(() => this.$message.error('导出失败'))
    },
    exportTrackMileageCity() {
      if (!this.period) { this.$message.warning('请先选择报表期'); return }
      this.exportingCityTrack = true
      api.get('/data/trackMileageCityExport', {
        params: { period: this.period },
        responseType: 'blob',
        timeout: 180000
      }).then(res => {
        const blob = res instanceof Blob ? res : new Blob([res], { type: 'application/zip' })
        const url = window.URL.createObjectURL(blob)
        const a = document.createElement('a')
        const fileName = this.period.replace('-', '年') + '月分市州轨迹.zip'
        a.href = url
        a.download = fileName
        document.body.appendChild(a)
        a.click()
        document.body.removeChild(a)
        window.URL.revokeObjectURL(url)
        this.$message.success('分市州轨迹已生成')
      }).catch(() => this.$message.error('生成分市州轨迹失败'))
        .finally(() => { this.exportingCityTrack = false })
    },
    onTypeSelect() {
      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.dataSource = ''
      this.cityName = ''
      this.viewMode = 'detail'
      this.summaryHint = ''
      this.doQuery()
@@ -318,6 +362,8 @@
          keyword: this.keyword || undefined,
          periodType: this.periodType || undefined,
          enterpriseCategory: this.type === 'trackMileage' ? (this.enterpriseCategory || undefined) : undefined,
          dataSource: this.type === 'trackMileage' ? (this.dataSource || undefined) : undefined,
          cityName: this.type === 'trackMileage' ? (this.cityName || undefined) : undefined,
          page: this.page,
          size: this.size
        }
@@ -362,6 +408,8 @@
          keyword: this.keyword || undefined,
          periodType: this.periodType || undefined,
          enterpriseCategory: this.type === 'trackMileage' ? (this.enterpriseCategory || undefined) : undefined,
          dataSource: this.type === 'trackMileage' ? (this.dataSource || undefined) : undefined,
          cityName: this.type === 'trackMileage' ? (this.cityName || undefined) : undefined,
          page: nextPage,
          size: this.size
        }