mirror of
https://github.com/certd/certd.git
synced 2026-07-13 00:37:36 +08:00
feat: 支持审计日志,操作日志
This commit is contained in:
@@ -19,7 +19,6 @@ import sysauthority from "./certd/sys-authority";
|
||||
import syscname from "./certd/sys-cname";
|
||||
import tutorial from "./certd/tutorial";
|
||||
import cron from "./certd/cron";
|
||||
import audit from "./certd/audit";
|
||||
|
||||
// Note: @ is reserved in locale messages; use {'@'} when needed.
|
||||
export default {
|
||||
@@ -44,5 +43,4 @@ export default {
|
||||
...syscname,
|
||||
...tutorial,
|
||||
...cron,
|
||||
...audit,
|
||||
};
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
export default {
|
||||
"certd.auditLog": "Audit Log",
|
||||
"certd.sysResources.auditLog": "Audit Log",
|
||||
};
|
||||
@@ -18,6 +18,7 @@ export default {
|
||||
openKey: "Open API Key",
|
||||
notification: "Notification Settings",
|
||||
siteMonitorSetting: "Site Monitor Settings",
|
||||
auditLog: "Audit Log",
|
||||
userSecurity: "Security Settings",
|
||||
userProfile: "Account Info",
|
||||
userGrant: "Grant Delegation",
|
||||
@@ -67,6 +68,7 @@ export default {
|
||||
projectJoin: "Join Project",
|
||||
currentProject: "Current Project",
|
||||
projectMemberManager: "Project Member",
|
||||
auditLog: "Audit Log",
|
||||
domainMonitorSetting: "Domain Monitor Settings",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -19,7 +19,6 @@ import sysauthority from "./certd/sys-authority";
|
||||
import syscname from "./certd/sys-cname";
|
||||
import tutorial from "./certd/tutorial";
|
||||
import cron from "./certd/cron";
|
||||
import audit from "./certd/audit";
|
||||
|
||||
// Note: @ is reserved in locale messages; use {'@'} when needed.
|
||||
export default {
|
||||
@@ -44,5 +43,4 @@ export default {
|
||||
...syscname,
|
||||
...tutorial,
|
||||
...cron,
|
||||
...audit,
|
||||
};
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
export default {
|
||||
"certd.auditLog": "操作日志",
|
||||
"certd.sysResources.auditLog": "操作日志",
|
||||
};
|
||||
@@ -18,6 +18,7 @@ export default {
|
||||
openKey: "开放接口密钥",
|
||||
notification: "通知设置",
|
||||
siteMonitorSetting: "站点监控设置",
|
||||
auditLog: "操作日志",
|
||||
userSecurity: "认证安全设置",
|
||||
userProfile: "账号信息",
|
||||
userGrant: "授权委托",
|
||||
@@ -67,6 +68,7 @@ export default {
|
||||
projectJoin: "加入项目",
|
||||
currentProject: "当前项目",
|
||||
projectMemberManager: "项目成员管理",
|
||||
auditLog: "审计日志",
|
||||
domainMonitorSetting: "域名监控设置",
|
||||
jobHistory: "监控执行记录",
|
||||
},
|
||||
|
||||
@@ -296,6 +296,11 @@ export const certdResources = [
|
||||
icon: "ion:document-text-outline",
|
||||
auth: true,
|
||||
keepAlive: true,
|
||||
isMenu: true,
|
||||
show: () => {
|
||||
const settingStore = useSettingStore();
|
||||
return settingStore.isPlus;
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -417,9 +417,13 @@ export const sysResources = [
|
||||
component: "/sys/audit/index.vue",
|
||||
meta: {
|
||||
icon: "ion:document-text-outline",
|
||||
permission: "sys:settings:view",
|
||||
keepAlive: true,
|
||||
auth: true,
|
||||
isMenu: true,
|
||||
show: () => {
|
||||
const settingStore = useSettingStore();
|
||||
return settingStore.isPlus;
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import { CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, UserPageQuery, UserPageRes, dict } from "@fast-crud/fast-crud";
|
||||
import { useI18n } from "/src/locales";
|
||||
import { useDicts } from "../dicts";
|
||||
|
||||
const typeDict = dict({
|
||||
url: "/pi/audit/dict",
|
||||
@@ -21,6 +23,8 @@ const actionDict = dict({
|
||||
});
|
||||
|
||||
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const { t } = useI18n();
|
||||
const { myProjectDict } = useDicts();
|
||||
const api = context.api;
|
||||
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
@@ -45,6 +49,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
view: { show: false },
|
||||
edit: { show: false },
|
||||
remove: { show: true },
|
||||
copy: { show: false },
|
||||
},
|
||||
},
|
||||
columns: {
|
||||
@@ -61,7 +66,6 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
show: true,
|
||||
component: {
|
||||
name: "a-range-picker",
|
||||
vModel: ["createTime_start", "createTime_end"],
|
||||
},
|
||||
},
|
||||
column: { width: 170, sorter: true },
|
||||
@@ -77,17 +81,16 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
},
|
||||
action: {
|
||||
title: "操作动作",
|
||||
type: "dict-select",
|
||||
dict: actionDict,
|
||||
type: "text",
|
||||
search: { show: true },
|
||||
column: { width: 100 },
|
||||
column: { width: 200, tooltip: true },
|
||||
form: { show: false },
|
||||
},
|
||||
content: {
|
||||
title: "内容",
|
||||
title: "备注",
|
||||
type: "text",
|
||||
search: { show: true },
|
||||
column: { minWidth: 300 },
|
||||
column: { width: 700, tooltip: true },
|
||||
form: { show: false },
|
||||
},
|
||||
ipAddress: {
|
||||
@@ -96,6 +99,14 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
column: { width: 140 },
|
||||
form: { show: false },
|
||||
},
|
||||
projectId: {
|
||||
title: t("certd.fields.projectName"),
|
||||
type: "dict-select",
|
||||
dict: myProjectDict,
|
||||
form: {
|
||||
show: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import { CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, UserPageQuery, UserPageRes, dict } from "@fast-crud/fast-crud";
|
||||
import { Modal } from "ant-design-vue";
|
||||
import { useI18n } from "/src/locales";
|
||||
import { useDicts } from "/@/views/certd/dicts";
|
||||
|
||||
const typeDict = dict({
|
||||
url: "/sys/audit/dict",
|
||||
@@ -21,6 +24,8 @@ const actionDict = dict({
|
||||
});
|
||||
|
||||
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const { t } = useI18n();
|
||||
const { myProjectDict } = useDicts();
|
||||
const api = context.api;
|
||||
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
@@ -31,19 +36,39 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
};
|
||||
|
||||
const cleanExpired = async () => {
|
||||
await api.Clean(90);
|
||||
crudExpose.doRefresh();
|
||||
Modal.confirm({
|
||||
title: "确认清理",
|
||||
content: "确定要清理90天前的审计日志吗?此操作不可撤销。",
|
||||
okText: "确认清理",
|
||||
okType: "danger",
|
||||
cancelText: "取消",
|
||||
async onOk() {
|
||||
await api.Clean(90);
|
||||
crudExpose.doRefresh();
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
return {
|
||||
crudOptions: {
|
||||
request: { pageRequest, delRequest },
|
||||
tabs: {
|
||||
name: "scope",
|
||||
show: true,
|
||||
dict: {
|
||||
data: [
|
||||
{ value: "system", label: "系统级", color: "red" },
|
||||
{ value: "user", label: "用户级", color: "blue" },
|
||||
],
|
||||
},
|
||||
},
|
||||
actionbar: {
|
||||
buttons: {
|
||||
add: { show: false },
|
||||
clean: {
|
||||
text: "清理过期日志(90天)",
|
||||
type: "default",
|
||||
type: "primary",
|
||||
danger: true,
|
||||
click: cleanExpired,
|
||||
},
|
||||
},
|
||||
@@ -55,12 +80,11 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
view: { show: false },
|
||||
edit: { show: false },
|
||||
remove: { show: true },
|
||||
copy: { show: false },
|
||||
},
|
||||
},
|
||||
search: {
|
||||
initialForm: {
|
||||
sort: { prop: "id", asc: false },
|
||||
},
|
||||
initialForm: { scope: "system" },
|
||||
},
|
||||
columns: {
|
||||
id: {
|
||||
@@ -76,13 +100,12 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
show: true,
|
||||
component: {
|
||||
name: "a-range-picker",
|
||||
vModel: ["createTime_start", "createTime_end"],
|
||||
},
|
||||
},
|
||||
column: { width: 170, sorter: true },
|
||||
form: { show: false },
|
||||
},
|
||||
userName: {
|
||||
username: {
|
||||
title: "操作人",
|
||||
type: "text",
|
||||
search: { show: true },
|
||||
@@ -90,7 +113,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
form: { show: false },
|
||||
},
|
||||
type: {
|
||||
title: "操作类型",
|
||||
title: "类型",
|
||||
type: "dict-select",
|
||||
dict: typeDict,
|
||||
search: { show: true },
|
||||
@@ -98,18 +121,17 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
form: { show: false },
|
||||
},
|
||||
action: {
|
||||
title: "操作动作",
|
||||
type: "dict-select",
|
||||
dict: actionDict,
|
||||
title: "操作",
|
||||
type: "text",
|
||||
search: { show: true },
|
||||
column: { width: 100 },
|
||||
column: { width: 200, tooltip: true },
|
||||
form: { show: false },
|
||||
},
|
||||
content: {
|
||||
title: "内容",
|
||||
title: "备注",
|
||||
type: "text",
|
||||
search: { show: true },
|
||||
column: { minWidth: 300 },
|
||||
column: { width: 500, tooltip: true },
|
||||
form: { show: false },
|
||||
},
|
||||
ipAddress: {
|
||||
@@ -118,6 +140,27 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
column: { width: 140 },
|
||||
form: { show: false },
|
||||
},
|
||||
projectId: {
|
||||
title: t("certd.fields.projectName"),
|
||||
type: "dict-select",
|
||||
dict: myProjectDict,
|
||||
form: {
|
||||
show: false,
|
||||
},
|
||||
},
|
||||
scope: {
|
||||
title: "范围",
|
||||
type: "dict-select",
|
||||
dict: dict({
|
||||
data: [
|
||||
{ value: "system", label: "系统级", color: "blue" },
|
||||
{ value: "user", label: "用户级", color: "green" },
|
||||
],
|
||||
}),
|
||||
search: { show: true },
|
||||
column: { width: 100 },
|
||||
form: { show: false },
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user