거래내역 엑셀 다운로드
This commit is contained in:
@@ -16,7 +16,9 @@ import {
|
||||
CashReceiptSummaryParams,
|
||||
CashReceiptListResponse,
|
||||
CashReceiptSummaryResponse,
|
||||
DetailData
|
||||
DetailData,
|
||||
CashReceiptExcelDownloadParams,
|
||||
CashReceiptExcelDownloadResponse
|
||||
} from '@/entities/transaction/model/types';
|
||||
import { useCashReceiptListMutation } from '@/entities/transaction/api/use-cash-receipt-list-mutation';
|
||||
import { DEFAULT_PAGE_PARAM } from '@/entities/common/model/constant';
|
||||
@@ -38,6 +40,7 @@ import { CashReceiptDetail } from '@/entities/transaction/ui/detail/cash-receit-
|
||||
import { checkGrant } from '@/shared/lib/check-grant';
|
||||
import { showAlert } from '@/widgets/show-alert';
|
||||
import { snackBar } from '@/shared/lib';
|
||||
import { useCashReceiptExcelDownloadMutation } from '@/entities/transaction/api/use-cash-receipt-excel-download-mutation';
|
||||
|
||||
/* 현금영수증 32 */
|
||||
const menuId = 32;
|
||||
@@ -80,6 +83,8 @@ export const CashReceiptListPage = () => {
|
||||
|
||||
const { mutateAsync: cashReceiptList } = useCashReceiptListMutation();
|
||||
const { mutateAsync: cashReceiptSummary } = useCashReceiptSummaryMutation();
|
||||
const { mutateAsync: cashReceiptExcelDownload } = useCashReceiptExcelDownloadMutation();
|
||||
|
||||
const onIntersect: IntersectionObserverCallback = (entries: Array<IntersectionObserverEntry>) => {
|
||||
entries.forEach((entry: IntersectionObserverEntry) => {
|
||||
if(entry.isIntersecting){
|
||||
@@ -176,7 +181,29 @@ export const CashReceiptListPage = () => {
|
||||
selectedMode: DownloadSelectedMode,
|
||||
userEmail?: string
|
||||
) => {
|
||||
|
||||
if(selectedMode === DownloadSelectedMode.EMAIL
|
||||
&& !!userEmail
|
||||
){
|
||||
let params: CashReceiptExcelDownloadParams = {
|
||||
email: userEmail,
|
||||
mid: mid,
|
||||
startDate: startDate,
|
||||
endDate: endDate,
|
||||
purposeType: purposeType,
|
||||
transactionType: transactionType,
|
||||
processResult: processResult
|
||||
};
|
||||
|
||||
cashReceiptExcelDownload(params).then((rs: CashReceiptExcelDownloadResponse) => {
|
||||
console.log(rs);
|
||||
snackBar('이메일로 엑셀파일 요청이 완료되었습니다.');
|
||||
}).catch((e: any) => {
|
||||
if(e.response?.data?.error?.message){
|
||||
snackBar(e.response?.data?.error?.message);
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user