지붕면 할당 순서 수정

This commit is contained in:
hyojun.choi 2025-03-18 11:33:45 +09:00
parent 06fa1766d6
commit 1fa02de62f

View File

@ -1,6 +1,6 @@
import { useRecoilState, useRecoilValue, useResetRecoilState, useSetRecoilState } from 'recoil'
import { canvasState, currentAngleTypeSelector, currentMenuState, currentObjectState } from '@/store/canvasAtom'
import { useEffect, useRef, useState } from 'react'
import { useContext, useEffect, useRef, useState } from 'react'
import { useAxios } from '@/hooks/useAxios'
import { useSwal } from '@/hooks/useSwal'
import { usePolygon } from '@/hooks/usePolygon'
@ -26,6 +26,7 @@ import { getChonByDegree, getDegreeByChon } from '@/util/canvas-util'
import { moduleSelectionDataState } from '@/store/selectedModuleOptions'
import { useCanvasPopupStatusController } from '@/hooks/common/useCanvasPopupStatusController'
import { outerLinePointsState } from '@/store/outerLineAtom'
import { QcastContext } from '@/app/QcastProvider'
export function useRoofAllocationSetting(id) {
const canvas = useRecoilValue(canvasState)
@ -49,7 +50,7 @@ export function useRoofAllocationSetting(id) {
const { get, post } = useAxios(globalLocaleState)
const { getMessage } = useMessage()
const { swalFire } = useSwal()
const { setIsGlobalLoading } = useContext(QcastContext)
const { setSurfaceShapePattern } = useRoofFn()
const [moduleSelectionData, setModuleSelectionData] = useRecoilState(moduleSelectionDataState)
@ -200,6 +201,7 @@ export function useRoofAllocationSetting(id) {
*/
const basicSettingSave = async () => {
try {
setIsGlobalLoading(true)
const patternData = {
objectNo: correntObjectNo,
planNo: Number(basicSetting.planNo),
@ -222,6 +224,7 @@ export function useRoofAllocationSetting(id) {
await post({ url: `/api/canvas-management/roof-allocation-settings`, data: patternData }).then((res) => {
swalFire({ text: getMessage(res.returnMessage) })
setIsGlobalLoading(false)
})
//Recoil 설정
@ -270,8 +273,6 @@ export function useRoofAllocationSetting(id) {
* 선택한 지붕재로 할당
*/
const handleSave = () => {
basicSettingSave()
/**
* 모두 actualSize 있으면 바로 적용 없으면 actualSize 설정
*/
@ -280,6 +281,7 @@ export function useRoofAllocationSetting(id) {
} else {
apply()
resetPoints()
basicSettingSave()
}
}
@ -287,7 +289,6 @@ export function useRoofAllocationSetting(id) {
* 지붕재 오른쪽 마우스 클릭 단일로 지붕재 변경 필요한 경우
*/
const handleSaveContext = () => {
basicSettingSave()
const newRoofList = currentRoofList.map((roof, idx) => {
return { ...roof, index: idx, raft: roof.raft ? roof.raft : roof.raftBaseCd }
})
@ -304,6 +305,7 @@ export function useRoofAllocationSetting(id) {
drawDirectionArrow(currentObject)
modifyModuleSelectionData()
closeAll()
basicSettingSave()
}
/**
@ -361,6 +363,7 @@ export function useRoofAllocationSetting(id) {
splitPolygonWithLines(roofBase)
}
} catch (e) {
console.log(e)
return
}