feat: 日志管理独立出来、增加登录日志界面 (#65)

This commit is contained in:
nsnail 2023-11-22 18:37:48 +08:00 committed by GitHub
parent 20195e7eaf
commit 9134c4fe01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 326 additions and 418 deletions

View File

@ -1,4 +1,5 @@
[
// ------------------------------ ------------------------------
{
"Component": "home",
"Icon": "el-icon-house",
@ -6,16 +7,17 @@
"Name": "home",
"Path": "/home",
"Sort": 100,
"Title": "面板",
"Title": "控面板",
"Type": 1
},
// ------------------------------ ------------------------------
{
"Icon": "el-icon-setting",
"Id": 373837917724677,
"Name": "sys",
"Path": "/sys",
"Sort": 99,
"Title": "系统管理",
"Name": "power",
"Path": "/power",
"Sort": 100,
"Title": "权限管理",
"Type": 1
},
{
@ -58,41 +60,18 @@
"Name": "sys-menu",
"ParentId": 373837917724677,
"Path": "/sys/menu",
"Sort": 96,
"Sort": 97,
"Title": "菜单管理",
"Type": 1
},
// ------------------------------ ------------------------------
{
"Component": "sys/log",
"Icon": "el-icon-tickets",
"Id": 374792687640581,
"Name": "sys-log",
"ParentId": 373837917724677,
"Path": "/sys/log",
"Sort": 93,
"Title": "请求日志",
"Type": 1
},
{
"Component": "sys/cache",
"Icon": "sc-icon-memory",
"Id": 374911555702789,
"Name": "sys-cache",
"ParentId": 373837917724677,
"Path": "/sys/cache",
"Sort": 94,
"Title": "缓存管理",
"Type": 1
},
{
"Component": "sys/dic",
"Icon": "sc-icon-dic",
"Id": 375315654221829,
"Name": "sys-dic",
"ParentId": 373837917724677,
"Path": "/sys/dic",
"Sort": 95,
"Title": "字典管理",
"Icon": "sc-icon-App",
"Id": 485278637670422,
"Name": "sys",
"Path": "/sys",
"Sort": 99,
"Title": "系统管理",
"Type": 1
},
{
@ -100,32 +79,21 @@
"Icon": "el-icon-set-up",
"Id": 380415005847557,
"Name": "sys-config",
"ParentId": 373837917724677,
"ParentId": 485278637670422,
"Path": "/sys/config",
"Sort": 92,
"Sort": 100,
"Title": "系统设置",
"Type": 1
},
{
"Component": "home/widgets/components/ver",
"Icon": "el-icon-pointer",
"Id": 480998862188554,
"Name": "sys-about",
"ParentId": 373837917724677,
"Path": "/sys/about",
"Sort": 91,
"Title": "版本信息",
"Type": 1,
},
{
"Component": "sys/api",
"Icon": "sc-icon-api",
"Id": 397880678895621,
"Name": "sys-api",
"ParentId": 373837917724677,
"Path": "/sys/api",
"Sort": 96,
"Title": "接口管理",
"Component": "sys/dic",
"Icon": "sc-icon-dic",
"Id": 375315654221829,
"Name": "sys-dic",
"ParentId": 485278637670422,
"Path": "/sys/dic",
"Sort": 99,
"Title": "字典管理",
"Type": 1
},
{
@ -133,12 +101,78 @@
"Icon": "el-icon-message",
"Id": 482779610341392,
"Name": "sys-msg",
"ParentId": 373837917724677,
"ParentId": 485278637670422,
"Path": "/sys/msg",
"Sort": 98,
"Title": "消息管理",
"Type": 1,
},
{
"Component": "sys/api",
"Icon": "sc-icon-api",
"Id": 397880678895621,
"Name": "sys-api",
"ParentId": 485278637670422,
"Path": "/sys/api",
"Sort": 97,
"Title": "接口管理",
"Type": 1
},
{
"Component": "sys/cache",
"Icon": "sc-icon-memory",
"Id": 374911555702789,
"Name": "sys-cache",
"ParentId": 485278637670422,
"Path": "/sys/cache",
"Sort": 96,
"Title": "缓存管理",
"Type": 1
},
{
"Component": "home/widgets/components/ver",
"Icon": "el-icon-pointer",
"Id": 480998862188554,
"Name": "sys-about",
"ParentId": 485278637670422,
"Path": "/sys/about",
"Sort": 95,
"Title": "版本信息",
"Type": 1,
},
// ------------------------------ ------------------------------
{
"Icon": "el-icon-tickets",
"Id": 374792687640581,
"Name": "log",
"Path": "/log",
"Sort": 98,
"Title": "日志管理",
"Type": 1
},
{
"Component": "sys/log/operation",
"Icon": "el-icon-pointer",
"Id": 485285246504976,
"Name": "sys-log-operation",
"ParentId": 374792687640581,
"Path": "/sys/log/operation",
"Sort": 100,
"Title": "操作日志",
"Type": 1,
},
{
"Component": "sys/log/login",
"Icon": "sc-icon-OpenDoor",
"Id": 485285246504970,
"Name": "sys-log-login",
"ParentId": 374792687640581,
"Path": "/sys/log/login",
"Sort": 99,
"Title": "登录日志",
"Type": 1,
},
// ------------------------------ ------------------------------
{
"Icon": "sc-icon-code",
"Id": 373838105399301,
@ -165,7 +199,7 @@
"Icon": "el-icon-eleme-filled",
"Name": "dev-element",
"Path": "https://element-plus.gitee.io/zh-CN/component/button.html",
"Sort": 100,
"Sort": 99,
"Title": "Element",
"Type": 3,
}

View File

@ -144,7 +144,7 @@ public sealed class DevService(IApiService apiService) : ServiceBase<DevService>
iconSelectContent = _regex2.Replace(iconSelectContent, "\"$1\":");
iconSelectContent = "{" + iconSelectContent + "}";
var iconExportJsInfo = iconSelectContent.ToObject<IconExportJsInfo>();
iconExportJsInfo.ExportDefault.Icons.Last().Icons.Add($"sc-icon-{req.IconName.ToLowerInvariant()}");
iconExportJsInfo.ExportDefault.Icons.Last().Icons.Add($"sc-icon-{req.IconName}");
var newContent = iconExportJsInfo.ToJson().TrimStart('{')[..^1].Replace("\"exportDefault\":", "export default");
await File.WriteAllTextAsync(iconSelectFile, newContent).ConfigureAwait(false);

View File

@ -28,7 +28,7 @@ public sealed class OperationLogger : IEventSubscriber
CreateRequestLogReq logReq = null;
// 登录日志特殊处理
if (operationEvent.Data.ApiId.Equals("api/user/login", StringComparison.OrdinalIgnoreCase)) {
if (operationEvent.Data.ApiId.Equals("api/sys/user/login.by.pwd", StringComparison.OrdinalIgnoreCase)) {
try {
var loginReq = operationEvent.Data.RequestBody.ToObject<LoginByPwdReq>();
logReq = operationEvent.Data with { ExtraData = loginReq.Account };

View File

@ -0,0 +1,7 @@
<template>
<svg t="1700643247048" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5913" width="128" height="128">
<path
d="M957.6 872l-432-736c-3.2-5.6-8.8-8-13.6-8s-10.4 2.4-13.6 8l-432 736c-6.4 10.4 1.6 24 13.6 24h864c12 0 20-13.6 13.6-24z m-793.6-40L512 239.2l348 592.8h-696zM480 704h64v64h-64v-64z m0-320h64v256h-64V384z"
p-id="5914"></path>
</svg>
</template>

View File

@ -0,0 +1,7 @@
<template>
<svg t="1700287923195" class="icon" viewBox="0 0 1159 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7208" width="128" height="128">
<path
d="M375.432019 950.647918H139.942526a65.628219 65.628219 0 0 1-66.59334-63.697977V137.051024a64.663098 64.663098 0 0 1 66.59334-63.697977h669.793885a64.663098 64.663098 0 0 1 66.59334 63.697977V289.540122a38.604835 38.604835 0 0 0 0 14.476813l7.720967 11.58145a37.639714 37.639714 0 0 0 40.535076 7.720967l11.581451-7.720967A37.639714 37.639714 0 0 0 949.678937 289.540122V137.051024A138.977405 138.977405 0 0 0 809.736411 0.00386H139.942526A138.977405 138.977405 0 0 0 0 137.051024v749.898917a138.977405 138.977405 0 0 0 139.942526 137.047164h235.489493a38.604835 38.604835 0 0 0 26.058263-10.61633 37.639714 37.639714 0 0 0 0-52.116527 38.604835 38.604835 0 0 0-26.058263-10.61633zM691.026544 289.540122a39.569956 39.569956 0 0 0-36.674593-39.569956H216.187075a39.569956 39.569956 0 0 0-36.674593 39.569956 38.604835 38.604835 0 0 0 36.674593 38.604835h438.164876a38.604835 38.604835 0 0 0 36.674593-38.604835zM216.187075 482.564296a39.569956 39.569956 0 0 0 0 79.139911h289.536261a39.569956 39.569956 0 0 0 0-79.139911z m219.082438 226.803405H216.187075a40.535077 40.535077 0 0 0-36.674593 40.535076 39.569956 39.569956 0 0 0 36.674593 39.569956h219.082438a39.569956 39.569956 0 0 0 36.674593-39.569956 40.535077 40.535077 0 0 0-36.674593-40.535076zM1147.528716 868.612644L895.632168 428.517527a86.860878 86.860878 0 0 0-146.698372 0L497.037249 868.612644a80.105032 80.105032 0 0 0-14.476813 38.604835 84.930637 84.930637 0 0 0 11.58145 42.465319 96.512087 96.512087 0 0 0 30.883868 30.883867 85.895758 85.895758 0 0 0 43.430439 11.581451h502.827974a85.895758 85.895758 0 0 0 86.860878-84.930637 80.105032 80.105032 0 0 0-10.616329-38.604835zM801.050323 796.228579h-8.686088a8.686088 8.686088 0 0 1 0-6.755846v-173.721757a7.720967 7.720967 0 0 1 7.720967 0h39.569956a9.651209 9.651209 0 0 1 8.686088 0v171.791515H839.655158z m0 37.639714h44.39556a18.337297 18.337297 0 0 1 0 9.651209V868.612644a18.337297 18.337297 0 0 1 0 9.651209 11.58145 11.58145 0 0 1-8.686088 0h-36.674593a8.686088 8.686088 0 0 1-7.720967 0 18.337297 18.337297 0 0 1 0-9.651209v-21.232659a18.337297 18.337297 0 0 1 0-9.651208z"
p-id="7209"></path>
</svg>
</template>

View File

@ -0,0 +1,7 @@
<template>
<svg t="1700642583398" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6047" width="128" height="128">
<path
d="M830.4 513.6C786.4 469.6 729.6 448 672 448c-48.8 0-96.8 16-136.8 47.2L277.6 237.6 384 131.2l-29.6-29.6L224 184 128.8 88.8l-44 44 406.4 406.4c-64.8 88-56.8 212 22.4 291.2 44 44 100.8 65.6 158.4 65.6s114.4-21.6 158.4-65.6c87.2-87.2 87.2-229.6 0-316.8z m-45.6 271.2c-30.4 30.4-70.4 47.2-112.8 47.2-42.4 0-83.2-16.8-112.8-47.2-62.4-62.4-62.4-164 0-226.4C588.8 528.8 629.6 512 672 512s83.2 16.8 112.8 47.2c62.4 62.4 62.4 163.2 0 225.6z"
p-id="6048"></path>
</svg>
</template>

View File

@ -0,0 +1,7 @@
<template>
<svg t="1700278692453" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7645" width="128" height="128">
<path
d="M341.764096 68.266667h682.666667v136.533333H341.764096zM341.764096 443.733333h682.666667v136.533334H341.764096zM341.764096 819.2h682.666667v136.533333H341.764096zM111.022763 223.914667h-32.085334V0h32.085334zM189.529429 445.098667a57.344 57.344 0 0 1-22.528 49.834666 80.554667 80.554667 0 0 1-50.517333 14.336H68.697429a43.690667 43.690667 0 0 0-29.354666 6.826667 43.690667 43.690667 0 0 0-6.826667 30.037333v32.085334h154.282667V614.4H0.430763V546.133333a61.44 61.44 0 0 1 68.266666-68.266666h47.786667c27.306667 0 40.96-10.24 40.96-32.085334a23.210667 23.210667 0 0 0-10.24-18.432 44.373333 44.373333 0 0 0-26.624-8.192H0.430763v-32.085333h120.149333a79.189333 79.189333 0 0 1 45.056 12.970667 52.565333 52.565333 0 0 1 23.893333 45.056zM186.798763 955.733333a58.709333 58.709333 0 0 1-22.528 49.834667 77.141333 77.141333 0 0 1-49.152 15.701333H7.257429v-32.085333h106.496c26.624 0 40.277333-10.922667 40.277334-33.450667s-15.018667-34.133333-44.373334-34.133333H8.622763v-32.085333h105.130666c25.941333 0 38.912-10.922667 38.912-32.085334s-12.970667-27.989333-37.546666-27.989333H0.430763v-32.085333h114.688a73.728 73.728 0 0 1 42.325333 10.922666 51.882667 51.882667 0 0 1 27.306667 49.152 58.026667 58.026667 0 0 1-21.845334 49.152 51.882667 51.882667 0 0 1 23.893334 49.152z"
p-id="7646"></path>
</svg>
</template>

View File

@ -0,0 +1,7 @@
<template>
<svg t="1700287773746" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5124" width="128" height="128">
<path
d="M136.3 410.2h70v150.2h-70zM206.3 851.3V733.8h-70v117.5c0 40.7 31.5 73.9 70.2 73.9h206.1v-70H207.5c-0.5-0.6-1.2-1.9-1.2-3.9zM206.3 139c0-2 0.7-3.3 1.1-3.9h619.8c0.5 0.6 1.1 1.8 1.1 3.9v151.1h70V139c0-40.7-31.5-73.9-70.2-73.9H206.5c-38.7 0-70.2 33.1-70.2 73.9v97.9h70V139zM886.8 677.2c-20-20-43-35.9-68-47.2 19.2-22.2 30.9-51.2 30.9-82.8 0-69.9-56.8-126.7-126.7-126.7s-126.7 56.8-126.7 126.7c0 31.6 11.7 60.6 30.9 82.8-25 11.4-48 27.2-68 47.2-43.8 43.8-67.9 101.9-67.9 163.8 0 6.1 0.2 12.2 0.7 18.2l69.8-5.5c-0.3-4.2-0.5-8.5-0.5-12.7 0-89.1 72.5-161.6 161.6-161.6S884.6 751.9 884.6 841c0 4.3-0.2 8.6-0.5 12.7l69.8 5.5c0.5-6 0.7-12.1 0.7-18.2 0-61.9-24.1-120-67.8-163.8zM723 490.5c31.3 0 56.7 25.4 56.7 56.7s-25.4 56.7-56.7 56.7-56.7-25.4-56.7-56.7 25.4-56.7 56.7-56.7zM93.9 288.5h154.8v70H93.9zM93.9 612.1h154.8v70H93.9z"
p-id="5125"></path>
</svg>
</template>

View File

@ -0,0 +1,10 @@
<template>
<svg t="1700643176982" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4094" width="128" height="128">
<path
d="M532.168854 539.929096h1.786692c15.748682 0 28.607548-12.809747 28.67918-28.559453 0.071631-15.821337-12.738116-28.739555-28.67918-28.811186-15.748682 0-28.607548 12.809747-28.679179 28.702716-0.071631 15.246239 11.874445 27.805276 26.892487 28.667923z"
p-id="4095"></path>
<path
d="M836.160379 19.661805H187.826318c-26.568099 0-43.732014 17.253966-43.732014 43.954071V895.28343c0 7.064906 7.994068 14.993482 15.784498 19.155269l496.746598 89.899496h4.989641c11.574616 0 18.771529-7.245008 18.771529-18.891256v-76.286454h155.786089c26.568099 0 43.732014-17.247826 43.732014-43.947931V63.615876C879.893416 36.915771 862.728478 19.661805 836.160379 19.661805zM642.795417 962.656887l-461.10996-82.36694V78.645175c0-8.438183 2.704598-11.142781 11.131525-11.142782h0.551562l449.426873 81.161485v813.993009z m199.506846-91.387384H680.38657V133.778866c0-7.100722-7.988951-15.041578-15.773242-19.179828L411.165965 69.661569l-56.746421-12.186553h487.882719v813.794487z"
p-id="4096"></path>
</svg>
</template>

View File

@ -0,0 +1,13 @@
<template>
<svg t="1700287474570" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4076" width="128" height="128">
<path
d="M758.969877 1017.428352H58.739777a35.205133 35.205133 0 0 1-35.205134-35.205134V154.902586a35.205133 35.205133 0 0 1 35.205134-35.205133h700.2301a35.205133 35.205133 0 0 1 35.205134 35.205133v177.609898a35.205133 35.205133 0 0 1-70.410267 0V190.10772H93.94491v756.910365h629.819834V805.376099a35.205133 35.205133 0 0 1 70.410267 0V982.223218a35.205133 35.205133 0 0 1-35.205134 35.205134z"
p-id="4077"></path>
<path
d="M503.321935 70.410267v45.766673h-188.934216V70.410267h188.934216m0-70.410267h-188.934216a70.410267 70.410267 0 0 0-70.410266 70.410267v45.766673a70.410267 70.410267 0 0 0 70.410266 70.410266h188.934216a70.410267 70.410267 0 0 0 70.410266-70.410266V70.410267a70.410267 70.410267 0 0 0-70.410266-70.410267zM402.400553 428.329122h-199.495756a35.205133 35.205133 0 1 1 0-70.410267h199.495756a35.205133 35.205133 0 0 1 0 70.410267zM369.542428 603.181283h-166.637631a35.205133 35.205133 0 0 1 0-70.410266h166.637631a35.205133 35.205133 0 0 1 0 70.410266zM627.713406 778.033445h-424.808609a35.205133 35.205133 0 0 1 0-70.410266h424.808609a35.205133 35.205133 0 0 1 0 70.410266z"
p-id="4078"></path>
<path
d="M893.488692 1023.999977a107.187896 107.187896 0 0 1-96.415125-60.200778l-82.473893-169.137196h-3.344487a251.787113 251.787113 0 0 1-225.993486-141.219524 249.275814 249.275814 0 0 1-21.017464-157.00316 253.383079 253.383079 0 0 1 74.482327-136.04437 35.205133 35.205133 0 0 1 55.788401 10.197754L663.094564 511.272416l52.479119-25.582397L646.947143 345.010306a35.205133 35.205133 0 0 1 26.33344-50.237725 253.559105 253.559105 0 0 1 153.09539 25.12473 249.240609 249.240609 0 0 1 110.731879 113.278384 251.810583 251.810583 0 0 1-30.006509 267.641158l82.509098 169.184136a107.070545 107.070545 0 0 1-96.121749 153.998988zM735.933985 722.855266a35.205133 35.205133 0 0 1 31.625945 19.785285l92.800731 190.354156a36.672014 36.672014 0 0 0 65.88054-32.130552l-92.706851-190.36589a35.205133 35.205133 0 0 1 6.571625-40.145587 181.200821 181.200821 0 0 0 33.761722-206.325551 180.097727 180.097727 0 0 0-139.377122-100.31116l59.848726 122.7603a35.205133 35.205133 0 0 1-16.217831 47.080998l-115.766213 56.433829a35.205133 35.205133 0 0 1-47.092734-16.217832l-59.848726-122.795505a181.118676 181.118676 0 0 0 176.471598 272.11221 36.378638 36.378638 0 0 1 4.04859-0.234701z"
p-id="4079"></path>
</svg>
</template>

View File

@ -1,15 +1,8 @@
<template>
<svg
class="icon"
height="200"
p-id="17682"
t="1679305285460"
version="1.1"
viewBox="0 0 1024 1024"
width="200"
xmlns="http://www.w3.org/2000/svg">
<svg t="1700642629058" class="icon" viewBox="0 0 1333 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7944" width="128" height="128">
<path
d="M830.4 513.6c-72-72-180-84.8-264.8-38.4L335.2 244.8 448 132l-45.6-45.6-144.8 80.8L154.4 64 64 154.4l411.2 411.2c-45.6 84.8-32.8 192.8 38.4 264.8 87.2 87.2 229.6 87.2 316.8 0 88-87.2 88-228.8 0-316.8zM740 740c-37.6 37.6-98.4 37.6-136 0s-37.6-98.4 0-136 98.4-37.6 136 0 37.6 98.4 0 136z"
p-id="17683"></path>
d="M 1101.48 342.52 a 155.844 155.844 0 1 0 -226.753 0 a 244.675 244.675 0 0 0 -53.7662 38.1818 A 197.922 197.922 0 0 0 484.34 373.688 a 243.896 243.896 0 0 0 -63.1169 -48.3117 a 155.844 155.844 0 1 0 -226.753 0 A 245.454 245.454 0 0 0 62.003 544.337 a 38.961 38.961 0 0 0 77.9221 0 a 168.311 168.311 0 0 1 298.441 -105.974 a 38.1818 38.1818 0 0 0 17.1428 13.2468 a 190.909 190.909 0 0 0 66.2337 180.78 a 319.48 319.48 0 0 0 -189.351 290.649 a 38.961 38.961 0 0 0 77.9221 0 a 241.559 241.559 0 0 1 482.337 0 a 38.961 38.961 0 0 0 77.9221 0 a 319.48 319.48 0 0 0 -189.351 -290.649 a 197.922 197.922 0 0 0 69.3506 -149.61 a 196.363 196.363 0 0 0 0 -28.052 a 37.4026 37.4026 0 0 0 17.922 -10.1299 a 166.753 166.753 0 0 1 123.117 -52.9869 A 168.311 168.311 0 0 1 1152.9 559.143 a 38.961 38.961 0 0 0 77.9221 0 a 245.454 245.454 0 0 0 -129.351 -216.623 Z M 308.236 295.767 a 77.9221 77.9221 0 1 1 77.9221 -77.9221 a 77.9221 77.9221 0 0 1 -77.9221 77.9221 Z m 342.857 311.688 a 120.779 120.779 0 1 1 121.558 -124.675 A 121.558 121.558 0 0 1 651.093 607.454 Z m 336.623 -290.649 a 77.9221 77.9221 0 1 1 77.9221 -77.9221 a 77.9221 77.9221 0 0 1 -77.9221 74.8052 Z"
fill="#666666"
p-id="7945"></path>
</svg>
</template>

View File

@ -45,4 +45,11 @@ export { default as ProductCategory } from './ProductCategory.vue'
export { default as Product } from './Product.vue'
export { default as Error } from './Error.vue'
export { default as Warning } from './Warning.vue'
export { default as Stats } from './Stats.vue'
export { default as Stats } from './Stats.vue'
export { default as Log } from './Log.vue'
export { default as OperLog } from './OperLog.vue'
export { default as LoginLog } from './LoginLog.vue'
export { default as ExLog } from './ExLog.vue'
export { default as Key } from './Key.vue'
export { default as OpenDoor } from './OpenDoor.vue'
export { default as Alert } from './Alert.vue'

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,158 @@
<template>
<el-container>
<el-main class="nopadding">
<el-container>
<el-header>
<div class="left-panel">
<na-search
ref="search"
:controls="[
{
type: 'select',
field: ['dy', 'httpStatusCode'],
options: [
{ label: '成功', value: '200,299' },
{ label: '失败', value: '300,999' },
],
placeholder: '登录结果',
},
{
type: 'input',
field: ['dy', 'extraData'],
placeholder: '登录名',
},
{
type: 'input',
field: ['dy', 'createdClientIp'],
placeholder: 'IP地址',
},
]"
:vue="this"
@search="onSearch" />
</div>
<div class="right-panel"></div>
</el-header>
<el-main class="nopadding">
<sc-table
ref="table"
:apiObj="$API.sys_log.pagedQuery"
:default-sort="{ prop: 'createdTime', order: 'descending' }"
:params="query"
remoteFilter
remoteSort
stripe
@row-click="rowClick">
<el-table-column :label="$t('日志编号')" prop="id" sortable="custom"></el-table-column>
<el-table-column :label="$t('日志时间')" prop="createdTime" sortable="custom"></el-table-column>
<el-table-column :label="$t('结果')" prop="httpStatusCode" sortable="custom">
<template #default="scope">
<sc-status-indicator :type="scope.row.httpStatusCode === 200 ? 'success' : 'danger'" />
{{ scope.row.httpStatusCode === 200 ? '成功' : '失败' }}
</template>
</el-table-column>
<el-table-column :label="$t('登录名')" prop="extraData" sortable="custom"> </el-table-column>
<el-table-column :label="$t('IP地址')" prop="createdClientIp" sortable="custom"></el-table-column>
<el-table-column :label="$t('操作系统')" prop="os" sortable="custom"></el-table-column>
<el-table-column
:label="$t('用户代理')"
prop="createdUserAgent"
sortable="custom"
show-overflow-tooltip
min-width="200"></el-table-column>
</sc-table>
</el-main>
</el-container>
</el-main>
</el-container>
<na-info v-if="dialog.info" ref="info"></na-info>
</template>
<script>
import naInfo from '@/components/naInfo/index.vue'
import tool from '@/utils/tool'
import ScTable from '@/components/scTable/index.vue'
export default {
components: {
ScTable,
naInfo,
},
watch: {},
data() {
return {
query: {
dynamicFilter: {
filters: [],
},
filter: {},
},
dialog: {
info: false,
},
}
},
mounted() {
this.$refs.search.form.dy.apiId = 'api/sys/user/login.by.pwd'
},
created() {
this.query.dynamicFilter.filters.push({
field: 'apiId',
operator: 'eq',
value: 'api/sys/user/login.by.pwd',
})
},
methods: {
//
onSearch(form) {
if (Array.isArray(form.dy.createdTime)) {
this.query.dynamicFilter.filters.push({
field: 'createdTime',
operator: 'dateRange',
value: form.dy.createdTime,
})
}
if (form.dy.httpStatusCode) {
this.query.dynamicFilter.filters.push({
field: 'httpStatusCode',
operator: 'range',
value: form.dy.httpStatusCode,
})
}
if (form.dy.apiId) {
this.query.dynamicFilter.filters.push({
field: 'apiId',
operator: 'contains',
value: form.dy.apiId,
})
}
if (form.dy.extraData) {
this.query.dynamicFilter.filters.push({
field: 'extraData',
operator: 'contains',
value: form.dy.extraData,
})
}
if (form.dy.createdClientIp) {
this.query.dynamicFilter.filters.push({
field: 'createdClientIp',
operator: 'contains',
value: form.dy.createdClientIp,
})
}
this.$refs.table.upData()
},
async rowClick(row) {
this.dialog.info = true
await this.$nextTick()
const res = await this.$API.sys_log.query.post({
filter: { id: row.id },
})
this.$refs.info.open(tool.sortProperties(res.data[0]), `日志详情:${row.id}`)
},
},
}
</script>
<style scoped></style>

View File

@ -89,9 +89,11 @@
<script>
import naInfo from '@/components/naInfo/index.vue'
import tool from '@/utils/tool'
import ScTable from '@/components/scTable/index.vue'
export default {
components: {
ScTable,
naInfo,
},
watch: {},