|
@@ -5,8 +5,8 @@ import TablePro from "@/components/TablePro"
|
|
import columns12 from "./tableConfig"
|
|
import columns12 from "./tableConfig"
|
|
import moment from "moment"
|
|
import moment from "moment"
|
|
import { useModel } from "umi"
|
|
import { useModel } from "umi"
|
|
-import { Button, Dropdown, message, notification, Select, Space } from "antd"
|
|
|
|
-import { newEditAdqAdgroupsDataApi } from "@/services/gameData"
|
|
|
|
|
|
+import { Button, Dropdown, message, Select, Space, Switch } from "antd"
|
|
|
|
+import { modifyStatusBatchApi } from "@/services/gameData"
|
|
import { DeleteOutlined, DownOutlined, PauseCircleOutlined, PlayCircleOutlined } from "@ant-design/icons"
|
|
import { DeleteOutlined, DownOutlined, PauseCircleOutlined, PlayCircleOutlined } from "@ant-design/icons"
|
|
import DayAd from "./dayAd"
|
|
import DayAd from "./dayAd"
|
|
import QueryFormNovel from "@/components/QueryForm/queryFormNovel"
|
|
import QueryFormNovel from "@/components/QueryForm/queryFormNovel"
|
|
@@ -35,13 +35,18 @@ const TencentNovelAd: React.FC<{ configName?: string, dayConfigName?: string }>
|
|
const [updateData, setUpdateDate] = useState<{ visible: boolean, type: '修改出价' | '修改名称' | '修改日限额' | '修改投放时间' | '删除' | '深度优化ROI' | '修改投放首日开始时间' }>({ visible: false, type: '修改出价' })
|
|
const [updateData, setUpdateDate] = useState<{ visible: boolean, type: '修改出价' | '修改名称' | '修改日限额' | '修改投放时间' | '删除' | '深度优化ROI' | '修改投放首日开始时间' }>({ visible: false, type: '修改出价' })
|
|
const [autoAcqVisible, setAutoAcqVisible] = useState<boolean>(false)
|
|
const [autoAcqVisible, setAutoAcqVisible] = useState<boolean>(false)
|
|
const [handleType, setHandleType] = useState<number>(1)
|
|
const [handleType, setHandleType] = useState<number>(1)
|
|
|
|
+ const [isZj, setIsZj] = useState<boolean>(true)
|
|
|
|
|
|
- const editAdqAdgroupsData = useAjax((params) => newEditAdqAdgroupsDataApi(params))
|
|
|
|
|
|
+ const modifyStatusBatch = useAjax((params) => modifyStatusBatchApi(params))
|
|
const getGDTList = useAjax((params) => getNovelGDTListApi(params))
|
|
const getGDTList = useAjax((params) => getNovelGDTListApi(params))
|
|
const getGDTTotal = useAjax((params) => getNovelGDTTotalApi(params))
|
|
const getGDTTotal = useAjax((params) => getNovelGDTTotalApi(params))
|
|
/****************************************/
|
|
/****************************************/
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
|
+ getList()
|
|
|
|
+ }, [queryForm, initialState?.iaaApp])
|
|
|
|
+
|
|
|
|
+ const getList = () => {
|
|
if (initialState?.iaaApp) {
|
|
if (initialState?.iaaApp) {
|
|
const [appId, productType] = initialState.iaaApp.split('||')
|
|
const [appId, productType] = initialState.iaaApp.split('||')
|
|
getGDTList.run({ ...queryForm, appId, productType })
|
|
getGDTList.run({ ...queryForm, appId, productType })
|
|
@@ -56,8 +61,7 @@ const TencentNovelAd: React.FC<{ configName?: string, dayConfigName?: string }>
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|
|
-
|
|
|
|
- }, [queryForm, initialState?.iaaApp])
|
|
|
|
|
|
+ }
|
|
|
|
|
|
const dayHandle = (data: any) => {
|
|
const dayHandle = (data: any) => {
|
|
setVisible(true)
|
|
setVisible(true)
|
|
@@ -66,37 +70,33 @@ const TencentNovelAd: React.FC<{ configName?: string, dayConfigName?: string }>
|
|
}
|
|
}
|
|
|
|
|
|
// 批量启停
|
|
// 批量启停
|
|
- 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)
|
|
|
|
|
|
+ const adStatus = (type: boolean) => {
|
|
|
|
+ let newSelectedRows = []
|
|
|
|
+ if (type) {
|
|
|
|
+ newSelectedRows = selectedRows.filter((item: { configuredStatus: string, adgroupId: number }) => item.configuredStatus === 'AD_STATUS_SUSPEND')
|
|
} else {
|
|
} else {
|
|
- params.configuredStatus = 'AD_STATUS_SUSPEND'
|
|
|
|
- params.adgroupIds = selectedRows.filter((item: { configuredStatus: string, adgroupId: number }) => item.configuredStatus === 'AD_STATUS_NORMAL').map(item => item.adgroupId)
|
|
|
|
|
|
+ newSelectedRows = selectedRows.filter((item: { configuredStatus: string, adgroupId: number }) => item.configuredStatus === 'AD_STATUS_NORMAL')
|
|
}
|
|
}
|
|
- if (params.adgroupIds.length === 0) {
|
|
|
|
- message.warn(`所以账号都是${type === 'play' ? '启动' : '暂停'}状态,无需${type === 'play' ? '启动' : '暂停'}操作`)
|
|
|
|
|
|
+ if (newSelectedRows.length === 0) {
|
|
|
|
+ message.warn(`所有广告都是${type ? '启动' : '暂停'}状态,无需${type ? '启动' : '暂停'}操作`)
|
|
return
|
|
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
|
|
|
|
- });
|
|
|
|
|
|
+ let accountAdgroupMaps = [...new Set(newSelectedRows?.map(item => item.accountId + ',' + item.adgroupId))]
|
|
|
|
+ modifyStatusBatch.run({ accountAdgroupMaps, suspend: !type }).then(res => {
|
|
|
|
+ if (res?.data?.failIdList?.length === 0) {
|
|
|
|
+ message.success(`${type ? '启动' : '暂停'}成功`)
|
|
|
|
+ getGDTList.refresh()
|
|
|
|
+ setSelectedRows([])
|
|
|
|
+ } else {
|
|
|
|
+ message.success(`${type ? '启动' : '暂停'}失败,${JSON.stringify(res?.data?.failIdList)}`)
|
|
}
|
|
}
|
|
- getGDTList.refresh()
|
|
|
|
- setSelectedRows([])
|
|
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
return <div>
|
|
return <div>
|
|
<TablePro
|
|
<TablePro
|
|
czChild={<Space>
|
|
czChild={<Space>
|
|
- {/* <Switch checkedChildren="开启全选" unCheckedChildren="关闭全选" checked={!isZj} onChange={(e) => { setIsZj(!e); }} /> */}
|
|
|
|
|
|
+ <Switch checkedChildren="开启全选" unCheckedChildren="关闭全选" checked={!isZj} onChange={(e) => { setIsZj(!e); }} />
|
|
<Select
|
|
<Select
|
|
style={{ width: 120 }}
|
|
style={{ width: 120 }}
|
|
onChange={(e) => {
|
|
onChange={(e) => {
|
|
@@ -107,8 +107,8 @@ const TencentNovelAd: React.FC<{ configName?: string, dayConfigName?: string }>
|
|
dropdownMatchSelectWidth={false}
|
|
dropdownMatchSelectWidth={false}
|
|
options={[{ label: '广告操作', value: 1 }, { label: '修改深度优化期望ROI', value: 3 }]}
|
|
options={[{ label: '广告操作', value: 1 }, { label: '修改深度优化期望ROI', value: 3 }]}
|
|
/>
|
|
/>
|
|
- <Button type='primary' style={{ background: '#67c23a', borderColor: '#67c23a' }} loading={editAdqAdgroupsData.loading} icon={<PlayCircleOutlined />} disabled={selectedRows.length === 0} onClick={() => adStatus('play')}>启动</Button>
|
|
|
|
- <Button type='primary' style={{ background: '#e6a23c', borderColor: '#e6a23c' }} loading={editAdqAdgroupsData.loading} icon={<PauseCircleOutlined />} disabled={selectedRows.length === 0} onClick={() => adStatus('suspend')}>暂停</Button>
|
|
|
|
|
|
+ <Button type='primary' style={{ background: '#67c23a', borderColor: '#67c23a' }} loading={modifyStatusBatch.loading} icon={<PlayCircleOutlined />} disabled={selectedRows.length === 0} onClick={() => adStatus(true)}>启动</Button>
|
|
|
|
+ <Button type='primary' style={{ background: '#e6a23c', borderColor: '#e6a23c' }} loading={modifyStatusBatch.loading} icon={<PauseCircleOutlined />} disabled={selectedRows.length === 0} onClick={() => adStatus(false)}>暂停</Button>
|
|
{handleType === 1 ? <>
|
|
{handleType === 1 ? <>
|
|
<Button type='primary' danger icon={<DeleteOutlined />} disabled={selectedRows.length === 0} onClick={() => {
|
|
<Button type='primary' danger icon={<DeleteOutlined />} disabled={selectedRows.length === 0} onClick={() => {
|
|
setUpdateDate({ visible: true, type: '删除' })
|
|
setUpdateDate({ visible: true, type: '删除' })
|
|
@@ -227,17 +227,17 @@ const TencentNovelAd: React.FC<{ configName?: string, dayConfigName?: string }>
|
|
setQueryForm({ ...newQueryForm, ...params })
|
|
setQueryForm({ ...newQueryForm, ...params })
|
|
}}
|
|
}}
|
|
/>}
|
|
/>}
|
|
- isZj
|
|
|
|
|
|
+ isZj={isZj}
|
|
totalData={totalData}
|
|
totalData={totalData}
|
|
- config={columns12(dayHandle, () => { getGDTList.refresh() })}
|
|
|
|
|
|
+ config={columns12(dayHandle, () => { getList() })}
|
|
configName={configName || '腾讯小说广告列表'}
|
|
configName={configName || '腾讯小说广告列表'}
|
|
fixed={{ left: 4, right: 2 }}
|
|
fixed={{ left: 4, right: 2 }}
|
|
scroll={{ x: 1000, y: 620 }}
|
|
scroll={{ x: 1000, y: 620 }}
|
|
title='腾讯广告列表'
|
|
title='腾讯广告列表'
|
|
loading={getGDTList.loading}
|
|
loading={getGDTList.loading}
|
|
ajax={getGDTList}
|
|
ajax={getGDTList}
|
|
- page={getGDTList?.data?.data?.current || 1}
|
|
|
|
- pageSize={getGDTList?.data?.data?.size || 20}
|
|
|
|
|
|
+ page={queryForm?.pageNum || 1}
|
|
|
|
+ pageSize={queryForm?.pageSize || 20}
|
|
total={getGDTList?.data?.data?.total || 0}
|
|
total={getGDTList?.data?.data?.total || 0}
|
|
dataSource={getGDTList?.data?.data?.records?.map((item: any) => ({ ...item, id: item.adgroupId, deepConversionSpec: item?.deepConversionSpecJson ? JSON.parse(item.deepConversionSpecJson) : {} }))}
|
|
dataSource={getGDTList?.data?.data?.records?.map((item: any) => ({ ...item, id: item.adgroupId, deepConversionSpec: item?.deepConversionSpecJson ? JSON.parse(item.deepConversionSpecJson) : {} }))}
|
|
onChange={(pagination: any, _: any, sortData: any) => {
|
|
onChange={(pagination: any, _: any, sortData: any) => {
|
|
@@ -257,7 +257,7 @@ const TencentNovelAd: React.FC<{ configName?: string, dayConfigName?: string }>
|
|
rowSelection={{
|
|
rowSelection={{
|
|
selectedRowKeys: selectedRows.map(item => item.adgroupId + ''),
|
|
selectedRowKeys: selectedRows.map(item => item.adgroupId + ''),
|
|
getCheckboxProps: (record: any) => ({
|
|
getCheckboxProps: (record: any) => ({
|
|
- disabled: handleType === 3 ? record.status === 'STATUS_DELETED' || record?.accountId === '总计' || !(record?.deepConversionSpec?.deepConversionWorthSpec?.goal === 'GOAL_1DAY_PURCHASE_ROAS') : record.status === 'STATUS_DELETED' || record?.accountId === '总计'
|
|
|
|
|
|
+ disabled: handleType === 3 ? record.status === 'STATUS_DELETED' || record?.accountId === '总计' || !(record?.deepConversionSpec?.deepConversionWorthSpec?.goal === 'GOAL_1DAY_PURCHASE_ROAS') : record.status === 'STATUS_DELETED' || record?.accountId === '总计'
|
|
}),
|
|
}),
|
|
onSelect: (record: { adgroupId: number }, selected: boolean) => {
|
|
onSelect: (record: { adgroupId: number }, selected: boolean) => {
|
|
if (selected) {
|
|
if (selected) {
|