From af1ec6c61f8c5a3b206f5fcf3e05428f8f9fa46f Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期三, 14 二月 2024 18:32:13 +0800
Subject: [PATCH] #

---
 zy-asrs-flow/src/pages/system/role/index.jsx |  138 ++++++++++++++++------------------
 zy-asrs-flow/src/utils/http.js               |   67 ++++++++++++++++
 2 files changed, 132 insertions(+), 73 deletions(-)

diff --git a/zy-asrs-flow/src/pages/system/role/index.jsx b/zy-asrs-flow/src/pages/system/role/index.jsx
index 905d50f..ab1f26e 100644
--- a/zy-asrs-flow/src/pages/system/role/index.jsx
+++ b/zy-asrs-flow/src/pages/system/role/index.jsx
@@ -6,6 +6,7 @@
 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'
 
 
 /**
@@ -89,6 +90,7 @@
 
 
 const LogininforTableList = () => {
+
     const formTableRef = useRef();
 
     const actionRef = useRef();
@@ -99,71 +101,74 @@
     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 (
@@ -263,27 +268,14 @@
                             <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={{
diff --git a/zy-asrs-flow/src/utils/http.js b/zy-asrs-flow/src/utils/http.js
index b988b19..4743ae6 100644
--- a/zy-asrs-flow/src/utils/http.js
+++ b/zy-asrs-flow/src/utils/http.js
@@ -1 +1,68 @@
 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;
\ No newline at end of file

--
Gitblit v1.9.1