handleLog.tsx 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. import { useAjax } from "@/Hook/useAjax"
  2. import { dynamicCreativeLogApi } from "@/services/launchAdq/adqv3"
  3. import { Button, Col, Form, Input, Modal, Row, Space, Table } from "antd"
  4. import React, { useEffect, useState } from "react"
  5. import { columnsLog } from "./tableConfig"
  6. interface Props {
  7. userId: number
  8. visible?: boolean,
  9. onClose?: () => void,
  10. }
  11. /**
  12. * 创意操作记录
  13. * @param param0
  14. * @returns
  15. */
  16. const HandleLog: React.FC<Props> = ({ visible, onClose, userId }) => {
  17. /*********************************/
  18. const [form] = Form.useForm();
  19. const [queryParams, setQueryParams] = useState<ADQV3.DynamicCreativeLogProps>({ pageNum: 1, pageSize: 20 })
  20. const dynamicCreativeLog = useAjax((params) => dynamicCreativeLogApi(params))
  21. /*********************************/
  22. useEffect(() => {
  23. dynamicCreativeLog.run({ ...queryParams, userId })
  24. }, [queryParams])
  25. const onFinish = (values: any) => {
  26. console.log(values)
  27. setQueryParams({ ...queryParams, ...values })
  28. }
  29. return <Modal
  30. title={<strong>创意操作记录</strong>}
  31. className="modalResetCss"
  32. visible={visible}
  33. onCancel={onClose}
  34. footer={null}
  35. width={1100}
  36. >
  37. <Space style={{ width: '100%' }} direction="vertical">
  38. <Form
  39. layout="inline"
  40. form={form}
  41. name="handleLog"
  42. onFinish={onFinish}
  43. style={{ marginBottom: 6 }}
  44. >
  45. <Row gutter={[10, 10]}>
  46. <Col><Form.Item name='accountId' style={{ marginRight: 0 }}>
  47. <Input placeholder="广告账号" style={{ width: 120 }} allowClear />
  48. </Form.Item></Col>
  49. <Col><Form.Item name='adgroupId' style={{ marginRight: 0 }}>
  50. <Input placeholder="广告ID" style={{ width: 120 }} allowClear />
  51. </Form.Item></Col>
  52. <Col><Form.Item name='creativeName' style={{ marginRight: 0 }}>
  53. <Input placeholder="创意名称" style={{ width: 150 }} allowClear />
  54. </Form.Item></Col>
  55. <Col><Form.Item name='creativeId' style={{ marginRight: 0 }}>
  56. <Input placeholder="创意ID" style={{ width: 120 }} allowClear />
  57. </Form.Item></Col>
  58. <Col><Form.Item style={{ marginRight: 0 }}>
  59. <Space>
  60. <Button type="primary" htmlType="submit">搜索</Button>
  61. <Button onClick={() => {
  62. form.resetFields()
  63. }}>重置</Button>
  64. </Space>
  65. </Form.Item></Col>
  66. </Row>
  67. </Form>
  68. <Table
  69. columns={columnsLog()}
  70. dataSource={dynamicCreativeLog?.data?.records}
  71. size="small"
  72. loading={dynamicCreativeLog?.loading}
  73. scroll={{ y: 500 }}
  74. rowKey={'id'}
  75. pagination={{
  76. defaultPageSize: 100,
  77. current: dynamicCreativeLog.data?.current || 1,
  78. pageSize: dynamicCreativeLog.data?.size || 10,
  79. total: dynamicCreativeLog.data?.total || 0
  80. }}
  81. onChange={(pagination) => {
  82. const { current, pageSize } = pagination
  83. setQueryParams({ ...queryParams, pageNum: current || 1, pageSize: pageSize || 10 })
  84. }}
  85. />
  86. </Space>
  87. </Modal>
  88. }
  89. export default React.memo(HandleLog)