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

main
minuk926 3 years ago
parent d371a93d99
commit c56debf764

@ -140,7 +140,7 @@ const ModifyJudgeDataForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
</Grid>
<Grid container spacing={1} xs={12} mt={1}>
<Grid item sm={1.7}>
<TextField disabled size="small" fullWidth required label="우편번호" value={rowData.zipcode1} />
<TextField disabled size="small" fullWidth required label="우편번호" value={rowData.zipcode1 + rowData.zipcode2} />
</Grid>
<Grid item sm={7}>
<TextField disabled size="small" required label="주소" fullWidth value={rowData.scJuso} />

@ -1,4 +1,4 @@
import { useState } from 'react';
import { useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import NumberFormat from 'react-number-format';
@ -52,6 +52,11 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
const onSave = () => {
// TODO : validation check
const formData = new FormData();
formData.append('scCode', rowData.scCode);
formData.append('scSeq', rowData.scSeq);
formData.append('scState', rowData.scState);
formData.append('scTransfer', rowData.scTransfer);
formData.append('scDatagb', rowData.scDatagb);
formData.append('scCarnum', scCarnum);
formData.append('scName', scName);
formData.append('scDong', scDong);
@ -61,23 +66,44 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
formData.append('scWdate', scWdate);
formData.append('scJbtime', scJbtime);
formData.append('scPos', scPos);
formData.append('zipcode1', zipcode1);
formData.append('zipcode1', zipcode1 ? zipcode1.substring(0, 3) : '');
formData.append('zipcode2', zipcode1 ? zipcode1.substring(3) : '');
formData.append('scJuso', scJuso);
formData.append('scBunji', scBunji);
Object.values(picads).forEach((v) => {
formData.append('picadFiles', v);
});
// eslint-disable-next-line no-plusplus
for (let idx = 1; idx < 5; idx++) {
if (rowData[`scPicad${idx}`]) {
formData.append(`scPicad${idx}`, rowData[`scPicad${idx}`]);
// const file = new File();
}
}
Object.values(frecads).forEach((v) => {
formData.append('frecadFiles', v);
});
// eslint-disable-next-line no-plusplus
for (let idx = 1; idx < 5; idx++) {
if (rowData[`scFrecad${idx}`]) {
formData.append(`scFrecad${idx}`, rowData[`scFrecad${idx}`]);
// const file = new File();
}
}
Object.values(contads).forEach((v) => {
formData.append('contadFiles', v);
});
console.log(picads, frecads, contads);
handleModalSave(formData);
// eslint-disable-next-line no-plusplus
for (let idx = 1; idx < 9; idx++) {
if (rowData[`scContad${idx}`]) {
formData.append(`scContad${idx}`, rowData[`scContad${idx}`]);
// const file = new File();
}
}
handleModalSave('SAVE', formData);
};
const handleChangeFile = (e) => {
@ -123,6 +149,16 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
setIsPostOpen(false);
};
useEffect(() => {
// eslint-disable-next-line no-plusplus
for (let idx = 1; idx < 5; idx++) {
if (rowData[`scPicad${idx}`]) {
console.log(rowData[`scPicad${idx}`]);
// const file = new File();
}
}
}, []);
return (
<>
<Grid mt={2}>
@ -274,7 +310,7 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
<Grid container spacing={1} item xs={12} mt={1}>
<Grid item sm={3}>
<FileReadInputForm
<FileInputForms
isDisabled={false}
fieldName="scPicad"
index={1}
@ -381,8 +417,9 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
<FileInputForms
isDisabled={false}
fieldName="scContad"
index={1}
labelName="첨부자료1"
index={1}
fileName={rowData.scContad1}
selectedFile={contads.scContad1?.name}
handleChangeFile={handleChangeFile}
alert={alert}
@ -395,6 +432,7 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
fieldName="scContad"
labelName="첨부자료2"
index={2}
fileName={rowData.scContad2}
selectedFile={contads.scContad2?.name}
handleChangeFile={handleChangeFile}
alert={alert}
@ -407,6 +445,7 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
fieldName="scContad"
labelName="첨부자료3"
index={3}
fileName={rowData.scContad3}
selectedFile={contads.scContad3?.name}
handleChangeFile={handleChangeFile}
alert={alert}
@ -418,6 +457,7 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
fieldName="scContad"
labelName="첨부자료4"
index={4}
fileName={rowData.scContad4}
selectedFile={contads.scContad4?.name}
handleChangeFile={handleChangeFile}
alert={alert}
@ -427,8 +467,9 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
<FileInputForms
isDisabled={typeof contads.scContad4 === 'undefined'}
fieldName="scContad"
index={5}
labelName="첨부자료5"
index={5}
fileName={rowData.scContad5}
selectedFile={contads.scContad5?.name}
handleChangeFile={handleChangeFile}
alert={alert}
@ -441,6 +482,7 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
fieldName="scContad"
labelName="첨부자료6"
index={6}
fileName={rowData.scContad6}
selectedFile={contads.scContad6?.name}
handleChangeFile={handleChangeFile}
alert={alert}
@ -453,6 +495,7 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
fieldName="scContad"
labelName="첨부자료7"
index={7}
fileName={rowData.scContad7}
selectedFile={contads.scContad7?.name}
handleChangeFile={handleChangeFile}
alert={alert}
@ -464,6 +507,7 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
fieldName="scContad"
labelName="첨부자료8"
index={8}
fileName={rowData.scContad8}
selectedFile={contads.scContad8?.name}
handleChangeFile={handleChangeFile}
alert={alert}

@ -16,6 +16,7 @@ const toDate = new Date();
const JudgeDataNewForm = ({ scDatagb, contDocs, ingbs, handleModalSave }) => {
const alert = useAlert();
const [isPostOpen, setIsPostOpen] = useState(false);
const [scCarnum, setScCarnum] = useState('');
const [scName, setScName] = useState('');
@ -34,8 +35,6 @@ const JudgeDataNewForm = ({ scDatagb, contDocs, ingbs, handleModalSave }) => {
const [frecads, setFrecads] = useState({});
const [contads, setContads] = useState({});
const [isPostOpen, setIsPostOpen] = useState(false);
const onSave = () => {
// TODO : validation check
const formData = new FormData();
@ -49,7 +48,8 @@ const JudgeDataNewForm = ({ scDatagb, contDocs, ingbs, handleModalSave }) => {
formData.append('scWdate', scWdate ? scWdate?.replace(/-/g, '') : '');
formData.append('scJbtime', scJbtime ? scJbtime?.replace(/:/g, '') : '');
formData.append('scPos', scPos);
formData.append('zipcode1', zipcode1 ?? '');
formData.append('zipcode1', zipcode1 ? zipcode1.substring(0, 3) : '');
formData.append('zipcode2', zipcode1 ? zipcode1.substring(3) : '');
formData.append('scJuso', scJuso);
formData.append('scBunji', scBunji);
@ -64,7 +64,6 @@ const JudgeDataNewForm = ({ scDatagb, contDocs, ingbs, handleModalSave }) => {
Object.values(contads).forEach((v) => {
formData.append('contadFiles', v);
});
console.log(picads, frecads, contads);
handleModalSave('SAVE', formData);
};

Loading…
Cancel
Save