Merge branch 'dev' into dev-yj

This commit is contained in:
yjnoh 2025-02-08 16:22:16 +09:00
commit 0861b7b70f
3 changed files with 15 additions and 10 deletions

View File

@ -33,7 +33,7 @@ export default function CanvasFrame() {
const currentMenu = useRecoilValue(currentMenuState)
const { floorPlanState } = useContext(FloorPlanContext)
const { contextMenu, handleClick } = useContextMenu()
const { currentCanvasPlan } = usePlan()
const { plans, currentCanvasPlan } = usePlan()
const totalDisplay = useRecoilValue(totalDisplaySelector) //
const { setIsGlobalLoading } = useContext(QcastContext)
const resetModuleStatisticsState = useResetRecoilState(moduleStatisticsState)
@ -46,11 +46,14 @@ export default function CanvasFrame() {
const loadCanvas = () => {
if (canvas) {
canvas?.clear() // .
if (currentCanvasPlan?.canvasStatus && floorPlanState.objectNo === currentCanvasPlan.objectNo) {
canvas?.loadFromJSON(JSON.parse(currentCanvasPlan.canvasStatus), function () {
canvasLoadInit() //config
canvas?.renderAll() // .
})
if (currentCanvasPlan) {
const plan = plans.find((plan) => plan.id === currentCanvasPlan.id)
if (plan?.canvasStatus && floorPlanState.objectNo === currentCanvasPlan.objectNo) {
canvas?.loadFromJSON(JSON.parse(plan.canvasStatus), function () {
canvasLoadInit() //config
canvas?.renderAll() // .
})
}
}
gridInit()
}

View File

@ -24,6 +24,7 @@ import { useEstimate } from '@/hooks/useEstimate'
import { useCircuitTrestle } from '@/hooks/useCirCuitTrestle'
import { useCanvasPopupStatusController } from '@/hooks/common/useCanvasPopupStatusController'
import { useImgLoader } from '@/hooks/floorPlan/useImgLoader'
import { usePlan } from '@/hooks/usePlan'
const ALLOCATION_TYPE = {
AUTO: 'auto',
@ -53,6 +54,7 @@ export default function CircuitTrestleSetting({ id }) {
const [seletedOption, setSeletedOption] = useState(null)
const { handleCanvasToPng } = useImgLoader()
const { saveCanvas } = usePlan()
const {
makers,
@ -345,6 +347,9 @@ export default function CircuitTrestleSetting({ id }) {
if (result) {
handleCanvasToPng(2)
setViewCircuitNumberTexts(true)
//
await saveCanvas(false)
//
await saveEstimate(result)
}
// removeNotAllocationModules()

View File

@ -5,7 +5,6 @@ import { useRecoilValue } from 'recoil'
import { useAxios } from '@/hooks/useAxios'
import { useSwal } from '@/hooks/useSwal'
import { usePlan } from '@/hooks/usePlan'
import { GlobalDataContext } from '@/app/GlobalDataProvider'
import { QcastContext } from '@/app/QcastProvider'
import { currentCanvasPlanState } from '@/store/canvasAtom'
@ -20,7 +19,6 @@ export function useEstimate() {
const { promisePost } = useAxios()
const { swalFire } = useSwal()
const { saveCanvas } = usePlan()
/**
* 도면 견적서 저장
@ -58,8 +56,7 @@ export function useEstimate() {
await promisePost({ url: '/api/estimate/save-estimate', data: saveEstimateData })
.then(async () => {
// 견적서 저장이 완료되면 캔버스 저장 후 견적서 페이지로 이동
await saveCanvas(false)
// 견적서 저장이 완료되면 견적서 페이지로 이동
moveEstimate(planNo, objectNo)
})
.catch((error) => {