|
@@ -1,9 +1,12 @@
|
|
|
import { useAjax } from "@/Hook/useAjax"
|
|
|
import { PromotionDataDay, getPromotionDataTencentDayListApi } from "@/services/gameData/adlist"
|
|
|
-import { Drawer } from "antd"
|
|
|
+import { Button, Drawer, Space } from "antd"
|
|
|
import React, { useEffect, useState } from "react"
|
|
|
import TableData from "../../components/TableData"
|
|
|
import columns12 from './tableConfigDay'
|
|
|
+import { getPresets } from "@/components/QueryForm/const"
|
|
|
+import QueryForm from "@/components/QueryForm"
|
|
|
+import { CloseOutlined } from "@ant-design/icons"
|
|
|
|
|
|
interface Props {
|
|
|
queryForm: PromotionDataDay
|
|
@@ -21,6 +24,7 @@ const DayAd: React.FC<Props> = ({ adName, queryForm, promotionId, onClose, visib
|
|
|
|
|
|
/***********************************/
|
|
|
const [data, setData] = useState<{ pageSize: number, pageNum: number, sortFiled?: string, sortType?: string }>({ pageNum: 1, pageSize: 100 })
|
|
|
+ const [date, setDate] = useState<[string, string]>()
|
|
|
const getPromotionDataTencentDayList = useAjax((params) => getPromotionDataTencentDayListApi(params))
|
|
|
/***********************************/
|
|
|
|
|
@@ -33,15 +37,33 @@ const DayAd: React.FC<Props> = ({ adName, queryForm, promotionId, onClose, visib
|
|
|
if (promotionId) {
|
|
|
params.promotionId = promotionId
|
|
|
}
|
|
|
- getPromotionDataTencentDayList.run({...params, ...data})
|
|
|
- }, [promotionId, queryForm, data])
|
|
|
+ if (date && date?.length > 0) {
|
|
|
+ params.costBeginDate = date[0]
|
|
|
+ params.costEndDate = date[1]
|
|
|
+ } else {
|
|
|
+ delete params?.costBeginDate
|
|
|
+ delete params?.costEndDate
|
|
|
+ }
|
|
|
+ getPromotionDataTencentDayList.run({ ...params, ...data })
|
|
|
+ }, [promotionId, queryForm, data, date])
|
|
|
|
|
|
- return <Drawer title={`${adName} 腾讯广告每日数据`} placement="right" width={'90%'} onClose={onClose} visible={visible}>
|
|
|
+ return <Drawer title={<div style={{ display: 'flex', justifyContent: 'space-between' }}><span>{`${adName} 腾讯广告每日数据`}</span> <Button type="text" icon={<CloseOutlined />} onClick={() => onClose?.()}></Button> </div>} closable={false} placement="right" width={'90%'} onClose={onClose} visible={visible}>
|
|
|
<TableData
|
|
|
+ leftChild={<QueryForm
|
|
|
+ onChange={(data: any) => {
|
|
|
+ const { costBeginDay, costEndDay } = data
|
|
|
+ if (costBeginDay && costEndDay) {
|
|
|
+ setDate([costBeginDay, costEndDay])
|
|
|
+ } else {
|
|
|
+ setDate(undefined)
|
|
|
+ }
|
|
|
+ }}
|
|
|
+ isConsumeDay={{ ranges: getPresets() }}
|
|
|
+ />}
|
|
|
scroll={{ x: 1000, y: 600 }}
|
|
|
ajax={getPromotionDataTencentDayList}
|
|
|
fixed={{ left: 3, right: 0 }}
|
|
|
- dataSource={getPromotionDataTencentDayList?.data?.records?.map((item: any, index: number) => ({ ...item, id: Number(data.pageNum.toString() + index.toString()) }))}
|
|
|
+ dataSource={getPromotionDataTencentDayList?.data?.records?.map((item: any, index: number) => ({ ...item, id: Number(data.pageNum.toString() + index.toString()) }))}
|
|
|
total={getPromotionDataTencentDayList?.data?.total}
|
|
|
page={queryForm.pageNum}
|
|
|
pageSize={queryForm.pageSize}
|