mirror of
https://github.com/PlayEdu/backend
synced 2025-06-29 07:32:49 +08:00
管理员日志详情组件优化
This commit is contained in:
parent
acc767f11b
commit
39871bd23f
@ -19,3 +19,7 @@ export function adminLogList(
|
|||||||
end_time: end_time,
|
end_time: end_time,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function adminLogDetail(id: number) {
|
||||||
|
return client.get(`/backend/v1/admin/log/detail/${id}`, {});
|
||||||
|
}
|
||||||
|
@ -1,21 +1,35 @@
|
|||||||
import React, { useState } from "react";
|
import React, { useState, useEffect } from "react";
|
||||||
import { Modal, Form } from "antd";
|
import { Modal, Form } from "antd";
|
||||||
|
import { adminLog } from "../../../../api";
|
||||||
|
|
||||||
interface PropInterface {
|
interface PropInterface {
|
||||||
param: string;
|
id: number;
|
||||||
result: string;
|
|
||||||
open: boolean;
|
open: boolean;
|
||||||
onCancel: () => void;
|
onCancel: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const AdminLogDetailDialog: React.FC<PropInterface> = ({
|
export const AdminLogDetailDialog: React.FC<PropInterface> = ({
|
||||||
param,
|
id,
|
||||||
open,
|
open,
|
||||||
onCancel,
|
onCancel,
|
||||||
result,
|
|
||||||
}) => {
|
}) => {
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const [loading, setLoading] = useState(true);
|
const [param, setParam] = useState("");
|
||||||
|
const [result, setResult] = useState("");
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (open && id > 0) {
|
||||||
|
getDetail();
|
||||||
|
}
|
||||||
|
}, [open, id]);
|
||||||
|
|
||||||
|
const getDetail = () => {
|
||||||
|
adminLog.adminLogDetail(id).then((res: any) => {
|
||||||
|
setParam(res.data.param);
|
||||||
|
setResult(res.data.result);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const onFinish = (values: any) => {};
|
const onFinish = (values: any) => {};
|
||||||
|
|
||||||
@ -31,18 +45,21 @@ export const AdminLogDetailDialog: React.FC<PropInterface> = ({
|
|||||||
centered
|
centered
|
||||||
forceRender
|
forceRender
|
||||||
open={true}
|
open={true}
|
||||||
width={416}
|
width={600}
|
||||||
onOk={() => onCancel()}
|
onOk={() => onCancel()}
|
||||||
onCancel={() => onCancel()}
|
onCancel={() => onCancel()}
|
||||||
footer={null}
|
footer={null}
|
||||||
maskClosable={false}
|
maskClosable={false}
|
||||||
>
|
>
|
||||||
<div className="mt-24">
|
<div
|
||||||
|
className="mt-24"
|
||||||
|
style={{ maxHeight: 600, overflowY: "auto", overflowX: "hidden" }}
|
||||||
|
>
|
||||||
<Form
|
<Form
|
||||||
form={form}
|
form={form}
|
||||||
name="adminlog-detail"
|
name="adminlog-detail"
|
||||||
labelCol={{ span: 5 }}
|
labelCol={{ span: 3 }}
|
||||||
wrapperCol={{ span: 19 }}
|
wrapperCol={{ span: 21 }}
|
||||||
initialValues={{ remember: true }}
|
initialValues={{ remember: true }}
|
||||||
onFinish={onFinish}
|
onFinish={onFinish}
|
||||||
onFinishFailed={onFinishFailed}
|
onFinishFailed={onFinishFailed}
|
||||||
|
@ -37,9 +37,8 @@ const SystemLogPage = () => {
|
|||||||
const [adminName, setAdminName] = useState("");
|
const [adminName, setAdminName] = useState("");
|
||||||
const [created_at, setCreatedAt] = useState<string[]>([]);
|
const [created_at, setCreatedAt] = useState<string[]>([]);
|
||||||
const [createdAts, setCreatedAts] = useState<any>([]);
|
const [createdAts, setCreatedAts] = useState<any>([]);
|
||||||
const [param, setParam] = useState("");
|
|
||||||
const [result, setResult] = useState("");
|
|
||||||
const [visiable, setVisiable] = useState(false);
|
const [visiable, setVisiable] = useState(false);
|
||||||
|
const [admId, setAdmId] = useState(0);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getData();
|
getData();
|
||||||
@ -131,8 +130,7 @@ const SystemLogPage = () => {
|
|||||||
type="link"
|
type="link"
|
||||||
className="b-link c-red"
|
className="b-link c-red"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setParam(record.param);
|
setAdmId(Number(record.id));
|
||||||
setResult(record.result);
|
|
||||||
setVisiable(true);
|
setVisiable(true);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@ -215,8 +213,7 @@ const SystemLogPage = () => {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<AdminLogDetailDialog
|
<AdminLogDetailDialog
|
||||||
param={param}
|
id={admId}
|
||||||
result={result}
|
|
||||||
open={visiable}
|
open={visiable}
|
||||||
onCancel={() => setVisiable(false)}
|
onCancel={() => setVisiable(false)}
|
||||||
></AdminLogDetailDialog>
|
></AdminLogDetailDialog>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user