배치면 초기설정, 지붕면 할당 - 지붕재 선택 수정

This commit is contained in:
김민식 2024-12-17 14:53:02 +09:00
parent 7f01ca25d8
commit b38cbd39de
2 changed files with 90 additions and 37 deletions

View File

@ -12,6 +12,7 @@ import { useRecoilValue } from 'recoil'
import { roofMaterialsAtom } from '@/store/settingAtom'
import { isObjectNotEmpty } from '@/util/common-utils'
import { useCommonCode } from '@/hooks/common/useCommonCode'
import QSelectBox from '@/components/common/select/QSelectBox'
export const ROOF_MATERIAL_LAYOUT = {
PARALLEL: 'P',
@ -185,7 +186,17 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
</th>
<td>
<div className="placement-option">
<div className="select-wrap" style={{ width: '171px' }}>
<div className="grid-select no-flx" style={{ width: '171px' }}>
{/* <QSelectBox
ref={roofRef.roofCd}
options={roofMaterials.map((roof, index) => {
return { name: roof.roofMatlNm, value: roof.roofMatlCd }
})}
value={currentRoofMaterial.roofMatlCd}
onChange={(e) => {
handleRoofTypeChange(e)
}}
/> */}
<select
className="select-light dark"
name="roofType"
@ -206,32 +217,46 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
</div>
{['R', 'C'].includes(currentRoofMaterial.widAuth) && (
<div className="flex-ment">
<div className="outline-form">
<span className="mr10">W</span>
<div className="input-grid" style={{ width: '63px' }}>
<span>W</span>
<div className="input-grid" style={{ width: '84px' }}>
<input
type="text"
className="input-origin block"
ref={roofRef.width}
defaultValue={parseInt(currentRoofMaterial.width)}
readOnly={currentRoofMaterial.widAuth === 'R'}
/>
</div>
{/* <div className="input-grid" style={{ width: '63px' }}>
<input
type="text"
className="input-origin block"
ref={roofRef.width}
defaultValue={parseInt(currentRoofMaterial.width)}
/>
</div>
</div>
</div> */}
</div>
)}
{['R', 'C'].includes(currentRoofMaterial.lenAuth) && (
<div className="flex-ment">
<div className="outline-form">
<span className="mr10">L</span>
<div className="input-grid" style={{ width: '63px' }}>
<input
type="text"
className="input-origin block"
ref={roofRef.length}
defaultValue={parseInt(currentRoofMaterial.length)}
/>
</div>
<span>L</span>
<div className="input-grid" style={{ width: '84px' }}>
<input
type="text"
className="input-origin block"
ref={roofRef.length}
defaultValue={parseInt(currentRoofMaterial.length)}
readOnly={currentRoofMaterial.lenAuth === 'R'}
/>
</div>
{/* <div className="input-grid" style={{ width: '63px' }}>
<input
type="text"
className="input-origin block"
ref={roofRef.length}
defaultValue={parseInt(currentRoofMaterial.length)}
/>
</div> */}
</div>
)}
{['C', 'R'].includes(currentRoofMaterial.raftAuth) && (
@ -252,16 +277,15 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
)}
{['C', 'R'].includes(currentRoofMaterial.roofPchAuth) && (
<div className="flex-ment">
<div className="outline-form">
<span className="mr10">{getMessage('hajebichi')}</span>
<div className="input-grid" style={{ width: '63px' }}>
<input
type="text"
className="input-origin block"
ref={roofRef.hajebichi}
value={parseInt(currentRoofMaterial.hajebichi)}
/>
</div>
<span>{getMessage('hajebichi')}</span>
<div className="input-grid" style={{ width: '84px' }}>
<input
type="text"
className="input-origin block"
ref={roofRef.hajebichi}
value={parseInt(currentRoofMaterial.hajebichi)}
readOnly={currentRoofMaterial.roofPchAuth === 'R'}
/>
</div>
</div>
)}

View File

@ -8,6 +8,8 @@ import { contextPopupPositionState } from '@/store/popupAtom'
import { useEffect, useState } from 'react'
import { basicSettingState } from '@/store/settingAtom'
import { ROOF_MATERIAL_LAYOUT } from '@/components/floor-plan/modal/placementShape/PlacementShapeSetting'
import { useCanvasSetting } from '@/hooks/option/useCanvasSetting'
import { useCommonCode } from '@/hooks/common/useCommonCode'
export default function RoofAllocationSetting(props) {
const contextPopupPosition = useRecoilValue(contextPopupPositionState)
@ -24,7 +26,15 @@ export default function RoofAllocationSetting(props) {
handleDefaultRoofMaterial,
handleChangeRoofMaterial,
} = useRoofAllocationSetting(id)
const { fetchBasicSettings } = useCanvasSetting()
const { findCommonCode } = useCommonCode()
const [raftCodes, setRaftCodes] = useState([])
useEffect(() => {
fetchBasicSettings()
const raftCodeList = findCommonCode('203800')
console.log('🚀 ~ useEffect ~ raftCodeList:', raftCodeList)
setRaftCodes(raftCodeList)
}, [])
return (
<WithDraggable isShow={true} pos={pos}>
<div className={`modal-pop-wrap ml mount`}>
@ -88,41 +98,60 @@ export default function RoofAllocationSetting(props) {
{roof.widAuth && (
<div className="flex-ment">
<span>W</span>
<div className="select-wrap" style={{ width: '84px' }}>
<div className="input-grid" style={{ width: '100px' }}>
<input type="text" className="input-origin block" defaultValue={100} readOnly />
</div>
{/* <div className="select-wrap" style={{ width: '84px' }}>
<select className="select-light dark" name="" id="">
<option>265</option>
</select>
</div>
</div> */}
</div>
)}
{roof.lenAuth && (
<div className="flex-ment">
<span>L</span>
<div className="select-wrap" style={{ width: '84px' }}>
<div className="input-grid" style={{ width: '100px' }}>
<input type="text" className="input-origin block" defaultValue={100} readOnly />
</div>
{/* <div className="select-wrap" style={{ width: '84px' }}>
<select className="select-light dark" name="" id="">
<option>235</option>
</select>
</div>
</div> */}
</div>
)}
{roof.raftAuth && (
<div className="flex-ment">
<span>{getMessage('modal.placement.initial.setting.rafter')}</span>
<div className="select-wrap" style={{ width: '84px' }}>
<select className="select-light dark" name="" id="">
<option>455</option>
</select>
<div className="grid-select" style={{ width: '84px' }}>
<QSelectBox
options={raftCodes.map((raft) => ({ name: raft.clCodeNm, value: raft.clCode }))}
value={raftCodes.find((r) => r.id === roof.id)}
/>
{/* <select className="select-light dark" name="roofGap" ref={roofRef.rafter}>
{raftCodes.map((raft, index) => {
return (
<option key={index} value={raft.clCode}>
{raft.clCodeNm}
</option>
)
})}
</select> */}
</div>
</div>
)}
{roof.roofPchAuth && (
<div className="flex-ment">
<span>{getMessage('hajebichi')}</span>
<div className="grid-select no-flx" style={{ width: '84px' }}>
<div className="input-grid" style={{ width: '84px' }}>
<input type="text" className="input-origin block" value={parseInt(roof.hajebichi)} readOnly={roof.roofPchAuth === 'R'} />
</div>
{/* <div className="grid-select no-flx" style={{ width: '84px' }}>
<select className="select-light dark" name="" id="">
<option>265</option>
</select>
</div>
</div> */}
</div>
)}
</div>