From 828641ce9d4178bbff9030ad19ce93d0267f185c Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期三, 17 九月 2025 08:36:42 +0800
Subject: [PATCH] no message

---
 zy-asrs-flow/src/pages/system/userLogin/index.jsx |  717 ++++++++++++++++++++++++-----------------------------------
 1 files changed, 289 insertions(+), 428 deletions(-)

diff --git a/zy-asrs-flow/src/pages/system/userLogin/index.jsx b/zy-asrs-flow/src/pages/system/userLogin/index.jsx
index b324a9f..badb391 100644
--- a/zy-asrs-flow/src/pages/system/userLogin/index.jsx
+++ b/zy-asrs-flow/src/pages/system/userLogin/index.jsx
@@ -1,428 +1,289 @@
-
-import React, { useState, useRef, useEffect } from 'react';
-import { Button, message, Modal, Tag } from 'antd';
-import {
-    FooterToolbar,
-    PageContainer,
-    ProTable,
-    LightFilter,
-} from '@ant-design/pro-components';
-import { FormattedMessage, useIntl } from '@umijs/max';
-import { PlusOutlined, ExportOutlined } from '@ant-design/icons';
-import Http from '@/utils/http';
-import Edit from './components/edit'
-import { TextFilter, SelectFilter, DatetimeRangeFilter, LinkFilter } from '@/components/TableSearch'
-import { repairBug } from '@/utils/common-util';
-
-const TABLE_KEY = "pro-table-userLogin";
-
-const typeMap = {
-    0: {
-        color: '#87d068',
-        text: '鐧诲綍鎴愬姛',
-    },
-    1: {
-        color: '#f50',
-        text: '鐧诲綍澶辫触',
-    },
-    2: {
-        color: '',
-        text: '閫�鍑虹櫥褰�',
-    },
-    3: {
-        color: '#3b5999',
-        text: '缁token',
-    },
-};
-
-const handleSave = async (val, intl) => {
-    const hide = message.loading('姝e湪娣诲姞');
-    try {
-        const resp = await Http.doPost('api/userLogin/save', val);
-        if (resp.code === 200) {
-            message.success('娣诲姞鎴愬姛');
-            return true;
-        } else {
-            message.error(resp.msg);
-            return false;
-        }
-    } catch (error) {
-        message.error('娣诲姞澶辫触璇烽噸璇曪紒');
-        return false;
-    } finally {
-        hide();
-    }
-};
-
-const handleUpdate = async (val, intl) => {
-    const hide = message.loading('姝e湪鏇存柊');
-    try {
-        const resp = await Http.doPost('api/userLogin/update', val);
-        if (resp.code === 200) {
-            message.success('鏇存柊鎴愬姛');
-            return true;
-        } else {
-            message.error(resp.msg);
-            return false;
-        }
-    } catch (error) {
-        message.error('閰嶇疆澶辫触璇烽噸璇曪紒');
-        return false;
-    } finally {
-        hide();
-    }
-};
-
-const handleRemove = async (rows, intl) => {
-    if (!rows) return true;
-    const hide = message.loading('姝e湪鍒犻櫎');
-    try {
-        const resp = await Http.doPost('api/userLogin/remove/' + rows.map((row) => row.id).join(','));
-        if (resp.code === 200) {
-            message.success('鍒犻櫎鎴愬姛');
-            return true;
-        } else {
-            message.error(resp.msg);
-            return false;
-        }
-    } catch (error) {
-        message.error('鍒犻櫎澶辫触锛岃閲嶈瘯');
-        return false;
-    } finally {
-        hide();
-    }
-};
-
-const handleExport = async (intl) => {
-    const hide = message.loading('姝e湪瀵煎嚭');
-    try {
-        const resp = await Http.doPostBlob('api/userLogin/export');
-        const blob = new Blob([resp], { type: 'application/vnd.ms-excel' });
-        window.location.href = window.URL.createObjectURL(blob);
-        message.success('瀵煎嚭鎴愬姛');
-        return true;
-    } catch (error) {
-        message.error('瀵煎嚭澶辫触锛岃閲嶈瘯');
-        return false;
-    } finally {
-        hide();
-    }
-};
-
-
-const Main = () => {
-    const intl = useIntl();
-    const formTableRef = useRef();
-    const actionRef = useRef();
-    const [selectedRows, setSelectedRows] = useState([]);
-    const [modalVisible, setModalVisible] = useState(false);
-    const [currentRow, setCurrentRow] = useState();
-    const [searchParam, setSearchParam] = useState({});
-
-    useEffect(() => {
-
-    }, []);
-
-    const columns = [
-        {
-            title: 'No',
-            dataIndex: 'index',
-            valueType: 'indexBorder',
-            width: 48,
-        },
-        {
-            title: '鐢ㄦ埛',
-            dataIndex: 'userId$',
-            valueType: 'text',
-            hidden: false,
-            width: 140,
-            filterDropdown: (props) => <LinkFilter
-                name='userId'
-                major='user'
-                {...props}
-                actionRef={actionRef}
-                setSearchParam={setSearchParam}
-            />,
-        },
-        {
-            title: '瀵嗛挜',
-            dataIndex: 'token',
-            valueType: 'text',
-            hidden: false,
-            ellipsis: true,
-            width: 140,
-            copyable: true,
-            filterDropdown: (props) => <TextFilter
-                name='token'
-                {...props}
-                actionRef={actionRef}
-                setSearchParam={setSearchParam}
-            />,
-        },
-        {
-            title: '鐧诲綍ip',
-            dataIndex: 'ip',
-            valueType: 'text',
-            hidden: false,
-            width: 140,
-            filterDropdown: (props) => <TextFilter
-                name='ip'
-                {...props}
-                actionRef={actionRef}
-                setSearchParam={setSearchParam}
-            />,
-        },
-        {
-            title: '绫诲瀷',
-            dataIndex: 'type',
-            valueType: 'text',
-            hidden: false,
-            width: 140,
-            filterDropdown: (props) => <SelectFilter
-                name='type'
-                {...props}
-                actionRef={actionRef}
-                setSearchParam={setSearchParam}
-                data={[
-                    { label: '鐧诲綍鎴愬姛', value: 0 },
-                    { label: '鐧诲綍澶辫触', value: 1 },
-                    { label: '閫�鍑虹櫥褰�', value: 2 },
-                    { label: '缁token', value: 3 },
-                ]}
-            />,
-            render: (_, record) => {
-                const type = typeMap[record.type]
-                return <Tag color={type.color}>{type.text}</Tag>
-            },
-        },
-        {
-            title: '娣诲姞鏃堕棿',
-            dataIndex: 'createTime$',
-            valueType: 'text',
-            hidden: false,
-            width: 140,
-            filterDropdown: (props) => <DatetimeRangeFilter
-                name='createTime'
-                {...props}
-                actionRef={actionRef}
-                setSearchParam={setSearchParam}
-            />,
-        },
-        {
-            title: '鐧诲綍绯荤粺',
-            dataIndex: 'system',
-            valueType: 'text',
-            hidden: false,
-            width: 140,
-            filterDropdown: (props) => <TextFilter
-                name='system'
-                {...props}
-                actionRef={actionRef}
-                setSearchParam={setSearchParam}
-            />,
-        },
-        {
-            title: '澶囨敞',
-            dataIndex: 'memo',
-            valueType: 'text',
-            hidden: false,
-            width: 140,
-            filterDropdown: (props) => <TextFilter
-                name='memo'
-                {...props}
-                actionRef={actionRef}
-                setSearchParam={setSearchParam}
-            />,
-        },
-
-        {
-            title: '鎿嶄綔',
-            dataIndex: 'option',
-            width: 140,
-            hidden: true,
-            valueType: 'option',
-            render: (_, record) => [
-                <Button
-                    type="link"
-                    key="edit"
-                    hidden="true"
-                    onClick={() => {
-                        setModalVisible(true);
-                        setCurrentRow(record);
-                    }}
-                >
-                    缂栬緫
-                </Button>,
-                <Button
-                    type="link"
-                    danger
-                    hidden="true"
-                    key="batchRemove"
-                    onClick={async () => {
-                        Modal.confirm({
-                            title: '鍒犻櫎',
-                            content: '纭畾鍒犻櫎璇ラ」鍚楋紵',
-                            onOk: async () => {
-                                const success = await handleRemove([record], intl);
-                                if (success) {
-                                    if (actionRef.current) {
-                                        actionRef.current.reload();
-                                    }
-                                }
-                            },
-                        });
-                    }}
-                >
-                    鍒犻櫎
-                </Button>,
-            ],
-        },
-    ];
-
-    return (
-        <PageContainer
-            header={{
-                breadcrumb: {},
-            }}
-        >
-            <div style={{ width: '100%', float: 'right' }}>
-                <ProTable
-                    key="userLogin"
-                    rowKey="id"
-                    actionRef={actionRef}
-                    formRef={formTableRef}
-                    columns={columns}
-                    cardBordered
-                    scroll={{ x: 1300 }}
-                    dateFormatter="string"
-                    pagination={{ pageSize: 16 }}
-                    search={false}
-                    style={{
-                        marginBottom: '20px'
-                    }}
-                    toolbar={{
-                        search: {
-                            onSearch: (value) => {
-                                setSearchParam(prevState => ({
-                                    ...prevState,
-                                    condition: value
-                                }));
-                                actionRef.current?.reload();
-                            },
-                        },
-                        filter: (
-                            <LightFilter
-                                onValuesChange={(val) => {
-                                }}
-                            >
-                            </LightFilter>
-                        ),
-                        actions: [
-                            <Button
-                                type="primary"
-                                key="save"
-                                hidden="true"
-                                onClick={async () => {
-                                    setModalVisible(true)
-                                }}
-                            >
-                                <PlusOutlined />
-                                娣诲姞
-                            </Button>,
-                            <Button
-                                key="export"
-                                onClick={async () => {
-                                    handleExport(intl);
-                                }}
-                            >
-                                <ExportOutlined />
-                                瀵煎嚭
-                            </Button>,
-                        ],
-                    }}
-                    request={(params, sorter, filter) =>
-                        Http.doPostPromise('/api/userLogin/page', { ...params, ...searchParam }, (res) => {
-                            return {
-                                data: res.data.records,
-                                total: res.data.total,
-                                success: true,
-                            }
-                        })
-                    }
-                    rowSelection={undefined}
-                    columnsState={{
-                        persistenceKey: TABLE_KEY,
-                        persistenceType: 'localStorage',
-                        defaultValue: {
-                            system: { show: repairBug(TABLE_KEY, 'system', false) },
-                            option: { fixed: 'right', disable: true },
-                        },
-                        onChange(value) {
-                        },
-                    }}
-                />
-            </div>
-
-            {selectedRows?.length > 0 && false && (
-                <FooterToolbar
-                    extra={
-                        <div>
-                            宸查�夋嫨
-                            <a style={{ fontWeight: 600 }}>{selectedRows.length}</a>
-                            椤�
-                        </div>
-                    }
-                >
-                    <Button
-                        key="remove"
-                        danger
-                        onClick={async () => {
-                            Modal.confirm({
-                                title: '鍒犻櫎',
-                                content: '纭畾鍒犻櫎璇ラ」鍚楋紵',
-                                onOk: async () => {
-                                    const success = await handleRemove(selectedRows, intl);
-                                    if (success) {
-                                        setSelectedRows([]);
-                                        actionRef.current?.reloadAndRest?.();
-                                    }
-                                },
-                            });
-                        }}
-                    >
-                        鎵归噺鍒犻櫎
-                    </Button>
-                </FooterToolbar>
-            )}
-
-            <Edit
-                open={modalVisible}
-                values={currentRow || {}}
-                onCancel={
-                    () => {
-                        setModalVisible(false);
-                        setCurrentRow(undefined);
-                    }
-                }
-                onSubmit={async (values) => {
-                    let ok = false;
-                    if (values.id) {
-                        ok = await handleUpdate({ ...values }, intl)
-                    } else {
-                        ok = await handleSave({ ...values }, intl)
-                    }
-                    if (ok) {
-                        setModalVisible(false);
-                        setCurrentRow(undefined);
-                        if (actionRef.current) {
-                            actionRef.current.reload();
-                        }
-                    }
-                }
-                }
-            />
-        </PageContainer>
-    );
-};
-
-export default Main;
+
+import React, { useState, useRef, useEffect } from 'react';
+import { Button, message, Modal, Tag } from 'antd';
+import {
+    FooterToolbar,
+    PageContainer,
+    ProTable,
+    LightFilter,
+} from '@ant-design/pro-components';
+import { FormattedMessage, useIntl } from '@umijs/max';
+import { PlusOutlined, ExportOutlined } from '@ant-design/icons';
+import Http from '@/utils/http';
+import Edit from './components/edit'
+import { TextFilter, SelectFilter, DatetimeRangeFilter, LinkFilter } from '@/components/TableSearch'
+import { repairBug } from '@/utils/common-util';
+
+const TABLE_KEY = "pro-table-userLogin";
+
+const typeMap = {
+    0: {
+        color: '#87d068',
+        text: '鐧诲綍鎴愬姛',
+    },
+    1: {
+        color: '#f50',
+        text: '鐧诲綍澶辫触',
+    },
+    2: {
+        color: '',
+        text: '閫�鍑虹櫥褰�',
+    },
+    3: {
+        color: '#3b5999',
+        text: '缁token',
+    },
+};
+
+const handleExport = async (intl) => {
+    const hide = message.loading(intl.formatMessage({ id: 'page.exporting', defaultMessage: '姝e湪瀵煎嚭' }));
+    try {
+        const resp = await Http.doPostBlob('api/userLogin/export');
+        const blob = new Blob([resp], { type: 'application/vnd.ms-excel' });
+        window.location.href = window.URL.createObjectURL(blob);
+        message.success(intl.formatMessage({ id: 'page.export.success', defaultMessage: '瀵煎嚭鎴愬姛' }));
+        return true;
+    } catch (error) {
+        message.error(intl.formatMessage({ id: 'page.export.fail', defaultMessage: '瀵煎嚭澶辫触锛岃閲嶈瘯' }));
+        return false;
+    } finally {
+        hide();
+    }
+};
+
+
+const Main = () => {
+    const intl = useIntl();
+    const formTableRef = useRef();
+    const actionRef = useRef();
+    const [selectedRows, setSelectedRows] = useState([]);
+    const [modalVisible, setModalVisible] = useState(false);
+    const [currentRow, setCurrentRow] = useState();
+    const [searchParam, setSearchParam] = useState({});
+
+    useEffect(() => {
+
+    }, []);
+
+    const columns = [
+        {
+            title: intl.formatMessage({
+                id: 'page.table.no',
+                defaultMessage: 'No'
+            }),
+            dataIndex: 'index',
+            valueType: 'indexBorder',
+            width: 48,
+        },
+        {
+            title: '鐢ㄦ埛',
+            dataIndex: 'userId$',
+            valueType: 'text',
+            hidden: false,
+            width: 140,
+            filterDropdown: (props) => <LinkFilter
+                name='userId'
+                major='user'
+                {...props}
+                actionRef={actionRef}
+                setSearchParam={setSearchParam}
+            />,
+        },
+        {
+            title: '瀵嗛挜',
+            dataIndex: 'token',
+            valueType: 'text',
+            hidden: false,
+            ellipsis: true,
+            width: 140,
+            copyable: true,
+            filterDropdown: (props) => <TextFilter
+                name='token'
+                {...props}
+                actionRef={actionRef}
+                setSearchParam={setSearchParam}
+            />,
+        },
+        {
+            title: '鐧诲綍ip',
+            dataIndex: 'ip',
+            valueType: 'text',
+            hidden: false,
+            width: 140,
+            filterDropdown: (props) => <TextFilter
+                name='ip'
+                {...props}
+                actionRef={actionRef}
+                setSearchParam={setSearchParam}
+            />,
+        },
+        {
+            title: '绫诲瀷',
+            dataIndex: 'type',
+            valueType: 'text',
+            hidden: false,
+            width: 140,
+            filterDropdown: (props) => <SelectFilter
+                name='type'
+                {...props}
+                actionRef={actionRef}
+                setSearchParam={setSearchParam}
+                data={[
+                    { label: '鐧诲綍鎴愬姛', value: 0 },
+                    { label: '鐧诲綍澶辫触', value: 1 },
+                    { label: '閫�鍑虹櫥褰�', value: 2 },
+                    { label: '缁token', value: 3 },
+                ]}
+            />,
+            render: (_, record) => {
+                const type = typeMap[record.type]
+                return <Tag color={type.color}>{type.text}</Tag>
+            },
+        },
+        {
+            title: '娣诲姞鏃堕棿',
+            dataIndex: 'createTime$',
+            valueType: 'text',
+            hidden: false,
+            width: 140,
+            filterDropdown: (props) => <DatetimeRangeFilter
+                name='createTime'
+                {...props}
+                actionRef={actionRef}
+                setSearchParam={setSearchParam}
+            />,
+        },
+        {
+            title: '鐧诲綍绯荤粺',
+            dataIndex: 'system',
+            valueType: 'text',
+            hidden: false,
+            width: 140,
+            filterDropdown: (props) => <TextFilter
+                name='system'
+                {...props}
+                actionRef={actionRef}
+                setSearchParam={setSearchParam}
+            />,
+        },
+        {
+            title: '澶囨敞',
+            dataIndex: 'memo',
+            valueType: 'text',
+            hidden: false,
+            width: 140,
+            filterDropdown: (props) => <TextFilter
+                name='memo'
+                {...props}
+                actionRef={actionRef}
+                setSearchParam={setSearchParam}
+            />,
+        },
+
+        {
+            title: '鎿嶄綔',
+            dataIndex: 'option',
+            width: 140,
+            hidden: true,
+            valueType: 'option',
+            render: (_, record) => [
+            ],
+        },
+    ];
+
+    return (
+        <PageContainer
+            header={{
+                breadcrumb: {},
+            }}
+        >
+            <div style={{ width: '100%', float: 'right' }}>
+                <ProTable
+                    key="userLogin"
+                    rowKey="id"
+                    actionRef={actionRef}
+                    formRef={formTableRef}
+                    columns={columns}
+                    cardBordered
+                    scroll={{ x: 1300 }}
+                    dateFormatter="string"
+                    pagination={{ pageSize: 16 }}
+                    search={false}
+                    style={{
+                        marginBottom: '20px'
+                    }}
+                    toolbar={{
+                        search: {
+                            onSearch: (value) => {
+                                setSearchParam(prevState => ({
+                                    ...prevState,
+                                    condition: value
+                                }));
+                                actionRef.current?.reload();
+                            },
+                        },
+                        filter: (
+                            <LightFilter
+                                onValuesChange={(val) => {
+                                }}
+                            >
+                            </LightFilter>
+                        ),
+                        actions: [
+                            <Button
+                                key="export"
+                                onClick={async () => {
+                                    handleExport(intl);
+                                }}
+                            >
+                                <ExportOutlined />
+                                <FormattedMessage id='page.export' defaultMessage='瀵煎嚭' />
+                            </Button>,
+                        ],
+                    }}
+                    request={(params, sorter, filter) =>
+                        Http.doPostPromise('/api/userLogin/page', { ...params, ...searchParam }, (res) => {
+                            return {
+                                data: res.data.records,
+                                total: res.data.total,
+                                success: true,
+                            }
+                        })
+                    }
+                    rowSelection={undefined}
+                    columnsState={{
+                        persistenceKey: TABLE_KEY,
+                        persistenceType: 'localStorage',
+                        defaultValue: {
+                            system: { show: repairBug(TABLE_KEY, 'system', false) },
+                            option: { fixed: 'right', disable: true },
+                        },
+                        onChange(value) {
+                        },
+                    }}
+                />
+            </div>
+
+            <Edit
+                open={modalVisible}
+                values={currentRow || {}}
+                onCancel={
+                    () => {
+                        setModalVisible(false);
+                        setCurrentRow(undefined);
+                    }
+                }
+                onSubmit={async (values) => {
+                    setModalVisible(false);
+                    setCurrentRow(undefined);
+                    if (actionRef.current) {
+                        actionRef.current.reload();
+                    }
+                }
+                }
+            />
+        </PageContainer>
+    );
+};
+
+export default Main;

--
Gitblit v1.9.1