flat: 暂存
This commit is contained in:
@@ -217,7 +217,7 @@ const JobTableList: React.FC = () => {
|
||||
size="small"
|
||||
key="edit"
|
||||
icon = <EditOutlined />
|
||||
hidden={!access.hasPerms('monitor:job:edit')}
|
||||
hidden={!access.hasPerms('monitor:job:edit.tsx')}
|
||||
onClick={() => {
|
||||
setModalVisible(true);
|
||||
setCurrentRow(record);
|
||||
|
||||
@@ -173,7 +173,7 @@ const JobLogTableList: React.FC = () => {
|
||||
type="link"
|
||||
size="small"
|
||||
key="edit"
|
||||
hidden={!access.hasPerms('monitor:job-log:edit')}
|
||||
hidden={!access.hasPerms('monitor:job-log:edit.tsx')}
|
||||
onClick={() => {
|
||||
setModalOpen(true);
|
||||
setCurrentRow(record);
|
||||
|
||||
@@ -1,216 +0,0 @@
|
||||
import React, { useEffect } from 'react';
|
||||
import {
|
||||
ProForm,
|
||||
ProFormDigit,
|
||||
ProFormText,
|
||||
ProFormRadio,
|
||||
ProFormTimePicker,
|
||||
} from '@ant-design/pro-components';
|
||||
import { Form, Modal} from 'antd';
|
||||
import { useIntl, FormattedMessage } from '@umijs/max';
|
||||
import { DictValueEnumObj } from '@/components/DictTag';
|
||||
|
||||
export type LogininforFormData = Record<string, unknown> & Partial<API.Monitor.Logininfor>;
|
||||
|
||||
export type LogininforFormProps = {
|
||||
onCancel: (flag?: boolean, formVals?: LogininforFormData) => void;
|
||||
onSubmit: (values: LogininforFormData) => Promise<void>;
|
||||
open: boolean;
|
||||
values: Partial<API.Monitor.Logininfor>;
|
||||
statusOptions: DictValueEnumObj;
|
||||
};
|
||||
|
||||
const LogininforForm: React.FC<LogininforFormProps> = (props) => {
|
||||
const [form] = Form.useForm();
|
||||
|
||||
const { statusOptions, } = props;
|
||||
|
||||
useEffect(() => {
|
||||
form.resetFields();
|
||||
form.setFieldsValue({
|
||||
infoId: props.values.infoId,
|
||||
userName: props.values.userName,
|
||||
ipaddr: props.values.ipaddr,
|
||||
loginLocation: props.values.loginLocation,
|
||||
browser: props.values.browser,
|
||||
os: props.values.os,
|
||||
status: props.values.status,
|
||||
msg: props.values.msg,
|
||||
loginTime: props.values.loginTime,
|
||||
});
|
||||
}, [form, props]);
|
||||
|
||||
const intl = useIntl();
|
||||
const handleOk = () => {
|
||||
form.submit();
|
||||
};
|
||||
const handleCancel = () => {
|
||||
props.onCancel();
|
||||
form.resetFields();
|
||||
};
|
||||
const handleFinish = async (values: Record<string, any>) => {
|
||||
props.onSubmit(values as LogininforFormData);
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal
|
||||
width={640}
|
||||
title={intl.formatMessage({
|
||||
id: 'system.logininfor.title',
|
||||
defaultMessage: '编辑系统访问记录',
|
||||
})}
|
||||
open={props.open}
|
||||
destroyOnClose
|
||||
forceRender
|
||||
onOk={handleOk}
|
||||
onCancel={handleCancel}
|
||||
>
|
||||
<ProForm
|
||||
form={form}
|
||||
grid={true}
|
||||
layout="horizontal"
|
||||
onFinish={handleFinish}>
|
||||
<ProFormDigit
|
||||
name="infoId"
|
||||
label={intl.formatMessage({
|
||||
id: 'system.logininfor.info_id',
|
||||
defaultMessage: '访问编号',
|
||||
})}
|
||||
colProps={{ md: 12, xl: 24 }}
|
||||
placeholder="请输入访问编号"
|
||||
disabled
|
||||
hidden={true}
|
||||
rules={[
|
||||
{
|
||||
required: false,
|
||||
message: <FormattedMessage id="请输入访问编号!" defaultMessage="请输入访问编号!" />,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<ProFormText
|
||||
name="userName"
|
||||
label={intl.formatMessage({
|
||||
id: 'system.logininfor.user_name',
|
||||
defaultMessage: '用户账号',
|
||||
})}
|
||||
colProps={{ md: 12, xl: 24 }}
|
||||
placeholder="请输入用户账号"
|
||||
rules={[
|
||||
{
|
||||
required: false,
|
||||
message: <FormattedMessage id="请输入用户账号!" defaultMessage="请输入用户账号!" />,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<ProFormText
|
||||
name="ipaddr"
|
||||
label={intl.formatMessage({
|
||||
id: 'system.logininfor.ipaddr',
|
||||
defaultMessage: '登录IP地址',
|
||||
})}
|
||||
colProps={{ md: 12, xl: 24 }}
|
||||
placeholder="请输入登录IP地址"
|
||||
rules={[
|
||||
{
|
||||
required: false,
|
||||
message: <FormattedMessage id="请输入登录IP地址!" defaultMessage="请输入登录IP地址!" />,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<ProFormText
|
||||
name="loginLocation"
|
||||
label={intl.formatMessage({
|
||||
id: 'system.logininfor.login_location',
|
||||
defaultMessage: '登录地点',
|
||||
})}
|
||||
colProps={{ md: 12, xl: 24 }}
|
||||
placeholder="请输入登录地点"
|
||||
rules={[
|
||||
{
|
||||
required: false,
|
||||
message: <FormattedMessage id="请输入登录地点!" defaultMessage="请输入登录地点!" />,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<ProFormText
|
||||
name="browser"
|
||||
label={intl.formatMessage({
|
||||
id: 'system.logininfor.browser',
|
||||
defaultMessage: '浏览器类型',
|
||||
})}
|
||||
colProps={{ md: 12, xl: 24 }}
|
||||
placeholder="请输入浏览器类型"
|
||||
rules={[
|
||||
{
|
||||
required: false,
|
||||
message: <FormattedMessage id="请输入浏览器类型!" defaultMessage="请输入浏览器类型!" />,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<ProFormText
|
||||
name="os"
|
||||
label={intl.formatMessage({
|
||||
id: 'system.logininfor.os',
|
||||
defaultMessage: '操作系统',
|
||||
})}
|
||||
colProps={{ md: 12, xl: 24 }}
|
||||
placeholder="请输入操作系统"
|
||||
rules={[
|
||||
{
|
||||
required: false,
|
||||
message: <FormattedMessage id="请输入操作系统!" defaultMessage="请输入操作系统!" />,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<ProFormRadio.Group
|
||||
valueEnum={statusOptions}
|
||||
name="status"
|
||||
label={intl.formatMessage({
|
||||
id: 'system.logininfor.status',
|
||||
defaultMessage: '登录状态',
|
||||
})}
|
||||
colProps={{ md: 12, xl: 24 }}
|
||||
placeholder="请输入登录状态"
|
||||
rules={[
|
||||
{
|
||||
required: false,
|
||||
message: <FormattedMessage id="请输入登录状态!" defaultMessage="请输入登录状态!" />,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<ProFormText
|
||||
name="msg"
|
||||
label={intl.formatMessage({
|
||||
id: 'system.logininfor.msg',
|
||||
defaultMessage: '提示消息',
|
||||
})}
|
||||
colProps={{ md: 12, xl: 24 }}
|
||||
placeholder="请输入提示消息"
|
||||
rules={[
|
||||
{
|
||||
required: false,
|
||||
message: <FormattedMessage id="请输入提示消息!" defaultMessage="请输入提示消息!" />,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<ProFormTimePicker
|
||||
name="loginTime"
|
||||
label={intl.formatMessage({
|
||||
id: 'system.logininfor.login_time',
|
||||
defaultMessage: '访问时间',
|
||||
})}
|
||||
colProps={{ md: 12, xl: 24 }}
|
||||
placeholder="请输入访问时间"
|
||||
rules={[
|
||||
{
|
||||
required: false,
|
||||
message: <FormattedMessage id="请输入访问时间!" defaultMessage="请输入访问时间!" />,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</ProForm>
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
|
||||
export default LogininforForm;
|
||||
@@ -1,335 +0,0 @@
|
||||
|
||||
import React, { useState, useRef, useEffect } from 'react';
|
||||
import { useIntl, FormattedMessage, useAccess } from '@umijs/max';
|
||||
import type { FormInstance } from 'antd';
|
||||
import { Button, message, Modal } from 'antd';
|
||||
import { ActionType, FooterToolbar, PageContainer, ProColumns, ProTable } from '@ant-design/pro-components';
|
||||
import { PlusOutlined, DeleteOutlined, ExclamationCircleOutlined, UnlockOutlined } from '@ant-design/icons';
|
||||
import { getLogininforList, removeLogininfor, exportLogininfor, unlockLogininfor, cleanLogininfor } from '@/services/monitor/logininfor';
|
||||
import DictTag from '@/components/DictTag';
|
||||
|
||||
/**
|
||||
* 删除节点
|
||||
*
|
||||
* @param selectedRows
|
||||
*/
|
||||
const handleRemove = async (selectedRows: API.Monitor.Logininfor[]) => {
|
||||
const hide = message.loading('正在删除');
|
||||
if (!selectedRows) return true;
|
||||
try {
|
||||
const resp = await removeLogininfor(selectedRows.map((row) => row.infoId).join(','));
|
||||
hide();
|
||||
if (resp.code === 200) {
|
||||
message.success('删除成功,即将刷新');
|
||||
} else {
|
||||
message.error(resp.msg);
|
||||
}
|
||||
return true;
|
||||
} catch (error) {
|
||||
hide();
|
||||
message.error('删除失败,请重试');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
const handleClean = async () => {
|
||||
const hide = message.loading('请稍候');
|
||||
try {
|
||||
const resp = await cleanLogininfor();
|
||||
hide();
|
||||
if (resp.code === 200) {
|
||||
message.success('清空成功,即将刷新');
|
||||
} else {
|
||||
message.error(resp.msg);
|
||||
}
|
||||
return true;
|
||||
} catch (error) {
|
||||
hide();
|
||||
message.error('请求失败,请重试');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
const handleUnlock = async (userName: string) => {
|
||||
const hide = message.loading('正在解锁');
|
||||
try {
|
||||
const resp = await unlockLogininfor(userName);
|
||||
hide();
|
||||
if (resp.code === 200) {
|
||||
message.success('解锁成功,即将刷新');
|
||||
} else {
|
||||
message.error(resp.msg);
|
||||
}
|
||||
return true;
|
||||
} catch (error) {
|
||||
hide();
|
||||
message.error('解锁失败,请重试');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
const handleExport = async () => {
|
||||
const hide = message.loading('正在导出');
|
||||
try {
|
||||
await exportLogininfor();
|
||||
hide();
|
||||
message.success('导出成功');
|
||||
return true;
|
||||
} catch (error) {
|
||||
hide();
|
||||
message.error('导出失败,请重试');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const LogininforTableList: React.FC = () => {
|
||||
const formTableRef = useRef<FormInstance>();
|
||||
|
||||
const actionRef = useRef<ActionType>();
|
||||
const [selectedRows, setSelectedRows] = useState<API.Monitor.Logininfor[]>([]);
|
||||
|
||||
const access = useAccess();
|
||||
|
||||
const statusOptions = {
|
||||
0: {
|
||||
label: '成功',
|
||||
key: '0',
|
||||
value: '0',
|
||||
text: '成功',
|
||||
status: 'success',
|
||||
listClass: 'success'
|
||||
},
|
||||
1: {
|
||||
label: '失败',
|
||||
key: '1',
|
||||
value: '1',
|
||||
text: '失败',
|
||||
status: 'error',
|
||||
listClass: 'danger'
|
||||
},
|
||||
};
|
||||
|
||||
/** 国际化配置 */
|
||||
const intl = useIntl();
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
}, []);
|
||||
|
||||
const columns: ProColumns<API.Monitor.Logininfor>[] = [
|
||||
{
|
||||
title: <FormattedMessage id="monitor.logininfor.info_id" defaultMessage="访问编号" />,
|
||||
dataIndex: 'infoId',
|
||||
valueType: 'text',
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: <FormattedMessage id="monitor.logininfor.user_name" defaultMessage="用户账号" />,
|
||||
dataIndex: 'userName',
|
||||
valueType: 'text',
|
||||
},
|
||||
{
|
||||
title: <FormattedMessage id="monitor.logininfor.ipaddr" defaultMessage="登录IP地址" />,
|
||||
dataIndex: 'ipaddr',
|
||||
valueType: 'text',
|
||||
},
|
||||
{
|
||||
title: <FormattedMessage id="monitor.logininfor.login_location" defaultMessage="登录地点" />,
|
||||
dataIndex: 'loginLocation',
|
||||
valueType: 'text',
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: <FormattedMessage id="monitor.logininfor.browser" defaultMessage="浏览器类型" />,
|
||||
dataIndex: 'browser',
|
||||
valueType: 'text',
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: <FormattedMessage id="monitor.logininfor.os" defaultMessage="操作系统" />,
|
||||
dataIndex: 'os',
|
||||
valueType: 'text',
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: <FormattedMessage id="monitor.logininfor.status" defaultMessage="登录状态" />,
|
||||
dataIndex: 'status',
|
||||
valueType: 'select',
|
||||
render: (_, record) => {
|
||||
return (<DictTag enums={statusOptions} value={record.status} />);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: <FormattedMessage id="monitor.logininfor.msg" defaultMessage="提示消息" />,
|
||||
dataIndex: 'msg',
|
||||
valueType: 'text',
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: <FormattedMessage id="monitor.logininfor.login_time" defaultMessage="访问时间" />,
|
||||
dataIndex: 'loginTime',
|
||||
valueType: 'dateTime',
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<PageContainer>
|
||||
<div style={{ width: '100%', float: 'right' }}>
|
||||
<ProTable<API.Monitor.Logininfor>
|
||||
headerTitle={intl.formatMessage({
|
||||
id: 'pages.searchTable.title',
|
||||
defaultMessage: '信息',
|
||||
})}
|
||||
actionRef={actionRef}
|
||||
formRef={formTableRef}
|
||||
rowKey="infoId"
|
||||
key="logininforList"
|
||||
search={{
|
||||
labelWidth: 120,
|
||||
}}
|
||||
toolBarRender={() => [
|
||||
<Button
|
||||
key="remove"
|
||||
danger
|
||||
hidden={selectedRows?.length === 0 || !access.hasPerms('monitor:logininfor:remove')}
|
||||
onClick={async () => {
|
||||
Modal.confirm({
|
||||
title: '是否确认删除所选数据项?',
|
||||
icon: <ExclamationCircleOutlined />,
|
||||
content: '请谨慎操作',
|
||||
async onOk() {
|
||||
const success = await handleRemove(selectedRows);
|
||||
if (success) {
|
||||
setSelectedRows([]);
|
||||
actionRef.current?.reloadAndRest?.();
|
||||
}
|
||||
},
|
||||
onCancel() { },
|
||||
});
|
||||
}}
|
||||
>
|
||||
<DeleteOutlined />
|
||||
<FormattedMessage id="pages.searchTable.delete" defaultMessage="删除" />
|
||||
</Button>,
|
||||
<Button
|
||||
type="primary"
|
||||
key="clean"
|
||||
danger
|
||||
hidden={selectedRows?.length === 0 || !access.hasPerms('monitor:logininfor:remove')}
|
||||
onClick={async () => {
|
||||
Modal.confirm({
|
||||
title: '是否确认清空所有数据项?',
|
||||
icon: <ExclamationCircleOutlined />,
|
||||
content: '请谨慎操作',
|
||||
async onOk() {
|
||||
const success = await handleClean();
|
||||
if (success) {
|
||||
setSelectedRows([]);
|
||||
actionRef.current?.reloadAndRest?.();
|
||||
}
|
||||
},
|
||||
onCancel() { },
|
||||
});
|
||||
}}
|
||||
>
|
||||
<DeleteOutlined />
|
||||
<FormattedMessage id="pages.searchTable.cleanAll" defaultMessage="清空" />
|
||||
</Button>,
|
||||
<Button
|
||||
type="primary"
|
||||
key="unlock"
|
||||
hidden={selectedRows?.length === 0 || !access.hasPerms('monitor:logininfor:unlock')}
|
||||
onClick={async () => {
|
||||
Modal.confirm({
|
||||
title: '是否确认解锁该用户的数据项?',
|
||||
icon: <ExclamationCircleOutlined />,
|
||||
content: '请谨慎操作',
|
||||
async onOk() {
|
||||
const success = await handleUnlock(selectedRows[0].userName);
|
||||
if (success) {
|
||||
setSelectedRows([]);
|
||||
actionRef.current?.reloadAndRest?.();
|
||||
}
|
||||
},
|
||||
onCancel() { },
|
||||
});
|
||||
}}
|
||||
>
|
||||
<UnlockOutlined />
|
||||
<FormattedMessage id="monitor.logininfor.unlock" defaultMessage="解锁" />
|
||||
</Button>,
|
||||
<Button
|
||||
type="primary"
|
||||
key="export"
|
||||
hidden={!access.hasPerms('monitor:logininfor:export')}
|
||||
onClick={async () => {
|
||||
handleExport();
|
||||
}}
|
||||
>
|
||||
<PlusOutlined />
|
||||
<FormattedMessage id="pages.searchTable.export" defaultMessage="导出" />
|
||||
</Button>,
|
||||
]}
|
||||
request={(params) =>
|
||||
getLogininforList({ ...params } as API.Monitor.LogininforListParams).then((res) => {
|
||||
const result = {
|
||||
data: res.rows,
|
||||
total: res.total,
|
||||
success: true,
|
||||
};
|
||||
return result;
|
||||
})
|
||||
}
|
||||
columns={columns}
|
||||
rowSelection={{
|
||||
onChange: (_, selectedRows) => {
|
||||
setSelectedRows(selectedRows);
|
||||
},
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
{selectedRows?.length > 0 && (
|
||||
<FooterToolbar
|
||||
extra={
|
||||
<div>
|
||||
<FormattedMessage id="pages.searchTable.chosen" defaultMessage="已选择" />
|
||||
<a style={{ fontWeight: 600 }}>{selectedRows.length}</a>
|
||||
<FormattedMessage id="pages.searchTable.item" defaultMessage="项" />
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<Button
|
||||
key="remove"
|
||||
danger
|
||||
hidden={!access.hasPerms('monitor:logininfor:remove')}
|
||||
onClick={async () => {
|
||||
Modal.confirm({
|
||||
title: '删除',
|
||||
content: '确定删除该项吗?',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: async () => {
|
||||
const success = await handleRemove(selectedRows);
|
||||
if (success) {
|
||||
setSelectedRows([]);
|
||||
actionRef.current?.reloadAndRest?.();
|
||||
}
|
||||
},
|
||||
});
|
||||
}}
|
||||
>
|
||||
<FormattedMessage id="pages.searchTable.batchDeletion" defaultMessage="批量删除" />
|
||||
</Button>
|
||||
</FooterToolbar>
|
||||
)}
|
||||
</PageContainer>
|
||||
);
|
||||
};
|
||||
|
||||
export default LogininforTableList;
|
||||
@@ -1,113 +0,0 @@
|
||||
import React from 'react';
|
||||
import { Descriptions, Modal } from 'antd';
|
||||
import { useIntl, FormattedMessage } from '@umijs/max';
|
||||
import { DictValueEnumObj } from '@/components/DictTag';
|
||||
import { getValueEnumLabel } from '@/utils/options';
|
||||
|
||||
export type MobilelogFormData = Record<string, unknown> & Partial<API.Monitor.Mobilelog>;
|
||||
|
||||
export type MobilelogFormProps = {
|
||||
onCancel: (flag?: boolean, formVals?: MobilelogFormData) => void;
|
||||
onSubmit: (values: MobilelogFormData) => Promise<void>;
|
||||
open: boolean;
|
||||
values: Partial<API.Monitor.Operlog>;
|
||||
businessTypeOptions: DictValueEnumObj;
|
||||
operatorTypeOptions: DictValueEnumObj;
|
||||
statusOptions: DictValueEnumObj;
|
||||
};
|
||||
|
||||
const OperlogDetailForm: React.FC<MobilelogFormProps> = (props) => {
|
||||
|
||||
const { values, businessTypeOptions, operatorTypeOptions, statusOptions, } = props;
|
||||
|
||||
const intl = useIntl();
|
||||
const handleOk = () => {};
|
||||
const handleCancel = () => {
|
||||
props.onCancel();
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal
|
||||
width={640}
|
||||
title={intl.formatMessage({
|
||||
id: 'monitor.operlog.title',
|
||||
defaultMessage: '编辑操作日志记录',
|
||||
})}
|
||||
open={props.open}
|
||||
destroyOnClose
|
||||
onOk={handleOk}
|
||||
onCancel={handleCancel}
|
||||
>
|
||||
<Descriptions column={24}>
|
||||
<Descriptions.Item
|
||||
span={12}
|
||||
label={<FormattedMessage id="monitor.operlog.module" defaultMessage="操作模块" />}
|
||||
>
|
||||
{`${values.title}/${getValueEnumLabel(businessTypeOptions, values.businessType)}`}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item
|
||||
span={12}
|
||||
label={<FormattedMessage id="monitor.operlog.request_method" defaultMessage="请求方式" />}
|
||||
>
|
||||
{values.requestMethod}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item
|
||||
span={12}
|
||||
label={<FormattedMessage id="monitor.operlog.oper_name" defaultMessage="操作人员" />}
|
||||
>
|
||||
{`${values.operName}/${values.operIp}`}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item
|
||||
span={12}
|
||||
label={<FormattedMessage id="monitor.operlog.operator_type" defaultMessage="操作类别" />}
|
||||
>
|
||||
{getValueEnumLabel(operatorTypeOptions, values.operatorType)}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item
|
||||
span={24}
|
||||
label={<FormattedMessage id="monitor.operlog.method" defaultMessage="方法名称" />}
|
||||
>
|
||||
{values.method}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item
|
||||
span={24}
|
||||
label={<FormattedMessage id="monitor.operlog.oper_url" defaultMessage="请求URL" />}
|
||||
>
|
||||
{values.operUrl}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item
|
||||
span={24}
|
||||
label={<FormattedMessage id="monitor.operlog.oper_param" defaultMessage="请求参数" />}
|
||||
>
|
||||
{values.operParam}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item
|
||||
span={24}
|
||||
label={<FormattedMessage id="monitor.operlog.json_result" defaultMessage="返回参数" />}
|
||||
>
|
||||
{values.jsonResult}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item
|
||||
span={24}
|
||||
label={<FormattedMessage id="monitor.operlog.error_msg" defaultMessage="错误消息" />}
|
||||
>
|
||||
{values.errorMsg}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item
|
||||
span={12}
|
||||
label={<FormattedMessage id="monitor.operlog.status" defaultMessage="操作状态" />}
|
||||
>
|
||||
{getValueEnumLabel(statusOptions, values.status)}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item
|
||||
span={12}
|
||||
label={<FormattedMessage id="monitor.operlog.oper_time" defaultMessage="操作时间" />}
|
||||
>
|
||||
{values.operTime?.toString()}
|
||||
</Descriptions.Item>
|
||||
</Descriptions>
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
|
||||
export default OperlogDetailForm;
|
||||
@@ -1,304 +0,0 @@
|
||||
import React, { useState, useRef, useEffect, useMemo } from 'react';
|
||||
import {addMobilelog, getMobileLogList, removeMobilelog, updateMobilelog} from "@/services/monitor/mobilelog";
|
||||
import { ActionType, FooterToolbar, PageContainer, ProColumns, ProTable } from '@ant-design/pro-components';
|
||||
import { useIntl, FormattedMessage, useAccess } from '@umijs/max';
|
||||
import { PlusOutlined, DeleteOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
|
||||
import { Button, message, Modal } from 'antd';
|
||||
import DictTag from "@/components/DictTag";
|
||||
import {getDictValueEnum} from "@/services/system/dict";
|
||||
import UpdateForm from './detail';
|
||||
import {addOperlog, removeOperlog, updateOperlog} from "@/services/monitor/operlog";
|
||||
/**
|
||||
* 添加节点
|
||||
*
|
||||
* @param fields
|
||||
*/
|
||||
const handleAdd = async (fields: API.Monitor.Operlog) => {
|
||||
const hide = message.loading('正在添加');
|
||||
try {
|
||||
const resp = await addMobilelog({ ...fields });
|
||||
hide();
|
||||
if (resp.code === 200) {
|
||||
message.success('添加成功');
|
||||
} else {
|
||||
message.error(resp.msg);
|
||||
}
|
||||
return true;
|
||||
} catch (error) {
|
||||
hide();
|
||||
message.error('添加失败请重试!');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* 更新节点
|
||||
*
|
||||
* @param fields
|
||||
*/
|
||||
const handleUpdate = async (fields: API.Monitor.Operlog) => {
|
||||
const hide = message.loading('正在更新');
|
||||
try {
|
||||
const resp = await updateMobilelog(fields);
|
||||
hide();
|
||||
if (resp.code === 200) {
|
||||
message.success('更新成功');
|
||||
} else {
|
||||
message.error(resp.msg);
|
||||
}
|
||||
return true;
|
||||
} catch (error) {
|
||||
hide();
|
||||
message.error('配置失败请重试!');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 删除节点
|
||||
*
|
||||
* @param selectedRows
|
||||
*/
|
||||
const handleRemove = async (selectedRows: API.Monitor.Operlog[]) => {
|
||||
const hide = message.loading('正在删除');
|
||||
if (!selectedRows) return true;
|
||||
try {
|
||||
const resp = await removeMobilelog(selectedRows.map((row) => row.operId).join(','));
|
||||
hide();
|
||||
if (resp.code === 200) {
|
||||
message.success('删除成功,即将刷新');
|
||||
} else {
|
||||
message.error(resp.msg);
|
||||
}
|
||||
return true;
|
||||
} catch (error) {
|
||||
hide();
|
||||
message.error('删除失败,请重试');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
const MobileLog: React.FC = () => {
|
||||
// ref
|
||||
const formTableRef = useRef<FormInstance>();
|
||||
const access = useAccess();
|
||||
const actionRef = useRef<ActionType>();
|
||||
// status
|
||||
const [params, useParams] = useState({})
|
||||
const [modalVisible, setModalVisible] = useState<boolean>(false);
|
||||
const [currentRow, setCurrentRow] = useState<API.Monitor.Mobilelog>();
|
||||
const [selectedRows, setSelectedRows] = useState<API.Monitor.Mobilelog[]>([]);
|
||||
// 枚举
|
||||
const [businessTypeOptions, setBusinessTypeOptions] = useState<any>([]);
|
||||
const [operatorTypeOptions, setOperatorTypeOptions] = useState<any>([]);
|
||||
const [statusOptions, setStatusOptions] = useState<any>([]);
|
||||
|
||||
// 初始化
|
||||
useEffect(() => {
|
||||
getDictValueEnum('sys_oper_type', true).then((data) => {
|
||||
setBusinessTypeOptions(data);
|
||||
});
|
||||
getDictValueEnum('sys_oper_type', true).then((data) => {
|
||||
setOperatorTypeOptions(data);
|
||||
});
|
||||
getDictValueEnum('sys_common_status', true).then((data) => {
|
||||
setStatusOptions(data);
|
||||
});
|
||||
}, []);
|
||||
|
||||
|
||||
const columns: ProColumns<API.Monitor.Mobilelog>[] = useMemo(() => [
|
||||
{
|
||||
title: '日志主键',
|
||||
dataIndex: 'operId',
|
||||
valueType: 'text',
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: "操作模块",
|
||||
dataIndex: 'title',
|
||||
valueType: 'text',
|
||||
},
|
||||
{
|
||||
title: "业务类型",
|
||||
dataIndex: 'businessType',
|
||||
valueType: 'select',
|
||||
valueEnum: businessTypeOptions,
|
||||
render: (_, record) => {
|
||||
return (<DictTag enums={businessTypeOptions} value={record.businessType} />);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "请求方式",
|
||||
dataIndex: 'requestMethod',
|
||||
valueType: 'text',
|
||||
},
|
||||
{
|
||||
title: "操作类别",
|
||||
dataIndex: 'operatorType',
|
||||
valueType: 'select',
|
||||
valueEnum: operatorTypeOptions,
|
||||
render: (_, record) => {
|
||||
return (<DictTag enums={operatorTypeOptions} value={record.operatorType} />);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "操作人员",
|
||||
dataIndex: 'operName',
|
||||
valueType: 'text',
|
||||
},
|
||||
{
|
||||
title: "主机地址",
|
||||
dataIndex: 'operIp',
|
||||
valueType: 'text',
|
||||
},
|
||||
{
|
||||
title: "操作地点",
|
||||
dataIndex: 'operLocation',
|
||||
valueType: 'text',
|
||||
},
|
||||
{
|
||||
title: "操作状态",
|
||||
dataIndex: 'status',
|
||||
valueType: 'select',
|
||||
valueEnum: statusOptions,
|
||||
render: (_, record) => {
|
||||
return (<DictTag key="status" enums={statusOptions} value={record.status} />);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "操作时间",
|
||||
dataIndex: 'operTime',
|
||||
valueType: 'dateTime',
|
||||
},
|
||||
{
|
||||
title: <FormattedMessage id="pages.searchTable.titleOption" defaultMessage="操作" />,
|
||||
dataIndex: 'option',
|
||||
width: '120px',
|
||||
valueType: 'option',
|
||||
render: (_, record) => [
|
||||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
key="edit"
|
||||
hidden={!access.hasPerms('system:operlog:edit')}
|
||||
onClick={() => {
|
||||
setModalVisible(true);
|
||||
setCurrentRow(record);
|
||||
}}
|
||||
>
|
||||
详细
|
||||
</Button>,
|
||||
],
|
||||
},
|
||||
], [businessTypeOptions, operatorTypeOptions, statusOptions])
|
||||
|
||||
return <>
|
||||
<PageContainer>
|
||||
<div style={{ width: '100%', float: 'right' }}>
|
||||
<ProTable
|
||||
// params 是需要自带的参数
|
||||
// 这个参数优先级更高,会覆盖查询表单的参数
|
||||
actionRef={actionRef}
|
||||
formRef={formTableRef}
|
||||
rowKey="operId"
|
||||
columns={columns}
|
||||
search={{
|
||||
labelWidth: 120,
|
||||
}}
|
||||
rowSelection={{
|
||||
onChange: (_, selectedRows) => {
|
||||
setSelectedRows(selectedRows);
|
||||
},
|
||||
}}
|
||||
request={(params) =>
|
||||
getMobileLogList({ ...params } as API.Monitor.MobilelogListParams).then((res) => {
|
||||
const result = {
|
||||
data: res.rows,
|
||||
total: res.total,
|
||||
success: true,
|
||||
};
|
||||
return result;
|
||||
})
|
||||
}
|
||||
toolBarRender={() => [
|
||||
// <Button
|
||||
// type="primary"
|
||||
// key="add"
|
||||
// hidden={!access.hasPerms('system:operlog:add')}
|
||||
// onClick={async () => {
|
||||
// setCurrentRow(undefined);
|
||||
// setModalVisible(true);
|
||||
// }}
|
||||
// >
|
||||
// <PlusOutlined /> <FormattedMessage id="pages.searchTable.new" defaultMessage="新建" />
|
||||
// </Button>,
|
||||
<Button
|
||||
type="primary"
|
||||
key="remove"
|
||||
danger
|
||||
hidden={selectedRows?.length === 0 || !access.hasPerms('system:operlog:remove')}
|
||||
onClick={async () => {
|
||||
Modal.confirm({
|
||||
title: '是否确认删除所选数据项?',
|
||||
icon: <ExclamationCircleOutlined />,
|
||||
content: '请谨慎操作',
|
||||
async onOk() {
|
||||
const success = await handleRemove(selectedRows);
|
||||
if (success) {
|
||||
setSelectedRows([]);
|
||||
actionRef.current?.reloadAndRest?.();
|
||||
}
|
||||
},
|
||||
onCancel() { },
|
||||
});
|
||||
}}
|
||||
>
|
||||
<DeleteOutlined />
|
||||
<FormattedMessage id="pages.searchTable.delete" defaultMessage="删除" />
|
||||
</Button>,
|
||||
<Button
|
||||
type="primary"
|
||||
key="export"
|
||||
hidden={!access.hasPerms('system:operlog:export')}
|
||||
onClick={async () => {
|
||||
handleExport();
|
||||
}}
|
||||
>
|
||||
<PlusOutlined />
|
||||
<FormattedMessage id="pages.searchTable.export" defaultMessage="导出" />
|
||||
</Button>,
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
<UpdateForm
|
||||
onSubmit={async (values) => {
|
||||
let success = false;
|
||||
if (values.operId) {
|
||||
success = await handleUpdate({ ...values } as API.Monitor.Mobilelog);
|
||||
} else {
|
||||
success = await handleAdd({ ...values } as API.Monitor.Mobilelog);
|
||||
}
|
||||
if (success) {
|
||||
setModalVisible(false);
|
||||
setCurrentRow(undefined);
|
||||
if (actionRef.current) {
|
||||
actionRef.current.reload();
|
||||
}
|
||||
}
|
||||
}}
|
||||
onCancel={() => {
|
||||
setModalVisible(false);
|
||||
setCurrentRow(undefined);
|
||||
}}
|
||||
open={modalVisible}
|
||||
values={currentRow || {}}
|
||||
businessTypeOptions={businessTypeOptions}
|
||||
operatorTypeOptions={operatorTypeOptions}
|
||||
statusOptions={statusOptions}
|
||||
/>
|
||||
</PageContainer>
|
||||
|
||||
</>
|
||||
};
|
||||
|
||||
export default MobileLog
|
||||
@@ -1,113 +0,0 @@
|
||||
import React from 'react';
|
||||
import { Descriptions, Modal } from 'antd';
|
||||
import { useIntl, FormattedMessage } from '@umijs/max';
|
||||
import { DictValueEnumObj } from '@/components/DictTag';
|
||||
import { getValueEnumLabel } from '@/utils/options';
|
||||
|
||||
export type OperlogFormData = Record<string, unknown> & Partial<API.Monitor.Operlog>;
|
||||
|
||||
export type OperlogFormProps = {
|
||||
onCancel: (flag?: boolean, formVals?: OperlogFormData) => void;
|
||||
onSubmit: (values: OperlogFormData) => Promise<void>;
|
||||
open: boolean;
|
||||
values: Partial<API.Monitor.Operlog>;
|
||||
businessTypeOptions: DictValueEnumObj;
|
||||
operatorTypeOptions: DictValueEnumObj;
|
||||
statusOptions: DictValueEnumObj;
|
||||
};
|
||||
|
||||
const OperlogDetailForm: React.FC<OperlogFormProps> = (props) => {
|
||||
|
||||
const { values, businessTypeOptions, operatorTypeOptions, statusOptions, } = props;
|
||||
|
||||
const intl = useIntl();
|
||||
const handleOk = () => {};
|
||||
const handleCancel = () => {
|
||||
props.onCancel();
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal
|
||||
width={640}
|
||||
title={intl.formatMessage({
|
||||
id: 'monitor.operlog.title',
|
||||
defaultMessage: '编辑操作日志记录',
|
||||
})}
|
||||
open={props.open}
|
||||
destroyOnClose
|
||||
onOk={handleOk}
|
||||
onCancel={handleCancel}
|
||||
>
|
||||
<Descriptions column={24}>
|
||||
<Descriptions.Item
|
||||
span={12}
|
||||
label={<FormattedMessage id="monitor.operlog.module" defaultMessage="操作模块" />}
|
||||
>
|
||||
{`${values.title}/${getValueEnumLabel(businessTypeOptions, values.businessType)}`}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item
|
||||
span={12}
|
||||
label={<FormattedMessage id="monitor.operlog.request_method" defaultMessage="请求方式" />}
|
||||
>
|
||||
{values.requestMethod}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item
|
||||
span={12}
|
||||
label={<FormattedMessage id="monitor.operlog.oper_name" defaultMessage="操作人员" />}
|
||||
>
|
||||
{`${values.operName}/${values.operIp}`}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item
|
||||
span={12}
|
||||
label={<FormattedMessage id="monitor.operlog.operator_type" defaultMessage="操作类别" />}
|
||||
>
|
||||
{getValueEnumLabel(operatorTypeOptions, values.operatorType)}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item
|
||||
span={24}
|
||||
label={<FormattedMessage id="monitor.operlog.method" defaultMessage="方法名称" />}
|
||||
>
|
||||
{values.method}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item
|
||||
span={24}
|
||||
label={<FormattedMessage id="monitor.operlog.oper_url" defaultMessage="请求URL" />}
|
||||
>
|
||||
{values.operUrl}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item
|
||||
span={24}
|
||||
label={<FormattedMessage id="monitor.operlog.oper_param" defaultMessage="请求参数" />}
|
||||
>
|
||||
{values.operParam}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item
|
||||
span={24}
|
||||
label={<FormattedMessage id="monitor.operlog.json_result" defaultMessage="返回参数" />}
|
||||
>
|
||||
{values.jsonResult}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item
|
||||
span={24}
|
||||
label={<FormattedMessage id="monitor.operlog.error_msg" defaultMessage="错误消息" />}
|
||||
>
|
||||
{values.errorMsg}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item
|
||||
span={12}
|
||||
label={<FormattedMessage id="monitor.operlog.status" defaultMessage="操作状态" />}
|
||||
>
|
||||
{getValueEnumLabel(statusOptions, values.status)}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item
|
||||
span={12}
|
||||
label={<FormattedMessage id="monitor.operlog.oper_time" defaultMessage="操作时间" />}
|
||||
>
|
||||
{values.operTime?.toString()}
|
||||
</Descriptions.Item>
|
||||
</Descriptions>
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
|
||||
export default OperlogDetailForm;
|
||||
@@ -1,365 +0,0 @@
|
||||
|
||||
import React, { useState, useRef, useEffect } from 'react';
|
||||
import { useIntl, FormattedMessage, useAccess } from '@umijs/max';
|
||||
import type { FormInstance } from 'antd';
|
||||
import { Button, message, Modal } from 'antd';
|
||||
import { ActionType, FooterToolbar, PageContainer, ProColumns, ProTable } from '@ant-design/pro-components';
|
||||
import { PlusOutlined, DeleteOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
|
||||
import { getOperlogList, removeOperlog, addOperlog, updateOperlog, exportOperlog } from '@/services/monitor/operlog';
|
||||
import UpdateForm from './detail';
|
||||
import { getDictValueEnum } from '@/services/system/dict';
|
||||
import DictTag from '@/components/DictTag';
|
||||
|
||||
/**
|
||||
* 添加节点
|
||||
*
|
||||
* @param fields
|
||||
*/
|
||||
const handleAdd = async (fields: API.Monitor.Operlog) => {
|
||||
const hide = message.loading('正在添加');
|
||||
try {
|
||||
const resp = await addOperlog({ ...fields });
|
||||
hide();
|
||||
if (resp.code === 200) {
|
||||
message.success('添加成功');
|
||||
} else {
|
||||
message.error(resp.msg);
|
||||
}
|
||||
return true;
|
||||
} catch (error) {
|
||||
hide();
|
||||
message.error('添加失败请重试!');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 更新节点
|
||||
*
|
||||
* @param fields
|
||||
*/
|
||||
const handleUpdate = async (fields: API.Monitor.Operlog) => {
|
||||
const hide = message.loading('正在更新');
|
||||
try {
|
||||
const resp = await updateOperlog(fields);
|
||||
hide();
|
||||
if (resp.code === 200) {
|
||||
message.success('更新成功');
|
||||
} else {
|
||||
message.error(resp.msg);
|
||||
}
|
||||
return true;
|
||||
} catch (error) {
|
||||
hide();
|
||||
message.error('配置失败请重试!');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 删除节点
|
||||
*
|
||||
* @param selectedRows
|
||||
*/
|
||||
const handleRemove = async (selectedRows: API.Monitor.Operlog[]) => {
|
||||
const hide = message.loading('正在删除');
|
||||
if (!selectedRows) return true;
|
||||
try {
|
||||
const resp = await removeOperlog(selectedRows.map((row) => row.operId).join(','));
|
||||
hide();
|
||||
if (resp.code === 200) {
|
||||
message.success('删除成功,即将刷新');
|
||||
} else {
|
||||
message.error(resp.msg);
|
||||
}
|
||||
return true;
|
||||
} catch (error) {
|
||||
hide();
|
||||
message.error('删除失败,请重试');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*
|
||||
*
|
||||
*/
|
||||
const handleExport = async () => {
|
||||
const hide = message.loading('正在导出');
|
||||
try {
|
||||
await exportOperlog();
|
||||
hide();
|
||||
message.success('导出成功');
|
||||
return true;
|
||||
} catch (error) {
|
||||
hide();
|
||||
message.error('导出失败,请重试');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const OperlogTableList: React.FC = () => {
|
||||
const formTableRef = useRef<FormInstance>();
|
||||
|
||||
const [modalVisible, setModalVisible] = useState<boolean>(false);
|
||||
|
||||
const actionRef = useRef<ActionType>();
|
||||
const [currentRow, setCurrentRow] = useState<API.Monitor.Operlog>();
|
||||
const [selectedRows, setSelectedRows] = useState<API.Monitor.Operlog[]>([]);
|
||||
|
||||
const [businessTypeOptions, setBusinessTypeOptions] = useState<any>([]);
|
||||
const [operatorTypeOptions, setOperatorTypeOptions] = useState<any>([]);
|
||||
const [statusOptions, setStatusOptions] = useState<any>([]);
|
||||
|
||||
const access = useAccess();
|
||||
|
||||
/** 国际化配置 */
|
||||
const intl = useIntl();
|
||||
|
||||
useEffect(() => {
|
||||
getDictValueEnum('sys_oper_type', true).then((data) => {
|
||||
setBusinessTypeOptions(data);
|
||||
});
|
||||
getDictValueEnum('sys_oper_type', true).then((data) => {
|
||||
setOperatorTypeOptions(data);
|
||||
});
|
||||
getDictValueEnum('sys_common_status', true).then((data) => {
|
||||
setStatusOptions(data);
|
||||
});
|
||||
}, []);
|
||||
|
||||
const columns: ProColumns<API.Monitor.Operlog>[] = [
|
||||
{
|
||||
title: <FormattedMessage id="monitor.operlog.oper_id" defaultMessage="日志主键" />,
|
||||
dataIndex: 'operId',
|
||||
valueType: 'text',
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: <FormattedMessage id="monitor.operlog.title" defaultMessage="操作模块" />,
|
||||
dataIndex: 'title',
|
||||
valueType: 'text',
|
||||
},
|
||||
{
|
||||
title: <FormattedMessage id="monitor.operlog.business_type" defaultMessage="业务类型" />,
|
||||
dataIndex: 'businessType',
|
||||
valueType: 'select',
|
||||
valueEnum: businessTypeOptions,
|
||||
render: (_, record) => {
|
||||
return (<DictTag enums={businessTypeOptions} value={record.businessType} />);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: <FormattedMessage id="monitor.operlog.request_method" defaultMessage="请求方式" />,
|
||||
dataIndex: 'requestMethod',
|
||||
valueType: 'text',
|
||||
},
|
||||
{
|
||||
title: <FormattedMessage id="monitor.operlog.operator_type" defaultMessage="操作类别" />,
|
||||
dataIndex: 'operatorType',
|
||||
valueType: 'select',
|
||||
valueEnum: operatorTypeOptions,
|
||||
render: (_, record) => {
|
||||
return (<DictTag enums={operatorTypeOptions} value={record.operatorType} />);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: <FormattedMessage id="monitor.operlog.oper_name" defaultMessage="操作人员" />,
|
||||
dataIndex: 'operName',
|
||||
valueType: 'text',
|
||||
},
|
||||
{
|
||||
title: <FormattedMessage id="monitor.operlog.oper_ip" defaultMessage="主机地址" />,
|
||||
dataIndex: 'operIp',
|
||||
valueType: 'text',
|
||||
},
|
||||
{
|
||||
title: <FormattedMessage id="monitor.operlog.oper_location" defaultMessage="操作地点" />,
|
||||
dataIndex: 'operLocation',
|
||||
valueType: 'text',
|
||||
},
|
||||
{
|
||||
title: <FormattedMessage id="monitor.operlog.status" defaultMessage="操作状态" />,
|
||||
dataIndex: 'status',
|
||||
valueType: 'select',
|
||||
valueEnum: statusOptions,
|
||||
render: (_, record) => {
|
||||
return (<DictTag key="status" enums={statusOptions} value={record.status} />);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: <FormattedMessage id="monitor.operlog.oper_time" defaultMessage="操作时间" />,
|
||||
dataIndex: 'operTime',
|
||||
valueType: 'dateTime',
|
||||
},
|
||||
{
|
||||
title: <FormattedMessage id="pages.searchTable.titleOption" defaultMessage="操作" />,
|
||||
dataIndex: 'option',
|
||||
width: '120px',
|
||||
valueType: 'option',
|
||||
render: (_, record) => [
|
||||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
key="edit"
|
||||
hidden={!access.hasPerms('system:mobilelog:edit')}
|
||||
onClick={() => {
|
||||
setModalVisible(true);
|
||||
setCurrentRow(record);
|
||||
}}
|
||||
>
|
||||
详细
|
||||
</Button>,
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<PageContainer>
|
||||
<div style={{ width: '100%', float: 'right' }}>
|
||||
<ProTable<API.Monitor.Operlog>
|
||||
headerTitle={intl.formatMessage({
|
||||
id: 'pages.searchTable.title',
|
||||
defaultMessage: '信息',
|
||||
})}
|
||||
actionRef={actionRef}
|
||||
formRef={formTableRef}
|
||||
rowKey="operId"
|
||||
key="operlogList"
|
||||
search={{
|
||||
labelWidth: 120,
|
||||
}}
|
||||
toolBarRender={() => [
|
||||
// <Button
|
||||
// type="primary"
|
||||
// key="add"
|
||||
// hidden={!access.hasPerms('system:mobilelog:add')}
|
||||
// onClick={async () => {
|
||||
// setCurrentRow(undefined);
|
||||
// setModalVisible(true);
|
||||
// }}
|
||||
// >
|
||||
// <PlusOutlined /> <FormattedMessage id="pages.searchTable.new" defaultMessage="新建" />
|
||||
// </Button>,
|
||||
<Button
|
||||
type="primary"
|
||||
key="remove"
|
||||
danger
|
||||
hidden={selectedRows?.length === 0 || !access.hasPerms('system:mobilelog:remove')}
|
||||
onClick={async () => {
|
||||
Modal.confirm({
|
||||
title: '是否确认删除所选数据项?',
|
||||
icon: <ExclamationCircleOutlined />,
|
||||
content: '请谨慎操作',
|
||||
async onOk() {
|
||||
const success = await handleRemove(selectedRows);
|
||||
if (success) {
|
||||
setSelectedRows([]);
|
||||
actionRef.current?.reloadAndRest?.();
|
||||
}
|
||||
},
|
||||
onCancel() { },
|
||||
});
|
||||
}}
|
||||
>
|
||||
<DeleteOutlined />
|
||||
<FormattedMessage id="pages.searchTable.delete" defaultMessage="删除" />
|
||||
</Button>,
|
||||
<Button
|
||||
type="primary"
|
||||
key="export"
|
||||
hidden={!access.hasPerms('system:mobilelog:export')}
|
||||
onClick={async () => {
|
||||
handleExport();
|
||||
}}
|
||||
>
|
||||
<PlusOutlined />
|
||||
<FormattedMessage id="pages.searchTable.export" defaultMessage="导出" />
|
||||
</Button>,
|
||||
]}
|
||||
request={(params) =>
|
||||
getOperlogList({ ...params } as API.Monitor.OperlogListParams).then((res) => {
|
||||
const result = {
|
||||
data: res.rows,
|
||||
total: res.total,
|
||||
success: true,
|
||||
};
|
||||
return result;
|
||||
})
|
||||
}
|
||||
columns={columns}
|
||||
rowSelection={{
|
||||
onChange: (_, selectedRows) => {
|
||||
setSelectedRows(selectedRows);
|
||||
},
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
{selectedRows?.length > 0 && (
|
||||
<FooterToolbar
|
||||
extra={
|
||||
<div>
|
||||
<FormattedMessage id="pages.searchTable.chosen" defaultMessage="已选择" />
|
||||
<a style={{ fontWeight: 600 }}>{selectedRows.length}</a>
|
||||
<FormattedMessage id="pages.searchTable.item" defaultMessage="项" />
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<Button
|
||||
key="remove"
|
||||
danger
|
||||
hidden={!access.hasPerms('system:mobilelog:del')}
|
||||
onClick={async () => {
|
||||
Modal.confirm({
|
||||
title: '删除',
|
||||
content: '确定删除该项吗?',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: async () => {
|
||||
const success = await handleRemove(selectedRows);
|
||||
if (success) {
|
||||
setSelectedRows([]);
|
||||
actionRef.current?.reloadAndRest?.();
|
||||
}
|
||||
},
|
||||
});
|
||||
}}
|
||||
>
|
||||
<FormattedMessage id="pages.searchTable.batchDeletion" defaultMessage="批量删除" />
|
||||
</Button>
|
||||
</FooterToolbar>
|
||||
)}
|
||||
<UpdateForm
|
||||
onSubmit={async (values) => {
|
||||
let success = false;
|
||||
if (values.operId) {
|
||||
success = await handleUpdate({ ...values } as API.Monitor.Operlog);
|
||||
} else {
|
||||
success = await handleAdd({ ...values } as API.Monitor.Operlog);
|
||||
}
|
||||
if (success) {
|
||||
setModalVisible(false);
|
||||
setCurrentRow(undefined);
|
||||
if (actionRef.current) {
|
||||
actionRef.current.reload();
|
||||
}
|
||||
}
|
||||
}}
|
||||
onCancel={() => {
|
||||
setModalVisible(false);
|
||||
setCurrentRow(undefined);
|
||||
}}
|
||||
open={modalVisible}
|
||||
values={currentRow || {}}
|
||||
businessTypeOptions={businessTypeOptions}
|
||||
operatorTypeOptions={operatorTypeOptions}
|
||||
statusOptions={statusOptions}
|
||||
/>
|
||||
</PageContainer>
|
||||
);
|
||||
};
|
||||
|
||||
export default OperlogTableList;
|
||||
Reference in New Issue
Block a user