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

333 lines
7.3 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, vendorScoresData, productScoresData, commendScoresData } = reportStore;
2 years ago
useEffect(() => {}, []);
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 columns_guide = [
{
title: "导游",
dataIndex: "TGI2_Name",
key: "TGI2_Name",
},
{
title: "平均分",
dataIndex: "VAverage",
key: "VAverage",
},
{
title: "接团数",
dataIndex: "ReceptionGroups",
key: "ReceptionGroups",
},
{
title: "表扬数",
dataIndex: "CommendNum",
key: "CommendNum",
},
{
title: "表扬率",
dataIndex: "CommendRate",
key: "CommendRate",
},
{
title: "投诉数",
dataIndex: "Complaints",
key: "Complaints",
},
{
title: "投诉率",
dataIndex: "ComplaintRate",
key: "ComplaintRate",
},
];
const columns_commend = [
{
title: "团号",
dataIndex: "GRI_NO",
key: "GRI_NO",
},
{
title: "投诉对象",
dataIndex: "ObjectName",
key: "ObjectName",
},
{
title: "客人评论",
dataIndex: "ECI_Content",
key: "ECI_Content",
},
];
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={() => {
reportStore.getHWVendorScores(
authStore.login.travelAgencyId,
search_date_start == null ? null : search_date_start.format(config.DATE_FORMAT),
search_date_end == null ? null : search_date_end.format(config.DATE_FORMAT)
);
reportStore.getHWProductScores(
authStore.login.travelAgencyId,
search_date_start == null ? null : search_date_start.format(config.DATE_FORMAT),
search_date_end == null ? null : search_date_end.format(config.DATE_FORMAT)
);
reportStore.getHWCommendScores(
authStore.login.travelAgencyId,
search_date_start == null ? null : search_date_start.format(config.DATE_FORMAT),
search_date_end == null ? null : search_date_end.format(config.DATE_FORMAT)
);
}}>
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={vendorScoresData.PrimaryData} columns={columns_primary} pagination={false} bordered />
2 years ago
</Col>
<Col md={24} lg={24} xxl={24}>
<Divider>Monthly Data</Divider>
<Table dataSource={vendorScoresData.MonthlyData} columns={columns_month} pagination={false} bordered />
2 years ago
</Col>
<Col md={24} lg={24} xxl={24}>
<Divider>地接考核分数</Divider>
<Table dataSource={dataSource_dmc} columns={columns_dmc} pagination={false} bordered />
</Col>
<Col md={24} lg={24} xxl={24}>
<Divider>导游接待情况</Divider>
<Table dataSource={productScoresData.GuideScores} columns={columns_guide} pagination={false} bordered />
<Divider>表扬情况</Divider>
<Table dataSource={commendScoresData.CommendScores} columns={columns_commend} pagination={false} bordered />
<Divider>投诉情况</Divider>
<Table dataSource={commendScoresData.ComplaintScores} columns={columns_commend} pagination={false} bordered />
<Divider>批评建议</Divider>
<Table dataSource={commendScoresData.CriticizeScores} columns={columns_commend} pagination={false} bordered />
</Col>
</Row>
</Space>
);
}
export default observer(Index);