feature/jaeyoung #46
@ -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
|
||||
}
|
||||
|
||||
|
||||
@ -178,7 +178,7 @@
|
||||
"modal.roof.alloc.select.parallel": "筋配置",
|
||||
"modal.roof.alloc.select.stairs": "千鳥配置",
|
||||
"modal.roof.alloc.apply": "選択した屋根材として割り当て",
|
||||
"plan.menu.estimate.docDown": "各種資料ダウンロード",
|
||||
"plan.menu.estimate.docDown": "見積書出力",
|
||||
"plan.menu.estimate.save": "保存",
|
||||
"plan.menu.estimate.reset": "初期化",
|
||||
"plan.menu.estimate.copy": "見積書のコピー",
|
||||
@ -886,7 +886,7 @@
|
||||
"estimate.detail.drawingEstimateCreateDate": "登録日",
|
||||
"estimate.detail.lastEditDatetime": "変更日時",
|
||||
"estimate.detail.saleStoreId": "一次販売店名",
|
||||
"estimate.detail.estimateDate": "見積日",
|
||||
"estimate.detail.estimateDate": "見積作成日",
|
||||
"estimate.detail.otherSaleStoreId": "二次販売店名",
|
||||
"estimate.detail.noOtherSaleStoreId": "二次店なし",
|
||||
"estimate.detail.receiveUser": "担当者",
|
||||
|
||||
@ -886,7 +886,7 @@
|
||||
"estimate.detail.drawingEstimateCreateDate": "등록일",
|
||||
"estimate.detail.lastEditDatetime": "변경일시",
|
||||
"estimate.detail.saleStoreId": "1차 판매점명",
|
||||
"estimate.detail.estimateDate": "견적일",
|
||||
"estimate.detail.estimateDate": "견적작성일",
|
||||
"estimate.detail.otherSaleStoreId": "2차 판매점명",
|
||||
"estimate.detail.noOtherSaleStoreId": "2차점 없음",
|
||||
"estimate.detail.receiveUser": "담당자",
|
||||
|
||||
@ -307,6 +307,9 @@ export function removeDuplicatePolygons(polygons) {
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user