📌fix: 견적서 생성 호출시 로딩바 추가

This commit is contained in:
yoosangwook 2025-02-11 10:46:48 +09:00
parent 62b86764d5
commit 18b9cafbce
5 changed files with 53 additions and 40 deletions

View File

@ -72,10 +72,10 @@ export default async function RootLayout({ children }) {
</div>
<Footer />
</div>
</QcastProvider>
)}
<QModal />
<PopupManager />
</QcastProvider>
)}
</body>
</html>
</GlobalDataProvider>

View File

@ -24,6 +24,7 @@ import { useCircuitTrestle } from '@/hooks/useCirCuitTrestle'
import { useCanvasPopupStatusController } from '@/hooks/common/useCanvasPopupStatusController'
import { useImgLoader } from '@/hooks/floorPlan/useImgLoader'
import { usePlan } from '@/hooks/usePlan'
import { QcastContext } from '@/app/QcastProvider'
const ALLOCATION_TYPE = {
AUTO: 'auto',
@ -56,6 +57,8 @@ export default function CircuitTrestleSetting({ id }) {
const { handleCanvasToPng } = useImgLoader()
const { saveCanvas } = usePlan()
const { setIsGlobalLoading } = useContext(QcastContext)
const {
makers,
setMakers,
@ -324,6 +327,7 @@ export default function CircuitTrestleSetting({ id }) {
// ()
const onApply = async () => {
setIsGlobalLoading(true)
canvas
.getObjects()
.filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE)

View File

@ -4,6 +4,8 @@ import { useCanvas } from '../useCanvas'
import { useAxios } from '../useAxios'
import { usePlan } from '../usePlan'
import { POLYGON_TYPE } from '@/common/common'
import { QcastContext } from '@/app/QcastProvider'
import { useContext } from 'react'
/**
* 이미지 로더 hook
@ -13,7 +15,7 @@ export function useImgLoader() {
const canvas = useRecoilValue(canvasState)
const { currentCanvasPlan } = usePlan()
const { post } = useAxios()
const { setIsGlobalLoading } = useContext(QcastContext)
/**
* 이미지 저장 왼쪽 , 오른쪽 아래 좌표
* return [start, end]
@ -39,6 +41,7 @@ export function useImgLoader() {
* @param {integer} type 1: 모듈만 있는 상태, 2: 가대까지 올린 상태
*/
const handleCanvasToPng = async (type) => {
try {
removeMouseLines()
canvas.getObjects('image').forEach((obj) => {
@ -81,6 +84,10 @@ export function useImgLoader() {
console.log('🚀 ~ handleCanvasToPng ~ result:', result)
return result
} catch (e) {
setIsGlobalLoading(false)
console.log('🚀 ~ handleCanvasToPng ~ e:', e)
}
}
/**

View File

@ -598,6 +598,7 @@ export const useTrestle = () => {
console.error(e)
// clear()
setViewCircuitNumberTexts(true)
setIsGlobalLoading(false)
return null
}
}

View File

@ -60,6 +60,7 @@ export function useEstimate() {
moveEstimate(planNo, objectNo)
})
.catch((error) => {
setIsGlobalLoading(false)
swalFire({ text: error.message, icon: 'error' })
})
}