diff --git a/src/components/floor-plan/CanvasMenu.jsx b/src/components/floor-plan/CanvasMenu.jsx index c5fb9194..012b62e9 100644 --- a/src/components/floor-plan/CanvasMenu.jsx +++ b/src/components/floor-plan/CanvasMenu.jsx @@ -44,6 +44,7 @@ import JA from '@/locales/ja.json' import { MENU } from '@/common/common' import { QcastContext } from '@/app/QcastProvider' + export default function CanvasMenu(props) { const { menuNumber, setMenuNumber } = props const pathname = usePathname() @@ -101,6 +102,8 @@ export default function CanvasMenu(props) { const { setIsGlobalLoading } = useContext(QcastContext) + //임시 + const { selectedPlan } = usePlan() const handleExcelPdfFileDown = async (donwloadType, drawingFlg) => { const url = '/api/estimate/excel-download' @@ -168,14 +171,14 @@ export default function CanvasMenu(props) { break case 5: // let pid = urlParams.get('pid') - promiseGet({ url: `/api/estimate/${objectNo}/${pid}/detail` }).then((res) => { + promiseGet({ url: `/api/estimate/${objectNo}/${selectedPlan.ordering}/detail` }).then((res) => { if (res.status === 200) { const estimateDetail = res.data - if (estimateDetail.docNo) { + if (estimateDetail.tempFlg === '0' && estimateDetail.estimateDate !== null) { setMenuNumber(menu.index) setCurrentMenu(menu.title) setFloorPlanObjectNo({ floorPlanObjectNo: objectNo }) - router.push(`/floor-plan/estimate/5?pid=${pid}&objectNo=${objectNo}`) + router.push(`/floor-plan/estimate/${menu.index}?pid=${selectedPlan.ordering}&objectNo=${objectNo}`) } else { swalFire({ text: getMessage('estimate.menu.move.valid1') }) } @@ -183,13 +186,13 @@ export default function CanvasMenu(props) { }) break case 6: - promiseGet({ url: `/api/estimate/${objectNo}/${pid}/detail` }).then((res) => { + promiseGet({ url: `/api/estimate/${objectNo}/${selectedPlan.ordering}/detail` }).then((res) => { if (res.status === 200) { const estimateDetail = res.data - if (estimateDetail.docNo) { + if (estimateDetail.tempFlg === '0') { setMenuNumber(menu.index) setCurrentMenu(menu.title) - router.push(`/floor-plan/simulator/${menu.index}?pid=${pid}&objectNo=${objectNo}`) + router.push(`/floor-plan/simulator/${menu.index}?pid=${selectedPlan.ordering}&objectNo=${objectNo}`) } else { swalFire({ text: getMessage('simulator.menu.move.valid1') }) } diff --git a/src/components/floor-plan/modal/roofAllocation/ContextRoofAllocationSetting.jsx b/src/components/floor-plan/modal/roofAllocation/ContextRoofAllocationSetting.jsx index e8942948..1d5bc188 100644 --- a/src/components/floor-plan/modal/roofAllocation/ContextRoofAllocationSetting.jsx +++ b/src/components/floor-plan/modal/roofAllocation/ContextRoofAllocationSetting.jsx @@ -79,133 +79,134 @@ export default function ContextRoofAllocationSetting(props) {
- {currentRoofList.map((roof, index) => { - return ( -
-
- - -
-
-
-
-
- handleChangeRoofMaterial(e, index)} - /> -
- {index === 0 && {getMessage('modal.roof.alloc.default.roof.material')}} - {index !== 0 && } -
+ {currentRoofList.length > 0 && + currentRoofList.map((roof, index) => { + return ( +
+
+ +
-
-
- {getMessage('slope')} -
- { - handleChangeInput(e, currentAngleType === 'slope' ? 'pitch' : 'angle', index) - }} - defaultValue={currentAngleType === 'slope' ? roof.pitch : roof.angle} - /> +
+
+
+
+ handleChangeRoofMaterial(e, index)} + /> +
+ {index === 0 && {getMessage('modal.roof.alloc.default.roof.material')}} + {index !== 0 && }
- {pitchText}
-
- {(roof.widAuth || roof.lenAuth) && (
- {roof.widAuth && ( -
- W -
- -
+
+ {getMessage('slope')} +
+ { + handleChangeInput(e, currentAngleType === 'slope' ? 'pitch' : 'angle', index) + }} + defaultValue={currentAngleType === 'slope' ? roof.pitch : roof.angle} + />
- )} - {roof.lenAuth && ( -
- L -
- -
-
- )} + {pitchText} +
- )} - {(roof.raftAuth || roof.roofPchAuth) && ( -
- {roof.raftAuth && ( -
+ {(roof.widAuth || roof.lenAuth) && ( +
+ {roof.widAuth && (
- {getMessage('modal.placement.initial.setting.rafter')} - {raftCodes.length > 0 && ( -
- -
- )} -
-
- )} - {roof.roofPchAuth && ( -
-
- {getMessage('hajebichi')} -
- + W +
+
-
- )} -
- )} -
-
- - + )} + {roof.lenAuth && ( +
+ L +
+ +
+
+ )} +
+ )} + {(roof.raftAuth || roof.roofPchAuth) && ( +
+ {roof.raftAuth && ( +
+
+ {getMessage('modal.placement.initial.setting.rafter')} + {raftCodes.length > 0 && ( +
+ +
+ )} +
+
+ )} + {roof.roofPchAuth && ( +
+
+ {getMessage('hajebichi')} +
+ +
+
+
+ )} +
+ )} +
+
+ + +
-
- ) - })} + ) + })}
{/* 시스템용량 */}
-
{getMessage('simulator.title.sub3')}
+
{getMessage('simulator.title.sub3')}
{objectDetail.capacity ? `${convertNumberToPriceDecimal(objectDetail.capacity)} kW` : ''}
{/* 연간예측발전량 */} @@ -257,7 +244,7 @@ export default function Simulator() { {/* 적설조건 */}
{getMessage('simulator.title.sub7')}
-
{objectDetail.snowfall} cm
+
{objectDetail.snowfall ? `${objectDetail.snowfall}cm` : ''}
{/* 풍속조건 */}
@@ -356,7 +343,10 @@ export default function Simulator() { {/* 지붕면 */} {moduleInfo.roofSurface} {/* 경사각 */} - {convertNumberToPriceDecimal(moduleInfo.slopeAngle)}{moduleInfo.classType == 0 ? "寸":"º"} + + {convertNumberToPriceDecimal(moduleInfo.slopeAngle)} + {moduleInfo.classType == 0 ? '寸' : 'º'} + {/* 방위각(도) */} {convertNumberToPriceDecimal(moduleInfo.azimuth)} {/* 태양전지모듈 */} diff --git a/src/hooks/common/useRoofFn.js b/src/hooks/common/useRoofFn.js index 40eb7b2f..84416370 100644 --- a/src/hooks/common/useRoofFn.js +++ b/src/hooks/common/useRoofFn.js @@ -22,8 +22,8 @@ export function useRoofFn() { const ratio = window.devicePixelRatio || 1 const layout = roofMaterial.layout - let width = (roofMaterial.width ?? 226) / 10 - let height = (roofMaterial.length ?? 158) / 10 + let width = (roofMaterial.width || 226) / 10 + let height = (roofMaterial.length || 158) / 10 const index = roofMaterial.index ?? 0 let roofStyle = 2 const inputPatternSize = { width: width, height: height } //임시 사이즈 diff --git a/src/hooks/roofcover/useRoofAllocationSetting.js b/src/hooks/roofcover/useRoofAllocationSetting.js index 546ebe0b..1488fb26 100644 --- a/src/hooks/roofcover/useRoofAllocationSetting.js +++ b/src/hooks/roofcover/useRoofAllocationSetting.js @@ -42,7 +42,7 @@ export function useRoofAllocationSetting(id) { const [currentRoofMaterial, setCurrentRoofMaterial] = useState(roofMaterials[0]) // 팝업 내 기준 지붕재 const [roofList, setRoofList] = useRecoilState(addedRoofsState) // 배치면 초기설정에서 선택한 지붕재 배열 const [editingLines, setEditingLines] = useState([]) - const [currentRoofList, setCurrentRoofList] = useState(null) + const [currentRoofList, setCurrentRoofList] = useState([]) const currentAngleType = useRecoilValue(currentAngleTypeSelector) const globalLocaleState = useRecoilValue(globalLocaleStore) const [basicInfo, setBasicInfo] = useState(null) diff --git a/src/hooks/usePlan.js b/src/hooks/usePlan.js index fb743828..a0733e57 100644 --- a/src/hooks/usePlan.js +++ b/src/hooks/usePlan.js @@ -215,7 +215,6 @@ export function usePlan(params = {}) { const estimateDetail = res.data if (pathname === '/floor-plan/estimate/5') { if (estimateDetail.tempFlg === '0' && estimateDetail.estimateDate !== null) { - console.log('이동') res.data.resetFlag = 'N' if (res.data.itemList.length > 0) { @@ -238,9 +237,12 @@ export function usePlan(params = {}) { swalFire({ text: getMessage('estimate.menu.move.valid1') }) } } else { - //발전시뮬레이션 - // 클릭한 플랜 탭으로 이동 - // updateCurrentPlan(newCurrentId) + // 발전시뮬레이션 + if (estimateDetail.tempFlg === '0') { + updateCurrentPlan(newCurrentId) + } else { + swalFire({ text: getMessage('simulator.menu.move.valid1') }) + } } } })