From cdf6a43cac016797bcd09dc669c1b11e3451f7ea Mon Sep 17 00:00:00 2001 From: basssy Date: Thu, 17 Oct 2024 17:50:33 +0900 Subject: [PATCH] =?UTF-8?q?=EB=AF=B8=EC=82=AC=EC=9A=A9=20=EB=9D=BC?= =?UTF-8?q?=EC=9D=B4=EB=B8=8C=EB=9F=AC=EB=A6=AC=20=EC=82=AD=EC=A0=9C=20&?= =?UTF-8?q?=20=EB=AC=BC=EA=B1=B4=ED=98=84=ED=99=A9=20=EC=84=A4=EA=B3=84?= =?UTF-8?q?=EC=9D=98=EB=A2=B0=20=EB=B6=88=EB=9F=AC=EC=98=A4=EA=B8=B0=20?= =?UTF-8?q?=ED=8C=9D=EC=97=85=EC=A0=81=EC=9A=A9=EC=A6=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 - src/components/management/Stuff.jsx | 3 +- .../management/StuffSearchCondition.jsx | 1 - .../management/popup/PlanRequestPop.jsx | 83 +++++++++++++++---- src/store/planReqAtom.js | 2 +- yarn.lock | 56 ++----------- 6 files changed, 75 insertions(+), 71 deletions(-) diff --git a/package.json b/package.json index d7214b51..4dfef6dd 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,6 @@ "prettier": "^3.3.3", "prisma": "^5.18.0", "react-color-palette": "^7.2.2", - "react-dropdown-select": "^4.11.3", "react-select": "^5.8.1", "sass": "^1.77.8", "tailwindcss": "^3.4.1" diff --git a/src/components/management/Stuff.jsx b/src/components/management/Stuff.jsx index 30fab787..9d6ff743 100644 --- a/src/components/management/Stuff.jsx +++ b/src/components/management/Stuff.jsx @@ -66,6 +66,7 @@ export default function Stuff() { gridColumns: [ { field: 'lastEditDatetime', + minWidth: 200, headerName: getMessage('stuff.gridHeader.lastEditDatetime'), headerCheckboxSelection: true, headerCheckboxSelectionCurrentPageOnly: true, //페이징시 현재 페이지만 체크되도록 @@ -295,8 +296,6 @@ export default function Stuff() { useEffect(() => { if (stuffSearchParams?.code === 'E') { //console.log('조회누름::::::::', stuffSearchParams, sessionState) - // stuffSearchParams.startRow = (pageNo - 1) * pageSize + 1 - // stuffSearchParams.endRow = pageNo * pageSize stuffSearchParams.startRow = 1 stuffSearchParams.endRow = 1 * pageSize stuffSearchParams.schSortType = defaultSortType diff --git a/src/components/management/StuffSearchCondition.jsx b/src/components/management/StuffSearchCondition.jsx index cf310719..7401863c 100644 --- a/src/components/management/StuffSearchCondition.jsx +++ b/src/components/management/StuffSearchCondition.jsx @@ -278,7 +278,6 @@ export default function StuffSearchCondition() { { setReceiveUser(e.target.value) diff --git a/src/components/management/popup/PlanRequestPop.jsx b/src/components/management/popup/PlanRequestPop.jsx index 46afad46..dbd979eb 100644 --- a/src/components/management/popup/PlanRequestPop.jsx +++ b/src/components/management/popup/PlanRequestPop.jsx @@ -1,6 +1,5 @@ import React, { useState, useRef, useEffect } from 'react' import { useForm } from 'react-hook-form' -import { queryStringFormatter } from '@/util/common-utils' import { useAxios } from '@/hooks/useAxios' import { globalLocaleStore } from '@/store/localeAtom' import { useRecoilState, useRecoilValue, useResetRecoilState } from 'recoil' @@ -12,17 +11,23 @@ import dayjs from 'dayjs' import PlanRequestPopQGrid from './PlanRequestPopQGrid' import { sessionStore } from '@/store/commonAtom' import { planReqSearchState } from '@/store/planReqAtom' -import { isObjectNotEmpty } from '@/util/common-utils' +import { isObjectNotEmpty, queryStringFormatter } from '@/util/common-utils' import Select from 'react-select' +import QPagination from '@/components/common/pagination/QPagination' export default function PlanRequestPop(props) { + const [pageNo, setPageNo] = useState(1) //현재 페이지 번호 + const [pageSize, setPageSize] = useState(20) //페이지 당 게시물 개수 + const [totalCount, setTotalCount] = useState(0) //총 갯수 + const sessionState = useRecoilValue(sessionStore) const globalLocaleState = useRecoilValue(globalLocaleStore) - const { get } = useAxios(globalLocaleState) + const { get, promiseGet } = useAxios(globalLocaleState) const { getMessage } = useMessage() + //Select ref const ref = useRef() // 검색조건 달력 셋팅 const [startDate, setStartDate] = useState(dayjs(new Date()).add(-3, 'month').format('YYYY-MM-DD')) @@ -51,7 +56,6 @@ export default function PlanRequestPop(props) { //초기화 const resetRecoil = () => { - console.log('초기화') setSchPlanReqNo('') setSchTitle('') setSchAddress('') @@ -75,7 +79,7 @@ export default function PlanRequestPop(props) { // 상태 검색조건 변경 const onSelectionChange = (key) => { //임시작업 - console.log('E::::::::', key) + // console.log('E::::::::', key) if (isObjectNotEmpty(key)) { setSchPlanStatCd(key.value) setPlanReqSearch({ @@ -95,8 +99,56 @@ export default function PlanRequestPop(props) { }, [planReqSearch]) // 조회 - const onSubmit = () => { - console.log('조회!!!!', planReqSearch) + const onSubmit = (page, type) => { + const params = { + saleStoreId: 'T100', + saleStoreLevel: '1', + // saleStoreId: sessionState?.storeId, + // saleStoreLevel: sessionState?.storeLvl, + schPlanReqNo: planReqSearch?.schPlanReqNo ? planReqSearch.schPlanReqNo : schPlanReqNo, + schTitle: planReqSearch?.schTitle ? planReqSearch.schTitle : schTitle, + schAddress: planReqSearch?.schAddress ? planReqSearch.schAddress : schAddress, + schSaleStoreName: planReqSearch?.schSaleStoreName ? planReqSearch.schSaleStoreName : schSaleStoreName, + schPlanReqName: planReqSearch?.schPlanReqName ? planReqSearch.schPlanReqName : schPlanReqName, + schPlanStatCd: planReqSearch?.schPlanStatCd ? planReqSearch.schPlanStatCd : schPlanStatCd, + schDateGbn: planReqSearch?.schDateGbn ? planReqSearch.schDateGbn : schDateGbn, + // schStartDt: dayjs(startDate).format('YYYY-MM-DD'), + // schEndDt: dayjs(endDate).format('YYYY-MM-DD'), + startRow: type === 'S' ? (1 - 1) * pageSize + 1 : (page - 1) * pageSize + 1, + endRow: type === 'S' ? 1 * pageSize : page * pageSize, + } + if (type === 'S') { + setPageNo(1) + } else { + setPageNo(page) + } + + const apiUrl = `/api/object/planReq/list?${queryStringFormatter(params)}` + promiseGet({ url: apiUrl }).then((res) => { + if (res.status === 200) { + if (isNotEmptyArray(res.data.data)) { + setGridProps({ ...gridProps, gridData: res.data.data, gridCount: res.data.data[0].totCnt }) + setTotalCount(res.data.data[0].totCnt) + } else { + setGridProps({ ...gridProps, gridData: [], gridCount: 0 }) + setTotalCount(0) + } + } else { + setGridProps({ ...gridProps, gridData: [], gridCount: 0 }) + setTotalCount(0) + } + }) + } + // 페이징 현재페이지 변경 + const handleChangePage = (page) => { + setPlanReqSearch({ + ...planReqSearch, + startRow: (page - 1) * pageSize + 1, + endRow: page * pageSize, + }) + setPageNo(page) + + onSubmit(page, 'P') } const [gridProps, setGridProps] = useState({ @@ -187,7 +239,12 @@ export default function PlanRequestPop(props) {

{getMessage('stuff.planReqPopup.popTitle')}

-