index.tsx 30 KB

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