sort 구조 변경

This commit is contained in:
focp212@naver.com
2025-10-24 16:49:46 +09:00
parent c0c983be1a
commit 8e27c42a2d
6 changed files with 35 additions and 107 deletions

View File

@@ -230,7 +230,7 @@ export const ListItem = ({
</div> </div>
<div className="transaction-amount"> <div className="transaction-amount">
<NumericFormat <NumericFormat
value={ goodsAmount } value={ goodsAmount || amount }
thousandSeparator thousandSeparator
displayType="text" displayType="text"
suffix={ '원' } suffix={ '원' }

View File

@@ -34,25 +34,22 @@ export const ListWrap = () => {
const { mutateAsync: vatReturnList } = useVatReturnListMutation(); const { mutateAsync: vatReturnList } = useVatReturnListMutation();
const callList = (option?: { const callList = () => {
sortType?: SortTypeKeys
}) => {
let params: VatReturnListParams = { let params: VatReturnListParams = {
mid: mid, mid: mid,
startMonth: startMonth, startMonth: startMonth,
endMonth: endMonth, endMonth: endMonth,
receiptType: receiptType, receiptType: receiptType,
targetType: targetType, targetType: targetType,
page: pageParam page: {
}; ...pageParam,
if(params.page){ ...{ sortType: sortType }
params.page.sortType = option?.sortType || sortType;
setPageParam(params.page);
} }
};
vatReturnList(params).then((rs: VatReturnListResponse) => { vatReturnList(params).then((rs: VatReturnListResponse) => {
setListItems(rs.content); setListItems(rs.content);
}); });
}; };
const onClickToOpenFIlter = () => { const onClickToOpenFIlter = () => {
@@ -72,7 +69,7 @@ export const ListWrap = () => {
callList(); callList();
}, [ }, [
mid, startMonth, endMonth, mid, startMonth, endMonth,
receiptType, targetType receiptType, targetType, sortType
]); ]);
const getListDateGroup = () => { const getListDateGroup = () => {

View File

@@ -74,17 +74,14 @@ export const AllTransactionListPage = () => {
const { mutateAsync: allTransactionListSummary } = useAllTransactionListSummaryMutation(); const { mutateAsync: allTransactionListSummary } = useAllTransactionListSummaryMutation();
const { mutateAsync: downloadExcel } = useDownloadExcelMutation(); const { mutateAsync: downloadExcel } = useDownloadExcelMutation();
const callList = (option?: { const callList = () => {
sortType?: SortTypeKeys,
val?: string
}) => {
let listSummaryParams: AllTransactionListSummaryParams = { let listSummaryParams: AllTransactionListSummaryParams = {
moid: moid, moid: moid,
tid: tid, tid: tid,
fromDate: fromDate, fromDate: fromDate,
toDate: toDate, toDate: toDate,
statusCode: statusCode, statusCode: statusCode,
serviceCode: option?.val || serviceCode, serviceCode: serviceCode,
minAmount: minAmount, minAmount: minAmount,
maxAmount: maxAmount, maxAmount: maxAmount,
dateCl: dateCl, dateCl: dateCl,
@@ -133,9 +130,6 @@ export const AllTransactionListPage = () => {
}; };
const onClickToSort = (sort: SortTypeKeys) => { const onClickToSort = (sort: SortTypeKeys) => {
setSortType(sort); setSortType(sort);
callList({
sortType: sort
});
}; };
const callServiceCodeOptions = () => { const callServiceCodeOptions = () => {
let serviceCodes = useStore.getState().CommonStore.serviceCodes; let serviceCodes = useStore.getState().CommonStore.serviceCodes;
@@ -147,9 +141,6 @@ export const AllTransactionListPage = () => {
let val = e.target.value; let val = e.target.value;
// onchagne 에서 useState가 즉시 반영 안되므로 값을 직접 바로 넘긴다. // onchagne 에서 useState가 즉시 반영 안되므로 값을 직접 바로 넘긴다.
setServiceCode(val); setServiceCode(val);
callList({
val: val
});
}; };
const getServiceCodeOptions = () => { const getServiceCodeOptions = () => {
@@ -173,7 +164,7 @@ export const AllTransactionListPage = () => {
useEffect(() => { useEffect(() => {
callList(); callList();
}, [ }, [
mid, moid, tid, mid, moid, tid, sortType,
fromDate, toDate, fromDate, toDate,
statusCode, serviceCode, statusCode, serviceCode,
minAmount, maxAmount, minAmount, maxAmount,

View File

@@ -63,18 +63,7 @@ export const BillingListPage = () => {
const { mutateAsync: billingList } = useBillingListMutation(); const { mutateAsync: billingList } = useBillingListMutation();
const { mutateAsync: downloadExcel } = useDownloadExcelMutation(); const { mutateAsync: downloadExcel } = useDownloadExcelMutation();
const callList = (option?: { const callList = () => {
sortType?: SortTypeKeys,
val?: string
}) => {
let newMinAmount = minAmount;
if(!!minAmount && typeof(minAmount) === 'string'){
newMinAmount = parseInt(minAmount);
}
let newMaxAmount = maxAmount;
if(!!maxAmount && typeof(maxAmount) === 'string'){
newMaxAmount = parseInt(maxAmount);
}
let listParams: BillingListParams = { let listParams: BillingListParams = {
mid: mid, mid: mid,
searchType: searchType, searchType: searchType,
@@ -84,15 +73,13 @@ export const BillingListPage = () => {
requestStatus: requestStatus, requestStatus: requestStatus,
processResult: processResult, processResult: processResult,
paymentMethod: paymentMethod, paymentMethod: paymentMethod,
minAmount: newMinAmount, minAmount: minAmount,
maxAmount: newMaxAmount, maxAmount: maxAmount,
page: pageParam page: {
}; ...pageParam,
...{ sortType: sortType }
if(listParams.page){
listParams.page.sortType = option?.sortType || sortType;
setPageParam(listParams.page);
} }
};
billingList(listParams).then((rs: BillingListResponse) => { billingList(listParams).then((rs: BillingListResponse) => {
setListItems(rs.content); setListItems(rs.content);
@@ -107,30 +94,21 @@ export const BillingListPage = () => {
}; };
const onClickToSort = (sort: SortTypeKeys) => { const onClickToSort = (sort: SortTypeKeys) => {
setSortType(sort); setSortType(sort);
callList({
sortType: sort
});
}; };
const onClickToRequestStatus = (val: BillingRequestStatus) => { const onClickToRequestStatus = (val: BillingRequestStatus) => {
setRequestStatus(val); setRequestStatus(val);
callList({
val: val
});
}; };
const onRequestDownload = (userEmail?: string) => { const onRequestDownload = (userEmail?: string) => {
}; };
useEffect(() => {
callList();
}, []);
useEffect(() => { useEffect(() => {
callList(); callList();
}, [ }, [
mid, searchType, searchKeyword, mid, searchType, searchKeyword,
startDate, endDate, startDate, endDate, sortType,
requestStatus, processResult, paymentMethod, requestStatus, processResult, paymentMethod,
minAmount, maxAmount minAmount, maxAmount
]); ]);

View File

@@ -69,16 +69,13 @@ export const CashReceiptListPage = () => {
const { mutateAsync: cashReceiptSummary } = useCashReceiptSummaryMutation(); const { mutateAsync: cashReceiptSummary } = useCashReceiptSummaryMutation();
const { mutateAsync: downloadExcel } = useDownloadExcelMutation(); const { mutateAsync: downloadExcel } = useDownloadExcelMutation();
const callList = (option?: { const callList = () => {
sortType?: SortTypeKeys,
val?: CashReceiptTransactionType
}) => {
let listSummaryParams: CashReceiptSummaryParams = { let listSummaryParams: CashReceiptSummaryParams = {
mid: mid, mid: mid,
startDate: startDate, startDate: startDate,
endDate: endDate, endDate: endDate,
purposeType: purposeType, purposeType: purposeType,
transactionType: option?.val || transactionType, transactionType: transactionType,
processResult: processResult, processResult: processResult,
searchNumberType: searchNumberType, searchNumberType: searchNumberType,
searchNumber: searchNumber, searchNumber: searchNumber,
@@ -86,16 +83,12 @@ export const CashReceiptListPage = () => {
}; };
let listParams: CashReceiptListParams = { let listParams: CashReceiptListParams = {
...listSummaryParams, ...listSummaryParams,
...{ page: {
page: pageParam ...pageParam,
...{ sortType: sortType }
} }
}; };
if(listParams.page){
listParams.page.sortType = option?.sortType || sortType;
setPageParam(listParams.page);
}
cashReceiptList(listParams).then((rs: CashReceiptListResponse) => { cashReceiptList(listParams).then((rs: CashReceiptListResponse) => {
setListItems(rs.content); setListItems(rs.content);
}); });
@@ -126,25 +119,16 @@ export const CashReceiptListPage = () => {
}; };
const onClickToSort = (sort: SortTypeKeys) => { const onClickToSort = (sort: SortTypeKeys) => {
setSortType(sort); setSortType(sort);
callList({
sortType: sort
});
}; };
const onClickToTransactionType = (val: CashReceiptTransactionType) => { const onClickToTransactionType = (val: CashReceiptTransactionType) => {
setTransactionType(val); setTransactionType(val);
callList({
val: val
});
}; };
useEffect(() => {
callList();
}, []);
useEffect(() => { useEffect(() => {
callList(); callList();
}, [ }, [
mid, startDate, endDate, mid, startDate, endDate, sortType,
purposeType, transactionType, processResult, purposeType, transactionType, processResult,
searchNumberType, searchNumber searchNumberType, searchNumber
]); ]);

View File

@@ -61,18 +61,7 @@ export const EscrowListPage = () => {
const { mutateAsync: escrowList } = useEscrowListMutation(); const { mutateAsync: escrowList } = useEscrowListMutation();
const { mutateAsync: downloadExcel } = useDownloadExcelMutation(); const { mutateAsync: downloadExcel } = useDownloadExcelMutation();
const callList = (option?: { const callList = () => {
sortType?: SortTypeKeys,
val?: string
}) => {
let newMinAmount = minAmount;
if(!!minAmount && typeof(minAmount) === 'string'){
newMinAmount = parseInt(minAmount);
}
let newMaxAmount = maxAmount;
if(!!maxAmount && typeof(maxAmount) === 'string'){
newMaxAmount = parseInt(maxAmount);
}
let listParams: EscrowListParams = { let listParams: EscrowListParams = {
mid: mid, mid: mid,
searchType: 'ORDER_NUMBER', searchType: 'ORDER_NUMBER',
@@ -81,15 +70,13 @@ export const EscrowListPage = () => {
endDate: endDate, endDate: endDate,
deliveryStatus: deliveryStatus, deliveryStatus: deliveryStatus,
settlementStatus: settlementStatus, settlementStatus: settlementStatus,
minAmount: newMinAmount, minAmount: minAmount,
maxAmount: newMaxAmount, maxAmount: maxAmount,
page: pageParam page: {
}; ...pageParam,
...{ sortType: sortType }
if(listParams.page){
listParams.page.sortType = option?.sortType || sortType;
setPageParam(listParams.page);
} }
};
escrowList(listParams).then((rs: EscrowListResponse) => { escrowList(listParams).then((rs: EscrowListResponse) => {
setListItems(rs.content); setListItems(rs.content);
@@ -114,26 +101,17 @@ export const EscrowListPage = () => {
}; };
const onClickToSort = (sort: SortTypeKeys) => { const onClickToSort = (sort: SortTypeKeys) => {
setSortType(sort); setSortType(sort);
callList({
sortType: sort
});
}; };
const onClickToDeliveryStatus = (val: EscrowDeliveryStatus) => { const onClickToDeliveryStatus = (val: EscrowDeliveryStatus) => {
setDeliveryStatus(val); setDeliveryStatus(val);
callList({
val: val
});
}; };
useEffect(() => {
callList();
}, []);
useEffect(() => { useEffect(() => {
callList(); callList();
}, [ }, [
mid, searchType, searchKeyword, mid, searchType, searchKeyword,
startDate, endDate, startDate, endDate, sortType,
deliveryStatus, settlementStatus, deliveryStatus, settlementStatus,
minAmount, maxAmount minAmount, maxAmount
]); ]);