orientation module validation 추가

This commit is contained in:
김민식 2025-04-08 16:14:57 +09:00
parent 468980abbc
commit 597aaa6d42
4 changed files with 14 additions and 12 deletions

View File

@ -144,18 +144,10 @@ export default function BasicSetting({ id, pos = { x: 50, y: 230 } }) {
if (tabNum === 1) {
orientationRef.current.handleNextStep()
setAddedRoofs(roofs)
setTabNum(tabNum + 1)
// setTabNum(tabNum + 1)
return
} else if (tabNum === 2) {
if (basicSetting.roofSizeSet !== '3') {
if (!isObjectNotEmpty(moduleSelectionData.module)) {
Swal.fire({
title: getMessage('module.not.found'),
icon: 'warning',
})
return
}
// if (addedRoofs.length !== moduleSelectionData.roofConstructions.length) {
// Swal.fire({
// title: getMessage('construction.length.difference'),

View File

@ -9,6 +9,7 @@ import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil'
import QSelectBox from '@/components/common/select/QSelectBox'
import { moduleSelectionDataState } from '@/store/selectedModuleOptions'
import { roofsState } from '@/store/roofAtom'
import Swal from 'sweetalert2'
export const Orientation = forwardRef((props, ref) => {
const { getMessage } = useMessage()
@ -150,6 +151,14 @@ export const Orientation = forwardRef((props, ref) => {
userId: loginUserState.userId, //
})
setTabNum(2)
} else {
if (!selectedModules || !selectedModules.itemId) {
Swal.fire({
title: getMessage('module.not.found'),
icon: 'warning',
})
return
}
}
}
@ -172,7 +181,7 @@ export const Orientation = forwardRef((props, ref) => {
}
const isComplete = () => {
if (!selectedModules) return false
if (!selectedModules || !selectedModules.itemId) return false
if (basicSetting && basicSetting.roofSizeSet !== '3') {
if (inputInstallHeight <= 0) {
return false
@ -190,6 +199,7 @@ export const Orientation = forwardRef((props, ref) => {
}
const handleChangeModule = (e) => {
console.log('hhㅗㅗㅗㅗㅗㅗㅗㅗㅗㅗㅗㅗㅗㅗㅗㅗㅗㅗㅗㅗㅗㅗ')
resetRoofs()
setSelectedModules(e)
}

View File

@ -31,7 +31,7 @@ export function useCircuitTrestle(executeEffect = false) {
const { getMessage } = useMessage()
useEffect(() => {
if (Object.keys(selectedModules).length > 0 && executeEffect) setModuleStatisticsData()
if (selectedModules && Object.keys(selectedModules).length > 0 && executeEffect) setModuleStatisticsData()
}, [selectedModules])
const getOptYn = () => {

View File

@ -2,7 +2,7 @@ import { atom } from 'recoil'
export const selectedModuleState = atom({
key: 'selectedModuleState',
default: [],
default: null,
dangerouslyAllowMutability: true,
})