diff --git a/src/components/management/StuffDetail.jsx b/src/components/management/StuffDetail.jsx index 684b6673..e8a1361f 100644 --- a/src/components/management/StuffDetail.jsx +++ b/src/components/management/StuffDetail.jsx @@ -350,6 +350,10 @@ export default function StuffDetail() { if (res?.data?.createUser === 'T01' && session?.userId !== 'T01') { //createUser가 T01인데 로그인사용자가 T01이 아니면 버튼숨기기 setShowButton('none') + } else { + if (session.storeId !== res?.data?.createUser) { + setShowButton('none') + } } if (isObjectNotEmpty(res.data)) { let surfaceTypeValue @@ -358,7 +362,7 @@ export default function StuffDetail() { } else if (res.data.surfaceType === 'Ⅱ') { surfaceTypeValue = '2' } - setManagementState({ ...res.data, surfaceTypeValue: surfaceTypeValue }) + setManagementState({ ...res.data, surfaceTypeValue: surfaceTypeValue, firstFlag: 'Y' }) } else { setManagementState({}) swalFire({ @@ -1403,6 +1407,7 @@ export default function StuffDetail() { // 수정모드일때는 PUT await promisePut({ url: apiUrl, data: params }) .then((res) => { + console.log('수정::::::::::::', params) setIsGlobalLoading(true) if (res.status === 201) { @@ -1413,8 +1418,6 @@ export default function StuffDetail() { type: 'alert', confirmFn: () => { callDetailApi(objectNo) - // setManagementState({ ...managementState, params }) - // router.push(`/management/stuff/detail?objectNo=${res.data.objectNo.toString()}`, { scroll: false }) }, }) } @@ -1426,48 +1429,22 @@ export default function StuffDetail() { } } - const callDetailApi = (objectNo) => { - promiseGet({ url: `/api/object/${objectNo}/detail` }).then((res) => { - if (res.status === 200) { - if (res?.data?.createUser === 'T01' && session?.userId !== 'T01') { - //createUser가 T01인데 로그인사용자가 T01이 아니면 버튼숨기기 + const callDetailApi = async (objectNo) => { + await promiseGet({ url: `/api/object/${objectNo}/detail` }).then((res) => { + if (res?.data?.createUser === 'T01' && session?.userId !== 'T01') { + setShowButton('none') + } else { + if (session.storeId !== res?.data?.createUser) { setShowButton('none') } - if (isObjectNotEmpty(res.data)) { - let surfaceTypeValue - if (res.data.surfaceType === 'Ⅲ・Ⅳ') { - surfaceTypeValue = '3' - } else if (res.data.surfaceType === 'Ⅱ') { - surfaceTypeValue = '2' - } - setManagementState({ ...res.data, surfaceTypeValue: surfaceTypeValue }) - } else { - setManagementState({}) - swalFire({ - text: getMessage('stuff.detail.header.notExistObjectNo'), - type: 'alert', - confirmFn: () => { - router.push('/management/stuff', { scroll: false }) - }, - }) - } - if (isNotEmptyArray(res.data.planList)) { - setPlanGridProps({ ...planGridProps, planGridData: res.data.planList }) - } else { - setPlanGridProps({ ...planGridProps, planGridData: [] }) - } - } else { - setManagementState({}) - setPlanGridProps({ ...planGridProps, planGridData: [] }) - - swalFire({ - text: getMessage('stuff.detail.header.notExistObjectNo'), - type: 'alert', - confirmFn: () => { - router.push('/management/stuff', { scroll: false }) - }, - }) } + let surfaceTypeValue + if (res.data.surfaceType === 'Ⅲ・Ⅳ') { + surfaceTypeValue = '3' + } else { + surfaceTypeValue = '2' + } + setManagementState({ ...res.data, surfaceTypeValue: surfaceTypeValue }) }) } @@ -1679,7 +1656,6 @@ export default function StuffDetail() { } } } - return ( <> {(editMode === 'NEW' && (