import { Button, Progress, Select, Space, Statistic, Table, Tag } from "antd" import React, { useEffect, useState } from "react" import style from './index.less' import Draggable from "react-draggable" import { CloseCircleOutlined, SearchOutlined, SyncOutlined } from "@ant-design/icons" import { allPlanProps, getAllPlanListApi } from "@/services/adMonitor/adMonitor" import { useAjax } from "@/Hook/useAjax" import { ColumnsType } from "antd/lib/table" import { GGStateData } from "@/pages/adMonitor/adMonitorList/data" import { GUANGGAOZHUANGTAI } from "@/pages/adMonitor/adMonitorList/enum" import SearchSelect from "./searchSelect" import moment from "moment" import { getAdAccountApi } from "@/services/launchAdq/adAuthorize" interface Props { userId: string onChange?: (adidList?: number[]) => void } /** * 开启监控过滤 * @returns */ const AdIdSearch: React.FC = ({ userId, onChange }) => { /***************************/ const [show, setShow] = useState(false) const [editSelectedRow, setEditSelectedRow] = useState([]) const [queryFrom, setQueryForm] = useState({ pageNum: 1, pageSize: 20, createStartTime: moment().subtract(3, 'days').format('YYYY-MM-DD'), createEndTime: moment().format('YYYY-MM-DD') }) const getAllPlanList = useAjax((params) => getAllPlanListApi(params)) // 获取广告账号列表 const getAdqAccountList = useAjax(() => getAdAccountApi(), { formatResult: true }) /***************************/ useEffect(() => { if (show) { getAllPlanList.run({ sysUserId: [userId], ...queryFrom }) } }, [userId, show, queryFrom]) const open = () => { setShow(true) getAdqAccountList.run() } const handleOk = () => { onChange?.(editSelectedRow) } return <> {show &&
setShow(false)}>
总共{total}数据, current: getAllPlanList?.data?.current || 1, pageSize: getAllPlanList?.data?.size || 20, }} rowSelection={{ selectedRowKeys: editSelectedRow, onChange: (selectedRowKeys: React.Key[], selectedRows: any[]) => { console.log(selectedRowKeys, selectedRows) setEditSelectedRow(selectedRowKeys) } }} onChange={(pagination, filters, sortData: any) => { let { current, pageSize } = pagination let newQueryForm = JSON.parse(JSON.stringify(queryFrom)) newQueryForm.pageNum = current newQueryForm.pageSize = pageSize if (sortData && JSON.stringify('sortData') !== '{}') { let { field, order } = sortData // descend 降序 大到小 ascend 升序 小到大 if (order) { newQueryForm.sortField = field newQueryForm.sort = order === 'ascend' ? 'ASC' : 'DESC' } else { Object.keys(newQueryForm).forEach(key => { if (key === 'sortField' || key === 'sort') { delete newQueryForm[key] } }) } } else { Object.keys(newQueryForm).forEach(key => { if (key === 'sortField' || key === 'sort') { delete newQueryForm[key] } }) } setQueryForm({ ...newQueryForm }) }} /> {editSelectedRow?.length > 0 &&
} } } const columns: ColumnsType = [ { title: '广告ID', dataIndex: 'adgroupId', key: 'adgroupId', align: 'center', width: 90, fixed: 'left', ellipsis: true }, { title: '广告状态', dataIndex: 'adStatus', key: 'adStatus', align: 'center', width: 90, ellipsis: true, render: (a: any) => { return GGStateData[a] || '--' } }, { title: '广告总消耗', dataIndex: 'cost', key: 'cost', align: 'center', width: 100, ellipsis: true, sorter: true, render: (a: any) => { return
= 30000 ? { color: '#000', fontWeight: 500 } : { fontWeight: 500 }} />
} }, { title: '曝光量', dataIndex: 'viewCount', key: 'viewCount', align: 'center', width: 75, sorter: true, ellipsis: true, render: (a: number) => { return = 100 ? { color: 'red', fontWeight: 600 } : {}}> {a || '--'} }, }, { title: '下单量', dataIndex: 'orderCount', key: 'orderCount', align: 'center', width: 75, sorter: true, ellipsis: true, render: (a: any) => { return } }, { title: '千次曝光成本', dataIndex: 'thousandDisplayPrice', key: 'thousandDisplayPrice', align: 'center', width: 95, // sorter: true, ellipsis: true, render: (a: any) => { return } }, { title: '点击量', dataIndex: 'clickCount', key: 'clickCount', align: 'center', width: 70, sorter: true, ellipsis: true, render: (a: number) => { return = 100 ? { color: 'red', fontWeight: 600 } : {}}> {a || '--'} }, }, ]; export default React.memo(AdIdSearch)