Merge branch 'dev' into feature/jaeyoung

This commit is contained in:
Jaeyoung Lee 2025-03-18 14:04:48 +09:00
commit 509c307e56
4 changed files with 14 additions and 8 deletions

View File

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

View File

@ -178,7 +178,7 @@
"modal.roof.alloc.select.parallel": "筋配置", "modal.roof.alloc.select.parallel": "筋配置",
"modal.roof.alloc.select.stairs": "千鳥配置", "modal.roof.alloc.select.stairs": "千鳥配置",
"modal.roof.alloc.apply": "選択した屋根材として割り当て", "modal.roof.alloc.apply": "選択した屋根材として割り当て",
"plan.menu.estimate.docDown": "各種資料ダウンロード", "plan.menu.estimate.docDown": "見積書出力",
"plan.menu.estimate.save": "保存", "plan.menu.estimate.save": "保存",
"plan.menu.estimate.reset": "初期化", "plan.menu.estimate.reset": "初期化",
"plan.menu.estimate.copy": "見積書のコピー", "plan.menu.estimate.copy": "見積書のコピー",
@ -886,7 +886,7 @@
"estimate.detail.drawingEstimateCreateDate": "登録日", "estimate.detail.drawingEstimateCreateDate": "登録日",
"estimate.detail.lastEditDatetime": "変更日時", "estimate.detail.lastEditDatetime": "変更日時",
"estimate.detail.saleStoreId": "一次販売店名", "estimate.detail.saleStoreId": "一次販売店名",
"estimate.detail.estimateDate": "見積日", "estimate.detail.estimateDate": "見積作成日",
"estimate.detail.otherSaleStoreId": "二次販売店名", "estimate.detail.otherSaleStoreId": "二次販売店名",
"estimate.detail.noOtherSaleStoreId": "二次店なし", "estimate.detail.noOtherSaleStoreId": "二次店なし",
"estimate.detail.receiveUser": "担当者", "estimate.detail.receiveUser": "担当者",

View File

@ -886,7 +886,7 @@
"estimate.detail.drawingEstimateCreateDate": "등록일", "estimate.detail.drawingEstimateCreateDate": "등록일",
"estimate.detail.lastEditDatetime": "변경일시", "estimate.detail.lastEditDatetime": "변경일시",
"estimate.detail.saleStoreId": "1차 판매점명", "estimate.detail.saleStoreId": "1차 판매점명",
"estimate.detail.estimateDate": "견적일", "estimate.detail.estimateDate": "견적작성일",
"estimate.detail.otherSaleStoreId": "2차 판매점명", "estimate.detail.otherSaleStoreId": "2차 판매점명",
"estimate.detail.noOtherSaleStoreId": "2차점 없음", "estimate.detail.noOtherSaleStoreId": "2차점 없음",
"estimate.detail.receiveUser": "담당자", "estimate.detail.receiveUser": "담당자",

View File

@ -307,6 +307,9 @@ export function removeDuplicatePolygons(polygons) {
} }
export const isSamePoint = (a, b) => { export const isSamePoint = (a, b) => {
if (!a || !b) {
return false
}
return Math.abs(Math.round(a.x) - Math.round(b.x)) <= 2 && Math.abs(Math.round(a.y) - Math.round(b.y)) <= 2 return Math.abs(Math.round(a.x) - Math.round(b.x)) <= 2 && Math.abs(Math.round(a.y) - Math.round(b.y)) <= 2
} }