Browse Source

添加导出excel

main
mac 2 months ago
parent
commit
a1db167003
  1. 4
      .env
  2. 25
      src/pages/assets-manage/assets-list.tsx
  3. 9
      src/pages/manage/deposit.tsx
  4. 9
      src/pages/manage/withdraw.tsx
  5. 1
      src/pages/review/withdraw.tsx
  6. 23
      src/pages/system-log/walletLog.tsx
  7. 2
      src/pages/vip-manage/proxy-list.tsx
  8. 27
      src/utils/index.ts

4
.env

@ -1,3 +1,3 @@
SKIP_PREFLIGHT_CHECK=true SKIP_PREFLIGHT_CHECK=true
REACT_APP_BASE_URL=https://matontrading.com
REACT_APP_ORIGIN_URL=https://matontrading.com
REACT_APP_BASE_URL=http://203.161.61.234:8082
REACT_APP_ORIGIN_URL=http://162.254.37.253:8086

25
src/pages/assets-manage/assets-list.tsx

@ -1,8 +1,8 @@
import api from "@/api" import api from "@/api"
import MyTable from "@/components/MyTable" import MyTable from "@/components/MyTable"
import { getTime } from "@/utils"
import { exprotExcel, getTime } from "@/utils"
import { EditOutlined } from "@ant-design/icons" import { EditOutlined } from "@ant-design/icons"
import { Button, Form, Input, Modal, Switch, notification } from "antd"
import { Button, Form, Input, Modal, Select, Switch, notification } from "antd"
import React, { useEffect, useRef, useState } from "react" import React, { useEffect, useRef, useState } from "react"
const AssetsList = () => { const AssetsList = () => {
@ -92,17 +92,36 @@ const AssetsList = () => {
} }
} }
const options = [
{ "value": 0, "label": "全部" },
{ "value": 1, "label": "现金钱包->资产账户" },
{ "value": 2, "label": "会员转账" },
{ "value": 3, "label": "资产账户->现金钱包" },
]
return ( return (
<div> <div>
<MyTable <MyTable
apiFun={api.get_assetsList} apiFun={api.get_assetsList}
columns={columns} columns={columns}
ref={tableRef} ref={tableRef}
header={
<div>
<Button type="primary" onClick={() => exprotExcel(2)}>Excel</Button>
</div>
}
searchConfigList={[{ searchConfigList={[{
key: 'search', key: 'search',
name: 'search', name: 'search',
slot: <Input style={{ minWidth: 350 }} placeholder="请输入MT账号、邮箱搜索" /> slot: <Input style={{ minWidth: 350 }} placeholder="请输入MT账号、邮箱搜索" />
}]}
},
{
key: 'type',
name: 'type',
initialValue: 0,
slot: <Select style={{ minWidth: 200 }} placeholder="" options={options} />
}
]}
/> />
<Modal <Modal
visible={visible} visible={visible}

9
src/pages/manage/deposit.tsx

@ -1,7 +1,7 @@
import api from "@/api" import api from "@/api"
import MyTable from "@/components/MyTable" import MyTable from "@/components/MyTable"
import { getTime } from "@/utils"
import { Input } from "antd"
import { exprotExcel, getTime } from "@/utils"
import { Button, Input } from "antd"
import React from "react" import React from "react"
const DepositManage = () => { const DepositManage = () => {
@ -33,6 +33,11 @@ const DepositManage = () => {
<MyTable <MyTable
apiFun={api.get_depositManageList} apiFun={api.get_depositManageList}
columns={columns} columns={columns}
header={
<div>
<Button type="primary" onClick={() => exprotExcel(3)}>Excel</Button>
</div>
}
searchConfigList={[{ searchConfigList={[{
key: 'search', key: 'search',
name: 'search', name: 'search',

9
src/pages/manage/withdraw.tsx

@ -1,7 +1,7 @@
import api from "@/api" import api from "@/api"
import MyTable from "@/components/MyTable" import MyTable from "@/components/MyTable"
import { getTime } from "@/utils"
import { Input } from "antd"
import { exprotExcel, getTime } from "@/utils"
import { Button, Input } from "antd"
import React from "react" import React from "react"
const WithdrawManage = () => { const WithdrawManage = () => {
@ -30,6 +30,11 @@ const WithdrawManage = () => {
<MyTable <MyTable
apiFun={api.get_withdrawManageList} apiFun={api.get_withdrawManageList}
columns={columns} columns={columns}
header={
<div>
<Button type="primary" onClick={() => exprotExcel(4)}>Excel</Button>
</div>
}
searchConfigList={[{ searchConfigList={[{
key: 'search', key: 'search',
name: 'search', name: 'search',

1
src/pages/review/withdraw.tsx

@ -34,6 +34,7 @@ const WithdrawReview = () => {
{ "dataIndex": "address", "title": "钱包地址" }, { "dataIndex": "address", "title": "钱包地址" },
{ "dataIndex": "amount", "title": "取款金额" }, { "dataIndex": "amount", "title": "取款金额" },
{ "dataIndex": "time", "title": "时间", render: (time) => (<div>{getTime(time * 1000)}</div>) }, { "dataIndex": "time", "title": "时间", render: (time) => (<div>{getTime(time * 1000)}</div>) },
{ "dataIndex": "name", "title": "姓名" },
{ "dataIndex": "email", "title": "用户" }, { "dataIndex": "email", "title": "用户" },
{ "dataIndex": "fee", "title": "取款手续费" }, { "dataIndex": "fee", "title": "取款手续费" },
{ "dataIndex": "order", "title": "订单号" }, { "dataIndex": "order", "title": "订单号" },

23
src/pages/system-log/walletLog.tsx

@ -1,6 +1,6 @@
import api from "@/api" import api from "@/api"
import MyTable from "@/components/MyTable" import MyTable from "@/components/MyTable"
import { Input } from "antd"
import { Input, Select } from "antd"
import React, { useRef } from "react" import React, { useRef } from "react"
const WalletLog = () => { const WalletLog = () => {
@ -48,6 +48,22 @@ const WalletLog = () => {
}, },
]; ];
const options = [
{ "value": 0, "label": "全部" },
{ "value": 1, "label": "现金钱包->资产账户" },
{ "value": 2, "label": "会员转账" },
{ "value": 3, "label": "资产账户->现金钱包" },
{ "value": 4, "label": "交易利润" },
{ "value": 5, "label": "利润结算" },
{ "value": 6, "label": "盈利分红" },
{ "value": 7, "label": "交易佣金" },
{ "value": 8, "label": "星级奖励" },
{ "value": 9, "label": "超级奖励" },
{ "value": 10, "label": "存款" },
{ "value": 11, "label": "取款" },
{ "value": 12, "label": "admin" },
{ "value": 13, "label": "admin-加减资金" },
]
return ( return (
<div> <div>
@ -59,6 +75,11 @@ const WalletLog = () => {
key: 'search', key: 'search',
name: 'search', name: 'search',
slot: <Input style={{ minWidth: 350 }} placeholder="请输入MT账号搜索" /> slot: <Input style={{ minWidth: 350 }} placeholder="请输入MT账号搜索" />
}, {
key: 'type',
name: 'type',
initialValue: 0,
slot: <Select style={{ minWidth: 200 }} placeholder="" options={options} />
}]} }]}
/> />
</div> </div>

2
src/pages/vip-manage/proxy-list.tsx

@ -4,6 +4,7 @@ import MyTable from "@/components/MyTable";
import { DeleteFilled, EditOutlined, RightCircleFilled, SolutionOutlined, StopTwoTone } from "@ant-design/icons"; import { DeleteFilled, EditOutlined, RightCircleFilled, SolutionOutlined, StopTwoTone } from "@ant-design/icons";
import { Button, Form, Input, Modal, Popconfirm, Radio, Select, Switch, message, notification } from "antd"; import { Button, Form, Input, Modal, Popconfirm, Radio, Select, Switch, message, notification } from "antd";
import { getBaseUrl, getOriginUrl } from "@/utils/axios"; import { getBaseUrl, getOriginUrl } from "@/utils/axios";
import { exprotExcel } from "@/utils";
const ProxyList = () => { const ProxyList = () => {
const [modal, setModal] = useState(false); const [modal, setModal] = useState(false);
@ -233,6 +234,7 @@ const ProxyList = () => {
columns={columns} columns={columns}
ref={tableRef} ref={tableRef}
header={<div style={{ marginBottom: 20 }}> header={<div style={{ marginBottom: 20 }}>
<Button type="primary" onClick={() => exprotExcel(1)} style={{ marginRight: 20 }}>Excel</Button>
<Button type="primary" onClick={() => setVisible(true)}></Button> <Button type="primary" onClick={() => setVisible(true)}></Button>
</div>} </div>}
/> />

27
src/utils/index.ts

@ -1,5 +1,7 @@
import { notification } from 'antd'; import { notification } from 'antd';
import './axios' import './axios'
import { store } from '@/store';
import { log } from 'console';
export const splitAddress = (address: string, index?: number) => { export const splitAddress = (address: string, index?: number) => {
try { try {
@ -46,4 +48,29 @@ export function copy(value: string) {
notification.success({ notification.success({
message: '复制成功' message: '复制成功'
}) })
}
/**
* @description excel
* @param type 1. 2. 3. 4.
*/
export const exprotExcel = async (type: 1 | 2 | 3 | 4) => {
const urls = [
'admin/userExcel',
'admin/assetsExcel',
'admin/depositExcel',
'admin/withdrawExcel'
]
const { token = '' } = store.getState().storeData.userInfo || {}
const base_url = `${process.env.REACT_APP_BASE_URL}/api/v1/${urls[type - 1]}`;
const res = await fetch(base_url, {
headers: {
Token: token
},
method: 'get',
})
const blob = await res.blob()
const url = window.URL.createObjectURL(blob)
window.open(url)
} }
Loading…
Cancel
Save