123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- import { Button, Card, Col, Form, Input, InputNumber, Row, Select, Space } from "antd"
- import React, { useEffect } from "react"
- import { getUserAllApi } from "@/services/operating/account";
- import { useAjax } from "@/Hook/useAjax";
- import { SearchOutlined } from "@ant-design/icons";
- import moment from "moment";
- import '../../tencentAdPutIn/index.less'
- interface Props {
- onSearch?: (value: Partial<CLOUDNEW.GetMaterialListProps>) => void
- }
- /**
- * 远程素材库
- * @param param0
- * @returns
- */
- const Search: React.FC<Props> = ({ onSearch }) => {
- /**********************************/
- const [form] = Form.useForm();
- const getUserAll = useAjax(() => getUserAllApi())
- /**********************************/
- useEffect(() => {
- getUserAll.run()
- }, [])
- const handleOk = (values: any) => {
- console.log(values)
- let params: any = []
- Object.keys(values).forEach(key => {
- let value = values[key]
- if (['accountIds', 'adgroupIds', 'dynamicCreativeIds', 'tencentMaterialId'].includes(key) && value) {
- let value1 = value.replace(/[,,\s]/g, ',')
- params[key] = value1.split(',').filter((a: any) => a)
- } else if ('uploadTime' === key && value?.length === 2) {
- params.uploadTimeMin = moment(value?.[0]).format('YYYY-MM-DD')
- params.uploadTimeMax = moment(value?.[1]).format('YYYY-MM-DD')
- } else if ('sizeQueries' === key) {
- params[key] = [value]
- } else {
- params[key] = value
- }
- })
- onSearch?.(params)
- }
- return <Card
- bodyStyle={{ padding: '5px 10px', overflow: 'auto hidden', display: 'flex', gap: 6, flexWrap: 'wrap' }}
- className="cardResetCss buttonResetCss"
- bordered
- >
- <Form
- layout="inline"
- name="basicSelectSearch"
- colon={false}
- form={form}
- onFinish={handleOk}
- initialValues={{
- sizeQueries: {
- relation: '='
- }
- }}
- >
- <Row gutter={[0, 6]}>
- <Col><Form.Item name="materialType">
- <Select
- placeholder="素材类型"
- filterOption={(input, option) =>
- ((option?.label ?? '') as any).toLowerCase().includes(input.toLowerCase())
- }
- allowClear
- style={{ width: 120 }}
- options={[
- { label: '图片', value: 'image' },
- { label: '视频', value: 'video' }
- ]}
- />
- </Form.Item></Col>
- <Col><Form.Item name={['sizeQueries', 'width']}>
- <InputNumber placeholder="素材宽" />
- </Form.Item></Col>
- <Col><Form.Item name={['sizeQueries', 'height']}>
- <InputNumber placeholder="素材高" />
- </Form.Item></Col>
- <Col>
- <Form.Item name={['sizeQueries', 'relation']}>
- <Select
- placeholder="运算符"
- filterOption={(input, option) =>
- ((option?.label ?? '') as any).toLowerCase().includes(input.toLowerCase())
- }
- style={{ width: 100 }}
- options={[
- { label: '小于', value: '<' },
- { label: '小于等于', value: '<=' },
- { label: '等于', value: '=' },
- { label: '大于', value: '>' },
- { label: '大于等于', value: '>=' },
- ]}
- />
- </Form.Item>
- </Col>
- {/* <Col><Form.Item name={'sysUserIds'}>
- <Select
- placeholder="投手"
- filterOption={(input, option) =>
- ((option?.label ?? '') as any).toLowerCase().includes(input.toLowerCase())
- }
- style={{ width: 190 }}
- maxTagCount={1}
- mode="multiple"
- allowClear
- options={getUserAll?.data?.map((item: { nickname: any; userId: any }) => ({ label: item.nickname, value: item.userId }))}
- />
- </Form.Item></Col> */}
- <Col><Form.Item>
- <Space>
- <Button onClick={() => form.resetFields()}>重置</Button>
- <Button type="primary" htmlType="submit" icon={<SearchOutlined />} className="modalResetCss">搜索</Button>
- </Space>
- </Form.Item></Col>
- </Row>
- </Form>
- </Card>
- }
- export default React.memo(Search)
|