From c56debf764b7f188f70a2da104364386dd814dde Mon Sep 17 00:00:00 2001 From: minuk926 Date: Wed, 27 Apr 2022 20:11:33 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EA=B1=B0=EC=A3=BC=EC=9E=90/=EC=9E=A5?= =?UTF-8?q?=EC=95=A0=EC=9D=B8=20=EC=9E=90=EB=A3=8C=20=EB=B3=80=EA=B2=BD=20?= =?UTF-8?q?fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/biz/judge/JudgeDataDetailForm.jsx | 2 +- src/views/biz/judge/JudgeDataModifyForm.jsx | 58 ++++++++++++++++++--- src/views/biz/judge/JudgeDataNewForm.jsx | 7 ++- 3 files changed, 55 insertions(+), 12 deletions(-) diff --git a/src/views/biz/judge/JudgeDataDetailForm.jsx b/src/views/biz/judge/JudgeDataDetailForm.jsx index 4b04bc0..4a67a47 100644 --- a/src/views/biz/judge/JudgeDataDetailForm.jsx +++ b/src/views/biz/judge/JudgeDataDetailForm.jsx @@ -140,7 +140,7 @@ const ModifyJudgeDataForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav - + diff --git a/src/views/biz/judge/JudgeDataModifyForm.jsx b/src/views/biz/judge/JudgeDataModifyForm.jsx index 18e0123..357a92d 100644 --- a/src/views/biz/judge/JudgeDataModifyForm.jsx +++ b/src/views/biz/judge/JudgeDataModifyForm.jsx @@ -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 ( <> @@ -274,7 +310,7 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav - { 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); };