#
luxiaotao1123
2024-02-27 03df7542cd456dc3e63a33cdd1f4cced5364f867
zy-asrs-flow/src/pages/system/userLogin/index.jsx
@@ -1,6 +1,6 @@
import React, { useState, useRef, useEffect } from 'react';
import { Button, message, Modal } from 'antd';
import { Button, message, Modal, Tag } from 'antd';
import {
    FooterToolbar,
    PageContainer,
@@ -14,6 +14,25 @@
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) => {
    const hide = message.loading('正在添加');
@@ -128,6 +147,7 @@
            dataIndex: 'token',
            valueType: 'text',
            hidden: false,
            ellipsis: true,
            width: 140,
            copyable: true,
            filterDropdown: (props) => <TextFilter
@@ -156,12 +176,22 @@
            valueType: 'text',
            hidden: false,
            width: 140,
            filterDropdown: (props) => <TextFilter
            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: '添加时间',
@@ -207,11 +237,13 @@
            title: '操作',
            dataIndex: 'option',
            width: 140,
            hidden: true,
            valueType: 'option',
            render: (_, record) => [
                <Button
                    type="link"
                    key="edit"
                    hidden="true"
                    onClick={() => {
                        setModalVisible(true);
                        setCurrentRow(record);
@@ -222,6 +254,7 @@
                <Button
                    type="link"
                    danger
                    hidden="true"
                    key="batchRemove"
                    onClick={async () => {
                        Modal.confirm({
@@ -260,8 +293,11 @@
                    cardBordered
                    scroll={{ x: 1300 }}
                    dateFormatter="string"
                    pagination={{ pageSize: 20 }}
                    pagination={{ pageSize: 16 }}
                    search={false}
                    style={{
                        marginBottom: '20px'
                    }}
                    toolbar={{
                        search: {
                            onSearch: (value) => {
@@ -283,6 +319,7 @@
                            <Button
                                type="primary"
                                key="save"
                                hidden="true"
                                onClick={async () => {
                                    setModalVisible(true)
                                }}
@@ -310,15 +347,12 @@
                            }
                        })
                    }
                    rowSelection={{
                        onChange: (ids, rows) => {
                            setSelectedRows(rows);
                        }
                    }}
                    rowSelection={undefined}
                    columnsState={{
                        persistenceKey: TABLE_KEY,
                        persistenceType: 'localStorage',
                        defaultValue: {
                            system: { show: repairBug(TABLE_KEY, 'system', false) },
                            option: { fixed: 'right', disable: true },
                        },
                        onChange(value) {
@@ -327,7 +361,7 @@
                />
            </div>
            {selectedRows?.length > 0 && (
            {selectedRows?.length > 0 && false && (
                <FooterToolbar
                    extra={
                        <div>