You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
GHHub/src/views/report/Index.jsx

272 lines
5.5 KiB
React

import { NavLink } from "react-router-dom";
import { useEffect, useState } from "react";
import { observer } from "mobx-react";
import { toJS } from "mobx";
2 years ago
import { Row, Col, Space, Button, Table, Divider, Typography, Badge, List, DatePicker } from "antd";
import { useStore } from "@/stores/StoreContext.js";
import * as config from "@/config";
import * as comm from "@/utils/commons";
import dayjs from "dayjs";
const { Title, Paragraph, Text } = Typography;
function Index() {
const { reportStore, authStore } = useStore();
const { search_date_start, search_date_end } = reportStore;
2 years ago
useEffect(() => {}, []);
const dataSource = [
{
key: "1",
name: "Groups",
age: 32,
address: "西湖区湖底公园1号",
},
{
key: "2",
name: "胡彦祖",
age: 42,
address: "西湖区湖底公园1号",
},
];
const columns_primary = [
{
title: "Groups",
dataIndex: "Groups",
key: "Groups",
},
{
title: "Number of People",
2 years ago
dataIndex: "PersonNum",
key: "PersonNum",
2 years ago
},
{
title: "Transaction AmountUSD)",
2 years ago
dataIndex: "AmountUSD",
key: "AmountUSD",
2 years ago
},
{
title: "Evaluation Score",
2 years ago
dataIndex: "EvaluationScore",
key: "EvaluationScore",
2 years ago
},
{
title: "TP Reviews",
2 years ago
dataIndex: "TPReviews",
key: "TPReviews",
2 years ago
},
{
title: "TP Reviews Rate",
2 years ago
dataIndex: "TPReviewRate",
key: "TPReviewRate",
2 years ago
},
{
title: "Complaints",
dataIndex: "Complaints",
key: "Complaints",
},
{
title: "Complaint Rate",
2 years ago
dataIndex: "ComplaintRate",
key: "ComplaintRate",
2 years ago
},
];
const columns_month = [
{
title: "Date",
2 years ago
dataIndex: "VMonth",
key: "VMonth",
2 years ago
},
{
title: "Groups",
2 years ago
dataIndex: "GroupsNum",
key: "GroupsNum",
2 years ago
},
{
title: "Number of People",
2 years ago
dataIndex: "PersonNum",
key: "PersonNum",
2 years ago
},
{
title: "Transaction AmountUSD)",
2 years ago
dataIndex: "AmountUSD",
key: "AmountUSD",
2 years ago
},
{
title: "Evaluation Score",
2 years ago
dataIndex: "EvaluationScore",
key: "EvaluationScore",
2 years ago
},
{
title: "TP Reviews",
2 years ago
dataIndex: "TPReviews",
key: "TPReviews",
2 years ago
},
{
title: "TP Reviews Rate",
2 years ago
dataIndex: "TPReviewRate",
key: "TPReviewRate",
2 years ago
},
{
title: "Complaints",
dataIndex: "Complaints",
key: "Complaints",
},
{
title: "Complaint Rate",
2 years ago
dataIndex: "ComplaintRate",
key: "ComplaintRate",
2 years ago
},
];
const columns_dmc = [
{
title: "Category",
dataIndex: "Category",
key: "Category",
onCell: (_, index) => {
if (index === 0) {
return {
2 years ago
rowSpan: 3,
//colSpan:0,
};
}
if (index >= 1 && index <= 2) {
return {
rowSpan: 0,
colSpan: 0,
2 years ago
};
}
},
},
{
title: "Item",
dataIndex: "Item",
key: "Item",
},
{
title: "Your Scores",
dataIndex: "Your Scores",
key: "Your Scores",
},
{
title: "Final Scores",
dataIndex: "Final Scores",
key: "Final Scores",
2 years ago
onCell: (_, index) => {
if (index === 0) {
return {
rowSpan: 5, //合并五行
//colSpan: 5,
};
} else {
return {
rowSpan: 0, //不显示其他数据
colSpan: 0,
};
}
},
2 years ago
},
];
const dataSource_dmc = [
{
key: "1",
2 years ago
Category: "Category1",
Item: "Item1",
"Your Scores": "Your Scores1",
"Final Scores": "Final Scores1",
2 years ago
},
{
key: "2",
2 years ago
Category: "Category2",
Item: "Item2",
"Your Scores": "Your Scores2",
"Final Scores": "Final Scores2",
2 years ago
},
{
key: "3",
2 years ago
Category: "Category3",
Item: "Item3",
"Your Scores": "Your Scores3",
"Final Scores": "Final Scores3",
2 years ago
},
{
key: "4",
2 years ago
Category: "Category4",
Item: "Item4",
"Your Scores": "Your Scores4",
"Final Scores": "Final Scores4",
2 years ago
},
{
key: "5",
2 years ago
Category: "Category5",
Item: "Item5",
"Your Scores": "Your Scores5",
"Final Scores": "Final Scores5",
2 years ago
},
];
return (
<Space direction="vertical" style={{ width: "100%" }}>
<Title level={3}></Title>
<Row gutter={16}>
<Col md={24} lg={8} xxl={6}>
<Space direction="horizontal">
Select Date
<DatePicker.RangePicker
format={config.DATE_FORMAT_MONTH}
allowClear={true}
style={{ width: "100%" }}
defaultValue={[search_date_start, search_date_end]}
onChange={reportStore.onDateRangeChange}
allowEmpty={true}
picker="month"
/>
</Space>
</Col>
<Col md={24} lg={4} xxl={4}>
<Button
type="primary"
loading={reportStore.loading}
// onClick={() =>
// invoiceStore.fetchInvoiceList(
// authStore.login.travelAgencyId,
// groupNo,
// search_date_start == null ? null : search_date_start.format(config.DATE_FORMAT),
// search_date_end == null ? null : search_date_end.format(config.DATE_FORMAT),
// OrderType
// )
// }
>
Get Report
</Button>
</Col>
<Col md={24} lg={10} xxl={11}></Col>
</Row>
<Title level={3}></Title>
<Row>
2 years ago
<Col md={24} lg={24} xxl={24}>
<Divider>Primary Data</Divider>
<Table dataSource={dataSource} columns={columns_primary} pagination={false} bordered />
</Col>
<Col md={24} lg={24} xxl={24}>
<Divider>Monthly Data</Divider>
<Table dataSource={dataSource} columns={columns_month} pagination={false} bordered />
</Col>
<Col md={24} lg={24} xxl={24}>
<Divider>地接考核分数</Divider>
<Table dataSource={dataSource_dmc} columns={columns_dmc} pagination={false} bordered />
</Col>
</Row>
</Space>
);
}
export default observer(Index);