📌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> </div>
<Footer /> <Footer />
</div> </div>
</QcastProvider>
)}
<QModal /> <QModal />
<PopupManager /> <PopupManager />
</QcastProvider>
)}
</body> </body>
</html> </html>
</GlobalDataProvider> </GlobalDataProvider>

View File

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

View File

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

View File

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

View File

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