wjx 1 год назад
Родитель
Сommit
0f980801fe

+ 5 - 0
src/pages/gameDataStatistics/adlist/monitor/index.tsx

@@ -83,8 +83,13 @@ const Monitor = () => {
             total={getPromotionDataDatList?.data?.total}
             page={queryForm.pageNum}
             pageSize={queryForm.pageSize}
+            sortData={{
+                field: queryForm?.sortFiled,
+                order: queryForm?.sortType === 'asc' ? 'ascend' : 'descend'
+            }}
             title='广告监控'
             onChange={(props: any) => {
+                console.log('---->', props)
                 let { pagination, sortData } = props
                 let { current, pageSize } = pagination
                 let newQueryForm = JSON.parse(JSON.stringify(queryForm))

+ 29 - 2
src/pages/gameDataStatistics/components/TableData/index.tsx

@@ -41,6 +41,10 @@ interface Prosp {
     totalData?: any[]
     summary?: ((data: readonly any[]) => React.ReactNode)
     rowClassName?: string | ((record: any, index: any) => string)
+    sortData?: {
+        field?: string,
+        order?: "descend" | "ascend"
+    }
 }
 
 export const version = '1.0.0'
@@ -48,12 +52,13 @@ export const version = '1.0.0'
 function TableData(props: Prosp) {
 
     /*************************/
-    const { isZj, totalData, scroll, title, dataSource, expandedRowRender, className, rowClassName, leftChild, page = undefined, pageSize = undefined, size = 'small', total = 0, onChange, config, configName, ajax, fixed = { left: 0, right: 1 }, summary } = props
+    const { isZj, totalData, scroll, title, dataSource, expandedRowRender, sortData, className, rowClassName, leftChild, page = undefined, pageSize = undefined, size = 'small', total = 0, onChange, config, configName, ajax, fixed = { left: 0, right: 1 }, summary } = props
     const [visible, setVisible] = useState<boolean>(false)
     const [isFullscreen, setIsFullscreen] = useState<boolean>(true)
     const [oldSelectData, setoldSelectData] = useState<any[]>([])
     const [oldFixed, setoldFixed] = useState<any>({ left: '0', right: '0' })
     const [newColumns, setNewColumns] = useState<any[]>([])
+    const [originalColumns, setOriginalColumns] = useState<any[]>([])
     const [timer, setTimer] = useState<string>(moment().format('HH:mm:ss'))
     const [selectData, setSelectData] = useState<{ selectData: any[], fixed: { left: number, right: number } }>({ selectData: [], fixed: { left: fixed.left, right: fixed.right } })
     const ref = useRef(null)
@@ -61,10 +66,30 @@ function TableData(props: Prosp) {
     const oldName = useRef(null)
     /*************************/
 
+    useEffect(() => {
+        if (originalColumns.length > 0) {
+            if (sortData?.field && sortData.order) {
+                setNewColumns(originalColumns.map((item: any) => {
+                    if (item.dataIndex === sortData?.field) {
+                        item.sortOrder = sortData.order
+                    }
+                    return item
+                }))
+            } else {
+                setNewColumns(originalColumns.map((item: any) => {
+                    const { sortOrder, ...ite } = item
+                    return ite
+                }))
+            }
+        }
+    }, [originalColumns, sortData])
+
     const { run: runSet } = useThrottleFn((newArr, newConfig, fixedData) => {
+        console.log('设置配置改变重新赋值')
         setoldSelectData(selectData.selectData)
         setoldFixed(selectData.fixed)
         if (newArr.length > 0) {
+            console.log('改变---->')
             let c: any[] = []
             newArr.forEach((newItem: any, index: number) => {
                 let oldItem = newConfig.find((c: { dataIndex: any }) => c.dataIndex === newItem.dataIndex)
@@ -93,6 +118,7 @@ function TableData(props: Prosp) {
                     c.push(ite)
                 }
             })
+            setOriginalColumns(c)
             setNewColumns(c)
             // setNewColumns(newArr.map((newItem: any, index: number) => {
             //     let oldItem = newConfig.find((c: { dataIndex: any }) => c.dataIndex === newItem.dataIndex)
@@ -148,7 +174,6 @@ function TableData(props: Prosp) {
                 newArr = newSelectData
             }
             if ((JSON.stringify(oldSelectDataString) !== JSON.stringify(selectData?.selectData)) || (JSON.stringify(selectData.fixed) !== JSON.stringify(oldFixed))) {
-                console.log('设置配置改变重新赋值')
                 runSet(newArr, newConfig, fixedData)
             }
         }
@@ -292,6 +317,8 @@ const Tab = React.memo((props: any) => {
                     size={size}
                     pagination={false}
                     hideOnSinglePage
+                    current={page}
+                    pageSize={pageSize}
                     className={`all_table header_table_body ${className ? className : ''}`}
                     sortDirections={['ascend', 'descend', null]}
                     handelResize={((columns: any) => handelResize(columns))}

+ 4 - 0
src/pages/gameDataStatistics/extensionData/everyday/tableConfig.tsx

@@ -186,6 +186,9 @@ function columns12(rechargeTrendHandle: (data: any) => void): { label: string, f
             data: [
                 { title: '注册成本', dataIndex: 'regCost', label: '用户数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} precision={2} /> },
                 { title: '注册人数', dataIndex: 'regUserCount', label: '用户数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
+                { title: '首日创角人数', dataIndex: 'firstRoleNum', label: '付费数据', align: 'center', width: 90, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
+                { title: '新用户累计创角人数', dataIndex: 'newUserTotalRoleNum', label: '付费数据', align: 'center', width: 90, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
+                { title: '创角人数', dataIndex: 'roleNum', label: '付费数据', align: 'center', width: 90, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
             ]
         },
         {
@@ -212,6 +215,7 @@ function columns12(rechargeTrendHandle: (data: any) => void): { label: string, f
                     render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
                 },
                 { title: '毛利额', dataIndex: 'grossMargin', label: '付费数据', align: 'center', width: 90, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
+                
                 ...roiC,
                 {
                     title: '60日ROI', dataIndex: 'roiDay60', label: '付费数据', align: 'center', width: 70, sorter: true,

+ 15 - 12
src/pages/gameDataStatistics/extensionData/total/tableConfig.tsx

@@ -90,7 +90,7 @@ function columns12(gameType: any) {
                     render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
                 },
                 { title: '千次曝光成本', dataIndex: 'thousandViewCost', label: '广告曝光数据', align: 'center', width: 70, default: 13, sorter: true, render: (a: string) => <Statistic value={a || 0} precision={2} /> },
-                { title: '平均点击均价', dataIndex: 'avgClickCost', label: '广告曝光数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} precision={2}/> },
+                { title: '平均点击均价', dataIndex: 'avgClickCost', label: '广告曝光数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} precision={2} /> },
                 { title: '应用下载开始量', dataIndex: 'appDownloadCount', label: '广告曝光数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
                 { title: '应用下载开始成本', dataIndex: 'appDownloadCost', label: '广告曝光数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} precision={2} /> },
                 {
@@ -121,7 +121,10 @@ function columns12(gameType: any) {
             label: '用户数据',
             data: [
                 { title: '注册人数', dataIndex: 'regUserCount', label: '用户数据', align: 'center', width: 70, default: 14, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
-                { title: '注册成本', dataIndex: 'regCost', label: '用户数据', align: 'center', width: 70, default: 15, sorter: true, render: (a: string) => <Statistic value={a || 0} precision={2} /> }
+                { title: '注册成本', dataIndex: 'regCost', label: '用户数据', align: 'center', width: 70, default: 15, sorter: true, render: (a: string) => <Statistic value={a || 0} precision={2} /> },
+                { title: '首日创角人数', dataIndex: 'firstRoleNum', label: '付费数据', align: 'center', width: 90, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
+                { title: '新用户累计创角人数', dataIndex: 'newUserTotalRoleNum', label: '付费数据', align: 'center', width: 90, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
+                { title: '创角人数', dataIndex: 'roleNum', label: '付费数据', align: 'center', width: 90, render: (a: string) => <Statistic value={a || 0} /> },
             ]
         },
         {
@@ -191,11 +194,11 @@ function columns12(gameType: any) {
                     title: '当天付费率', dataIndex: 'todayRechargeRate', label: '付费数据', align: 'center', width: 70, sorter: true,
                     render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
                 },
-                { title: '新用户付费比', dataIndex: 'newUserRechargeRatio', label: '付费数据', align: 'center', width: 70, render: (a: string) => <Statistic value={a || 0} precision={2}/> },
-                { title: '首日客单价', dataIndex: 'avgFirstUserRecharge', label: '付费数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} precision={2}/> },
-                { title: '新用户客单价', dataIndex: 'avgUserRecharge', label: '付费数据', align: 'center', width: 70, render: (a: string) => <Statistic value={a || 0} precision={2}/> },
-                { title: '当天客单价', dataIndex: 'avgTodayRecharge', label: '付费数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} precision={2}/> },
-                { title: '账面客单价', dataIndex: 'avgShowUserRecharge', label: '付费数据', align: 'center', width: 70, render: (a: string) => <Statistic value={a || 0} precision={2}/> },
+                { title: '新用户付费比', dataIndex: 'newUserRechargeRatio', label: '付费数据', align: 'center', width: 70, render: (a: string) => <Statistic value={a || 0} precision={2} /> },
+                { title: '首日客单价', dataIndex: 'avgFirstUserRecharge', label: '付费数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} precision={2} /> },
+                { title: '新用户客单价', dataIndex: 'avgUserRecharge', label: '付费数据', align: 'center', width: 70, render: (a: string) => <Statistic value={a || 0} precision={2} /> },
+                { title: '当天客单价', dataIndex: 'avgTodayRecharge', label: '付费数据', align: 'center', width: 70, sorter: true, render: (a: string) => <Statistic value={a || 0} precision={2} /> },
+                { title: '账面客单价', dataIndex: 'avgShowUserRecharge', label: '付费数据', align: 'center', width: 70, render: (a: string) => <Statistic value={a || 0} precision={2} /> },
                 { title: '首日充值成本', dataIndex: 'firstRechargeCost', label: '付费数据', align: 'center', width: 90, sorter: true, render: (a: string) => <Statistic value={a || 0} precision={2} /> },
                 { title: '新用户充值成本', dataIndex: 'userRechargeCost', label: '付费数据', align: 'center', width: 90, render: (a: string) => <Statistic value={a || 0} precision={2} /> },
                 { title: '当天充值成本', dataIndex: 'todayRechargeCost', label: '付费数据', align: 'center', width: 90, sorter: true, render: (a: string) => <Statistic value={a || 0} precision={2} /> },
@@ -216,11 +219,11 @@ function columns12(gameType: any) {
                 //     title: '当天复充率', dataIndex: 'todayRepeatRechargeRate', label: '付费数据', align: 'center', width: 70, sorter: true,
                 //     render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
                 // },
-                { title: '新增注册ARPPU', dataIndex: 'newRegArpu', label: '付费数据', align: 'center', width: 80, sorter: true, render: (a: string) => <Statistic value={a || 0} precision={2}/> },
-                { title: '首日付费ARPPU', dataIndex: 'firstRechargeArpu', label: '付费数据', align: 'center', width: 80, sorter: true, render: (a: string) => <Statistic value={a || 0} precision={2}/> },
-                { title: '新用户付费ARPPU', dataIndex: 'userRechargeArpu', label: '付费数据', align: 'center', width: 80, render: (a: string) => <Statistic value={a || 0} precision={2}/> },
-                { title: '至今付费ARPPU', dataIndex: 'todayRechargeArpu', label: '付费数据', align: 'center', width: 80, sorter: true, render: (a: string) => <Statistic value={a || 0} precision={2}/> },
-                { title: '账面ARPPU', dataIndex: 'showRechargeArpu', label: '付费数据', align: 'center', width: 80, render: (a: string) => <Statistic value={a || 0} precision={2}/> }
+                { title: '新增注册ARPPU', dataIndex: 'newRegArpu', label: '付费数据', align: 'center', width: 80, sorter: true, render: (a: string) => <Statistic value={a || 0} precision={2} /> },
+                { title: '首日付费ARPPU', dataIndex: 'firstRechargeArpu', label: '付费数据', align: 'center', width: 80, sorter: true, render: (a: string) => <Statistic value={a || 0} precision={2} /> },
+                { title: '新用户付费ARPPU', dataIndex: 'userRechargeArpu', label: '付费数据', align: 'center', width: 80, render: (a: string) => <Statistic value={a || 0} precision={2} /> },
+                { title: '至今付费ARPPU', dataIndex: 'todayRechargeArpu', label: '付费数据', align: 'center', width: 80, sorter: true, render: (a: string) => <Statistic value={a || 0} precision={2} /> },
+                { title: '账面ARPPU', dataIndex: 'showRechargeArpu', label: '付费数据', align: 'center', width: 80, render: (a: string) => <Statistic value={a || 0} precision={2} /> }
             ]
         },
         // {