mid 셋팅및 코드 정리
This commit is contained in:
@@ -17,6 +17,7 @@ import { SortOptionsBox } from '@/entities/additional-service/ui/sort-options-bo
|
||||
import { useExtensionKeyinListMutation } from '@/entities/additional-service/api/use-extension-keyin-list-mutation';
|
||||
import { DEFAULT_PAGE_PARAM } from '@/entities/common/model/constant';
|
||||
import { KeyInPaymentList } from '@/entities/additional-service/ui/key-in-payment/key-in-payment-list';
|
||||
import { useStore } from '@/shared/model/store';
|
||||
|
||||
// contant로 옮기기
|
||||
const requestStatusBtnGroup = [
|
||||
@@ -28,13 +29,13 @@ const requestStatusBtnGroup = [
|
||||
|
||||
export const KeyInPaymentPage = () => {
|
||||
const { navigate } = useNavigate();
|
||||
|
||||
const userMid = useStore.getState().UserStore.mid;
|
||||
|
||||
const [sortBy, setSortBy] = useState<SortByKeys>(SortByKeys.New);
|
||||
const [listItems, setListItems] = useState({});
|
||||
const [filterOn, setFilterOn] = useState<boolean>(false);
|
||||
const [pageParam, setPageParam] = useState(DEFAULT_PAGE_PARAM);
|
||||
const [mid, setMid] = useState<string>('nictest00m');
|
||||
const [mid, setMid] = useState<string>(userMid);
|
||||
const [startDate, setStartDate] = useState(moment().format('YYYY-MM-DD'));
|
||||
const [endDate, setEndDate] = useState(moment().format('YYYY-MM-DD'));
|
||||
const [transactionStatus, setTransactionStatus] = useState<KeyInPaymentTransactionStatus>(KeyInPaymentTransactionStatus.ALL)
|
||||
@@ -59,11 +60,11 @@ export const KeyInPaymentPage = () => {
|
||||
pageParam.sortBy = (option?.sortBy) ? option.sortBy : sortBy;
|
||||
setPageParam(pageParam);
|
||||
let newMinAmount = minAmount;
|
||||
if (!!minAmount && typeof (minAmount) === 'string') {
|
||||
if(!!minAmount && typeof (minAmount) === 'string'){
|
||||
newMinAmount = parseInt(minAmount);
|
||||
}
|
||||
let newMaxAmount = maxAmount;
|
||||
if (!!maxAmount && typeof (maxAmount) === 'string') {
|
||||
if(!!maxAmount && typeof (maxAmount) === 'string'){
|
||||
newMaxAmount = parseInt(maxAmount);
|
||||
}
|
||||
let listParams = {
|
||||
@@ -76,7 +77,7 @@ export const KeyInPaymentPage = () => {
|
||||
page: pageParam
|
||||
};
|
||||
|
||||
console.log("Request Info: ", listParams)
|
||||
console.log('Request Info: ', listParams);
|
||||
|
||||
keyinList(listParams).then((rs) => {
|
||||
setListItems(assembleData(rs.content));
|
||||
@@ -84,21 +85,21 @@ export const KeyInPaymentPage = () => {
|
||||
}
|
||||
|
||||
const assembleData = (content: Array<KeyInPaymentListItem>) => {
|
||||
console.log('rs.content:', content)
|
||||
console.log('rs.content:', content);
|
||||
let data: any = {};
|
||||
if (content && content.length > 0) {
|
||||
for (let i = 0; i < content?.length; i++) {
|
||||
for(let i = 0; i < content?.length; i++){
|
||||
let paymentDate = content[i]?.paymentDate?.substring(0, 8);
|
||||
let groupDate = moment(paymentDate).format('YYYYMMDD');
|
||||
if (!!groupDate && !data.hasOwnProperty(groupDate)) {
|
||||
if(!!groupDate && !data.hasOwnProperty(groupDate)){
|
||||
data[groupDate] = [];
|
||||
}
|
||||
if (!!groupDate && data.hasOwnProperty(groupDate)) {
|
||||
if(!!groupDate && data.hasOwnProperty(groupDate)){
|
||||
data[groupDate].push(content[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log('Data : ', data)
|
||||
console.log('Data : ', data);
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -109,11 +110,11 @@ export const KeyInPaymentPage = () => {
|
||||
|
||||
const onClickToDownloadExcel = () => {
|
||||
let newMinAmount = minAmount;
|
||||
if (!!minAmount && typeof (minAmount) === 'string') {
|
||||
if(!!minAmount && typeof (minAmount) === 'string'){
|
||||
newMinAmount = parseInt(minAmount);
|
||||
}
|
||||
let newMaxAmount = maxAmount;
|
||||
if (!!maxAmount && typeof (maxAmount) === 'string') {
|
||||
if(!!maxAmount && typeof (maxAmount) === 'string'){
|
||||
newMaxAmount = parseInt(maxAmount);
|
||||
}
|
||||
downloadExcel({
|
||||
@@ -124,7 +125,7 @@ export const KeyInPaymentPage = () => {
|
||||
minAmount: newMinAmount,
|
||||
maxAmount: newMaxAmount
|
||||
}).then((rs) => {
|
||||
console.log('Excel Dowload Status : ' + rs.status)
|
||||
console.log('Excel Dowload Status : ' + rs.status);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -134,9 +135,11 @@ export const KeyInPaymentPage = () => {
|
||||
};
|
||||
|
||||
const onClickToTransactionStatus = (val: KeyInPaymentTransactionStatus) => {
|
||||
console.log("TransactionStatus Test: ", val)
|
||||
console.log('TransactionStatus Test: ', val);
|
||||
setTransactionStatus(val);
|
||||
callList({ val: val });
|
||||
callList({
|
||||
val: val
|
||||
});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user