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() {