| | |
| | | |
| | | import React, { useState, useRef, useEffect } from 'react'; |
| | | import { Button, message, Modal } from 'antd'; |
| | | import { Button, message, Modal, Tag } from 'antd'; |
| | | import { |
| | | FooterToolbar, |
| | | PageContainer, |
| | |
| | | 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('正在添加'); |
| | |
| | | dataIndex: 'token', |
| | | valueType: 'text', |
| | | hidden: false, |
| | | ellipsis: true, |
| | | width: 140, |
| | | copyable: true, |
| | | filterDropdown: (props) => <TextFilter |
| | |
| | | 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: '添加时间', |
| | |
| | | title: '操作', |
| | | dataIndex: 'option', |
| | | width: 140, |
| | | hidden: true, |
| | | valueType: 'option', |
| | | render: (_, record) => [ |
| | | <Button |
| | | type="link" |
| | | key="edit" |
| | | hidden="true" |
| | | onClick={() => { |
| | | setModalVisible(true); |
| | | setCurrentRow(record); |
| | |
| | | <Button |
| | | type="link" |
| | | danger |
| | | hidden="true" |
| | | key="batchRemove" |
| | | onClick={async () => { |
| | | Modal.confirm({ |
| | |
| | | cardBordered |
| | | scroll={{ x: 1300 }} |
| | | dateFormatter="string" |
| | | pagination={{ pageSize: 20 }} |
| | | pagination={{ pageSize: 16 }} |
| | | search={false} |
| | | style={{ |
| | | marginBottom: '20px' |
| | | }} |
| | | toolbar={{ |
| | | search: { |
| | | onSearch: (value) => { |
| | |
| | | <Button |
| | | type="primary" |
| | | key="save" |
| | | hidden="true" |
| | | onClick={async () => { |
| | | setModalVisible(true) |
| | | }} |
| | |
| | | } |
| | | }) |
| | | } |
| | | 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) { |
| | |
| | | /> |
| | | </div> |
| | | |
| | | {selectedRows?.length > 0 && ( |
| | | {selectedRows?.length > 0 && false && ( |
| | | <FooterToolbar |
| | | extra={ |
| | | <div> |