diff --git a/src/components/Data.jsx b/src/components/Data.jsx index d067a63..cf4a29b 100644 --- a/src/components/Data.jsx +++ b/src/components/Data.jsx @@ -10,14 +10,15 @@ import { isEmpty, getNestedValue } from "../utils/commons"; * @property data1 * @property data2 */ -export const VSTag = (props) => { - const { diffPercent, diffData, data1, data2 } = props; +export const VSTag = ({ diffPercent, diffData, ...props }) => { const CaretIcon = parseInt(diffPercent) < 0 ? CaretDownOutlined : CaretUpOutlined; const tagColor = parseInt(diffPercent) < 0 ? 'gold' : 'lime'; - return parseInt(diffPercent) === 0 ? ( - '-' + return diffData===undefined ? null : parseInt(diffPercent) === 0 ? ( + + -%{' '}{diffData} + ) : ( - + {/*
{data1} vs {data2}
*/} @@ -48,7 +49,7 @@ export const TableExportBtn = (props) => { ); // .filter((c) => c.dataIndex) // !['string', 'number'].includes(typeof vc.title) ? `${v?.titleX || v.title}` : `${v?.titleX || v.title}-${vc.title || ''}` - ; + // ; setColumnsMap(flatCols); // console.log('flatCols', flatCols); diff --git a/src/components/SearchForm.jsx b/src/components/SearchForm.jsx index 9aedd7b..b94010d 100644 --- a/src/components/SearchForm.jsx +++ b/src/components/SearchForm.jsx @@ -54,6 +54,12 @@ const SearchForm = ({ initialValue, onSubmit, onReset, onMounted, confirmText, f { key: "starttime", transform: arrVal => (arrVal ? arrVal[0].format(DATE_FORMAT) : "") }, { key: "endtime", transform: arrVal => (arrVal ? arrVal[1].format(SMALL_DATETIME_FORMAT) : "") }, ], + datesDiff: [ + { key: "datesDiff1", transform: arrVal => (arrVal ? arrVal[0].format(DATE_FORMAT) : "") }, + { key: "datesDiff2", transform: arrVal => (arrVal ? arrVal[1].endOf('month').format(SMALL_DATETIME_FORMAT) : "") }, + { key: "timeDiff1", transform: arrVal => (arrVal ? arrVal[0].format(DATE_FORMAT) : "") }, + { key: "timeDiff2", transform: arrVal => (arrVal ? arrVal[1].format(SMALL_DATETIME_FORMAT) : "") }, + ], invoiceStatus: { key: "invoiceStatus", transform: value => value?.value || value?.key || "", default: "" }, invoiceCheckStatus: { key: "invoiceCheckStatus", transform: value => value?.value || value?.key || "", default: "" }, audit_state: { key: "audit_state", transform: value => value?.value || value?.key || "", default: "" }, @@ -87,7 +93,7 @@ const SearchForm = ({ initialValue, onSubmit, onReset, onMounted, confirmText, f unconfirmed: { key: "unconfirmed", transform: value => (value ? 1 : 0) }, }; let dest = {}; - const { dates, ...omittedValue } = values; + const { dates, datesDiff, ...omittedValue } = values; dest = { ...omittedValue, ...objectMapper(values, destinationObject) }; for (const key in dest) { if (Object.prototype.hasOwnProperty.call(dest, key)) { @@ -252,10 +258,15 @@ function getFields(props) { item( "dates", //时间日期 99, - - {/* */} - - , + + + + + { fieldProps?.dates?.hide_vs === false && + + + } + , fieldProps?.dates?.col || midCol ), item( diff --git a/src/stores/Report.js b/src/stores/Report.js index f68d154..1814bc7 100644 --- a/src/stores/Report.js +++ b/src/stores/Report.js @@ -8,6 +8,10 @@ const initialState = { vendorScoresData: [], //地接统计数据集,合计数据,每月数据,地接考核分数 productScoresData: [], //产品体验分析 常用酒店分析, 导游接待情况 commendScoresData: [], //表扬情况, 投诉情况, 评建议 + + vendorScoresDataDiff: [], + productScoresDataDiff: [], + commendScoresDataDiff: [], }; export const useReportStore = create( devtools((set, get) => ({ @@ -19,8 +23,12 @@ export const useReportStore = create( setProductScoresData: (productScoresData) => set({ productScoresData }), setCommendScoresData: (commendScoresData) => set({ commendScoresData }), - async getHWVendorScores(VEI_SN, StartDate, EndDate) { - const { setLoading, setVendorScoresData } = get(); + setVendorScoresDataDiff: (vendorScoresDataDiff) => set({ vendorScoresDataDiff }), + setProductScoresDataDiff: (productScoresDataDiff) => set({ productScoresDataDiff }), + setCommendScoresDataDiff: (commendScoresDataDiff) => set({ commendScoresDataDiff }), + + async getHWVendorScores(VEI_SN, StartDate, EndDate, isCompare = false) { + const { setLoading, setVendorScoresData, setVendorScoresDataDiff } = get(); setLoading(true); const searchParams = { VEI_SN, @@ -30,12 +38,13 @@ export const useReportStore = create( OrderType: '-1', GroupType: '-1', }; - const { errcode, ...Result } = await fetchJSON(`${HT_HOST}/service-cusservice/PTGetHWVendorScores`, searchParams); - setVendorScoresData(errcode === 0 ? Result : {}); + const { errcode, errmsg, ...Result } = await fetchJSON(`${HT_HOST}/service-cusservice/PTGetHWVendorScores`, searchParams); + if(isCompare===false) setVendorScoresData(errcode === 0 ? Result : {}); + else setVendorScoresDataDiff(errcode === 0 ? Result : {}); // setLoading(false); }, - async getHWProductScores(VEI_SN, StartDate, EndDate) { - const { setLoading, setProductScoresData } = get(); + async getHWProductScores(VEI_SN, StartDate, EndDate, isCompare = false) { + const { setLoading, setProductScoresData, setProductScoresDataDiff } = get(); setLoading(true); const searchParams = { VEI_SN, @@ -45,12 +54,13 @@ export const useReportStore = create( OrderType: '-1', GroupType: '-1', }; - const { errcode, ...Result } = await fetchJSON(`${HT_HOST}/service-cusservice/PTGetHWProductScores`, searchParams); - setProductScoresData(errcode === 0 ? Result : {}); + const { errcode, errmsg, ...Result } = await fetchJSON(`${HT_HOST}/service-cusservice/PTGetHWProductScores`, searchParams); + if(isCompare===false) setProductScoresData(errcode === 0 ? Result : {}); + else setProductScoresDataDiff(errcode === 0 ? Result : {}); setLoading(false); }, - async getHWCommendScores(VEI_SN, StartDate, EndDate) { - const { setLoading, setCommendScoresData } = get(); + async getHWCommendScores(VEI_SN, StartDate, EndDate, isCompare = false) { + const { setLoading, setCommendScoresData, setCommendScoresDataDiff } = get(); setLoading(true); const searchParams = { VEI_SN, @@ -60,8 +70,9 @@ export const useReportStore = create( OrderType: '-1', GroupType: '-1', }; - const { errcode, ...Result } = await fetchJSON(`${HT_HOST}/service-cusservice/PTGetHWCommendScores`, searchParams); - setCommendScoresData(errcode === 0 ? Result : {}); + const { errcode, errmsg, ...Result } = await fetchJSON(`${HT_HOST}/service-cusservice/PTGetHWCommendScores`, searchParams); + if(isCompare===false) setCommendScoresData(errcode === 0 ? Result : {}); + else setCommendScoresDataDiff(errcode === 0 ? Result : {}); // setLoading(false); }, }), { name: 'reportStore'}) diff --git a/src/views/report/Index.jsx b/src/views/report/Index.jsx index f8bb02d..ec926ca 100644 --- a/src/views/report/Index.jsx +++ b/src/views/report/Index.jsx @@ -6,32 +6,51 @@ import SearchForm from '@/components/SearchForm'; import useReportStore from '@/stores/Report'; import { useTranslation } from 'react-i18next' import { usingStorage } from '@/hooks/usingStorage'; +import { VSTag } from '@/components/Data'; +import { DATE_FORMAT } from '@/config'; function Index() { const { t } = useTranslation(); const {travelAgencyId, } = usingStorage(); - const [loading, vendorScoresData, getHWVendorScores] = useReportStore((state) => [state.loading, state.vendorScoresData, state.getHWVendorScores]); - const [productScoresData, getHWProductScores] = useReportStore((state) => [state.productScoresData, state.getHWProductScores]); - const [commendScoresData, getHWCommendScores] = useReportStore((state) => [state.commendScoresData, state.getHWCommendScores]); + const [loading, setLoading, reset] = useReportStore((state) => [state.loading, state.setLoading, state.reset]); + const [vendorScoresData, vendorScoresDataDiff, getHWVendorScores] = useReportStore((state) => [state.vendorScoresData, state.vendorScoresDataDiff, state.getHWVendorScores]); + const [productScoresData, productScoresDataDiff, getHWProductScores] = useReportStore((state) => [state.productScoresData, state.productScoresDataDiff, state.getHWProductScores]); + const [commendScoresData, commendScoresDataDiff, getHWCommendScores] = useReportStore((state) => [state.commendScoresData, state.commendScoresDataDiff, state.getHWCommendScores]); - const evaluationScores = vendorScoresData.EvaluationScores ? vendorScoresData.EvaluationScores[0] : []; + const evaluationScores = vendorScoresData.EvaluationScores ? vendorScoresData.EvaluationScores[0] : {}; + const evaluationScoresDiff = vendorScoresDataDiff.EvaluationScores ? vendorScoresDataDiff.EvaluationScores[0] : {}; const primaryData = vendorScoresData.EvaluationScores ? [comm.pick(vendorScoresData.EvaluationScores[0], ['Groups', 'PersonNum', 'AmountUSD', 'EvaluationScore', 'TPReviews', 'TPReviewRate', 'Complaints', 'ComplaintRate'])] : []; + let MonthlyData = vendorScoresData.MonthlyData || []; + if (vendorScoresData.EvaluationScores && !comm.isEmpty(vendorScoresDataDiff)) { + primaryData[0].diff = vendorScoresDataDiff.EvaluationScores + ? comm.pick(vendorScoresDataDiff.EvaluationScores[0], ['Groups', 'PersonNum', 'AmountUSD', 'EvaluationScore', 'TPReviews', 'TPReviewRate', 'Complaints', 'ComplaintRate']) + : {}; + MonthlyData = MonthlyData.map((row, ri) => ({...row, diff: vendorScoresDataDiff.MonthlyData[ri]})) + } + + const guideData = (productScoresData?.GuideScores || []).reduce((a, row) => ({...a, [row.key]: row}), {}); + const guideDataDiff = (productScoresDataDiff?.GuideScores || []).reduce((a, row) => ({...a, [row.key]: row}), {}); + if (productScoresData.GuideScores && !comm.isEmpty(productScoresDataDiff)) { + Object.keys(guideData).forEach(key => { + guideData[key].diff = guideDataDiff[key]; + }) + } const evaluationScoresData = [ - { category: 'DMC Services', item: 'Guide', value: evaluationScores.FRTGuide, note: evaluationScores.FRTText }, - { category: 'DMC Services', item: 'Driver & Vehicle', value: evaluationScores.FRTGriver }, - { category: 'DMC Services', item: 'Food Arrangement', value: evaluationScores.FRTMeal }, - { category: 'DMC Services', item: 'Activity', value: evaluationScores.FRTProduct }, - { category: 'Itinerary Arrangements', item: 'Hotel', value: evaluationScores.FRTHotel, }, - { category: 'Itinerary Arrangements', item: 'Travel Advisor’s Planning', value: evaluationScores.FRTAdvisor }, + { category: 'DMC Services', item: 'Guide', value: evaluationScores.FRTGuide, note: evaluationScores.FRTText, diff: { value: evaluationScoresDiff?.FRTGuide } }, + { category: 'DMC Services', item: 'Driver & Vehicle', value: evaluationScores.FRTGriver, diff: { value: evaluationScoresDiff?.FRTGriver } }, + { category: 'DMC Services', item: 'Food Arrangement', value: evaluationScores.FRTMeal, diff: { value: evaluationScoresDiff?.FRTMeal } }, + { category: 'DMC Services', item: 'Activity', value: evaluationScores.FRTProduct, diff: { value: evaluationScoresDiff?.FRTProduct } }, + { category: 'Itinerary Arrangements', item: 'Hotel', value: evaluationScores.FRTHotel, diff: { value: evaluationScoresDiff?.FRTHotel } }, + { category: 'Itinerary Arrangements', item: 'Travel Advisor’s Planning', value: evaluationScores.FRTAdvisor, diff: { value: evaluationScoresDiff?.FRTAdvisor } }, ]; const columns_evaluation = [ { title: 'Category', dataIndex: 'category', key: 'category',align: 'center', onCell: (_, index) => ({ rowSpan: index === 0 ? 4 : index === 4 ? 2 : 0 }) }, { title: 'Item', dataIndex: 'item', key: 'item', align: 'center' }, - { title: 'Your Scores', dataIndex: 'value', key: 'value',align: 'center', }, + { title: 'Your Scores', dataIndex: 'value', key: 'value',align: 'left', render: (text, { diff }) => <>{text} }, { title: 'Note', dataIndex: 'note', key: 'note',align: 'center', onCell: (_, index) => ({ rowSpan: index === 0 ? 7 : 0 })}, ]; @@ -40,8 +59,8 @@ function Index() { { title: '3 scores', dataIndex: 'stand_3', key: 'stand_3', align: 'center', onCell: (_, index) => ({ colSpan: (index === 2 || index===4) ? 3 : 1 }) }, { title: '4 scores', dataIndex: 'stand_4', key: 'stand_4',align: 'center',onCell: (_, index) => ({ colSpan: (index === 2 || index===4) ? 0 : 1 }) }, { title: '5 scores', dataIndex: 'stand_5', key: 'stand_5',align: 'center',onCell: (_, index) => ({ colSpan: (index === 2 || index===4) ? 0 : 1 }) }, - { title: 'Your Scores', dataIndex: 'value', key: 'value',align: 'center', }, - { title: 'Final Scores', dataIndex: 'final_score', key: 'final_score',align: 'center', onCell: (_, index) => ({ rowSpan: index === 0 ? 5 : 0 })}, + { title: 'Your Scores', dataIndex: 'value', key: 'value',align: 'center', render: (text, { diff }) => <>{text} }, + { title: 'Final Scores', dataIndex: 'final_score', key: 'final_score',align: 'center', onCell: (_, index) => ({ rowSpan: index === 0 ? 5 : 0 }), render: (text, { diff }) => <>{text} }, { title: 'Note', dataIndex: 'note', key: 'note',align: 'center', }, ]; const DMCData_customer_satisfaction = [ @@ -53,6 +72,10 @@ function Index() { value: evaluationScores.TPReviewRating, final_score: evaluationScores.AvgCusSatisfaction, note: evaluationScores.AvgCusSatisfaction, + diff: { + value: evaluationScoresDiff?.TPReviewRating, + final_score: evaluationScoresDiff?.AvgCusSatisfaction, + } }, { item: 'Post tour complaints', @@ -62,6 +85,9 @@ function Index() { value: evaluationScores.PostTourComplaints, // final_score: evaluationScores.AvgCusSatisfaction, note: evaluationScores.PostTourComplaintsText, + diff: { + value: evaluationScoresDiff?.PostTourComplaints, + } }, { item: 'Complaints resolved during the tour', @@ -70,9 +96,24 @@ function Index() { // stand_5: '0', value: evaluationScores.ComplaintsDuringTour, note: evaluationScores.ComplaintsDuringTourText, + diff: { + value: evaluationScoresDiff?.ComplaintsDuringTour, + } + }, + { item: 'Customer photos', stand_3: '\\', stand_4: '30%', stand_5: '50%', + value: evaluationScores.CustomerPhotoRate, + note: evaluationScores.CustomerPhotoRateText, + diff: { + value: evaluationScoresDiff?.CustomerPhotoRate, + } + }, + { item: 'Evaluation scores', stand_3: '4.5', + value: evaluationScores.EvaluationFormScore, + note: evaluationScores.EvaluationFormScoreText, + diff: { + value: evaluationScoresDiff?.EvaluationFormScore, + } }, - { item: 'Customer photos', stand_3: '\\', stand_4: '30%', stand_5: '50%', value: evaluationScores.CustomerPhotoRate, note: evaluationScores.CustomerPhotoRateText }, - { item: 'Evaluation scores', stand_3: '4.5', value: evaluationScores.EvaluationFormScore, note: evaluationScores.EvaluationFormScoreText }, ]; const columns_DMC_sopport_local = [ @@ -80,8 +121,8 @@ function Index() { { title: '3 scores', dataIndex: 'stand_3', key: 'stand_3', align: 'center', }, { title: '4 scores', dataIndex: 'stand_4', key: 'stand_4',align: 'center', }, { title: '5 scores', dataIndex: 'stand_5', key: 'stand_5',align: 'center', }, - { title: 'Your Scores', dataIndex: 'value', key: 'value',align: 'center', }, - { title: 'Final Scores', dataIndex: 'final_score', key: 'final_score',align: 'center', onCell: (_, index) => ({ rowSpan: index === 0 ? 6 : 0 })}, + { title: 'Your Scores', dataIndex: 'value', key: 'value',align: 'center', render: (text, { diff }) => <>{text} }, + { title: 'Final Scores', dataIndex: 'final_score', key: 'final_score',align: 'center', onCell: (_, index) => ({ rowSpan: index === 0 ? 6 : 0 }), render: (text, { diff }) => <>{text} }, { title: 'Note', dataIndex: 'note', key: 'note',align: 'center', }, ]; const DMCData_sopport_local = [ @@ -93,6 +134,10 @@ function Index() { value: evaluationScores.ResponseEfficiency, final_score: evaluationScores.AvgLocalResources, note: evaluationScores.ResponseEfficiencyText, + diff: { + value: evaluationScoresDiff?.ResponseEfficiency, + final_score: evaluationScoresDiff?.AvgLocalResources, + } }, { item: 'Provide suggestions and alternatives', @@ -102,6 +147,9 @@ function Index() { value: evaluationScores.ProvideSuggestions, // final_score: evaluationScores.AvgCusSatisfaction, note: evaluationScores.ProvideSuggestionsText, + diff: { + value: evaluationScoresDiff?.ProvideSuggestions, + } }, { item: 'Provide local tourism information', @@ -110,27 +158,48 @@ function Index() { stand_5: '√', value: evaluationScores.ProvideLocalInfo, note: evaluationScores.ProvideLocalInfoText, + diff: { + value: evaluationScoresDiff?.ProvideLocalInfo, + } }, { item: 'Assist in developing exclusive products', stand_3: '\\', stand_4: '\\', - stand_5: '√', value: evaluationScores.ExclusiveProducts, note: evaluationScores.ExclusiveProductsText }, + stand_5: '√', + value: evaluationScores.ExclusiveProducts, + note: evaluationScores.ExclusiveProductsText, + diff: { + value: evaluationScoresDiff?.ExclusiveProducts, + } + }, { item: 'Dedicated tour guide team for AH', stand_3: '\\', stand_4: '√', - stand_5: '√', value: evaluationScores.DedicatedTourGuide, note: evaluationScores.DedicatedTourGuideText }, + stand_5: '√', + value: evaluationScores.DedicatedTourGuide, + note: evaluationScores.DedicatedTourGuideText, + diff: { + value: evaluationScoresDiff?.DedicatedTourGuide, + } + }, { item: 'Partner hotels with contracted rate', stand_3: '\\', stand_4: '√', - stand_5: '√', value: evaluationScores.PartnerHotels, note: evaluationScores.PartnerHotelsText }, + stand_5: '√', + value: evaluationScores.PartnerHotels, + note: evaluationScores.PartnerHotelsText, + diff: { + value: evaluationScoresDiff?.PartnerHotels, + } + }, ]; const columns_DMC_pricing = [ { title: 'Pricing & Settlement (20%)', dataIndex: 'item', key: 'item',align: 'center', }, { title: '3 scores', dataIndex: 'stand_3', key: 'stand_3', align: 'center', }, { title: '4 scores', dataIndex: 'stand_4', key: 'stand_4',align: 'center', }, { title: '5 scores', dataIndex: 'stand_5', key: 'stand_5',align: 'center', }, - { title: 'Your Scores', dataIndex: 'value', key: 'value',align: 'center', }, - { title: 'Final Scores', dataIndex: 'final_score', key: 'final_score',align: 'center', onCell: (_, index) => ({ rowSpan: index === 0 ? 3 : 0 })}, + { title: 'Your Scores', dataIndex: 'value', key: 'value',align: 'center', render: (text, { diff }) => <>{text} }, + { title: 'Final Scores', dataIndex: 'final_score', key: 'final_score',align: 'center', onCell: (_, index) => ({ rowSpan: index === 0 ? 3 : 0 }), render: (text, { diff }) => <>{text} }, { title: 'Note', dataIndex: 'note', key: 'note',align: 'center', }, ]; const DMCData_pricing = [ @@ -142,6 +211,10 @@ function Index() { value: evaluationScores.Quotation, final_score: evaluationScores.AvgPricingAndSettlement, note: evaluationScores.QuotationText, + diff: { + value: evaluationScoresDiff?.Quotation, + final_score: evaluationScoresDiff?.AvgPricingAndSettlement, + }, }, { item: 'Settlement', @@ -150,6 +223,7 @@ function Index() { stand_5: 'Monthly settlement after the tours', value: evaluationScores.Settlement, note: evaluationScores.SettlementText, + diff: { value: evaluationScoresDiff?.Settlement }, }, { item: 'Cancellation policy', @@ -158,6 +232,7 @@ function Index() { stand_5: '1 day', value: evaluationScores.CancellationPolicy, note: evaluationScores.CancellationPolicyText, + diff: { value: evaluationScoresDiff?.CancellationPolicy }, },]; const columns_primary = [ @@ -165,48 +240,66 @@ function Index() { title: 'Groups', dataIndex: 'Groups', key: 'Groups', + render: (text, { diff }) => <>{text}, }, { title: 'Number of People', dataIndex: 'PersonNum', key: 'PersonNum', + render: (text, { diff }) => <>{text}, }, { title: 'Transaction Amount(USD)', dataIndex: 'AmountUSD', key: 'AmountUSD', - render: (value) => comm.formatPrice(value), + render: (value, { diff }) => <>{comm.formatPrice(value)}, + // }, { title: 'Evaluation Score', dataIndex: 'EvaluationScore', key: 'EvaluationScore', + render: (text, { diff }) => <>{text}, }, { title: 'TP Reviews', dataIndex: 'TPReviews', key: 'TPReviews', + render: (text, { diff }) => <>{text}, }, { title: 'TP Reviews Rate', dataIndex: 'TPReviewRate', key: 'TPReviewRate', - render: (value) => comm.formatPercent(value), + render: (text, { diff }) => <>{comm.formatPercent(text)}, }, { title: 'Complaints', dataIndex: 'Complaints', key: 'Complaints', + render: (text, { diff }) => <>{text}, }, { title: 'Complaint Rate', dataIndex: 'ComplaintRate', key: 'ComplaintRate', - render: (value) => comm.formatPercent(value), + render: (text, { diff }) => <>{comm.formatPercent(text)}, }, ]; - const columns_month = [{ title: 'Date', dataIndex: 'VMonth', key: 'VMonth' }, ...columns_primary]; + const columns_month = [ + { + title: 'Date', + dataIndex: 'VMonth', + key: 'VMonth', + render: (text, { diff }) => ( + <> + {text} {diff?.VMonth ? ` VS ${diff.VMonth}` : ''} + + ), + }, + ...columns_primary, + ]; const columns_guide = [ { @@ -218,33 +311,38 @@ function Index() { title: 'Average Scores', dataIndex: 'VAverage', key: 'VAverage', + render: (text, { diff }) => <>{text}, }, { title: 'Group Numbers', dataIndex: 'ReceptionGroups', key: 'ReceptionGroups', + render: (text, { diff }) => <>{text}, }, { title: 'TP Reviews', dataIndex: 'CommendNum', key: 'CommendNum', + render: (text, { diff }) => <>{text}, }, { title: 'TP Review Rate', dataIndex: 'CommendRate', key: 'CommendRate', - render: (value) => comm.formatPercent(value), + // render: (value) => comm.formatPercent(value), + render: (text, { diff }) => <>{comm.formatPercent(text)}, }, { title: 'Complaints', dataIndex: 'Complaints', key: 'Complaints', + render: (text, { diff }) => <>{text}, }, { title: 'Complaint Rate', dataIndex: 'ComplaintRate', key: 'ComplaintRate', - render: (value) => comm.formatPercent(value), + render: (text, { diff }) => <>{comm.formatPercent(text)}, }, ]; @@ -274,6 +372,22 @@ function Index() { overrides: { pdf: { compress: true }, canvas: { useCORS: true } }, }); + const onGetData = async (formVal) => { + reset(); + const fixDiff1 = dayjs(formVal.datesDiff1).startOf('month').format(DATE_FORMAT); + const res = await Promise.all([ + getHWVendorScores(formVal.agency || travelAgencyId, formVal.startdate, formVal.enddate), + getHWProductScores(formVal.agency || travelAgencyId, formVal.startdate, formVal.enddate), + getHWCommendScores(formVal.agency || travelAgencyId, formVal.startdate, formVal.enddate), + ...(comm.isEmpty(formVal.datesDiff1) ? [] : [ + getHWVendorScores(formVal.agency || travelAgencyId, fixDiff1, formVal.datesDiff2, true), + getHWProductScores(formVal.agency || travelAgencyId, fixDiff1, formVal.datesDiff2, true), + getHWCommendScores(formVal.agency || travelAgencyId, fixDiff1, formVal.datesDiff2, true) + ]) + ]); + setLoading(false); + }; + return ( {/* */} @@ -286,15 +400,14 @@ function Index() { fieldsConfig={{ shows: ['dates'], fieldProps: { - dates: { label: 'Select Date', col: 12 }, + dates: { label: 'Select Date', col: 12, hide_vs: false }, }, fieldComProps: { dates: { picker: 'month', presets: false } }, }} confirmText={t('vendor:report.GetReport')} onSubmit={(err, formVal, filedsVal) => { - getHWVendorScores(formVal.agency || travelAgencyId, formVal.startdate, formVal.enddate); - getHWProductScores(formVal.agency || travelAgencyId, formVal.startdate, formVal.enddate); - getHWCommendScores(formVal.agency || travelAgencyId, formVal.startdate, formVal.enddate); + // return false; + onGetData(formVal); }} /> @@ -318,7 +431,7 @@ function Index() { Monthly Data - +
@@ -334,7 +447,7 @@ function Index() {
- Final Scores: {evaluationScores.FinalScores} + Final Scores: {evaluationScores.FinalScores}{evaluationScoresDiff?.FinalScores ? <> : ''}
@@ -373,28 +486,28 @@ function Index() { Tour Guides Performence -
+
TP Reviews -
+
Complaints -
+
Suggestions from Customers -
+