지붕덮개 - 지붕면 할당 list 버그 작업중
This commit is contained in:
parent
f5ee816b19
commit
89102719a9
@ -123,6 +123,13 @@ export default function CanvasMenu(props) {
|
|||||||
if (pathname !== '/floor-plan') router.push('/floor-plan')
|
if (pathname !== '/floor-plan') router.push('/floor-plan')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
console.log('addedRoofs', addedRoofs)
|
||||||
|
}, [addedRoofs])
|
||||||
|
useEffect(() => {
|
||||||
|
console.log('selectedRoofMaterial', selectedRoofMaterial)
|
||||||
|
}, [selectedRoofMaterial])
|
||||||
|
|
||||||
const changeSelectedRoofMaterial = (e) => {
|
const changeSelectedRoofMaterial = (e) => {
|
||||||
setBasicSetting({ ...basicSetting, selectedRoofMaterial: e })
|
setBasicSetting({ ...basicSetting, selectedRoofMaterial: e })
|
||||||
}
|
}
|
||||||
@ -307,14 +314,16 @@ export default function CanvasMenu(props) {
|
|||||||
<button className={`btn02 ${commonUtils.dimension ? 'active' : ''} `} onClick={() => commonFunctions('dimension')}></button>
|
<button className={`btn02 ${commonUtils.dimension ? 'active' : ''} `} onClick={() => commonFunctions('dimension')}></button>
|
||||||
<button className={`btn03 ${commonUtils.distance ? 'active' : ''} `} onClick={() => commonFunctions('distance')}></button>
|
<button className={`btn03 ${commonUtils.distance ? 'active' : ''} `} onClick={() => commonFunctions('distance')}></button>
|
||||||
</div>
|
</div>
|
||||||
{addedRoofs.length > 0 && (
|
{isObjectNotEmpty(selectedRoofMaterial) && addedRoofs.length > 0 && (
|
||||||
<div className="select-box">
|
<div className="select-box">
|
||||||
{
|
{
|
||||||
<QSelectBox
|
<QSelectBox
|
||||||
title={selectedRoofMaterial?.roofMatlNm}
|
|
||||||
showKey={'roofMatlNm'}
|
showKey={'roofMatlNm'}
|
||||||
options={addedRoofs}
|
options={addedRoofs}
|
||||||
|
value={selectedRoofMaterial}
|
||||||
onChange={changeSelectedRoofMaterial}
|
onChange={changeSelectedRoofMaterial}
|
||||||
|
sourceKey={'index'}
|
||||||
|
targetKey={'index'}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -47,6 +47,7 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
|
|||||||
fetchBasicSettings()
|
fetchBasicSettings()
|
||||||
const raftCodeList = findCommonCode('203800')
|
const raftCodeList = findCommonCode('203800')
|
||||||
setRaftCodes(raftCodeList)
|
setRaftCodes(raftCodeList)
|
||||||
|
console.log('raftCodeList', raftCodeList)
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -78,9 +79,8 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleRafterChange = (value) => {
|
const handleRafterChange = (value) => {
|
||||||
console.log('🚀 ~ handleRafterChange ~ value:', value)
|
|
||||||
const selectedRafter = raftCodes.find((raft) => raft.clCode === value)
|
const selectedRafter = raftCodes.find((raft) => raft.clCode === value)
|
||||||
setCurrentRoofMaterial({ ...currentRoofMaterial, raft: selectedRafter })
|
setCurrentRoofMaterial({ ...currentRoofMaterial, raft: selectedRafter.clCode })
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleSaveBtn = () => {
|
const handleSaveBtn = () => {
|
||||||
@ -93,12 +93,12 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
|
|||||||
// raft: roofRef.rafter.current?.value,
|
// raft: roofRef.rafter.current?.value,
|
||||||
selected: true,
|
selected: true,
|
||||||
layout: roofLayout,
|
layout: roofLayout,
|
||||||
|
index: 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
const newAddedRoofs = [...addedRoofs]
|
const newAddedRoofs = [...addedRoofs]
|
||||||
if (addedRoofs.length === 1) {
|
if (addedRoofs.length === 1) {
|
||||||
newAddedRoofs[0] = roofInfo
|
newAddedRoofs[0] = { ...roofInfo }
|
||||||
|
|
||||||
setAddedRoofs(newAddedRoofs)
|
setAddedRoofs(newAddedRoofs)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,6 +244,9 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
|
|||||||
})}
|
})}
|
||||||
value={currentRoofMaterial}
|
value={currentRoofMaterial}
|
||||||
onChange={(e) => handleRoofTypeChange(e.roofMatlCd)}
|
onChange={(e) => handleRoofTypeChange(e.roofMatlCd)}
|
||||||
|
sourceKey="id"
|
||||||
|
targetKey="id"
|
||||||
|
showKey="name"
|
||||||
/>
|
/>
|
||||||
{/* <select
|
{/* <select
|
||||||
className="select-light dark"
|
className="select-light dark"
|
||||||
@ -312,16 +315,17 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
|
|||||||
{currentRoofMaterial && ['C', 'R'].includes(currentRoofMaterial.raftAuth) && (
|
{currentRoofMaterial && ['C', 'R'].includes(currentRoofMaterial.raftAuth) && (
|
||||||
<div className="flex-ment">
|
<div className="flex-ment">
|
||||||
<span>{getMessage('modal.placement.initial.setting.rafter')}</span>
|
<span>{getMessage('modal.placement.initial.setting.rafter')}</span>
|
||||||
<div className="select-wrap" style={{ width: '160px' }}>
|
{raftCodes.length > 0 && (
|
||||||
<QSelectBox
|
<div className="select-wrap" style={{ width: '160px' }}>
|
||||||
ref={roofRef.rafter}
|
<QSelectBox
|
||||||
options={raftCodes.map((raft, index) => {
|
options={raftCodes}
|
||||||
return { ...raft, name: globalLocale === 'ko' ? raft.clCodeNm : raft.clCodeNmJp }
|
value={currentRoofMaterial}
|
||||||
})}
|
onChange={(e) => handleRafterChange(e.clCode)}
|
||||||
value={raftCodes.find((r) => r.clCode === currentRoofMaterial.raftBaseCd)}
|
sourceKey="clCode"
|
||||||
onChange={(e) => handleRafterChange(e.clCode)}
|
targetKey={currentRoofMaterial.raft ? 'raft' : 'raftBaseCd'}
|
||||||
/>
|
showKey="clCodeNm"
|
||||||
{/* <select className="select-light dark" name="roofGap" ref={roofRef.rafter}>
|
/>
|
||||||
|
{/* <select className="select-light dark" name="roofGap" ref={roofRef.rafter}>
|
||||||
{raftCodes.map((raft, index) => {
|
{raftCodes.map((raft, index) => {
|
||||||
return (
|
return (
|
||||||
<option key={index} value={raft.clCode} selected={currentRoofMaterial.raft === raft.clCode}>
|
<option key={index} value={raft.clCode} selected={currentRoofMaterial.raft === raft.clCode}>
|
||||||
@ -330,7 +334,8 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
|
|||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
</select> */}
|
</select> */}
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{currentRoofMaterial && ['C', 'R'].includes(currentRoofMaterial.roofPchAuth) && (
|
{currentRoofMaterial && ['C', 'R'].includes(currentRoofMaterial.roofPchAuth) && (
|
||||||
|
|||||||
@ -51,13 +51,15 @@ export default function RoofAllocationSetting(props) {
|
|||||||
<span>{getMessage('modal.roof.alloc.select.roof.material')}</span>
|
<span>{getMessage('modal.roof.alloc.select.roof.material')}</span>
|
||||||
<div className="grid-select">
|
<div className="grid-select">
|
||||||
<QSelectBox
|
<QSelectBox
|
||||||
title={roofMaterials[0]?.name}
|
|
||||||
options={roofMaterials}
|
options={roofMaterials}
|
||||||
value={roofMaterials[0]}
|
value={roofMaterials[0]}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
// const selected = roofMaterials.find((roofMaterial) => roofMaterial.roofMatlCd === e.id)
|
// const selected = roofMaterials.find((roofMaterial) => roofMaterial.roofMatlCd === e.id)
|
||||||
setCurrentRoofMaterial(e)
|
setCurrentRoofMaterial(e)
|
||||||
}}
|
}}
|
||||||
|
showKey={'roofMatlNm'}
|
||||||
|
sourceKey={'roofMatlCd'}
|
||||||
|
targetKey={'roofMatlCd'}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
@ -89,7 +91,10 @@ export default function RoofAllocationSetting(props) {
|
|||||||
<div className="grid-select" style={{ width: '248px' }}>
|
<div className="grid-select" style={{ width: '248px' }}>
|
||||||
<QSelectBox
|
<QSelectBox
|
||||||
options={roofMaterials}
|
options={roofMaterials}
|
||||||
title={roofMaterials.find((r) => r.id === roof.id).name}
|
value={roof}
|
||||||
|
showKey={'roofMatlNm'}
|
||||||
|
sourceKey={'roofMatlCd'}
|
||||||
|
targetKey={'roofMatlCd'}
|
||||||
onChange={(e) => handleChangeRoofMaterial(e, index)}
|
onChange={(e) => handleChangeRoofMaterial(e, index)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -123,9 +128,17 @@ export default function RoofAllocationSetting(props) {
|
|||||||
<div className="block-box">
|
<div className="block-box">
|
||||||
<div className="flex-ment">
|
<div className="flex-ment">
|
||||||
<span>{getMessage('modal.placement.initial.setting.rafter')}</span>
|
<span>{getMessage('modal.placement.initial.setting.rafter')}</span>
|
||||||
<div className="grid-select" style={{ width: '160px' }}>
|
{raftCodes.length > 0 && (
|
||||||
<QSelectBox options={raftCodes} value={raftCodes.find((r) => r.clCode === roof.raftBaseCd)} />
|
<div className="grid-select" style={{ width: '160px' }}>
|
||||||
</div>
|
<QSelectBox
|
||||||
|
options={raftCodes}
|
||||||
|
value={roof}
|
||||||
|
showKey={'clCodeNm'}
|
||||||
|
sourceKey={'clCode'}
|
||||||
|
targetKey={roof.raft ? 'raft' : 'raftBaseCd'}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@ -137,6 +137,7 @@ export function useCanvasSetting() {
|
|||||||
id: item.roofMatlCd,
|
id: item.roofMatlCd,
|
||||||
name: item.roofMatlNm,
|
name: item.roofMatlNm,
|
||||||
selected: idx === 0,
|
selected: idx === 0,
|
||||||
|
index: idx,
|
||||||
nameJp: item.roofMatlNmJp,
|
nameJp: item.roofMatlNmJp,
|
||||||
length: item.lenBase && parseInt(item.lenBase),
|
length: item.lenBase && parseInt(item.lenBase),
|
||||||
width: item.widBase && parseInt(item.widBase),
|
width: item.widBase && parseInt(item.widBase),
|
||||||
@ -149,10 +150,10 @@ export function useCanvasSetting() {
|
|||||||
|
|
||||||
if (addedRoofs.length === 0) {
|
if (addedRoofs.length === 0) {
|
||||||
const newAddedRoofs = []
|
const newAddedRoofs = []
|
||||||
newAddedRoofs.push({ ...selectedRoofMaterial, selected: true })
|
newAddedRoofs.push({ ...selectedRoofMaterial, selected: true, index: 0 })
|
||||||
setAddedRoofs(newAddedRoofs)
|
setAddedRoofs(newAddedRoofs)
|
||||||
}
|
}
|
||||||
setBasicSettings({ ...basicSetting, roofMaterials: selectedRoofMaterial })
|
setBasicSettings({ ...basicSetting, selectedRoofMaterial: selectedRoofMaterial })
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@ -169,11 +169,12 @@ export function useRoofAllocationSetting(id) {
|
|||||||
setBasicSetting((prev) => {
|
setBasicSetting((prev) => {
|
||||||
return {
|
return {
|
||||||
...prev,
|
...prev,
|
||||||
roofs: roofList,
|
|
||||||
selectedRoofMaterial: roofList.find((roof) => roof.selected),
|
selectedRoofMaterial: roofList.find((roof) => roof.selected),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
setRoofList(roofList)
|
||||||
|
|
||||||
const roofs = canvas.getObjects().filter((obj) => obj.name === 'roof')
|
const roofs = canvas.getObjects().filter((obj) => obj.name === 'roof')
|
||||||
|
|
||||||
roofs.forEach((roof) => {
|
roofs.forEach((roof) => {
|
||||||
|
|||||||
@ -225,11 +225,8 @@ export const selectedRoofMaterialSelector = selector({
|
|||||||
key: 'selectedRoofMaterialSelector',
|
key: 'selectedRoofMaterialSelector',
|
||||||
get: ({ get }) => {
|
get: ({ get }) => {
|
||||||
const basicSetting = get(basicSettingState)
|
const basicSetting = get(basicSettingState)
|
||||||
const addedRoofs = get(addedRoofsSelector)
|
|
||||||
// addedRoofs에서 selectedRoofMaterial을 찾아 index를 반환
|
|
||||||
const index = addedRoofs.findIndex((roof) => roof === basicSetting.selectedRoofMaterial)
|
|
||||||
|
|
||||||
return { ...basicSetting.selectedRoofMaterial, index }
|
return { ...basicSetting.selectedRoofMaterial }
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user