diff --git a/src/access.ts b/src/access.ts index ca84238..dbb9d5c 100644 --- a/src/access.ts +++ b/src/access.ts @@ -18,6 +18,9 @@ export default function access(initialState: { }, canShowButton: (buttonName) => { // return true; + if (routeList == null || routeList == undefined || routeList.length == 0) { + return true; + } return routeList.includes(buttonName); }, }; diff --git a/src/constants/enum/timeType.ts b/src/constants/enum/timeType.ts index 326e3b6..7a6237b 100644 --- a/src/constants/enum/timeType.ts +++ b/src/constants/enum/timeType.ts @@ -1,6 +1,6 @@ export enum TimeType { - DAY = 'day', - WEEK = 'week', - MONTH = 'month', + DAY = '1', + WEEK = '2', + MONTH = '3', } export default TimeType; diff --git a/src/pages/DataBoard/CoreData/List/index.tsx b/src/pages/DataBoard/CoreData/List/index.tsx index 5c1254e..660ab42 100644 --- a/src/pages/DataBoard/CoreData/List/index.tsx +++ b/src/pages/DataBoard/CoreData/List/index.tsx @@ -2,110 +2,79 @@ import React, { useRef, useState } from 'react'; import Table, { ProColumns, ActionType } from '@/components/Table'; import moment from 'moment'; import TimeType from '@/constants/enum/timeType'; -import { getData } from '@/utils/getData'; import MoreData from '@/widget/MoreData'; -import { - getCoreData, - getPayData, - getTodayUserData, - getMonthPayData, - getNewUserData, -} from '@/services/dataBorad/coreData'; +import { getCoreData, getListData } from '@/services/dataBorad/coreData'; import { Card, Col, Row, Select } from 'antd'; +import { fetchTableData } from '@/utils/table'; const CoreData: React.FC = () => { const tableRef = useRef(); - const [timeType, setTimeType] = useState(TimeType.DAY); - // const [date, setDate] = useState(getData); - const [userDate, setUserDate] = useState(getData(getTodayUserData)); - const [newUserdate, setNewUserDate] = useState(getData(getNewUserData)); - const [payData, setPayDate] = useState(getData(getMonthPayData)); - const [allPay, setAllPayDate] = useState(getData(getPayData)); + const TimeTypeList = [ + { + label: '每日', + value: TimeType.DAY, + }, + { + label: '每周', + value: TimeType.WEEK, + }, + { + label: '每月', + value: TimeType.MONTH, + }, + ]; + + const [coreData, setCoreData] = useState({ + today_active_user: '', + today_new_user: '', + month_recharge: '', + recharge_sum: '', + }); const columns: ProColumns[] = [ { title: '时间类型', - dataIndex: 'coinType', + dataIndex: 'code', hideInTable: true, initialValue: TimeType.DAY, - renderFormItem: (item, { type, defaultRender, ...rest }, form) => { - return ( -