import { Button, Card, Col, DatePicker, 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 { SOURCE_TYPE_IMAGE_ENUM, SOURCE_TYPE_VIDEO_ENUM } from "../../tencentAdPutIn/const"; interface Props { type: 'image' | 'video' onSearch?: (value: Partial) => void } // 选择素材搜索 const SelectGroupSearch: React.FC = ({ type, 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', 'descriptionList'].includes(key) && value !== undefined && value !== null) { 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 ('dataTime' === key && value?.length === 2) { params.dataTimeMin = moment(value?.[0]).format('YYYY-MM-DD') params.dataTimeMax = moment(value?.[1]).format('YYYY-MM-DD') } else { params[key] = value } }) onSearch?.(params) } return
((option?.label ?? '') as any).toLowerCase().includes(input.toLowerCase()) } style={{ width: 100 }} allowClear options={[{ label: '未使用', value: 0 }, { label: '无消耗', value: 1 }, { label: '有消耗', value: 2 }]} /> ((option?.label ?? '') as any).toLowerCase().includes(input.toLowerCase()) } style={{ width: 100 }} allowClear dropdownMatchSelectWidth={false} options={type === 'image' ? Object.keys(SOURCE_TYPE_IMAGE_ENUM).map(key => ({ label: SOURCE_TYPE_IMAGE_ENUM[key as keyof typeof SOURCE_TYPE_IMAGE_ENUM], value: key })) : Object.keys(SOURCE_TYPE_VIDEO_ENUM).map(key => ({ label: SOURCE_TYPE_VIDEO_ENUM[key as keyof typeof SOURCE_TYPE_VIDEO_ENUM], value: key })) as any} />
} export default React.memo(SelectGroupSearch)