import { Badge, Button, Input, Modal, Space, Table, Tag, Typography } from 'antd'; import React, { useEffect, useState } from 'react'; import '../../tencentAdPutIn/index.less' import { getAdqLandingPageOfficialListApi } from '@/services/adqV3/global'; import { useAjax } from '@/Hook/useAjax'; import { SyncOutlined } from '@ant-design/icons'; import { PageStatusEnum } from '@/services/launchAdq/enum'; const { Text } = Typography; /** * 选择落地页 * @returns */ const SelectPage: React.FC<{ accountId: number, value?: any, onChange?: (e: any) => void }> = ({ accountId, value, onChange }) => { /***********************************/ const [visible, setVisible] = useState(false) const [selectedRowKeys, setSelectedRowKeys] = useState([]) const [queryForm, setQueryForm] = useState<{ accountId?: number, pageName?: string, ownerUid?: number, pageSize: number, pageNum: number, isSqDownPage: boolean }>({ pageNum: 1, pageSize: 20, isSqDownPage: false }) const listAjax = useAjax((params) => getAdqLandingPageOfficialListApi(params)) /***********************************/ useEffect(() => { if (accountId) { const params: any = { ...queryForm, // pageStatus: 'NORMAL', pageType: 'PAGE_TYPE_OFFICIAL', accountId } delete params.isSqDownPage listAjax.run(params) } }, [accountId, queryForm]) const handleOk = () => { onChange?.(selectedRowKeys?.[0]) setVisible(false) } return <>
{value &&
{Array.isArray(value) ? value.map((item: { pageName: any; pageId: any; }) => `${item.pageName}(${item.pageId})`) : `${value?.pageName}(${value?.pageId})`}
}
{visible && 官方落地页} open={visible} onOk={handleOk} onCancel={() => { setVisible(false) }} className='modalResetCss' width={750} > setQueryForm({ ...queryForm, pageNum: 1, pageName: e.target.value })} /> { return } }, ]} dataSource={listAjax?.data?.records} size="small" loading={listAjax?.loading} scroll={{ y: 400 }} bordered rowKey={'pageId'} pagination={{ total: listAjax?.data?.total, defaultPageSize: 20, current: listAjax?.data?.current, pageSize: listAjax?.data?.size }} onChange={(pagination) => { const { current, pageSize } = pagination setQueryForm({ ...queryForm, pageNum: current as number, pageSize: pageSize as number || 20 }) }} rowSelection={{ selectedRowKeys: selectedRowKeys?.map((item: any) => item?.pageId), type: 'radio', onChange(selectedRowKeys, selectedRows, info) { setSelectedRowKeys(selectedRows) }, }} /> } ; }; export default SelectPage;