wyq 3 years ago
parent
commit
0aad032fda
2 changed files with 47 additions and 2 deletions
  1. 1 0
      src/api/request.js
  2. 46 2
      src/components/ExceptionLog/index.js

+ 1 - 0
src/api/request.js

@@ -66,6 +66,7 @@ const request = {
     getOperationLog: '/security-center/logManage/getOperationLog',//操作日志
     getLoginLog: '/security-center/logManage/getLoginLog',//登录日志
     getAbnormalLog: '/security-center/logManage/getAbnormalLog',//异常日志
+    getAbnormalLogWayAndIp: '/security-center/logManage/getAbnormalLogWayAndIp',//查看异常日志
 }
 
 export default request;

+ 46 - 2
src/components/ExceptionLog/index.js

@@ -10,11 +10,14 @@ function ExceptionLog() {
   useEffect(() => {
     getAbnormalLog();
     console.log(123);
-    
+
   }, []);
   const [logList, setLogList] = useState([]);
   const [total, setTotal] = useState(0);
   const [size, setSize] = useState(15);
+  const [msvisible, setMsvisible] = useState(false);
+  const [tipText, setTipText] = useState('');
+  
   const [form] = Form.useForm();
 
   let list = []
@@ -29,7 +32,7 @@ function ExceptionLog() {
       if (res.data.code === 200) {
         const data = res.data.data;
         console.log(data);
-        
+
         setLogList(data.records);
         setTotal(data.total)
       }
@@ -47,6 +50,28 @@ function ExceptionLog() {
     params.size = pageSize
     getAbnormalLog()
   }
+  function showModal(operationWay) {
+    setMsvisible(true)
+    getAbnormalLogWayAndIp(operationWay)
+  }
+  function handleOk() {
+    setMsvisible(false)
+  }
+  function handleCancel() {
+    setMsvisible(false)
+  }
+  function getAbnormalLogWayAndIp(operationWay) {
+    let params = {
+      mark:0,
+      operationWay: operationWay
+    }
+    post(api.getAbnormalLogWayAndIp, params).then((res) => {
+      if (res.data.code === 200) {
+        const data = res.data.data;
+        setTipText(data)
+      }
+    })
+  }
   const onFinish = (value) => {
     params = {
       ...params,
@@ -74,6 +99,13 @@ function ExceptionLog() {
     { title: 'IP地址', dataIndex: 'operationIp', key: 'index' },
     { title: '用户代理', dataIndex: 'operationName', key: 'index' },
     { title: '创建时间', dataIndex: 'gmtCreate', key: 'index' },
+    {
+      title: '操作', dataIndex: 'key', render: (text, record) => (
+        <Space size="middle">
+          <a onClick={e => showModal(record.operationWay)}>查看</a>
+        </Space>
+      )
+    }
   ]
   return (
     <div className="wrapper">
@@ -127,6 +159,18 @@ function ExceptionLog() {
             onChange: (page, pageSize) => changePage(page, pageSize),//点击页码事件
             total: total
           }} />
+
+        <Modal
+          title="查看异常"
+          okText='确定'
+          cancelText='取消'
+          width={400}
+          visible={msvisible}
+          onOk={handleOk}
+          onCancel={handleCancel}
+        >
+          <p>{tipText}</p>
+        </Modal>
       </div>
     </div >
   )