Skip to content

Commit 4f06cfe

Browse files
committed
feat: Add Operate Log
1 parent 8b52927 commit 4f06cfe

File tree

10 files changed

+470
-33
lines changed

10 files changed

+470
-33
lines changed

ui/src/api/operate-log.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { Result } from '@/request/Result'
2+
import { get } from '@/request/index'
3+
import type { pageRequest } from '@/api/type/common'
4+
import { type Ref } from 'vue'
5+
6+
const prefix = '/operate_log'
7+
/**
8+
* 日志分页列表
9+
* @param 参数
10+
* page {
11+
"current_page": "string",
12+
"page_size": "string",
13+
}
14+
* @query 参数
15+
param: any
16+
*/
17+
const getOperateLog: (
18+
page: pageRequest,
19+
param: any,
20+
loading?: Ref<boolean>
21+
) => Promise<Result<any>> = (page, param, loading) => {
22+
return get(`${prefix}/${page.current_page}/${page.page_size}`, param, loading)
23+
}
24+
25+
export default {
26+
getOperateLog
27+
}

ui/src/locales/lang/en-US/views/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import problem from './problem'
1313
import log from './log'
1414
import applicationWorkflow from './application-workflow'
1515
import login from './login'
16+
import operateLog from './operate-log'
1617
export default {
1718
notFound,
1819
application,
@@ -28,5 +29,6 @@ export default {
2829
paragraph,
2930
problem,
3031
log,
31-
login
32+
login,
33+
operateLog
3234
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
export default {
2+
title: 'Operate Logs',
3+
table: {
4+
menu: {
5+
label: 'Operate menu'
6+
},
7+
operate: {
8+
label: 'Operate'
9+
},
10+
user: {
11+
label: 'Operate user'
12+
},
13+
status: {
14+
label: 'Status',
15+
success: 'Successed',
16+
fail: 'Failed',
17+
all: 'All'
18+
},
19+
ip_address: {
20+
label: 'IP Address'
21+
},
22+
opt: {
23+
label: 'API Details'
24+
},
25+
operateTime: {
26+
label: 'Operate Time'
27+
}
28+
},
29+
close: 'Close'
30+
}
Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,34 @@
1-
import notFound from './404';
2-
import application from './application';
3-
import applicationOverview from './application-overview';
4-
import dataset from './dataset';
5-
import system from './system';
6-
import functionLib from './function-lib';
7-
import user from './user';
8-
import team from './team';
9-
import template from './template';
10-
import document from './document';
11-
import paragraph from './paragraph';
12-
import problem from './problem';
13-
import log from './log';
14-
import applicationWorkflow from './application-workflow';
15-
import login from './login';
1+
import notFound from './404'
2+
import application from './application'
3+
import applicationOverview from './application-overview'
4+
import dataset from './dataset'
5+
import system from './system'
6+
import functionLib from './function-lib'
7+
import user from './user'
8+
import team from './team'
9+
import template from './template'
10+
import document from './document'
11+
import paragraph from './paragraph'
12+
import problem from './problem'
13+
import log from './log'
14+
import applicationWorkflow from './application-workflow'
15+
import login from './login'
16+
import operateLog from './operate-log'
1617
export default {
17-
notFound,
18-
application,
19-
applicationOverview,
20-
dataset,
21-
system,
22-
functionLib,
23-
user,
24-
team,
25-
template,
26-
document,
27-
paragraph,
28-
problem,
29-
log,
30-
applicationWorkflow,
31-
login
32-
};
18+
notFound,
19+
application,
20+
applicationOverview,
21+
dataset,
22+
system,
23+
functionLib,
24+
user,
25+
team,
26+
template,
27+
document,
28+
paragraph,
29+
problem,
30+
log,
31+
applicationWorkflow,
32+
login,
33+
operateLog
34+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
export default {
2+
title: '操作日志',
3+
table: {
4+
menu: {
5+
label: '操作菜单'
6+
},
7+
operate: {
8+
label: '操作'
9+
},
10+
user: {
11+
label: '操作用户'
12+
},
13+
status: {
14+
label: '状态',
15+
success: '成功',
16+
fail: '失败',
17+
all: '全部'
18+
},
19+
ip_address: {
20+
label: 'IP地址'
21+
},
22+
opt: {
23+
label: 'API详情'
24+
},
25+
operateTime: {
26+
label: '操作时间'
27+
}
28+
},
29+
close: '关闭'
30+
}

ui/src/locales/lang/zh-Hant/views/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import problem from './problem'
1313
import log from './log'
1414
import applicationWorkflow from './application-workflow'
1515
import login from './login'
16+
import operateLog from './operate-log'
1617
export default {
1718
notFound,
1819
application,
@@ -28,5 +29,6 @@ export default {
2829
paragraph,
2930
problem,
3031
log,
31-
login
32+
login,
33+
operateLog
3234
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
export default {
2+
title: '操作日誌',
3+
table: {
4+
menu: {
5+
label: '操作菜單'
6+
},
7+
operate: {
8+
label: '操作'
9+
},
10+
user: {
11+
label: '操作用戶'
12+
},
13+
status: {
14+
label: '狀態',
15+
success: '成功',
16+
fail: '失敗',
17+
all: '全部'
18+
},
19+
ip_address: {
20+
label: 'IP地址'
21+
},
22+
opt: {
23+
label: 'API詳情'
24+
},
25+
operateTime: {
26+
label: '操作時間'
27+
}
28+
},
29+
close: '關閉'
30+
}

ui/src/router/modules/setting.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,20 @@ const settingRouter = {
103103
component: () => import('@/views/email/index.vue')
104104
}
105105
]
106+
},
107+
{
108+
path: '/operate',
109+
name: 'operate',
110+
meta: {
111+
icon: 'app-document',
112+
iconActive: 'app-document-active',
113+
title: 'views.operateLog.title',
114+
activeMenu: '/setting',
115+
parentPath: '/setting',
116+
parentName: 'setting',
117+
permission: new ComplexPermission(['ADMIN'], ['x-pack'], 'AND')
118+
},
119+
component: () => import('@/views/operate-log/index.vue')
106120
}
107121
]
108122
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<template>
2+
<el-dialog
3+
:title="$t('views.operateLog.table.opt.label')"
4+
v-model="dialogVisible"
5+
:close-on-click-modal="false"
6+
:close-on-press-escape="false"
7+
>
8+
<el-scrollbar height="400" class="details">
9+
<div class="content">{{ details }}</div>
10+
</el-scrollbar>
11+
<template #footer>
12+
<span class="dialog-footer">
13+
<el-button @click.prevent="dialogVisible = false">
14+
{{ $t('views.operateLog.close') }}
15+
</el-button>
16+
</span>
17+
</template>
18+
</el-dialog>
19+
</template>
20+
<script setup lang="ts">
21+
import { ref } from 'vue'
22+
const dialogVisible = ref<boolean>(false)
23+
const details = ref<string>()
24+
25+
const open = (data: any) => {
26+
details.value = JSON.stringify(data.details, null, 4)
27+
dialogVisible.value = true
28+
}
29+
30+
defineExpose({ open })
31+
</script>
32+
<style lang="scss" scoped>
33+
.details {
34+
margin: 0 10px 30px;
35+
border: 1px #cccccc solid;
36+
.content {
37+
padding: 10px 20px;
38+
white-space: pre-wrap;
39+
}
40+
}
41+
</style>

0 commit comments

Comments
 (0)