123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650 |
- import { useAjax } from '@/Hook/useAjax'
- import { AdStatusEnum, OptimizationGoalEnum, PromotedObjectType } from '@/services/launchAdq/enum'
- import { Col, Row, Input, Select, message, Space, Button, Switch, notification, Modal, Tooltip, Checkbox, Dropdown, Menu } from 'antd'
- import React, { useEffect, useCallback, useState } from 'react'
- import TableData from '../../components/TableData'
- import tableConfig from './tableConfig'
- import { putAdqAdgroupsSync, getAdqAdgroupsList, delListAdqAdgroupsApi, newEditAdqAdgroupsDataApi, editAdqAdgroupsDataApi, putAdqAdgroupsSyncBatch, putModifyCustomAudienceApi, getPutUserApi } from '@/services/launchAdq/adq'
- import { CopyOutlined, DeleteOutlined, DownOutlined, ExclamationCircleOutlined, FieldTimeOutlined, FormOutlined, PauseCircleOutlined, PlayCircleOutlined, QuestionCircleOutlined, SyncOutlined, TransactionOutlined } from '@ant-design/icons'
- import UpdateAd from './updateAd'
- import Copy from './copy'
- import { txAdConfig } from '../config'
- import Log from '../log'
- import SetEarlyWarning from '@/components/EarlyWarning/setEarlyWarning'
- import CrowdPackModal from '../../components/crowdPackModal'
- import './index.less'
- import Details from '@/pages/adMonitor/adMonitorList/components/Details'
- type Props = {
- accountId?: string,
- adAccountId?: string,
- userId: string,
- Ts?: any,
- queryParmas?: {
- accountId?: string,//账户ID
- campaignId?: string,//计划ID
- adgroupId?: string,//广告ID
- adcreativeId?: string,//创意ID
- pageId?: string,//落地页ID
- targetingId?: string,//定向ID}
- },
- tableIdClick?: (props: {
- activeKey: string, parma: {
- accountId?: string,//账户ID
- campaignId?: string,//计划ID
- adgroupId?: string,//广告ID
- adcreativeId?: string,//创意ID
- pageId?: string,//落地页ID
- targetingId?: string,//定向ID
- }
- }) => void
- }
- const Ad: React.FC<Props> = (props) => {
- /***********************/
- let { accountId, userId, queryParmas, Ts } = props
- const [selectedRows, setSelectedRows] = useState<any[]>([])
- const [update, setUpdate] = useState<{ visible: boolean, title: string }>({ visible: false, title: '' })
- const [model, setModel] = useState(true)
- const [copyData, setCopyData] = useState<{ visible: boolean }>({ visible: false })
- const [detailShow, setDetailShow] = useState<boolean>(false)
- const [detailData, setDetailData] = useState<any>({})
- const [czjlShow, setCzjlShow] = useState(false)
- const [cpVisible, setCpVisible] = useState(false)
- const [isClearSelect, setIsClearSelect] = useState(true)
- const [accountCreateLogs, setAccountCreateLogs] = useState<{ adAccountId: number, id: number, customAudienceList?: any[], excludedCustomAudienceList?: any[] }[]>([])
- const [queryFrom, set_queryFrom] = useState<{
- pageNum: number;
- pageSize: number;
- accountIdList?: any[];
- adgroupName?: string;
- adgroupIdList?: any[];
- promotedObjectType?: string;
- isDeleted?: boolean
- campaignIdList?: any[]
- statusList?: any[],
- memoList?: any[]
- remarkList?: any[]
- optimizationGoal?: string,
- putUserIdList?: number[]
- }>({ pageNum: 1, pageSize: 20, isDeleted: false })
- const listAjax = useAjax((params) => getAdqAdgroupsList(params), { formatResult: true })
- const syncAjax = useAjax((adAccountId) => putAdqAdgroupsSync(adAccountId))
- const delListAdqAdgroups = useAjax((params) => delListAdqAdgroupsApi(params))
- const editAdqAdgroupsData = useAjax((params) => newEditAdqAdgroupsDataApi(params))
- const editAdqAdgroups = useAjax((params) => editAdqAdgroupsDataApi(params))
- const putModifyCustomAudience = useAjax((params) => putModifyCustomAudienceApi(params))
- const putAdqAdgroupsSyncBatchApi = useAjax((params) => putAdqAdgroupsSyncBatch(params))
- const getPutUser = useAjax((params) => getPutUserApi(params))
- /************************/
- // useEffect(() => {
- // getPutUser.run({ userId })
- // }, [userId])
- useEffect(() => {
- // let { accountId, campaignId, adgroupId, ...obj } = queryParmas
- // let new_queryParmas = {
- // ...obj,
- // accountIdList: accountId ? [accountId] : [],
- // campaignIdList: campaignId ? [campaignId] : [],
- // adgroupIdList: adgroupId ? [adgroupId] : []
- // }
- getList({ pageNum: 1, pageSize: 20, isDeleted: false })
- }, [accountId, userId, queryParmas, model])
- // 获取列表
- const getList = useCallback((params: {
- pageNum: number;
- pageSize: number;
- accountIdList?: any[];
- adgroupName?: string;
- adgroupIdList?: any[];
- promotedObjectType?: string;
- isDeleted?: boolean
- campaignIdList?: any[]
- statusList?: any[],
- memoList?: any[]
- remarkList?: any[]
- isDeepConversionSpec?: boolean
- }) => {
- if (!model) {
- params.isDeepConversionSpec = true
- }
- listAjax.run({ ...params, userId })
- }, [userId, listAjax, model])
- // 同步
- const sync = useCallback(() => {
- // if (selectedRows?.length === 0) {
- // message.error('请先勾选要同步的广点通账号!')
- // return
- // }
- let arr = [...new Set(selectedRows?.map(item => item.accountId))]
- syncAjax.run({ accountIdList: arr }).then(res => {
- res && listAjax.refresh()
- res ? message.success('同步成功!') : message.error('同步失败!')
- })
- }, [listAjax, selectedRows])
- /** 删除 */
- const deleteHandle = (type: 0 | 1, adgroupId?: number) => {
- const hide = message.loading('删除中。。。', 0)
- delListAdqAdgroups.run({ adgroupIds: type === 1 ? selectedRows.map(item => item.adgroupId) : [adgroupId] }).then(res => {
- hide()
- message.success('删除成功')
- setSelectedRows([])
- listAjax.refresh()
- }).catch(() => hide())
- }
- /** 修改排期出价 */
- const editScheduling = () => {
- setUpdate({ visible: true, title: '批量修改' })
- }
- /** 修改排期出价 */
- const editDeepConversion = () => {
- setUpdate({ visible: true, title: '批量修改深度优化' })
- }
- // 单个启停
- const onChange = () => {
- listAjax.refresh()
- setSelectedRows([])
- }
- // 批量启停
- const adStatus = (type: 'play' | 'suspend') => {
- let params: any = {}
- if (type === 'play') {
- params.configuredStatus = 'AD_STATUS_NORMAL'
- params.adgroupIds = selectedRows.filter((item: { configuredStatus: string, adgroupId: number }) => item.configuredStatus === 'AD_STATUS_SUSPEND').map(item => item.adgroupId)
- } else {
- params.configuredStatus = 'AD_STATUS_SUSPEND'
- params.adgroupIds = selectedRows.filter((item: { configuredStatus: string, adgroupId: number }) => item.configuredStatus === 'AD_STATUS_NORMAL').map(item => item.adgroupId)
- }
- if (params.adgroupIds.length === 0) {
- message.warn(`所以账号都是${type === 'play' ? '启动' : '暂停'}状态,无需${type === 'play' ? '启动' : '暂停'}操作`)
- return
- }
- editAdqAdgroupsData.run(params).then(res => {
- message.success(`${type === 'play' ? '启动' : '暂停'}成功: ${res.success},失败: ${res.fail}`)//
- if (res?.fail) {
- notification.error({
- message: `${type === 'play' ? '启动' : '暂停'}失败`,
- description: `成功: ${res.success},修改失败${res.fail}条,失败的请到任务列表查看`,
- duration: 0
- });
- }
- listAjax.refresh()
- setSelectedRows([])
- })
- }
- //同步广告
- const syncAd = useCallback(() => {
- const hide = message.loading('同步中。。。', 0)
- putAdqAdgroupsSyncBatchApi.run({ adgroupIds: selectedRows?.map(item => item.adgroupId) }).then(res => {
- hide()
- if (res) {
- message.success('同步成功!')
- listAjax.refresh()
- }
- }).catch(() => hide())
- }, [selectedRows])
- // 批量复制
- const copyHandle = () => {
- setCopyData({ visible: true })
- }
- const handleSave = (row: any) => {
- const hide = message.loading(`广告“${row.adgroupId}”广告名称修改成<${row.adgroupName}>,修改中`, 0, () => {
- message.success('修改成功');
- });
- editAdqAdgroups.run({ adgroupIds: [row.adgroupId], adgroupName: row.adgroupName }).then(res => {
- message.success('修改广告名称成功')
- listAjax.refresh()
- hide()
- })
- }
- const handleSaveDaily = (row: any) => {
- console.log('row--->', row)
- const hide = message.loading(`广告“${row.adgroupId}”广告预算修改成<${row.dailyBudget}元>,修改中`, 0, () => {
- message.success('修改成功');
- });
- editAdqAdgroups.run({ adgroupIds: [row.adgroupId], dailyBudget: row.dailyBudget * 100 }).then(res => {
- message.success('修改广告预算成功')
- listAjax.refresh()
- hide()
- })
- }
- const details = (data: any) => {
- setDetailData(data)
- setDetailShow(true)
- }
- // 设置人群包
- const setRqb = () => {
- const { accountId } = selectedRows[0]
- setAccountCreateLogs([{ id: accountId, adAccountId: accountId }])
- setCpVisible(true)
- }
- // 确认提交人群包
- const handleRqb = (value: any[]) => {
- if ((value[0]?.customAudienceList && value[0]?.customAudienceList?.length > 0) || (value[0]?.excludedCustomAudienceList && value[0]?.excludedCustomAudienceList?.length > 0)) {
- let { adAccountId, customAudienceList = [], excludedCustomAudienceList = [] } = value[0]
- let adgroupIds = selectedRows.map((item: { adgroupId: number }) => item.adgroupId)
- let customAudienceIds = customAudienceList.map((item: { id: number }) => item.id)
- let excludedCustomAudienceIds = excludedCustomAudienceList.map((item: { id: number }) => item.id)
- const hide = message.loading('正在修改。。。', 0)
- setAccountCreateLogs([])
- setCpVisible(false)
- let params: any = { adAccountId, adgroupIds };
- if (excludedCustomAudienceIds.length > 0) {
- params['excludedCustomAudienceIds'] = excludedCustomAudienceIds
- }
- if (customAudienceIds?.length > 0) {
- params['customAudienceIds'] = customAudienceIds
- }
- putModifyCustomAudience.run(params).then(res => {
- hide()
- setSelectedRows([])
- message.success('修改成功,请到腾讯广告平台查看')
- }).catch(err => hide())
- } else {
- message.error('请选择用户群')
- }
- }
- return <div>
- {/* 修改广告 */}
- {update.visible && <UpdateAd
- {...update}
- selectedRows={selectedRows}
- onChange={() => {
- setUpdate({ visible: false, title: '' })
- listAjax.refresh()
- setSelectedRows([])
- }}
- onClose={() => { setUpdate({ visible: false, title: '' }) }}
- />}
- {/* 复制广告 */}
- {copyData.visible && <Copy selectedRows={selectedRows} {...copyData} onClose={() => setCopyData({ visible: false })} onChange={() => { setCopyData({ visible: false }); listAjax.refresh(); setSelectedRows([]) }} />}
- <Row gutter={[6, 6]} align='middle' style={{ marginBottom: 15 }}>
- {Ts && <Col>
- {Ts()}
- </Col>}
- <Col>
- <Input
- placeholder='广告账号'
- allowClear
- style={{ width: 100 }}
- onChange={(e) => {
- let value = e.target.value
- let arr: any = []
- if (value) {
- value = value.replace(/[,,\s]/g, ',')
- arr = value.split(',').filter((a: any) => a)
- }
- set_queryFrom({ ...queryFrom, accountIdList: arr })
- }}
- />
- </Col>
- <Col>
- <Input
- placeholder='广告ID'
- allowClear
- style={{ width: 100 }}
- onChange={(e) => {
- let value = e.target.value
- let arr: any = []
- if (value) {
- value = value.replace(/[,,\s]/g, ',')
- arr = value.split(',').filter((a: any) => a)
- }
- set_queryFrom({ ...queryFrom, adgroupIdList: arr })
- }}
- />
- </Col>
- <Col>
- <Input
- placeholder='计划ID'
- allowClear
- style={{ width: 100 }}
- onChange={(e) => {
- let value = e.target.value
- let arr: any = []
- if (value) {
- value = value.replace(/[,,\s]/g, ',')
- arr = value.split(',').filter((a: any) => a)
- }
- set_queryFrom({ ...queryFrom, campaignIdList: arr })
- }}
- />
- </Col>
- <Col>
- <Select
- placeholder='推广目标'
- style={{ width: 110 }}
- showSearch
- filterOption={(input: any, option: any) =>
- (option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
- }
- allowClear
- onChange={(value: any) => {
- set_queryFrom({ ...queryFrom, promotedObjectType: value })
- }}
- >
- {Object.keys(PromotedObjectType).map(key => {
- return <Select.Option value={key} key={key}>{PromotedObjectType[key]}</Select.Option>
- })}
- </Select>
- </Col>
- <Col>
- <Select
- placeholder='已删除?'
- style={{ width: 100 }}
- showSearch
- filterOption={(input: any, option: any) =>
- (option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
- }
- allowClear
- value={queryFrom?.isDeleted}
- onChange={(value: any) => {
- set_queryFrom({ ...queryFrom, isDeleted: value })
- }}
- >
- <Select.Option value={true}>已删除</Select.Option>
- <Select.Option value={false}>未删除</Select.Option>
- </Select>
- </Col>
- <Col>
- <Select
- placeholder='广告状态'
- mode="multiple"
- style={{ minWidth: 120 }}
- showSearch
- filterOption={(input: any, option: any) =>
- (option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
- }
- allowClear
- onChange={(value: any) => {
- set_queryFrom({ ...queryFrom, statusList: value })
- }}
- >
- {
- Object.keys(AdStatusEnum).map(key => {
- return <Select.Option value={key} key={key}>{AdStatusEnum[key]}</Select.Option>
- })
- }
- </Select>
- </Col>
- <Col>
- <Input
- placeholder='广告名称'
- allowClear
- style={{ width: 120 }}
- onChange={(e) => {
- let value = e.target.value
- set_queryFrom({ ...queryFrom, adgroupName: value })
- }}
- />
- </Col>
- <Col>
- <Input
- placeholder='腾讯备注'
- allowClear
- style={{ width: 120 }}
- onChange={(e) => {
- let value = e.target.value
- let arr: any = []
- if (value) {
- value = value.replace(/[,,\s]/g, ',')
- arr = value.split(',').filter((a: any) => a)
- }
- set_queryFrom({ ...queryFrom, memoList: arr })
- }}
- />
- </Col>
- <Col>
- <Input
- placeholder='本地备注'
- allowClear
- style={{ width: 120 }}
- onChange={(e) => {
- let value = e.target.value
- let arr: any = []
- if (value) {
- value = value.replace(/[,,\s]/g, ',')
- arr = value.split(',').filter((a: any) => a)
- }
- set_queryFrom({ ...queryFrom, remarkList: arr })
- }}
- />
- </Col>
- <Col>
- <Select
- placeholder='优化目标'
- style={{ width: 100 }}
- showSearch
- filterOption={(input: any, option: any) =>
- (option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
- }
- allowClear
- value={queryFrom.optimizationGoal}
- onChange={(value: any) => {
- set_queryFrom({ ...queryFrom, optimizationGoal: value })
- }}
- >
- {Object.keys(OptimizationGoalEnum).map(key => <Select.Option value={key} key={key}>{OptimizationGoalEnum[key]}</Select.Option>)}
- </Select>
- </Col>
- {/* <Col>
- <Select
- placeholder='投手'
- mode='multiple'
- style={{ minWidth: 100 }}
- maxLength={1}
- showSearch
- filterOption={(input: any, option: any) =>
- (option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
- }
- allowClear
- value={queryFrom.putUserIdList}
- onChange={(value: any) => {
- set_queryFrom({ ...queryFrom, putUserIdList: value })
- }}
- >
- {getPutUser?.data ? Object.keys(getPutUser?.data).map(key => <Select.Option value={key} key={key}>{getPutUser?.data[key]}</Select.Option>) : null}
- </Select>
- </Col> */}
- <Col>
- <Space>
- <Button
- type="primary"
- onClick={() => {
- if (isClearSelect) {
- setSelectedRows([])
- }
- getList({ ...queryFrom, pageNum: 1 })
- }}
- >
- <Space>
- <span>搜索</span>
- <Checkbox className='clearCheckbox' onClick={(e) => e.stopPropagation()} checked={isClearSelect} onChange={(e) => setIsClearSelect(e.target.checked)} />
- <Tooltip title="勾选搜索清空已选">
- <QuestionCircleOutlined />
- </Tooltip>
- </Space>
- </Button>
- {selectedRows?.length > 0 && <Button type='link' style={{ padding: 0, color: 'red' }} onClick={() => {
- setSelectedRows([])
- }}>清空已选({selectedRows?.length})</Button>}
- </Space>
- </Col>
- </Row>
- <TableData
- isCard={false}
- columns={() => tableConfig(onChange, details, handleSave, handleSaveDaily)}
- ajax={listAjax}
- syncAjax={sync}
- fixed={{ left: 2, right: 4 }}
- dataSource={listAjax?.data?.data?.records}
- loading={listAjax?.loading || syncAjax?.loading}
- scroll={{ y: 560 }}
- total={listAjax?.data?.data?.total}
- page={listAjax?.data?.data?.current}
- pageSize={listAjax?.data?.data?.size}
- myKey={'adgroupId'}
- gutter={[0, 10]}
- config={txAdConfig}
- configName="腾讯广告"
- leftChild={<Space direction='vertical'>
- <Row gutter={[10, 10]} align='middle'>
- <Col>
- <Switch checkedChildren="普通" unCheckedChildren="ROI" checked={model} onChange={(checked) => { setModel(checked); setSelectedRows([]) }} style={model ? {} : { background: '#67c23a' }} />
- </Col>
- {!model && <Col><Button type='primary' icon={<TransactionOutlined />} disabled={selectedRows.length === 0} onClick={editDeepConversion}>修改深度优化ROI</Button></Col>}
- <Col><Button type='primary' style={{ background: '#1890ff' }} icon={<CopyOutlined />} disabled={selectedRows.length === 0} onClick={copyHandle}>复制</Button></Col>
- <Col><Button type='primary' style={{ background: '#67c23a', borderColor: '#67c23a' }} loading={editAdqAdgroupsData.loading} icon={<PlayCircleOutlined />} disabled={selectedRows.length === 0} onClick={() => adStatus('play')}>启动</Button></Col>
- <Col><Button type='primary' style={{ background: '#e6a23c', borderColor: '#e6a23c' }} loading={editAdqAdgroupsData.loading} icon={<PauseCircleOutlined />} disabled={selectedRows.length === 0} onClick={() => adStatus('suspend')}>暂停</Button></Col>
- <Col><SetEarlyWarning selectedRows={selectedRows} onChange={() => listAjax.refresh()} /></Col>
- <Col>
- <Dropdown overlay={<Menu
- onClick={(e) => {
- switch (e.key) {
- case '1':
- editScheduling()
- break
- case '2':
- setRqb()
- break
- case '3':
- syncAd()
- break
- case '4':
- Modal.confirm({
- title: '删除',
- content: '确定删除?',
- icon: <ExclamationCircleOutlined />,
- okType: 'danger',
- onOk() {
- deleteHandle(1)
- }
- });
- break
- }
- }}
- items={[
- {
- key: '1',
- disabled: selectedRows.length === 0,
- label: <Button type="link" size='small' style={{ padding: 0 }} icon={<FieldTimeOutlined />} disabled={selectedRows.length === 0}>修改排期出价名称</Button>,
- },
- {
- key: '2',
- disabled: selectedRows.length > 0 ? !selectedRows.every((item: { accountId: number }) => item.accountId === selectedRows[0].accountId) : true,
- label: <Button type="link" size='small' style={{ padding: 0 }} icon={<FormOutlined />} loading={putModifyCustomAudience.loading} disabled={selectedRows.length > 0 ? !selectedRows.every((item: { accountId: number }) => item.accountId === selectedRows[0].accountId) : true}>
- 修改人群包
- <Tooltip title="2023/4/20 16:20:00刷新页面后平台创建的广告可修改,或者其它平台使用定向包创建广告可用">
- <QuestionCircleOutlined />
- </Tooltip>
- </Button>,
- },
- {
- key: '3',
- disabled: selectedRows.length === 0,
- label: <Button type="link" size='small' style={{ padding: 0 }} loading={putAdqAdgroupsSyncBatchApi.loading} icon={<SyncOutlined />} disabled={selectedRows.length === 0}>同步广告</Button>,
- },
- {
- key: '4',
- disabled: selectedRows.length === 0,
- label: <Button danger type="link" size='small' style={{ padding: 0 }} loading={delListAdqAdgroups.loading} icon={<DeleteOutlined />} disabled={selectedRows.length === 0}>删除</Button>,
- },
- ]} />}>
- <a onClick={(e) => e.preventDefault()}>
- <Space>
- 更多
- <DownOutlined />
- </Space>
- </a>
- </Dropdown>
- </Col>
- <Col>
- <Button type='dashed' onClick={() => { setCzjlShow(true) }}>操作记录</Button>
- </Col>
- </Row>
- </Space>}
- rowSelection={{
- selectedRowKeys: selectedRows.map(item => item.adgroupId.toString()),
- getCheckboxProps: (record: any) => ({
- disabled: model ?
- record.status === 'STATUS_DELETED' :
- record.status === 'STATUS_DELETED' ||
- !(!model &&
- // record?.promotedObjectType === 'PROMOTED_OBJECT_TYPE_WECHAT_OFFICIAL_ACCOUNT' &&
- // record?.optimizationGoal === 'OPTIMIZATIONGOAL_FOLLOW' &&
- record?.deepConversionSpec?.deepConversionWorthSpec?.goal === 'GOAL_1DAY_PURCHASE_ROAS'
- )
- }),
- onSelect: (record: { adgroupId: number, mpName: string }, selected: boolean) => {
- if (selected) {
- selectedRows.push({ ...record })
- setSelectedRows([...selectedRows])
- } else {
- let newSelectAccData = selectedRows.filter((item: { adgroupId: number }) => item.adgroupId !== record.adgroupId)
- setSelectedRows([...newSelectAccData])
- }
- },
- onSelectAll: (selected: boolean, selectedRowss: { adgroupId: number }[], changeRows: { adgroupId: number }[]) => {
- if (selected) {
- let newSelectAccData = [...selectedRows]
- changeRows.forEach((item: { adgroupId: number }) => {
- let index = newSelectAccData.findIndex((ite: { adgroupId: number }) => ite.adgroupId === item.adgroupId)
- if (index === -1) {
- newSelectAccData.push({ ...item })
- }
- })
- setSelectedRows([...newSelectAccData])
- } else {
- let newSelectAccData = selectedRows.filter((item: { adgroupId: number }) => {
- let index = changeRows.findIndex((ite: { adgroupId: number }) => ite.adgroupId === item.adgroupId)
- if (index !== -1) {
- return false
- } else {
- return true
- }
- })
- setSelectedRows([...newSelectAccData])
- }
- }
- }}
- onChange={(props: any) => {
- let { pagination } = props
- let { current, pageSize } = pagination
- set_queryFrom({ ...queryFrom, pageNum: current, pageSize })
- getList({ ...queryFrom, pageNum: current, pageSize })
- }}
- />
- {detailShow && <Details visible={detailShow} onClose={() => { setDetailShow(false) }} data={{ adgroup_id: detailData.adgroupId, account_id: detailData.accountId }} />}
- {czjlShow && <Modal
- visible={czjlShow}
- onCancel={() => { setCzjlShow(false) }}
- onOk={() => { setCzjlShow(false) }}
- width={1200}
- footer={null}
- title={"广告操作记录"}
- >
- <Log {...props} />
- </Modal>}
- {cpVisible && <CrowdPackModal visible={cpVisible} data={accountCreateLogs} onClose={() => setCpVisible(false)} onChange={(e) => { handleRqb(e) }} />}
- </div>
- }
- export default Ad
|