feat: 系统日志添加查看详情 (#974)

* feat: 系统日志添加查看详情
This commit is contained in:
xiaoming
2024-03-13 20:46:37 +08:00
committed by GitHub
parent 0b9fcaca4a
commit e6302b0f38
14 changed files with 799 additions and 582 deletions

View File

@@ -1,9 +1,11 @@
import dayjs from "dayjs";
import Detail from "./detail.vue";
import { message } from "@/utils/message";
import { getSystemLogsList } from "@/api/system";
import { addDialog } from "@/components/ReDialog";
import type { PaginationProps } from "@pureadmin/table";
import { type Ref, reactive, ref, onMounted, toRaw } from "vue";
import { getKeyList, useCopyToClipboard } from "@pureadmin/utils";
import { getSystemLogsList, getSystemLogsDetail } from "@/api/system";
import Info from "@iconify-icons/ri/question-line";
export function useRole(tableRef: Ref) {
@@ -126,12 +128,12 @@ export function useRole(tableRef: Ref) {
minWidth: 180,
formatter: ({ requestTime }) =>
dayjs(requestTime).format("YYYY-MM-DD HH:mm:ss")
},
{
label: "操作",
fixed: "right",
slot: "operation"
}
// {
// label: "操作",
// fixed: "right",
// slot: "operation"
// }
];
function handleSizeChange(val: number) {
@@ -157,7 +159,8 @@ export function useRole(tableRef: Ref) {
}
/** 拷贝请求接口,表格单元格被双击时触发 */
function handleCellDblclick({ url }) {
function handleCellDblclick({ url }, { property }) {
if (property !== "url") return;
update(url);
copied.value
? message(`${url} 已拷贝`, { type: "success" })
@@ -185,6 +188,20 @@ export function useRole(tableRef: Ref) {
onSearch();
}
function onDetail(row) {
getSystemLogsDetail({ id: row.id }).then(res => {
addDialog({
title: "系统日志详情",
fullscreen: true,
hideFooter: true,
contentRenderer: () => Detail,
props: {
data: [res]
}
});
});
}
async function onSearch() {
loading.value = true;
const { data } = await getSystemLogsList(toRaw(form));
@@ -216,6 +233,7 @@ export function useRole(tableRef: Ref) {
pagination,
selectedNum,
onSearch,
onDetail,
clearAll,
resetForm,
onbatchDel,