diff --git a/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx b/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx
index 1ca8b420..921d5fdb 100644
--- a/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx
+++ b/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx
@@ -48,8 +48,11 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
}, [])
useEffect(() => {
+ console.log('๐ ~ useEffect ~ basicSetting:', currentRoof)
setBasicSettings({
...basicSetting,
+ roofSizeSet: currentRoof.roofSizeSet,
+ roofAngleSet: currentRoof.roofAngleSet,
roofsData: {
roofApply: true,
roofSeq: 0,
@@ -61,12 +64,21 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
roofLayout: currentRoof.layout,
},
})
- }, [basicSetting.roofSizeSet, basicSetting.roofAngleSet, currentRoof])
+ }, [currentRoof])
+
+ const handleRoofSizeSetChange = (value) => {
+ setCurrentRoof({...currentRoof, roofSizeSet: value})
+ }
+
+ const handleRoofAngleSetChange = (value) => {
+ setCurrentRoof({...currentRoof, roofAngleSet: value})
+ }
// Function to update the roofType and corresponding values
const handleRoofTypeChange = (value) => {
const selectedRoofMaterial = roofMaterials.find((roof) => roof.roofMatlCd === value)
- setCurrentRoof({...selectedRoofMaterial, index: 0})
+ console.log('๐ ~ handleRoofTypeChange ~ selectedRoofMaterial:', selectedRoofMaterial)
+ setCurrentRoof({...selectedRoofMaterial, index: 0, roofSizeSet: currentRoof.roofSizeSet, roofAngleSet: currentRoof.roofAngleSet})
}
const changeInput = (value, e) => {
@@ -125,6 +137,8 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
roofHajebichi: currentRoof.hajebichi,
roofGap: currentRoof.raft,
roofLayout: currentRoof.layout,
+ roofSizeSet: currentRoof.roofSizeSet,
+ roofAngleSet: currentRoof.roofAngleSet,
},
})
@@ -167,8 +181,9 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
name="roofSizeSet"
id="ra01"
value="1" // roofSizeSet ๊ฐ์ด '1'์ธ ๊ฒฝ์ฐ
- checked={basicSetting.roofSizeSet == '1'} // ์ ํ ์ฌ๋ถ ํ์ธ
- onChange={(e) => setBasicSettings({ ...basicSetting, roofSizeSet: e.target.value })} // ์ํ ์
๋ฐ์ดํธ
+ checked={currentRoof.roofSizeSet === '1'} // ์ ํ ์ฌ๋ถ ํ์ธ
+ //onChange={(e) => setBasicSettings({ ...basicSetting, roofSizeSet: e.target.value })} // ์ํ ์
๋ฐ์ดํธ
+ onClick={() => handleRoofSizeSetChange(1)}
/>
@@ -178,8 +193,9 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
name="roofSizeSet"
id="ra02"
value="2" // roofSizeSet ๊ฐ์ด '2'์ธ ๊ฒฝ์ฐ
- checked={basicSetting.roofSizeSet == '2'} // ์ ํ ์ฌ๋ถ ํ์ธ
- onChange={(e) => setBasicSettings({ ...basicSetting, roofSizeSet: e.target.value })} // ์ํ ์
๋ฐ์ดํธ
+ checked={currentRoof.roofSizeSet === '2'} // ์ ํ ์ฌ๋ถ ํ์ธ
+ //onChange={(e) => setBasicSettings({ ...basicSetting, roofSizeSet: e.target.value })} // ์ํ ์
๋ฐ์ดํธ
+ onClick={() => handleRoofSizeSetChange(2)}
/>
@@ -189,8 +205,9 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
name="roofSizeSet"
id="ra03"
value="3" // roofSizeSet ๊ฐ์ด '3'์ธ ๊ฒฝ์ฐ
- checked={basicSetting.roofSizeSet == '3'} // ์ ํ ์ฌ๋ถ ํ์ธ
- onChange={(e) => setBasicSettings({ ...basicSetting, roofSizeSet: e.target.value })} // ์ํ ์
๋ฐ์ดํธ
+ checked={currentRoof.roofSizeSet === '3'} // ์ ํ ์ฌ๋ถ ํ์ธ
+ //onChange={(e) => setBasicSettings({ ...basicSetting, roofSizeSet: e.target.value })} // ์ํ ์
๋ฐ์ดํธ
+ onClick={() => handleRoofSizeSetChange(3)}
/>
@@ -207,8 +224,9 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
name="roofAngleSet"
id="ra04"
value="slope" // ์ฒซ ๋ฒ์งธ ๋ผ๋์ค ๋ฒํผ์ ๊ฐ
- checked={basicSetting.roofAngleSet == 'slope'} // ํ์ฌ ์ ํ๋ ๊ฐ์ธ์ง ํ์ธ
- onChange={(e) => setBasicSettings({ ...basicSetting, roofAngleSet: e.target.value })} // ์ํ ์
๋ฐ์ดํธ
+ checked={currentRoof.roofAngleSet === 'slope'} // ํ์ฌ ์ ํ๋ ๊ฐ์ธ์ง ํ์ธ
+ //onChange={(e) => setBasicSettings({ ...basicSetting, roofAngleSet: e.target.value })} // ์ํ ์
๋ฐ์ดํธ
+ onClick={() => handleRoofAngleSetChange('slope')}
/>
@@ -218,8 +236,9 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
name="roofAngleSet"
id="ra05"
value="flat" // ๋ ๋ฒ์งธ ๋ผ๋์ค ๋ฒํผ์ ๊ฐ
- checked={basicSetting.roofAngleSet == 'flat'} // ํ์ฌ ์ ํ๋ ๊ฐ์ธ์ง ํ์ธ
- onChange={(e) => setBasicSettings({ ...basicSetting, roofAngleSet: e.target.value })} // ์ํ ์
๋ฐ์ดํธ
+ checked={currentRoof.roofAngleSet === 'flat'} // ํ์ฌ ์ ํ๋ ๊ฐ์ธ์ง ํ์ธ
+ //onChange={(e) => setBasicSettings({ ...basicSetting, roofAngleSet: e.target.value })} // ์ํ ์
๋ฐ์ดํธ
+ onClick={() => handleRoofAngleSetChange('flat')}
/>
@@ -237,17 +256,17 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
{
return { ...roof, name: globalLocale === 'ko' ? roof.roofMatlNm : roof.roofMatlNmJp }
})}
- value={basicSetting.roofSizeSet == 3 ? null : currentRoof.roofMatlCd}
+ value={currentRoof.roofSizeSet == 3 ? null : currentRoof.roofMatlCd}
onChange={(e) => handleRoofTypeChange(e.roofMatlCd)}
sourceKey="id"
targetKey="id"
showKey="name"
- disabled={basicSetting.roofSizeSet == 3}
+ disabled={currentRoof.roofSizeSet == 3}
/>
{/*
- {basicSetting && ['R', 'C'].includes(currentRoof.widAuth) && (
+ {currentRoof && ['R', 'C'].includes(currentRoof.widAuth) && (
W
@@ -279,7 +298,7 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
value={parseInt(currentRoof.width)}
onChange={(e) => onlyNumberInputChange(e, changeInput)}
readOnly={currentRoof.widAuth === 'R'}
- disabled={basicSetting.roofSizeSet == 3}
+ disabled={currentRoof.roofSizeSet == 3}
/>
{/*
@@ -292,7 +311,7 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
*/}
)}
- {basicSetting && ['R', 'C'].includes(currentRoof.lenAuth) && (
+ {currentRoof && ['R', 'C'].includes(currentRoof.lenAuth) && (
L
@@ -304,7 +323,7 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
value={parseInt(currentRoof.length)}
onChange={(e) => onlyNumberInputChange(e, changeInput)}
readOnly={currentRoof.lenAuth === 'R'}
- disabled={basicSetting.roofSizeSet == 3}
+ disabled={currentRoof.roofSizeSet == 3}
/>
{/*
@@ -317,7 +336,7 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
*/}
)}
- {basicSetting && ['C', 'R'].includes(currentRoof.raftAuth) && (
+ {currentRoof && ['C', 'R'].includes(currentRoof.raftAuth) && (
{getMessage('modal.placement.initial.setting.rafter')}
{raftCodes.length > 0 && (
@@ -331,7 +350,7 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
sourceKey="clCode"
targetKey={currentRoof.raft ? 'raft' : 'raftBaseCd'}
showKey="clCodeNm"
- disabled={basicSetting.roofSizeSet == 3}
+ disabled={currentRoof.roofSizeSet == 3}
/>
{/*
)}
- {basicSetting && ['C', 'R'].includes(currentRoof.roofPchAuth) && (
+ {currentRoof && ['C', 'R'].includes(currentRoof.roofPchAuth) && (
{getMessage('hajebichi')}
@@ -358,7 +377,7 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
value={parseInt(currentRoof.hajebichi)}
onChange={(e) => onlyNumberInputChange(e, changeInput)}
readOnly={currentRoof.roofPchAuth === 'R'}
- disabled={basicSetting.roofSizeSet == 3}
+ disabled={currentRoof.roofSizeSet == 3}
/>
diff --git a/src/hooks/option/useCanvasSetting.js b/src/hooks/option/useCanvasSetting.js
index c4ac79c9..dc2488f2 100644
--- a/src/hooks/option/useCanvasSetting.js
+++ b/src/hooks/option/useCanvasSetting.js
@@ -274,7 +274,7 @@ export function useCanvasSetting() {
// ๊ธฐ๋ณธ์ค์ (PlacementShapeSetting) ์กฐํ ๋ฐ ์ด๊ธฐํ
const fetchBasicSettings = async () => {
try {
- await get({ url: `/api/canvas-management/canvas-basic-settings/by-object/1/${correntObjectNo}` }).then((res) => {
+ await get({ url: `/api/canvas-management/canvas-basic-settings/by-object/${correntObjectNo}` }).then((res) => {
let roofsRow = {}
let roofsArray = {}
@@ -320,15 +320,6 @@ export function useCanvasSetting() {
]
}
- // ๋๋จธ์ง ๋ฐ์ดํฐ์ ํจ๊ป 'roofs' ๋ฐฐ์ด์ patternData์ ๋ฃ์
- const patternData = {
- roofSizeSet: roofsRow[0].roofSizeSet,
- roofAngleSet: roofsRow[0].roofAngleSet,
- roofs: roofsArray, // ๋ง๋ค์ด์ง roofs ๋ฐฐ์ด
- }
-
- //console.log('fetchBasicSettings patternData', patternData)
-
// ๋ฐ์ดํฐ ์ค์
const addRoofs = []
roofMaterials?.map((material) => {
@@ -340,6 +331,8 @@ export function useCanvasSetting() {
, hajebichi: roofsArray[0].roofHajebichi
, raft: roofsArray[0].roofGap
, layout: roofsArray[0].roofLayout
+ , roofSizeSet: roofsRow[0].roofSizeSet
+ , roofAngleSet: roofsRow[0].roofAngleSet
})
setAddedRoofs(addRoofs)
@@ -378,6 +371,8 @@ export function useCanvasSetting() {
roofHajebichi: basicSetting.roofsData.roofHajebichi === null || basicSetting.roofsData.roofHajebichi === undefined ? 0 : basicSetting.roofsData.roofHajebichi,
roofGap: basicSetting.roofsData.roofGap === null || basicSetting.roofsData.roofGap === undefined ? 'HEI_455' : basicSetting.roofsData.roofGap,
roofLayout: basicSetting.roofsData.roofLayout === null || basicSetting.roofsData.roofLayout === undefined ? 'P' : basicSetting.roofsData.roofLayout,
+ roofPitch: 4,
+ roofAngle: 21.8,
},
],
}
diff --git a/src/hooks/roofcover/useRoofAllocationSetting.js b/src/hooks/roofcover/useRoofAllocationSetting.js
index 3e999380..f0884969 100644
--- a/src/hooks/roofcover/useRoofAllocationSetting.js
+++ b/src/hooks/roofcover/useRoofAllocationSetting.js
@@ -90,18 +90,13 @@ export function useRoofAllocationSetting(id) {
closePopup(id)
}
- // console.log('๐ ~ useEffect ~ roofMaterials >>>>>>>>>>>>> :', roofMaterials)
- // console.log('๐ ~ useEffect ~ basicSetting >>>>>>>>>>>>> :', basicSetting)
- // console.log('๐ ~ useEffect ~ roofList >>>>>>>>>>>>> :', roofList)
- // console.log('๐ ~ useEffect ~ currentRoofList >>>>>>>>>>>>> :', currentRoofList)
-
fetchBasicSettings()
}, [])
- // ์กฐํ ๋ฐ ์ด๊ธฐํ
+ // ์ง๋ถ๋ฉด ํ ๋น ์กฐํ ๋ฐ ์ด๊ธฐํ
const fetchBasicSettings = async () => {
try {
- await get({ url: `/api/canvas-management/canvas-basic-settings/by-object/1/${correntObjectNo}` }).then((res) => {
+ await get({ url: `/api/canvas-management/canvas-basic-settings/by-object/${correntObjectNo}` }).then((res) => {
console.log('๐ ~ useRoofAllocationSetting ~ fetchBasicSettings ~ res >>>>>>>>>>>>>>>>>>>>> :', res)
let roofsArray = {}
@@ -116,6 +111,8 @@ export function useRoofAllocationSetting(id) {
roofHajebichi: item.roofHajebichi,
roofGap: item.roofGap,
roofLayout: item.roofLayout,
+ roofPitch: item.roofPitch,
+ roofAngle: item.roofAngle,
}
})
} else {
@@ -129,15 +126,12 @@ export function useRoofAllocationSetting(id) {
roofHajebichi: 0,
roofGap: 'HEI_455',
roofLayout: 'P',
+ roofPitch: 4,
+ roofAngle: 21.8,
},
]
}
- // ๋๋จธ์ง ๋ฐ์ดํฐ์ ํจ๊ป 'roofs' ๋ฐฐ์ด์ patternData์ ๋ฃ์
- const patternData = {
- roofs: roofsArray, // ๋ง๋ค์ด์ง roofs ๋ฐฐ์ด
- }
-
console.log('fetchBasicSettings roofsArray', roofsArray)
// ๋ฐ์ดํฐ ์ค์
@@ -155,6 +149,8 @@ export function useRoofAllocationSetting(id) {
hajebichi: roofsArray[i].roofHajebichi,
raft: roofsArray[i].roofGap,
layout: roofsArray[i].roofLayout,
+ pitch: roofsArray[i].roofPitch,
+ angle: roofsArray[i].roofAngle,
})
setCurrentRoofList(selectRoofs)
}
@@ -167,28 +163,30 @@ export function useRoofAllocationSetting(id) {
}
}
- // ์ ์ฅ
+ // ์ง๋ถ๋ฉด ํ ๋น ์ ์ฅ
const basicSettingSave = async () => {
const patternData = {
objectNo: correntObjectNo,
roofSizeSet: basicSetting.roofSizeSet,
roofAngleSet: basicSetting.roofAngleSet,
- roofMaterialsAddList: currentRoofList.map((item) => ({
+ roofMaterialsAddList: currentRoofList.map((item, index) => ({
roofApply: item.selected === null || item.selected === undefined ? 'true' : item.selected,
- roofSeq: item.index === null || item.index === undefined ? 0 : item.index,
+ roofSeq: index,
roofMatlCd: item.roofMatlCd === null || item.roofMatlCd === undefined ? 'ROOF_ID_WA_53A' : item.roofMatlCd,
roofWidth: item.width === null || item.width === undefined ? 0 : item.width,
roofHeight: item.length === null || item.length === undefined ? 0 : item.length,
roofHajebichi: item.hajebichi === null || item.hajebichi === undefined ? 0 : item.hajebichi,
roofGap: item.raft === null || item.raft === undefined ? 'HEI_455' : item.raft,
roofLayout: item.layout === null || item.layout === undefined ? 'P' : item.layout,
+ roofPitch: item.pitch === null || item.pitch === undefined ? 4 : item.pitch,
+ roofAngle: item.angle === null || item.angle === undefined ? 21.8 : item.angle,
})),
}
console.log('๐ ~ basicSettingSave ~ patternData >>>>>>>>>>>>> :', patternData)
// HTTP POST ์์ฒญ ๋ณด๋ด๊ธฐ
- await post({ url: `/api/canvas-management/canvas-basic-settings`, data: patternData })
+ await post({ url: `/api/canvas-management/roof-allocation-settings`, data: patternData })
.then((res) => {
swalFire({ text: getMessage(res.returnMessage) })