|
@@ -1,6 +1,6 @@
|
|
|
import Tables from '@/components/Tables';
|
|
|
import { useAjax } from '@/Hook/useAjax';
|
|
|
-import { getChatGameListApi, getChatListApi } from '@/services/gameData/player';
|
|
|
+import { getChatGameListApi, getChatListApi, getServerListApi } from '@/services/gameData/player';
|
|
|
import { Button, Card, Col, DatePicker, Form, Input, Row, Select, Space } from 'antd';
|
|
|
import React, { useEffect, useState } from 'react';
|
|
|
import style from '../../components/TableData/index.less'
|
|
@@ -12,10 +12,14 @@ const ChatList: React.FC = () => {
|
|
|
|
|
|
/*********************************/
|
|
|
const [form] = Form.useForm()
|
|
|
+ const supperGameId = Form.useWatch('supperGameId', form)
|
|
|
const [queryFrom, setQueryFrom] = React.useState<{ supperGameId: number, pageNum: number, pageSize: number, roleId?: string, roleName?: string, chatStart?: string, chatEnd?: string }>({ supperGameId: 0, pageNum: 1, pageSize: 20 })
|
|
|
const [gameList, setGameList] = useState<DefaultOptionType[]>([])
|
|
|
+ const [serverList, setServerList] = useState<DefaultOptionType[]>([])
|
|
|
+
|
|
|
const getChatGameList = useAjax(() => getChatGameListApi())
|
|
|
const getChatList = useAjax((params) => getChatListApi(params))
|
|
|
+ const getServerList = useAjax((params) => getServerListApi(params))
|
|
|
/*********************************/
|
|
|
|
|
|
useEffect(() => {
|
|
@@ -29,12 +33,24 @@ const ChatList: React.FC = () => {
|
|
|
})
|
|
|
}, [])
|
|
|
|
|
|
+
|
|
|
+
|
|
|
useEffect(() => {
|
|
|
if (queryFrom.supperGameId) {
|
|
|
getChatList.run(queryFrom)
|
|
|
}
|
|
|
}, [queryFrom])
|
|
|
|
|
|
+ useEffect(() => {
|
|
|
+ if (supperGameId) {
|
|
|
+ getServerList.run({ supperGameId }).then(res => {
|
|
|
+ if (res) {
|
|
|
+ setServerList(Object.keys(res).map(key => ({ label: res[key], value: key })))
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }, [supperGameId])
|
|
|
+
|
|
|
const onFinish = (data: any) => {
|
|
|
const oldQueryFrom = JSON.parse(JSON.stringify(queryFrom))
|
|
|
const { chatTime, ...params } = { ...oldQueryFrom, ...data, pageNum: 1 }
|
|
@@ -58,11 +74,11 @@ const ChatList: React.FC = () => {
|
|
|
</div>
|
|
|
|
|
|
<Space style={{ width: '100%' }} direction="vertical" size={10}>
|
|
|
- <Form
|
|
|
- layout="inline"
|
|
|
- className='queryForm'
|
|
|
- name="basicGameChat"
|
|
|
- form={form}
|
|
|
+ <Form
|
|
|
+ layout="inline"
|
|
|
+ className='queryForm'
|
|
|
+ name="basicGameChat"
|
|
|
+ form={form}
|
|
|
onFinish={onFinish}
|
|
|
>
|
|
|
<Row gutter={[0, 6]}>
|
|
@@ -80,6 +96,21 @@ const ChatList: React.FC = () => {
|
|
|
options={gameList}
|
|
|
/>
|
|
|
</Form.Item></Col>
|
|
|
+ {supperGameId && <Col><Form.Item name='serverId'>
|
|
|
+ <Select
|
|
|
+ showSearch
|
|
|
+ style={{ minWidth: 140 }}
|
|
|
+ placeholder={'请选择区服'}
|
|
|
+ filterOption={(input, option) =>
|
|
|
+ (option?.label as any)?.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
|
+ }
|
|
|
+ onChange={() => {
|
|
|
+ form.setFieldsValue({ codeType: undefined })
|
|
|
+ }}
|
|
|
+ loading={getServerList?.loading}
|
|
|
+ options={serverList}
|
|
|
+ />
|
|
|
+ </Form.Item></Col>}
|
|
|
<Col><Form.Item name='roleName'>
|
|
|
<Input placeholder="角色名称" allowClear style={{ width: 140 }} />
|
|
|
</Form.Item></Col>
|