|
|
@@ -0,0 +1,157 @@
|
|
|
+<template>
|
|
|
+ <div class="report-parse-status admin-page">
|
|
|
+ <div class="header admin-page-header">
|
|
|
+ <h2 class="admin-page-title">解析进度</h2>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="filter-bar">
|
|
|
+ <el-select v-model="query.parseStatus" placeholder="解析状态" clearable style="width: 140px">
|
|
|
+ <el-option label="全部" value="" />
|
|
|
+ <el-option label="采集中" value="collecting" />
|
|
|
+ <el-option label="成功" value="completed" />
|
|
|
+ <el-option label="失败" value="failed" />
|
|
|
+ </el-select>
|
|
|
+ <el-input
|
|
|
+ v-model="query.keyword"
|
|
|
+ placeholder="关键词(文件名或用户ID)"
|
|
|
+ style="width: 220px"
|
|
|
+ clearable
|
|
|
+ @keyup.enter.native="handleSearch"
|
|
|
+ />
|
|
|
+ <el-button type="primary" @click="handleSearch">查询</el-button>
|
|
|
+ <el-button @click="handleReset">重置</el-button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="adm-table-wrap">
|
|
|
+ <el-table :data="list" v-loading="loading" border stripe height="100%">
|
|
|
+ <el-table-column prop="draftId" label="草稿ID" width="90" />
|
|
|
+ <el-table-column prop="userId" label="用户ID" width="90" />
|
|
|
+ <el-table-column prop="reportType" label="报告类型" width="130" />
|
|
|
+ <el-table-column prop="originalFilename" label="文件名" min-width="200" show-overflow-tooltip />
|
|
|
+ <el-table-column label="解析状态" width="100">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <el-tag v-if="row.parseStatus === 'collecting'" type="info" size="small">采集中</el-tag>
|
|
|
+ <el-tag v-else-if="row.parseStatus === 'completed'" type="success" size="small">成功</el-tag>
|
|
|
+ <el-tag v-else-if="row.parseStatus === 'failed'" type="danger" size="small">失败</el-tag>
|
|
|
+ <el-tag v-else size="small">未触发</el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="parseMethod" label="解析方式" width="110" />
|
|
|
+ <el-table-column prop="parseAttempt" label="尝试次数" width="90" />
|
|
|
+ <el-table-column label="下次重试" width="160">
|
|
|
+ <template slot-scope="{ row }">{{ formatTime(row.nextRetryAt) }}</template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="parseError" label="错误信息" min-width="180" show-overflow-tooltip />
|
|
|
+ <el-table-column prop="confirmedReportId" label="入库报告ID" width="110" />
|
|
|
+ <el-table-column label="更新时间" width="160">
|
|
|
+ <template slot-scope="{ row }">{{ formatTime(row.updatedAt) }}</template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" width="100" fixed="right">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="primary"
|
|
|
+ :disabled="row.parseStatus === 'completed'"
|
|
|
+ @click="handleRetry(row)"
|
|
|
+ >重试</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <el-pagination
|
|
|
+ v-if="total > size"
|
|
|
+ @current-change="onPageChange"
|
|
|
+ :current-page="page"
|
|
|
+ :page-size="size"
|
|
|
+ :total="total"
|
|
|
+ layout="total, prev, pager, next"
|
|
|
+ class="pagination-wrap"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { listReportParseDrafts, retryReportParseDraft } from '@/api/reportParse'
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: 'ReportParseStatus',
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ list: [],
|
|
|
+ loading: false,
|
|
|
+ page: 1,
|
|
|
+ size: 20,
|
|
|
+ total: 0,
|
|
|
+ query: { parseStatus: '', keyword: '', reportType: '' }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.loadList()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ async loadList() {
|
|
|
+ this.loading = true
|
|
|
+ try {
|
|
|
+ const params = {
|
|
|
+ page: this.page,
|
|
|
+ size: this.size,
|
|
|
+ parseStatus: this.query.parseStatus,
|
|
|
+ reportType: this.query.reportType,
|
|
|
+ keyword: this.query.keyword
|
|
|
+ }
|
|
|
+ const res = await listReportParseDrafts(params)
|
|
|
+ const data = res.data || {}
|
|
|
+ this.list = data.records || []
|
|
|
+ this.total = data.total || 0
|
|
|
+ } catch (e) {
|
|
|
+ this.$message.error('加载解析进度失败')
|
|
|
+ } finally {
|
|
|
+ this.loading = false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleSearch() {
|
|
|
+ this.page = 1
|
|
|
+ this.loadList()
|
|
|
+ },
|
|
|
+ handleReset() {
|
|
|
+ this.query.parseStatus = ''
|
|
|
+ this.query.keyword = ''
|
|
|
+ this.page = 1
|
|
|
+ this.loadList()
|
|
|
+ },
|
|
|
+ onPageChange(val) {
|
|
|
+ this.page = val
|
|
|
+ this.loadList()
|
|
|
+ },
|
|
|
+ async handleRetry(row) {
|
|
|
+ try {
|
|
|
+ await this.$confirm(`确认重试草稿 #${row.draftId} 的解析?`, '提示', { type: 'warning' })
|
|
|
+ } catch (e) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ await retryReportParseDraft(row.draftId)
|
|
|
+ this.$message.success('已触发重试')
|
|
|
+ this.loadList()
|
|
|
+ } catch (e) {
|
|
|
+ this.$message.error('重试失败')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ formatTime(t) {
|
|
|
+ if (!t) return '—'
|
|
|
+ return t.replace ? t.replace('T', ' ').substring(0, 19) : t
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+.report-parse-status {
|
|
|
+ padding: 20px;
|
|
|
+}
|
|
|
+.pagination-wrap {
|
|
|
+ margin-top: 16px;
|
|
|
+ text-align: right;
|
|
|
+}
|
|
|
+</style>
|