|
@@ -1,6 +1,17 @@
|
|
|
|
+import { useAjax } from "@/Hook/useAjax";
|
|
|
|
+import { getIaaAgentListApi } from "@/services/iaaSystem/channel";
|
|
import { PlusOutlined } from "@ant-design/icons"
|
|
import { PlusOutlined } from "@ant-design/icons"
|
|
-import { Button, Card, Col, Form, Row, Space } from "antd"
|
|
|
|
-import React, { useState } from "react"
|
|
|
|
|
|
+import ProTable, { ActionType } from "@ant-design/pro-table";
|
|
|
|
+import { Button, Space, Table } from "antd"
|
|
|
|
+import React, { useEffect, useRef, useState } from "react"
|
|
|
|
+import tableConfig from "./tableConfig";
|
|
|
|
+import ModalChannel from "./modalChannel";
|
|
|
|
+import { getBackPolicyAllListApi } from "@/services/iaaSystem/backPolicy";
|
|
|
|
+import ConfigPutStatus from "./configPutStatus";
|
|
|
|
+import ConfigBackPolicy from "./configBackPolicy";
|
|
|
|
+import { getAllOfOwnerUserApi, getTtAllUserListApi } from "@/services/iaaSystem";
|
|
|
|
+import { getAppAuthListApi } from "@/services/iaaSystem/application";
|
|
|
|
+import { DefaultOptionType } from "antd/lib/select";
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -10,102 +21,166 @@ import React, { useState } from "react"
|
|
const Channel: React.FC = () => {
|
|
const Channel: React.FC = () => {
|
|
|
|
|
|
/***************************************/
|
|
/***************************************/
|
|
- const [form] = Form.useForm()
|
|
|
|
- const [initialValues, setInitialValues] = useState<any>({})
|
|
|
|
- // const [queryFrom, setQueryForm] = useState<GameVipProps>({ pageNum: 1, pageSize: 20 })
|
|
|
|
|
|
+ const actionRef = useRef<ActionType>();
|
|
|
|
+ const [visible, setVisible] = useState<boolean>(false)
|
|
|
|
+ const [initialValues, setInitialValues] = useState<any>()
|
|
|
|
+ const [backValueEnum, setBackValueEnum] = useState<any>({})
|
|
|
|
+ const [selectedRows, setSelectedRows] = useState<any[]>([])
|
|
|
|
+ const [putStatusVisible, setPutStatusVisible] = useState<boolean>(false)
|
|
|
|
+ const [backPolicyVisible, setBackPolicyVisible] = useState<boolean>(false)
|
|
|
|
+ const [appList, setAppList] = useState<DefaultOptionType[]>([])
|
|
|
|
+ const [appObj, setAppObj] = useState<any>({})
|
|
|
|
+
|
|
|
|
+ const getFolderList = useAjax((params) => getIaaAgentListApi(params), { type: 'table' })
|
|
|
|
+ const getBackPolicyAllList = useAjax(() => getBackPolicyAllListApi())
|
|
|
|
+ const getAllOfOwnerUser = useAjax(() => getAllOfOwnerUserApi())
|
|
|
|
+ const getTtAllUserList = useAjax(() => getTtAllUserListApi())
|
|
|
|
+ const getAppAuthList = useAjax(() => getAppAuthListApi())
|
|
/***************************************/
|
|
/***************************************/
|
|
|
|
|
|
- const onFinish = (data: any) => {
|
|
|
|
- // let oldQueryFrom = JSON.parse(JSON.stringify(queryFrom))
|
|
|
|
- // setQueryForm({ ...oldQueryFrom, ...data, pageNum: 1 })
|
|
|
|
|
|
+
|
|
|
|
+ useEffect(() => {
|
|
|
|
+ getBackPolicyAllList.run().then(res => {
|
|
|
|
+ console.log(res)
|
|
|
|
+ let newBackValueEnum: any = {}
|
|
|
|
+ res?.data?.forEach((item: any) => {
|
|
|
|
+ newBackValueEnum[item.id] = item.backPolicyName
|
|
|
|
+ })
|
|
|
|
+ setBackValueEnum(newBackValueEnum)
|
|
|
|
+ })
|
|
|
|
+ getAllOfOwnerUser.run()
|
|
|
|
+ getTtAllUserList.run()
|
|
|
|
+ getAppAuthList.run().then(res => {
|
|
|
|
+ if (res?.data) {
|
|
|
|
+ let newAppList: DefaultOptionType[] = []
|
|
|
|
+ let newAppObj: any = {}
|
|
|
|
+ res.data?.third.forEach((item: { name: any; id: any; }) => {
|
|
|
|
+ newAppList.push({ label: item.name, value: item.id })
|
|
|
|
+ newAppObj[item.id] = {
|
|
|
|
+ text: item.name
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ setAppList(newAppList)
|
|
|
|
+ setAppObj(newAppObj)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }, [])
|
|
|
|
+
|
|
|
|
+ // 变更投放状态
|
|
|
|
+ const handlePutStatus = () => {
|
|
|
|
+ setPutStatusVisible(true)
|
|
}
|
|
}
|
|
|
|
|
|
- return <Card
|
|
|
|
- style={{ borderRadius: 8 }}
|
|
|
|
- headStyle={{ textAlign: 'left' }}
|
|
|
|
- bodyStyle={{ padding: '5px 10px' }}
|
|
|
|
- >
|
|
|
|
- <div style={{ textAlign: 'center', fontWeight: 'bold', padding: '4px 6px 6px', fontSize: 16, marginBottom: 4, position: 'relative' }}>
|
|
|
|
- 渠道管理
|
|
|
|
- </div>
|
|
|
|
|
|
+ return <>
|
|
|
|
+ <ProTable<any>
|
|
|
|
+ columns={tableConfig(backValueEnum, appObj)}
|
|
|
|
+ actionRef={actionRef}
|
|
|
|
+ cardBordered
|
|
|
|
+ request={async (params, sort, filter) => {
|
|
|
|
+ console.log(sort, filter);
|
|
|
|
+ return await getFolderList.run(params)
|
|
|
|
+ }}
|
|
|
|
+ editable={{
|
|
|
|
+ type: 'multiple',
|
|
|
|
+ }}
|
|
|
|
+ rowKey="id"
|
|
|
|
+ search={{
|
|
|
|
+ labelWidth: 'auto',
|
|
|
|
+ }}
|
|
|
|
+ headerTitle={<strong>推广渠道</strong>}
|
|
|
|
+ toolBarRender={() => [
|
|
|
|
+ <Button type="primary" onClick={() => {
|
|
|
|
+ setVisible(true)
|
|
|
|
+ }}>
|
|
|
|
+ <PlusOutlined />
|
|
|
|
+ 新建
|
|
|
|
+ </Button>
|
|
|
|
+ ]}
|
|
|
|
+ scroll={{ x: 1200 }}
|
|
|
|
+ rowSelection={{
|
|
|
|
+ // 自定义选择项参考: https://ant.design/components/table-cn/#components-table-demo-row-selection-custom
|
|
|
|
+ // 注释该行则默认不显示下拉选项
|
|
|
|
+ selections: [Table.SELECTION_ALL, Table.SELECTION_INVERT],
|
|
|
|
+ onChange(_, selectedRows) {
|
|
|
|
+ setSelectedRows(selectedRows)
|
|
|
|
+ },
|
|
|
|
+ }}
|
|
|
|
+ tableAlertRender={({
|
|
|
|
+ selectedRowKeys,
|
|
|
|
+ selectedRows,
|
|
|
|
+ onCleanSelected,
|
|
|
|
+ }) => {
|
|
|
|
+ return (
|
|
|
|
+ <Space size={24}>
|
|
|
|
+ <span>
|
|
|
|
+ 已选 {selectedRowKeys.length} 项
|
|
|
|
+ <a style={{ marginInlineStart: 8 }} onClick={onCleanSelected}>
|
|
|
|
+ 取消选择
|
|
|
|
+ </a>
|
|
|
|
+ </span>
|
|
|
|
+ </Space>
|
|
|
|
+ );
|
|
|
|
+ }}
|
|
|
|
+ tableAlertOptionRender={() => {
|
|
|
|
+ return (
|
|
|
|
+ <Space size={16}>
|
|
|
|
+ <a onClick={handlePutStatus}>变更投放状态</a>
|
|
|
|
+ <a onClick={() => setBackPolicyVisible(true)}>修改回传策略</a>
|
|
|
|
+ </Space>
|
|
|
|
+ );
|
|
|
|
+ }}
|
|
|
|
+ />
|
|
|
|
+
|
|
|
|
+ {/* 新增修改 */}
|
|
|
|
+ {visible && <ModalChannel
|
|
|
|
+ appList={appList}
|
|
|
|
+ getAllOfOwnerUser={getAllOfOwnerUser}
|
|
|
|
+ getTtAllUserList={getTtAllUserList}
|
|
|
|
+ getBackPolicyAllList={getBackPolicyAllList}
|
|
|
|
+ visible={visible}
|
|
|
|
+ initialValues={initialValues}
|
|
|
|
+ onChange={() => {
|
|
|
|
+ setVisible(false)
|
|
|
|
+ setInitialValues(undefined)
|
|
|
|
+ actionRef.current?.reload()
|
|
|
|
+ }}
|
|
|
|
+ onClose={() => {
|
|
|
|
+ setVisible(false)
|
|
|
|
+ setInitialValues(undefined)
|
|
|
|
+ }}
|
|
|
|
+ />}
|
|
|
|
|
|
- <Space style={{ width: '100%' }} direction="vertical" size={10}>
|
|
|
|
- <Form layout="inline" className='queryForm' initialValues={initialValues} name="basicGameVip" form={form} onFinish={onFinish}>
|
|
|
|
- <Row gutter={[0, 6]}>
|
|
|
|
- {/* <Col><Form.Item name='vipLevel'>
|
|
|
|
- <Input placeholder="VIP档位" allowClear style={{ width: 140 }} />
|
|
|
|
- </Form.Item></Col>
|
|
|
|
- <Col><Form.Item name='superGameId'>
|
|
|
|
- <Select
|
|
|
|
- maxTagCount={1}
|
|
|
|
- showSearch
|
|
|
|
- style={{ minWidth: 140 }}
|
|
|
|
- allowClear
|
|
|
|
- placeholder={'请选择超父游戏'}
|
|
|
|
- filterOption={(input, option) =>
|
|
|
|
- (option?.children as any)?.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
|
|
- }
|
|
|
|
- >
|
|
|
|
- {superGameList?.map((item: any) => <Select.Option value={item.super_game_id} key={item.super_game_id}>{item.super_game_name}</Select.Option>)}
|
|
|
|
- </Select>
|
|
|
|
- </Form.Item></Col>
|
|
|
|
- <Col><Form.Item name='parentGameId'>
|
|
|
|
- <Select
|
|
|
|
- maxTagCount={1}
|
|
|
|
- showSearch
|
|
|
|
- style={{ minWidth: 140 }}
|
|
|
|
- allowClear
|
|
|
|
- placeholder={'请选择父游戏'}
|
|
|
|
- filterOption={(input, option) =>
|
|
|
|
- (option?.children as any)?.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
|
|
- }
|
|
|
|
- >
|
|
|
|
- {thatStoreData?.gameList?.map((item: any) => <Select.Option value={item.id} key={item.id}>{item.name}</Select.Option>)}
|
|
|
|
- </Select>
|
|
|
|
- </Form.Item></Col> */}
|
|
|
|
- <Col>
|
|
|
|
- {/* <Space>
|
|
|
|
- <Button type="primary" htmlType="submit">搜索</Button>
|
|
|
|
- <Button onClick={() => form.resetFields()}>重置</Button>
|
|
|
|
- <Button icon={<PlusOutlined />} type="primary" onClick={() => { setVisible(true); setInitialValues({}) }}>新增VIP档位</Button>
|
|
|
|
- <Button icon={<PlusOutlined />} type="primary" onClick={() => { setVisibleS(true); setInitialValues({}) }}>批量新增VIP档位</Button>
|
|
|
|
- </Space> */}
|
|
|
|
- </Col>
|
|
|
|
- </Row>
|
|
|
|
- </Form>
|
|
|
|
|
|
+ {/* 变更状态 */}
|
|
|
|
+ {putStatusVisible && <ConfigPutStatus
|
|
|
|
+ selectedRows={selectedRows}
|
|
|
|
+ visible={putStatusVisible}
|
|
|
|
+ onChange={() => {
|
|
|
|
+ setPutStatusVisible(false)
|
|
|
|
+ actionRef.current?.reload();
|
|
|
|
+ (actionRef.current as any)?.clearSelected()
|
|
|
|
+ }}
|
|
|
|
+ onClose={() => {
|
|
|
|
+ (actionRef.current as any)?.clearSelected()
|
|
|
|
+ setPutStatusVisible(false)
|
|
|
|
+ }}
|
|
|
|
+ />}
|
|
|
|
|
|
- {/* <div className={`${style['small']}`}> */}
|
|
|
|
- {/* <Tables
|
|
|
|
- className={`all_table content_table_body`}
|
|
|
|
- bordered
|
|
|
|
- sortDirections={['ascend', 'descend', null]}
|
|
|
|
- current={queryFrom.pageNum}
|
|
|
|
- pageSize={queryFrom.pageSize}
|
|
|
|
- columns={columnsPos(editVip, del)}
|
|
|
|
- dataSource={getGameVip?.data?.records}
|
|
|
|
- scroll={{ x: 1000, y: 600 }}
|
|
|
|
- onChange={(pagination: any, filters: any, sortData: any) => {
|
|
|
|
- let { current, pageSize } = pagination
|
|
|
|
- let newQueryForm = JSON.parse(JSON.stringify(queryFrom))
|
|
|
|
- if (sortData && sortData?.order) {
|
|
|
|
- newQueryForm['sortType'] = sortData?.order === 'ascend' ? 'asc' : 'desc'
|
|
|
|
- newQueryForm['sortFiled'] = sortData?.field
|
|
|
|
- } else {
|
|
|
|
- delete newQueryForm['sortType']
|
|
|
|
- delete newQueryForm['sortFiled']
|
|
|
|
- }
|
|
|
|
- newQueryForm.pageNum = current
|
|
|
|
- newQueryForm.pageSize = pageSize
|
|
|
|
- setQueryForm({ ...newQueryForm })
|
|
|
|
- }}
|
|
|
|
- size="small"
|
|
|
|
- total={getGameVip?.data?.total}
|
|
|
|
- loading={getGameVip?.loading}
|
|
|
|
- defaultPageSize={20}
|
|
|
|
- /> */}
|
|
|
|
- {/* </div> */}
|
|
|
|
- </Space>
|
|
|
|
- </Card>
|
|
|
|
|
|
+ {/* 修改回传策略 */}
|
|
|
|
+ {backPolicyVisible && <ConfigBackPolicy
|
|
|
|
+ getBackPolicyAllList={getBackPolicyAllList}
|
|
|
|
+ selectedRows={selectedRows}
|
|
|
|
+ visible={backPolicyVisible}
|
|
|
|
+ onChange={() => {
|
|
|
|
+ setBackPolicyVisible(false)
|
|
|
|
+ actionRef.current?.reload();
|
|
|
|
+ (actionRef.current as any)?.clearSelected()
|
|
|
|
+ }}
|
|
|
|
+ onClose={() => {
|
|
|
|
+ (actionRef.current as any)?.clearSelected()
|
|
|
|
+ setBackPolicyVisible(false)
|
|
|
|
+ }}
|
|
|
|
+ />}
|
|
|
|
+ </>
|
|
}
|
|
}
|
|
|
|
|
|
export default Channel
|
|
export default Channel
|