xyc
2026-08-23 f860b52d65508c3617796dc77a35c18c03a22213
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<template>
  <el-container>
    <el-header>交通统计报表审核系统 - 企业解释</el-header>
    <el-container>
      <el-aside width="200px">
        <el-menu router default-active="/explain">
          <el-menu-item index="/dashboard">工作台</el-menu-item>
          <el-menu-item index="/import">数据导入</el-menu-item>
          <el-menu-item index="/data">数据查看</el-menu-item>
          <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="/rules">规则管理</el-menu-item>
          <el-menu-item index="/users">用户管理</el-menu-item>
        </el-menu>
      </el-aside>
      <el-main>
        <h3>企业解释</h3>
        <el-form :inline="true">
          <el-form-item label="报表期">
            <el-date-picker v-model="period" type="month" placeholder="全部" value-format="yyyy-MM" clearable style="width:140px" @change="loadData"></el-date-picker>
          </el-form-item>
          <el-form-item label="企业名称">
            <el-input v-model="keyword" placeholder="输入企业名称关键字" clearable style="width:220px" @keyup.enter.native="loadData"></el-input>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="loadData">查询</el-button>
          </el-form-item>
          <el-form-item>
            <span style="color:#909399;font-size:12px">共 {{ total }} 条解释</span>
          </el-form-item>
        </el-form>
        <div class="table-area">
        <el-table :data="records" border v-loading="loading" size="small" style="width:100%" height="100%">
          <el-table-column prop="reportPeriod" label="报表期" width="100"></el-table-column>
          <el-table-column prop="regionCode" label="所属地区" width="100"></el-table-column>
          <el-table-column prop="enterpriseCode" label="企业代码" min-width="140" show-overflow-tooltip></el-table-column>
          <el-table-column prop="enterpriseName" label="企业名称" min-width="200" show-overflow-tooltip></el-table-column>
          <el-table-column prop="vehicleTotal" label="车辆数" width="90"></el-table-column>
          <el-table-column prop="tonsTotal" label="吨位" width="100"></el-table-column>
          <el-table-column prop="freightTotal" label="货运量" width="110"></el-table-column>
          <el-table-column prop="turnoverTotal" label="周转量" width="120"></el-table-column>
          <el-table-column prop="avgDistance" label="平均运距" width="100"></el-table-column>
          <el-table-column prop="verifyExplanation" label="企业解释" min-width="280" show-overflow-tooltip></el-table-column>
          <el-table-column label="操作" width="100" fixed="right">
            <template slot-scope="scope">
              <el-button size="mini" type="primary" @click="analyze(scope.row)">AI 分析</el-button>
            </template>
          </el-table-column>
        </el-table>
        </div>
        <el-pagination style="margin-top:15px;text-align:right"
          background layout="total, prev, pager, next, sizes"
          :total="total" :current-page.sync="page" :page-size.sync="size"
          :page-sizes="[20, 50, 100]" @current-change="loadData" @size-change="loadData">
        </el-pagination>
 
        <ai-chat-dialog :visible.sync="chatVisible" :context="chatContext"></ai-chat-dialog>
      </el-main>
    </el-container>
  </el-container>
</template>
<script>
import api from '@/api'
import AiChatDialog from '@/components/AiChatDialog'
export default {
  name: 'ExplainReview',
  components: { AiChatDialog },
  data() {
    return {
      period: '', keyword: '', page: 1, size: 20, total: 0, records: [], loading: false,
      chatVisible: false, chatContext: {}
    }
  },
  methods: {
    loadData() {
      this.loading = true
      api.get('/explain/list', {
        params: {
          period: this.period || undefined,
          keyword: this.keyword || undefined,
          page: this.page,
          size: this.size
        }
      }).then(res => {
        const d = res.data || {}
        this.records = d.records || []
        this.total = d.total || 0
        if (this.page > 1 && this.records.length === 0) {
          this.page = 1
          this.loadData()
        }
      }).catch(() => {
        this.$message.error('解释查询失败')
      }).finally(() => {
        this.loading = false
      })
    },
    analyze(row) {
      const explanation = (row.verifyExplanation || '').trim()
      if (!explanation) { this.$message.warning('该企业未填写解释'); return }
      this.chatContext = {
        reportId: row.id,
        reportPeriod: row.reportPeriod || this.period,
        enterpriseName: row.enterpriseName || '',
        verifyExplanation: explanation
      }
      this.chatVisible = true
    }
  },
  mounted() {
    this.loadData()
  }
}
</script>
<style scoped>
.el-header { background: #409EFF; color: white; line-height: 60px; font-size: 18px; }
</style>