fix: 거주자/장애인 자료 변경 반영

main
minuk926 3 years ago
parent 2d8e67d347
commit 0cd6cf4347

@ -11,7 +11,6 @@ import { IconSearch } from '@tabler/icons';
import FileInputForms from 'views/cmm/file-ctl/FileInputForms'; import FileInputForms from 'views/cmm/file-ctl/FileInputForms';
import DaumPost from '../../cmm/DaumPost'; import DaumPost from '../../cmm/DaumPost';
import FileReadInputForm from '../../cmm/file-ctl/FileReadInputForm';
// const toDate = new Date(); // const toDate = new Date();
@ -104,6 +103,12 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
// const file = new File(); // const file = new File();
} }
} }
// eslint-disable-next-line no-restricted-syntax
// for (const pair of formData.entries()) {
// console.log(pair[0], pair[1]);
// }
handleModalSave('SAVE', formData); handleModalSave('SAVE', formData);
}; };
@ -115,19 +120,21 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
setPicads((picads) => { setPicads((picads) => {
const updated = { ...picads }; const updated = { ...picads };
updated[fileArrKey] = e.target.files[0]; updated[fileArrKey] = e.target.files[0];
e.target.fileName = e.target.files[0].name; rowData[fileArrKey] = e.target.files[0].name;
return updated; return updated;
}); });
} else if (fileKey === 'scFrecad') { } else if (fileKey === 'scFrecad') {
setFrecads((frecads) => { setFrecads((frecads) => {
const updated = { ...frecads }; const updated = { ...frecads };
updated[fileArrKey] = e.target.files[0]; updated[fileArrKey] = e.target.files[0];
rowData[fileArrKey] = e.target.files[0].name;
return updated; return updated;
}); });
} else if (fileKey === 'scContad') { } else if (fileKey === 'scContad') {
setContads((contads) => { setContads((contads) => {
const updated = { ...contads }; const updated = { ...contads };
updated[fileArrKey] = e.target.files[0]; updated[fileArrKey] = e.target.files[0];
rowData[fileArrKey] = e.target.files[0].name;
return updated; return updated;
}); });
} }
@ -151,10 +158,27 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
setIsPostOpen(false); setIsPostOpen(false);
}; };
const setFileUploadBtn = (fieldName, idx) => {
let isDisabled = false;
switch (idx) {
case 1:
isDisabled = false;
break;
default:
isDisabled =
rowData[`${fieldName}${idx}`] || rowData[`${fieldName}${idx - 1}`]
? false
: typeof picads[`${fieldName}${idx - 1}`] === 'undefined';
break;
}
return isDisabled;
};
useEffect(() => { useEffect(() => {
// eslint-disable-next-line no-plusplus // eslint-disable-next-line no-plusplus
for (let idx = 1; idx < 5; idx++) { for (let idx = 1; idx < 5; idx++) {
if (rowData[`scPicad${idx}`]) { if (rowData[`scPicad${idx}`]) {
// URL.createObjectURL(rowData[`scPicad${idx}`]);
console.log(rowData[`scPicad${idx}`]); console.log(rowData[`scPicad${idx}`]);
// const file = new File(); // const file = new File();
} }
@ -314,7 +338,7 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
{_.range(1, 5, 1).map((idx) => ( {_.range(1, 5, 1).map((idx) => (
<Grid item sm={3}> <Grid item sm={3}>
<FileInputForms <FileInputForms
isDisabled={idx === 1 ? false : typeof picads[`scPicad${idx - 1}`] === 'undefined'} isDisabled={setFileUploadBtn('scPicad', idx)}
fieldName="scPicad" fieldName="scPicad"
index={idx} index={idx}
labelName={`단속사진${idx}`} labelName={`단속사진${idx}`}
@ -331,7 +355,7 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
{_.range(1, 5, 1).map((idx) => ( {_.range(1, 5, 1).map((idx) => (
<Grid item sm={3}> <Grid item sm={3}>
<FileInputForms <FileInputForms
isDisabled={idx === 1 ? false : typeof frecads[`scFrecad${idx - 1}`] === 'undefined'} isDisabled={setFileUploadBtn('scFrecad', idx)}
fieldName="scFrecad" fieldName="scFrecad"
index={idx} index={idx}
labelName={`진술서${idx}`} labelName={`진술서${idx}`}
@ -348,7 +372,7 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
{_.range(1, 9, 1).map((idx) => ( {_.range(1, 9, 1).map((idx) => (
<Grid item sm={3}> <Grid item sm={3}>
<FileInputForms <FileInputForms
isDisabled={idx === 1 ? false : typeof contads[`scContad${idx - 1}`] === 'undefined'} isDisabled={setFileUploadBtn('scContad', idx)}
fieldName="scContad" fieldName="scContad"
index={idx} index={idx}
labelName={`첨부자료${idx}`} labelName={`첨부자료${idx}`}

Loading…
Cancel
Save