queryFormNovel.tsx 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  1. import { useAjax } from "@/Hook/useAjax"
  2. import { AD_STATUS_ENUM, BID_MODE_ENUM, MARKETING_GOAL_ENUM, MARKETING_TARGET_TYPE_ENUM, OPTIMIZATIONGOAL_ENUM, PromotedObjectType } from "@/pages/iaaData/const"
  3. import { getPutUserListApi } from "@/services/iaaData"
  4. import { Button, Col, Form, Row, Space, DatePicker, Select, Input, InputNumber } from "antd"
  5. import { RangePickerProps } from "antd/lib/date-picker"
  6. import React, { useEffect, useState } from "react"
  7. import { useModel } from "umi"
  8. interface Props {
  9. onChange?: (data: any) => void
  10. /** 默认值 */
  11. initialValues?: any
  12. /** 是否开启 广告账号 搜索 */
  13. isAccountId?: boolean
  14. /** 是否开启 当前出价 搜索 */
  15. isCpaBid?: boolean
  16. /** 是否开启 广告名称 搜索 */
  17. isAdgroupName?: boolean
  18. /** 是否开启 广告ID 搜索 */
  19. isAdgroupId?: boolean
  20. /** 是否开启 创意名称 搜索 */
  21. isDynamicCreativeName?: boolean
  22. /** 是否开启 创意ID 搜索 */
  23. isDynamicCreativeId?: boolean
  24. /** 是否开启 腾讯备注 搜索 */
  25. isMemo?: boolean
  26. /** 是否开启 本地备注 搜索 */
  27. isRemark?: boolean
  28. /** 是否开启 投手 搜索 */
  29. isPutUserId?: boolean
  30. /** 是否开启 投手 搜索 */
  31. isPutUserIdList?: boolean
  32. /** 是否开启 出价方式 搜索 */
  33. isPricing?: boolean,
  34. /** 是否开启 广告状态 搜索 */
  35. isStatus?: boolean,
  36. /** 是否开启 删除状态 搜索 */
  37. isDeleted?: boolean,
  38. /** 是否开启 是否深度优化 搜索 */
  39. isDeepConversionSpec?: boolean,
  40. /** 是否开启 启用禁用状态 搜索 */
  41. isConfiguredStatus?: boolean,
  42. /** 是否开启 营销目的 搜索 */
  43. isMarketingGoal?: boolean,
  44. /** 是否开启 营销目的 搜索 */
  45. isMarketingTargetType?: boolean,
  46. /** 是否开启 推广目标类型 搜索 */
  47. isPromotedObjectType?: boolean,
  48. /** 是否开启 推广目标名称 搜索 */
  49. isPromotedObjectName?: boolean,
  50. /** 是否开启 优化目标类型 搜索 */
  51. isOptimizationGoal?: boolean,
  52. /** 是否开启 投放模式 搜索 */
  53. isDeliveryMode?: boolean,
  54. /** 是否开启 日期 搜索 */
  55. day1?: RangePickerProps
  56. /** 是否开启 日期 搜索 */
  57. day2?: RangePickerProps
  58. /** 是否开启 日期 搜索 */
  59. day3?: RangePickerProps
  60. /** 是否开启 最小总消耗 搜索 */
  61. isCostTotalMin?: boolean
  62. /** 是否开启 最低总千次曝光成本 搜索 */
  63. isThousandDisplayPriceTotalMin?: boolean
  64. /** 是否开启 最低转化数 搜索 */
  65. isConversionsCountTotalMin?: boolean
  66. /** 是否开启 激活首日广告变现ROI 搜索 */
  67. isIncomeRoi1?: boolean
  68. /** 是否开启 注册成本 搜索 */
  69. isRegCost?: boolean
  70. /** 是否开启 注册成本(平台上报+广告主上报 搜索 */
  71. isRegCostPla?: boolean
  72. /** 是否开启 点击均价 搜索 */
  73. isCpc?: boolean
  74. }
  75. /**
  76. * 游戏数据系统 请求参数
  77. * @returns
  78. */
  79. const QueryFormNovel: React.FC<Props> = (props) => {
  80. /**************************/
  81. const { initialState } = useModel('@@initialState');
  82. const {
  83. onChange, initialValues, isAccountId, isAdgroupName, isAdgroupId, isDynamicCreativeName, isDynamicCreativeId, isMemo, isRemark, isCpaBid, isPutUserId, isPutUserIdList, isPricing, isStatus, isMarketingGoal, isMarketingTargetType, isPromotedObjectType, isPromotedObjectName, isOptimizationGoal, isDeliveryMode, isDeleted, isDeepConversionSpec, isConfiguredStatus, day1, day2, day3,
  84. isCostTotalMin, isThousandDisplayPriceTotalMin, isConversionsCountTotalMin, isIncomeRoi1, isRegCost, isRegCostPla, isCpc
  85. } = props
  86. const [form] = Form.useForm()
  87. const [putUserList, setPutUserList] = useState<{ label: string, value: string }[]>([])
  88. const getPutUserList = useAjax((params) => getPutUserListApi(params))
  89. /**************************/
  90. useEffect(() => {
  91. if ((isPutUserId || isPutUserIdList) && initialState?.productType) {
  92. getPutUserList.run({ productType: initialState?.productType }).then(res => {
  93. if (res?.data) {
  94. setPutUserList(Object.keys(res.data).map(key => ({ value: key, label: res.data[key] })))
  95. }
  96. })
  97. }
  98. }, [isPutUserId, isPutUserIdList, initialState?.productType])
  99. const onFinish = (data: any) => {
  100. console.log('更新了字段---->', data);
  101. onChange && onChange(data)
  102. }
  103. return <Form layout="inline" className='queryForm' initialValues={initialValues} name="basic" form={form} onFinish={onFinish}>
  104. <Row gutter={[0, 6]}>
  105. {/* 广告账号 */}
  106. {isAccountId && <Col><Form.Item name='accountId'>
  107. <Input placeholder="广告账号" style={{ width: 150 }} />
  108. </Form.Item></Col>}
  109. {/* 广告名称 */}
  110. {isAdgroupName && <Col><Form.Item name='adgroupName'>
  111. <Input placeholder="广告名称" style={{ width: 150 }} />
  112. </Form.Item></Col>}
  113. {/* 广告ID */}
  114. {isAdgroupId && <Col><Form.Item name='adgroupId'>
  115. <Input placeholder="广告ID" style={{ width: 150 }} />
  116. </Form.Item></Col>}
  117. {/* 创意名称 */}
  118. {isDynamicCreativeName && <Col><Form.Item name='dynamicCreativeName'>
  119. <Input placeholder="创意名称" style={{ width: 150 }} />
  120. </Form.Item></Col>}
  121. {/* 创意ID */}
  122. {isDynamicCreativeId && <Col><Form.Item name='dynamicCreativeId'>
  123. <Input placeholder="创意ID" style={{ width: 150 }} />
  124. </Form.Item></Col>}
  125. {/* 腾讯备注 */}
  126. {isMemo && <Col><Form.Item name='memo'>
  127. <Input placeholder="腾讯备注" style={{ width: 150 }} />
  128. </Form.Item></Col>}
  129. {/* 腾讯备注 */}
  130. {isRemark && <Col><Form.Item name='remark'>
  131. <Input placeholder="本地备注" style={{ width: 150 }} />
  132. </Form.Item></Col>}
  133. {/* 出价 */}
  134. {isCpaBid && <Col><Form.Item name='cpaBid'>
  135. <InputNumber placeholder="出价" style={{ width: 120 }} />
  136. </Form.Item></Col>}
  137. {/* 投手 */}
  138. {isPutUserId && <Col><Form.Item name='putUserId'>
  139. <Select
  140. showSearch
  141. allowClear
  142. style={{ minWidth: 120 }}
  143. placeholder={'投手'}
  144. filterOption={(input, option) =>
  145. (option?.label as any)?.toLowerCase().indexOf(input.toLowerCase()) >= 0
  146. }
  147. maxTagCount={1}
  148. loading={getPutUserList.loading}
  149. options={putUserList}
  150. />
  151. </Form.Item></Col>}
  152. {/* 投手多选 */}
  153. {isPutUserIdList && <Col><Form.Item name='putUserIdList'>
  154. <Select
  155. showSearch
  156. allowClear
  157. mode="multiple"
  158. style={{ minWidth: 120 }}
  159. placeholder={'投手'}
  160. filterOption={(input, option) =>
  161. (option?.label as any)?.toLowerCase().indexOf(input.toLowerCase()) >= 0
  162. }
  163. maxTagCount={1}
  164. loading={getPutUserList.loading}
  165. options={putUserList}
  166. />
  167. </Form.Item></Col>}
  168. {/* 出价方式 */}
  169. {isPricing && <Col><Form.Item name='pricing'>
  170. <Select
  171. showSearch
  172. allowClear
  173. style={{ width: 120 }}
  174. placeholder={'出价方式'}
  175. filterOption={(input, option) =>
  176. (option?.label as any)?.toLowerCase().indexOf(input.toLowerCase()) >= 0
  177. }
  178. options={Object.keys(BID_MODE_ENUM).map(key => ({ label: BID_MODE_ENUM[key as keyof typeof BID_MODE_ENUM], value: key }))}
  179. />
  180. </Form.Item></Col>}
  181. {/* 广告状态 */}
  182. {isStatus && <Col><Form.Item name='status'>
  183. <Select
  184. showSearch
  185. allowClear
  186. mode="multiple"
  187. style={{ width: 120 }}
  188. placeholder={'广告状态'}
  189. filterOption={(input, option) =>
  190. (option?.label as any)?.toLowerCase().indexOf(input.toLowerCase()) >= 0
  191. }
  192. options={Object.keys(AD_STATUS_ENUM).map(key => ({ label: AD_STATUS_ENUM[key as keyof typeof AD_STATUS_ENUM], value: key }))}
  193. />
  194. </Form.Item></Col>}
  195. {/* 营销目的 */}
  196. {isMarketingGoal && <Col><Form.Item name='marketingGoal'>
  197. <Select
  198. showSearch
  199. allowClear
  200. style={{ width: 120 }}
  201. placeholder={'营销目的'}
  202. filterOption={(input, option) =>
  203. (option?.label as any)?.toLowerCase().indexOf(input.toLowerCase()) >= 0
  204. }
  205. options={Object.keys(MARKETING_GOAL_ENUM).map(key => ({ label: MARKETING_GOAL_ENUM[key as keyof typeof MARKETING_GOAL_ENUM], value: key }))}
  206. />
  207. </Form.Item></Col>}
  208. {/* 推广内容资产类型 */}
  209. {isMarketingTargetType && <Col><Form.Item name='marketingTargetType'>
  210. <Select
  211. showSearch
  212. allowClear
  213. style={{ width: 120 }}
  214. placeholder={'推广内容资产类型'}
  215. filterOption={(input, option) =>
  216. (option?.label as any)?.toLowerCase().indexOf(input.toLowerCase()) >= 0
  217. }
  218. options={Object.keys(MARKETING_TARGET_TYPE_ENUM).map(key => ({ label: MARKETING_TARGET_TYPE_ENUM[key as keyof typeof MARKETING_TARGET_TYPE_ENUM], value: key }))}
  219. />
  220. </Form.Item></Col>}
  221. {/* 推广目标 */}
  222. {isPromotedObjectType && <Col><Form.Item name='promotedObjectType'>
  223. <Select
  224. showSearch
  225. allowClear
  226. style={{ width: 120 }}
  227. placeholder={'推广目标'}
  228. filterOption={(input, option) =>
  229. (option?.label as any)?.toLowerCase().indexOf(input.toLowerCase()) >= 0
  230. }
  231. options={Object.keys(PromotedObjectType).map(key => ({ label: PromotedObjectType[key as keyof typeof PromotedObjectType], value: key }))}
  232. />
  233. </Form.Item></Col>}
  234. {/* 推广目标名称 */}
  235. {isPromotedObjectName && <Col><Form.Item name='promotedObjectName'>
  236. <Input placeholder="推广目标名称" style={{ width: 150 }} />
  237. </Form.Item></Col>}
  238. {/* 优化目标 */}
  239. {isOptimizationGoal && <Col><Form.Item name='optimizationGoal'>
  240. <Select
  241. showSearch
  242. allowClear
  243. style={{ width: 120 }}
  244. placeholder={'优化目标'}
  245. filterOption={(input, option) =>
  246. (option?.label as any)?.toLowerCase().indexOf(input.toLowerCase()) >= 0
  247. }
  248. options={Object.keys(OPTIMIZATIONGOAL_ENUM).map(key => ({ label: OPTIMIZATIONGOAL_ENUM[key as keyof typeof OPTIMIZATIONGOAL_ENUM], value: key }))}
  249. />
  250. </Form.Item></Col>}
  251. {/* 投放模式 */}
  252. {isDeliveryMode && <Col><Form.Item name='deliveryMode'>
  253. <Select
  254. placeholder='投放模式'
  255. style={{ width: 120, minWidth: 120 }}
  256. showSearch
  257. allowClear
  258. filterOption={(input: any, option: any) =>
  259. (option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
  260. }
  261. mode="multiple"
  262. >
  263. <Select.Option value={'DELIVERY_MODE_CUSTOMIZE'}>自定义创意</Select.Option>
  264. <Select.Option value={'DELIVERY_MODE_COMPONENT'}>组件化创意</Select.Option>
  265. </Select>
  266. </Form.Item></Col>}
  267. {/* 是否删除 */}
  268. {isDeleted && <Col><Form.Item name='deleted'>
  269. <Select
  270. showSearch
  271. allowClear
  272. style={{ width: 120 }}
  273. placeholder={'是否删除?'}
  274. filterOption={(input, option) =>
  275. (option?.children as any)?.toLowerCase().indexOf(input.toLowerCase()) >= 0
  276. }
  277. >
  278. <Select.Option value={true}>是</Select.Option>
  279. <Select.Option value={false}>否</Select.Option>
  280. </Select>
  281. </Form.Item></Col>}
  282. {/* 是否删除 */}
  283. {isDeepConversionSpec && <Col><Form.Item name='isDeepConversionSpec'>
  284. <Select
  285. showSearch
  286. allowClear
  287. style={{ width: 120 }}
  288. placeholder={'是否深度优化'}
  289. filterOption={(input, option) =>
  290. (option?.children as any)?.toLowerCase().indexOf(input.toLowerCase()) >= 0
  291. }
  292. >
  293. <Select.Option value={true}>是</Select.Option>
  294. <Select.Option value={false}>否</Select.Option>
  295. </Select>
  296. </Form.Item></Col>}
  297. {/* 启用禁用状态 */}
  298. {isConfiguredStatus && <Col><Form.Item name='configuredStatus'>
  299. <Select
  300. placeholder='启用禁用状态'
  301. style={{ minWidth: 120 }}
  302. showSearch
  303. allowClear
  304. filterOption={(input: any, option: any) =>
  305. (option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
  306. }
  307. mode="multiple"
  308. >
  309. <Select.Option value={'AD_STATUS_NORMAL'}>有效</Select.Option>
  310. <Select.Option value={'AD_STATUS_SUSPEND'}>暂停</Select.Option>
  311. </Select>
  312. </Form.Item></Col>}
  313. {/* 日期选择框 */}
  314. {day1 && <Col><Form.Item name='day1'>
  315. {/* @ts-ignore */}
  316. <DatePicker.RangePicker style={{ width: 250 }} {...day1} />
  317. </Form.Item></Col>}
  318. {/* 日期选择框 */}
  319. {day2 && <Col><Form.Item name='day2'>
  320. {/* @ts-ignore */}
  321. <DatePicker.RangePicker style={{ width: 250 }} {...day2} />
  322. </Form.Item></Col>}
  323. {/* 日期选择框 */}
  324. {day3 && <Col><Form.Item name='day3'>
  325. {/* @ts-ignore */}
  326. <DatePicker.RangePicker style={{ width: 250 }} {...day3} />
  327. </Form.Item></Col>}
  328. {/* 最小总消耗 */}
  329. {isCostTotalMin && <Col><Form.Item name='costTotalMin'>
  330. <InputNumber placeholder="最小总消耗" style={{ width: 100 }} />
  331. </Form.Item></Col>}
  332. {/* 最低转化数 */}
  333. {isConversionsCountTotalMin && <Col><Form.Item name='conversionsCountTotalMin'>
  334. <InputNumber placeholder="最低转化数" style={{ width: 100 }} />
  335. </Form.Item></Col>}
  336. {/* 最低总千次曝光成本 */}
  337. {isThousandDisplayPriceTotalMin && <Col><Form.Item name='thousandDisplayPriceTotalMin'>
  338. <InputNumber placeholder="最低总千次曝光成本" style={{ width: 150 }} />
  339. </Form.Item></Col>}
  340. {/* 激活首日广告变现ROI */}
  341. {isIncomeRoi1 && <>
  342. <Col><Form.Item name='incomeRoi1Min'>
  343. <InputNumber placeholder="激活首日广告变现ROI最小值" style={{ width: 200 }} />
  344. </Form.Item></Col>
  345. <Col><Form.Item name='incomeRoi1Max'>
  346. <InputNumber placeholder="激活首日广告变现ROI最大值" style={{ width: 200 }} />
  347. </Form.Item></Col>
  348. </>}
  349. {/* 注册成本(平台上报+广告主上报 */}
  350. {isRegCost && <>
  351. <Col><Form.Item name='regCostMin'>
  352. <InputNumber placeholder="注册成本最小值" style={{ width: 120 }} />
  353. </Form.Item></Col>
  354. <Col><Form.Item name='regCostMax'>
  355. <InputNumber placeholder="注册成本最大值" style={{ width: 120 }} />
  356. </Form.Item></Col>
  357. </>}
  358. {/* 注册成本(平台上报+广告主上报 */}
  359. {isRegCostPla && <>
  360. <Col><Form.Item name='regCostPlaMin'>
  361. <InputNumber placeholder="注册成本最小值(平台上报...)" style={{ width: 180 }} />
  362. </Form.Item></Col>
  363. <Col><Form.Item name='regCostPlaMax'>
  364. <InputNumber placeholder="注册成本最大值(平台上报...)" style={{ width: 180 }} />
  365. </Form.Item></Col>
  366. </>}
  367. {/* 注册成本(平台上报+广告主上报 */}
  368. {isCpc && <>
  369. <Col><Form.Item name='cpcMin'>
  370. <InputNumber placeholder="点击均价最小值" style={{ width: 120 }} />
  371. </Form.Item></Col>
  372. <Col><Form.Item name='cpcMax'>
  373. <InputNumber placeholder="点击均价最大值" style={{ width: 120 }} />
  374. </Form.Item></Col>
  375. </>}
  376. <Col>
  377. <Space>
  378. <Button type="primary" htmlType="submit">搜索</Button>
  379. <Button onClick={() => form.resetFields()}>重置</Button>
  380. </Space>
  381. </Col>
  382. </Row>
  383. </Form>
  384. }
  385. export default React.memo(QueryFormNovel)