From 0492623a3273e6dff21854bcd71e4ea8200b1b88 Mon Sep 17 00:00:00 2001 From: YCC Date: Fri, 29 Mar 2024 16:49:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=8D=E9=A6=88=E8=A1=A8=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 + package.json | 4 +- src/stores/Report.js | 2 +- src/views/report/Index.jsx | 346 ++++++++++++++++++++++++++++++------- 4 files changed, 290 insertions(+), 64 deletions(-) diff --git a/README.md b/README.md index 1df0fcf..e6b1bab 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,8 @@ antd https://ant-design.antgroup.com/components/upload-cn#uploadfile 国内供应商平台 http://p.mycht.cn/index.aspx 文档预览 https://github.com/cyntler/react-doc-viewer wps的文档预览 https://wwo.wps.cn/docs/front-end/introduction/quick-start +pdf生成 https://github.com/ivmarcos/react-to-pdf +react-pdf https://react-pdf.org ## 阿里云OSS Bucket 名称:global-highlights-hub diff --git a/package.json b/package.json index 1a7b137..098a5ef 100644 --- a/package.json +++ b/package.json @@ -9,12 +9,14 @@ "preview": "vite preview" }, "dependencies": { + "@react-pdf/renderer": "^3.4.0", "antd": "^5.4.2", "mobx": "^6.9.0", "mobx-react": "^7.6.0", "react": "^18.2.0", "react-dom": "^18.2.0", - "react-router-dom": "^6.10.0" + "react-router-dom": "^6.10.0", + "react-to-pdf": "^1.0.1" }, "devDependencies": { "@types/react": "^18.0.28", diff --git a/src/stores/Report.js b/src/stores/Report.js index f37787c..2b7befc 100644 --- a/src/stores/Report.js +++ b/src/stores/Report.js @@ -28,7 +28,7 @@ class Report { getHWVendorScores(VEI_SN, StartDate, EndDate) { this.loading = true; //HT_HOST + const fetchUrl = prepareUrl("http://202.103.68.231:889/service-cusservice/PTGetHWVendorScores") - .append("VEI_SN", 1) + .append("VEI_SN", 32865) .append("StartDate", StartDate) .append("EndDate", EndDate) .append("StrDEI_SN", "(,-1,)") diff --git a/src/views/report/Index.jsx b/src/views/report/Index.jsx index 4f56b49..f87522c 100644 --- a/src/views/report/Index.jsx +++ b/src/views/report/Index.jsx @@ -2,63 +2,21 @@ import { NavLink } from "react-router-dom"; import { useEffect, useState } from "react"; import { observer } from "mobx-react"; import { toJS } from "mobx"; -import { Row, Col, Space, Button, Table, Divider, Typography, Badge, List, DatePicker } from "antd"; +import { Row, Col, Space, Button, Table, Divider, Typography, List, Descriptions, DatePicker, Card } from "antd"; import { useStore } from "@/stores/StoreContext.js"; import * as config from "@/config"; import * as comm from "@/utils/commons"; import dayjs from "dayjs"; +import { usePDF } from "react-to-pdf"; -const { Title, Paragraph, Text } = Typography; +const { Title } = Typography; function Index() { const { reportStore, authStore } = useStore(); const { search_date_start, search_date_end, vendorScoresData, productScoresData, commendScoresData } = reportStore; - + const evaluationScores = vendorScoresData.EvaluationScores ? vendorScoresData.EvaluationScores[0] : []; useEffect(() => {}, []); - const columns_primary = [ - { - title: "Groups", - dataIndex: "Groups", - key: "Groups", - }, - { - title: "Number of People", - dataIndex: "PersonNum", - key: "PersonNum", - }, - { - title: "Transaction Amount(USD)", - dataIndex: "AmountUSD", - key: "AmountUSD", - }, - { - title: "Evaluation Score", - dataIndex: "EvaluationScore", - key: "EvaluationScore", - }, - { - title: "TP Reviews", - dataIndex: "TPReviews", - key: "TPReviews", - }, - { - title: "TP Reviews Rate", - dataIndex: "TPReviewRate", - key: "TPReviewRate", - }, - { - title: "Complaints", - dataIndex: "Complaints", - key: "Complaints", - }, - { - title: "Complaint Rate", - dataIndex: "ComplaintRate", - key: "ComplaintRate", - }, - ]; - const columns_month = [ { title: "Date", @@ -202,7 +160,7 @@ function Index() { key: "GRI_NO", }, { - title: "投诉对象", + title: "对象", dataIndex: "ObjectName", key: "ObjectName", }, @@ -251,9 +209,19 @@ function Index() { }, ]; + const { toPDF, targetRef } = usePDF({ + method: "save", + filename: "GHH-Report.pdf", + page: { margin: "3", format: "letter" }, //margin: Margin.SMALL, + canvas: { mimeType: "image/jpeg", qualityRatio: 1 }, + overrides: { pdf: { compress: true }, canvas: { useCORS: true } }, + }); + return ( - + + <div></div> + @@ -293,35 +261,289 @@ function Index() { Get Report - + + + - + + - Primary Data - + + {evaluationScores.Groups} + {evaluationScores.PersonNum} + {evaluationScores.AmountUSD} + {evaluationScores.EvaluationScore} + {evaluationScores.TPReviews} + {evaluationScores.TPReviewRate} + {evaluationScores.Complaints} + {evaluationScores.ComplaintRate} + - Monthly Data + Monthly Data
- 地接考核分数 -
+ + 地接考核分数 Final Scores: + + {evaluationScores.FinalScores} + + +
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Customer Satisfaction + + 3 scores + + 4 scores + + 5 scores + + Your Scores + + Final Scores + + 备注 +
TP review rating\30%60%{evaluationScores.TPReviewRating} + {evaluationScores.AvgCusSatisfaction} + {evaluationScores.TPReviewRatingText}
Post tour complaints100{evaluationScores.PostTourComplaints}{evaluationScores.PostTourComplaintsText}
Complaints resolved during the tour + 3 + {evaluationScores.ComplaintsDuringTour}{evaluationScores.ComplaintsDuringTourText}
Customer photos\30%50%{evaluationScores.CustomerPhotoRate}{evaluationScores.CustomerPhotoRateText}
Evaluation scores + 4.5 + {evaluationScores.EvaluationFormScore}{evaluationScores.EvaluationFormScoreText}
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Operator Support & Local resources + + 3 scores + + 4 scores + + 5 scores + + Your Scores + + Final Scores + + 备注 +
Response efficiency1d6hrs3hrs{evaluationScores.ResponseEfficiency} + {evaluationScores.AvgLocalResources} + {evaluationScores.ResponseEfficiencyText}
Provide suggestions and alternatives\{evaluationScores.ProvideSuggestions}{evaluationScores.ProvideSuggestionsText}
Provide local tourism information\{evaluationScores.ProvideLocalInfo}{evaluationScores.ProvideLocalInfoText}
Assist in developing exclusive products\\{evaluationScores.ExclusiveProducts}{evaluationScores.ExclusiveProductsText}
Dedicated tour guide team for AH\{evaluationScores.DedicatedTourGuide}{evaluationScores.DedicatedTourGuideText}
Partner hotels with contracted rate\{evaluationScores.PartnerHotels}{evaluationScores.PartnerHotelsText}
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Pricing & Settlement (20%) + + 3 scores + + 4 scores + + 5 scores + + Your Scores + + Final Scores + + 备注 +
QuotationPackageDay toursIndividual services{evaluationScores.Quotation} + {evaluationScores.AvgPricingAndSettlement} + {evaluationScores.QuotationText}
SettlementPrepaymentMonthly PrepaymentMonthly settlement after the tours{evaluationScores.Settlement}{evaluationScores.SettlementText}
Cancellation policy30 days21 days1 day{evaluationScores.CancellationPolicy}{evaluationScores.CancellationPolicyText}
+ + + + + + +
+ Scoring Rules} bordered> + 1. The maximum score is 5 + + 2. The three categories are: + + 1). Customer satisfaction (40%) + 2). Operator support & local resources (40%) + 3). Pricing & settlement (20%) + + + 3. For each category, you can only get the corresponding score if you meet the standards of all items under the score. + 4. The final score is the sum of the scores of each category multiplied by the proportion of the category. + - 导游接待情况 + 导游接待情况 - - 表扬情况 + + + 表扬情况
- - 投诉情况 + + + 投诉情况
- - 批评建议 + + + 批评建议