북면 설치 불가 작업
This commit is contained in:
parent
a214cd2dff
commit
b2a17d21f8
@ -1,6 +1,7 @@
|
|||||||
'use client'
|
'use client'
|
||||||
import { useEffect, useRef, useState } from 'react'
|
import { useEffect, useRef, useState } from 'react'
|
||||||
import { useOnClickOutside } from 'usehooks-ts'
|
import { useOnClickOutside } from 'usehooks-ts'
|
||||||
|
import { useMessage } from '@/hooks/useMessage'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -26,13 +27,15 @@ export default function QSelectBox({
|
|||||||
showKey = '',
|
showKey = '',
|
||||||
params = {},
|
params = {},
|
||||||
}) {
|
}) {
|
||||||
|
const { getMessage } = useMessage()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 초기 상태 처리
|
* 초기 상태 처리
|
||||||
* useState 초기 값으로 사용해야 해서 useState 보다 위에 작성
|
* useState 초기 값으로 사용해야 해서 useState 보다 위에 작성
|
||||||
* @returns {string} 초기 상태
|
* @returns {string} 초기 상태
|
||||||
*/
|
*/
|
||||||
const handleInitState = () => {
|
const handleInitState = () => {
|
||||||
if (options.length === 0) return title !== '' ? title : '선택하세요.'
|
if (options.length === 0) return title !== '' ? title : getMessage('selectbox.title')
|
||||||
if (showKey !== '' && !value) {
|
if (showKey !== '' && !value) {
|
||||||
//value가 없으면 showKey가 있으면 우선 보여준다
|
//value가 없으면 showKey가 있으면 우선 보여준다
|
||||||
// return options[0][showKey]
|
// return options[0][showKey]
|
||||||
@ -44,13 +47,13 @@ export default function QSelectBox({
|
|||||||
return option[sourceKey] === value[targetKey]
|
return option[sourceKey] === value[targetKey]
|
||||||
})
|
})
|
||||||
if (!option) {
|
if (!option) {
|
||||||
return title !== '' ? title : '선택하세요.'
|
return title !== '' ? title : getMessage('selectbox.title')
|
||||||
} else {
|
} else {
|
||||||
return option[showKey]
|
return option[showKey]
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//일치하는 조건이 없으면 기본값을 보여준다.
|
//일치하는 조건이 없으면 기본값을 보여준다.
|
||||||
return title !== '' ? title : '선택하세요.'
|
return title !== '' ? title : getMessage('selectbox.title')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -25,26 +25,29 @@ import { useCommonUtils } from '@/hooks/common/useCommonUtils'
|
|||||||
import useMenu from '@/hooks/common/useMenu'
|
import useMenu from '@/hooks/common/useMenu'
|
||||||
import { useEstimateController } from '@/hooks/floorPlan/estimate/useEstimateController'
|
import { useEstimateController } from '@/hooks/floorPlan/estimate/useEstimateController'
|
||||||
import { useAxios } from '@/hooks/useAxios'
|
import { useAxios } from '@/hooks/useAxios'
|
||||||
import { useModuleBasicSetting } from '@/hooks/module/useModuleBasicSetting'
|
|
||||||
import { canvasSettingState, canvasState, canvasZoomState, currentMenuState, verticalHorizontalModeState } from '@/store/canvasAtom'
|
import { canvasSettingState, canvasState, canvasZoomState, currentMenuState, 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'
|
||||||
import { addedRoofsState, basicSettingState, selectedRoofMaterialSelector, settingModalFirstOptionsState } from '@/store/settingAtom'
|
import {
|
||||||
|
addedRoofsState,
|
||||||
|
basicSettingState,
|
||||||
|
corridorDimensionSelector,
|
||||||
|
selectedRoofMaterialSelector,
|
||||||
|
settingModalFirstOptionsState,
|
||||||
|
} from '@/store/settingAtom'
|
||||||
import { placementShapeDrawingPointsState } from '@/store/placementShapeDrawingAtom'
|
import { placementShapeDrawingPointsState } from '@/store/placementShapeDrawingAtom'
|
||||||
import { commonUtilsState } from '@/store/commonUtilsAtom'
|
import { commonUtilsState } from '@/store/commonUtilsAtom'
|
||||||
import { menusState, menuTypeState } from '@/store/menuAtom'
|
import { menusState, menuTypeState } from '@/store/menuAtom'
|
||||||
import { estimateState, floorPlanObjectState } from '@/store/floorPlanObjectAtom'
|
import { estimateState, floorPlanObjectState } from '@/store/floorPlanObjectAtom'
|
||||||
import { pwrGnrSimTypeState } from '@/store/simulatorAtom'
|
import { pwrGnrSimTypeState } from '@/store/simulatorAtom'
|
||||||
import { isObjectNotEmpty } from '@/util/common-utils'
|
import { isObjectNotEmpty } from '@/util/common-utils'
|
||||||
|
import { POLYGON_TYPE } from '@/common/common'
|
||||||
|
|
||||||
import KO from '@/locales/ko.json'
|
import KO from '@/locales/ko.json'
|
||||||
import JA from '@/locales/ja.json'
|
import JA from '@/locales/ja.json'
|
||||||
|
|
||||||
import { MENU, POLYGON_TYPE } from '@/common/common'
|
|
||||||
|
|
||||||
import { QcastContext } from '@/app/QcastProvider'
|
import { QcastContext } from '@/app/QcastProvider'
|
||||||
|
|
||||||
export default function CanvasMenu(props) {
|
export default function CanvasMenu(props) {
|
||||||
const { menuNumber, setMenuNumber } = props
|
const { menuNumber, setMenuNumber } = props
|
||||||
const pathname = usePathname()
|
const pathname = usePathname()
|
||||||
@ -238,6 +241,16 @@ export default function CanvasMenu(props) {
|
|||||||
if (menuNumber === 1) {
|
if (menuNumber === 1) {
|
||||||
onClickPlacementInitialMenu()
|
onClickPlacementInitialMenu()
|
||||||
}
|
}
|
||||||
|
if (menuNumber === 3) {
|
||||||
|
const moduleSurfacesArray = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE)
|
||||||
|
if (moduleSurfacesArray.length > 0) {
|
||||||
|
moduleSurfacesArray.forEach((moduleSurface) => {
|
||||||
|
moduleSurface.modules = []
|
||||||
|
canvas.remove(moduleSurface)
|
||||||
|
})
|
||||||
|
canvas.renderAll()
|
||||||
|
}
|
||||||
|
}
|
||||||
}, [menuNumber, type])
|
}, [menuNumber, type])
|
||||||
|
|
||||||
// 저장버튼(btn08) 클릭 시 호출되는 함수
|
// 저장버튼(btn08) 클릭 시 호출되는 함수
|
||||||
|
|||||||
@ -34,7 +34,7 @@ export default function BasicSetting({ id, pos = { x: 50, y: 230 } }) {
|
|||||||
const currentCanvasPlan = useRecoilValue(currentCanvasPlanState)
|
const currentCanvasPlan = useRecoilValue(currentCanvasPlanState)
|
||||||
|
|
||||||
// const { initEvent } = useContext(EventContext)
|
// const { initEvent } = useContext(EventContext)
|
||||||
const { manualModuleSetup, autoModuleSetup, manualFlatroofModuleSetup, autoFlatroofModuleSetup } = useModuleBasicSetting()
|
const { manualModuleSetup, autoModuleSetup, manualFlatroofModuleSetup, autoFlatroofModuleSetup } = useModuleBasicSetting(1)
|
||||||
const { updateObjectDate } = useMasterController()
|
const { updateObjectDate } = useMasterController()
|
||||||
const handleBtnNextStep = () => {
|
const handleBtnNextStep = () => {
|
||||||
if (tabNum === 1) {
|
if (tabNum === 1) {
|
||||||
|
|||||||
@ -120,7 +120,7 @@ export default function ModuleTabContents({ tabIndex, addRoof, setAddedRoofs, ro
|
|||||||
value={selectedTrestle}
|
value={selectedTrestle}
|
||||||
sourceKey={'trestleMkrCd'}
|
sourceKey={'trestleMkrCd'}
|
||||||
targetKey={'trestleMkrCd'}
|
targetKey={'trestleMkrCd'}
|
||||||
showKey={'trestleMkrCdNm'}
|
showKey={'trestleMkrCdJp'}
|
||||||
onChange={handleChangeTrestle}
|
onChange={handleChangeTrestle}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
@ -138,7 +138,7 @@ export default function ModuleTabContents({ tabIndex, addRoof, setAddedRoofs, ro
|
|||||||
value={selectedConstMthd}
|
value={selectedConstMthd}
|
||||||
sourceKey={'constMthdCd'}
|
sourceKey={'constMthdCd'}
|
||||||
targetKey={'constMthdCd'}
|
targetKey={'constMthdCd'}
|
||||||
showKey={'constMthdCdNm'}
|
showKey={'constMthdCdJp'}
|
||||||
onChange={handleChangeConstMthd}
|
onChange={handleChangeConstMthd}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
@ -156,7 +156,7 @@ export default function ModuleTabContents({ tabIndex, addRoof, setAddedRoofs, ro
|
|||||||
value={selectedRoofBase}
|
value={selectedRoofBase}
|
||||||
sourceKey={'roofBaseCd'}
|
sourceKey={'roofBaseCd'}
|
||||||
targetKey={'roofBaseCd'}
|
targetKey={'roofBaseCd'}
|
||||||
showKey={'roofBaseCdNm'}
|
showKey={'roofBaseCdJp'}
|
||||||
onChange={handleChangeRoofBase}
|
onChange={handleChangeRoofBase}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@ -4,20 +4,17 @@ import { useModuleBasicSetting } from '@/hooks/module/useModuleBasicSetting'
|
|||||||
import { checkedModuleState, currentCanvasPlanState } from '@/store/canvasAtom'
|
import { checkedModuleState, currentCanvasPlanState } from '@/store/canvasAtom'
|
||||||
import { useRecoilValue, useSetRecoilState } from 'recoil'
|
import { useRecoilValue, useSetRecoilState } from 'recoil'
|
||||||
import { moduleSelectionDataState } from '@/store/selectedModuleOptions'
|
import { moduleSelectionDataState } from '@/store/selectedModuleOptions'
|
||||||
import { useModulePlace } from '@/hooks/module/useModulePlace'
|
|
||||||
|
|
||||||
const Placement = forwardRef((props, refs) => {
|
const Placement = forwardRef((props, refs) => {
|
||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
const [isChidori, setIsChidori] = useState(false)
|
const [isChidori, setIsChidori] = useState(false)
|
||||||
const [isChidoriNotAble, setIsChidoriNotAble] = useState(false)
|
const [isChidoriNotAble, setIsChidoriNotAble] = useState(false)
|
||||||
const currentCanvasPlan = useRecoilValue(currentCanvasPlanState)
|
|
||||||
|
|
||||||
const [setupLocation, setSetupLocation] = useState('center')
|
const [setupLocation, setSetupLocation] = useState('center')
|
||||||
const [isMaxSetup, setIsMaxSetup] = useState('false')
|
const [isMaxSetup, setIsMaxSetup] = useState('false')
|
||||||
const [selectedItems, setSelectedItems] = useState({})
|
const [selectedItems, setSelectedItems] = useState({})
|
||||||
|
|
||||||
const { makeModuleInstArea } = useModuleBasicSetting()
|
const { selectedModules } = useModuleBasicSetting(3)
|
||||||
const { selectedModules } = useModulePlace()
|
|
||||||
|
|
||||||
const setCheckedModules = useSetRecoilState(checkedModuleState)
|
const setCheckedModules = useSetRecoilState(checkedModuleState)
|
||||||
const moduleSelectionData = useRecoilValue(moduleSelectionDataState)
|
const moduleSelectionData = useRecoilValue(moduleSelectionDataState)
|
||||||
|
|||||||
@ -229,9 +229,7 @@ export function useMasterController() {
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
const updateObjectDate = async (params = null) => {
|
const updateObjectDate = async (params = null) => {
|
||||||
return await put({ url: '/api/object/update-object-date', data: params }).then((res) => {
|
return await put({ url: '/api/object/update-object-date', data: params })
|
||||||
console.log('updateObjectDate', res)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
|
import { useState } from 'react'
|
||||||
import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil'
|
import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil'
|
||||||
import { canvasSettingState, canvasState, checkedModuleState, isManualModuleSetupState, selectedModuleState } from '@/store/canvasAtom'
|
import { canvasSettingState, canvasState, checkedModuleState, isManualModuleSetupState } from '@/store/canvasAtom'
|
||||||
import { rectToPolygon, polygonToTurfPolygon, calculateVisibleModuleHeight, getDegreeByChon } from '@/util/canvas-util'
|
import { rectToPolygon, polygonToTurfPolygon, calculateVisibleModuleHeight, getDegreeByChon } from '@/util/canvas-util'
|
||||||
import { basicSettingState, roofDisplaySelector } from '@/store/settingAtom'
|
import { basicSettingState, roofDisplaySelector } from '@/store/settingAtom'
|
||||||
import offsetPolygon, { calculateAngle } from '@/util/qpolygon-utils'
|
import offsetPolygon, { calculateAngle } from '@/util/qpolygon-utils'
|
||||||
@ -15,14 +16,17 @@ import { useRoofFn } from '@/hooks/common/useRoofFn'
|
|||||||
import { useEffect } from 'react'
|
import { useEffect } from 'react'
|
||||||
import { useMessage } from '@/hooks/useMessage'
|
import { useMessage } from '@/hooks/useMessage'
|
||||||
import { moduleStatisticsState } from '@/store/circuitTrestleAtom'
|
import { moduleStatisticsState } from '@/store/circuitTrestleAtom'
|
||||||
|
import { moduleSelectionDataState, selectedModuleState } from '@/store/selectedModuleOptions'
|
||||||
|
import { useMasterController } from '@/hooks/common/useMasterController'
|
||||||
|
import { v4 as uuidv4 } from 'uuid'
|
||||||
|
|
||||||
export function useModuleBasicSetting() {
|
export function useModuleBasicSetting(tabNum) {
|
||||||
const canvas = useRecoilValue(canvasState)
|
const canvas = useRecoilValue(canvasState)
|
||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
const roofDisplay = useRecoilValue(roofDisplaySelector)
|
const roofDisplay = useRecoilValue(roofDisplaySelector)
|
||||||
const [moduleSetupSurface, setModuleSetupSurface] = useRecoilState(moduleSetupSurfaceState)
|
const [moduleSetupSurface, setModuleSetupSurface] = useRecoilState(moduleSetupSurfaceState)
|
||||||
const [moduleIsSetup, setModuleIsSetup] = useRecoilState(moduleIsSetupState)
|
const [moduleIsSetup, setModuleIsSetup] = useRecoilState(moduleIsSetupState)
|
||||||
const { addCanvasMouseEventListener, initEvent, removeMouseEvent } = useEvent()
|
const { addCanvasMouseEventListener, initEvent, removeMouseEvent, addTargetMouseEventListener } = useEvent()
|
||||||
const { swalFire } = useSwal()
|
const { swalFire } = useSwal()
|
||||||
|
|
||||||
const compasDeg = useRecoilValue(compasDegAtom)
|
const compasDeg = useRecoilValue(compasDegAtom)
|
||||||
@ -34,6 +38,13 @@ export function useModuleBasicSetting() {
|
|||||||
|
|
||||||
const canvasSetting = useRecoilValue(canvasSettingState)
|
const canvasSetting = useRecoilValue(canvasSettingState)
|
||||||
|
|
||||||
|
const moduleSelectionData = useRecoilValue(moduleSelectionDataState)
|
||||||
|
const [trestleDetailParams, setTrestleDetailParams] = useState([])
|
||||||
|
const [trestleDetailList, setTrestleDetailList] = useState([])
|
||||||
|
const selectedModules = useRecoilValue(selectedModuleState)
|
||||||
|
const { getTrestleDetailList } = useMasterController()
|
||||||
|
const [saleStoreNorthFlg, setSaleStoreNorthFlg] = useState(false)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// console.log('basicSetting', basicSetting)
|
// console.log('basicSetting', basicSetting)
|
||||||
if (canvas) {
|
if (canvas) {
|
||||||
@ -47,6 +58,247 @@ export function useModuleBasicSetting() {
|
|||||||
|
|
||||||
// const { addTargetMouseEventListener, addCanvasMouseEventListener, initEvent } = useContext(EventContext)
|
// const { addTargetMouseEventListener, addCanvasMouseEventListener, initEvent } = useContext(EventContext)
|
||||||
|
|
||||||
|
//모듈 선택에서 선택된 값들 넘어옴
|
||||||
|
useEffect(() => {
|
||||||
|
if (moduleSelectionData && tabNum === 3) {
|
||||||
|
const common = moduleSelectionData.common
|
||||||
|
|
||||||
|
const roofConstructions = moduleSelectionData.roofConstructions
|
||||||
|
|
||||||
|
const listParams = roofConstructions.map((item) => {
|
||||||
|
return {
|
||||||
|
...common,
|
||||||
|
moduleTpCd: selectedModules.itemTp,
|
||||||
|
roofMatlCd: item.trestle.roofMatlCd,
|
||||||
|
trestleMkrCd: item.trestle.trestleMkrCd,
|
||||||
|
constMthdCd: item.trestle.constMthdCd,
|
||||||
|
roofBaseCd: item.trestle.roofBaseCd,
|
||||||
|
constTp: item.construction.constTp,
|
||||||
|
mixMatlNo: selectedModules.mixMatlNo,
|
||||||
|
roofPitch: item.addRoof.hajebichi ? item.addRoof.hajebichi : 0,
|
||||||
|
inclCd: String(item.addRoof.pitch),
|
||||||
|
roofIndex: item.addRoof.index,
|
||||||
|
workingWidth: item.addRoof.lenBase,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
setTrestleDetailParams(listParams)
|
||||||
|
|
||||||
|
//북면 설치 가능 판매점
|
||||||
|
if (moduleSelectionData.common.saleStoreNorthFlg === '1') {
|
||||||
|
setSaleStoreNorthFlg(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [moduleSelectionData])
|
||||||
|
|
||||||
|
//가대 상세 데이터 조회
|
||||||
|
const getTrestleDetailListData = async () => {
|
||||||
|
const trestleDetailList = await getTrestleDetailList(trestleDetailParams)
|
||||||
|
if (trestleDetailList.length > 0) {
|
||||||
|
setTrestleDetailList(trestleDetailList)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//가대 상세 데이터 파라메터 담기면 실행
|
||||||
|
useEffect(() => {
|
||||||
|
if (trestleDetailParams.length > 0) {
|
||||||
|
getTrestleDetailListData(trestleDetailParams)
|
||||||
|
}
|
||||||
|
}, [trestleDetailParams])
|
||||||
|
|
||||||
|
//가대 상세 데이터 들어오면 실행
|
||||||
|
useEffect(() => {
|
||||||
|
if (trestleDetailList.length > 0) {
|
||||||
|
//지붕을 가져옴
|
||||||
|
canvas
|
||||||
|
.getObjects()
|
||||||
|
.filter((roof) => roof.name === 'roof')
|
||||||
|
.forEach((roof) => {
|
||||||
|
const roofIndex = roof.roofMaterial.index //지붕의 지붕재의 순번
|
||||||
|
trestleDetailList.forEach((detail) => {
|
||||||
|
if (detail.data !== null) {
|
||||||
|
if (Number(detail.data.roofIndex) === roofIndex) {
|
||||||
|
//roof에 상세 데이터 추가
|
||||||
|
roof.set({ trestleDetail: detail.data })
|
||||||
|
//배치면 설치 영역
|
||||||
|
makeModuleInstArea(roof, detail.data)
|
||||||
|
//surface에 상세 데이터 추가
|
||||||
|
} else {
|
||||||
|
console.log('가대 데이터가 없네요...')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}, [trestleDetailList])
|
||||||
|
|
||||||
|
//가대 상세 데이터 기준으로 모듈 설치 배치면 생성
|
||||||
|
const makeModuleInstArea = (roof, trestleDetail) => {
|
||||||
|
//지붕 객체 반환
|
||||||
|
|
||||||
|
if (!roof) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
//도머등 오브젝트 객체가 있으면 아웃라인 낸다
|
||||||
|
const batchObjects = canvas
|
||||||
|
?.getObjects()
|
||||||
|
.filter(
|
||||||
|
(obj) =>
|
||||||
|
obj.name === BATCH_TYPE.OPENING ||
|
||||||
|
obj.name === BATCH_TYPE.SHADOW ||
|
||||||
|
obj.name === BATCH_TYPE.TRIANGLE_DORMER ||
|
||||||
|
obj.name === BATCH_TYPE.PENTAGON_DORMER,
|
||||||
|
) //도머s 객체
|
||||||
|
|
||||||
|
//도머도 외곽을 따야한다
|
||||||
|
const batchObjectOptions = {
|
||||||
|
stroke: 'red',
|
||||||
|
fill: 'transparent',
|
||||||
|
strokeDashArray: [10, 4],
|
||||||
|
strokeWidth: 1,
|
||||||
|
lockMovementX: true,
|
||||||
|
lockMovementY: true,
|
||||||
|
lockRotation: true,
|
||||||
|
lockScalingX: true,
|
||||||
|
lockScalingY: true,
|
||||||
|
selectable: true,
|
||||||
|
name: POLYGON_TYPE.OBJECT_SURFACE,
|
||||||
|
originX: 'center',
|
||||||
|
originY: 'center',
|
||||||
|
}
|
||||||
|
|
||||||
|
//도머등 오브젝트 객체가 있으면 아웃라인 낸다
|
||||||
|
batchObjects.forEach((obj) => {
|
||||||
|
//도머일때
|
||||||
|
if (obj.name === BATCH_TYPE.TRIANGLE_DORMER || obj.name === BATCH_TYPE.PENTAGON_DORMER) {
|
||||||
|
const groupPoints = obj.groupPoints
|
||||||
|
const offsetObjects = offsetPolygon(groupPoints, 10)
|
||||||
|
const dormerOffset = new QPolygon(offsetObjects, batchObjectOptions)
|
||||||
|
dormerOffset.setViewLengthText(false)
|
||||||
|
canvas.add(dormerOffset) //모듈설치면 만들기
|
||||||
|
} else {
|
||||||
|
//개구, 그림자일때
|
||||||
|
const points = obj.points
|
||||||
|
const offsetObjects = offsetPolygon(points, 10)
|
||||||
|
const offset = new QPolygon(offsetObjects, batchObjectOptions)
|
||||||
|
offset.setViewLengthText(false)
|
||||||
|
canvas.add(offset) //모듈설치면 만들기
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const isExistSurface = canvas.getObjects().find((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE && obj.parentId === roof.id)
|
||||||
|
if (isExistSurface) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let offsetLength = canvasSetting.roofSizeSet === 3 ? -90 : (trestleDetail.eaveIntvl / 10) * -1
|
||||||
|
setSurfaceShapePattern(roof, roofDisplay.column, true) //패턴 변경
|
||||||
|
const offsetPoints = offsetPolygon(roof.points, offsetLength) //안쪽 offset
|
||||||
|
//모듈설치영역?? 생성
|
||||||
|
|
||||||
|
const surfaceId = uuidv4()
|
||||||
|
|
||||||
|
let isNorth = false
|
||||||
|
|
||||||
|
//북면이 있지만
|
||||||
|
if (roof.directionText && roof.directionText.indexOf('北') > -1) {
|
||||||
|
//북쪽일때 해당 서북서, 동북동은 제외한다고 한다
|
||||||
|
if (!(roof.directionText.indexOf('西北西') > -1 || roof.directionText.indexOf('東北東') > -1)) {
|
||||||
|
isNorth = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//모듈설치면 생성
|
||||||
|
let setupSurface = new QPolygon(offsetPoints, {
|
||||||
|
stroke: 'red',
|
||||||
|
fill: 'rgba(255,255,255,0.1)',
|
||||||
|
strokeDashArray: [10, 4],
|
||||||
|
strokeWidth: 1,
|
||||||
|
lockMovementX: true,
|
||||||
|
lockMovementY: true,
|
||||||
|
lockRotation: true,
|
||||||
|
lockScalingX: true,
|
||||||
|
lockScalingY: true,
|
||||||
|
selectable: true,
|
||||||
|
parentId: roof.id, //가대 폴리곤의 임시 인덱스를 넣어줌
|
||||||
|
name: POLYGON_TYPE.MODULE_SETUP_SURFACE,
|
||||||
|
flowDirection: roof.direction,
|
||||||
|
direction: roof.direction,
|
||||||
|
flipX: roof.flipX,
|
||||||
|
flipY: roof.flipY,
|
||||||
|
surfaceId: surfaceId,
|
||||||
|
originX: 'center',
|
||||||
|
originY: 'center',
|
||||||
|
modules: [],
|
||||||
|
roofMaterial: roof.roofMaterial,
|
||||||
|
trestleDetail: trestleDetail,
|
||||||
|
isNorth: isNorth,
|
||||||
|
perPixelTargetFind: true,
|
||||||
|
// angle: -compasDeg,
|
||||||
|
})
|
||||||
|
|
||||||
|
setupSurface.setViewLengthText(false)
|
||||||
|
canvas.add(setupSurface) //모듈설치면 만들기
|
||||||
|
|
||||||
|
//지붕면 선택 금지
|
||||||
|
roof.set({
|
||||||
|
selectable: false, //선택 금지
|
||||||
|
evented: false, //클릭 이벤트도 금지
|
||||||
|
})
|
||||||
|
|
||||||
|
canvas.renderAll()
|
||||||
|
|
||||||
|
//모듈설치면 클릭이벤트
|
||||||
|
addTargetMouseEventListener('mousedown', setupSurface, function () {
|
||||||
|
toggleSelection(setupSurface)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
let selectedModuleInstSurfaceArray = []
|
||||||
|
|
||||||
|
//설치 범위 지정 클릭 이벤트
|
||||||
|
const toggleSelection = (setupSurface) => {
|
||||||
|
const isExist = selectedModuleInstSurfaceArray.some((obj) => obj.parentId === setupSurface.parentId)
|
||||||
|
//최초 선택일때
|
||||||
|
if (!isExist) {
|
||||||
|
//설치면이 북면이고 북면설치 허용점이 아니면
|
||||||
|
if (setupSurface.isNorth && !saleStoreNorthFlg) {
|
||||||
|
swalFire({ text: getMessage('module.not.batch.north'), icon: 'warning' })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
//기본 선택이랑 스트로크 굵기가 같으면 선택 안됨으로 봄
|
||||||
|
setupSurface.set({
|
||||||
|
...setupSurface,
|
||||||
|
strokeWidth: 3,
|
||||||
|
strokeDashArray: [0],
|
||||||
|
fill: 'rgba(255,255,255,0.1)',
|
||||||
|
})
|
||||||
|
canvas.discardActiveObject() // 객체의 활성 상태 해제
|
||||||
|
//중복으로 들어가는걸 방지하기 위한 코드
|
||||||
|
|
||||||
|
canvas?.renderAll()
|
||||||
|
selectedModuleInstSurfaceArray.push(setupSurface)
|
||||||
|
} else {
|
||||||
|
//선택후 재선택하면 선택안됨으로 변경
|
||||||
|
setupSurface.set({
|
||||||
|
...setupSurface,
|
||||||
|
fill: 'rgba(255,255,255,0.1)',
|
||||||
|
strokeDashArray: [10, 4],
|
||||||
|
strokeWidth: 1,
|
||||||
|
})
|
||||||
|
canvas.discardActiveObject() // 객체의 활성 상태 해제
|
||||||
|
|
||||||
|
//폴리곤에 커스텀 인덱스를 가지고 해당 배열 인덱스를 찾아 삭제함
|
||||||
|
const removeIndex = setupSurface.parentId
|
||||||
|
const removeArrayIndex = selectedModuleInstSurfaceArray.findIndex((obj) => obj.parentId === removeIndex)
|
||||||
|
selectedModuleInstSurfaceArray.splice(removeArrayIndex, 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
canvas?.renderAll()
|
||||||
|
setModuleSetupSurface([...selectedModuleInstSurfaceArray])
|
||||||
|
}
|
||||||
|
|
||||||
//모듈,회로에서 다른메뉴 -> 배치면으로 갈 경수 초기화
|
//모듈,회로에서 다른메뉴 -> 배치면으로 갈 경수 초기화
|
||||||
const restoreModuleInstArea = () => {
|
const restoreModuleInstArea = () => {
|
||||||
//설치면 삭제
|
//설치면 삭제
|
||||||
@ -76,6 +328,7 @@ export function useModuleBasicSetting() {
|
|||||||
*/
|
*/
|
||||||
const manualModuleSetup = () => {
|
const manualModuleSetup = () => {
|
||||||
// console.log('isManualModuleSetup', isManualModuleSetup)
|
// console.log('isManualModuleSetup', isManualModuleSetup)
|
||||||
|
const moduleSetupSurfaces = canvas?.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE) //모듈설치면를 가져옴
|
||||||
|
|
||||||
if (isManualModuleSetup) {
|
if (isManualModuleSetup) {
|
||||||
if (checkedModule.length === 0) {
|
if (checkedModule.length === 0) {
|
||||||
@ -90,8 +343,14 @@ export function useModuleBasicSetting() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const moduleSetupSurfaces = canvas?.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE) //모듈설치면를 가져옴
|
|
||||||
const batchObjects = canvas?.getObjects().filter((obj) => obj.name === POLYGON_TYPE.OBJECT_SURFACE) //도머s 객체
|
const batchObjects = canvas?.getObjects().filter((obj) => obj.name === POLYGON_TYPE.OBJECT_SURFACE) //도머s 객체
|
||||||
|
//수동모드 모듈 설치면 선택 잠금
|
||||||
|
moduleSetupSurfaces.forEach((obj) => {
|
||||||
|
obj.set({
|
||||||
|
selectable: false,
|
||||||
|
evented: false,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
const moduleOptions = {
|
const moduleOptions = {
|
||||||
fill: checkedModule[0].color,
|
fill: checkedModule[0].color,
|
||||||
@ -168,7 +427,12 @@ export function useModuleBasicSetting() {
|
|||||||
parentId: moduleSetupSurfaces[i].parentId,
|
parentId: moduleSetupSurfaces[i].parentId,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
//북면이고 북면설치상점이 아니면 그냥 return
|
||||||
|
if (trestlePolygon.isNorth && !saleStoreNorthFlg) {
|
||||||
|
return
|
||||||
|
} else {
|
||||||
canvas?.add(tempModule) //움직여가면서 추가됨
|
canvas?.add(tempModule) //움직여가면서 추가됨
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 스냅기능
|
* 스냅기능
|
||||||
@ -361,6 +625,7 @@ export function useModuleBasicSetting() {
|
|||||||
const isOverlap = manualDrawModules.some((module) => turf.booleanOverlap(tempTurfModule, polygonToTurfPolygon(module))) //겹치는지 확인
|
const isOverlap = manualDrawModules.some((module) => turf.booleanOverlap(tempTurfModule, polygonToTurfPolygon(module))) //겹치는지 확인
|
||||||
if (!isOverlap) {
|
if (!isOverlap) {
|
||||||
canvas?.remove(tempModule)
|
canvas?.remove(tempModule)
|
||||||
|
|
||||||
//안겹치면 넣는다
|
//안겹치면 넣는다
|
||||||
// tempModule.setCoords()
|
// tempModule.setCoords()
|
||||||
moduleOptions.surfaceId = trestlePolygon.id
|
moduleOptions.surfaceId = trestlePolygon.id
|
||||||
@ -379,6 +644,14 @@ export function useModuleBasicSetting() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
//수동모드 해제시 모듈 설치면 선택 잠금
|
||||||
|
moduleSetupSurfaces.forEach((obj) => {
|
||||||
|
obj.set({
|
||||||
|
selectable: true,
|
||||||
|
evented: true,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
removeMouseEvent('mouse:up')
|
removeMouseEvent('mouse:up')
|
||||||
removeMouseEvent('mouse:move')
|
removeMouseEvent('mouse:move')
|
||||||
canvas?.remove(...canvas?.getObjects().filter((obj) => obj.name === 'tempModule')) //움직일때 일단 지워가면서 움직임
|
canvas?.remove(...canvas?.getObjects().filter((obj) => obj.name === 'tempModule')) //움직일때 일단 지워가면서 움직임
|
||||||
@ -2209,6 +2482,7 @@ export function useModuleBasicSetting() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
selectedModules,
|
||||||
manualModuleSetup,
|
manualModuleSetup,
|
||||||
autoModuleSetup,
|
autoModuleSetup,
|
||||||
restoreModuleInstArea,
|
restoreModuleInstArea,
|
||||||
|
|||||||
@ -10,6 +10,8 @@ import offsetPolygon from '@/util/qpolygon-utils'
|
|||||||
import { v4 as uuidv4 } from 'uuid'
|
import { v4 as uuidv4 } from 'uuid'
|
||||||
import { QPolygon } from '@/components/fabric/QPolygon'
|
import { QPolygon } from '@/components/fabric/QPolygon'
|
||||||
import { useEvent } from '@/hooks/useEvent'
|
import { useEvent } from '@/hooks/useEvent'
|
||||||
|
import { useSwal } from '@/hooks/useSwal'
|
||||||
|
import { useMessage } from '@/hooks/useMessage'
|
||||||
|
|
||||||
export function useModulePlace() {
|
export function useModulePlace() {
|
||||||
const canvas = useRecoilValue(canvasState)
|
const canvas = useRecoilValue(canvasState)
|
||||||
@ -23,211 +25,9 @@ export function useModulePlace() {
|
|||||||
const roofDisplay = useRecoilValue(roofDisplaySelector)
|
const roofDisplay = useRecoilValue(roofDisplaySelector)
|
||||||
const { addTargetMouseEventListener } = useEvent()
|
const { addTargetMouseEventListener } = useEvent()
|
||||||
const setModuleSetupSurface = useSetRecoilState(moduleSetupSurfaceState)
|
const setModuleSetupSurface = useSetRecoilState(moduleSetupSurfaceState)
|
||||||
|
const [saleStoreNorthFlg, setSaleStoreNorthFlg] = useState(false)
|
||||||
useEffect(() => {
|
const { swalFire } = useSwal()
|
||||||
if (moduleSelectionData) {
|
const { getMessage } = useMessage()
|
||||||
const common = moduleSelectionData.common
|
|
||||||
const roofConstructions = moduleSelectionData.roofConstructions
|
|
||||||
|
|
||||||
const listParams = roofConstructions.map((item) => {
|
|
||||||
return {
|
|
||||||
...common,
|
|
||||||
moduleTpCd: selectedModules.itemTp,
|
|
||||||
roofMatlCd: item.trestle.roofMatlCd,
|
|
||||||
trestleMkrCd: item.trestle.trestleMkrCd,
|
|
||||||
constMthdCd: item.trestle.constMthdCd,
|
|
||||||
roofBaseCd: item.trestle.roofBaseCd,
|
|
||||||
constTp: item.construction.constTp,
|
|
||||||
mixMatlNo: selectedModules.mixMatlNo,
|
|
||||||
roofPitch: item.addRoof.hajebichi ? item.addRoof.hajebichi : 0,
|
|
||||||
inclCd: String(item.addRoof.pitch),
|
|
||||||
roofIndex: item.addRoof.index,
|
|
||||||
workingWidth: item.addRoof.lenBase,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
setTrestleDetailParams(listParams)
|
|
||||||
}
|
|
||||||
}, [moduleSelectionData])
|
|
||||||
|
|
||||||
const getTrestleDetailListData = async () => {
|
|
||||||
const trestleDetailList = await getTrestleDetailList(trestleDetailParams)
|
|
||||||
if (trestleDetailList.length > 0) {
|
|
||||||
setTrestleDetailList(trestleDetailList)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (trestleDetailParams.length > 0) {
|
|
||||||
getTrestleDetailListData(trestleDetailParams)
|
|
||||||
}
|
|
||||||
}, [trestleDetailParams])
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (trestleDetailList.length > 0) {
|
|
||||||
//지붕을 가져옴
|
|
||||||
canvas
|
|
||||||
.getObjects()
|
|
||||||
.filter((roof) => roof.name === 'roof')
|
|
||||||
.forEach((roof) => {
|
|
||||||
const roofIndex = roof.roofMaterial.index //지붕의 지붕재의 순번
|
|
||||||
trestleDetailList.forEach((detail) => {
|
|
||||||
if (detail.data !== null) {
|
|
||||||
if (Number(detail.data.roofIndex) === roofIndex) {
|
|
||||||
//roof에 상세 데이터 추가
|
|
||||||
roof.set({ trestleDetail: detail.data })
|
|
||||||
//배치면 설치 영역
|
|
||||||
makeModuleInstArea(roof, detail.data)
|
|
||||||
//surface에 상세 데이터 추가
|
|
||||||
} else {
|
|
||||||
console.log('가대 데이터가 없네요...')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}, [trestleDetailList])
|
|
||||||
|
|
||||||
const makeModuleInstArea = (roof, trestleDetail) => {
|
|
||||||
//지붕 객체 반환
|
|
||||||
|
|
||||||
if (!roof) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const batchObjects = canvas
|
|
||||||
?.getObjects()
|
|
||||||
.filter(
|
|
||||||
(obj) =>
|
|
||||||
obj.name === BATCH_TYPE.OPENING ||
|
|
||||||
obj.name === BATCH_TYPE.SHADOW ||
|
|
||||||
obj.name === BATCH_TYPE.TRIANGLE_DORMER ||
|
|
||||||
obj.name === BATCH_TYPE.PENTAGON_DORMER,
|
|
||||||
) //도머s 객체
|
|
||||||
|
|
||||||
//도머도 외곽을 따야한다
|
|
||||||
|
|
||||||
const batchObjectOptions = {
|
|
||||||
stroke: 'red',
|
|
||||||
fill: 'transparent',
|
|
||||||
strokeDashArray: [10, 4],
|
|
||||||
strokeWidth: 1,
|
|
||||||
lockMovementX: true,
|
|
||||||
lockMovementY: true,
|
|
||||||
lockRotation: true,
|
|
||||||
lockScalingX: true,
|
|
||||||
lockScalingY: true,
|
|
||||||
selectable: true,
|
|
||||||
name: POLYGON_TYPE.OBJECT_SURFACE,
|
|
||||||
originX: 'center',
|
|
||||||
originY: 'center',
|
|
||||||
}
|
|
||||||
|
|
||||||
batchObjects.forEach((obj) => {
|
|
||||||
if (obj.name === BATCH_TYPE.TRIANGLE_DORMER || obj.name === BATCH_TYPE.PENTAGON_DORMER) {
|
|
||||||
const groupPoints = obj.groupPoints
|
|
||||||
const offsetObjects = offsetPolygon(groupPoints, 10)
|
|
||||||
const dormerOffset = new QPolygon(offsetObjects, batchObjectOptions)
|
|
||||||
dormerOffset.setViewLengthText(false)
|
|
||||||
canvas.add(dormerOffset) //모듈설치면 만들기
|
|
||||||
} else {
|
|
||||||
const points = obj.points
|
|
||||||
const offsetObjects = offsetPolygon(points, 10)
|
|
||||||
const offset = new QPolygon(offsetObjects, batchObjectOptions)
|
|
||||||
offset.setViewLengthText(false)
|
|
||||||
canvas.add(offset) //모듈설치면 만들기
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const isExistSurface = canvas.getObjects().find((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE && obj.parentId === roof.id)
|
|
||||||
if (isExistSurface) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
let offsetLength = canvasSetting.roofSizeSet === 3 ? -90 : (trestleDetail.eaveIntvl / 10) * -1
|
|
||||||
setSurfaceShapePattern(roof, roofDisplay.column, true) //패턴 변경
|
|
||||||
const offsetPoints = offsetPolygon(roof.points, offsetLength) //안쪽 offset
|
|
||||||
//모듈설치영역?? 생성
|
|
||||||
|
|
||||||
const surfaceId = uuidv4()
|
|
||||||
|
|
||||||
let setupSurface = new QPolygon(offsetPoints, {
|
|
||||||
stroke: 'red',
|
|
||||||
fill: 'transparent',
|
|
||||||
strokeDashArray: [10, 4],
|
|
||||||
strokeWidth: 1,
|
|
||||||
lockMovementX: true,
|
|
||||||
lockMovementY: true,
|
|
||||||
lockRotation: true,
|
|
||||||
lockScalingX: true,
|
|
||||||
lockScalingY: true,
|
|
||||||
selectable: true,
|
|
||||||
parentId: roof.id, //가대 폴리곤의 임시 인덱스를 넣어줌
|
|
||||||
name: POLYGON_TYPE.MODULE_SETUP_SURFACE,
|
|
||||||
flowDirection: roof.direction,
|
|
||||||
direction: roof.direction,
|
|
||||||
flipX: roof.flipX,
|
|
||||||
flipY: roof.flipY,
|
|
||||||
surfaceId: surfaceId,
|
|
||||||
originX: 'center',
|
|
||||||
originY: 'center',
|
|
||||||
modules: [],
|
|
||||||
roofMaterial: roof.roofMaterial,
|
|
||||||
trestleDetail: trestleDetail,
|
|
||||||
// angle: -compasDeg,
|
|
||||||
})
|
|
||||||
|
|
||||||
setupSurface.setViewLengthText(false)
|
|
||||||
canvas.add(setupSurface) //모듈설치면 만들기
|
|
||||||
|
|
||||||
//지붕면 선택 금지
|
|
||||||
roof.set({
|
|
||||||
selectable: false,
|
|
||||||
})
|
|
||||||
|
|
||||||
//모듈설치면 클릭이벤트
|
|
||||||
addTargetMouseEventListener('mousedown', setupSurface, function () {
|
|
||||||
toggleSelection(setupSurface)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
let selectedModuleInstSurfaceArray = []
|
|
||||||
|
|
||||||
//설치 범위 지정 클릭 이벤트
|
|
||||||
const toggleSelection = (setupSurface) => {
|
|
||||||
const isExist = selectedModuleInstSurfaceArray.some((obj) => obj.parentId === setupSurface.parentId)
|
|
||||||
//최초 선택일때
|
|
||||||
if (!isExist) {
|
|
||||||
//기본 선택이랑 스트로크 굵기가 같으면 선택 안됨으로 봄
|
|
||||||
setupSurface.set({
|
|
||||||
...setupSurface,
|
|
||||||
strokeWidth: 3,
|
|
||||||
strokeDashArray: [0],
|
|
||||||
fill: 'transparent',
|
|
||||||
})
|
|
||||||
canvas.discardActiveObject() // 객체의 활성 상태 해제
|
|
||||||
//중복으로 들어가는걸 방지하기 위한 코드
|
|
||||||
|
|
||||||
canvas?.renderAll()
|
|
||||||
selectedModuleInstSurfaceArray.push(setupSurface)
|
|
||||||
} else {
|
|
||||||
//선택후 재선택하면 선택안됨으로 변경
|
|
||||||
setupSurface.set({
|
|
||||||
...setupSurface,
|
|
||||||
fill: 'transparent',
|
|
||||||
strokeDashArray: [10, 4],
|
|
||||||
strokeWidth: 1,
|
|
||||||
})
|
|
||||||
canvas.discardActiveObject() // 객체의 활성 상태 해제
|
|
||||||
|
|
||||||
//폴리곤에 커스텀 인덱스를 가지고 해당 배열 인덱스를 찾아 삭제함
|
|
||||||
const removeIndex = setupSurface.parentId
|
|
||||||
const removeArrayIndex = selectedModuleInstSurfaceArray.findIndex((obj) => obj.parentId === removeIndex)
|
|
||||||
selectedModuleInstSurfaceArray.splice(removeArrayIndex, 1)
|
|
||||||
}
|
|
||||||
|
|
||||||
canvas?.renderAll()
|
|
||||||
setModuleSetupSurface([...selectedModuleInstSurfaceArray])
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
selectedModules,
|
selectedModules,
|
||||||
|
|||||||
@ -5,8 +5,11 @@ import { useMasterController } from '@/hooks/common/useMasterController'
|
|||||||
import { useCommonCode } from '@/hooks/common/useCommonCode'
|
import { useCommonCode } from '@/hooks/common/useCommonCode'
|
||||||
import { selectedModuleState, moduleSelectionInitParamsState, moduleSelectionDataState } from '@/store/selectedModuleOptions'
|
import { selectedModuleState, moduleSelectionInitParamsState, moduleSelectionDataState } from '@/store/selectedModuleOptions'
|
||||||
import { isObjectNotEmpty } from '@/util/common-utils'
|
import { isObjectNotEmpty } from '@/util/common-utils'
|
||||||
|
import { canvasState } from '@/store/canvasAtom'
|
||||||
|
import { POLYGON_TYPE } from '@/common/common'
|
||||||
|
|
||||||
export function useModuleSelection(props) {
|
export function useModuleSelection(props) {
|
||||||
|
const canvas = useRecoilValue(canvasState)
|
||||||
const { managementState, setManagementState, managementStateLoaded } = useContext(GlobalDataContext)
|
const { managementState, setManagementState, managementStateLoaded } = useContext(GlobalDataContext)
|
||||||
|
|
||||||
const [roughnessCodes, setRoughnessCodes] = useState([]) //면조도 목록
|
const [roughnessCodes, setRoughnessCodes] = useState([]) //면조도 목록
|
||||||
@ -41,6 +44,7 @@ export function useModuleSelection(props) {
|
|||||||
instHt: managementState?.installHeight, //설치높이
|
instHt: managementState?.installHeight, //설치높이
|
||||||
stdWindSpeed: managementState?.standardWindSpeedId, //기준풍속
|
stdWindSpeed: managementState?.standardWindSpeedId, //기준풍속
|
||||||
stdSnowLd: managementState?.verticalSnowCover, //기준적설량
|
stdSnowLd: managementState?.verticalSnowCover, //기준적설량
|
||||||
|
saleStoreNorthFlg: managementState?.saleStoreNorthFlg, //북쪽 설치 여부
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedModules) {
|
if (selectedModules) {
|
||||||
@ -62,6 +66,7 @@ export function useModuleSelection(props) {
|
|||||||
|
|
||||||
// 202000 풍속
|
// 202000 풍속
|
||||||
const windCodeList = findCommonCode('202000')
|
const windCodeList = findCommonCode('202000')
|
||||||
|
|
||||||
windCodeList.forEach((obj) => {
|
windCodeList.forEach((obj) => {
|
||||||
obj.name = obj.clCodeNm
|
obj.name = obj.clCodeNm
|
||||||
obj.id = obj.clCode
|
obj.id = obj.clCode
|
||||||
@ -83,6 +88,16 @@ export function useModuleSelection(props) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getModuleData(roofsIds)
|
getModuleData(roofsIds)
|
||||||
|
|
||||||
|
//메뉴 이동시 배치면 삭제
|
||||||
|
const moduleSurfacesArray = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE)
|
||||||
|
if (moduleSurfacesArray.length > 0) {
|
||||||
|
moduleSurfacesArray.forEach((moduleSurface) => {
|
||||||
|
moduleSurface.module = []
|
||||||
|
canvas.remove(moduleSurface)
|
||||||
|
})
|
||||||
|
canvas.renderAll()
|
||||||
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const getModuleData = async (roofsIds) => {
|
const getModuleData = async (roofsIds) => {
|
||||||
|
|||||||
@ -299,6 +299,7 @@ export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab
|
|||||||
//거대메이커, 공법, 지붕밑바탕 api 조회
|
//거대메이커, 공법, 지붕밑바탕 api 조회
|
||||||
const getModuleOptionsListData = async (params, type) => {
|
const getModuleOptionsListData = async (params, type) => {
|
||||||
const optionsList = await getTrestleList(params)
|
const optionsList = await getTrestleList(params)
|
||||||
|
console.log('optionsList', optionsList)
|
||||||
|
|
||||||
if (optionsList.data.length > 0) {
|
if (optionsList.data.length > 0) {
|
||||||
if (type === 'trestle') {
|
if (type === 'trestle') {
|
||||||
|
|||||||
@ -997,5 +997,6 @@
|
|||||||
"construction.length.difference": "지붕면 공법을 전부 선택해주세요.",
|
"construction.length.difference": "지붕면 공법을 전부 선택해주세요.",
|
||||||
"menu.validation.canvas.roof": "패널을 배치하려면 지붕면을 입력해야 합니다.",
|
"menu.validation.canvas.roof": "패널을 배치하려면 지붕면을 입력해야 합니다.",
|
||||||
"batch.object.outside.roof": "오브젝트는 지붕내에 설치해야 합니다.",
|
"batch.object.outside.roof": "오브젝트는 지붕내에 설치해야 합니다.",
|
||||||
"batch.object.notinstall.cross": "오브젝트는 겹쳐서 설치 할 수 없습니다."
|
"batch.object.notinstall.cross": "오브젝트는 겹쳐서 설치 할 수 없습니다.",
|
||||||
|
"module.not.batch.north": "북쪽에는 모듈을 배치할 수 없습니다."
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user