feat: 조사매물 지붕정보 수정/생성 시 코드값 입력되도록 변경
- 공통코드 동기화 이후 코드 값이 존재하면 수정/생성 시 해당 코드 값이 입력되도록 구현
This commit is contained in:
parent
b571197ffc
commit
206e435610
@ -206,7 +206,7 @@ export default function RoofForm(props: {
|
|||||||
<SelectedBox mode={mode} column="openFieldPlateKind" detailInfoData={roofInfo as SurveyDetailInfo} setRoofInfo={setRoofInfo} />
|
<SelectedBox mode={mode} column="openFieldPlateKind" detailInfoData={roofInfo as SurveyDetailInfo} setRoofInfo={setRoofInfo} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{roofInfo.openFieldPlateKind === '4' && (
|
{roofInfo.openFieldPlateKind === 'S' && (
|
||||||
<div className="data-input-form-bx">
|
<div className="data-input-form-bx">
|
||||||
{/* 노지판 두께 */}
|
{/* 노지판 두께 */}
|
||||||
<div className="data-input-form-tit">
|
<div className="data-input-form-tit">
|
||||||
@ -309,7 +309,7 @@ const SelectedBox = ({
|
|||||||
const handleSelectChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
|
const handleSelectChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
|
||||||
const value = e.target.value
|
const value = e.target.value
|
||||||
const isEtc = value === 'etc'
|
const isEtc = value === 'etc'
|
||||||
const isSpecialEtc = isSpecialCase && value === '2'
|
const isSpecialEtc = isSpecialCase && value === 'O'
|
||||||
|
|
||||||
const updatedData = {
|
const updatedData = {
|
||||||
...detailInfoData,
|
...detailInfoData,
|
||||||
@ -339,7 +339,7 @@ const SelectedBox = ({
|
|||||||
if (mode === 'READ') return true
|
if (mode === 'READ') return true
|
||||||
if (column === 'installationAvailability') return false
|
if (column === 'installationAvailability') return false
|
||||||
if (column === 'constructionYear') {
|
if (column === 'constructionYear') {
|
||||||
return detailInfoData.constructionYear === '1' || detailInfoData.constructionYear === null
|
return detailInfoData.constructionYear === 'N' || detailInfoData.constructionYear === null
|
||||||
}
|
}
|
||||||
return !isEtcSelected && !etcValue
|
return !isEtcSelected && !etcValue
|
||||||
}
|
}
|
||||||
@ -351,11 +351,11 @@ const SelectedBox = ({
|
|||||||
name={column}
|
name={column}
|
||||||
id={column}
|
id={column}
|
||||||
disabled={mode === 'READ'}
|
disabled={mode === 'READ'}
|
||||||
value={selectedId ? Number(selectedId) : etcValue || isEtcSelected ? 'etc' : ''}
|
value={selectedId ? String(selectedId) : etcValue || isEtcSelected ? 'etc' : ''}
|
||||||
onChange={handleSelectChange}
|
onChange={handleSelectChange}
|
||||||
>
|
>
|
||||||
{selectBoxOptions[column as keyof typeof selectBoxOptions].map((item) => (
|
{selectBoxOptions[column as keyof typeof selectBoxOptions].map((item) => (
|
||||||
<option key={item.id} value={item.id}>
|
<option key={item.code ?? String(item.id)} value={item.code ?? String(item.id)}>
|
||||||
{item.name}
|
{item.name}
|
||||||
</option>
|
</option>
|
||||||
))}
|
))}
|
||||||
@ -458,17 +458,17 @@ const RadioSelected = ({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{radioEtcData[column as keyof typeof radioEtcData].map((item) => (
|
{radioEtcData[column as keyof typeof radioEtcData].map((item) => (
|
||||||
<div className="radio-form-box mb10" key={item.id}>
|
<div className="radio-form-box mb10" key={item.code ?? String(item.id)}>
|
||||||
<input
|
<input
|
||||||
type="radio"
|
type="radio"
|
||||||
name={column}
|
name={column}
|
||||||
id={`${column}_${item.id}`}
|
id={`${column}_${item.code ?? item.id}`}
|
||||||
disabled={mode === 'READ'}
|
disabled={mode === 'READ'}
|
||||||
checked={Number(selectedId) === item.id}
|
checked={Number(selectedId) === (item.code ?? item.id)}
|
||||||
onChange={handleRadioChange}
|
onChange={handleRadioChange}
|
||||||
value={item.id}
|
value={item.code ?? item.id}
|
||||||
/>
|
/>
|
||||||
<label htmlFor={`${column}_${item.id}`}>{item.label}</label>
|
<label htmlFor={`${column}_${item.code ?? item.id}`}>{item.label}</label>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
{showEtcOption && (
|
{showEtcOption && (
|
||||||
@ -528,12 +528,12 @@ const MultiCheck = ({
|
|||||||
const selectedValues = makeNumArr(String(roofInfo[column as keyof SurveyDetailInfo] ?? ''))
|
const selectedValues = makeNumArr(String(roofInfo[column as keyof SurveyDetailInfo] ?? ''))
|
||||||
|
|
||||||
/** 다중 선택 처리 */
|
/** 다중 선택 처리 */
|
||||||
const handleCheckbox = (id: number) => {
|
const handleCheckbox = (item: { id: number; code: string | null; name: string }) => {
|
||||||
const isOtherSelected = Boolean(etcValue)
|
const isOtherSelected = Boolean(etcValue)
|
||||||
let newValue: string[]
|
let newValue: string[]
|
||||||
|
|
||||||
if (selectedValues.includes(String(id))) {
|
if (selectedValues.includes(item.code ?? String(item.id))) {
|
||||||
newValue = selectedValues.filter((v) => v !== String(id))
|
newValue = selectedValues.filter((v) => v !== item.code && v !== String(item.id))
|
||||||
} else {
|
} else {
|
||||||
/** 지붕 재료 처리 - 최대 2개 선택 처리 */
|
/** 지붕 재료 처리 - 최대 2개 선택 처리 */
|
||||||
if (isRoofMaterial) {
|
if (isRoofMaterial) {
|
||||||
@ -543,7 +543,7 @@ const MultiCheck = ({
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
newValue = [...selectedValues, String(id)]
|
newValue = [...selectedValues, item.code ?? String(item.id)]
|
||||||
}
|
}
|
||||||
setRoofInfo({ ...roofInfo, [column]: newValue.join(',') })
|
setRoofInfo({ ...roofInfo, [column]: newValue.join(',') })
|
||||||
}
|
}
|
||||||
@ -586,9 +586,9 @@ const MultiCheck = ({
|
|||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
id={`${column}_${item.id}`}
|
id={`${column}_${item.id}`}
|
||||||
checked={selectedValues.includes(String(item.id))}
|
checked={selectedValues.includes(item.code ?? String(item.id))}
|
||||||
disabled={mode === 'READ'}
|
disabled={mode === 'READ'}
|
||||||
onChange={() => handleCheckbox(item.id)}
|
onChange={() => handleCheckbox(item)}
|
||||||
/>
|
/>
|
||||||
<label htmlFor={`${column}_${item.id}`}>{item.name}</label>
|
<label htmlFor={`${column}_${item.id}`}>{item.name}</label>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user