|
@@ -9,7 +9,7 @@ import style from '../../components/TableData/index.less'
|
|
import Tables from "@/components/Tables"
|
|
import Tables from "@/components/Tables"
|
|
import columnsPos from "./tableConfig"
|
|
import columnsPos from "./tableConfig"
|
|
import AddBanIp from "./addBanIp"
|
|
import AddBanIp from "./addBanIp"
|
|
-import { PlusOutlined } from "@ant-design/icons"
|
|
|
|
|
|
+import { CopyOutlined, PlusOutlined } from "@ant-design/icons"
|
|
|
|
|
|
/**
|
|
/**
|
|
* 封禁IP管理
|
|
* 封禁IP管理
|
|
@@ -19,10 +19,11 @@ const BanIpManage: React.FC = () => {
|
|
|
|
|
|
/*************************/
|
|
/*************************/
|
|
const [form] = Form.useForm()
|
|
const [form] = Form.useForm()
|
|
- const [initialValues, _setInitialValues] = useState<any>({})
|
|
|
|
|
|
+ const [initialValues, setInitialValues] = useState<any>({})
|
|
const [queryFrom, setQueryForm] = useState<IpManageListProps>({ pageNum: 1, pageSize: 20 })
|
|
const [queryFrom, setQueryForm] = useState<IpManageListProps>({ pageNum: 1, pageSize: 20 })
|
|
const [addShow, setAddShow] = useState<boolean>(false)
|
|
const [addShow, setAddShow] = useState<boolean>(false)
|
|
-
|
|
|
|
|
|
+ const [selectedRows, setSelectedRows] = useState<any[]>([])
|
|
|
|
+
|
|
const getGameChoiceList = useAjax(() => getGameChoiceListApi())
|
|
const getGameChoiceList = useAjax(() => getGameChoiceListApi())
|
|
const getIpManageList = useAjax((params: IpManageListProps) => getIpManageListApi(params))
|
|
const getIpManageList = useAjax((params: IpManageListProps) => getIpManageListApi(params))
|
|
const updateBanIp = useAjax((params: { ip: string, status: number }) => updateBanIpApi(params))
|
|
const updateBanIp = useAjax((params: { ip: string, status: number }) => updateBanIpApi(params))
|
|
@@ -72,7 +73,7 @@ const BanIpManage: React.FC = () => {
|
|
封禁IP管理
|
|
封禁IP管理
|
|
</div>
|
|
</div>
|
|
<Space style={{ width: '100%' }} direction="vertical" size={10}>
|
|
<Space style={{ width: '100%' }} direction="vertical" size={10}>
|
|
- <Form layout="inline" className='queryForm' initialValues={initialValues} name="basicGameServer" form={form} onFinish={onFinish}>
|
|
|
|
|
|
+ <Form layout="inline" className='queryForm' name="basicGameServer" form={form} onFinish={onFinish}>
|
|
<Row gutter={[0, 6]}>
|
|
<Row gutter={[0, 6]}>
|
|
<Col><Form.Item name='gameId'>
|
|
<Col><Form.Item name='gameId'>
|
|
<Select
|
|
<Select
|
|
@@ -116,7 +117,19 @@ const BanIpManage: React.FC = () => {
|
|
<Space>
|
|
<Space>
|
|
<Button type="primary" htmlType="submit">搜索</Button>
|
|
<Button type="primary" htmlType="submit">搜索</Button>
|
|
<Button onClick={() => form.resetFields()}>重置</Button>
|
|
<Button onClick={() => form.resetFields()}>重置</Button>
|
|
- <Button type="primary" icon={<PlusOutlined />} onClick={() => setAddShow(true)}>新增封禁IP</Button>
|
|
|
|
|
|
+ <Button type="primary" icon={<PlusOutlined />} onClick={() => { setInitialValues({}); setAddShow(true) }}>新增封禁IP</Button>
|
|
|
|
+ <Button
|
|
|
|
+ type="dashed"
|
|
|
|
+ icon={<CopyOutlined />}
|
|
|
|
+ disabled={selectedRows?.length === 0}
|
|
|
|
+ onClick={() => {
|
|
|
|
+ setInitialValues({ ips: selectedRows?.map(item => item.ip)?.toString() })
|
|
|
|
+ setAddShow(true)
|
|
|
|
+ }}
|
|
|
|
+ >
|
|
|
|
+ 复制IP封禁
|
|
|
|
+ </Button>
|
|
|
|
+ <Button type="link" disabled={selectedRows?.length === 0} onClick={() => { setSelectedRows([]) }}>清空选择</Button>
|
|
</Space>
|
|
</Space>
|
|
</Col>
|
|
</Col>
|
|
</Row>
|
|
</Row>
|
|
@@ -146,6 +159,40 @@ const BanIpManage: React.FC = () => {
|
|
newQueryForm.pageSize = pageSize
|
|
newQueryForm.pageSize = pageSize
|
|
setQueryForm({ ...newQueryForm })
|
|
setQueryForm({ ...newQueryForm })
|
|
}}
|
|
}}
|
|
|
|
+ rowSelection={{
|
|
|
|
+ selectedRowKeys: selectedRows.map(item => item.id + ''),
|
|
|
|
+ onSelect: (record: { id: number }, selected: boolean) => {
|
|
|
|
+ if (selected) {
|
|
|
|
+ selectedRows.push({ ...record })
|
|
|
|
+ setSelectedRows([...selectedRows])
|
|
|
|
+ } else {
|
|
|
|
+ let newSelectAccData = selectedRows.filter((item: { id: number }) => item.id !== record.id)
|
|
|
|
+ setSelectedRows([...newSelectAccData])
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ onSelectAll: (selected: boolean, selectedRowss: { id: number }[], changeRows: { id: number }[]) => {
|
|
|
|
+ if (selected) {
|
|
|
|
+ let newSelectAccData = [...selectedRows]
|
|
|
|
+ changeRows.forEach((item: { id: number }) => {
|
|
|
|
+ let index = newSelectAccData.findIndex((ite: { id: number }) => ite.id === item.id)
|
|
|
|
+ if (index === -1) {
|
|
|
|
+ newSelectAccData.push({ ...item })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ setSelectedRows([...newSelectAccData])
|
|
|
|
+ } else {
|
|
|
|
+ let newSelectAccData = selectedRows.filter((item: { id: number }) => {
|
|
|
|
+ let index = changeRows.findIndex((ite: { id: number }) => ite.id === item.id)
|
|
|
|
+ if (index !== -1) {
|
|
|
|
+ return false
|
|
|
|
+ } else {
|
|
|
|
+ return true
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ setSelectedRows([...newSelectAccData])
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }}
|
|
size="small"
|
|
size="small"
|
|
total={getIpManageList?.data?.total}
|
|
total={getIpManageList?.data?.total}
|
|
loading={getIpManageList?.loading}
|
|
loading={getIpManageList?.loading}
|
|
@@ -155,7 +202,19 @@ const BanIpManage: React.FC = () => {
|
|
</Space>
|
|
</Space>
|
|
|
|
|
|
{/* 新增封禁IP */}
|
|
{/* 新增封禁IP */}
|
|
- {addShow && <AddBanIp gameList={getGameChoiceList?.data} visible={addShow} onClose={() => setAddShow(false)} onChange={() => { setAddShow(false); getIpManageList?.refresh() }} />}
|
|
|
|
|
|
+ {addShow && <AddBanIp
|
|
|
|
+ initialValues={initialValues}
|
|
|
|
+ gameList={getGameChoiceList?.data}
|
|
|
|
+ visible={addShow}
|
|
|
|
+ onClose={() => {
|
|
|
|
+ setAddShow(false)
|
|
|
|
+ setInitialValues({})
|
|
|
|
+ }}
|
|
|
|
+ onChange={() => {
|
|
|
|
+ setAddShow(false);
|
|
|
|
+ setInitialValues({})
|
|
|
|
+ getIpManageList?.refresh()
|
|
|
|
+ }} />}
|
|
</Card>
|
|
</Card>
|
|
}
|
|
}
|
|
|
|
|