index.tsx 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656
  1. import { useAjax } from '@/Hook/useAjax'
  2. import { AdStatusEnum, OptimizationGoalEnum, PromotedObjectType } from '@/services/launchAdq/enum'
  3. import { Col, Row, Input, Select, message, Space, Button, Switch, notification, Modal, Tooltip, Checkbox, Dropdown, Menu } from 'antd'
  4. import React, { useEffect, useCallback, useState } from 'react'
  5. import TableData from '../../components/TableData'
  6. import tableConfig from './tableConfig'
  7. import { putAdqAdgroupsSync, getAdqAdgroupsList, delListAdqAdgroupsApi, newEditAdqAdgroupsDataApi, editAdqAdgroupsDataApi, putAdqAdgroupsSyncBatch, putModifyCustomAudienceApi, getPutUserApi } from '@/services/launchAdq/adq'
  8. import { CopyOutlined, DeleteOutlined, DownOutlined, ExclamationCircleOutlined, FieldTimeOutlined, FormOutlined, PauseCircleOutlined, PlayCircleOutlined, QuestionCircleOutlined, SyncOutlined, TransactionOutlined } from '@ant-design/icons'
  9. import UpdateAd from './updateAd'
  10. import Copy from './copy'
  11. import PlanDetail from '@/pages/adMonitor/adMonitorList/components/planDetail'
  12. import { txAdConfig } from '../config'
  13. import Log from '../log'
  14. import SetEarlyWarning from '@/components/EarlyWarning/setEarlyWarning'
  15. import CrowdPackModal from '../../components/crowdPackModal'
  16. import './index.less'
  17. import AdIdSearch from './adIdSearch'
  18. import Details from '@/pages/adMonitor/adMonitorList/components/Details'
  19. type Props = {
  20. accountId?: string,
  21. adAccountId?: string,
  22. userId: string,
  23. Ts?: any,
  24. queryParmas?: {
  25. accountId?: string,//账户ID
  26. campaignId?: string,//计划ID
  27. adgroupId?: string,//广告ID
  28. adcreativeId?: string,//创意ID
  29. pageId?: string,//落地页ID
  30. targetingId?: string,//定向ID}
  31. },
  32. tableIdClick?: (props: {
  33. activeKey: string, parma: {
  34. accountId?: string,//账户ID
  35. campaignId?: string,//计划ID
  36. adgroupId?: string,//广告ID
  37. adcreativeId?: string,//创意ID
  38. pageId?: string,//落地页ID
  39. targetingId?: string,//定向ID
  40. }
  41. }) => void
  42. }
  43. const Ad: React.FC<Props> = (props) => {
  44. /***********************/
  45. let { accountId, userId, queryParmas, Ts } = props
  46. const [selectedRows, setSelectedRows] = useState<any[]>([])
  47. const [update, setUpdate] = useState<{ visible: boolean, title: string }>({ visible: false, title: '' })
  48. const [model, setModel] = useState(true)
  49. const [copyData, setCopyData] = useState<{ visible: boolean }>({ visible: false })
  50. const [detailShow, setDetailShow] = useState<boolean>(false)
  51. const [detailData, setDetailData] = useState<any>({})
  52. const [czjlShow, setCzjlShow] = useState(false)
  53. const [cpVisible, setCpVisible] = useState(false)
  54. const [isClearSelect, setIsClearSelect] = useState(true)
  55. const [accountCreateLogs, setAccountCreateLogs] = useState<{ adAccountId: number, id: number, customAudienceList?: any[], excludedCustomAudienceList?: any[] }[]>([])
  56. const [queryFrom, set_queryFrom] = useState<{
  57. pageNum: number;
  58. pageSize: number;
  59. accountIdList?: any[];
  60. adgroupName?: string;
  61. adgroupIdList?: any[];
  62. promotedObjectType?: string;
  63. isDeleted?: boolean
  64. campaignIdList?: any[]
  65. statusList?: any[],
  66. memoList?: any[]
  67. remarkList?: any[]
  68. optimizationGoal?: string,
  69. putUserIdList?: number[]
  70. }>({ pageNum: 1, pageSize: 20 })
  71. const listAjax = useAjax((params) => getAdqAdgroupsList(params), { formatResult: true })
  72. const syncAjax = useAjax((adAccountId) => putAdqAdgroupsSync(adAccountId))
  73. const delListAdqAdgroups = useAjax((params) => delListAdqAdgroupsApi(params))
  74. const editAdqAdgroupsData = useAjax((params) => newEditAdqAdgroupsDataApi(params))
  75. const editAdqAdgroups = useAjax((params) => editAdqAdgroupsDataApi(params))
  76. const putModifyCustomAudience = useAjax((params) => putModifyCustomAudienceApi(params))
  77. const putAdqAdgroupsSyncBatchApi = useAjax((params) => putAdqAdgroupsSyncBatch(params))
  78. const getPutUser = useAjax((params) => getPutUserApi(params))
  79. /************************/
  80. useEffect(() => {
  81. getPutUser.run({ userId })
  82. }, [userId])
  83. useEffect(() => {
  84. // let { accountId, campaignId, adgroupId, ...obj } = queryParmas
  85. // let new_queryParmas = {
  86. // ...obj,
  87. // accountIdList: accountId ? [accountId] : [],
  88. // campaignIdList: campaignId ? [campaignId] : [],
  89. // adgroupIdList: adgroupId ? [adgroupId] : []
  90. // }
  91. getList({ pageNum: 1, pageSize: 20 })
  92. }, [accountId, userId, queryParmas, model])
  93. // 获取列表
  94. const getList = useCallback((params: {
  95. pageNum: number;
  96. pageSize: number;
  97. accountIdList?: any[];
  98. adgroupName?: string;
  99. adgroupIdList?: any[];
  100. promotedObjectType?: string;
  101. isDeleted?: boolean
  102. campaignIdList?: any[]
  103. statusList?: any[],
  104. memoList?: any[]
  105. remarkList?: any[]
  106. isDeepConversionSpec?: boolean
  107. }) => {
  108. if (!model) {
  109. params.isDeepConversionSpec = true
  110. }
  111. listAjax.run({ ...params, userId })
  112. }, [userId, listAjax, model])
  113. // 同步
  114. const sync = useCallback(() => {
  115. // if (selectedRows?.length === 0) {
  116. // message.error('请先勾选要同步的广点通账号!')
  117. // return
  118. // }
  119. let arr = [...new Set(selectedRows?.map(item => item.accountId))]
  120. syncAjax.run({ accountIdList: arr }).then(res => {
  121. res && listAjax.refresh()
  122. res ? message.success('同步成功!') : message.error('同步失败!')
  123. })
  124. }, [listAjax, selectedRows])
  125. /** 删除 */
  126. const deleteHandle = (type: 0 | 1, adgroupId?: number) => {
  127. const hide = message.loading('删除中。。。', 0)
  128. delListAdqAdgroups.run({ adgroupIds: type === 1 ? selectedRows.map(item => item.adgroupId) : [adgroupId] }).then(res => {
  129. hide()
  130. message.success('删除成功')
  131. setSelectedRows([])
  132. listAjax.refresh()
  133. }).catch(() => hide())
  134. }
  135. /** 修改排期出价 */
  136. const editScheduling = () => {
  137. setUpdate({ visible: true, title: '批量修改' })
  138. }
  139. /** 修改排期出价 */
  140. const editDeepConversion = () => {
  141. setUpdate({ visible: true, title: '批量修改深度优化' })
  142. }
  143. // 单个启停
  144. const onChange = () => {
  145. listAjax.refresh()
  146. setSelectedRows([])
  147. }
  148. // 批量启停
  149. const adStatus = (type: 'play' | 'suspend') => {
  150. let params: any = {}
  151. if (type === 'play') {
  152. params.configuredStatus = 'AD_STATUS_NORMAL'
  153. params.adgroupIds = selectedRows.filter((item: { configuredStatus: string, adgroupId: number }) => item.configuredStatus === 'AD_STATUS_SUSPEND').map(item => item.adgroupId)
  154. } else {
  155. params.configuredStatus = 'AD_STATUS_SUSPEND'
  156. params.adgroupIds = selectedRows.filter((item: { configuredStatus: string, adgroupId: number }) => item.configuredStatus === 'AD_STATUS_NORMAL').map(item => item.adgroupId)
  157. }
  158. if (params.adgroupIds.length === 0) {
  159. message.warn(`所以账号都是${type === 'play' ? '启动' : '暂停'}状态,无需${type === 'play' ? '启动' : '暂停'}操作`)
  160. return
  161. }
  162. editAdqAdgroupsData.run(params).then(res => {
  163. message.success(`${type === 'play' ? '启动' : '暂停'}成功: ${res.success},失败: ${res.fail}`)//
  164. if (res?.fail) {
  165. notification.error({
  166. message: `${type === 'play' ? '启动' : '暂停'}失败`,
  167. description: `成功: ${res.success},修改失败${res.fail}条,失败的请到任务列表查看`,
  168. duration: 0
  169. });
  170. }
  171. listAjax.refresh()
  172. setSelectedRows([])
  173. })
  174. }
  175. //同步广告
  176. const syncAd = useCallback(() => {
  177. const hide = message.loading('同步中。。。', 0)
  178. putAdqAdgroupsSyncBatchApi.run({ adgroupIds: selectedRows?.map(item => item.adgroupId) }).then(res => {
  179. hide()
  180. if (res) {
  181. message.success('同步成功!')
  182. listAjax.refresh()
  183. }
  184. }).catch(() => hide())
  185. }, [selectedRows])
  186. // 批量复制
  187. const copyHandle = () => {
  188. setCopyData({ visible: true })
  189. }
  190. const handleSave = (row: any) => {
  191. const hide = message.loading(`广告“${row.adgroupId}”广告名称修改成<${row.adgroupName}>,修改中`, 0, () => {
  192. message.success('修改成功');
  193. });
  194. editAdqAdgroups.run({ adgroupIds: [row.adgroupId], adgroupName: row.adgroupName }).then(res => {
  195. message.success('修改广告名称成功')
  196. listAjax.refresh()
  197. hide()
  198. })
  199. }
  200. const handleSaveDaily = (row: any) => {
  201. console.log('row--->', row)
  202. const hide = message.loading(`广告“${row.adgroupId}”广告预算修改成<${row.dailyBudget}元>,修改中`, 0, () => {
  203. message.success('修改成功');
  204. });
  205. editAdqAdgroups.run({ adgroupIds: [row.adgroupId], dailyBudget: row.dailyBudget * 100 }).then(res => {
  206. message.success('修改广告预算成功')
  207. listAjax.refresh()
  208. hide()
  209. })
  210. }
  211. const details = (data: any) => {
  212. setDetailData(data)
  213. setDetailShow(true)
  214. }
  215. // 设置人群包
  216. const setRqb = () => {
  217. const { accountId } = selectedRows[0]
  218. setAccountCreateLogs([{ id: accountId, adAccountId: accountId }])
  219. setCpVisible(true)
  220. }
  221. // 确认提交人群包
  222. const handleRqb = (value: any[]) => {
  223. if ((value[0]?.customAudienceList && value[0]?.customAudienceList?.length > 0) || (value[0]?.excludedCustomAudienceList && value[0]?.excludedCustomAudienceList?.length > 0)) {
  224. let { adAccountId, customAudienceList = [], excludedCustomAudienceList = [] } = value[0]
  225. let adgroupIds = selectedRows.map((item: { adgroupId: number }) => item.adgroupId)
  226. let customAudienceIds = customAudienceList.map((item: { id: number }) => item.id)
  227. let excludedCustomAudienceIds = excludedCustomAudienceList.map((item: { id: number }) => item.id)
  228. const hide = message.loading('正在修改。。。', 0)
  229. setAccountCreateLogs([])
  230. setCpVisible(false)
  231. let params: any = { adAccountId, adgroupIds };
  232. if (excludedCustomAudienceIds.length > 0) {
  233. params['excludedCustomAudienceIds'] = excludedCustomAudienceIds
  234. }
  235. if (customAudienceIds?.length > 0) {
  236. params['customAudienceIds'] = customAudienceIds
  237. }
  238. putModifyCustomAudience.run(params).then(res => {
  239. hide()
  240. setSelectedRows([])
  241. message.success('修改成功,请到腾讯广告平台查看')
  242. }).catch(err => hide())
  243. } else {
  244. message.error('请选择用户群')
  245. }
  246. }
  247. return <div>
  248. {/* 修改广告 */}
  249. {update.visible && <UpdateAd
  250. {...update}
  251. selectedRows={selectedRows}
  252. onChange={() => {
  253. setUpdate({ visible: false, title: '' })
  254. listAjax.refresh()
  255. setSelectedRows([])
  256. }}
  257. onClose={() => { setUpdate({ visible: false, title: '' }) }}
  258. />}
  259. {/* 复制广告 */}
  260. {copyData.visible && <Copy selectedRows={selectedRows} {...copyData} onClose={() => setCopyData({ visible: false })} onChange={() => { setCopyData({ visible: false }); listAjax.refresh(); setSelectedRows([]) }} />}
  261. <Row gutter={[6, 6]} align='middle' style={{ marginBottom: 15 }}>
  262. {Ts && <Col>
  263. {Ts()}
  264. </Col>}
  265. <Col>
  266. <Input
  267. placeholder='广告账号'
  268. allowClear
  269. style={{ width: 100 }}
  270. onChange={(e) => {
  271. let value = e.target.value
  272. let arr: any = []
  273. if (value) {
  274. value = value.replace(/[,,\s]/g, ',')
  275. arr = value.split(',').filter((a: any) => a)
  276. }
  277. set_queryFrom({ ...queryFrom, accountIdList: arr })
  278. }}
  279. />
  280. </Col>
  281. <Col>
  282. <Input
  283. placeholder='广告ID'
  284. allowClear
  285. style={{ width: 100 }}
  286. onChange={(e) => {
  287. let value = e.target.value
  288. let arr: any = []
  289. if (value) {
  290. value = value.replace(/[,,\s]/g, ',')
  291. arr = value.split(',').filter((a: any) => a)
  292. }
  293. set_queryFrom({ ...queryFrom, adgroupIdList: arr })
  294. }}
  295. />
  296. </Col>
  297. <Col>
  298. <Input
  299. placeholder='计划ID'
  300. allowClear
  301. style={{ width: 100 }}
  302. onChange={(e) => {
  303. let value = e.target.value
  304. let arr: any = []
  305. if (value) {
  306. value = value.replace(/[,,\s]/g, ',')
  307. arr = value.split(',').filter((a: any) => a)
  308. }
  309. set_queryFrom({ ...queryFrom, campaignIdList: arr })
  310. }}
  311. />
  312. </Col>
  313. <Col>
  314. <Select
  315. placeholder='推广目标'
  316. style={{ width: 110 }}
  317. showSearch
  318. filterOption={(input: any, option: any) =>
  319. (option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
  320. }
  321. allowClear
  322. onChange={(value: any) => {
  323. set_queryFrom({ ...queryFrom, promotedObjectType: value })
  324. }}
  325. >
  326. {Object.keys(PromotedObjectType).map(key => {
  327. return <Select.Option value={key} key={key}>{PromotedObjectType[key]}</Select.Option>
  328. })}
  329. </Select>
  330. </Col>
  331. <Col>
  332. <Select
  333. placeholder='已删除?'
  334. style={{ width: 100 }}
  335. showSearch
  336. filterOption={(input: any, option: any) =>
  337. (option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
  338. }
  339. allowClear
  340. onChange={(value: any) => {
  341. set_queryFrom({ ...queryFrom, isDeleted: value })
  342. }}
  343. >
  344. <Select.Option value={true}>已删除</Select.Option>
  345. <Select.Option value={false}>未删除</Select.Option>
  346. </Select>
  347. </Col>
  348. <Col>
  349. <Select
  350. placeholder='广告状态'
  351. mode="multiple"
  352. style={{ minWidth: 120 }}
  353. showSearch
  354. filterOption={(input: any, option: any) =>
  355. (option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
  356. }
  357. allowClear
  358. onChange={(value: any) => {
  359. set_queryFrom({ ...queryFrom, statusList: value })
  360. }}
  361. >
  362. {
  363. Object.keys(AdStatusEnum).map(key => {
  364. return <Select.Option value={key} key={key}>{AdStatusEnum[key]}</Select.Option>
  365. })
  366. }
  367. </Select>
  368. </Col>
  369. <Col>
  370. <Input
  371. placeholder='广告名称'
  372. allowClear
  373. style={{ width: 120 }}
  374. onChange={(e) => {
  375. let value = e.target.value
  376. set_queryFrom({ ...queryFrom, adgroupName: value })
  377. }}
  378. />
  379. </Col>
  380. <Col>
  381. <Input
  382. placeholder='腾讯备注'
  383. allowClear
  384. style={{ width: 120 }}
  385. onChange={(e) => {
  386. let value = e.target.value
  387. let arr: any = []
  388. if (value) {
  389. value = value.replace(/[,,\s]/g, ',')
  390. arr = value.split(',').filter((a: any) => a)
  391. }
  392. set_queryFrom({ ...queryFrom, memoList: arr })
  393. }}
  394. />
  395. </Col>
  396. <Col>
  397. <Input
  398. placeholder='本地备注'
  399. allowClear
  400. style={{ width: 120 }}
  401. onChange={(e) => {
  402. let value = e.target.value
  403. let arr: any = []
  404. if (value) {
  405. value = value.replace(/[,,\s]/g, ',')
  406. arr = value.split(',').filter((a: any) => a)
  407. }
  408. set_queryFrom({ ...queryFrom, remarkList: arr })
  409. }}
  410. />
  411. </Col>
  412. <Col>
  413. <Select
  414. placeholder='优化目标'
  415. style={{ width: 100 }}
  416. showSearch
  417. filterOption={(input: any, option: any) =>
  418. (option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
  419. }
  420. allowClear
  421. value={queryFrom.optimizationGoal}
  422. onChange={(value: any) => {
  423. set_queryFrom({ ...queryFrom, optimizationGoal: value })
  424. }}
  425. >
  426. {Object.keys(OptimizationGoalEnum).map(key => <Select.Option value={key} key={key}>{OptimizationGoalEnum[key]}</Select.Option>)}
  427. </Select>
  428. </Col>
  429. <Col>
  430. <Select
  431. placeholder='投手'
  432. mode='multiple'
  433. style={{ minWidth: 100 }}
  434. maxLength={1}
  435. showSearch
  436. filterOption={(input: any, option: any) =>
  437. (option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
  438. }
  439. allowClear
  440. value={queryFrom.putUserIdList}
  441. onChange={(value: any) => {
  442. set_queryFrom({ ...queryFrom, putUserIdList: value })
  443. }}
  444. >
  445. {getPutUser?.data ? Object.keys(getPutUser?.data).map(key => <Select.Option value={key} key={key}>{getPutUser?.data[key]}</Select.Option>) : null}
  446. </Select>
  447. </Col>
  448. <Col>
  449. <Space>
  450. <Button
  451. type="primary"
  452. onClick={() => {
  453. if (isClearSelect) {
  454. setSelectedRows([])
  455. }
  456. getList({ ...queryFrom, pageNum: 1 })
  457. }}
  458. >
  459. <Space>
  460. <span>搜索</span>
  461. <Checkbox className='clearCheckbox' onClick={(e) => e.stopPropagation()} checked={isClearSelect} onChange={(e) => setIsClearSelect(e.target.checked)} />
  462. <Tooltip title="勾选搜索清空已选">
  463. <QuestionCircleOutlined />
  464. </Tooltip>
  465. </Space>
  466. </Button>
  467. {selectedRows?.length > 0 && <Button type='link' style={{ padding: 0, color: 'red' }} onClick={() => {
  468. setSelectedRows([])
  469. }}>清空已选({selectedRows?.length})</Button>}
  470. </Space>
  471. </Col>
  472. </Row>
  473. <TableData
  474. isCard={false}
  475. columns={() => tableConfig(onChange, details, handleSave, handleSaveDaily)}
  476. ajax={listAjax}
  477. syncAjax={sync}
  478. fixed={{ left: 2, right: 4 }}
  479. dataSource={listAjax?.data?.data?.records}
  480. loading={listAjax?.loading || syncAjax?.loading}
  481. scroll={{ y: 560 }}
  482. total={listAjax?.data?.data?.total}
  483. page={listAjax?.data?.data?.current}
  484. pageSize={listAjax?.data?.data?.size}
  485. myKey={'adgroupId'}
  486. gutter={[0, 10]}
  487. config={txAdConfig}
  488. configName="腾讯广告"
  489. leftChild={<Space direction='vertical'>
  490. <Row gutter={[10, 10]} align='middle'>
  491. <Col>
  492. <Switch checkedChildren="普通" unCheckedChildren="ROI" checked={model} onChange={(checked) => { setModel(checked); setSelectedRows([]) }} style={model ? {} : { background: '#67c23a' }} />
  493. </Col>
  494. {!model && <Col><Button type='primary' icon={<TransactionOutlined />} disabled={selectedRows.length === 0} onClick={editDeepConversion}>修改深度优化ROI</Button></Col>}
  495. <Col><Button type='primary' style={{ background: '#1890ff' }} icon={<CopyOutlined />} disabled={selectedRows.length === 0} onClick={copyHandle}>复制</Button></Col>
  496. <Col><Button type='primary' style={{ background: '#67c23a', borderColor: '#67c23a' }} loading={editAdqAdgroupsData.loading} icon={<PlayCircleOutlined />} disabled={selectedRows.length === 0} onClick={() => adStatus('play')}>启动</Button></Col>
  497. <Col><Button type='primary' style={{ background: '#e6a23c', borderColor: '#e6a23c' }} loading={editAdqAdgroupsData.loading} icon={<PauseCircleOutlined />} disabled={selectedRows.length === 0} onClick={() => adStatus('suspend')}>暂停</Button></Col>
  498. <Col><SetEarlyWarning selectedRows={selectedRows} onChange={() => listAjax.refresh()} /></Col>
  499. <Col>
  500. <Dropdown overlay={<Menu
  501. onClick={(e) => {
  502. switch (e.key) {
  503. case '1':
  504. editScheduling()
  505. break
  506. case '2':
  507. setRqb()
  508. break
  509. case '3':
  510. syncAd()
  511. break
  512. case '4':
  513. Modal.confirm({
  514. title: '删除',
  515. content: '确定删除?',
  516. icon: <ExclamationCircleOutlined />,
  517. okType: 'danger',
  518. onOk() {
  519. deleteHandle(1)
  520. }
  521. });
  522. break
  523. }
  524. }}
  525. items={[
  526. {
  527. key: '1',
  528. disabled: selectedRows.length === 0,
  529. label: <Button type="link" size='small' style={{ padding: 0 }} icon={<FieldTimeOutlined />} disabled={selectedRows.length === 0}>修改排期出价名称</Button>,
  530. },
  531. {
  532. key: '2',
  533. disabled: selectedRows.length > 0 ? !selectedRows.every((item: { accountId: number }) => item.accountId === selectedRows[0].accountId) : true,
  534. 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}>
  535. 修改人群包
  536. <Tooltip title="2023/4/20 16:20:00刷新页面后平台创建的广告可修改,或者其它平台使用定向包创建广告可用">
  537. <QuestionCircleOutlined />
  538. </Tooltip>
  539. </Button>,
  540. },
  541. {
  542. key: '3',
  543. disabled: selectedRows.length === 0,
  544. label: <Button type="link" size='small' style={{ padding: 0 }} loading={putAdqAdgroupsSyncBatchApi.loading} icon={<SyncOutlined />} disabled={selectedRows.length === 0}>同步广告</Button>,
  545. },
  546. {
  547. key: '4',
  548. disabled: selectedRows.length === 0,
  549. label: <Button danger type="link" size='small' style={{ padding: 0 }} loading={delListAdqAdgroups.loading} icon={<DeleteOutlined />} disabled={selectedRows.length === 0}>删除</Button>,
  550. },
  551. ]} />}>
  552. <a onClick={(e) => e.preventDefault()}>
  553. <Space>
  554. 更多
  555. <DownOutlined />
  556. </Space>
  557. </a>
  558. </Dropdown>
  559. </Col>
  560. <Col>
  561. <Button type='dashed' onClick={() => { setCzjlShow(true) }}>操作记录</Button>
  562. </Col>
  563. <Col>
  564. <AdIdSearch userId={userId} onChange={(e) => {
  565. getList({ ...queryFrom, pageNum: 1, adgroupIdList: e })
  566. }} />
  567. </Col>
  568. </Row>
  569. </Space>}
  570. rowSelection={{
  571. selectedRowKeys: selectedRows.map(item => item.adgroupId.toString()),
  572. getCheckboxProps: (record: any) => ({
  573. disabled: model ?
  574. record.status === 'STATUS_DELETED' :
  575. record.status === 'STATUS_DELETED' ||
  576. !(!model &&
  577. // record?.promotedObjectType === 'PROMOTED_OBJECT_TYPE_WECHAT_OFFICIAL_ACCOUNT' &&
  578. // record?.optimizationGoal === 'OPTIMIZATIONGOAL_FOLLOW' &&
  579. record?.deepConversionSpec?.deepConversionWorthSpec?.goal === 'GOAL_1DAY_PURCHASE_ROAS'
  580. )
  581. }),
  582. onSelect: (record: { adgroupId: number, mpName: string }, selected: boolean) => {
  583. if (selected) {
  584. selectedRows.push({ ...record })
  585. setSelectedRows([...selectedRows])
  586. } else {
  587. let newSelectAccData = selectedRows.filter((item: { adgroupId: number }) => item.adgroupId !== record.adgroupId)
  588. setSelectedRows([...newSelectAccData])
  589. }
  590. },
  591. onSelectAll: (selected: boolean, selectedRowss: { adgroupId: number }[], changeRows: { adgroupId: number }[]) => {
  592. if (selected) {
  593. let newSelectAccData = [...selectedRows]
  594. changeRows.forEach((item: { adgroupId: number }) => {
  595. let index = newSelectAccData.findIndex((ite: { adgroupId: number }) => ite.adgroupId === item.adgroupId)
  596. if (index === -1) {
  597. newSelectAccData.push({ ...item })
  598. }
  599. })
  600. setSelectedRows([...newSelectAccData])
  601. } else {
  602. let newSelectAccData = selectedRows.filter((item: { adgroupId: number }) => {
  603. let index = changeRows.findIndex((ite: { adgroupId: number }) => ite.adgroupId === item.adgroupId)
  604. if (index !== -1) {
  605. return false
  606. } else {
  607. return true
  608. }
  609. })
  610. setSelectedRows([...newSelectAccData])
  611. }
  612. }
  613. }}
  614. onChange={(props: any) => {
  615. let { pagination } = props
  616. let { current, pageSize } = pagination
  617. set_queryFrom({ ...queryFrom, pageNum: current, pageSize })
  618. getList({ ...queryFrom, pageNum: current, pageSize })
  619. }}
  620. />
  621. {detailShow && <Details visible={detailShow} onClose={() => { setDetailShow(false) }} data={{ adgroup_id: detailData.adgroupId, account_id: detailData.accountId }} />}
  622. {czjlShow && <Modal
  623. visible={czjlShow}
  624. onCancel={() => { setCzjlShow(false) }}
  625. onOk={() => { setCzjlShow(false) }}
  626. width={1200}
  627. footer={null}
  628. title={"广告操作记录"}
  629. >
  630. <Log {...props} />
  631. </Modal>}
  632. {cpVisible && <CrowdPackModal visible={cpVisible} data={accountCreateLogs} onClose={() => setCpVisible(false)} onChange={(e) => { handleRqb(e) }} />}
  633. </div>
  634. }
  635. export default Ad