dev #66
@ -50,6 +50,7 @@ import JA from '@/locales/ja.json'
|
|||||||
import { QcastContext } from '@/app/QcastProvider'
|
import { QcastContext } from '@/app/QcastProvider'
|
||||||
import { useRoofFn } from '@/hooks/common/useRoofFn'
|
import { useRoofFn } from '@/hooks/common/useRoofFn'
|
||||||
import { usePolygon } from '@/hooks/usePolygon'
|
import { usePolygon } from '@/hooks/usePolygon'
|
||||||
|
import { useTrestle } from '@/hooks/module/useTrestle'
|
||||||
export default function CanvasMenu(props) {
|
export default function CanvasMenu(props) {
|
||||||
const { selectedMenu, setSelectedMenu } = props
|
const { selectedMenu, setSelectedMenu } = props
|
||||||
const pathname = usePathname()
|
const pathname = usePathname()
|
||||||
@ -67,6 +68,7 @@ export default function CanvasMenu(props) {
|
|||||||
const globalLocale = useRecoilValue(globalLocaleStore)
|
const globalLocale = useRecoilValue(globalLocaleStore)
|
||||||
const canvas = useRecoilValue(canvasState)
|
const canvas = useRecoilValue(canvasState)
|
||||||
const { handleZoomClear, handleZoom } = useCanvasEvent()
|
const { handleZoomClear, handleZoom } = useCanvasEvent()
|
||||||
|
const { setAllModuleSurfaceIsComplete, isAllComplete } = useTrestle()
|
||||||
const { handleMenu } = useMenu()
|
const { handleMenu } = useMenu()
|
||||||
// const urlParams = useSearchParams()
|
// const urlParams = useSearchParams()
|
||||||
const { handleEstimateSubmit, fetchSetting, estimateContextState, setEstimateContextState } = useEstimateController()
|
const { handleEstimateSubmit, fetchSetting, estimateContextState, setEstimateContextState } = useEstimateController()
|
||||||
@ -194,6 +196,7 @@ export default function CanvasMenu(props) {
|
|||||||
confirmFn: () => {
|
confirmFn: () => {
|
||||||
//해당 메뉴 이동시 배치면 삭제
|
//해당 메뉴 이동시 배치면 삭제
|
||||||
|
|
||||||
|
setAllModuleSurfaceIsComplete(false)
|
||||||
const moduleSurfacesArray = canvas
|
const moduleSurfacesArray = canvas
|
||||||
.getObjects()
|
.getObjects()
|
||||||
.filter((obj) => [POLYGON_TYPE.MODULE_SETUP_SURFACE, POLYGON_TYPE.MODULE, POLYGON_TYPE.OBJECT_SURFACE].includes(obj.name))
|
.filter((obj) => [POLYGON_TYPE.MODULE_SETUP_SURFACE, POLYGON_TYPE.MODULE, POLYGON_TYPE.OBJECT_SURFACE].includes(obj.name))
|
||||||
@ -233,6 +236,10 @@ export default function CanvasMenu(props) {
|
|||||||
await reloadCanvasStatus(objectNo, pid)
|
await reloadCanvasStatus(objectNo, pid)
|
||||||
break
|
break
|
||||||
case 'estimate':
|
case 'estimate':
|
||||||
|
if (!isAllComplete()) {
|
||||||
|
swalFire({ text: getMessage('estimate.menu.move.valid1') })
|
||||||
|
return
|
||||||
|
}
|
||||||
setIsGlobalLoading(true)
|
setIsGlobalLoading(true)
|
||||||
promiseGet({ url: `/api/estimate/${objectNo}/${selectedPlan.planNo}/detail` }).then((res) => {
|
promiseGet({ url: `/api/estimate/${objectNo}/${selectedPlan.planNo}/detail` }).then((res) => {
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
|
|||||||
@ -154,6 +154,7 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
getPcsVoltageChk(pcsVoltageChkParams).then((res) => {
|
getPcsVoltageChk(pcsVoltageChkParams).then((res) => {
|
||||||
if (res.resultCode === 'S') {
|
if (res.resultCode === 'S') {
|
||||||
setTabNum(2)
|
setTabNum(2)
|
||||||
|
setAllModuleSurfaceIsComplete(false)
|
||||||
} else {
|
} else {
|
||||||
swalFire({
|
swalFire({
|
||||||
title: res.resultMsg,
|
title: res.resultMsg,
|
||||||
@ -187,6 +188,7 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (res?.result.resultCode === 'S' && res?.data) {
|
if (res?.result.resultCode === 'S' && res?.data) {
|
||||||
setTabNum(2)
|
setTabNum(2)
|
||||||
|
setAllModuleSurfaceIsComplete(false)
|
||||||
} else {
|
} else {
|
||||||
swalFire({ text: getMessage('common.message.send.error') })
|
swalFire({ text: getMessage('common.message.send.error') })
|
||||||
}
|
}
|
||||||
@ -286,6 +288,8 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
setSelectedModels(pcsItemList)
|
setSelectedModels(pcsItemList)
|
||||||
getPcsVoltageChk(pcsVoltageChkParams).then((res) => {
|
getPcsVoltageChk(pcsVoltageChkParams).then((res) => {
|
||||||
setAllocationType(ALLOCATION_TYPE.PASSIVITY)
|
setAllocationType(ALLOCATION_TYPE.PASSIVITY)
|
||||||
|
setAllModuleSurfaceIsComplete(false)
|
||||||
|
clearTrestle()
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
swalFire({
|
swalFire({
|
||||||
@ -318,6 +322,7 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setAllocationType(ALLOCATION_TYPE.PASSIVITY)
|
setAllocationType(ALLOCATION_TYPE.PASSIVITY)
|
||||||
|
clearTrestle()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -654,6 +659,7 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
setTabNum(2)
|
setTabNum(2)
|
||||||
|
setAllModuleSurfaceIsComplete(false)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3077,6 +3077,9 @@ export const useTrestle = () => {
|
|||||||
// 배치면 전체에 가대 설치 여부
|
// 배치면 전체에 가대 설치 여부
|
||||||
const isAllComplete = () => {
|
const isAllComplete = () => {
|
||||||
const surfaces = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE)
|
const surfaces = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE)
|
||||||
|
if (surfaces.length === 0) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
return surfaces.every((surface) => surface.isComplete)
|
return surfaces.every((surface) => surface.isComplete)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user