|
@@ -1,109 +1,141 @@
|
|
|
-import { AlertOutlined, SearchOutlined } from "@ant-design/icons";
|
|
|
-import { PageContainer } from "@ant-design/pro-components"
|
|
|
-import { Affix, Alert, Button, Card, Col, DatePicker, Form, Input, Row, Space, Table, Tag, theme } from "antd"
|
|
|
-import moment from "moment";
|
|
|
-import { useEffect, useState } from "react";
|
|
|
-import Columns from "./tableConfig";
|
|
|
-import { useRequest } from "ahooks";
|
|
|
-import { getIncomeListApi } from "@/services/task-api/income";
|
|
|
-
|
|
|
-/**
|
|
|
- * 收益
|
|
|
- * @returns
|
|
|
- */
|
|
|
-const Income: React.FC = () => {
|
|
|
-
|
|
|
- /*****************************/
|
|
|
- const { useToken } = theme;
|
|
|
- const { token } = useToken();
|
|
|
- const [form] = Form.useForm()
|
|
|
- const [queryForm, setQueryForm] = useState<TASKAPI.IncomeList>({ pageNum: 1, pageSize: 20 })
|
|
|
- const getIncomeList = useRequest(getIncomeListApi, { manual: true })
|
|
|
- /*****************************/
|
|
|
-
|
|
|
- useEffect(() => {
|
|
|
- getIncomeList.runAsync(queryForm)
|
|
|
- }, [queryForm])
|
|
|
-
|
|
|
- const onFinish = (data: any) => {
|
|
|
- const { time, ...pre } = data
|
|
|
- let newQueryForm = JSON.parse(JSON.stringify(queryForm))
|
|
|
- newQueryForm.pageNum = 1
|
|
|
- if (time) {
|
|
|
- newQueryForm.startTime = moment(time[0]).format('YYYY-MM-DD')
|
|
|
- newQueryForm.endTime = moment(time[1]).format('YYYY-MM-DD')
|
|
|
- } else {
|
|
|
- delete newQueryForm?.startTime
|
|
|
- delete newQueryForm?.endTime
|
|
|
- }
|
|
|
- setQueryForm({ ...newQueryForm, ...pre })
|
|
|
- }
|
|
|
-
|
|
|
- return <PageContainer>
|
|
|
- <Card
|
|
|
- style={{ borderRadius: 8 }}
|
|
|
- bodyStyle={{ padding: 0 }}
|
|
|
- >
|
|
|
- <Space direction="vertical" style={{ width: '100%' }} size={0}>
|
|
|
- <Affix offsetTop={56}>
|
|
|
- <div style={{ backgroundColor: token.colorBgBase, padding: token.paddingContentHorizontalLG, borderRadius: 8, borderBottom: `1px solid ${token.colorBorderSecondary}` }}>
|
|
|
- <Form layout="inline" className='queryForm' name="Incomebasic" form={form} onFinish={onFinish}>
|
|
|
- <Row gutter={[0, 6]}>
|
|
|
- <Col>
|
|
|
- <Form.Item name='taskName'>
|
|
|
- <Input prefix={<SearchOutlined />} placeholder="搜索你发布的素材的任务名称" />
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
-
|
|
|
- <Col><Form.Item name='time'>
|
|
|
- <DatePicker.RangePicker style={{ width: 250 }} placeholder={['上传开始日期', '上传开始日期']} />
|
|
|
- </Form.Item></Col>
|
|
|
-
|
|
|
- <Col>
|
|
|
- <Space>
|
|
|
- <Button type="primary" htmlType="submit">搜索</Button>
|
|
|
- <Button onClick={() => form.resetFields()}>重置</Button>
|
|
|
- <Alert
|
|
|
- style={{ padding: `4px 12px` }}
|
|
|
- type="warning"
|
|
|
- showIcon
|
|
|
- icon={<AlertOutlined />}
|
|
|
- message="官方公告:收益结算请点击页面右上角头像“用户中心”查看!"
|
|
|
- />
|
|
|
- </Space>
|
|
|
- </Col>
|
|
|
- </Row>
|
|
|
- </Form>
|
|
|
- </div>
|
|
|
- </Affix>
|
|
|
-
|
|
|
- <div style={{ padding: token.paddingContentHorizontalLG }}>
|
|
|
- <Table
|
|
|
- columns={Columns()}
|
|
|
- dataSource={getIncomeList?.data?.data?.records}
|
|
|
- scroll={{ x: 1000 }}
|
|
|
- rowKey={(s) => {
|
|
|
- return s.id
|
|
|
- }}
|
|
|
- size='small'
|
|
|
- pagination={{
|
|
|
- total: 0,
|
|
|
- showTotal: (total) => <Tag color="cyan">总共{total}数据</Tag>,
|
|
|
- showSizeChanger: true,
|
|
|
- showLessItems: true,
|
|
|
- defaultCurrent: 1,
|
|
|
- defaultPageSize: 20,//默认初始的每页条数
|
|
|
- current: getIncomeList?.data?.data?.current || 1,
|
|
|
- pageSize: getIncomeList?.data?.data?.size || 20,
|
|
|
- onChange: (page, pageSize) => {
|
|
|
- setQueryForm({ ...queryForm, pageNum: page, pageSize })
|
|
|
- }
|
|
|
- }}
|
|
|
- />
|
|
|
- </div>
|
|
|
- </Space>
|
|
|
- </Card>
|
|
|
- </PageContainer>
|
|
|
-}
|
|
|
-
|
|
|
-export default Income
|
|
|
+import { getIncomeListApi } from '@/services/task-api/income';
|
|
|
+import { AlertOutlined, SearchOutlined } from '@ant-design/icons';
|
|
|
+import { PageContainer } from '@ant-design/pro-components';
|
|
|
+import { useRequest } from 'ahooks';
|
|
|
+import {
|
|
|
+ Affix,
|
|
|
+ Alert,
|
|
|
+ Button,
|
|
|
+ Card,
|
|
|
+ Col,
|
|
|
+ DatePicker,
|
|
|
+ Form,
|
|
|
+ Input,
|
|
|
+ Row,
|
|
|
+ Space,
|
|
|
+ Table,
|
|
|
+ Tag,
|
|
|
+ theme,
|
|
|
+} from 'antd';
|
|
|
+import moment from 'moment';
|
|
|
+import { useEffect, useState } from 'react';
|
|
|
+import Columns from './tableConfig';
|
|
|
+
|
|
|
+/**
|
|
|
+ * 收益
|
|
|
+ * @returns
|
|
|
+ */
|
|
|
+const Income: React.FC = () => {
|
|
|
+ /*****************************/
|
|
|
+ const { useToken } = theme;
|
|
|
+ const { token } = useToken();
|
|
|
+ const [form] = Form.useForm();
|
|
|
+ const [queryForm, setQueryForm] = useState<TASKAPI.IncomeList>({ pageNum: 1, pageSize: 20 });
|
|
|
+ const getIncomeList = useRequest(getIncomeListApi, { manual: true });
|
|
|
+ /*****************************/
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ getIncomeList.runAsync(queryForm);
|
|
|
+ }, [queryForm]);
|
|
|
+
|
|
|
+ const onFinish = (data: any) => {
|
|
|
+ const { time, ...pre } = data;
|
|
|
+ let newQueryForm = JSON.parse(JSON.stringify(queryForm));
|
|
|
+ newQueryForm.pageNum = 1;
|
|
|
+ if (time) {
|
|
|
+ newQueryForm.startTime = moment(time[0]).format('YYYY-MM-DD');
|
|
|
+ newQueryForm.endTime = moment(time[1]).format('YYYY-MM-DD');
|
|
|
+ } else {
|
|
|
+ delete newQueryForm?.startTime;
|
|
|
+ delete newQueryForm?.endTime;
|
|
|
+ }
|
|
|
+ setQueryForm({ ...newQueryForm, ...pre });
|
|
|
+ };
|
|
|
+
|
|
|
+ return (
|
|
|
+ <PageContainer>
|
|
|
+ <Card style={{ borderRadius: 8 }} bodyStyle={{ padding: 0 }}>
|
|
|
+ <Space direction="vertical" style={{ width: '100%' }} size={0}>
|
|
|
+ <Affix offsetTop={56}>
|
|
|
+ <div
|
|
|
+ style={{
|
|
|
+ backgroundColor: token.colorBgBase,
|
|
|
+ padding: token.paddingContentHorizontalLG,
|
|
|
+ borderRadius: 8,
|
|
|
+ borderBottom: `1px solid ${token.colorBorderSecondary}`,
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <Form
|
|
|
+ layout="inline"
|
|
|
+ className="queryForm"
|
|
|
+ name="Incomebasic"
|
|
|
+ form={form}
|
|
|
+ onFinish={onFinish}
|
|
|
+ >
|
|
|
+ <Row gutter={[0, 6]}>
|
|
|
+ <Col>
|
|
|
+ <Form.Item name="taskName">
|
|
|
+ <Input prefix={<SearchOutlined />} placeholder="搜索素材作品对应的任务名称" />
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
+
|
|
|
+ <Col>
|
|
|
+ <Form.Item name="time">
|
|
|
+ <DatePicker.RangePicker
|
|
|
+ style={{ width: 250 }}
|
|
|
+ placeholder={['上传开始日期', '上传开始日期']}
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
+
|
|
|
+ <Col>
|
|
|
+ <Space>
|
|
|
+ <Button type="primary" htmlType="submit">
|
|
|
+ 搜索
|
|
|
+ </Button>
|
|
|
+ <Button onClick={() => form.resetFields()}>重置</Button>
|
|
|
+ <Alert
|
|
|
+ style={{ padding: `4px 12px` }}
|
|
|
+ type="warning"
|
|
|
+ showIcon
|
|
|
+ icon={<AlertOutlined />}
|
|
|
+ message="官方公告:收益结算请点击页面右上角头像“用户中心”查看!"
|
|
|
+ />
|
|
|
+ </Space>
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
+ </Form>
|
|
|
+ </div>
|
|
|
+ </Affix>
|
|
|
+
|
|
|
+ <div style={{ padding: token.paddingContentHorizontalLG }}>
|
|
|
+ <Table
|
|
|
+ columns={Columns()}
|
|
|
+ dataSource={getIncomeList?.data?.data?.records}
|
|
|
+ scroll={{ x: 1000 }}
|
|
|
+ rowKey={(s) => {
|
|
|
+ return s.id;
|
|
|
+ }}
|
|
|
+ size="small"
|
|
|
+ pagination={{
|
|
|
+ total: 0,
|
|
|
+ showTotal: (total) => <Tag color="cyan">总共{total}数据</Tag>,
|
|
|
+ showSizeChanger: true,
|
|
|
+ showLessItems: true,
|
|
|
+ defaultCurrent: 1,
|
|
|
+ defaultPageSize: 20, //默认初始的每页条数
|
|
|
+ current: getIncomeList?.data?.data?.current || 1,
|
|
|
+ pageSize: getIncomeList?.data?.data?.size || 20,
|
|
|
+ onChange: (page, pageSize) => {
|
|
|
+ setQueryForm({ ...queryForm, pageNum: page, pageSize });
|
|
|
+ },
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </Space>
|
|
|
+ </Card>
|
|
|
+ </PageContainer>
|
|
|
+ );
|
|
|
+};
|
|
|
+
|
|
|
+export default Income;
|