|
@@ -1,18 +1,21 @@
|
|
import { useAjax } from "@/Hook/useAjax"
|
|
import { useAjax } from "@/Hook/useAjax"
|
|
-import { getDynamicCreativeV3ListApi } from "@/services/launchAdq/adqv3"
|
|
|
|
-import { Badge, Button, Col, Form, Input, Row, Select, Space } from "antd"
|
|
|
|
|
|
+import { delBatchCreativeApi, getDynamicCreativeV3ListApi, syncBatchCreativeApi, updateBatchDynamicCreativesInfoApi } from "@/services/launchAdq/adqv3"
|
|
|
|
+import { Badge, Button, Col, Form, Input, Modal, Popconfirm, Row, Select, Space, Table, message } from "antd"
|
|
import React, { useEffect, useState } from "react"
|
|
import React, { useEffect, useState } from "react"
|
|
import { txDynamicConfig } from "../config"
|
|
import { txDynamicConfig } from "../config"
|
|
import tableConfig from "./tableConfig"
|
|
import tableConfig from "./tableConfig"
|
|
import TableData from "@/pages/launchSystemNew/components/TableData"
|
|
import TableData from "@/pages/launchSystemNew/components/TableData"
|
|
import ReviewDetails from "./reviewDetails"
|
|
import ReviewDetails from "./reviewDetails"
|
|
|
|
+import { DeleteOutlined, PauseCircleOutlined, PlayCircleOutlined } from "@ant-design/icons"
|
|
|
|
+import '../../tencentAdPutIn/index.less'
|
|
|
|
+import { MessageApi } from "antd/lib/message"
|
|
|
|
|
|
/** 审核结果 */
|
|
/** 审核结果 */
|
|
export const AD_STATUS = {
|
|
export const AD_STATUS = {
|
|
- NORMAL: <Badge status="success" text="审核通过" />,
|
|
|
|
- PENDING: <Badge status="default" text="审核中" />,
|
|
|
|
- DENIED: <Badge status="error" text="有违规" />,
|
|
|
|
- PARTIALLY_NORMAL: <Badge status="warning" text="部分审核通过" />,
|
|
|
|
|
|
+ NORMAL: <Badge status="success" text="审核通过" />,
|
|
|
|
+ PENDING: <Badge status="default" text="审核中" />,
|
|
|
|
+ DENIED: <Badge status="error" text="有违规" />,
|
|
|
|
+ PARTIALLY_NORMAL: <Badge status="warning" text="部分审核通过" />,
|
|
}
|
|
}
|
|
|
|
|
|
const Creative: React.FC<ADQV3.CreativeProps> = ({ queryForm, setQueryForm, userId }) => {
|
|
const Creative: React.FC<ADQV3.CreativeProps> = ({ queryForm, setQueryForm, userId }) => {
|
|
@@ -21,8 +24,14 @@ const Creative: React.FC<ADQV3.CreativeProps> = ({ queryForm, setQueryForm, user
|
|
const [form] = Form.useForm();
|
|
const [form] = Form.useForm();
|
|
const [dynimicData, setDynamicData] = useState<any>({})
|
|
const [dynimicData, setDynamicData] = useState<any>({})
|
|
const [dynimicVisible, setDynamicVisible] = useState<boolean>(false)
|
|
const [dynimicVisible, setDynamicVisible] = useState<boolean>(false)
|
|
|
|
+ const [selectedRows, setSelectedRows] = useState<any[]>([])
|
|
|
|
+ const [failIdList, setFailIdList] = useState<{ adgroupId: number, code: number, message: string, messageCn: string }[]>([])
|
|
|
|
+ const [failVisible, setFailVisible] = useState<boolean>(false)
|
|
|
|
|
|
const getDynamicCreativeV3List = useAjax((params) => getDynamicCreativeV3ListApi(params), { formatResult: true })
|
|
const getDynamicCreativeV3List = useAjax((params) => getDynamicCreativeV3ListApi(params), { formatResult: true })
|
|
|
|
+ const delBatchCreative = useAjax((params) => delBatchCreativeApi(params))
|
|
|
|
+ const updateBatchDynamicCreativesInfo = useAjax((params) => updateBatchDynamicCreativesInfoApi(params))
|
|
|
|
+ const syncBatchCreative = useAjax((params) => syncBatchCreativeApi(params))
|
|
/*********************************/
|
|
/*********************************/
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
@@ -47,15 +56,115 @@ const Creative: React.FC<ADQV3.CreativeProps> = ({ queryForm, setQueryForm, user
|
|
setDynamicVisible(true)
|
|
setDynamicVisible(true)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ const dynamicHandle = (type: '删除' | '启动' | '暂停', data?: any) => {
|
|
|
|
+ let accountAdgroupMaps = data ? [data.accountId + ',' + data.dynamicCreativeId] :[...new Set(selectedRows?.map(item => item.accountId + ',' + item.dynamicCreativeId))]
|
|
|
|
+ let hide: any
|
|
|
|
+ if (data) {
|
|
|
|
+ hide = message.loading(`正在设置...`, 0, () => {
|
|
|
|
+ message.success('设置成功');
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ switch (type) {
|
|
|
|
+ case '删除':
|
|
|
|
+ delBatchCreative.run({ accountAdgroupMaps }).then(res => {
|
|
|
|
+ if (res?.failIdList?.length === 0) {
|
|
|
|
+ message.success(`修改操作完成!`)
|
|
|
|
+ getDynamicCreativeV3List.refresh()
|
|
|
|
+ setSelectedRows([])
|
|
|
|
+ } else {
|
|
|
|
+ setFailIdList(res?.list || [])
|
|
|
|
+ setFailVisible(true)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ break
|
|
|
|
+ case '启动':
|
|
|
|
+ case '暂停':
|
|
|
|
+ updateBatchDynamicCreativesInfo.run({ accountAdgroupMaps, suspend: type === '暂停' }).then(res => {
|
|
|
|
+ if (res?.failIdList?.length === 0) {
|
|
|
|
+ message.success(`修改操作完成!`)
|
|
|
|
+ getDynamicCreativeV3List.refresh()
|
|
|
|
+ setSelectedRows([])
|
|
|
|
+ } else {
|
|
|
|
+ setFailIdList(res?.list || [])
|
|
|
|
+ setFailVisible(true)
|
|
|
|
+ }
|
|
|
|
+ if (hide) {
|
|
|
|
+ hide()
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ break
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ const sync = () => {
|
|
|
|
+ if (selectedRows?.length > 0) {
|
|
|
|
+ const hide = message.loading(`正在同步...`, 0, () => {
|
|
|
|
+ message.success('设置成功');
|
|
|
|
+ });
|
|
|
|
+ let accountAdgroupMaps = [...new Set(selectedRows?.map(item => item.accountId + ',' + item.dynamicCreativeId))]
|
|
|
|
+ syncBatchCreative.run({ accountAdgroupMaps }).then(res => {
|
|
|
|
+ res && getDynamicCreativeV3List.refresh()
|
|
|
|
+ res ? message.success('同步成功!') : message.error('同步失败!')
|
|
|
|
+ hide()
|
|
|
|
+ }).catch(() => hide())
|
|
|
|
+ } else {
|
|
|
|
+ message.error('请勾选需要同步的创意')
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
return <>
|
|
return <>
|
|
|
|
+ <Form
|
|
|
|
+ layout="inline"
|
|
|
|
+ form={form}
|
|
|
|
+ name="basignCreative"
|
|
|
|
+ initialValues={queryForm}
|
|
|
|
+ onFinish={onFinish}
|
|
|
|
+ style={{ marginBottom: 6 }}
|
|
|
|
+ >
|
|
|
|
+ <Row gutter={[10, 10]}>
|
|
|
|
+ <Col><Form.Item name='accountId' style={{ marginRight: 0 }}>
|
|
|
|
+ <Input placeholder="广告账号,多个逗号隔开" style={{ width: 180 }} allowClear />
|
|
|
|
+ </Form.Item></Col>
|
|
|
|
+ <Col><Form.Item name='adgroupId' style={{ marginRight: 0 }}>
|
|
|
|
+ <Input placeholder="广告ID" style={{ width: 120 }} allowClear />
|
|
|
|
+ </Form.Item></Col>
|
|
|
|
+ <Col><Form.Item name='creativeName' style={{ marginRight: 0 }}>
|
|
|
|
+ <Input placeholder="创意名称" style={{ width: 150 }} allowClear />
|
|
|
|
+ </Form.Item></Col>
|
|
|
|
+ <Col><Form.Item name='creativeId' style={{ marginRight: 0 }}>
|
|
|
|
+ <Input placeholder="创意ID" style={{ width: 120 }} allowClear />
|
|
|
|
+ </Form.Item></Col>
|
|
|
|
+ <Col><Form.Item name='isDeleted'>
|
|
|
|
+ <Select
|
|
|
|
+ placeholder='是否删除?'
|
|
|
|
+ style={{ width: 100 }}
|
|
|
|
+ showSearch
|
|
|
|
+ filterOption={(input: any, option: any) =>
|
|
|
|
+ (option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
|
|
|
|
+ }
|
|
|
|
+ >
|
|
|
|
+ <Select.Option value={true}>是</Select.Option>
|
|
|
|
+ <Select.Option value={false}>否</Select.Option>
|
|
|
|
+ </Select>
|
|
|
|
+ </Form.Item></Col>
|
|
|
|
+ <Col><Form.Item style={{ marginRight: 0 }}>
|
|
|
|
+ <Space>
|
|
|
|
+ <Button type="primary" htmlType="submit">搜索</Button>
|
|
|
|
+ <Button onClick={() => form.resetFields()}>重置</Button>
|
|
|
|
+ <Button disabled={selectedRows.length === 0} style={{ padding: 0 }} danger type="link" onClick={() => setSelectedRows([])}>清空已选({selectedRows.length})</Button>
|
|
|
|
+ </Space>
|
|
|
|
+ </Form.Item></Col>
|
|
|
|
+ </Row>
|
|
|
|
+ </Form>
|
|
<TableData
|
|
<TableData
|
|
isCard={false}
|
|
isCard={false}
|
|
- columns={() => tableConfig(reviewStatusDetails)}
|
|
|
|
|
|
+ columns={() => tableConfig(reviewStatusDetails, (data, type) => dynamicHandle(type, data))}
|
|
ajax={getDynamicCreativeV3List}
|
|
ajax={getDynamicCreativeV3List}
|
|
fixed={{ left: 2, right: 4 }}
|
|
fixed={{ left: 2, right: 4 }}
|
|
dataSource={getDynamicCreativeV3List?.data?.data?.records}
|
|
dataSource={getDynamicCreativeV3List?.data?.data?.records}
|
|
- loading={getDynamicCreativeV3List?.loading}
|
|
|
|
|
|
+ loading={getDynamicCreativeV3List?.loading || syncBatchCreative.loading || updateBatchDynamicCreativesInfo.loading}
|
|
scroll={{ y: 560 }}
|
|
scroll={{ y: 560 }}
|
|
|
|
+ syncAjax={sync}
|
|
total={getDynamicCreativeV3List?.data?.data?.total}
|
|
total={getDynamicCreativeV3List?.data?.data?.total}
|
|
page={getDynamicCreativeV3List?.data?.data?.current}
|
|
page={getDynamicCreativeV3List?.data?.data?.current}
|
|
pageSize={getDynamicCreativeV3List?.data?.data?.size}
|
|
pageSize={getDynamicCreativeV3List?.data?.data?.size}
|
|
@@ -63,47 +172,55 @@ const Creative: React.FC<ADQV3.CreativeProps> = ({ queryForm, setQueryForm, user
|
|
gutter={[0, 10]}
|
|
gutter={[0, 10]}
|
|
config={txDynamicConfig}
|
|
config={txDynamicConfig}
|
|
configName="创意3.0"
|
|
configName="创意3.0"
|
|
- leftChild={<Form
|
|
|
|
- layout="inline"
|
|
|
|
- form={form}
|
|
|
|
- name="basignCreative"
|
|
|
|
- initialValues={queryForm}
|
|
|
|
- onFinish={onFinish}
|
|
|
|
- >
|
|
|
|
- <Row gutter={[10, 10]}>
|
|
|
|
- <Col><Form.Item name='accountId' style={{ marginRight: 0 }}>
|
|
|
|
- <Input placeholder="广告账号,多个逗号隔开" style={{ width: 150 }} allowClear />
|
|
|
|
- </Form.Item></Col>
|
|
|
|
- <Col><Form.Item name='adgroupId' style={{ marginRight: 0 }}>
|
|
|
|
- <Input placeholder="广告ID" style={{ width: 120 }} allowClear />
|
|
|
|
- </Form.Item></Col>
|
|
|
|
- <Col><Form.Item name='creativeName' style={{ marginRight: 0 }}>
|
|
|
|
- <Input placeholder="创意名称" style={{ width: 150 }} allowClear />
|
|
|
|
- </Form.Item></Col>
|
|
|
|
- <Col><Form.Item name='creativeId' style={{ marginRight: 0 }}>
|
|
|
|
- <Input placeholder="创意ID" style={{ width: 120 }} allowClear />
|
|
|
|
- </Form.Item></Col>
|
|
|
|
- <Col><Form.Item name='isDeleted'>
|
|
|
|
- <Select
|
|
|
|
- placeholder='是否删除?'
|
|
|
|
- style={{ width: 100 }}
|
|
|
|
- showSearch
|
|
|
|
- filterOption={(input: any, option: any) =>
|
|
|
|
- (option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
|
|
|
|
|
|
+ leftChild={<Space>
|
|
|
|
+ <Button type='primary' style={{ background: '#67c23a', borderColor: '#67c23a' }} loading={updateBatchDynamicCreativesInfo.loading} icon={<PlayCircleOutlined />} disabled={selectedRows.length === 0} onClick={() => dynamicHandle('启动')}>启动</Button>
|
|
|
|
+ <Button type='primary' style={{ background: '#e6a23c', borderColor: '#e6a23c' }} loading={updateBatchDynamicCreativesInfo.loading} icon={<PauseCircleOutlined />} disabled={selectedRows.length === 0} onClick={() => dynamicHandle('暂停')}>暂停</Button>
|
|
|
|
+ <Popconfirm
|
|
|
|
+ title="确定删除?"
|
|
|
|
+ onConfirm={() => dynamicHandle('删除')}
|
|
|
|
+ disabled={selectedRows.length === 0}
|
|
|
|
+ >
|
|
|
|
+ <Button type='primary' danger icon={<DeleteOutlined />} loading={delBatchCreative.loading} disabled={selectedRows.length === 0}>删除</Button>
|
|
|
|
+ </Popconfirm>
|
|
|
|
+ </Space>}
|
|
|
|
+ rowSelection={{
|
|
|
|
+ selectedRowKeys: selectedRows.map(item => item.dynamicCreativeId.toString()),
|
|
|
|
+ getCheckboxProps: (record: any) => ({
|
|
|
|
+ disabled: record.isDeleted
|
|
|
|
+ }),
|
|
|
|
+ onSelect: (record: { dynamicCreativeId: number }, selected: boolean) => {
|
|
|
|
+ if (selected) {
|
|
|
|
+ selectedRows.push({ ...record })
|
|
|
|
+ setSelectedRows([...selectedRows])
|
|
|
|
+ } else {
|
|
|
|
+ let newSelectAccData = selectedRows.filter((item: { dynamicCreativeId: number }) => item.dynamicCreativeId !== record.dynamicCreativeId)
|
|
|
|
+ setSelectedRows([...newSelectAccData])
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ onSelectAll: (selected: boolean, selectedRowss: { dynamicCreativeId: number }[], changeRows: { dynamicCreativeId: number }[]) => {
|
|
|
|
+ if (selected) {
|
|
|
|
+ let newSelectAccData = [...selectedRows]
|
|
|
|
+ changeRows.forEach((item: { dynamicCreativeId: number }) => {
|
|
|
|
+ let index = newSelectAccData.findIndex((ite: { dynamicCreativeId: number }) => ite.dynamicCreativeId === item.dynamicCreativeId)
|
|
|
|
+ if (index === -1) {
|
|
|
|
+ let data: any = { ...item }
|
|
|
|
+ newSelectAccData.push(data)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ setSelectedRows([...newSelectAccData])
|
|
|
|
+ } else {
|
|
|
|
+ let newSelectAccData = selectedRows.filter((item: { dynamicCreativeId: number }) => {
|
|
|
|
+ let index = changeRows.findIndex((ite: { dynamicCreativeId: number }) => ite.dynamicCreativeId === item.dynamicCreativeId)
|
|
|
|
+ if (index !== -1) {
|
|
|
|
+ return false
|
|
|
|
+ } else {
|
|
|
|
+ return true
|
|
}
|
|
}
|
|
- >
|
|
|
|
- <Select.Option value={true}>是</Select.Option>
|
|
|
|
- <Select.Option value={false}>否</Select.Option>
|
|
|
|
- </Select>
|
|
|
|
- </Form.Item></Col>
|
|
|
|
- <Col><Form.Item style={{ marginRight: 0 }}>
|
|
|
|
- <Space>
|
|
|
|
- <Button type="primary" htmlType="submit">搜索</Button>
|
|
|
|
- <Button onClick={() => form.resetFields()}>重置</Button>
|
|
|
|
- </Space>
|
|
|
|
- </Form.Item></Col>
|
|
|
|
- </Row>
|
|
|
|
- </Form>}
|
|
|
|
|
|
+ })
|
|
|
|
+ setSelectedRows([...newSelectAccData])
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }}
|
|
onChange={(props: any) => {
|
|
onChange={(props: any) => {
|
|
let { pagination } = props
|
|
let { pagination } = props
|
|
let { current, pageSize } = pagination
|
|
let { current, pageSize } = pagination
|
|
@@ -118,6 +235,41 @@ const Creative: React.FC<ADQV3.CreativeProps> = ({ queryForm, setQueryForm, user
|
|
setDynamicVisible(false)
|
|
setDynamicVisible(false)
|
|
}}
|
|
}}
|
|
/>}
|
|
/>}
|
|
|
|
+
|
|
|
|
+ {failVisible && <Modal
|
|
|
|
+ title={<strong>报错信息</strong>}
|
|
|
|
+ visible={failVisible}
|
|
|
|
+ className='modalResetCss'
|
|
|
|
+ width={650}
|
|
|
|
+ onCancel={() => { setFailVisible(false); setFailIdList([]) }}
|
|
|
|
+ footer={null}
|
|
|
|
+ >
|
|
|
|
+ <Table
|
|
|
|
+ size="small"
|
|
|
|
+ bordered
|
|
|
|
+ rowKey={'creativeId'}
|
|
|
|
+ columns={[{
|
|
|
|
+ title: '创意ID',
|
|
|
|
+ dataIndex: 'creativeId',
|
|
|
|
+ key: 'creativeId',
|
|
|
|
+ width: 110,
|
|
|
|
+ render: (value) => <span style={{ fontSize: 12 }}>{value}</span>,
|
|
|
|
+ }, {
|
|
|
|
+ title: 'code',
|
|
|
|
+ dataIndex: 'code',
|
|
|
|
+ key: 'code',
|
|
|
|
+ width: 70,
|
|
|
|
+ align: 'center',
|
|
|
|
+ render: (value) => <span style={{ fontSize: 12 }}>{value}</span>,
|
|
|
|
+ }, {
|
|
|
|
+ title: '错误信息',
|
|
|
|
+ dataIndex: 'messageCn',
|
|
|
|
+ key: 'messageCn',
|
|
|
|
+ render: (value) => <span style={{ fontSize: 12 }}>{value}</span>,
|
|
|
|
+ }]}
|
|
|
|
+ dataSource={failIdList}
|
|
|
|
+ />
|
|
|
|
+ </Modal>}
|
|
</>
|
|
</>
|
|
}
|
|
}
|
|
|
|
|