| | |
| | | import { PlusOutlined, DeleteOutlined, ExclamationCircleOutlined, UnlockOutlined } from '@ant-design/icons'; |
| | | import { getLogininforList, removeLogininfor, exportLogininfor, unlockLogininfor, cleanLogininfor } from '@/services/monitor/logininfor'; |
| | | import { request } from '@umijs/max'; |
| | | import Http from '@/utils/http' |
| | | |
| | | |
| | | /** |
| | |
| | | |
| | | |
| | | const LogininforTableList = () => { |
| | | |
| | | const formTableRef = useRef(); |
| | | |
| | | const actionRef = useRef(); |
| | |
| | | const intl = useIntl(); |
| | | |
| | | useEffect(() => { |
| | | // getDictValueEnum('sys_common_status', true).then((data) => { |
| | | // setStatusOptions(data); |
| | | // }); |
| | | |
| | | }, []); |
| | | |
| | | const columns = [ |
| | | { |
| | | title: <FormattedMessage id="monitor.logininfor.info_id" defaultMessage="访问编号" />, |
| | | dataIndex: 'infoId', |
| | | valueType: 'text', |
| | | hideInSearch: true, |
| | | }, |
| | | { |
| | | title: '姓名', |
| | | dataIndex: 'name', |
| | | valueType: 'text', |
| | | }, |
| | | { |
| | | title: <FormattedMessage id="monitor.logininfor.user_name" defaultMessage="用户账号" />, |
| | | dataIndex: 'userName', |
| | | title: '标识', |
| | | dataIndex: 'code', |
| | | 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', |
| | | valueEnum: statusOptions, |
| | | // 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', |
| | | }, |
| | | // { |
| | | // 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', |
| | | // valueEnum: statusOptions, |
| | | // // 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 ( |
| | |
| | | <FormattedMessage id="pages.searchTable.export" defaultMessage="导出" /> |
| | | </Button>, |
| | | ]} |
| | | request={(params) => { |
| | | console.log(params); |
| | | request('/api/role/page', { |
| | | method: 'POST', |
| | | headers: { |
| | | 'Content-Type': 'application/json' |
| | | }, |
| | | data: { ...params } |
| | | }).then((res) => { |
| | | if (res.code === 200) { |
| | | const result = { |
| | | data: res.records, |
| | | total: res.total, |
| | | success: true, |
| | | }; |
| | | return result; |
| | | } else { |
| | | message.error(res.msg) |
| | | request={(params) => |
| | | Http.doPost('/api/role/page', params, (res) => { |
| | | return { |
| | | data: res.data.records, |
| | | total: res.data.total, |
| | | success: true, |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | columns={columns} |
| | | rowSelection={{ |
| | |
| | | import { request } from '@umijs/max'; |
| | | import { message, Modal } from 'antd'; |
| | | |
| | | const doGet = (url, params, fn) => { |
| | | return request(url, { |
| | | method: 'GET', |
| | | params |
| | | }).then((res) => { |
| | | if (res.code === 200) { |
| | | if (fn) { |
| | | return fn(res); |
| | | } else { |
| | | return res; |
| | | } |
| | | } else { |
| | | message.error(res.msg) |
| | | } |
| | | }); |
| | | } |
| | | |
| | | const doGetSync = async (url, params) => { |
| | | const res = await request(url, { |
| | | method: 'GET', |
| | | params |
| | | }); |
| | | if (res.code === 200) { |
| | | return res; |
| | | } |
| | | message.error(res.msg) |
| | | } |
| | | |
| | | const doPost = (url, params, fn) => { |
| | | return request(url, { |
| | | method: 'POST', |
| | | headers: { |
| | | 'Content-Type': 'application/json' |
| | | }, |
| | | data: { ...params } |
| | | }).then((res) => { |
| | | if (res.code === 200) { |
| | | if (fn) { |
| | | return fn(res); |
| | | } else { |
| | | return res; |
| | | } |
| | | } else { |
| | | message.error(res.msg) |
| | | } |
| | | }); |
| | | } |
| | | |
| | | const doPostSync = async (url, params) => { |
| | | const res = await request(url, { |
| | | method: 'POST', |
| | | headers: { |
| | | 'Content-Type': 'application/json' |
| | | }, |
| | | data: { ...params } |
| | | }); |
| | | if (res.code === 200) { |
| | | return res; |
| | | } |
| | | message.error(res.msg) |
| | | } |
| | | |
| | | const Http = { doGet, doGetSync, doPost, doPostSync } |
| | | |
| | | export default Http; |