|
@@ -1,6 +1,6 @@
|
|
|
import { useAjax } from "@/Hook/useAjax"
|
|
|
import Tables from "@/components/Tables"
|
|
|
-import { getGameChoiceListApi } from "@/services/gameData"
|
|
|
+import { getGameChoiceListApi, getGameListNewApi } from "@/services/gameData"
|
|
|
import { CreateRoleConfigProps, delGameUserConfigApi, getCreateRoleConfigListApi } from "@/services/gameData/roleOperate"
|
|
|
import { PlusOutlined } from "@ant-design/icons"
|
|
|
import { Button, Card, Col, Form, Row, Select, Space, message } from "antd"
|
|
@@ -20,7 +20,9 @@ const CreateRoleConfig: React.FC = () => {
|
|
|
const [initialValues, setInitialValues] = useState<any>({})
|
|
|
const [queryFrom, setQueryForm] = useState<CreateRoleConfigProps>({ pageNum: 1, pageSize: 20 })
|
|
|
const [visible, setVisible] = useState<boolean>(false)
|
|
|
- const getGameChoiceList = useAjax(() => getGameChoiceListApi())
|
|
|
+ const [gameList, setGameList] = useState<any[]>([])
|
|
|
+
|
|
|
+ const getGameChoiceList = useAjax((params) => getGameListNewApi(params))
|
|
|
const getCreateRoleConfigList = useAjax((params) => getCreateRoleConfigListApi(params))
|
|
|
const delGameUserConfig = useAjax((params) => delGameUserConfigApi(params))
|
|
|
/**************************/
|
|
@@ -29,7 +31,10 @@ const CreateRoleConfig: React.FC = () => {
|
|
|
}, [queryFrom])
|
|
|
|
|
|
useEffect(() => {
|
|
|
- getGameChoiceList.run()
|
|
|
+ getGameChoiceList.run({ sourceSystem: 'ZX_ONE' }).then((res: { gameList: any; parentGameList: any; superGameList: any }) => {
|
|
|
+ const { gameList } = res
|
|
|
+ setGameList(gameList?.map((item: { id: any; game_name: any }) => ({ id: item.id, name: item.game_name })) || [])
|
|
|
+ })
|
|
|
}, [])
|
|
|
|
|
|
const onFinish = (data: any) => {
|
|
@@ -44,7 +49,7 @@ const CreateRoleConfig: React.FC = () => {
|
|
|
}
|
|
|
|
|
|
const del = (id: number) => {
|
|
|
- delGameUserConfig.run({ id }).then(res => {
|
|
|
+ delGameUserConfig.run({ id }).then((res: any) => {
|
|
|
if (res) {
|
|
|
message.success('删除成功')
|
|
|
getCreateRoleConfigList.refresh()
|
|
@@ -74,8 +79,9 @@ const CreateRoleConfig: React.FC = () => {
|
|
|
filterOption={(input, option) =>
|
|
|
(option?.children as any)?.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
|
}
|
|
|
+ loading={getGameChoiceList.loading}
|
|
|
>
|
|
|
- {getGameChoiceList?.data?.map((item: any) => <Select.Option value={item.id} key={item.id}>{item.name}</Select.Option>)}
|
|
|
+ {gameList?.map((item: any) => <Select.Option value={item.id} key={item.id}>{item.name}</Select.Option>)}
|
|
|
</Select>
|
|
|
</Form.Item></Col>
|
|
|
|
|
@@ -124,7 +130,7 @@ const CreateRoleConfig: React.FC = () => {
|
|
|
{visible && <EditModal
|
|
|
visible={visible}
|
|
|
initialValues={initialValues}
|
|
|
- gameList={getGameChoiceList?.data}
|
|
|
+ gameList={gameList}
|
|
|
onClose={() => { setVisible(false); }}
|
|
|
onChange={() => {
|
|
|
getCreateRoleConfigList.refresh()
|