12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- import React, { useEffect, useState } from "react"
- import TableData from "../../components/TableData"
- import columns12 from "./tableConfig"
- import { useAjax } from "@/Hook/useAjax"
- import { AccountProps, getAccountRechargeRankingListApi } from "@/services/gameData/rankingList"
- import QueryForm from "@/components/QueryForm"
- import moment from "moment"
- import { rangePresets } from "@/components/QueryForm/const"
- const Account: React.FC = () => {
- /********************************/
- const [queryForm, setQueryForm] = useState<AccountProps>({ pageNum: 1, pageSize: 20 })
- const getAccountRechargeRankingList = useAjax((params) => getAccountRechargeRankingListApi(params))
- /********************************/
- useEffect(() => {
- getAccountRechargeRankingList.run(queryForm)
- }, [queryForm])
- return <div>
- <TableData
- leftChild={<QueryForm
- onChange={(data: any) => {
- console.log(data)
- const { rechargeDay, ...params } = data
- let newQueryForm = JSON.parse(JSON.stringify(queryForm))
- newQueryForm.pageNum = 1
- if (rechargeDay && rechargeDay?.length === 2) {
- newQueryForm.beginDay = moment(rechargeDay[0]).format('YYYY-MM-DD')
- newQueryForm.endDay = moment(rechargeDay[1]).format('YYYY-MM-DD')
- } else {
- delete newQueryForm.beginDay
- delete newQueryForm.endDay
- }
- setQueryForm({ ...newQueryForm, ...params })
- }}
- rechargeDay={{ ranges: rangePresets }}
- isSysUserId
- isType
- isAccountId
- isGameId
- />}
- scroll={{ x: 1000, y: 600 }}
- ajax={getAccountRechargeRankingList}
- fixed={{ left: 3, right: 3 }}
- dataSource={getAccountRechargeRankingList?.data?.records?.map((item: any, index: number) => ({ ...item, id: Number(queryForm.pageNum.toString() + index.toString()) }))}
- total={getAccountRechargeRankingList?.data?.total}
- page={queryForm.pageNum}
- pageSize={queryForm.pageSize}
- title='推广账号消耗排行榜'
- onChange={(props: any) => {
- let { pagination, sortData } = props
- let { current, pageSize } = pagination
- let newQueryForm = JSON.parse(JSON.stringify(queryForm))
- if (sortData && sortData?.order) {
- newQueryForm['sortType'] = sortData?.order === 'ascend' ? 'asc' : 'desc'
- newQueryForm['sortFiled'] = sortData?.field
- } else {
- delete newQueryForm['sortType']
- delete newQueryForm['sortFiled']
- }
- newQueryForm.pageNum = current
- newQueryForm.pageSize = pageSize
- setQueryForm({ ...newQueryForm })
- }}
- config={columns12()}
- configName={'推广账号消耗排行榜'}
- />
- </div>
- }
- export default Account
|