Merge branch 'dev' into dev-yj
This commit is contained in:
commit
393cfd5277
@ -74,7 +74,7 @@ export default function CanvasMenu(props) {
|
|||||||
const [estimateCopyPopupOpen, setEstimateCopyPopupOpen] = useState(false)
|
const [estimateCopyPopupOpen, setEstimateCopyPopupOpen] = useState(false)
|
||||||
|
|
||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
const { saveCanvas } = usePlan()
|
const { saveCanvas, reloadCanvasStatus } = usePlan()
|
||||||
const { swalFire } = useSwal()
|
const { swalFire } = useSwal()
|
||||||
const { initEvent, addCanvasMouseEventListener, addDocumentEventListener } = useEvent()
|
const { initEvent, addCanvasMouseEventListener, addDocumentEventListener } = useEvent()
|
||||||
// const { initEvent, addCanvasMouseEventListener, addDocumentEventListener } = useContext(EventContext)
|
// const { initEvent, addCanvasMouseEventListener, addDocumentEventListener } = useContext(EventContext)
|
||||||
@ -149,7 +149,7 @@ export default function CanvasMenu(props) {
|
|||||||
setIsGlobalLoading(false)
|
setIsGlobalLoading(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
const onClickNav = (menu) => {
|
const onClickNav = async (menu) => {
|
||||||
switch (menu.index) {
|
switch (menu.index) {
|
||||||
case 0:
|
case 0:
|
||||||
swalFire({
|
swalFire({
|
||||||
@ -164,17 +164,45 @@ export default function CanvasMenu(props) {
|
|||||||
case 1:
|
case 1:
|
||||||
setType('placementShape')
|
setType('placementShape')
|
||||||
onClickPlacementInitialMenu()
|
onClickPlacementInitialMenu()
|
||||||
|
await reloadCanvasStatus(objectNo, pid)
|
||||||
break
|
break
|
||||||
case 2:
|
case 2:
|
||||||
setType('outline')
|
setType('outline')
|
||||||
|
await reloadCanvasStatus(objectNo, pid)
|
||||||
break
|
break
|
||||||
case 3:
|
case 3:
|
||||||
setType('surface')
|
|
||||||
break
|
|
||||||
case 4:
|
|
||||||
console.log('🚀 ~ onClickNav ~ menu:', menu)
|
console.log('🚀 ~ onClickNav ~ menu:', menu)
|
||||||
console.log('🚀 ~ onClickNav ~ menuNumber:', menuNumber)
|
console.log('🚀 ~ onClickNav ~ menuNumber:', menuNumber)
|
||||||
|
if (menuNumber > menu.index) {
|
||||||
|
const modules = canvas.getObjects().filter((module) => module.name === POLYGON_TYPE.MODULE)
|
||||||
|
if (modules.length > 0) {
|
||||||
|
swalFire({
|
||||||
|
text: getMessage('module.delete.confirm'),
|
||||||
|
type: 'confirm',
|
||||||
|
confirmFn: () => {
|
||||||
|
//해당 메뉴 이동시 배치면 삭제
|
||||||
|
const moduleSurfacesArray = canvas
|
||||||
|
.getObjects()
|
||||||
|
.filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE || obj.name === POLYGON_TYPE.MODULE)
|
||||||
|
if (moduleSurfacesArray.length > 0) {
|
||||||
|
moduleSurfacesArray.forEach((moduleSurface) => {
|
||||||
|
canvas.remove(moduleSurface)
|
||||||
|
})
|
||||||
|
canvas.renderAll()
|
||||||
|
}
|
||||||
|
setType('surface')
|
||||||
|
},
|
||||||
|
denyFn: () => {
|
||||||
|
setType('surface')
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setType('surface')
|
||||||
|
}
|
||||||
|
await reloadCanvasStatus(objectNo, pid)
|
||||||
|
break
|
||||||
|
case 4:
|
||||||
if (menuNumber < menu.index) {
|
if (menuNumber < menu.index) {
|
||||||
if (!checkMenuAndCanvasState()) {
|
if (!checkMenuAndCanvasState()) {
|
||||||
swalFire({ text: getMessage('menu.validation.canvas.roof') })
|
swalFire({ text: getMessage('menu.validation.canvas.roof') })
|
||||||
@ -185,7 +213,7 @@ export default function CanvasMenu(props) {
|
|||||||
} else {
|
} else {
|
||||||
router.push(`/floor-plan?pid=${pid}&objectNo=${objectNo}`)
|
router.push(`/floor-plan?pid=${pid}&objectNo=${objectNo}`)
|
||||||
}
|
}
|
||||||
|
await reloadCanvasStatus(objectNo, pid)
|
||||||
break
|
break
|
||||||
case 5:
|
case 5:
|
||||||
setIsGlobalLoading(true)
|
setIsGlobalLoading(true)
|
||||||
@ -591,10 +619,10 @@ export default function CanvasMenu(props) {
|
|||||||
<li
|
<li
|
||||||
key={`canvas-menu-${menu.index}`}
|
key={`canvas-menu-${menu.index}`}
|
||||||
className={`canvas-menu-item ${menuNumber === menu.index ? 'active' : ''}`}
|
className={`canvas-menu-item ${menuNumber === menu.index ? 'active' : ''}`}
|
||||||
onClick={() => {
|
onClick={async () => {
|
||||||
if (['2', '3'].includes(canvasSetting?.roofSizeSet) && menu.index === 2) return
|
if (['2', '3'].includes(canvasSetting?.roofSizeSet) && menu.index === 2) return
|
||||||
if (menuNumber === 4 && [1, 2].includes(menu.index)) return
|
if (menuNumber === 4 && [1, 2].includes(menu.index)) return
|
||||||
onClickNav(menu)
|
await onClickNav(menu)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<button className={checkMenuState(menu) ? 'no-click' : ''}>
|
<button className={checkMenuState(menu) ? 'no-click' : ''}>
|
||||||
|
|||||||
@ -93,13 +93,6 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
// 수동할당 시 모듈 삭제
|
// 수동할당 시 모듈 삭제
|
||||||
useEffect(() => {
|
|
||||||
if (allocationType === ALLOCATION_TYPE.PASSIVITY && tabNum === 2) {
|
|
||||||
const notAllocationModules = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE && !obj.circuit)
|
|
||||||
canvas.remove(...notAllocationModules)
|
|
||||||
canvas.renderAll()
|
|
||||||
}
|
|
||||||
}, [tabNum])
|
|
||||||
|
|
||||||
// 시리즈중 자동으로 추천 PCS 정보 조회
|
// 시리즈중 자동으로 추천 PCS 정보 조회
|
||||||
const onAutoRecommend = () => {
|
const onAutoRecommend = () => {
|
||||||
@ -459,6 +452,21 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleStepUp = () => {
|
||||||
|
const notAllocationModules = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE && !obj.circuit)
|
||||||
|
if (notAllocationModules.length > 0) {
|
||||||
|
swalFire({
|
||||||
|
title: getMessage('not.allocation.exist.module'),
|
||||||
|
type: 'alert',
|
||||||
|
confirmFn: () => {},
|
||||||
|
})
|
||||||
|
return
|
||||||
|
// canvas.remove(...notAllocationModules)
|
||||||
|
// canvas.renderAll()
|
||||||
|
}
|
||||||
|
setTabNum(2)
|
||||||
|
}
|
||||||
|
|
||||||
// 닫기 버튼 클릭 시 처리하는 함수 추가
|
// 닫기 버튼 클릭 시 처리하는 함수 추가
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
// // 회로 번호 텍스트 제거
|
// // 회로 번호 텍스트 제거
|
||||||
@ -514,7 +522,7 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
<button className="btn-frame modal mr5 " onClick={() => onClickPrev()}>
|
<button className="btn-frame modal mr5 " onClick={() => onClickPrev()}>
|
||||||
{getMessage('modal.common.prev')}
|
{getMessage('modal.common.prev')}
|
||||||
</button>
|
</button>
|
||||||
<button className="btn-frame modal act" onClick={() => setTabNum(2)}>
|
<button className="btn-frame modal act" onClick={() => handleStepUp()}>
|
||||||
{getMessage('modal.circuit.trestle.setting.circuit.allocation')}({getMessage('modal.circuit.trestle.setting.step.up.allocation')})
|
{getMessage('modal.circuit.trestle.setting.circuit.allocation')}({getMessage('modal.circuit.trestle.setting.step.up.allocation')})
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -36,7 +36,7 @@ export default function PanelEdit(props) {
|
|||||||
const { moduleMove, moduleCopy, moduleMultiMove, moduleMultiCopy, moduleMoveAll, moduleCopyAll } = useModule()
|
const { moduleMove, moduleCopy, moduleMultiMove, moduleMultiCopy, moduleMoveAll, moduleCopyAll } = useModule()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (canvas) {
|
if (!canvas) {
|
||||||
const isSetupModules = canvas.getObjects().filter((obj) => obj.name === 'module') // selectedObj에 없는 객체만 필터링
|
const isSetupModules = canvas.getObjects().filter((obj) => obj.name === 'module') // selectedObj에 없는 객체만 필터링
|
||||||
isSetupModules.forEach((obj) => obj.set({ lockMovementX: false, lockMovementY: false }))
|
isSetupModules.forEach((obj) => obj.set({ lockMovementX: false, lockMovementY: false }))
|
||||||
}
|
}
|
||||||
@ -52,8 +52,8 @@ export default function PanelEdit(props) {
|
|||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
debugger
|
||||||
const completeSurfaces = canvas.getObject().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE && obj.isComplete)
|
const completeSurfaces = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE && obj.isComplete)
|
||||||
|
|
||||||
if (completeSurfaces.length > 0) {
|
if (completeSurfaces.length > 0) {
|
||||||
swalFire({
|
swalFire({
|
||||||
|
|||||||
@ -47,6 +47,7 @@ export function useModule() {
|
|||||||
|
|
||||||
canvas.discardActiveObject() //선택해제
|
canvas.discardActiveObject() //선택해제
|
||||||
|
|
||||||
|
debugger
|
||||||
const isSetupModules = getOtherModules(selectedObj)
|
const isSetupModules = getOtherModules(selectedObj)
|
||||||
const selectedModules = canvas.getObjects().filter((obj) => selectedIds.includes(obj.id) && obj.name === 'module') //선택했던 객체들만 가져옴
|
const selectedModules = canvas.getObjects().filter((obj) => selectedIds.includes(obj.id) && obj.name === 'module') //선택했던 객체들만 가져옴
|
||||||
const setupSurface = canvas
|
const setupSurface = canvas
|
||||||
|
|||||||
@ -134,7 +134,7 @@ export function usePlan(params = {}) {
|
|||||||
/**
|
/**
|
||||||
* objectNo에 해당하는 canvas 목록을 조회
|
* objectNo에 해당하는 canvas 목록을 조회
|
||||||
*/
|
*/
|
||||||
const getCanvasByObjectNo = async (userId, objectNo, planNo) => {
|
const getCanvasByObjectNo = async (objectNo, planNo) => {
|
||||||
return await get({ url: `/api/canvas-management/canvas-statuses/by-object/${objectNo}` }).then((res) =>
|
return await get({ url: `/api/canvas-management/canvas-statuses/by-object/${objectNo}` }).then((res) =>
|
||||||
res.map((item) => ({
|
res.map((item) => ({
|
||||||
id: item.id,
|
id: item.id,
|
||||||
@ -397,7 +397,7 @@ export function usePlan(params = {}) {
|
|||||||
*/
|
*/
|
||||||
const loadCanvasPlanData = async (userId, objectNo, planNo) => {
|
const loadCanvasPlanData = async (userId, objectNo, planNo) => {
|
||||||
console.log('🚀 ~ loadCanvasPlanData ~ userId, objectNo, planNo:', userId, objectNo, planNo)
|
console.log('🚀 ~ loadCanvasPlanData ~ userId, objectNo, planNo:', userId, objectNo, planNo)
|
||||||
await getCanvasByObjectNo(userId, objectNo, planNo).then(async (res) => {
|
await getCanvasByObjectNo(objectNo, planNo).then(async (res) => {
|
||||||
if (res.length > 0) {
|
if (res.length > 0) {
|
||||||
setCurrentCanvasPlan(res.find((plan) => plan.planNo === planNo))
|
setCurrentCanvasPlan(res.find((plan) => plan.planNo === planNo))
|
||||||
setPlans(res)
|
setPlans(res)
|
||||||
@ -415,6 +415,22 @@ export function usePlan(params = {}) {
|
|||||||
setPlans((plans) => plans.map((plan) => ({ ...plan, canvasStatus: null })))
|
setPlans((plans) => plans.map((plan) => ({ ...plan, canvasStatus: null })))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* plan canvasStatus 불러오기
|
||||||
|
*
|
||||||
|
* 견적서/발전시뮬레이션에서 플랜 이동 시 현재 플랜의 canvasStatus를 불러오기 위해 사용
|
||||||
|
*/
|
||||||
|
const reloadCanvasStatus = async (objectNo, planNo) => {
|
||||||
|
if (pathname === '/floor-plan/estimate/5' || pathname === '/floor-plan/simulator/6') {
|
||||||
|
await getCanvasByObjectNo(objectNo, planNo).then((res) => {
|
||||||
|
if (res.length > 0) {
|
||||||
|
setCurrentCanvasPlan((prev) => ({ ...prev, canvasStatus: res.find((plan) => plan.planNo === planNo).canvasStatus }))
|
||||||
|
setPlans((plans) => plans.map((plan) => ({ ...plan, canvasStatus: res.find((plan) => plan.planNo === planNo).canvasStatus })))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 현재 plan 이동 -> 새로운 링크로 이동
|
* 현재 plan 이동 -> 새로운 링크로 이동
|
||||||
*/
|
*/
|
||||||
@ -434,5 +450,6 @@ export function usePlan(params = {}) {
|
|||||||
handleDeletePlan,
|
handleDeletePlan,
|
||||||
loadCanvasPlanData,
|
loadCanvasPlanData,
|
||||||
resetCanvasStatus,
|
resetCanvasStatus,
|
||||||
|
reloadCanvasStatus,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1010,5 +1010,8 @@
|
|||||||
"batch.object.outside.roof": "オブジェクトは屋根に設置する必要があります。",
|
"batch.object.outside.roof": "オブジェクトは屋根に設置する必要があります。",
|
||||||
"batch.object.notinstall.cross": "オブジェクトは重複してインストールできません。",
|
"batch.object.notinstall.cross": "オブジェクトは重複してインストールできません。",
|
||||||
"module.not.batch.north": "북쪽에는 모듈을 배치할 수 없습니다.",
|
"module.not.batch.north": "북쪽에는 모듈을 배치할 수 없습니다.",
|
||||||
"max.select": "최대 {0}개까지 선택할 수 있습니다.(JA)"
|
"module.trestleDetail.not.exist": "가대 상세 정보가 없습니다.",
|
||||||
|
"max.select": "최대 {0}개까지 선택할 수 있습니다.(JA)",
|
||||||
|
"module.delete.confirm": "パネルを削除して面入力に戻ります。正しいですか?\nはい]を選択すると削除し、面入力に戻ります。\nいいえ」を選択すると、削除せずに現在の状態を維持します。",
|
||||||
|
"not.allocation.exist.module": "할당하지 않은 모듈이 있습니다.(JA)"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1012,5 +1012,7 @@
|
|||||||
"batch.object.notinstall.cross": "오브젝트는 겹쳐서 설치 할 수 없습니다.",
|
"batch.object.notinstall.cross": "오브젝트는 겹쳐서 설치 할 수 없습니다.",
|
||||||
"module.not.batch.north": "북쪽에는 모듈을 배치할 수 없습니다.",
|
"module.not.batch.north": "북쪽에는 모듈을 배치할 수 없습니다.",
|
||||||
"module.trestleDetail.not.exist": "가대 상세 정보가 없습니다.",
|
"module.trestleDetail.not.exist": "가대 상세 정보가 없습니다.",
|
||||||
"max.select": "최대 {0}개까지 선택할 수 있습니다."
|
"max.select": "최대 {0}개까지 선택할 수 있습니다.",
|
||||||
|
"module.delete.confirm": "패널을 삭제하고 면입력으로 돌아갑니다. 맞습니까?\n[예]를 선택하면 삭제하고, 면 입력으로 돌아갑니다.\n[아니오]를 선택하면 삭제하지 않고 현재 상태를 유지합니다.",
|
||||||
|
"not.allocation.exist.module": "할당하지 않은 모듈이 있습니다."
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user