모듈 자동 레이아웃 설치
This commit is contained in:
parent
034bfb374e
commit
fe957102d9
@ -334,9 +334,12 @@ export default function BasicSetting({ id, pos = { x: 50, y: 230 } }) {
|
||||
<button className={`btn-frame modal mr5 ${isManualModuleSetup ? 'act' : ''}`} onClick={handleManualModuleSetup}>
|
||||
{getMessage('modal.module.basic.setting.passivity.placement')}
|
||||
</button>
|
||||
<button className="btn-frame modal act" onClick={() => autoModuleSetup()}>
|
||||
<button className="btn-frame modal act mr5" onClick={() => autoModuleSetup('auto')}>
|
||||
{getMessage('modal.module.basic.setting.auto.placement')}
|
||||
</button>
|
||||
<button className="btn-frame modal act" onClick={() => autoModuleSetup('layout', layoutSetup)}>
|
||||
{getMessage('modal.module.basic.setting.auto.row.batch')}
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
|
||||
@ -18,7 +18,7 @@ export function useMasterController() {
|
||||
*/
|
||||
const getRoofMaterialList = async () => {
|
||||
return await get({ url: '/api/v1/master/getRoofMaterialList' }).then((res) => {
|
||||
console.log('🚀🚀 ~ getRoofMaterialList ~ res:', res)
|
||||
// console.log('🚀🚀 ~ getRoofMaterialList ~ res:', res)
|
||||
return res
|
||||
})
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ export function useModuleBasicSetting(tabNum) {
|
||||
setTrestleDetailList(roofConstructionArray)
|
||||
|
||||
//북면 설치 가능 판매점
|
||||
if (moduleSelectionData.common.saleStoreNorthFlg === '1') {
|
||||
if (moduleSelectionData.common.saleStoreNorthFlg == '1') {
|
||||
setSaleStoreNorthFlg(true)
|
||||
}
|
||||
}
|
||||
@ -111,6 +111,10 @@ export function useModuleBasicSetting(tabNum) {
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
console.log('saleStoreNorthFlg', saleStoreNorthFlg)
|
||||
}, [saleStoreNorthFlg])
|
||||
|
||||
//가대 상세 데이터 들어오면 실행
|
||||
useEffect(() => {
|
||||
if (trestleDetailList.length > 0) {
|
||||
@ -236,8 +240,26 @@ export function useModuleBasicSetting(tabNum) {
|
||||
}
|
||||
})
|
||||
|
||||
let isNorth = false
|
||||
|
||||
const isExistSurface = canvas.getObjects().find((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE && obj.parentId === roof.id)
|
||||
|
||||
if (isExistSurface) {
|
||||
if (canvasSetting.roofSizeSet != '3') {
|
||||
//북면이 있지만
|
||||
if (roof.directionText && roof.directionText.indexOf('北') > -1) {
|
||||
//북쪽일때 해당 서북서, 동북동은 제외한다고 한다
|
||||
if (!(roof.directionText.indexOf('西北西') > -1 || roof.directionText.indexOf('東北東') > -1)) {
|
||||
isNorth = true
|
||||
}
|
||||
}
|
||||
|
||||
isExistSurface.set({
|
||||
isNorth: isNorth, //북면여부
|
||||
isSaleStoreNorthFlg: moduleSelectionData.common.saleStoreNorthFlg == '1' ? true : false, //북면설치가능점 여부
|
||||
})
|
||||
}
|
||||
|
||||
addTargetMouseEventListener('mousedown', isExistSurface, function () {
|
||||
toggleSelection(isExistSurface)
|
||||
})
|
||||
@ -270,7 +292,6 @@ export function useModuleBasicSetting(tabNum) {
|
||||
//모듈설치영역?? 생성
|
||||
|
||||
const surfaceId = uuidv4()
|
||||
let isNorth = false
|
||||
|
||||
if (canvasSetting.roofSizeSet != '3') {
|
||||
//북면이 있지만
|
||||
@ -307,6 +328,7 @@ export function useModuleBasicSetting(tabNum) {
|
||||
trestleDetail: trestleDetail,
|
||||
isNorth: isNorth,
|
||||
perPixelTargetFind: true,
|
||||
isSaleStoreNorthFlg: moduleSelectionData.common.saleStoreNorthFlg == '1' ? true : false, //북면설치가능점 여부
|
||||
// angle: -compasDeg,
|
||||
})
|
||||
|
||||
@ -352,8 +374,11 @@ export function useModuleBasicSetting(tabNum) {
|
||||
const isExist = selectedModuleInstSurfaceArray.some((obj) => obj.parentId === setupSurface.parentId)
|
||||
//최초 선택일때
|
||||
if (!isExist) {
|
||||
//설치면이 북면이고 북면설치 허용점이 아니면
|
||||
if (setupSurface.isNorth && !saleStoreNorthFlg) {
|
||||
//모듈에 북면 설치 가능 모듈이 있는지 확인함
|
||||
const isNorthModuleYn = moduleSelectionData?.module.itemList.some((module) => module.northModuleYn === 'Y')
|
||||
|
||||
//설치면이 북면이고 북면설치 허용점이 아니면 북면 모듈이 한개도 없으면
|
||||
if (setupSurface.isNorth && !setupSurface.isSaleStoreNorthFlg && !isNorthModuleYn) {
|
||||
swalFire({ text: getMessage('module.not.batch.north'), icon: 'warning' })
|
||||
return
|
||||
}
|
||||
@ -538,9 +563,15 @@ export function useModuleBasicSetting(tabNum) {
|
||||
parentId: moduleSetupSurfaces[i].parentId,
|
||||
})
|
||||
|
||||
const northModuleYn = checkedModule.some((module) => module.northModuleYn === 'Y')
|
||||
//북면이고 북면설치상점이 아니면 그냥 return
|
||||
if (trestlePolygon.isNorth && !saleStoreNorthFlg) {
|
||||
return
|
||||
if (trestlePolygon.isNorth && !trestlePolygon.isSaleStoreNorthFlg) {
|
||||
if (!northModuleYn) {
|
||||
//북면이고 설치 가능 상점이 아닌데 북면 설치 모듈이 있으면
|
||||
return
|
||||
} else {
|
||||
canvas?.add(tempModule) //움직여가면서 추가됨
|
||||
}
|
||||
} else {
|
||||
canvas?.add(tempModule) //움직여가면서 추가됨
|
||||
}
|
||||
@ -765,7 +796,7 @@ export function useModuleBasicSetting(tabNum) {
|
||||
const mixAsgYn = trestlePolygon.modules[0].moduleInfo.mixAsgYn
|
||||
//현재 체크된 모듈기준으로 혼합가능인지 확인 Y === Y, N === N 일때만 설치 가능
|
||||
if (checkedModule[0].mixAsgYn !== mixAsgYn) {
|
||||
swalFire({ text: getMessage('modal.module.basic.setting.module.placement.mix.asg.yn.error') })
|
||||
swalFire({ text: getMessage('modal.module.basic.setting.module.placement.mix.asg.yn.error'), icon: 'warning' })
|
||||
return
|
||||
}
|
||||
}
|
||||
@ -798,7 +829,7 @@ export function useModuleBasicSetting(tabNum) {
|
||||
const intersection = turf.intersect(turf.featureCollection([dormerTurfPolygon, tempTurfModule])) //겹치는지 확인
|
||||
//겹치면 안됨
|
||||
if (intersection) {
|
||||
swalFire({ text: getMessage('module.place.overobject') })
|
||||
swalFire({ text: getMessage('module.place.overobject'), icon: 'warning' })
|
||||
isIntersection = false
|
||||
}
|
||||
})
|
||||
@ -876,7 +907,7 @@ export function useModuleBasicSetting(tabNum) {
|
||||
}
|
||||
|
||||
if (checkedModule.length === 0) {
|
||||
swalFire({ text: getMessage('module.place.select.module') })
|
||||
swalFire({ text: getMessage('module.place.select.module'), icon: 'warning' })
|
||||
setIsManualModuleLayoutSetup(false)
|
||||
setManualSetupMode(`manualLayoutSetup_false`)
|
||||
return
|
||||
@ -890,7 +921,7 @@ export function useModuleBasicSetting(tabNum) {
|
||||
)
|
||||
|
||||
if (hasZeroLength) {
|
||||
swalFire({ text: getMessage('module.layout.setup.has.zero.value') })
|
||||
swalFire({ text: getMessage('module.layout.setup.has.zero.value'), icon: 'warning' })
|
||||
setIsManualModuleLayoutSetup(false)
|
||||
setManualSetupMode(`manualLayoutSetup_false`)
|
||||
return
|
||||
@ -902,7 +933,7 @@ export function useModuleBasicSetting(tabNum) {
|
||||
|
||||
//Y인 모듈과 N인 모듈이 둘다 존재하면 설치 불가
|
||||
if (mixAsgY.length > 0 && mixAsgN.length > 0) {
|
||||
swalFire({ text: getMessage('modal.module.basic.setting.module.placement.mix.asg.yn.error') })
|
||||
swalFire({ text: getMessage('modal.module.basic.setting.module.placement.mix.asg.yn.error'), icon: 'warning' })
|
||||
return
|
||||
}
|
||||
|
||||
@ -1068,9 +1099,15 @@ export function useModuleBasicSetting(tabNum) {
|
||||
parentId: moduleSetupSurfaces[i].parentId,
|
||||
})
|
||||
|
||||
const northModuleYn = checkedModule.some((module) => module.northModuleYn === 'Y')
|
||||
//북면이고 북면설치상점이 아니면 그냥 return
|
||||
if (trestlePolygon.isNorth && !saleStoreNorthFlg) {
|
||||
return
|
||||
if (trestlePolygon.isNorth && !trestlePolygon.isSaleStoreNorthFlg) {
|
||||
if (!northModuleYn) {
|
||||
//북면이고 설치 가능 상점이 아닌데 북면 설치 모듈이 있으면
|
||||
return
|
||||
} else {
|
||||
canvas?.add(tempModule) //움직여가면서 추가됨
|
||||
}
|
||||
} else {
|
||||
canvas?.add(tempModule) //움직여가면서 추가됨
|
||||
}
|
||||
@ -1732,23 +1769,51 @@ export function useModuleBasicSetting(tabNum) {
|
||||
}
|
||||
|
||||
//자동 모듈 설치(그리드 방식)
|
||||
const autoModuleSetup = (placementRef) => {
|
||||
const autoModuleSetup = (type, layoutSetupRef) => {
|
||||
initEvent() //마우스 이벤트 초기화
|
||||
|
||||
//실패한 지붕재 배열
|
||||
let failAutoSetupRoof = []
|
||||
|
||||
let checkedLayoutData
|
||||
|
||||
/**
|
||||
* 자동 레이아웃일때 0이 있거나 혼합이 있는지 확인하는 로직
|
||||
*/
|
||||
if (type === 'layout') {
|
||||
checkedLayoutData = layoutSetupRef.filter((module) => module.checked)
|
||||
const hasZeroLength = checkedLayoutData.some((module) => module.row === 0 || module.col === 0)
|
||||
|
||||
if (hasZeroLength) {
|
||||
swalFire({ text: getMessage('module.layout.setup.has.zero.value'), icon: 'warning' })
|
||||
return
|
||||
}
|
||||
|
||||
//혼합 가능 모듈과 혼합 불가능 모듈을 선택했을때 카운트를 해서 확인
|
||||
const mixAsgY = checkedModule.filter((obj) => obj.mixAsgYn === 'Y')
|
||||
const mixAsgN = checkedModule.filter((obj) => obj.mixAsgYn === 'N')
|
||||
|
||||
//Y인 모듈과 N인 모듈이 둘다 존재하면 설치 불가
|
||||
if (mixAsgY.length > 0 && mixAsgN.length > 0) {
|
||||
swalFire({ text: getMessage('modal.module.basic.setting.module.placement.mix.asg.yn.error'), icon: 'warning' })
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (checkedModule.length === 0) {
|
||||
swalFire({ text: getMessage('module.place.select.module') })
|
||||
swalFire({ text: getMessage('module.place.select.module'), icon: 'warning' })
|
||||
return
|
||||
}
|
||||
|
||||
//혼합 가능 모듈과 혼합 불가능 모듈을 선택했을때 카운트를 해서 확인
|
||||
const mixAsgY = checkedModule.filter((obj) => obj.mixAsgYn === 'Y')
|
||||
const mixAsgN = checkedModule.filter((obj) => obj.mixAsgYn === 'N')
|
||||
// //혼합 가능 모듈과 혼합 불가능 모듈을 선택했을때 카운트를 해서 확인
|
||||
// const mixAsgY = checkedModule.filter((obj) => obj.mixAsgYn === 'Y')
|
||||
// const mixAsgN = checkedModule.filter((obj) => obj.mixAsgYn === 'N')
|
||||
|
||||
//Y인 모듈과 N인 모듈이 둘다 존재하면 설치 불가
|
||||
if (mixAsgY.length > 0 && mixAsgN.length > 0) {
|
||||
swalFire({ text: getMessage('modal.module.basic.setting.module.placement.mix.asg.yn.error') })
|
||||
return
|
||||
}
|
||||
// //Y인 모듈과 N인 모듈이 둘다 존재하면 설치 불가
|
||||
// if (mixAsgY.length > 0 && mixAsgN.length > 0) {
|
||||
// swalFire({ text: getMessage('modal.module.basic.setting.module.placement.mix.asg.yn.error') })
|
||||
// return
|
||||
// }
|
||||
|
||||
const isChidori = moduleSetupOption.isChidori
|
||||
const setupLocation = moduleSetupOption.setupLocation
|
||||
@ -1820,14 +1885,50 @@ export function useModuleBasicSetting(tabNum) {
|
||||
return turf.booleanContains(turfModuleSetupSurface, squarePolygon) || turf.booleanWithin(squarePolygon, turfModuleSetupSurface)
|
||||
}
|
||||
|
||||
/**
|
||||
* 자동 레이아웃 설치 일시 row col 초과 여부 확인
|
||||
* @param {*} trestleDetailData
|
||||
* @returns
|
||||
*/
|
||||
const checkAutoLayoutModuleSetup = (moduleSetupSurface, trestleDetailData) => {
|
||||
const isMultipleModules = checkedModule.length > 1 //모듈이 여러개면
|
||||
const maxCol = trestleDetailData.moduleMaxCols //최대 열수 -> 얘는 멀티랑 관계없음
|
||||
const maxRow = isMultipleModules
|
||||
? trestleDetailData.moduleMaxRows
|
||||
: trestleDetailData.module.find((item) => item.moduleTpCd === checkedModule[0].moduleTpCd).moduleMaxRows //멀티모듈이면 밖에 maxRows로 판단 아니면 module->itemmList를 가지고 판단
|
||||
|
||||
//단수 합단수
|
||||
const sumRowCount = isMultipleModules
|
||||
? layoutSetupRef.filter((item) => item.checked).reduce((acc, cur) => acc + cur.row, 0)
|
||||
: layoutSetupRef.find((item) => item.moduleId === checkedModule[0].itemId).row //멀티모듈이면 전체 합, 체크된 한개의 열
|
||||
|
||||
//
|
||||
const sumColCount = layoutSetupRef.filter((item) => item.col).some((item) => item.col > maxCol)
|
||||
|
||||
if (sumRowCount > maxRow || sumColCount) {
|
||||
failAutoSetupRoof.push(moduleSetupSurface)
|
||||
return false
|
||||
}
|
||||
|
||||
// 혼합일때 모듈 개별의 row를 체크함
|
||||
const isPassedObject =
|
||||
isMultipleModules && layoutSetupRef.find((item, index) => item.checked && item.row > trestleDetailData.module[index].mixModuleMaxRows)
|
||||
|
||||
if (isPassedObject) {
|
||||
failAutoSetupRoof.push(moduleSetupSurface)
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
//흐름 방향이 남쪽(아래)
|
||||
const downFlowSetupModule = (
|
||||
surfaceMaxLines,
|
||||
surfaceMaxLines, //deprecated
|
||||
maxLengthLine,
|
||||
moduleSetupArray,
|
||||
moduleSetupSurface,
|
||||
containsBatchObjects,
|
||||
isCenter = false,
|
||||
isCenter = false, //deprecated
|
||||
intvHor,
|
||||
intvVer,
|
||||
) => {
|
||||
@ -1840,8 +1941,35 @@ export function useModuleBasicSetting(tabNum) {
|
||||
let installedModuleHeightCount = 0 //마지막으로 설치된 모듈의 카운트
|
||||
let isChidoriLine = false
|
||||
let flowLines
|
||||
let installedModuleMixYn
|
||||
const isNorthSurface = moduleSetupSurface.isNorth
|
||||
const isIncludeNorthModule = checkedModule.some((module) => module.northModuleYn === 'Y') //체크된 모듈 중에 북면 모듈이 있는지 확인하는 로직
|
||||
|
||||
let layoutRow = 0
|
||||
let layoutCol = 0
|
||||
|
||||
if (type === 'layout') {
|
||||
const isPassed = checkAutoLayoutModuleSetup(moduleSetupSurface, trestleDetailData)
|
||||
if (!isPassed) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
for (let moduleIndex = 0; moduleIndex < checkedModule.length; moduleIndex++) {
|
||||
const module = checkedModule[moduleIndex]
|
||||
|
||||
if (type === 'layout' && checkedLayoutData) {
|
||||
const layout = checkedLayoutData.find((item) => module.itemId === item.moduleId)
|
||||
layoutRow = layout.row
|
||||
layoutCol = layout.col
|
||||
}
|
||||
//혼합여부에 따라 설치 여부 결정
|
||||
if (installedModuleMixYn && installedModuleMixYn !== module.mixAsgYn) {
|
||||
continue
|
||||
}
|
||||
//북면일때
|
||||
const isNorthModuleYn = module.northModuleYn === 'Y'
|
||||
|
||||
checkedModule.forEach((module, moduleIndex) => {
|
||||
const tmpModuleData = trestleDetailData.module.filter((moduleObj) => module.moduleTpCd === moduleObj.moduleTpCd)[0]
|
||||
//혼합모듈일때는 mixModuleMaxRows 값이 0 이상임
|
||||
// let moduleMaxRows = tmpModuleData.mixModuleMaxRows === 0 ? tmpModuleData.moduleMaxRows : tmpModuleData.mixModuleMaxRows
|
||||
@ -1857,18 +1985,38 @@ export function useModuleBasicSetting(tabNum) {
|
||||
}
|
||||
}
|
||||
|
||||
if (moduleSetupSurface.isSaleStoreNorthFlg) {
|
||||
//북면일때
|
||||
if (isIncludeNorthModule) {
|
||||
if (!isNorthModuleYn && isNorthSurface) {
|
||||
continue
|
||||
} //흐름 방향이 북쪽(위)
|
||||
}
|
||||
} else {
|
||||
if (isNorthSurface) {
|
||||
if (!isNorthModuleYn) {
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//육지붕이 아닐때만 넣는다 육지붕일땐 클릭 이벤트에 별도로 넣어놓음
|
||||
const moduleArray = []
|
||||
|
||||
let calcAreaWidth = Math.abs(flowLines.right.x1 - flowLines.left.x1) //오른쪽 x에서 왼쪽 x를 뺀 가운데를 찾는 로직
|
||||
let calcModuleWidthCount = calcAreaWidth / (width + intvHor + 1) //뺀 공간에서 모듈을 몇개를 넣을수 있는지 확인하는 로직
|
||||
|
||||
let calcMaxModuleWidthCount = calcModuleWidthCount > moduleMaxCols ? moduleMaxCols : calcModuleWidthCount //최대 모듈 단수가 있기 때문에 최대 단수보다 카운트가 크면 최대 단수로 씀씀
|
||||
let totalModuleWidthCount = Math.floor(calcMaxModuleWidthCount) //치조배치일경우는 한개 더 넣는다
|
||||
|
||||
let calcAreaHeight = flowLines.bottom.y1 - flowLines.top.y1
|
||||
let calcModuleHeightCount = calcAreaHeight / (height + intvVer + 1)
|
||||
|
||||
if (type === 'layout') {
|
||||
calcModuleWidthCount = layoutCol > calcModuleWidthCount ? calcModuleWidthCount : layoutCol
|
||||
calcModuleHeightCount = layoutRow
|
||||
}
|
||||
|
||||
let calcMaxModuleWidthCount = calcModuleWidthCount > moduleMaxCols ? moduleMaxCols : calcModuleWidthCount //최대 모듈 단수가 있기 때문에 최대 단수보다 카운트가 크면 최대 단수로 씀씀
|
||||
let totalModuleWidthCount = Math.floor(calcMaxModuleWidthCount) //치조배치일경우는 한개 더 넣는다
|
||||
|
||||
let calcStartPoint = flowLines.right.type === 'flat' ? (calcAreaWidth - totalModuleWidthCount * width) / 2 : 0 //반씩 나눠서 중앙에 맞춤 bottom 기준으로 양변이 직선일때만 가운데 정렬
|
||||
let startPointX = flowLines.left.x1 + calcStartPoint //시작점을 만든다
|
||||
|
||||
@ -1882,7 +2030,7 @@ export function useModuleBasicSetting(tabNum) {
|
||||
let chidoriLength = 0
|
||||
|
||||
//첫번재 모듈 설치 후 두번째 모듈을 몇개까지 설치 할 수 있는지 계산
|
||||
if (moduleIndex > 0) {
|
||||
if (installedModuleHeightCount > 0) {
|
||||
// moduleMaxRows = totalModuleMaxRows - installedModuleHeightCount //두번째 모듈일때
|
||||
isChidoriLine = installedModuleHeightCount % 2 != 0 ? true : false //첫번째에서 짝수에서 끝났으면 홀수는 치도리가 아님 짝수는 치도리
|
||||
}
|
||||
@ -1892,12 +2040,12 @@ export function useModuleBasicSetting(tabNum) {
|
||||
let moduleY = flowLines.bottom.y1 - height * i - 1 //살짝 여유를 준다
|
||||
|
||||
//두번째 모듈 -> 혼합일 경우의 설치될 모듈 높이를 계산
|
||||
if (moduleIndex > 0) {
|
||||
moduleY = installedLastHeightCoord - intvVer
|
||||
if (installedModuleHeightCount > 0) {
|
||||
moduleY = installedLastHeightCoord
|
||||
}
|
||||
|
||||
//첫번째는 붙여서 두번째는 마진을 주고 설치
|
||||
heightMargin = i === 0 ? 0 : intvVer * i
|
||||
heightMargin = installedModuleHeightCount === 0 ? 0 : intvVer
|
||||
|
||||
for (let j = 0; j < totalModuleWidthCount; j++) {
|
||||
let moduleX = startPointX + width * j + 1 //5정도 마진을 준다
|
||||
@ -1947,18 +2095,19 @@ export function useModuleBasicSetting(tabNum) {
|
||||
installedLastHeightCoord = moduleY - height - heightMargin
|
||||
} else {
|
||||
//디버깅용
|
||||
// tempModule.set({ fill: 'transparent', stroke: 'red', strokeWidth: 1 })
|
||||
// canvas?.add(tempModule)
|
||||
// canvas.renderAll()
|
||||
tempModule.set({ fill: 'transparent', stroke: 'red', strokeWidth: 1 })
|
||||
canvas?.add(tempModule)
|
||||
canvas.renderAll()
|
||||
}
|
||||
}
|
||||
if (isInstall) {
|
||||
++installedModuleHeightCount
|
||||
installedModuleMixYn = module.mixAsgYn
|
||||
}
|
||||
}
|
||||
|
||||
setupModule.push(moduleArray)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const topFlowSetupModule = (
|
||||
@ -1980,8 +2129,36 @@ export function useModuleBasicSetting(tabNum) {
|
||||
let installedModuleHeightCount = 0 //마지막으로 설치된 모듈의 카운트
|
||||
let isChidoriLine = false
|
||||
let flowLines
|
||||
let installedModuleMixYn
|
||||
const isNorthSurface = moduleSetupSurface.isNorth
|
||||
const isIncludeNorthModule = checkedModule.some((module) => module.northModuleYn === 'Y') //체크된 모듈 중에 북면 모듈이 있는지 확인하는 로직
|
||||
|
||||
let layoutRow = 0
|
||||
let layoutCol = 0
|
||||
|
||||
if (type === 'layout') {
|
||||
const isPassed = checkAutoLayoutModuleSetup(moduleSetupSurface, trestleDetailData)
|
||||
if (!isPassed) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
for (let moduleIndex = 0; moduleIndex < checkedModule.length; moduleIndex++) {
|
||||
const module = checkedModule[moduleIndex]
|
||||
|
||||
if (type === 'layout' && checkedLayoutData) {
|
||||
const layout = checkedLayoutData.find((item) => module.itemId === item.moduleId)
|
||||
layoutRow = layout.row
|
||||
layoutCol = layout.col
|
||||
}
|
||||
|
||||
//혼합여부에 따라 설치 여부 결정
|
||||
if (installedModuleMixYn && installedModuleMixYn !== module.mixAsgYn) {
|
||||
continue
|
||||
}
|
||||
|
||||
const isNorthModuleYn = module.northModuleYn === 'Y'
|
||||
|
||||
checkedModule.forEach((module, moduleIndex) => {
|
||||
const tmpModuleData = trestleDetailData.module.filter((moduleObj) => module.moduleTpCd === moduleObj.moduleTpCd)[0]
|
||||
//혼합모듈일때는 mixModuleMaxRows 값이 0 이상임
|
||||
let moduleMaxRows = tmpModuleData.mixModuleMaxRows === 0 ? tmpModuleData.moduleMaxRows : tmpModuleData.mixModuleMaxRows
|
||||
@ -1997,20 +2174,45 @@ export function useModuleBasicSetting(tabNum) {
|
||||
}
|
||||
}
|
||||
|
||||
//흐름 방향이 북쪽(위)
|
||||
if (moduleSetupSurface.isSaleStoreNorthFlg) {
|
||||
//북면가능 설치 대리점이면
|
||||
//북면일때
|
||||
if (isIncludeNorthModule) {
|
||||
//북면 모듈이 있는지 확인하는 로직
|
||||
if (!isNorthModuleYn && isNorthSurface) {
|
||||
//북면 모듈이 있으면 북면 모듈만 깔고 나머지는 스킵
|
||||
continue
|
||||
} //흐름 방향이 북쪽(위)
|
||||
}
|
||||
} else {
|
||||
// 불면설치 불가 대리점이면
|
||||
if (isNorthSurface) {
|
||||
//북면일때
|
||||
if (!isNorthModuleYn) {
|
||||
//북면 모듈이 아니면 스킵
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//육지붕이 아닐때만 넣는다 육지붕일땐 클릭 이벤트에 별도로 넣어놓음
|
||||
const moduleArray = []
|
||||
|
||||
let calcAreaWidth = flowLines.right.x1 - flowLines.left.x1 //오른쪽 x에서 왼쪽 x를 뺀 가운데를 찾는 로직
|
||||
let calcModuleWidthCount = calcAreaWidth / (width + intvHor + 1) //뺀 공간에서 모듈을 몇개를 넣을수 있는지 확인하는 로직
|
||||
let calcAreaHeight = flowLines.bottom.y1 - flowLines.top.y1
|
||||
let calcModuleHeightCount = calcAreaHeight / (height + intvVer + 1)
|
||||
|
||||
//단수지정 자동이면
|
||||
if (type === 'layout') {
|
||||
calcModuleWidthCount = layoutCol > calcModuleWidthCount ? calcModuleWidthCount : layoutCol
|
||||
calcModuleHeightCount = layoutRow
|
||||
}
|
||||
|
||||
let calcMaxModuleWidthCount = calcModuleWidthCount > moduleMaxCols ? moduleMaxCols : calcModuleWidthCount //최대 모듈 단수가 있기 때문에 최대 단수보다 카운트가 크면 최대 단수로 씀씀
|
||||
// let totalModuleWidthCount = isChidori ? Math.abs(calcMaxModuleWidthCount) : Math.floor(calcMaxModuleWidthCount) //치조배치일경우는 한개 더 넣는다 //??어쩔때는 붙고 어쩔때는 안붙고 멋대로???
|
||||
let totalModuleWidthCount = Math.floor(calcMaxModuleWidthCount) //치조배치일경우는 한개 더 넣는다
|
||||
|
||||
let calcAreaHeight = flowLines.bottom.y1 - flowLines.top.y1
|
||||
let calcModuleHeightCount = calcAreaHeight / (height + intvVer + 1)
|
||||
|
||||
let calcStartPoint = flowLines.left.type === 'flat' ? (calcAreaWidth - totalModuleWidthCount * width) / 2 : 0 //반씩 나눠서 중앙에 맞춤 bottom 기준으로 양변이 직선일때만 가운데 정렬
|
||||
let startPointX = flowLines.right.x1 - calcStartPoint //시작점을 만든다
|
||||
|
||||
@ -2032,11 +2234,11 @@ export function useModuleBasicSetting(tabNum) {
|
||||
let isInstall = false
|
||||
let moduleY = flowLines.top.y1 + height * i //탑의 y점에서부터 아래로 그려 내려간다
|
||||
|
||||
if (moduleIndex > 0) {
|
||||
moduleY = installedLastHeightCoord + intvVer + 1
|
||||
if (installedModuleHeightCount > 0) {
|
||||
moduleY = installedLastHeightCoord
|
||||
}
|
||||
|
||||
heightMargin = i === 0 ? 0 : intvVer * i //모듈간에 마진이 있어 마진값도 넣음
|
||||
heightMargin = installedModuleHeightCount === 0 ? 0 : intvVer //모듈간에 마진이 있어 마진값도 넣음
|
||||
for (let j = 0; j < totalModuleWidthCount; j++) {
|
||||
//모듈 열수 만큼 반복
|
||||
let moduleX = startPointX - width * j - 1 //시작점에서 우 -> 좌로 그려 내려간다
|
||||
@ -2087,11 +2289,12 @@ export function useModuleBasicSetting(tabNum) {
|
||||
}
|
||||
if (isInstall) {
|
||||
++installedModuleHeightCount
|
||||
installedModuleMixYn = module.mixAsgYn
|
||||
}
|
||||
}
|
||||
|
||||
setupModule.push(moduleArray)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
//남, 북과 같은 로직으로 적용하려면 좌우는 열 -> 행 으로 그려야함
|
||||
@ -2115,8 +2318,36 @@ export function useModuleBasicSetting(tabNum) {
|
||||
let installedModuleHeightCount = 0 //마지막으로 설치된 모듈의 카운트
|
||||
let isChidoriLine = false
|
||||
let flowLines
|
||||
let installedModuleMixYn
|
||||
const isNorthSurface = moduleSetupSurface.isNorth
|
||||
const isIncludeNorthModule = checkedModule.some((module) => module.northModuleYn === 'Y') //체크된 모듈 중에 북면 모듈이 있는지 확인하는 로직
|
||||
|
||||
checkedModule.forEach((module, moduleIndex) => {
|
||||
let layoutRow = 0
|
||||
let layoutCol = 0
|
||||
|
||||
if (type === 'layout') {
|
||||
const isPassed = checkAutoLayoutModuleSetup(moduleSetupSurface, trestleDetailData)
|
||||
if (!isPassed) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
for (let moduleIndex = 0; moduleIndex < checkedModule.length; moduleIndex++) {
|
||||
const module = checkedModule[moduleIndex]
|
||||
|
||||
//단수 지정이면
|
||||
if (type === 'layout' && checkedLayoutData) {
|
||||
const layout = checkedLayoutData.find((item) => module.itemId === item.moduleId)
|
||||
layoutRow = layout.row
|
||||
layoutCol = layout.col
|
||||
}
|
||||
|
||||
//혼합여부에 따라 설치 여부 결정
|
||||
if (installedModuleMixYn && installedModuleMixYn !== module.mixAsgYn) {
|
||||
continue
|
||||
}
|
||||
|
||||
const isNorthModuleYn = module.northModuleYn === 'Y'
|
||||
const tmpModuleData = trestleDetailData.module.filter((moduleObj) => module.moduleTpCd === moduleObj.moduleTpCd)[0]
|
||||
//혼합모듈일때는 mixModuleMaxRows 값이 0 이상임
|
||||
let moduleMaxRows = tmpModuleData.mixModuleMaxRows === 0 ? tmpModuleData.moduleMaxRows : tmpModuleData.mixModuleMaxRows
|
||||
@ -2135,19 +2366,46 @@ export function useModuleBasicSetting(tabNum) {
|
||||
}
|
||||
}
|
||||
|
||||
if (moduleSetupSurface.isSaleStoreNorthFlg) {
|
||||
//북면가능 설치 대리점이면
|
||||
//북면일때
|
||||
if (isIncludeNorthModule) {
|
||||
//북면 모듈이 있는지 확인하는 로직
|
||||
if (!isNorthModuleYn && isNorthSurface) {
|
||||
//북면 모듈이 있으면 북면 모듈만 깔고 나머지는 스킵
|
||||
continue
|
||||
} //흐름 방향이 북쪽(위)
|
||||
}
|
||||
} else {
|
||||
// 불면설치 불가 대리점이면
|
||||
if (isNorthSurface) {
|
||||
//북면일때
|
||||
if (!isNorthModuleYn) {
|
||||
//북면 모듈이 아니면 스킵
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//육지붕이 아닐때만 넣는다 육지붕일땐 클릭 이벤트에 별도로 넣어놓음
|
||||
|
||||
const moduleArray = []
|
||||
|
||||
let calcAreaWidth = flowLines.bottom.y1 - flowLines.top.y1 //아래에서 y에서 위를 y를 뺀 가운데를 찾는 로직
|
||||
let calcModuleWidthCount = calcAreaWidth / (height + intvHor + 1) //뺀 공간에서 모듈을 몇개를 넣을수 있는지 확인하는 로직
|
||||
let calcAreaHeight = flowLines.right.x1 - flowLines.left.x1
|
||||
let calcModuleHeightCount = calcAreaHeight / (width + intvVer + 1)
|
||||
|
||||
//단수지정 자동이면
|
||||
if (type === 'layout') {
|
||||
calcModuleWidthCount = layoutCol > calcModuleWidthCount ? calcModuleWidthCount : layoutCol
|
||||
calcModuleHeightCount = layoutRow
|
||||
}
|
||||
|
||||
let calcMaxModuleWidthCount = calcModuleWidthCount > moduleMaxCols ? moduleMaxCols : calcModuleWidthCount //최대 모듈 단수가 있기 때문에 최대 단수보다 카운트가 크면 최대 단수로 씀씀
|
||||
// let totalModuleWidthCount = isChidori ? Math.abs(calcMaxModuleWidthCount) : Math.floor(calcMaxModuleWidthCount) //치조배치일경우는 한개 더 넣는다
|
||||
let totalModuleWidthCount = Math.floor(calcMaxModuleWidthCount) //치조배치일경우는 한개 더 넣는다
|
||||
|
||||
let calcAreaHeight = flowLines.right.x1 - flowLines.left.x1
|
||||
let calcModuleHeightCount = calcAreaHeight / (width + intvVer + 1)
|
||||
|
||||
let calcStartPoint = flowLines.bottom.type === 'flat' ? (calcAreaWidth - totalModuleWidthCount * height) / 2 : 0 //반씩 나눠서 중앙에 맞춤 left 높이 기준으로 양변이 직선일때만 가운데 정렬
|
||||
let startPointX = flowLines.top.y1 + calcStartPoint //시작점을 만든다
|
||||
|
||||
@ -2171,12 +2429,12 @@ export function useModuleBasicSetting(tabNum) {
|
||||
let moduleY = flowLines.left.x1 + width * i + 1 //살짝 여유를 준다
|
||||
|
||||
//두번째 모듈 -> 혼합일 경우의 설치될 모듈 높이를 계산
|
||||
if (moduleIndex > 0) {
|
||||
moduleY = installedLastHeightCoord + intvHor
|
||||
if (installedModuleHeightCount > 0) {
|
||||
moduleY = installedLastHeightCoord
|
||||
}
|
||||
|
||||
//첫번째는 붙여서 두번째는 마진을 주고 설치
|
||||
heightMargin = i === 0 ? 0 : intvHor * i
|
||||
heightMargin = installedModuleHeightCount === 0 ? 0 : intvHor
|
||||
|
||||
for (let j = 0; j < totalModuleWidthCount; j++) {
|
||||
let moduleX = startPointX + height * j + 1 //5정도 마진을 준다
|
||||
@ -2227,10 +2485,11 @@ export function useModuleBasicSetting(tabNum) {
|
||||
|
||||
if (isInstall) {
|
||||
++installedModuleHeightCount
|
||||
installedModuleMixYn = module.mixAsgYn
|
||||
}
|
||||
}
|
||||
setupModule.push(moduleArray)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const rightFlowSetupModule = (
|
||||
@ -2252,8 +2511,35 @@ export function useModuleBasicSetting(tabNum) {
|
||||
let installedModuleHeightCount = 0 //마지막으로 설치된 모듈의 카운트
|
||||
let isChidoriLine = false
|
||||
let flowLines
|
||||
let installedModuleMixYn
|
||||
const isNorthSurface = moduleSetupSurface.isNorth
|
||||
const isIncludeNorthModule = checkedModule.some((module) => module.northModuleYn === 'Y') //체크된 모듈 중에 북면 모듈이 있는지 확인하는 로직
|
||||
|
||||
checkedModule.forEach((module, moduleIndex) => {
|
||||
let layoutRow = 0
|
||||
let layoutCol = 0
|
||||
|
||||
if (type === 'layout') {
|
||||
const isPassed = checkAutoLayoutModuleSetup(moduleSetupSurface, trestleDetailData)
|
||||
if (!isPassed) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
for (let moduleIndex = 0; moduleIndex < checkedModule.length; moduleIndex++) {
|
||||
const module = checkedModule[moduleIndex]
|
||||
|
||||
if (type === 'layout' && checkedLayoutData) {
|
||||
const layout = checkedLayoutData.find((item) => module.itemId === item.moduleId)
|
||||
layoutRow = layout.row
|
||||
layoutCol = layout.col
|
||||
}
|
||||
|
||||
//혼합여부에 따라 설치 여부 결정
|
||||
if (installedModuleMixYn && installedModuleMixYn !== module.mixAsgYn) {
|
||||
continue
|
||||
}
|
||||
|
||||
const isNorthModuleYn = module.northModuleYn === 'Y'
|
||||
const tmpModuleData = trestleDetailData.module.filter((moduleObj) => module.moduleTpCd === moduleObj.moduleTpCd)[0]
|
||||
//혼합모듈일때는 mixModuleMaxRows 값이 0 이상임
|
||||
let moduleMaxRows = tmpModuleData.mixModuleMaxRows === 0 ? tmpModuleData.moduleMaxRows : tmpModuleData.mixModuleMaxRows
|
||||
@ -2272,18 +2558,45 @@ export function useModuleBasicSetting(tabNum) {
|
||||
}
|
||||
}
|
||||
|
||||
if (moduleSetupSurface.isSaleStoreNorthFlg) {
|
||||
//북면가능 설치 대리점이면
|
||||
//북면일때
|
||||
if (isIncludeNorthModule) {
|
||||
//북면 모듈이 있는지 확인하는 로직
|
||||
if (!isNorthModuleYn && isNorthSurface) {
|
||||
//북면 모듈이 있으면 북면 모듈만 깔고 나머지는 스킵
|
||||
continue
|
||||
} //흐름 방향이 북쪽(위)
|
||||
}
|
||||
} else {
|
||||
// 불면설치 불가 대리점이면
|
||||
if (isNorthSurface) {
|
||||
//북면일때
|
||||
if (!isNorthModuleYn) {
|
||||
//북면 모듈이 아니면 스킵
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//육지붕이 아닐때만 넣는다 육지붕일땐 클릭 이벤트에 별도로 넣어놓음
|
||||
const moduleArray = []
|
||||
|
||||
let calcAreaWidth = flowLines.bottom.y1 - flowLines.top.y1 //아래에서 y에서 위를 y를 뺀 가운데를 찾는 로직
|
||||
let calcModuleWidthCount = calcAreaWidth / (height + intvHor + 1) //뺀 공간에서 모듈을 몇개를 넣을수 있는지 확인하는 로직
|
||||
let calcAreaHeight = flowLines.right.x1 - flowLines.left.x1
|
||||
let calcModuleHeightCount = calcAreaHeight / (width + intvVer + 1)
|
||||
|
||||
//단수지정 자동이면
|
||||
if (type === 'layout') {
|
||||
calcModuleWidthCount = layoutCol > calcModuleWidthCount ? calcModuleWidthCount : layoutCol
|
||||
calcModuleHeightCount = layoutRow
|
||||
}
|
||||
|
||||
let calcMaxModuleWidthCount = calcModuleWidthCount > moduleMaxCols ? moduleMaxCols : calcModuleWidthCount //최대 모듈 단수가 있기 때문에 최대 단수보다 카운트가 크면 최대 단수로 씀씀
|
||||
// let totalModuleWidthCount = isChidori ? Math.abs(calcMaxModuleWidthCount) : Math.floor(calcMaxModuleWidthCount) //치조배치일경우는 한개 더 넣는다
|
||||
let totalModuleWidthCount = Math.floor(calcMaxModuleWidthCount) //치조배치일경우는 한개 더 넣는다
|
||||
|
||||
let calcAreaHeight = flowLines.right.x1 - flowLines.left.x1
|
||||
let calcModuleHeightCount = calcAreaHeight / (width + intvVer + 1)
|
||||
|
||||
let calcStartPoint = flowLines.top.type === 'flat' ? (calcAreaWidth - totalModuleWidthCount * height) / 2 : 0 //반씩 나눠서 중앙에 맞춤 left 높이 기준으로 양변이 직선일때만 가운데 정렬
|
||||
let startPointX = flowLines.bottom.y2 - calcStartPoint //시작점을 만든다
|
||||
|
||||
@ -2307,12 +2620,12 @@ export function useModuleBasicSetting(tabNum) {
|
||||
let moduleY = flowLines.right.x1 - width * i - 1 //살짝 여유를 준다
|
||||
|
||||
//두번째 모듈 -> 혼합일 경우의 설치될 모듈 높이를 계산
|
||||
if (moduleIndex > 0) {
|
||||
moduleY = installedLastHeightCoord - intvHor
|
||||
if (installedModuleHeightCount > 0) {
|
||||
moduleY = installedLastHeightCoord
|
||||
}
|
||||
|
||||
//첫번째는 붙여서 두번째는 마진을 주고 설치
|
||||
heightMargin = i === 0 ? 0 : intvHor * i
|
||||
heightMargin = installedModuleHeightCount === 0 ? 0 : intvHor
|
||||
|
||||
for (let j = 0; j < totalModuleWidthCount; j++) {
|
||||
let moduleX = startPointX - height * j - 1 //5정도 마진을 준다
|
||||
@ -2366,11 +2679,12 @@ export function useModuleBasicSetting(tabNum) {
|
||||
|
||||
if (isInstall) {
|
||||
++installedModuleHeightCount
|
||||
installedModuleMixYn = module.mixAsgYn
|
||||
}
|
||||
}
|
||||
|
||||
setupModule.push(moduleArray)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
moduleSetupSurfaces.forEach((moduleSetupSurface, index) => {
|
||||
@ -2460,6 +2774,18 @@ export function useModuleBasicSetting(tabNum) {
|
||||
}
|
||||
})
|
||||
// calculateForApi()
|
||||
|
||||
if (type === 'layout' && failAutoSetupRoof.length > 0) {
|
||||
const roofNamesList = failAutoSetupRoof.map((roof) => ({
|
||||
roofName: roof.roofMaterial.roofMatlNmJp,
|
||||
moduleMaxRows: roof.trestleDetail.moduleMaxRows,
|
||||
}))
|
||||
|
||||
const alertString = roofNamesList.map((item, index) => `${item.roofName}(${item.moduleMaxRows})`)
|
||||
console.log('alertString', alertString)
|
||||
|
||||
// swalFire({ text: alertString, icon: 'warning' })
|
||||
}
|
||||
}
|
||||
|
||||
const coordToTurfPolygon = (points) => {
|
||||
|
||||
@ -149,9 +149,10 @@
|
||||
"modal.module.basic.setting.pitch.module.column.amount": "列数",
|
||||
"modal.module.basic.setting.pitch.module.column.margin": "左右間隔",
|
||||
"modal.module.basic.setting.prev": "前に戻る",
|
||||
"modal.module.basic.setting.row.batch": "段・列数指定配置",
|
||||
"modal.module.basic.setting.row.batch": "レイアウト指定",
|
||||
"modal.module.basic.setting.passivity.placement": "手動配置",
|
||||
"modal.module.basic.setting.auto.placement": "自動配置",
|
||||
"modal.module.basic.setting.auto.row.batch": "自動レイアウト指定",
|
||||
"plan.menu.module.circuit.setting.circuit.trestle.setting": "回路設定",
|
||||
"modal.circuit.trestle.setting": "回路設定",
|
||||
"modal.circuit.trestle.setting.alloc.trestle": "架台配置",
|
||||
|
||||
@ -152,7 +152,8 @@
|
||||
"modal.module.basic.setting.prev": "이전",
|
||||
"modal.module.basic.setting.row.batch": "단·열수 지정 배치",
|
||||
"modal.module.basic.setting.passivity.placement": "수동 배치",
|
||||
"modal.module.basic.setting.auto.placement": "설정값으로 자동 배치",
|
||||
"modal.module.basic.setting.auto.placement": "자동 배치",
|
||||
"modal.module.basic.setting.auto.row.batch": "자동 단·열수 지정 배치 ",
|
||||
"plan.menu.module.circuit.setting.circuit.trestle.setting": "회로설정",
|
||||
"modal.circuit.trestle.setting": "회로설정",
|
||||
"modal.circuit.trestle.setting.alloc.trestle": "가대할당",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user