perf: report loading

feature/price_manager
Lei OT 1 year ago
parent 5ef8c9a72f
commit 877a020dc0

@ -32,7 +32,7 @@ export const useReportStore = create(
}; };
const { errcode, ...Result } = await fetchJSON(`${HT_HOST}/service-cusservice/PTGetHWVendorScores`, searchParams); const { errcode, ...Result } = await fetchJSON(`${HT_HOST}/service-cusservice/PTGetHWVendorScores`, searchParams);
setVendorScoresData(errcode === 0 ? Result : {}); setVendorScoresData(errcode === 0 ? Result : {});
setLoading(false); // setLoading(false);
}, },
async getHWProductScores(VEI_SN, StartDate, EndDate) { async getHWProductScores(VEI_SN, StartDate, EndDate) {
const { setLoading, setProductScoresData } = get(); const { setLoading, setProductScoresData } = get();
@ -62,7 +62,7 @@ export const useReportStore = create(
}; };
const { errcode, ...Result } = await fetchJSON(`${HT_HOST}/service-cusservice/PTGetHWCommendScores`, searchParams); const { errcode, ...Result } = await fetchJSON(`${HT_HOST}/service-cusservice/PTGetHWCommendScores`, searchParams);
setCommendScoresData(errcode === 0 ? Result : {}); setCommendScoresData(errcode === 0 ? Result : {});
setLoading(false); // setLoading(false);
}, },
})) }))
); );

@ -1,4 +1,4 @@
import { Row, Col, Space, Button, Table, Divider, Typography } from 'antd'; import { Row, Col, Space, Button, Table, Divider, Typography, } from 'antd';
import * as comm from '@/utils/commons'; import * as comm from '@/utils/commons';
import { usePDF } from 'react-to-pdf'; import { usePDF } from 'react-to-pdf';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
@ -9,7 +9,7 @@ import useReportStore from '@/stores/Report';
function Index() { function Index() {
const [travelAgencyId, ] = useAuthStore((state) => [state.loginUser.travelAgencyId]); const [travelAgencyId, ] = useAuthStore((state) => [state.loginUser.travelAgencyId]);
const [vendorScoresData, getHWVendorScores] = useReportStore((state) => [state.vendorScoresData, state.getHWVendorScores]); const [loading, vendorScoresData, getHWVendorScores] = useReportStore((state) => [state.loading, state.vendorScoresData, state.getHWVendorScores]);
const [productScoresData, getHWProductScores] = useReportStore((state) => [state.productScoresData, state.getHWProductScores]); const [productScoresData, getHWProductScores] = useReportStore((state) => [state.productScoresData, state.getHWProductScores]);
const [commendScoresData, getHWCommendScores] = useReportStore((state) => [state.commendScoresData, state.getHWCommendScores]); const [commendScoresData, getHWCommendScores] = useReportStore((state) => [state.commendScoresData, state.getHWCommendScores]);
@ -300,7 +300,6 @@ function Index() {
<Button onClick={() => toPDF()}>Download PDF</Button> <Button onClick={() => toPDF()}>Download PDF</Button>
</Col> </Col>
</Row> </Row>
<Row ref={targetRef}> <Row ref={targetRef}>
<Col md={24} lg={24} xxl={16}> <Col md={24} lg={24} xxl={16}>
<Divider orientation='center'> <Divider orientation='center'>
@ -308,7 +307,7 @@ function Index() {
Primary Data Primary Data
</Typography.Title> </Typography.Title>
</Divider> </Divider>
<Table dataSource={primaryData} columns={columns_primary} pagination={false} bordered /> <Table loading={loading} dataSource={primaryData} columns={columns_primary} pagination={false} bordered />
</Col> </Col>
<Col md={24} lg={24} xxl={16}> <Col md={24} lg={24} xxl={16}>
@ -317,7 +316,7 @@ function Index() {
Monthly Data Monthly Data
</Typography.Title> </Typography.Title>
</Divider> </Divider>
<Table dataSource={vendorScoresData.MonthlyData} columns={columns_month} pagination={false} bordered /> <Table loading={loading} dataSource={vendorScoresData.MonthlyData} columns={columns_month} pagination={false} bordered />
</Col> </Col>
<Col md={24} lg={24} xxl={16}> <Col md={24} lg={24} xxl={16}>

Loading…
Cancel
Save