Compare commits

..

No commits in common. "d524b33f5694417f59c3068934ecfd666bbda7be" and "6c6e5845ef0341b4125f19d16837ddcddaefbd86" have entirely different histories.

8 changed files with 43 additions and 70 deletions

View File

@ -91,14 +91,14 @@ export default function BasicSetting({ id, pos = { x: 50, y: 230 } }) {
useEffect(() => { useEffect(() => {
if (roofsStore && addedRoofs) { if (roofsStore && addedRoofs) {
console.log('🚀 ~ useEffect ~ roofsStore, addedRoofs:', roofsStore, addedRoofs) console.log('🚀 ~ useEffect ~ roofsStore, addedRoofs:', roofsStore, addedRoofs)
// setRoofs( setRoofs(
// addedRoofs.map((roof, index) => { addedRoofs.map((roof, index) => {
// return { return {
// ...roof, ...roof,
// ...roofsStore[index]?.addRoof, ...roofsStore[index].addRoof,
// } }
// }), }),
// ) )
setModuleSelectionData({ setModuleSelectionData({
...moduleSelectionData, ...moduleSelectionData,

View File

@ -321,7 +321,7 @@ export const Orientation = forwardRef((props, ref) => {
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{Array.from({ length: 3 }).map((_, index) => { {Array.from({ length: 2 }).map((_, index) => {
return selectedModules && selectedModules?.itemList && selectedModules?.itemList?.length >= index + 1 ? ( return selectedModules && selectedModules?.itemList && selectedModules?.itemList?.length >= index + 1 ? (
<tr key={index}> <tr key={index}>
<td> <td>

View File

@ -5,7 +5,6 @@ import {
checkedModuleState, checkedModuleState,
isManualModuleLayoutSetupState, isManualModuleLayoutSetupState,
isManualModuleSetupState, isManualModuleSetupState,
moduleRowColArrayState,
moduleSetupOptionState, moduleSetupOptionState,
toggleManualSetupModeState, toggleManualSetupModeState,
} from '@/store/canvasAtom' } from '@/store/canvasAtom'
@ -37,7 +36,6 @@ const Placement = forwardRef((props, refs) => {
const resetModuleSetupOption = useResetRecoilState(moduleSetupOptionState) const resetModuleSetupOption = useResetRecoilState(moduleSetupOptionState)
const [colspan, setColspan] = useState(1) const [colspan, setColspan] = useState(1)
const [moduleRowColArray, setModuleRowColArray] = useRecoilState(moduleRowColArrayState)
// //
useEffect(() => { useEffect(() => {
@ -64,10 +62,6 @@ const Placement = forwardRef((props, refs) => {
} }
}, []) }, [])
useEffect(() => {
console.log('moduleRowColArray', moduleRowColArray)
}, [moduleRowColArray])
// //
useEffect(() => { useEffect(() => {
if (isObjectNotEmpty(moduleSelectionData)) { if (isObjectNotEmpty(moduleSelectionData)) {
@ -348,18 +342,18 @@ const Placement = forwardRef((props, refs) => {
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{moduleSelectionData.roofConstructions.map((item, index) => ( {moduleSelectionData.roofConstructions.map((item) => (
<tr> <tr>
<td> <td>
<div className="color-wrap"> <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> <span className="name">{item.addRoof.roofMatlNmJp}</span>
</div> </div>
</td> </td>
{moduleRowColArray[index]?.map((item) => ( {selectedModules.itemList.map((item) => (
<> <>
<td className="al-c">{item.moduleMaxRows}</td> <td className="al-c">7</td>
{colspan > 1 && <td className="al-c">{item.mixModuleMaxRows}</td>} {colspan > 1 && <td className="al-c">5</td>}
</> </>
))} ))}
</tr> </tr>

View File

@ -45,7 +45,7 @@ const Trestle = forwardRef((props, ref) => {
const selectedModules = useRecoilValue(selectedModuleState) // const selectedModules = useRecoilValue(selectedModuleState) //
// const [moduleSelectionData, setModuleSelectionData] = useRecoilState(moduleSelectionDataState) // const [moduleSelectionData, setModuleSelectionData] = useRecoilState(moduleSelectionDataState)
const [lengthBase, setLengthBase] = useState(0) const [lengthBase, setLengthBase] = useState(0)
const [hajebichi, setHajebichi] = useState(trestleState?.roofPitch ?? 0) const [hajebichi, setHajebichi] = useState(0)
const [selectedRaftBase, setSelectedRaftBase] = useState(null) const [selectedRaftBase, setSelectedRaftBase] = useState(null)
const [selectedTrestle, setSelectedTrestle] = useState(null) const [selectedTrestle, setSelectedTrestle] = useState(null)
const [selectedConstMthd, setSelectedConstMthd] = useState(null) const [selectedConstMthd, setSelectedConstMthd] = useState(null)
@ -196,12 +196,10 @@ const Trestle = forwardRef((props, ref) => {
stdWindSpeed: managementState?.standardWindSpeedId ?? '', stdWindSpeed: managementState?.standardWindSpeedId ?? '',
stdSnowLd: +managementState?.verticalSnowCover ?? '', stdSnowLd: +managementState?.verticalSnowCover ?? '',
inclCd: selectedRoof?.pitch.toString() ?? 0, inclCd: selectedRoof?.pitch.toString() ?? 0,
// roofPitch: Math.round(selectedRoof?.roofPchBase ?? 0), roofPitch: Math.round(selectedRoof?.roofPchBase ?? 0),
roofPitch: hajebichi ?? 0,
constTp: constructionList[index].constTp, constTp: constructionList[index].constTp,
mixMatlNo: selectedModules.mixMatlNo, mixMatlNo: selectedModules.mixMatlNo,
// workingWidth: selectedRoof?.length.toString() ?? '', workingWidth: selectedRoof?.length.toString() ?? '',
workingWidth: lengthBase ?? '',
// snowGdPossYn: constructionList[index].snowGdPossYn, // snowGdPossYn: constructionList[index].snowGdPossYn,
// cvrYn: constructionList[index].cvrYn, // cvrYn: constructionList[index].cvrYn,
}, },
@ -256,24 +254,25 @@ const Trestle = forwardRef((props, ref) => {
} }
}) })
console.log('newAddedRoofs', newAddedRoofs)
if (result) { if (result) {
setRoofs(newAddedRoofs) setRoofs(newAddedRoofs)
setModuleSelectionData({ setModuleSelectionData({
...moduleSelectionData, ...moduleSelectionData,
roofConstructions: newAddedRoofs.map((roof, index) => { roofConstructions: newAddedRoofs.map((roof, index) => {
return { return {
roofIndex: index,
addRoof: { addRoof: {
...moduleSelectionData.roofConstructions[index]?.addRoof,
...roof.addRoof, ...roof.addRoof,
...moduleSelectionData.roofConstructions[index].addRoof,
}, },
trestle: { trestle: {
...roof.trestle, ...roof.trestle,
...moduleSelectionData.roofConstructions[index]?.trestle, ...moduleSelectionData.roofConstructions[index].trestle,
}, },
construction: { construction: {
...moduleSelectionData.roofConstructions[index]?.construction,
...roof.construction, ...roof.construction,
...moduleSelectionData.roofConstructions[index].construction,
}, },
trestleDetail: { trestleDetail: {
...roof.trestleDetail, ...roof.trestleDetail,
@ -339,7 +338,7 @@ const Trestle = forwardRef((props, ref) => {
<input <input
type="text" type="text"
className="input-origin block" className="input-origin block"
value={lengthBase} value={trestleState?.lengthBase}
onChange={(e) => setLengthBase(e.target.value)} onChange={(e) => setLengthBase(e.target.value)}
disabled={selectedRoof.lenAuth === 'R'} disabled={selectedRoof.lenAuth === 'R'}
/> />
@ -380,7 +379,7 @@ const Trestle = forwardRef((props, ref) => {
type="text" type="text"
className="input-origin block" className="input-origin block"
disabled={selectedRoof.roofPchAuth === 'R'} disabled={selectedRoof.roofPchAuth === 'R'}
onChange={(e) => setHajebichi(e.target.value)} onChange={(e) => handleHajebichiAndLength(e, 'hajebichi')}
value={hajebichi} value={hajebichi}
/> />
</div> </div>

View File

@ -10,7 +10,6 @@ import {
isManualModuleSetupState, isManualModuleSetupState,
moduleSetupOptionState, moduleSetupOptionState,
toggleManualSetupModeState, toggleManualSetupModeState,
moduleRowColArrayState,
} from '@/store/canvasAtom' } from '@/store/canvasAtom'
import { rectToPolygon, polygonToTurfPolygon, calculateVisibleModuleHeight, getDegreeByChon, toFixedWithoutRounding } from '@/util/canvas-util' import { rectToPolygon, polygonToTurfPolygon, calculateVisibleModuleHeight, getDegreeByChon, toFixedWithoutRounding } from '@/util/canvas-util'
@ -62,7 +61,6 @@ export function useModuleBasicSetting(tabNum) {
const { drawDirectionArrow } = usePolygon() const { drawDirectionArrow } = usePolygon()
const moduleSetupOption = useRecoilValue(moduleSetupOptionState) const moduleSetupOption = useRecoilValue(moduleSetupOptionState)
const setManualSetupMode = useSetRecoilState(toggleManualSetupModeState) const setManualSetupMode = useSetRecoilState(toggleManualSetupModeState)
const [moduleRowColArray, setModuleRowColArray] = useRecoilState(moduleRowColArrayState)
useEffect(() => { useEffect(() => {
return () => { return () => {
@ -83,8 +81,6 @@ export function useModuleBasicSetting(tabNum) {
//모듈 선택에서 선택된 값들 넘어옴 //모듈 선택에서 선택된 값들 넘어옴
const makeModuleInitArea = () => { const makeModuleInitArea = () => {
console.log('moduleSelectionData', moduleSelectionData)
if (isObjectNotEmpty(moduleSelectionData) && tabNum === 3) { if (isObjectNotEmpty(moduleSelectionData) && tabNum === 3) {
if (canvasSetting.roofSizeSet !== '3') { if (canvasSetting.roofSizeSet !== '3') {
const common = moduleSelectionData.common const common = moduleSelectionData.common
@ -94,11 +90,11 @@ export function useModuleBasicSetting(tabNum) {
const listParams = roofConstructions.map((item) => { const listParams = roofConstructions.map((item) => {
return { return {
...common, ...common,
roofMatlCd: item.addRoof.roofMatlCd, roofMatlCd: item.trestle.roofMatlCd,
trestleMkrCd: item.addRoof.trestleMkrCd, trestleMkrCd: item.trestle.trestleMkrCd,
constMthdCd: item.addRoof.constMthdCd, constMthdCd: item.trestle.constMthdCd,
roofBaseCd: item.addRoof.roofBaseCd, roofBaseCd: item.trestle.roofBaseCd,
constTp: item.addRoof.constTp, constTp: item.construction.constTp,
mixMatlNo: selectedModules.mixMatlNo, mixMatlNo: selectedModules.mixMatlNo,
roofPitch: item.addRoof.hajebichi ? item.addRoof.hajebichi : 0, roofPitch: item.addRoof.hajebichi ? item.addRoof.hajebichi : 0,
inclCd: String(item.addRoof.pitch), inclCd: String(item.addRoof.pitch),
@ -144,7 +140,6 @@ export function useModuleBasicSetting(tabNum) {
//가대 상세 데이터 들어오면 실행 //가대 상세 데이터 들어오면 실행
useEffect(() => { useEffect(() => {
if (trestleDetailList.length > 0) { if (trestleDetailList.length > 0) {
let rowColArray = []
//지붕을 가져옴 //지붕을 가져옴
canvas canvas
.getObjects() .getObjects()
@ -152,37 +147,26 @@ export function useModuleBasicSetting(tabNum) {
.forEach((roof) => { .forEach((roof) => {
if (!roof.roofMaterial) return if (!roof.roofMaterial) return
const roofIndex = roof.roofMaterial.index //지붕의 지붕재의 순번 const roofIndex = roof.roofMaterial.index //지붕의 지붕재의 순번
trestleDetailList.forEach((detail) => { trestleDetailList.forEach((detail) => {
if (detail.data !== null) { if (detail.data !== null) {
if (Number(detail.data.roofIndex) === roofIndex) { if (Number(detail.data.roofIndex) === roofIndex) {
//roof에 상세 데이터 추가 //roof에 상세 데이터 추가
roof.set({ roof.set({
trestleDetail: detail.data, trestleDetail: detail.data,
stroke: roofOutlineColor(roofIndex), stroke: roofOutlineColor(roofIndex),
strokeWidth: 7, strokeWidth: 7,
}) })
const offsetObjects = moduleSelectionData.roofConstructions.find((item) => item.addRoof.index === roofIndex)
roof.lines.forEach((line) => { 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) 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]) }, [trestleDetailList])
@ -201,12 +185,12 @@ export function useModuleBasicSetting(tabNum) {
const getOffset = (data, type) => { const getOffset = (data, type) => {
switch (type) { switch (type) {
case LINE_TYPE.WALLLINE.EAVES: case LINE_TYPE.WALLLINE.EAVES:
return data.eavesMargin / 10 return data.eaveIntvl / 10
case LINE_TYPE.WALLLINE.GABLE: case LINE_TYPE.WALLLINE.GABLE:
return data.kerabaMargin / 10 return data.kerabaIntvl / 10
case LINE_TYPE.SUBLINE.RIDGE: case LINE_TYPE.SUBLINE.RIDGE:
case LINE_TYPE.WALLLINE.SHED: case LINE_TYPE.WALLLINE.SHED:
return data.ridgeMargin / 10 return data.ridgeIntvl / 10
default: default:
return 200 / 10 return 200 / 10
} }

View File

@ -8,6 +8,8 @@ import { GlobalDataContext } from '@/app/GlobalDataProvider'
const RAFT_BASE_CODE = '203800' const RAFT_BASE_CODE = '203800'
const trestleReducer = (state, action) => { const trestleReducer = (state, action) => {
console.log('🚀 ~ trestleReducer ~ state:', state)
console.log('🚀 ~ trestleReducer ~ action:', action)
switch (action.type) { switch (action.type) {
case 'SET_RAFT_BASE': case 'SET_RAFT_BASE':
case 'SET_TRESTLE_MAKER': case 'SET_TRESTLE_MAKER':
@ -19,6 +21,7 @@ const trestleReducer = (state, action) => {
...action.roof, ...action.roof,
} }
case 'SET_INITIALIZE': case 'SET_INITIALIZE':
console.log('SET_INITIALIZE')
return { return {
moduleTpCd: action.roof.moduleTpCd ?? '', moduleTpCd: action.roof.moduleTpCd ?? '',
roofMatlCd: action.roof.roofMatlCd ?? '', roofMatlCd: action.roof.roofMatlCd ?? '',
@ -82,6 +85,7 @@ export function useModuleTrestle(props) {
useEffect(() => { useEffect(() => {
if (trestleState) { if (trestleState) {
console.log('🚀 ~ useEffect ~ trestleState:', trestleState)
handleSetTrestleList() handleSetTrestleList()
if (!trestleState.trestleMkrCd) { if (!trestleState.trestleMkrCd) {
setConstMthdList([]) setConstMthdList([])
@ -164,7 +168,7 @@ export function useModuleTrestle(props) {
stdSnowLd: trestleState.stdSnowLd ?? '', stdSnowLd: trestleState.stdSnowLd ?? '',
inclCd: trestleState.inclCd ?? '', inclCd: trestleState.inclCd ?? '',
raftBaseCd: trestleState.raftBaseCd ?? '', raftBaseCd: trestleState.raftBaseCd ?? '',
roofPitch: Math.round(trestleState.roofPitch) ?? '', roofPitch: trestleState.roofPitch ?? '',
}).then((res) => { }).then((res) => {
if (res?.data) setConstructionList(res.data) if (res?.data) setConstructionList(res.data)
}) })

View File

@ -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) => { setBasicSetting((prev) => {
@ -308,8 +308,7 @@ export function useRoofAllocationSetting(id) {
const selectedRoofMaterial = newRoofList.find((roof) => roof.selected) const selectedRoofMaterial = newRoofList.find((roof) => roof.selected)
setSurfaceShapePattern(currentObject, roofDisplay.column, false, selectedRoofMaterial, true) setSurfaceShapePattern(currentObject, roofDisplay.column, false, selectedRoofMaterial, true)
drawDirectionArrow(currentObject) drawDirectionArrow(currentObject)
setModuleSelectionData({ ...moduleSelectionData, roofConstructions: newRoofList }) modifyModuleSelectionData()
// modifyModuleSelectionData()
closeAll() closeAll()
basicSettingSave() basicSettingSave()
} }
@ -431,8 +430,7 @@ export function useRoofAllocationSetting(id) {
setSelectedMenu('surface') setSelectedMenu('surface')
/** 모듈 선택 데이터 초기화 */ /** 모듈 선택 데이터 초기화 */
// modifyModuleSelectionData() modifyModuleSelectionData()
setModuleSelectionData({ ...moduleSelectionData, roofConstructions: newRoofList })
} }
/** /**

View File

@ -402,9 +402,3 @@ export const toggleManualSetupModeState = atom({
key: 'toggleManualSetupModeState', key: 'toggleManualSetupModeState',
default: '', default: '',
}) })
export const moduleRowColArrayState = atom({
key: 'moduleRowColArrayState',
default: [],
dangerouslyAllowMutability: true,
})