index.tsx 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. import { useAjax } from "@/Hook/useAjax"
  2. import { getDynamicCreativeV3ListApi } from "@/services/launchAdq/adqv3"
  3. import { Button, Col, Form, Input, Row, Select, Space } from "antd"
  4. import React, { useEffect } from "react"
  5. import { txDynamicConfig } from "../config"
  6. import tableConfig from "./tableConfig"
  7. import TableData from "@/pages/launchSystemNew/components/TableData"
  8. const Creative: React.FC<ADQV3.CreativeProps> = ({ queryForm, setQueryForm, userId }) => {
  9. /*********************************/
  10. const [form] = Form.useForm();
  11. const getDynamicCreativeV3List = useAjax((params) => getDynamicCreativeV3ListApi(params), { formatResult: true })
  12. /*********************************/
  13. useEffect(() => {
  14. form.setFieldsValue({ adgroupId: queryForm.adgroupId })
  15. }, [queryForm.adgroupId])
  16. useEffect(() => {
  17. getDynamicCreativeV3List.run({ ...queryForm, userId })
  18. }, [userId, queryForm])
  19. const onFinish = (values: any) => {
  20. console.log(values)
  21. setQueryForm({ ...queryForm, ...values })
  22. }
  23. return <div>
  24. <Form
  25. layout="inline"
  26. form={form}
  27. name="basignCreative"
  28. initialValues={queryForm}
  29. onFinish={onFinish}
  30. >
  31. <Row gutter={[10, 10]}>
  32. <Col><Form.Item name='accountId' style={{ marginRight: 0 }}>
  33. <Input placeholder="广告账号" allowClear />
  34. </Form.Item></Col>
  35. <Col><Form.Item name='adgroupId' style={{ marginRight: 0 }}>
  36. <Input placeholder="广告ID" allowClear />
  37. </Form.Item></Col>
  38. <Col><Form.Item name='creativeName' style={{ marginRight: 0 }}>
  39. <Input placeholder="创意名称" allowClear />
  40. </Form.Item></Col>
  41. <Col><Form.Item name='creativeId' style={{ marginRight: 0 }}>
  42. <Input placeholder="创意ID" allowClear />
  43. </Form.Item></Col>
  44. <Col><Form.Item name='isDeleted'>
  45. <Select
  46. placeholder='是否删除?'
  47. style={{ width: 100 }}
  48. showSearch
  49. filterOption={(input: any, option: any) =>
  50. (option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
  51. }
  52. >
  53. <Select.Option value={true}>是</Select.Option>
  54. <Select.Option value={false}>否</Select.Option>
  55. </Select>
  56. </Form.Item></Col>
  57. <Col><Form.Item style={{ marginRight: 0 }}>
  58. <Button type="primary" htmlType="submit">搜索</Button>
  59. <Button onClick={() => form.resetFields()}>重置</Button>
  60. </Form.Item></Col>
  61. </Row>
  62. </Form>
  63. <TableData
  64. isCard={false}
  65. columns={() => tableConfig()}
  66. ajax={getDynamicCreativeV3List}
  67. fixed={{ left: 2, right: 4 }}
  68. dataSource={getDynamicCreativeV3List?.data?.data?.records}
  69. loading={getDynamicCreativeV3List?.loading}
  70. scroll={{ y: 560 }}
  71. total={getDynamicCreativeV3List?.data?.data?.total}
  72. page={getDynamicCreativeV3List?.data?.data?.current}
  73. pageSize={getDynamicCreativeV3List?.data?.data?.size}
  74. myKey={'dynamicCreativeId'}
  75. gutter={[0, 10]}
  76. config={txDynamicConfig}
  77. configName="创意3.0"
  78. leftChild={<Space direction='vertical'>
  79. <Row gutter={[10, 10]} align='middle'>
  80. </Row>
  81. </Space>}
  82. onChange={(props: any) => {
  83. let { pagination } = props
  84. let { current, pageSize } = pagination
  85. setQueryForm({ ...queryForm, pageNum: current, pageSize })
  86. }}
  87. />
  88. </div>
  89. }
  90. export default React.memo(Creative)