wjx 1 jaar geleden
bovenliggende
commit
93947e91f6

+ 1 - 1
src/components/QueryForm/index.tsx

@@ -1,4 +1,4 @@
-import { Button, Checkbox, Col, DatePicker, Form, Input, InputNumber, Radio, Row, Select, Space, Switch } from "antd"
+import { Button, Checkbox, Col, DatePicker, Form, Input, InputNumber, Radio, Row, Select, Space } from "antd"
 import React, { useEffect, useState } from "react"
 import moment from "moment"
 import { useAjax } from "@/Hook/useAjax"

+ 10 - 1
src/pages/gameDataStatistics/player/role/index.tsx

@@ -1,5 +1,5 @@
 import { useAjax } from "@/Hook/useAjax"
-import { PlayerRoleListProps, getUserRoleListApi } from "@/services/gameData/player"
+import { PlayerRoleListProps, getUserRoleListApi, getUserRoleTotalApi } from "@/services/gameData/player"
 import React, { useEffect, useState } from "react"
 import TableData from "../../components/TableData"
 import QueryForm from "@/components/QueryForm"
@@ -15,10 +15,17 @@ const Role: React.FC = () => {
 
     /************************/
     const [queryForm, setQueryForm] = useState<PlayerRoleListProps>({ pageNum: 1, pageSize: 50, sourceSystem: 'ZX_ONE' })
+    const [totalData, setTotalData] = useState<any[]>([])
     const getUserRoleList = useAjax((params) => getUserRoleListApi(params))
+    const getUserRoleTotal = useAjax((params) => getUserRoleTotalApi(params))
     /************************/
 
     useEffect(() => {
+        getUserRoleTotal.run(queryForm).then((res: { id: number; zj: string; }) => {
+            res.id = 1
+            res.zj = '总计'
+            setTotalData([res])
+        })
         getUserRoleList.run(queryForm)
     }, [queryForm])
 
@@ -95,6 +102,8 @@ const Role: React.FC = () => {
                 isPayIntervalTime={{ tips: '充值距注册时间区间(分钟)' }}
                 isRoleCount={{ tips: '玩家等级区间' }}
             />}
+            isZj
+            totalData={totalData}
             scroll={{ x: 1000, y: 600 }}
             ajax={getUserRoleList}
             fixed={{ left: 1, right: 0 }}

+ 10 - 2
src/pages/gameDataStatistics/player/role/tableConfig.tsx

@@ -8,7 +8,15 @@ function columns12() {
         {
             label: '玩家列表',
             data: [
-                { title: '玩家ID', dataIndex: 'id', label: '玩家列表', align: 'center', default: 1, width: 55 },
+                {
+                    title: '玩家ID', dataIndex: 'id', label: '玩家列表', align: 'center', default: 1, width: 55,
+                    render: (a: string, b: any) => {
+                        if (b?.zj) {
+                            return b?.zj
+                        }
+                        return b?.id
+                    }
+                },
                 { title: '玩家账号', dataIndex: 'username', label: '玩家列表', align: 'center', width: 120, default: 2, render: (a: string, b: any) => (<WidthEllipsis isCopy value={a} />) },
                 { title: '玩家昵称', dataIndex: 'nickname', label: '玩家列表', align: 'center', width: 120, render: (a: string, b: any) => (<WidthEllipsis value={a} />) },
                 { title: '玩家注册IP', dataIndex: 'regIp', label: '玩家列表', align: 'center', width: 100, default: 3, render: (a: string, b: any) => (<WidthEllipsis isCopy value={a} />) },
@@ -53,7 +61,7 @@ function columns12() {
                 }
             ]
         },
-       
+
     ]
 
     return newArr

+ 12 - 0
src/services/gameData/player.ts

@@ -192,6 +192,18 @@ export async function getUserRoleListApi(params: PlayerRoleListProps) {
     });
 }
 
+/**
+ * 玩家角色列表总计
+ * @param params 
+ * @returns 
+ */
+export async function getUserRoleTotalApi(params: PlayerRoleListProps) {
+    return request(wapi + '/player/role/total', {
+        method: 'POST',
+        data: params,
+    });
+}
+
 export async function downloadRoleListApi(params: PlayerRoleListProps) {
     return request(api + '/manage/user/role/list/excel', {
         method: 'POST',