battle event 조회조건 처리

This commit is contained in:
2025-02-13 14:42:07 +09:00
parent 513ea114cc
commit ffaaa5be14
5 changed files with 108 additions and 54 deletions

View File

@@ -3,10 +3,10 @@
import { Axios } from '../utils';
// 전투시스템 리스트 조회
export const BattleEventView = async (token, landType, landData, userType, userData, landSize, status, startDate, endDate, order, size, currentPage) => {
export const BattleEventView = async (token, searchType, searchData, configId, rewardId, repeatType, status, roundCount, hotTime, startDate, endDate, order, size, currentPage) => {
try {
const res = await Axios.get(
`/api/v1/battle/event/list?land_type=${landType}&land_data=${landData}&user_type=${userType}&user_data=${userData}&land_size=${landSize}&status=${status}&start_dt=${startDate}&end_dt=${endDate}&orderby=${order}&page_no=${currentPage}
`/api/v1/battle/event/list?search_type=${searchType}&search_data=${searchData}&config_id=${configId}&reward_id=${rewardId}&repeat_type=${repeatType}&status=${status}&round_count=${roundCount}&hot_time=${hotTime}&start_dt=${startDate}&end_dt=${endDate}&orderby=${order}&page_no=${currentPage}
&page_size=${size}`,
{
headers: { Authorization: `Bearer ${token}` },

View File

@@ -195,4 +195,12 @@ export const battleRepeatType = [
{ value: 'THURSDAY', name: 'Week-목' },
{ value: 'FRIDAY', name: 'Week-금' },
{ value: 'SATURDAY', name: 'Week-토' },
];
];
export const eventSearchType = [
{ value: 'ID', name: '이벤트 ID' },
{ value: 'NAME', name: '이벤트명' },
];
export const battleEventRoundCount = [1,2,3,4,8,12,16];
export const battleEventHotTime = [1,2,3,4,5,6,7,8];

View File

@@ -33,7 +33,12 @@ import { NONE, TYPE_MODIFY, TYPE_REGISTRY } from '../../../assets/data/adminCons
import { landAuctionStatus, landAuctionStatusType, languageType, CurrencyType } from '../../../assets/data';
import { useModal } from '../../../utils/hook';
import { convertKTCDate } from '../../../utils';
import { battleEventStatus, battleRepeatType } from '../../../assets/data/options';
import {
battleEventHotTime,
battleEventRoundCount,
battleEventStatus,
battleRepeatType,
} from '../../../assets/data/options';
import DatePickerComponent from '../../common/Date/DatePickerComponent';
import { BattleEventModify, BattleEventSingleRegist } from '../../../apis/Battle';
import { battleEventStatusType } from '../../../assets/data/types';
@@ -341,7 +346,7 @@ const BattleEventModal = ({ modalType, detailView, handleDetailView, content, se
</SelectInput>
<FormLabel>라운드 </FormLabel>
<SelectInput value={resultData.round_count} onChange={e => setResultData({ ...resultData, round_count: e.target.value })} disabled={!isView('round')} width="100px">
{[1,2,3,4,8,12,16].map((data, index) => (
{battleEventRoundCount.map((data, index) => (
<option key={index} value={data}>
{data}
</option>
@@ -359,7 +364,7 @@ const BattleEventModal = ({ modalType, detailView, handleDetailView, content, se
</SelectInput>
<FormLabel>핫타임</FormLabel>
<SelectInput value={resultData.hot_time} onChange={e => setResultData({ ...resultData, hot_time: e.target.value })} disabled={!isView('hot')} width="100px">
{[1,2,3,4,5,6,7,8].map((data, index) => (
{battleEventHotTime.map((data, index) => (
<option key={index} value={data}>
{data}
</option>

View File

@@ -2,19 +2,27 @@ import { TextInput, BtnWrapper, InputLabel, SelectInput, InputGroup } from '../.
import Button from '../../common/button/Button';
import { SearchBarLayout, SearchPeriod } from '../../common/SearchBar';
import { useCallback, useEffect, useState } from 'react';
import { landAuctionStatus, landSearchType, landSize, userSearchType } from '../../../assets/data';
import { BattleEventView } from '../../../apis/Battle';
import {
battleEventHotTime,
battleEventRoundCount,
battleEventStatus,
battleRepeatType,
eventSearchType,
} from '../../../assets/data/options';
export const useBattleEventSearch = (token, initialPageSize) => {
const [searchParams, setSearchParams] = useState({
landType: 'ID',
landData: '',
userType: 'GUID',
userData: '',
landSize: 'ALL',
searchType: 'ID',
searchData: '',
configId: 'ALL',
rewardId: 'ALL',
repeatType: 'ALL',
status: 'ALL',
auctionStartDate: '',
auctionEndDate: '',
roundCount: 'ALL',
hotTime: 'ALL',
startDate: '',
endDate: '',
orderBy: 'DESC',
pageSize: initialPageSize,
currentPage: 1
@@ -32,14 +40,16 @@ export const useBattleEventSearch = (token, initialPageSize) => {
setLoading(true);
const result = await BattleEventView(
token,
params.landType,
params.landData,
params.userType,
params.userData,
params.landSize,
params.searchType,
params.searchData,
params.configId,
params.rewardId,
params.repeatType,
params.status,
params.auctionStartDate && new Date(params.auctionStartDate).toISOString(),
params.auctionEndDate && new Date(params.auctionEndDate).toISOString(),
params.roundCount,
params.hotTime,
params.startDate && new Date(params.startDate).toISOString(),
params.endDate && new Date(params.endDate).toISOString(),
params.orderBy,
params.pageSize,
params.currentPage
@@ -73,14 +83,16 @@ export const useBattleEventSearch = (token, initialPageSize) => {
const handleReset = useCallback(async () => {
const resetParams = {
landType: 'ID',
landData: '',
userType: 'GUID',
userData: '',
landSize: 'ALL',
searchType: 'ID',
searchData: '',
configId: 'ALL',
rewardId: 'ALL',
repeatType: 'ALL',
status: 'ALL',
auctionStartDate: '',
auctionEndDate: '',
roundCount: 'ALL',
hotTime: 'ALL',
startDate: '',
endDate: '',
orderBy: 'DESC',
pageSize: initialPageSize,
currentPage: 1
@@ -114,7 +126,7 @@ export const useBattleEventSearch = (token, initialPageSize) => {
};
};
const BattleEventSearchBar = ({ searchParams, onSearch, onReset }) => {
const BattleEventSearchBar = ({ searchParams, onSearch, onReset, configData, rewardData }) => {
const handleSubmit = event => {
event.preventDefault();
@@ -124,8 +136,8 @@ const BattleEventSearchBar = ({ searchParams, onSearch, onReset }) => {
const searchList = [
<>
<InputGroup>
<SelectInput value={searchParams.landType} onChange={e => onSearch({landType: e.target.value })}>
{landSearchType.map((data, index) => (
<SelectInput value={searchParams.searchType} onChange={e => onSearch({searchType: e.target.value })}>
{eventSearchType.map((data, index) => (
<option key={index} value={data.value}>
{data.name}
</option>
@@ -133,39 +145,55 @@ const BattleEventSearchBar = ({ searchParams, onSearch, onReset }) => {
</SelectInput>
<TextInput
type="text"
placeholder={searchParams.landType === 'ID' ? '랜드 ID 입력' : '랜드명 입력'}
value={searchParams.landData}
placeholder={searchParams.searchType === 'ID' ? '이벤트 ID 입력' : '이벤트명 입력'}
value={searchParams.searchData}
width="300px"
onChange={e => onSearch({ landData: e.target.value })}
onChange={e => onSearch({ searchData: e.target.value })}
/>
</InputGroup>
</>,
<>
<InputLabel>낙찰자</InputLabel>
<InputLabel>라운드 시간</InputLabel>
<InputGroup>
<SelectInput value={searchParams.userType} onChange={e => onSearch({userType: e.target.value })}>
{userSearchType.map((data, index) => (
<SelectInput value={searchParams.configId} onChange={e => onSearch({ configId: e.target.value })}>
<option value="ALL">전체</option>
{configData?.map((data, index) => (
<option key={index} value={data.value}>
{data.name}
</option>
))}
</SelectInput>
<TextInput
type="text"
placeholder={searchParams.userType === 'GUID' ? 'GUID 입력' : '닉네임 입력'}
value={searchParams.userData}
width="300px"
onChange={e => onSearch({ userData: e.target.value })}
/>
</InputGroup>
<InputLabel>배정 포드</InputLabel>
<InputGroup>
<SelectInput value={searchParams.rewardId} onChange={e => onSearch({ rewardId: e.target.value })}>
<option value='ALL'>전체</option>
{rewardData?.map((data, index) => (
<option key={index} value={data.value}>
{data.name}
</option>
))}
</SelectInput>
</InputGroup>
<InputLabel>라운드 </InputLabel>
<InputGroup>
<SelectInput value={searchParams.roundCount} onChange={e => onSearch({ roundCount: e.target.value })}>
<option value='ALL'>전체</option>
{battleEventRoundCount.map((data, index) => (
<option key={index} value={data}>
{data}
</option>
))}
</SelectInput>
</InputGroup>
</>
];
const optionList = [
<>
<InputLabel>랜드크기</InputLabel>
<SelectInput value={searchParams.landSize} onChange={e => onSearch({ landSize: e.target.value }, false)} >
{landSize.map((data, index) => (
<InputLabel>반복</InputLabel>
<SelectInput value={searchParams.repeatType} onChange={e => onSearch({ repeatType: e.target.value }, false)} >
{battleRepeatType.map((data, index) => (
<option key={index} value={data.value}>
{data.name}
</option>
@@ -173,9 +201,9 @@ const BattleEventSearchBar = ({ searchParams, onSearch, onReset }) => {
</SelectInput>
</>,
<>
<InputLabel>경매상태</InputLabel>
<InputLabel>이벤트상태</InputLabel>
<SelectInput value={searchParams.status} onChange={e => onSearch({ status: e.target.value }, false)}>
{landAuctionStatus.map((data, index) => (
{battleEventStatus.map((data, index) => (
<option key={index} value={data.value}>
{data.name}
</option>
@@ -183,12 +211,23 @@ const BattleEventSearchBar = ({ searchParams, onSearch, onReset }) => {
</SelectInput>
</>,
<>
<InputLabel>경매 일자</InputLabel>
<InputLabel>핫타임</InputLabel>
<SelectInput value={searchParams.hotTime} onChange={e => onSearch({ hotTime: e.target.value }, false)}>
<option value="ALL">전체</option>
{battleEventHotTime.map((data, index) => (
<option key={index} value={data}>
{data}
</option>
))}
</SelectInput>
</>,
<>
<InputLabel>이벤트 기간</InputLabel>
<SearchPeriod
startDate={searchParams.auctionStartDate}
handleStartDate={date => onSearch({ auctionStartDate: date }, false)}
endDate={searchParams.auctionEndDate}
handleEndDate={date => onSearch({ auctionEndDate: date }, false)}
startDate={searchParams.startDate}
handleStartDate={date => onSearch({ startDate: date }, false)}
endDate={searchParams.endDate}
handleEndDate={date => onSearch({ endDate: date }, false)}
/>
</>,
<></>,<></>,

View File

@@ -170,6 +170,8 @@ const BattleEvent = () => {
}
}}
onReset={handleReset}
configData={battleConfigData}
rewardData={battleRewardData}
/>
</FormWrapper>
<ViewTableInfo total={dataList?.total} total_all={dataList?.total_all} handleOrderBy={handleOrderByChange} handlePageSize={handlePageSizeChange}>