Merge branch 'dev' into dev-yj
This commit is contained in:
commit
ea2cbe9e83
@ -85,5 +85,5 @@ export function useCanvasPopupStatusController(param = 1) {
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
return { handleModuleSelectionTotal, trigger }
|
return { getModuleSelection, handleModuleSelectionTotal, trigger }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -575,7 +575,7 @@ export function useCanvasSetting(executeEffect = true) {
|
|||||||
|
|
||||||
/** 모듈 선택 데이터 초기화 */
|
/** 모듈 선택 데이터 초기화 */
|
||||||
resetModuleSelectionData()
|
resetModuleSelectionData()
|
||||||
moduleSelectedDataTrigger({ common: {}, module: {}, roofConstructions: [] })
|
// moduleSelectedDataTrigger({ common: {}, module: {}, roofConstructions: [] })
|
||||||
const isModuleExist = canvas.getObjects().some((obj) => obj.name === POLYGON_TYPE.MODULE)
|
const isModuleExist = canvas.getObjects().some((obj) => obj.name === POLYGON_TYPE.MODULE)
|
||||||
if (!isModuleExist) {
|
if (!isModuleExist) {
|
||||||
resetSelectedModules()
|
resetSelectedModules()
|
||||||
|
|||||||
@ -9,13 +9,16 @@ import { canvasState, currentCanvasPlanState, plansState, canvasSettingState } f
|
|||||||
import { useAxios } from '@/hooks/useAxios'
|
import { useAxios } from '@/hooks/useAxios'
|
||||||
import { useMessage } from '@/hooks/useMessage'
|
import { useMessage } from '@/hooks/useMessage'
|
||||||
import { useSwal } from '@/hooks/useSwal'
|
import { useSwal } from '@/hooks/useSwal'
|
||||||
import { SAVE_KEY } from '@/common/common'
|
import { POLYGON_TYPE, SAVE_KEY } from '@/common/common'
|
||||||
import { removeImage } from '@/lib/fileAction'
|
import { removeImage } from '@/lib/fileAction'
|
||||||
import { FloorPlanContext } from '@/app/floor-plan/FloorPlanProvider'
|
import { FloorPlanContext } from '@/app/floor-plan/FloorPlanProvider'
|
||||||
import { useEstimateController } from '@/hooks/floorPlan/estimate/useEstimateController'
|
import { useEstimateController } from '@/hooks/floorPlan/estimate/useEstimateController'
|
||||||
import { outerLinePointsState } from '@/store/outerLineAtom'
|
import { outerLinePointsState } from '@/store/outerLineAtom'
|
||||||
import { placementShapeDrawingPointsState } from '@/store/placementShapeDrawingAtom'
|
import { placementShapeDrawingPointsState } from '@/store/placementShapeDrawingAtom'
|
||||||
import { useCanvasSetting } from '@/hooks/option/useCanvasSetting'
|
import { useCanvasSetting } from '@/hooks/option/useCanvasSetting'
|
||||||
|
import { compasDegAtom } from '@/store/orientationAtom'
|
||||||
|
import { moduleSelectionDataState, selectedModuleState } from '@/store/selectedModuleOptions'
|
||||||
|
import { useCanvasPopupStatusController } from './common/useCanvasPopupStatusController'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 플랜 처리 훅
|
* 플랜 처리 훅
|
||||||
@ -38,7 +41,7 @@ export function usePlan(params = {}) {
|
|||||||
|
|
||||||
const { swalFire } = useSwal()
|
const { swalFire } = useSwal()
|
||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
const { get, promisePost, promisePut, promiseDel, promiseGet } = useAxios()
|
const { get, post, promisePost, promisePut, promiseDel, promiseGet } = useAxios()
|
||||||
|
|
||||||
const { setEstimateContextState } = useEstimateController()
|
const { setEstimateContextState } = useEstimateController()
|
||||||
|
|
||||||
@ -48,6 +51,14 @@ export function usePlan(params = {}) {
|
|||||||
const { fetchBasicSettings, basicSettingCopySave } = useCanvasSetting()
|
const { fetchBasicSettings, basicSettingCopySave } = useCanvasSetting()
|
||||||
const [canvasSetting, setCanvasSetting] = useRecoilState(canvasSettingState)
|
const [canvasSetting, setCanvasSetting] = useRecoilState(canvasSettingState)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 플랜 복사 시 모듈이 있을경우 모듈 데이터 복사하기 위한 처리
|
||||||
|
*/
|
||||||
|
const { getModuleSelection } = useCanvasPopupStatusController()
|
||||||
|
const [compasDeg, setCompasDeg] = useRecoilState(compasDegAtom)
|
||||||
|
const [moduleSelectionDataStore, setModuleSelectionDataStore] = useRecoilState(moduleSelectionDataState)
|
||||||
|
const [selectedModules, setSelectedModules] = useRecoilState(selectedModuleState)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 마우스 포인터의 가이드라인 제거
|
* 마우스 포인터의 가이드라인 제거
|
||||||
*/
|
*/
|
||||||
@ -191,7 +202,7 @@ export function usePlan(params = {}) {
|
|||||||
objectNo: objectNo,
|
objectNo: objectNo,
|
||||||
copyFlg: '0',
|
copyFlg: '0',
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
const res = await promisePost({ url: '/api/object/add-plan', data: planData })
|
const res = await promisePost({ url: '/api/object/add-plan', data: planData })
|
||||||
let newPlan = {
|
let newPlan = {
|
||||||
id: res.data.canvasId,
|
id: res.data.canvasId,
|
||||||
@ -231,15 +242,54 @@ export function usePlan(params = {}) {
|
|||||||
planNo: newPlan.planNo,
|
planNo: newPlan.planNo,
|
||||||
})),
|
})),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 방위 데이터 복사
|
||||||
|
*/
|
||||||
|
const sourceDegree = await getModuleSelection(1)
|
||||||
|
console.log('🚀 ~ sourceDegree:', sourceDegree)
|
||||||
|
const degreeData = {
|
||||||
|
objectNo,
|
||||||
|
planNo: parseInt(newPlan.planNo),
|
||||||
|
popupType: 1,
|
||||||
|
popupStatus: sourceDegree.popupStatus,
|
||||||
|
}
|
||||||
|
console.log('🚀 ~ postObjectPlan ~ degreeData:', degreeData)
|
||||||
|
await post({ url: `/api/v1/canvas-popup-status`, data: degreeData })
|
||||||
|
/** 리코일 세팅 */
|
||||||
|
setCompasDeg(sourceDegree.popupStatus)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 모듈 선택 데이터 복사
|
||||||
|
*/
|
||||||
|
const moduleSelectionData = await getModuleSelection(2)
|
||||||
|
console.log('🚀 ~ moduleSelectionData:', moduleSelectionData)
|
||||||
|
const moduleStatus = moduleSelectionData.popupStatus.replace(/"/g, '\"')
|
||||||
|
const moduleData = {
|
||||||
|
objectNo,
|
||||||
|
planNo: parseInt(newPlan.planNo),
|
||||||
|
popupType: 2,
|
||||||
|
popupStatus: moduleStatus,
|
||||||
|
}
|
||||||
|
console.log('🚀 ~ postObjectPlan ~ moduleData:', moduleData)
|
||||||
|
await post({ url: `/api/v1/canvas-popup-status`, data: moduleData })
|
||||||
|
const copyData = JSON.parse(moduleStatus)
|
||||||
|
console.log('🚀 ~ postObjectPlan ~ copyData:', copyData)
|
||||||
|
|
||||||
|
/** 리코일 세팅 */
|
||||||
|
setModuleSelectionDataStore(copyData)
|
||||||
|
if (copyData.module) setSelectedModules(copyData.module)
|
||||||
|
const roofSurfaceList = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE)
|
||||||
|
const modules = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE)
|
||||||
|
roofSurfaceList.forEach((surface) => {
|
||||||
|
surface.modules = modules.filter((module) => module.surfaceId === surface.id)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
setCurrentCanvasPlan(newPlan)
|
setCurrentCanvasPlan(newPlan)
|
||||||
setPlans((plans) => [...plans.map((plan) => ({ ...plan, isCurrent: false })), newPlan])
|
setPlans((plans) => [...plans.map((plan) => ({ ...plan, isCurrent: false })), newPlan])
|
||||||
|
|
||||||
swalFire({ text: getMessage('plan.message.save') })
|
swalFire({ text: getMessage('plan.message.save') })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
|
||||||
swalFire({ text: error.response.data.message, icon: 'error' })
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user