|
@@ -1,6 +1,6 @@
|
|
|
import { CloseOutlined, DownOutlined, FilterOutlined, SearchOutlined, UpOutlined } from "@ant-design/icons"
|
|
|
import { Button, DatePicker, Form, Input, InputNumber, Popover, Select, Space } from "antd"
|
|
|
-import React, { useEffect, useState } from "react"
|
|
|
+import React, { forwardRef, useEffect, useImperativeHandle, useState } from "react"
|
|
|
import '../../launchSystemNew/adq/ad/index.less'
|
|
|
import moment from "moment"
|
|
|
import { useLocalStorageState, useTimeout } from "ahooks"
|
|
@@ -9,6 +9,7 @@ import { AdListProps } from "@/services/adMonitor/adMonitor"
|
|
|
import { useModel } from "umi"
|
|
|
import { ADGROUP_STATUS } from "../adqv3/const"
|
|
|
import { AdUnitType_Enum } from "@/pages/launchSystemNew/account/const"
|
|
|
+import { MARKETING_GOAL_ENUM, MARKETING_TARGET_TYPE_ENUM } from "../tencentAdPutIn/const"
|
|
|
const { RangePicker } = DatePicker;
|
|
|
|
|
|
type TypeProps = 'DatePicker' | 'Input' | 'InputNumber' | 'Select'
|
|
@@ -30,7 +31,7 @@ interface Props {
|
|
|
* 请求体 AD 合集
|
|
|
* @returns
|
|
|
*/
|
|
|
-const FilterQuery: React.FC<Props> = ({ onChange, initialValues, queryForm, setQueryForm }) => {
|
|
|
+const FilterQuery = forwardRef(({ onChange, initialValues, queryForm, setQueryForm }: Props, ref) => {
|
|
|
|
|
|
/********************************/
|
|
|
const [form] = Form.useForm();
|
|
@@ -41,6 +42,21 @@ const FilterQuery: React.FC<Props> = ({ onChange, initialValues, queryForm, setQ
|
|
|
const { getPicherList } = useModel('useOperating.useWxGroupList')
|
|
|
/********************************/
|
|
|
|
|
|
+ useImperativeHandle(ref, () => ({
|
|
|
+ onOpen(data: any) {
|
|
|
+ setVisible(true)
|
|
|
+ let { adCreateTimeMin, adCreateTimeMax, putDateBegin, putDateEnd, ...params } = data
|
|
|
+ if (adCreateTimeMin && adCreateTimeMax) {
|
|
|
+ params.adCreateTime = [moment(adCreateTimeMin), moment(adCreateTimeMax)]
|
|
|
+ }
|
|
|
+ if (putDateBegin && putDateEnd) {
|
|
|
+ params.putDate = [moment(putDateBegin), moment(putDateEnd)]
|
|
|
+ }
|
|
|
+ console.log('params', params)
|
|
|
+ form.setFieldsValue(params)
|
|
|
+ },
|
|
|
+ }));
|
|
|
+
|
|
|
useTimeout(() => {
|
|
|
setVisible(false);
|
|
|
}, 1000);
|
|
@@ -50,6 +66,40 @@ const FilterQuery: React.FC<Props> = ({ onChange, initialValues, queryForm, setQ
|
|
|
}, [])
|
|
|
|
|
|
const queryList: QueryProps[] = [
|
|
|
+ {
|
|
|
+ lable: '营销目的',
|
|
|
+ name: 'marketingGoal',
|
|
|
+ type: 'Select',
|
|
|
+ value: (params) => <Select
|
|
|
+ placeholder='营销目的'
|
|
|
+ style={{ width: '100%', minWidth: 130 }}
|
|
|
+ showSearch
|
|
|
+ allowClear
|
|
|
+ filterOption={(input: any, option: any) =>
|
|
|
+ (option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
|
|
|
+ }
|
|
|
+ {...params}
|
|
|
+ >
|
|
|
+ {Object.keys(MARKETING_GOAL_ENUM).map(key => <Select.Option value={key} key={key}>{MARKETING_GOAL_ENUM[key as keyof typeof MARKETING_GOAL_ENUM]}</Select.Option>)}
|
|
|
+ </Select>
|
|
|
+ },
|
|
|
+ {
|
|
|
+ lable: '推广内容资产类型',
|
|
|
+ name: 'marketingTargetType',
|
|
|
+ type: 'Select',
|
|
|
+ value: (params) => <Select
|
|
|
+ placeholder='推广内容资产类型'
|
|
|
+ style={{ width: '100%', minWidth: 130 }}
|
|
|
+ showSearch
|
|
|
+ allowClear
|
|
|
+ filterOption={(input: any, option: any) =>
|
|
|
+ (option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
|
|
|
+ }
|
|
|
+ {...params}
|
|
|
+ >
|
|
|
+ {Object.keys(MARKETING_TARGET_TYPE_ENUM).map(key => <Select.Option value={key} key={key}>{MARKETING_TARGET_TYPE_ENUM[key as keyof typeof MARKETING_TARGET_TYPE_ENUM]}</Select.Option>)}
|
|
|
+ </Select>
|
|
|
+ },
|
|
|
{
|
|
|
lable: '广告创建时间',
|
|
|
name: 'adCreateTime',
|
|
@@ -204,6 +254,54 @@ const FilterQuery: React.FC<Props> = ({ onChange, initialValues, queryForm, setQ
|
|
|
type: 'InputNumber',
|
|
|
value: (params) => <InputNumber placeholder="请输入最低总千次曝光成本" style={{ width: '100%' }} {...params} />
|
|
|
},
|
|
|
+ {
|
|
|
+ lable: '激活首日广告变现ROI区间最小值',
|
|
|
+ name: 'incomeRoi1Min',
|
|
|
+ type: 'InputNumber',
|
|
|
+ value: (params) => <InputNumber placeholder="激活首日广告变现ROI区间最小值" style={{ width: '100%' }} {...params} />
|
|
|
+ },
|
|
|
+ {
|
|
|
+ lable: '激活首日广告变现ROI区间最大值',
|
|
|
+ name: 'incomeRoi1Max',
|
|
|
+ type: 'InputNumber',
|
|
|
+ value: (params) => <InputNumber placeholder="激活首日广告变现ROI区间最大值" style={{ width: '100%' }} {...params} />
|
|
|
+ },
|
|
|
+ {
|
|
|
+ lable: '注册成本区间最小值',
|
|
|
+ name: 'regCostMin',
|
|
|
+ type: 'InputNumber',
|
|
|
+ value: (params) => <InputNumber placeholder="注册成本区间最小值" style={{ width: '100%' }} {...params} />
|
|
|
+ },
|
|
|
+ {
|
|
|
+ lable: '注册成本区间最大值',
|
|
|
+ name: 'regCostMax',
|
|
|
+ type: 'InputNumber',
|
|
|
+ value: (params) => <InputNumber placeholder="注册成本区间最大值" style={{ width: '100%' }} {...params} />
|
|
|
+ },
|
|
|
+ {
|
|
|
+ lable: '注册成本(平台上报+广告主上报)区间最小值',
|
|
|
+ name: 'regCostPlaMin',
|
|
|
+ type: 'InputNumber',
|
|
|
+ value: (params) => <InputNumber placeholder="注册成本(平台上报+广告主上报)区间最小值" style={{ width: '100%' }} {...params} />
|
|
|
+ },
|
|
|
+ {
|
|
|
+ lable: '注册成本(平台上报+广告主上报)区间最大值',
|
|
|
+ name: 'regCostPlaMax',
|
|
|
+ type: 'InputNumber',
|
|
|
+ value: (params) => <InputNumber placeholder="注册成本(平台上报+广告主上报)区间最大值" style={{ width: '100%' }} {...params} />
|
|
|
+ },
|
|
|
+ {
|
|
|
+ lable: '点击均价最小值',
|
|
|
+ name: 'cpcMin',
|
|
|
+ type: 'InputNumber',
|
|
|
+ value: (params) => <InputNumber placeholder="点击均价最小值" style={{ width: '100%' }} {...params} />
|
|
|
+ },
|
|
|
+ {
|
|
|
+ lable: '点击均价最大值',
|
|
|
+ name: 'cpcMax',
|
|
|
+ type: 'InputNumber',
|
|
|
+ value: (params) => <InputNumber placeholder="点击均价最大值" style={{ width: '100%' }} {...params} />
|
|
|
+ },
|
|
|
]
|
|
|
|
|
|
useEffect(() => {
|
|
@@ -362,7 +460,12 @@ const FilterQuery: React.FC<Props> = ({ onChange, initialValues, queryForm, setQ
|
|
|
open={visible}
|
|
|
trigger={'click'}
|
|
|
placement="bottomLeft"
|
|
|
- onOpenChange={(e) => setVisible(e)}
|
|
|
+ onOpenChange={(e) => {
|
|
|
+ setVisible(e)
|
|
|
+ if (e && initialValues) {
|
|
|
+ form.setFieldsValue(initialValues)
|
|
|
+ }
|
|
|
+ }}
|
|
|
getPopupContainer={() => document.getElementById('filterQueryContentAd') as any}
|
|
|
content={<div style={{ width: 500, height: 400, overflowY: 'auto', padding: '10px 16px' }}>
|
|
|
<Form
|
|
@@ -370,7 +473,6 @@ const FilterQuery: React.FC<Props> = ({ onChange, initialValues, queryForm, setQ
|
|
|
form={form}
|
|
|
colon={false}
|
|
|
layout="vertical"
|
|
|
- initialValues={initialValues}
|
|
|
onValuesChange={(changedValues) => {
|
|
|
console.log(changedValues)
|
|
|
let messageArr = message ? message?.split(',') : []
|
|
@@ -421,6 +523,12 @@ const FilterQuery: React.FC<Props> = ({ onChange, initialValues, queryForm, setQ
|
|
|
case 'optimizationGoal':
|
|
|
value = OptimizationGoalEnum[value as keyof typeof OptimizationGoalEnum] || '请选择'
|
|
|
break
|
|
|
+ case 'marketingGoal':
|
|
|
+ value = MARKETING_GOAL_ENUM[value as keyof typeof MARKETING_GOAL_ENUM] || '请选择'
|
|
|
+ break
|
|
|
+ case 'marketingTargetType':
|
|
|
+ value = MARKETING_TARGET_TYPE_ENUM[value as keyof typeof MARKETING_TARGET_TYPE_ENUM] || '请选择'
|
|
|
+ break
|
|
|
case 'promotedObjectType':
|
|
|
value = PromotedObjectType[value as keyof typeof PromotedObjectType] || '请选择'
|
|
|
break
|
|
@@ -467,7 +575,7 @@ const FilterQuery: React.FC<Props> = ({ onChange, initialValues, queryForm, setQ
|
|
|
})}
|
|
|
</div>
|
|
|
</div>
|
|
|
-}
|
|
|
+})
|
|
|
|
|
|
export default React.memo(FilterQuery)
|
|
|
|