wanshenmean
2 天以前 5e851678cc02257bbbd179446de36082430ca5bc
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<!--
*Author:System
 *Contact:-
 *代码由框架生成,任何更改都可能导致被代码生成器覆盖
 *业务请在@/extension/system/Mes_Log.jsx此处编写
 -->
<template>
  <div class="mes-log-page">
    <!-- 统计卡片区域 -->
    <mes-log-statistics ref="statistics" />
 
    <!-- 日志列表 -->
    <view-grid
      ref="grid"
      :columns="columns"
      :detail="detail"
      :editFormFields="editFormFields"
      :editFormOptions="editFormOptions"
      :searchFormFields="searchFormFields"
      :searchFormOptions="searchFormOptions"
      :table="table"
      :extend="extend"
    />
  </div>
</template>
 
<script>
import extend from "@/extension/system/Mes_Log.jsx";
import MesLogStatistics from "@/components/MesLogStatistics.vue";
import { ref, defineComponent } from "vue";
 
export default defineComponent({
  name: "Mes_Log",
  components: {
    MesLogStatistics
  },
  setup() {
    const table = ref({
      key: "Id",
      cnName: "MES接口日志",
      name: "Mes_Log",
      url: "/MesLog/",
      sortName: "Id"
    });
 
    const columns = ref([
      { field: "id", title: "ID", width: 80, hidden: true },
      {
        field: "apiType",
        title: "接口类型",
        width: 130,
        bind: { key: "mesApiType", data: [] }
      },
      {
        field: "isSuccess",
        title: "状态",
        width: 80,
        bind: { key: "mesApiStatus", data: [] }
      },
      {
        field: "requestJson",
        title: "请求内容",
        width: 200,
        formatter: (row) => {
          if (!row.requestJson) return '-';
          const preview = row.requestJson.length > 50
            ? row.requestJson.substring(0, 50) + '...'
            : row.requestJson;
          return `<span style="color: #409EFF; cursor: pointer;">${preview}</span>`;
        }
      },
      {
        field: "responseJson",
        title: "响应内容",
        width: 200,
        formatter: (row) => {
          if (!row.responseJson) return '-';
          const preview = row.responseJson.length > 50
            ? row.responseJson.substring(0, 50) + '...'
            : row.responseJson;
          return `<span style="color: #409EFF; cursor: pointer;">${preview}</span>`;
        }
      },
      { field: "errorMessage", title: "错误信息", width: 250 },
      { field: "elapsedMs", title: "耗时(ms)", width: 100, sortable: true },
      { field: "createDate", title: "调用时间", width: 160, sortable: true },
      { field: "creator", title: "操作人", width: 100 }
    ]);
 
    const detail = ref({
      cnName: "MES日志详情",
      columns: [],
      sortName: "Id",
      key: "Id"
    });
 
    const editFormFields = ref({});
    const editFormOptions = ref([]);
 
    const searchFormFields = ref({
      apiType: "",
      isSuccess: "",
      dateRange: "",
      creator: "",
      elapsedRange: "",
      errorKeyword: "",
      jsonKeyword: ""
    });
 
    const searchFormOptions = ref([
      [
        { field: "apiType", title: "接口类型", type: "select",dataKey: "mesApiType", data: [] },
        { field: "isSuccess", title: "状态", type: "select" ,dataKey: "mesApiStatus", data: []},
        { field: "dateRange", title: "时间范围", type: "datetimeRange" }
      ],
      [
        { field: "creator", title: "操作人", type: "text" },
        {
          field: "elapsedRange",
          title: "耗时范围(ms)",
          type: "numberRange",
          placeholder: ["最小", "最大"]
        }
      ],
      [
        { field: "errorKeyword", title: "错误关键字", type: "text" },
        { field: "jsonKeyword", title: "JSON内容关键字", type: "text" }
      ]
    ]);
 
    return {
      table,
      columns,
      detail,
      editFormFields,
      editFormOptions,
      searchFormFields,
      searchFormOptions,
      extend
    };
  }
});
</script>
 
<style scoped>
.mes-log-page {
  padding: 16px;
}
</style>