정산내역 엑셀다운로드
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
import moment from 'moment';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { NumericFormat } from 'react-number-format';
|
||||
import { IMAGE_ROOT } from '@/shared/constants/common';
|
||||
import { ListDateGroup } from './list-date-group';
|
||||
import { PATHS } from '@/shared/constants/paths';
|
||||
import { useNavigate } from '@/shared/lib/hooks/use-navigate';
|
||||
import { DEFAULT_PAGE_PARAM } from '@/entities/common/model/constant';
|
||||
import { SortTypeBox } from '@/entities/common/ui/sort-type-box';
|
||||
@@ -21,14 +19,14 @@ import {
|
||||
SettlementPeriodType,
|
||||
SettlementPaymentMethod,
|
||||
SettlementsHistoryContent,
|
||||
ListDateGroupProps,
|
||||
SettlementsTransactionListContent,
|
||||
SettlementsHistoryParams,
|
||||
SettlementsHistoryResponse,
|
||||
SettlementsHistorySummaryParams,
|
||||
SettlementsHistorySummaryResponse,
|
||||
SettlementsTransactionSummaryParams,
|
||||
DetailData
|
||||
DetailData,
|
||||
SettlementsHistoryExcelParams
|
||||
} from '../model/types';
|
||||
import { DefaultRequestPagination, SortTypeKeys } from '@/entities/common/model/types';
|
||||
import { useStore } from '@/shared/model/store';
|
||||
@@ -39,6 +37,8 @@ import { SettlementDetail } from './detail/settlement-detail';
|
||||
import { showAlert } from '@/widgets/show-alert';
|
||||
import { checkGrant } from '@/shared/lib/check-grant';
|
||||
import { snackBar } from '@/shared/lib';
|
||||
import { useSettlementsHistoryExcelMutation } from '../api/use-settlements-history-excel-mutation';
|
||||
import { VatReturnDownloadExcelResponse } from '@/entities/vat-return/model/types';
|
||||
|
||||
export interface ListWrapProps {
|
||||
startDateFromCalendar?: string;
|
||||
@@ -91,6 +91,7 @@ export const ListWrap = ({
|
||||
const { mutateAsync: settlementsHistorySummary} = useSettlementsHistorySummaryMutation();
|
||||
const { mutateAsync: settlementsTransactionList } = useSettlementsTransactionListMutation();
|
||||
const { mutateAsync: settlementsTransactionSummary } = useSettlementsTransactionSummaryMutation();
|
||||
const { mutateAsync: settlementsHistoryExcel } = useSettlementsHistoryExcelMutation();
|
||||
|
||||
const callList = (type?: string) => {
|
||||
setOnActionIntersect(false);
|
||||
@@ -397,7 +398,27 @@ export const ListWrap = ({
|
||||
selectedMode: DownloadSelectedMode,
|
||||
userEmail?: string
|
||||
) => {
|
||||
|
||||
if(selectedMode === DownloadSelectedMode.EMAIL
|
||||
&& !!userEmail
|
||||
){
|
||||
let params: SettlementsHistoryExcelParams = {
|
||||
email: userEmail,
|
||||
mid: mid,
|
||||
periodType: periodType,
|
||||
startDate: startDate,
|
||||
endDate: endDate,
|
||||
paymentMethod: paymentMethod
|
||||
};
|
||||
settlementsHistoryExcel(params).then((rs: VatReturnDownloadExcelResponse) => {
|
||||
console.log(rs);
|
||||
snackBar('이메일로 엑셀파일 요청이 완료되었습니다.');
|
||||
}).catch((e: any) => {
|
||||
if(e.response?.data?.error?.message){
|
||||
snackBar(e.response?.data?.error?.message);
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user