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) { if (tabNum === 1) {
orientationRef.current.handleNextStep() orientationRef.current.handleNextStep()
setAddedRoofs(roofs) setAddedRoofs(roofs)
setTabNum(tabNum + 1) // setTabNum(tabNum + 1)
return return
} else if (tabNum === 2) { } else if (tabNum === 2) {
if (basicSetting.roofSizeSet !== '3') { if (basicSetting.roofSizeSet !== '3') {
if (!isObjectNotEmpty(moduleSelectionData.module)) {
Swal.fire({
title: getMessage('module.not.found'),
icon: 'warning',
})
return
}
// if (addedRoofs.length !== moduleSelectionData.roofConstructions.length) { // if (addedRoofs.length !== moduleSelectionData.roofConstructions.length) {
// Swal.fire({ // Swal.fire({
// title: getMessage('construction.length.difference'), // 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 QSelectBox from '@/components/common/select/QSelectBox'
import { moduleSelectionDataState } from '@/store/selectedModuleOptions' import { moduleSelectionDataState } from '@/store/selectedModuleOptions'
import { roofsState } from '@/store/roofAtom' import { roofsState } from '@/store/roofAtom'
import Swal from 'sweetalert2'
export const Orientation = forwardRef((props, ref) => { export const Orientation = forwardRef((props, ref) => {
const { getMessage } = useMessage() const { getMessage } = useMessage()
@ -150,6 +151,14 @@ export const Orientation = forwardRef((props, ref) => {
userId: loginUserState.userId, // userId: loginUserState.userId, //
}) })
setTabNum(2) 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 = () => { const isComplete = () => {
if (!selectedModules) return false if (!selectedModules || !selectedModules.itemId) return false
if (basicSetting && basicSetting.roofSizeSet !== '3') { if (basicSetting && basicSetting.roofSizeSet !== '3') {
if (inputInstallHeight <= 0) { if (inputInstallHeight <= 0) {
return false return false
@ -190,6 +199,7 @@ export const Orientation = forwardRef((props, ref) => {
} }
const handleChangeModule = (e) => { const handleChangeModule = (e) => {
console.log('hhㅗㅗㅗㅗㅗㅗㅗㅗㅗㅗㅗㅗㅗㅗㅗㅗㅗㅗㅗㅗㅗㅗ')
resetRoofs() resetRoofs()
setSelectedModules(e) setSelectedModules(e)
} }

View File

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

View File

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