sysInterfacelog.js
6.36 KB
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
150
151
152
153
154
155
156
157
158
159
160
161
let action = null;
layui.config({
base: "/js/",
version: 33
}).use(['system'], function () {
var form = layui.form,
$ = layui.jquery,
system = layui.system,
table = layui.table,
u = new system.u(),
element = layui.element,
sendDataWhere = { responseNo200: "httpNo200" },
areaName = 'Log',
tableName = 'Logs';
action = {
queryOptions: function () {
var options = {
resetFrom: "form[lay-filter=listForm]",
fromId: "listForm",
urlQuery: `/${areaName}/${tableName}/LoadSysInterLog`,
sendDataWhere: sendDataWhere,
mainTable: app.data.tableIns
}
return options;
},
queryOptionsDesc: function () {
var options = {
resetFrom: "form[lay-filter=listFormDesc]",
fromId: "listFormDesc",
urlQuery: `/${areaName}/${tableName}/LoadSysInterLog`,
mainTable: app.data.tableInsDesc,
sendDataWhere: null,
isAddWhereExtend: "arbitrarily"
}
return options;
},
//所有动作成功之后
actionSuccess: (flag, toolbarId) => {
var data = sendDataWhere;
if (flag.includes("Desc")) {
data = {};
}
u.refreshTable(app, u, data, flag);
}
}
var app = {
data: {
cols: [
[
{ field: 'id', width: 80, hide: true, title: 'Id' },
{ field: 'type', width: 180, title: '类型:接收/发送' },
{ field: 'system', width: 120, hide: true, title: '系统' },
{ field: 'path', width: 240, title: '路径' },
{ field: 'method', width: 100, title: '方法' },
{ field: 'request', width: 500, title: '请求', },
{ field: 'response', width: 400, title: '响应' },
{ field: 'totalMilliseconds', width: 100, title: '耗时(秒)' },
{ field: 'logTime', width: 150, title: '日志时间' },
{ field: 'actionName', width: 400, title: '调用方法' },
{ field: 'server', width: 150, title: '服务器' },
{ field: 'queryString', width: 150, title: '查询字符串' },
{ field: 'apiGroup', width: 150, title: 'Api控制器' },
{ field: 'name', width: 150, title: '用户名' },
{ field: 'ip', width: 150, title: 'Ip地址' },
{ field: 'browser', width: 150, title: '浏览器' },
{ field: 'result', width: 150, title: '结果' },
{ field: 'flag', width: 150, title: '重发标识' },
{ field: 'createTime', width: 150, title: '创建时间' },
{ field: 'createBy', width: 150, title: '创建用户' }
]
],
tableIns: null,
tableInsDesc: null,
tableElem: "mainList",
tableElemDesc: "mainListDesc",
selectOption: {
type: {
SelType: "key",
SelValue: "key",
SelFrom: "dataSource",
Dom: [$("select[name='type']")],
dataSource: u.sysEnumData.EnumLog,
},
//返回的数据 用于后续操作
selectData: {
}
}
},
methods: {
initTable: function (opt) {
var config = {};
if (opt != undefined) $.extend(config, opt);
let options = {
elem: "#" + app.data.tableElem,
url: `/${areaName}/${tableName}/LoadSysInterLog`,
cols: u.columnRecord(app.data.tableElem, app.data.cols),
toolbar: '#toolbarTable',
height: "full-56",
where: config,
doneExtend: function (res, obj) {
app.methods.initJsonViewer($("div[lay-id=mainList] tr td"));
}
}
app.data.tableIns = u.initTable(options);
},
initTableDesc: function (obj) {
let opt = {
elem: "#" + app.data.tableElemDesc,
url: `/${areaName}/${tableName}/LoadSysInterLog`,
cols: u.columnRecord(app.data.tableElem, app.data.cols),
toolbar: '#toolbarTableDesc',
height: "full-56",
doneExtend: function (res, obj) {
app.methods.initJsonViewer($("div[lay-id=mainListDesc] tr td"));
}
}
app.data.tableInsDesc = u.initTable(opt);
},
initJsonViewer($ele) {
$ele.click(function () {
var rendererEle = $(u.getParentElemId("json-renderer"));
var jsonValEle = $(u.getParentElemId("sys-json-val"));
var celVal = this.textContent;
jsonValEle.val(celVal);
$(u.getParentElemId("sys-drawer-conent")).show("fast");
try {
var celValEval = eval('(' + celVal + ')');
}
catch (error) {
rendererEle.text(celVal);
return;
}
rendererEle.jsonViewer(celValEval);
})
},
initFrom: function () {
debugger
u.initSelecteByEnum(app.data.selectOption);
u.tabClick("tableTabBody");
}
},
registerEvent: function () {
//layer.msg("表格列【请求、响应】等文本展开后,可双击鼠标左键全选文本值!", { icon: u.config.iconoOk, shade: 0.4, time: u.config.msgOpenTime });
},
init: function () {
var dataWhere = form.val("listForm")
dataWhere["responseNo200"] = "httpNo200";
app.methods.initTable(dataWhere);
app.methods.initTableDesc();
app.methods.initFrom();
app.registerEvent();
}
};
app.init();
});