xw 6 днів тому
батько
коміт
5beb4bd955
2 змінених файлів з 289 додано та 0 видалено
  1. 91 0
      src/api/qw/sopFailedLog.js
  2. 198 0
      src/views/qw/sop/failedLog/index.vue

+ 91 - 0
src/api/qw/sopFailedLog.js

@@ -0,0 +1,91 @@
+import request from '@/utils/request'
+
+/**
+ * 查询SOP生成失败日志列表(推荐使用-包含扩展信息)
+ * 后端已做公司数据隔离,不需要传companyId
+ */
+export function listFailedLog(query) {
+  return request({
+    url: '/qwSop/failedLog/voList',
+    method: 'get',
+    params: query
+  })
+}
+
+/**
+ * 查询失败日志统计信息
+ * 用于顶部统计卡片展示
+ */
+export function getFailedLogStatistics(query) {
+  return request({
+    url: '/qwSop/failedLog/statistics',
+    method: 'get',
+    params: query
+  })
+}
+
+/**
+ * 标记单个客户为已补发
+ * @param {number} id - 失败日志ID
+ * @param {object} data - 请求数据,包含 retryBy(可选)
+ */
+export function markRetried(id, data) {
+  return request({
+    url: `/qwSop/failedLog/markRetried/${id}`,
+    method: 'put',
+    data: data
+  })
+}
+
+/**
+ * 批量标记为已补发
+ * @param {object} data - 请求数据,包含 ids 数组和 retryBy(可选)
+ */
+export function batchMarkRetried(data) {
+  return request({
+    url: '/qwSop/failedLog/batchMarkRetried',
+    method: 'put',
+    data: data
+  })
+}
+
+/**
+ * 按营期查询失败日志
+ */
+export function listByUserLogsId(userLogsId) {
+  return request({
+    url: `/qwSop/failedLog/listByUserLogsId/${userLogsId}`,
+    method: 'get'
+  })
+}
+
+/**
+ * 按SOP查询失败日志
+ */
+export function listBySopId(sopId) {
+  return request({
+    url: `/qwSop/failedLog/listBySopId/${sopId}`,
+    method: 'get'
+  })
+}
+
+/**
+ * 查询失败日志详情
+ */
+export function getFailedLog(id) {
+  return request({
+    url: `/qwSop/failedLog/${id}`,
+    method: 'get'
+  })
+}
+
+/**
+ * 只看未补发的记录
+ */
+export function listNotRetried(query) {
+  return request({
+    url: '/qwSop/failedLog/listNotRetried',
+    method: 'get',
+    params: query
+  })
+}

+ 198 - 0
src/views/qw/sop/failedLog/index.vue

@@ -0,0 +1,198 @@
+<template>
+  <div class="app-container">
+    <!-- 页面标题 -->
+    <div class="page-header">
+      <h3>SOP生成失败日志</h3>
+    </div>
+
+    <!-- 筛选表单 -->
+    <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="100px" class="filter-form">
+      <el-form-item label="SOP ID" prop="sopId">
+        <el-input
+          v-model="queryParams.sopId"
+          placeholder="请输入SOP ID"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+
+      <el-form-item label="营期ID" prop="userLogsId">
+        <el-input
+          v-model="queryParams.userLogsId"
+          placeholder="请输入营期ID"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+
+      <el-form-item label="企微主体" prop="corpId">
+        <el-input
+          v-model="queryParams.corpId"
+          placeholder="请输入企微主体ID"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+
+      <el-form-item label="客户ID" prop="externalId">
+        <el-input
+          v-model="queryParams.externalId"
+          placeholder="请输入客户ID"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+
+      <el-form-item label="发送人" prop="qwUserId">
+        <el-input
+          v-model="queryParams.qwUserId"
+          placeholder="请输入发送人ID或名称"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="small" @click="handleQuery">
+          搜索
+        </el-button>
+        <el-button icon="el-icon-refresh" size="small" @click="resetQuery">
+          重置
+        </el-button>
+      </el-form-item>
+    </el-form>
+
+    <!-- 数据表格 -->
+    <el-table
+      v-loading="loading"
+      :data="tableData"
+      border
+      stripe>
+
+      <el-table-column label="企微主体" width="150" show-overflow-tooltip>
+        <template slot-scope="scope">
+          {{ scope.row.corpName || scope.row.corpId }}
+        </template>
+      </el-table-column>
+
+      <el-table-column label="客户名称" prop="externalName" width="120" show-overflow-tooltip />
+
+      <el-table-column label="客户ID" prop="externalId" width="100" align="center" />
+
+      <el-table-column label="SOP名称" prop="sopName" width="150" show-overflow-tooltip />
+
+      <el-table-column label="营期ID" prop="userLogsId" width="100" align="center" />
+
+      <el-table-column label="发送人" prop="qwUserName" width="100" />
+
+      <el-table-column label="第几天" prop="dayNum" width="80" align="center" />
+
+      <el-table-column label="发送时间" prop="sendTime" width="100" align="center" />
+
+      <el-table-column label="创建时间" prop="createTime" width="160" align="center" />
+
+    </el-table>
+
+    <!-- 分页组件 -->
+    <pagination
+      v-show="total > 0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+  </div>
+</template>
+
+<script>
+import { listFailedLog } from '@/api/qw/sopFailedLog'
+
+export default {
+  name: 'SopFailedLog',
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 总条数
+      total: 0,
+      // 表格数据
+      tableData: [],
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        sopId: null,
+        userLogsId: null,
+        corpId: null,
+        externalId: null,
+        qwUserId: null
+      }
+    }
+  },
+  created() {
+    this.getList()
+  },
+  methods: {
+    /**
+     * 查询列表
+     */
+    getList() {
+      this.loading = true
+      listFailedLog(this.queryParams).then(response => {
+        this.tableData = response.rows || []
+        this.total = response.total || 0
+        this.loading = false
+      }).catch(() => {
+        this.tableData = []
+        this.total = 0
+        this.loading = false
+      })
+    },
+
+    /**
+     * 搜索按钮操作
+     */
+    handleQuery() {
+      this.queryParams.pageNum = 1
+      this.getList()
+    },
+
+    /**
+     * 重置按钮操作
+     */
+    resetQuery() {
+      this.resetForm('queryForm')
+      this.handleQuery()
+    }
+  }
+}
+</script>
+
+<style scoped>
+.app-container {
+  padding: 20px;
+}
+
+.page-header {
+  margin-bottom: 20px;
+}
+
+.page-header h3 {
+  margin: 0;
+  font-size: 18px;
+  font-weight: 600;
+  color: #303133;
+}
+
+.filter-form {
+  background: #f5f7fa;
+  padding: 15px;
+  border-radius: 4px;
+  margin-bottom: 20px;
+}
+</style>