From 40e5cf773dc55b5ff85d9a042baa0de95c1910b2 Mon Sep 17 00:00:00 2001 From: basssy Date: Wed, 6 Nov 2024 08:42:41 +0900 Subject: [PATCH] =?UTF-8?q?=EB=AC=BC=EA=B1=B4=20=EC=83=81=EC=84=B8=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/management/StuffDetail.jsx | 49 ++++++++++------------- 1 file changed, 21 insertions(+), 28 deletions(-) diff --git a/src/components/management/StuffDetail.jsx b/src/components/management/StuffDetail.jsx index 49fc92f8..9a455216 100644 --- a/src/components/management/StuffDetail.jsx +++ b/src/components/management/StuffDetail.jsx @@ -420,7 +420,6 @@ export default function StuffDetail() { useEffect(() => { if (isObjectNotEmpty(detailData)) { - // console.log('상세데이타세팅:::::', detailData) // 도도부현API get({ url: '/api/object/prefecture/list' }).then((res) => { if (!isEmptyArray(res)) { @@ -434,23 +433,18 @@ export default function StuffDetail() { let firstList let otherList let favList - // if (sessionState?.storeId === 'T01') { + if (session?.storeId === 'T01') { - // url = `/api/object/saleStore/${sessionState?.storeId}/firstList?userId=${sessionState?.userId}` url = `/api/object/saleStore/${session?.storeId}/firstList?userId=${session?.userId}` } else { - // if (sessionState.storeLvl === '1') { if (session.storeLvl === '1') { - // url = `/api/object/saleStore/${sessionState?.storeId}/list?firstFlg=1&userId=${sessionState?.userId}` url = `/api/object/saleStore/${session?.storeId}/list?firstFlg=1&userId=${session?.userId}` } else { - // url = `/api/object/saleStore/${sessionState?.storeId}/list?firstFlg=1&userId=${sessionState?.userId}` url = `/api/object/saleStore/${session?.storeId}/list?firstFlg=1&userId=${session?.userId}` } } get({ url: url }).then((res) => { if (!isEmptyArray(res)) { - // if (sessionState?.storeId === 'T01') { if (session?.storeId === 'T01') { firstList = res.filter((row) => row.saleStoreLevel === '1') firstList.sort((a, b) => (a.saleStoreId !== 'T01') - (b.saleStoreId !== 'T01') || a.saleStoreId - b.saleStoreId) @@ -459,14 +453,19 @@ export default function StuffDetail() { setFavoriteStoreList(favList) setShowSaleStoreList(favList) - form.setValue('saleStoreId', firstList[0].saleStoreId) - form.setValue('saleStoreName', firstList[0].saleStoreName) - form.setValue('saleStoreLevel', firstList[0].saleStoreLevel) - setSelOptions(firstList[0].saleStoreId) + if (detailData.firstAgentId != null) { + form.setValue('saleStoreId', detailData.firstAgentId) + setSelOptions(detailData.firstAgentId) + } else { + form.setValue('saleStoreId', detailData.saleStoreId) + setSelOptions(detailData.saleStoreId) + } //상세데이터의 1차점 아이디로 2차점 목록 조회하기 - // url = `/api/object/saleStore/${detailData?.saleStoreId}/list?firstFlg=0&userId=${sessionState?.userId}` - url = `/api/object/saleStore/${detailData?.saleStoreId}/list?firstFlg=0&userId=${session?.userId}` + + let data = detailData?.firstAgentId ? detailData.firstAgentId : detailData.saleStoreId + // url = `/api/object/saleStore/${session?.storeId}/list?firstFlg=0&userId=${session?.userId}` + url = `/api/object/saleStore/${data}/list?firstFlg=0&userId=${session?.userId}` get({ url: url }).then((res) => { if (!isEmptyArray(res)) { @@ -482,7 +481,6 @@ export default function StuffDetail() { }) } else { //1차점 셀렉트박스 - // if (sessionState?.storeLvl === '1') { if (session?.storeLvl === '1') { firstList = res favList = res.filter((row) => row.priority !== 'B') @@ -572,7 +570,6 @@ export default function StuffDetail() { form.setValue('remarks', detailData.remarks) }) } - // }, [detailData, sessionState]) }, [detailData, session]) //경칭선택 변경 이벤트 @@ -1931,7 +1928,6 @@ export default function StuffDetail() {
- {/* {sessionState?.storeId === 'T01' && ( */} {session?.storeId === 'T01' && ( <>
@@ -1947,10 +1943,8 @@ export default function StuffDetail() { onChange={onSelectionChange} getOptionLabel={(x) => x.saleStoreName} getOptionValue={(x) => x.saleStoreId} - // isClearable={sessionState?.storeLvl === '1' ? true : false} - isClearable={session?.storeLvl === '1' ? true : false} - // isDisabled={sessionState?.storeLvl !== '1' ? true : false} - isDisabled={session?.storeLvl !== '1' ? true : false} + isClearable={detailData.tempFlg === '0' ? false : session?.storeLvl === '1' ? true : false} + isDisabled={detailData.tempFlg === '0' ? true : session?.storeLvl !== '1' ? true : false} value={saleStoreList.filter(function (option) { return option.saleStoreId === selOptions })} @@ -1967,7 +1961,6 @@ export default function StuffDetail() {
)} - {/* {sessionState?.storeId !== 'T01' && sessionState?.storeLvl === '1' && ( */} {session?.storeId !== 'T01' && session?.storeLvl === '1' && ( <>
@@ -1983,8 +1976,9 @@ export default function StuffDetail() { getOptionLabel={(x) => x.saleStoreName} getOptionValue={(x) => x.saleStoreId} isClearable={false} - // isDisabled={sessionState?.storeLvl !== '1' ? true : sessionState?.storeId !== 'T01' ? true : false} - isDisabled={session?.storeLvl !== '1' ? true : session?.storeId !== 'T01' ? true : false} + isDisabled={ + detailData.tempFlg === '0' ? true : session?.storeLvl !== '1' ? true : session?.storeId !== 'T01' ? true : false + } value={showSaleStoreList.filter(function (option) { return option.saleStoreId === selOptions })} @@ -2001,7 +1995,6 @@ export default function StuffDetail() {
)} - {/* {sessionState?.storeId !== 'T01' && sessionState?.storeLvl !== '1' && ( */} {session?.storeId !== 'T01' && session?.storeLvl !== '1' && ( <>
@@ -2062,10 +2055,10 @@ export default function StuffDetail() { onChange={onSelectionChange2} getOptionLabel={(x) => x.saleStoreName} getOptionValue={(x) => x.saleStoreId} - // isDisabled={sessionState?.storeLvl === '1' && form.watch('saleStoreId') != '' ? false : true} - isDisabled={session?.storeLvl === '1' && form.watch('saleStoreId') != '' ? false : true} - // isClearable={sessionState?.storeLvl === '1' ? true : false} - isClearable={session?.storeLvl === '1' ? true : false} + isDisabled={ + detailData.tempFlg === '0' ? true : session?.storeLvl === '1' && form.watch('saleStoreId') != '' ? false : true + } + isClearable={detailData.tempFlg === '0' ? false : session?.storeLvl === '1' ? true : false} value={otherSaleStoreList.filter(function (option) { return option.saleStoreId === otherSelOptions })}