Merge branch 'dev' into dev-yj
This commit is contained in:
commit
58ab20a807
@ -9,7 +9,8 @@ import QSelectBox from '@/components/common/select/QSelectBox'
|
|||||||
|
|
||||||
import { useMessage } from '@/hooks/useMessage'
|
import { useMessage } from '@/hooks/useMessage'
|
||||||
import { usePlan } from '@/hooks/usePlan'
|
import { usePlan } from '@/hooks/usePlan'
|
||||||
import { canvasState, canvasZoomState, currentMenuState, verticalHorizontalModeState } from '@/store/canvasAtom'
|
import { useSwal } from '@/hooks/useSwal'
|
||||||
|
import { canvasState, canvasZoomState, currentMenuState, currentCanvasPlanState, verticalHorizontalModeState } from '@/store/canvasAtom'
|
||||||
import { sessionStore } from '@/store/commonAtom'
|
import { sessionStore } from '@/store/commonAtom'
|
||||||
import { outerLinePointsState } from '@/store/outerLineAtom'
|
import { outerLinePointsState } from '@/store/outerLineAtom'
|
||||||
import { appMessageStore, globalLocaleStore } from '@/store/localeAtom'
|
import { appMessageStore, globalLocaleStore } from '@/store/localeAtom'
|
||||||
@ -40,6 +41,7 @@ export default function CanvasMenu(props) {
|
|||||||
const setCurrentMenu = useSetRecoilState(currentMenuState)
|
const setCurrentMenu = useSetRecoilState(currentMenuState)
|
||||||
const setPoints = useSetRecoilState(outerLinePointsState)
|
const setPoints = useSetRecoilState(outerLinePointsState)
|
||||||
const [canvasZoom, setCanvasZoom] = useRecoilState(canvasZoomState)
|
const [canvasZoom, setCanvasZoom] = useRecoilState(canvasZoomState)
|
||||||
|
const [currentCanvasPlan, setcurrentCanvasPlan] = useRecoilState(currentCanvasPlanState)
|
||||||
|
|
||||||
const globalLocale = useRecoilValue(globalLocaleStore)
|
const globalLocale = useRecoilValue(globalLocaleStore)
|
||||||
const canvas = useRecoilValue(canvasState)
|
const canvas = useRecoilValue(canvasState)
|
||||||
@ -47,6 +49,7 @@ export default function CanvasMenu(props) {
|
|||||||
|
|
||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
const { saveCanvas } = usePlan()
|
const { saveCanvas } = usePlan()
|
||||||
|
const { swalFire } = useSwal()
|
||||||
|
|
||||||
const SelectOption = [{ name: '瓦53A' }, { name: '瓦53A' }]
|
const SelectOption = [{ name: '瓦53A' }, { name: '瓦53A' }]
|
||||||
const onClickNav = (menu) => {
|
const onClickNav = (menu) => {
|
||||||
@ -78,7 +81,13 @@ export default function CanvasMenu(props) {
|
|||||||
|
|
||||||
// 저장버튼(btn08) 클릭 시 호출되는 함수
|
// 저장버튼(btn08) 클릭 시 호출되는 함수
|
||||||
const handleSaveCanvas = () => {
|
const handleSaveCanvas = () => {
|
||||||
saveCanvas(sessionState.userId)
|
swalFire({
|
||||||
|
html: getMessage('common.message.confirm.save') + `</br>${currentCanvasPlan.name}`,
|
||||||
|
type: 'confirm',
|
||||||
|
confirmFn: () => {
|
||||||
|
saveCanvas(sessionState.userId)
|
||||||
|
},
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleClear = () => {
|
const handleClear = () => {
|
||||||
|
|||||||
@ -2,14 +2,13 @@ import { useRecoilState } from 'recoil'
|
|||||||
import { canvasState, currentCanvasPlanState, initCanvasPlansState } from '@/store/canvasAtom'
|
import { canvasState, currentCanvasPlanState, initCanvasPlansState } from '@/store/canvasAtom'
|
||||||
import { useAxios } from '@/hooks/useAxios'
|
import { useAxios } from '@/hooks/useAxios'
|
||||||
import { useMessage } from '@/hooks/useMessage'
|
import { useMessage } from '@/hooks/useMessage'
|
||||||
import { toastUp } from '@/hooks/useToast'
|
import { useSwal } from '@/hooks/useSwal'
|
||||||
import { sessionStore } from '@/store/commonAtom'
|
|
||||||
import { useState } from 'react'
|
|
||||||
|
|
||||||
export function usePlan() {
|
export function usePlan() {
|
||||||
const [canvas, setCanvas] = useRecoilState(canvasState)
|
const [canvas, setCanvas] = useRecoilState(canvasState)
|
||||||
const [currentCanvasPlan, setcurrentCanvasPlan] = useRecoilState(currentCanvasPlanState)
|
const [currentCanvasPlan, setcurrentCanvasPlan] = useRecoilState(currentCanvasPlanState)
|
||||||
const [initCanvasPlans, setInitCanvasPlans] = useRecoilState(initCanvasPlansState)
|
const [initCanvasPlans, setInitCanvasPlans] = useRecoilState(initCanvasPlansState)
|
||||||
|
const { swalFire } = useSwal()
|
||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
const { get, promisePost, promisePut, promiseDel } = useAxios()
|
const { get, promisePost, promisePut, promiseDel } = useAxios()
|
||||||
|
|
||||||
@ -101,14 +100,14 @@ export function usePlan() {
|
|||||||
|
|
||||||
await promisePut({ url: '/api/canvas-management/canvas-statuses', data: planData })
|
await promisePut({ url: '/api/canvas-management/canvas-statuses', data: planData })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
toastUp({ message: getMessage('common.message.save'), type: 'success' }) // 성공 시 메세지 없음
|
swalFire({ text: getMessage('common.message.save') })
|
||||||
console.log('[PUT] canvas-statuses res :::::::: %o', res)
|
console.log('[PUT] canvas-statuses res :::::::: %o', res)
|
||||||
setInitCanvasPlans((initCanvasPlans) =>
|
setInitCanvasPlans((initCanvasPlans) =>
|
||||||
initCanvasPlans.map((plan) => (plan.id === currentCanvasPlan.id ? { ...plan, canvasStatus: canvasStatus } : plan)),
|
initCanvasPlans.map((plan) => (plan.id === currentCanvasPlan.id ? { ...plan, canvasStatus: canvasStatus } : plan)),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
toastUp({ message: error.message, type: 'error' })
|
swalFire({ text: error.message, icon: 'error' })
|
||||||
console.error('[PUT] canvas-statuses error :::::::: %o', error)
|
console.error('[PUT] canvas-statuses error :::::::: %o', error)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
@ -122,11 +121,11 @@ export function usePlan() {
|
|||||||
|
|
||||||
await promisePost({ url: '/api/canvas-management/canvas-statuses', data: planData })
|
await promisePost({ url: '/api/canvas-management/canvas-statuses', data: planData })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
toastUp({ message: getMessage('common.message.save'), type: 'success' }) // 성공 시 메세지 없음
|
swalFire({ text: getMessage('common.message.save') })
|
||||||
console.log('[POST] canvas-statuses response :::::::: %o', res)
|
console.log('[POST] canvas-statuses response :::::::: %o', res)
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
toastUp({ message: error.message, type: 'error' })
|
swalFire({ text: error.message, icon: 'error' })
|
||||||
console.error('[POST] canvas-statuses res error :::::::: %o', error)
|
console.error('[POST] canvas-statuses res error :::::::: %o', error)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user