traffic-audit-web/src/views/DataImport.vue
@@ -103,7 +103,11 @@
              <div v-show="sideOpen" class="side-content">
                <div class="side-head">
                  <span>本月导入进度({{ period || '未选择报表期' }})</span>
                  <span class="side-head-btns">
                  <el-button type="text" icon="el-icon-refresh" @click="loadData">刷新</el-button>
                    <el-button type="text" icon="el-icon-delete" style="color:#F56C6C" :loading="clearing"
                               :disabled="!period || clearing || importing" @click="clearPeriodData">清空</el-button>
                  </span>
                </div>
                <div v-if="!period" class="tip">请先在上方选择报表期</div>
                <div v-else class="overview-grid">
@@ -158,6 +162,7 @@
      period: (() => { const d = new Date(); return d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0') })(),
      cityDirLoading: false,
      importing: false,
      clearing: false,
      sideOpen: false,
      result: '',
      error: '',
@@ -520,6 +525,28 @@
        .catch(e => { if (!e || !e._toast) this.$message.error('导入记录加载失败,请刷新重试') })
        .finally(() => { this.batchLoading = false })
    },
    clearPeriodData() {
      if (!this.period) { this.$message.warning('请先选择报表期'); return }
      if (this.importing) { this.$message.warning('正在导入数据,请等待导入完成后再清空'); return }
      if (this.clearing) return
      this.$confirm(
        '将清空 ' + this.period + ' 报表期在数据库中的全部已导入数据,同时删除该报表期的审核结果与导入批次记录(便于整月重新导入)。\n此操作不可撤销,是否继续?',
        '清空 ' + this.period + ' 数据',
        { type: 'warning', confirmButtonText: '确认清空', cancelButtonText: '取消' }
      ).then(() => {
        this.clearing = true
        api.post('/import/clear', null, { params: { period: this.period }, timeout: 600000 })
          .then(() => {
            this.$message.success('已清空 ' + this.period + ' 报表期的数据,可以重新导入')
            this.loadData()
          })
          .catch(e => {
            if (e && e._toast) return
            this.$message.error((e.response && e.response.data && e.response.data.message) || '清空失败,请稍后重试')
          })
          .finally(() => { this.clearing = false })
      }).catch(() => {})
    },
    batchKeyToType(k) {
      if (BATCH_TYPE_MAP[k]) return BATCH_TYPE_MAP[k]
      if (k && k.indexOf('INVEST_') === 0) {
@@ -591,6 +618,8 @@
.import-side.side-open .side-toggle-text { writing-mode: horizontal-tb; letter-spacing: normal; margin-top: 0; }
.side-content { padding: 8px 12px 12px; max-height: calc(100vh - 220px); overflow-y: auto; overscroll-behavior: contain; }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 600; margin-bottom: 6px; }
.side-head-btns { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.side-head-btns .el-button + .el-button { margin-left: 0; }
.import-side .overview-grid { display: block; }
.import-side .ov-row { display: block; margin-bottom: 6px; }
.import-side .ov-group { width: auto; }