diff --git a/src/utils/commons.js b/src/utils/commons.js index ce0d136..4b158f4 100644 --- a/src/utils/commons.js +++ b/src/utils/commons.js @@ -143,3 +143,12 @@ export function groupBy(array, callback) { return groups; }, {}); } + + +export function formatPrice(price) { + return Math.ceil(price).toLocaleString(); +} + +export function formatPercent(number) { + return Math.round(number * 100) + "%"; +} \ No newline at end of file diff --git a/src/views/report/Index.jsx b/src/views/report/Index.jsx index 73213db..7730e10 100644 --- a/src/views/report/Index.jsx +++ b/src/views/report/Index.jsx @@ -3,6 +3,7 @@ import { observer } from "mobx-react"; import { Row, Col, Space, Button, Table, Divider, Typography, DatePicker } from "antd"; import { useStore } from "@/stores/StoreContext.js"; import * as config from "@/config"; +import * as comm from "@/utils/commons"; import { usePDF } from "react-to-pdf"; function Index() { @@ -31,6 +32,7 @@ function Index() { title: "Transaction Amount(USD)", dataIndex: "AmountUSD", key: "AmountUSD", + render: (value) => comm.formatPrice(value), }, { title: "Evaluation Score", @@ -46,6 +48,7 @@ function Index() { title: "TP Reviews Rate", dataIndex: "TPReviewRate", key: "TPReviewRate", + render: (value) => comm.formatPercent(value), }, { title: "Complaints", @@ -56,60 +59,63 @@ function Index() { title: "Complaint Rate", dataIndex: "ComplaintRate", key: "ComplaintRate", + render: (value) => comm.formatPercent(value), }, ]; const columns_guide = [ { - title: "导游", + title: "Name", dataIndex: "TGI2_Name", key: "TGI2_Name", }, { - title: "平均分", + title: "Average Scores", dataIndex: "VAverage", key: "VAverage", }, { - title: "接团数", + title: "Group Numbers", dataIndex: "ReceptionGroups", key: "ReceptionGroups", }, { - title: "表扬数", + title: "TP Reviews", dataIndex: "CommendNum", key: "CommendNum", }, { - title: "表扬率", + title: "TP Review Rate", dataIndex: "CommendRate", key: "CommendRate", + render: (value) => comm.formatPercent(value), }, { - title: "投诉数", + title: "Complaints", dataIndex: "Complaints", key: "Complaints", }, { - title: "投诉率", + title: "Complaint Rate", dataIndex: "ComplaintRate", key: "ComplaintRate", + render: (value) => comm.formatPercent(value), }, ]; const columns_commend = [ { - title: "团号", + title: "Reference Number", dataIndex: "GRI_NO", key: "GRI_NO", }, { - title: "对象", + title: "Tour Guides", dataIndex: "ObjectName", key: "ObjectName", }, { - title: "客人评论", + title: "Essential Comments", dataIndex: "ECI_Content", key: "ECI_Content", }, @@ -195,12 +201,12 @@ function Index() {