import { Button, Col, DatePicker, Form, Input, Radio, Row, Select, Space } from "antd" import React, { useEffect, useState } from "react" import moment from "moment" import { useAjax } from "@/Hook/useAjax" import { getAllOfOwnerUserApi, getChannelChoiceListApi, getGameChoiceListApi, getGameChoiceParentListType1Api, getPayListApi, getSubUserWithSelfListApi, getTtAllUserListApi, getUserSystemTypeChoiceListApi } from "@/services/gameData" import { PayStatus, TYPE, gameClassifyEnum } from "./const" import { ADSTATUSEnum as ADSTTTATUSEnum } from "@/pages/gameDataStatistics/adlist/monitor/const" import { ADSTATUSEnum } from "@/pages/gameDataStatistics/adlist/tencentMonitor/const" import IntervalTime from "./intervalTime" interface Props { onChange?: (data: any) => void /** 默认值 */ initialValues?: any /** 开启数据源搜索 */ isSource?: boolean, /** 是否开启 广告账号 搜索 */ isAccount?: boolean /** 是否开启 广告账户ID 搜索 */ isAccountId?: boolean /** 是否开启 公司ID 搜索 */ isCompanyId?: boolean /** 是否开启 CPID 搜索 */ isCpId?: boolean /** 是否开启 cp名 搜索 */ isCpName?: boolean /** 是否开启 CP方订单ID 搜索 */ isCpOrderId?: boolean /** 是否开启 CP通知状态 搜索 */ isCpStatus?: boolean /** 是否开启 订单创建日期 搜索 */ isCreateDay?: { ranges?: any } /** 是否开启 操作设备 搜索 */ isDevice?: boolean /** 是否开启 注册游戏名 搜索 */ isRechargeGameName?: boolean /** 是否开启 游戏名 搜索 */ isGameName?: boolean /** 是否开启 游戏ID 搜索 */ isGameId?: boolean /** 是否开启 充值游戏ID 搜索 */ isOrderGameId?: boolean /** 是否开启 父游戏ID 搜索 */ isParentId?: boolean /** 是否开启 游戏应用类型 搜索 */ isGameType?: boolean /** 是否开启 游戏角色名 搜索 */ isGameRoleName?: boolean /** 是否开启 游戏角色名ID 搜索 */ isGameRoleId?: boolean /** 是否开启 是否首充 搜索 */ isFirstRecharge?: boolean /** 是否开启 是否切量 搜索 */ isSwitch?: boolean /** 是否开启 收款商户号 搜索 */ isMerchantNo?: boolean /** 是否开启 商户订单ID 搜索 */ isOrderId?: boolean /** 是否开启 商户订单号 搜索 */ isMerchantOrderNo?: boolean /** 是否开启 支付状态 搜索 */ isPayStatus?: boolean /** 是否开启 支付方式 搜索 */ isPayWay?: boolean /** 是否开启 产品名称 搜索 */ isProductName?: boolean /** 是否开启 注册渠道名 搜索 */ isRegAgent?: boolean /** 是否开启 渠道名称 搜索 */ isAgentName?: boolean /** 是否开启 注册渠道ID 搜索 */ isAgentId?: boolean /** 是否开启 渠道标识 搜索 */ isAgentKey?: boolean /** 是否开启 投放渠道名 搜索 */ isPutAgent?: boolean /** 是否开启 用户注册日期 搜索 */ isRegDay?: { ranges?: any } /** 是否开启 投手名称 搜索 */ isSysUserName?: boolean /** 是否开启 投手ID 搜索 */ isSysUserId?: boolean /** 是否开启 玩家账号 搜索 */ isUserName?: boolean /** 是否开启 用户ID 搜索 */ isUserId?: boolean /** 是否开启 不同排行榜选择 搜索 */ isSelectRanking?: boolean /** 是否开启 消耗日期 搜索 */ isConsumeDay?: { ranges?: any } /** 是否开启 充值日期 搜索 */ rechargeDay?: { ranges?: any } /** 是否开启 支付时间 搜索 */ payTimeDay?: { ranges?: any } /** 是否开启 下单时间 搜索 */ placeAnOrderDay?: { ranges?: any } /** 是否开启布谷 游戏类型 筛选 */ isBGGameClassify?: boolean, /** 是否开启 单个充值日期 选择 */ isRechargeDate?: boolean, /** 是否开启 开始时间 结束时间 搜索 */ isBeginDay?: boolean /** 是否开启 玩家ID 搜索 */ isGameUserId?: boolean /** 是否开启 操作系统 选择 */ isOs?: boolean /** 是否开启 推广媒体 选择 */ isType?: boolean /** 是否开启 计划ID 搜索 */ isProjectId?: boolean /** 是否开启 计划名称 搜索 */ isProjectName?: boolean /** 是否开启 广告ID 搜索 */ isPromotionId?: boolean /** 是否开启 广告名称 搜索 */ isPromotionName?: boolean /** 是否开启 头条广告状态 搜索 */ isAdTTStatus?: boolean /** 是否开启 腾讯广告状态 搜索 */ isAdTXStatus?: boolean /** 是否开启 展示数据类型(买量,自然,总) 搜索 */ isUserEnterType?: boolean /** 是否开启 区服名称 搜索 */ isServerName?: boolean /** 是否开启区服ID 搜索 */ isServerId?: boolean /** 是否开启 开服时间 搜索 */ isServerDay?: { ranges?: any } /** 是否开启 充值到支付的间隔时间 搜索 */ isPayIntervalTime?: boolean } /** * 游戏数据系统 请求参数 * @returns */ const QueryForm: React.FC = (props) => { /**************************/ const { onChange, initialValues, isSource, isAccount, isAccountId, isCompanyId, isAgentKey, isAgentName, isCpId, isCpName, isCpOrderId, isCpStatus, isCreateDay, isDevice, isGameName, isRechargeGameName, isGameId, isOrderGameId, isGameRoleId, isGameRoleName, isFirstRecharge, isSwitch, isMerchantNo, isOrderId, isMerchantOrderNo, isPayStatus, isPayWay, isProductName, isRegAgent, isAgentId, isPutAgent, isRegDay, isOs, isParentId, isProjectId, isProjectName, isPromotionId, isPromotionName, isSysUserName, isRechargeDate, isBGGameClassify, isGameUserId, isSysUserId, isUserName, isUserId, isSelectRanking, isGameType, isConsumeDay, rechargeDay, isBeginDay, isType, isAdTTStatus, isUserEnterType, isServerName, isServerId, isServerDay, isAdTXStatus, payTimeDay, placeAnOrderDay, isPayIntervalTime } = props const [form] = Form.useForm() const [accountList, setAccountList] = useState([]) const [userIdList, setUserIdList] = useState([]) const getAllOfOwnerUser = useAjax(() => getAllOfOwnerUserApi()) const getTtAllUserList = useAjax(() => getTtAllUserListApi()) const getGameChoiceList = useAjax(() => getGameChoiceListApi()) const getSubUserWithSelfList = useAjax(() => getSubUserWithSelfListApi()) const getChannelChoiceList = useAjax(() => getChannelChoiceListApi()) const getGameChoiceParentListType1 = useAjax(() => getGameChoiceParentListType1Api()) const getUserSystemTypeChoiceList = useAjax(() => getUserSystemTypeChoiceListApi()) const getPayList = useAjax(() => getPayListApi()) /**************************/ useEffect(() => { if (isAccountId) { // 请求广告账号列表 async function getAccount() { let data: any[] = [] let res1 = await getAllOfOwnerUser.run() let data1 = [] if (res1) { data1 = res1?.map((item: any) => ({ label: item.accountId, value: item.accountId, corporationName: item.corporationName })) } let res2 = await getTtAllUserList.run() let data2 = [] if (res2) { data2 = res2?.map((item: any) => ({ label: item.accountId, value: item.accountId, corporationName: item.accountName })) } data = [...data1, ...data2] setAccountList(data) } getAccount() } }, [isAccountId]) /** 游戏列表 */ useEffect(() => { if (isGameId || isOrderGameId || isParentId) { getGameChoiceList.run() } }, [isGameId, isOrderGameId, isParentId]) /** 投手列表 */ useEffect(() => { if (isSysUserId) { getSubUserWithSelfList.run().then(res => { // let loginUserId = localStorage.getItem('userId') // let nameList = ['杨安明', '曹春林', '杨泽健', '金勇旭', '杨雨霏', '毛斌峰', '董平'] // if (loginUserId && ['158', '120', '119', '289', '399'].includes(loginUserId)) { // setUserIdList(res.filter((item: any) => nameList.includes(item.nickname))) // } else { // setUserIdList(res) // } setUserIdList(res) }) } }, [isSysUserId]) /** 推广渠道 */ useEffect(() => { if (isAgentId) { getChannelChoiceList.run() } }, [isAgentId]) /** 游戏应用类型 */ useEffect(() => { if (isGameType) { getGameChoiceParentListType1.run() } }, [isGameType]) /** 操作系统 */ useEffect(() => { if (isOs) { getUserSystemTypeChoiceList.run() } }, [isOs]) /** 支付方式 */ useEffect(() => { if (isPayWay) { getPayList.run() } }, [isPayWay]) const onFinish = (data: any) => { // 处理订单创建日期 if (isCreateDay) { if (data?.createDay && data?.createDay?.length > 0) { data.beginOrderTime = moment(data?.createDay[0]).format('YYYY-MM-DD') data.endOrderTime = moment(data?.createDay[1]).format('YYYY-MM-DD') } else { data.beginOrderTime = '' data.endOrderTime = '' } delete data.createDay } // 处理 用户注册日期 if (isRegDay) { if (data?.regDay && data?.regDay?.length > 0) { data.regStartDay = moment(data?.regDay[0]).format('YYYY-MM-DD') data.regEndDay = moment(data?.regDay[1]).format('YYYY-MM-DD') } else { data.regStartDay = '' data.regEndDay = '' } delete data.regDay } // 处理 消耗日期 if (isConsumeDay) { if (data?.consumeDay && data?.consumeDay?.length > 0) { data.costBeginDay = moment(data?.consumeDay[0]).format('YYYY-MM-DD') data.costEndDay = moment(data?.consumeDay[1]).format('YYYY-MM-DD') } else { data.costBeginDay = '' data.costEndDay = '' } delete data.consumeDay } // 处理 不同排行榜 选择 if (isSelectRanking) { switch (data?.dateType) { case 'all': data.beginDay = '' data.endDay = '' break; case 'today': data.beginDay = moment().format('YYYY-MM-DD') data.endDay = moment().format('YYYY-MM-DD') break case 'yesterday': data.beginDay = moment().subtract(1, 'd').format('YYYY-MM-DD') data.endDay = moment().subtract(1, 'd').format('YYYY-MM-DD') break case '7days': data.beginDay = moment().subtract(7, 'd').format('YYYY-MM-DD') data.endDay = moment().format('YYYY-MM-DD') break case '30days': data.beginDay = moment().subtract(30, 'd').format('YYYY-MM-DD') data.endDay = moment().format('YYYY-MM-DD') break } delete data?.dateType } console.log('更新了字段---->', data); onChange && onChange(data) } return
{/* 数据源搜索 */} {isSource && } {/* 展示数据类型 */} {isUserEnterType && } {/* 不同排行榜选择 */} {isSelectRanking && 总排行 今日排行 昨日排行 7日排行 30日排行 } {/* 广告区服名称 */} {isServerName && } {/* 广告区服ID */} {isServerId && } {/* 广告账户名称 */} {isAccount && } {/* 广告账号ID */} {isAccountId && } {/* 公司ID */} {isCompanyId && } {/* cp名 */} {isCpName && } {/* CPID */} {isCpId && } {/* CP方订单ID */} {isCpOrderId && } {/* CP通知状态 */} {isCpStatus && } {/* 计划名称 */} {isProjectName && } {/* 计划ID */} {isProjectId && } {/* 广告名称 */} {isPromotionName && } {/* 广告ID */} {isPromotionId && } {/* 广告状态 */} {isAdTTStatus && } {isAdTXStatus && } {/* 操作设备 */} {isDevice && } {/* 游戏名 */} {isRechargeGameName && } {/* 玩家ID */} {isGameUserId && } {/* 游戏名 */} {isGameName && } {/* 游戏ID搜索 */} {isGameId && } {/* 充值游戏ID */} {isOrderGameId && } {/* 父游戏ID */} {isParentId && } {/* 游戏应用类型搜索 */} {isGameType && } {/* 布谷游戏应用类型搜索 */} {isBGGameClassify && } {/* 游戏角色名 */} {isGameRoleName && } {/* 游戏角色名id搜索 */} {isGameRoleId && } {/* 是否首充 */} {isFirstRecharge && } {/* 是否切量 */} {isSwitch && } {/* 收款商户号 */} {isMerchantNo && } {/* 收款商户号 */} {isMerchantOrderNo && } {/* 收款商户号 */} {isOrderId && } {/* 支付状态 */} {isPayStatus && } {/* 支付方式 */} {isPayWay && } {/* 推广媒体 */} {isType && } {/* 产品名称 */} {isProductName && } {/* 注册渠道名 */} {isRegAgent && } {/* 渠道标识 */} {isAgentKey && } {/* 渠道名称 */} {isAgentName && } {/* 推广渠道id */} {isAgentId && } {/* 投放渠道名 */} {isPutAgent && } {/* 投手名 */} {isSysUserName && } {/* 投手ID */} {isSysUserId && } {/* 玩家账号 */} {isUserName && } {/* 用户id */} {isUserId && } {/* 用户id */} {isOs && } {/* 用户注册日期搜索 */} {isRegDay && } {/* 消耗日期 搜索 */} {isConsumeDay && } {/* 消耗日期 搜索 */} {isBeginDay && } {/* 订单创建日期搜索 */} {isCreateDay && } {/* 充值日期搜索 */} {rechargeDay && } {/* 单个充值日期搜索 */} {payTimeDay && } {/* 单个充值日期搜索 */} {placeAnOrderDay && } {/* 开服日期搜索 */} {isServerDay && } {/* 单个充值日期搜索 */} {isRechargeDate && } {/* 单个充值日期搜索 */} {isPayIntervalTime && }
} export default React.memo(QueryForm)