Compare commits
No commits in common. "d524b33f5694417f59c3068934ecfd666bbda7be" and "6c6e5845ef0341b4125f19d16837ddcddaefbd86" have entirely different histories.
d524b33f56
...
6c6e5845ef
@ -91,14 +91,14 @@ export default function BasicSetting({ id, pos = { x: 50, y: 230 } }) {
|
||||
useEffect(() => {
|
||||
if (roofsStore && addedRoofs) {
|
||||
console.log('🚀 ~ useEffect ~ roofsStore, addedRoofs:', roofsStore, addedRoofs)
|
||||
// setRoofs(
|
||||
// addedRoofs.map((roof, index) => {
|
||||
// return {
|
||||
// ...roof,
|
||||
// ...roofsStore[index]?.addRoof,
|
||||
// }
|
||||
// }),
|
||||
// )
|
||||
setRoofs(
|
||||
addedRoofs.map((roof, index) => {
|
||||
return {
|
||||
...roof,
|
||||
...roofsStore[index].addRoof,
|
||||
}
|
||||
}),
|
||||
)
|
||||
|
||||
setModuleSelectionData({
|
||||
...moduleSelectionData,
|
||||
|
||||
@ -321,7 +321,7 @@ export const Orientation = forwardRef((props, ref) => {
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{Array.from({ length: 3 }).map((_, index) => {
|
||||
{Array.from({ length: 2 }).map((_, index) => {
|
||||
return selectedModules && selectedModules?.itemList && selectedModules?.itemList?.length >= index + 1 ? (
|
||||
<tr key={index}>
|
||||
<td>
|
||||
|
||||
@ -5,7 +5,6 @@ import {
|
||||
checkedModuleState,
|
||||
isManualModuleLayoutSetupState,
|
||||
isManualModuleSetupState,
|
||||
moduleRowColArrayState,
|
||||
moduleSetupOptionState,
|
||||
toggleManualSetupModeState,
|
||||
} from '@/store/canvasAtom'
|
||||
@ -37,7 +36,6 @@ const Placement = forwardRef((props, refs) => {
|
||||
const resetModuleSetupOption = useResetRecoilState(moduleSetupOptionState)
|
||||
|
||||
const [colspan, setColspan] = useState(1)
|
||||
const [moduleRowColArray, setModuleRowColArray] = useRecoilState(moduleRowColArrayState)
|
||||
|
||||
//모듈 배치면 생성
|
||||
useEffect(() => {
|
||||
@ -64,10 +62,6 @@ const Placement = forwardRef((props, refs) => {
|
||||
}
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
console.log('moduleRowColArray', moduleRowColArray)
|
||||
}, [moduleRowColArray])
|
||||
|
||||
//최초 지입시 체크
|
||||
useEffect(() => {
|
||||
if (isObjectNotEmpty(moduleSelectionData)) {
|
||||
@ -348,18 +342,18 @@ const Placement = forwardRef((props, refs) => {
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{moduleSelectionData.roofConstructions.map((item, index) => (
|
||||
{moduleSelectionData.roofConstructions.map((item) => (
|
||||
<tr>
|
||||
<td>
|
||||
<div className="color-wrap">
|
||||
<span className="color-box" style={{ backgroundColor: roofOutlineColor(item.addRoof.index) }}></span>
|
||||
<span className="color-box" style={{ backgroundColor: roofOutlineColor(item.roofIndex) }}></span>
|
||||
<span className="name">{item.addRoof.roofMatlNmJp}</span>
|
||||
</div>
|
||||
</td>
|
||||
{moduleRowColArray[index]?.map((item) => (
|
||||
{selectedModules.itemList.map((item) => (
|
||||
<>
|
||||
<td className="al-c">{item.moduleMaxRows}</td>
|
||||
{colspan > 1 && <td className="al-c">{item.mixModuleMaxRows}</td>}
|
||||
<td className="al-c">7</td>
|
||||
{colspan > 1 && <td className="al-c">5</td>}
|
||||
</>
|
||||
))}
|
||||
</tr>
|
||||
|
||||
@ -45,7 +45,7 @@ const Trestle = forwardRef((props, ref) => {
|
||||
const selectedModules = useRecoilValue(selectedModuleState) //선택된 모듈
|
||||
// const [moduleSelectionData, setModuleSelectionData] = useRecoilState(moduleSelectionDataState)
|
||||
const [lengthBase, setLengthBase] = useState(0)
|
||||
const [hajebichi, setHajebichi] = useState(trestleState?.roofPitch ?? 0)
|
||||
const [hajebichi, setHajebichi] = useState(0)
|
||||
const [selectedRaftBase, setSelectedRaftBase] = useState(null)
|
||||
const [selectedTrestle, setSelectedTrestle] = useState(null)
|
||||
const [selectedConstMthd, setSelectedConstMthd] = useState(null)
|
||||
@ -196,12 +196,10 @@ const Trestle = forwardRef((props, ref) => {
|
||||
stdWindSpeed: managementState?.standardWindSpeedId ?? '',
|
||||
stdSnowLd: +managementState?.verticalSnowCover ?? '',
|
||||
inclCd: selectedRoof?.pitch.toString() ?? 0,
|
||||
// roofPitch: Math.round(selectedRoof?.roofPchBase ?? 0),
|
||||
roofPitch: hajebichi ?? 0,
|
||||
roofPitch: Math.round(selectedRoof?.roofPchBase ?? 0),
|
||||
constTp: constructionList[index].constTp,
|
||||
mixMatlNo: selectedModules.mixMatlNo,
|
||||
// workingWidth: selectedRoof?.length.toString() ?? '',
|
||||
workingWidth: lengthBase ?? '',
|
||||
workingWidth: selectedRoof?.length.toString() ?? '',
|
||||
// snowGdPossYn: constructionList[index].snowGdPossYn,
|
||||
// cvrYn: constructionList[index].cvrYn,
|
||||
},
|
||||
@ -256,24 +254,25 @@ const Trestle = forwardRef((props, ref) => {
|
||||
}
|
||||
})
|
||||
|
||||
console.log('newAddedRoofs', newAddedRoofs)
|
||||
|
||||
if (result) {
|
||||
setRoofs(newAddedRoofs)
|
||||
setModuleSelectionData({
|
||||
...moduleSelectionData,
|
||||
roofConstructions: newAddedRoofs.map((roof, index) => {
|
||||
return {
|
||||
roofIndex: index,
|
||||
addRoof: {
|
||||
...moduleSelectionData.roofConstructions[index]?.addRoof,
|
||||
...roof.addRoof,
|
||||
...moduleSelectionData.roofConstructions[index].addRoof,
|
||||
},
|
||||
trestle: {
|
||||
...roof.trestle,
|
||||
...moduleSelectionData.roofConstructions[index]?.trestle,
|
||||
...moduleSelectionData.roofConstructions[index].trestle,
|
||||
},
|
||||
construction: {
|
||||
...moduleSelectionData.roofConstructions[index]?.construction,
|
||||
...roof.construction,
|
||||
...moduleSelectionData.roofConstructions[index].construction,
|
||||
},
|
||||
trestleDetail: {
|
||||
...roof.trestleDetail,
|
||||
@ -339,7 +338,7 @@ const Trestle = forwardRef((props, ref) => {
|
||||
<input
|
||||
type="text"
|
||||
className="input-origin block"
|
||||
value={lengthBase}
|
||||
value={trestleState?.lengthBase}
|
||||
onChange={(e) => setLengthBase(e.target.value)}
|
||||
disabled={selectedRoof.lenAuth === 'R'}
|
||||
/>
|
||||
@ -380,7 +379,7 @@ const Trestle = forwardRef((props, ref) => {
|
||||
type="text"
|
||||
className="input-origin block"
|
||||
disabled={selectedRoof.roofPchAuth === 'R'}
|
||||
onChange={(e) => setHajebichi(e.target.value)}
|
||||
onChange={(e) => handleHajebichiAndLength(e, 'hajebichi')}
|
||||
value={hajebichi}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@ -10,7 +10,6 @@ import {
|
||||
isManualModuleSetupState,
|
||||
moduleSetupOptionState,
|
||||
toggleManualSetupModeState,
|
||||
moduleRowColArrayState,
|
||||
} from '@/store/canvasAtom'
|
||||
|
||||
import { rectToPolygon, polygonToTurfPolygon, calculateVisibleModuleHeight, getDegreeByChon, toFixedWithoutRounding } from '@/util/canvas-util'
|
||||
@ -62,7 +61,6 @@ export function useModuleBasicSetting(tabNum) {
|
||||
const { drawDirectionArrow } = usePolygon()
|
||||
const moduleSetupOption = useRecoilValue(moduleSetupOptionState)
|
||||
const setManualSetupMode = useSetRecoilState(toggleManualSetupModeState)
|
||||
const [moduleRowColArray, setModuleRowColArray] = useRecoilState(moduleRowColArrayState)
|
||||
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
@ -83,8 +81,6 @@ export function useModuleBasicSetting(tabNum) {
|
||||
|
||||
//모듈 선택에서 선택된 값들 넘어옴
|
||||
const makeModuleInitArea = () => {
|
||||
console.log('moduleSelectionData', moduleSelectionData)
|
||||
|
||||
if (isObjectNotEmpty(moduleSelectionData) && tabNum === 3) {
|
||||
if (canvasSetting.roofSizeSet !== '3') {
|
||||
const common = moduleSelectionData.common
|
||||
@ -94,11 +90,11 @@ export function useModuleBasicSetting(tabNum) {
|
||||
const listParams = roofConstructions.map((item) => {
|
||||
return {
|
||||
...common,
|
||||
roofMatlCd: item.addRoof.roofMatlCd,
|
||||
trestleMkrCd: item.addRoof.trestleMkrCd,
|
||||
constMthdCd: item.addRoof.constMthdCd,
|
||||
roofBaseCd: item.addRoof.roofBaseCd,
|
||||
constTp: item.addRoof.constTp,
|
||||
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),
|
||||
@ -144,7 +140,6 @@ export function useModuleBasicSetting(tabNum) {
|
||||
//가대 상세 데이터 들어오면 실행
|
||||
useEffect(() => {
|
||||
if (trestleDetailList.length > 0) {
|
||||
let rowColArray = []
|
||||
//지붕을 가져옴
|
||||
canvas
|
||||
.getObjects()
|
||||
@ -152,37 +147,26 @@ export function useModuleBasicSetting(tabNum) {
|
||||
.forEach((roof) => {
|
||||
if (!roof.roofMaterial) return
|
||||
const roofIndex = roof.roofMaterial.index //지붕의 지붕재의 순번
|
||||
|
||||
trestleDetailList.forEach((detail) => {
|
||||
if (detail.data !== null) {
|
||||
if (Number(detail.data.roofIndex) === roofIndex) {
|
||||
//roof에 상세 데이터 추가
|
||||
|
||||
roof.set({
|
||||
trestleDetail: detail.data,
|
||||
stroke: roofOutlineColor(roofIndex),
|
||||
strokeWidth: 7,
|
||||
})
|
||||
|
||||
const offsetObjects = moduleSelectionData.roofConstructions.find((item) => item.addRoof.index === roofIndex)
|
||||
|
||||
roof.lines.forEach((line) => {
|
||||
line.attributes = { ...line.attributes, offset: getOffset(offsetObjects.addRoof, line.attributes.type) }
|
||||
line.attributes = { ...line.attributes, offset: getOffset(detail.data, line.attributes.type) }
|
||||
})
|
||||
//배치면 설치 영역
|
||||
makeModuleInstArea(roof, detail.data)
|
||||
//surface에 상세 데이터 추가
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
trestleDetailList.forEach((detail) => {
|
||||
const moduleRowArray = []
|
||||
detail.data.module.forEach((module) => {
|
||||
moduleRowArray.push({ moduleMaxRows: module.moduleMaxRows, mixModuleMaxRows: module.mixModuleMaxRows })
|
||||
})
|
||||
rowColArray.push(moduleRowArray)
|
||||
})
|
||||
setModuleRowColArray(rowColArray)
|
||||
}
|
||||
}, [trestleDetailList])
|
||||
|
||||
@ -201,12 +185,12 @@ export function useModuleBasicSetting(tabNum) {
|
||||
const getOffset = (data, type) => {
|
||||
switch (type) {
|
||||
case LINE_TYPE.WALLLINE.EAVES:
|
||||
return data.eavesMargin / 10
|
||||
return data.eaveIntvl / 10
|
||||
case LINE_TYPE.WALLLINE.GABLE:
|
||||
return data.kerabaMargin / 10
|
||||
return data.kerabaIntvl / 10
|
||||
case LINE_TYPE.SUBLINE.RIDGE:
|
||||
case LINE_TYPE.WALLLINE.SHED:
|
||||
return data.ridgeMargin / 10
|
||||
return data.ridgeIntvl / 10
|
||||
default:
|
||||
return 200 / 10
|
||||
}
|
||||
|
||||
@ -8,6 +8,8 @@ import { GlobalDataContext } from '@/app/GlobalDataProvider'
|
||||
const RAFT_BASE_CODE = '203800'
|
||||
|
||||
const trestleReducer = (state, action) => {
|
||||
console.log('🚀 ~ trestleReducer ~ state:', state)
|
||||
console.log('🚀 ~ trestleReducer ~ action:', action)
|
||||
switch (action.type) {
|
||||
case 'SET_RAFT_BASE':
|
||||
case 'SET_TRESTLE_MAKER':
|
||||
@ -19,6 +21,7 @@ const trestleReducer = (state, action) => {
|
||||
...action.roof,
|
||||
}
|
||||
case 'SET_INITIALIZE':
|
||||
console.log('SET_INITIALIZE')
|
||||
return {
|
||||
moduleTpCd: action.roof.moduleTpCd ?? '',
|
||||
roofMatlCd: action.roof.roofMatlCd ?? '',
|
||||
@ -82,6 +85,7 @@ export function useModuleTrestle(props) {
|
||||
|
||||
useEffect(() => {
|
||||
if (trestleState) {
|
||||
console.log('🚀 ~ useEffect ~ trestleState:', trestleState)
|
||||
handleSetTrestleList()
|
||||
if (!trestleState.trestleMkrCd) {
|
||||
setConstMthdList([])
|
||||
@ -164,7 +168,7 @@ export function useModuleTrestle(props) {
|
||||
stdSnowLd: trestleState.stdSnowLd ?? '',
|
||||
inclCd: trestleState.inclCd ?? '',
|
||||
raftBaseCd: trestleState.raftBaseCd ?? '',
|
||||
roofPitch: Math.round(trestleState.roofPitch) ?? '',
|
||||
roofPitch: trestleState.roofPitch ?? '',
|
||||
}).then((res) => {
|
||||
if (res?.data) setConstructionList(res.data)
|
||||
})
|
||||
|
||||
@ -296,7 +296,7 @@ export function useRoofAllocationSetting(id) {
|
||||
})
|
||||
}
|
||||
|
||||
return { ...roof, index: idx, raft: roof.raft ? roof.raft : roof.raftBaseCd, raftBaseCd: roof.raft ? roof.raft : roof.raftBaseCd }
|
||||
return { ...roof, index: idx, raft: roof.raft ? roof.raft : roof.raftBaseCd }
|
||||
})
|
||||
|
||||
setBasicSetting((prev) => {
|
||||
@ -308,8 +308,7 @@ export function useRoofAllocationSetting(id) {
|
||||
const selectedRoofMaterial = newRoofList.find((roof) => roof.selected)
|
||||
setSurfaceShapePattern(currentObject, roofDisplay.column, false, selectedRoofMaterial, true)
|
||||
drawDirectionArrow(currentObject)
|
||||
setModuleSelectionData({ ...moduleSelectionData, roofConstructions: newRoofList })
|
||||
// modifyModuleSelectionData()
|
||||
modifyModuleSelectionData()
|
||||
closeAll()
|
||||
basicSettingSave()
|
||||
}
|
||||
@ -431,8 +430,7 @@ export function useRoofAllocationSetting(id) {
|
||||
setSelectedMenu('surface')
|
||||
|
||||
/** 모듈 선택 데이터 초기화 */
|
||||
// modifyModuleSelectionData()
|
||||
setModuleSelectionData({ ...moduleSelectionData, roofConstructions: newRoofList })
|
||||
modifyModuleSelectionData()
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -402,9 +402,3 @@ export const toggleManualSetupModeState = atom({
|
||||
key: 'toggleManualSetupModeState',
|
||||
default: '',
|
||||
})
|
||||
|
||||
export const moduleRowColArrayState = atom({
|
||||
key: 'moduleRowColArrayState',
|
||||
default: [],
|
||||
dangerouslyAllowMutability: true,
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user