fix: debug console 에러 fix

main
minuk926 3 years ago
parent 0585ba3378
commit d509a8e47b

@ -165,18 +165,17 @@ const ModifyJudgeDataForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
<TextField disabled size="small" fullWidth required label="우편번호" value={rowData?.zipcode1 + rowData?.zipcode2} /> <TextField disabled size="small" fullWidth required label="우편번호" value={rowData?.zipcode1 + rowData?.zipcode2} />
</Grid> </Grid>
<Grid item xs={7}> <Grid item xs={7}>
<TextField disabled size="small" required label="주소" fullWidth value={rowData?.scJuso} /> <TextField disabled size="small" required label="주소" fullWidth value={rowData?.scJuso || ''} />
</Grid> </Grid>
<Grid item xs={3}> <Grid item xs={3}>
<TextField disabled size="small" required label="번지" fullWidth value={rowData?.scBunji} /> <TextField disabled size="small" required label="번지" fullWidth value={rowData?.scBunji || ''} />
</Grid> </Grid>
</Grid> </Grid>
<Grid container spacing={1} mt={1}> <Grid container spacing={1} mt={1}>
{_.range(1, 5, 1).map((idx) => ( {_.range(1, 5, 1).map((idx) => (
<Grid item xs={3}> <Grid item xs={3} key={idx}>
<ImageFileTextForm <ImageFileTextForm
key={idx}
labelName={`단속사진${idx}`} labelName={`단속사진${idx}`}
fileName={rowData[`scPicad${idx}`]} fileName={rowData[`scPicad${idx}`]}
handleViewImg={viewImg} handleViewImg={viewImg}
@ -187,9 +186,8 @@ const ModifyJudgeDataForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
</Grid> </Grid>
<Grid container spacing={1} mt={1}> <Grid container spacing={1} mt={1}>
{_.range(1, 5, 1).map((idx) => ( {_.range(1, 5, 1).map((idx) => (
<Grid item xs={3}> <Grid item xs={3} key={idx}>
<ImageFileTextForm <ImageFileTextForm
key={idx}
labelName={`진술서${idx}`} labelName={`진술서${idx}`}
fileName={rowData[`scFrecad${idx}`]} fileName={rowData[`scFrecad${idx}`]}
handleViewImg={viewImg} handleViewImg={viewImg}
@ -200,9 +198,8 @@ const ModifyJudgeDataForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
</Grid> </Grid>
<Grid container spacing={1} mt={1}> <Grid container spacing={1} mt={1}>
{_.range(1, 9, 1).map((idx) => ( {_.range(1, 9, 1).map((idx) => (
<Grid item xs={3}> <Grid item xs={3} key={idx}>
<ImageFileTextForm <ImageFileTextForm
key={idx}
labelName={`첨부자료${idx}`} labelName={`첨부자료${idx}`}
fileName={rowData[`scContad${idx}`]} fileName={rowData[`scContad${idx}`]}
handleViewImg={viewImg} handleViewImg={viewImg}

@ -342,7 +342,15 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
/> />
</Grid> </Grid>
<Grid item xs={7}> <Grid item xs={7}>
<TextField size="small" required disabled label="주소" fullWidth value={scJuso} onChange={(e) => setScJuso(e?.target?.value)} /> <TextField
size="small"
required
disabled
label="주소"
fullWidth
value={scJuso || ''}
onChange={(e) => setScJuso(e?.target?.value)}
/>
</Grid> </Grid>
<Grid item xs={3.3}> <Grid item xs={3.3}>
<TextField size="small" required label="번지" fullWidth value={scBunji} onChange={(e) => setScBunji(e?.target?.value)} /> <TextField size="small" required label="번지" fullWidth value={scBunji} onChange={(e) => setScBunji(e?.target?.value)} />
@ -351,9 +359,8 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
<Grid container spacing={1} mt={1}> <Grid container spacing={1} mt={1}>
{_.range(1, 5, 1).map((idx) => ( {_.range(1, 5, 1).map((idx) => (
<Grid item xs={3}> <Grid item xs={3} key={idx}>
<FileInputForms <FileInputForms
key={idx}
isDisabled={setFileUploadBtn('scPicad', idx)} isDisabled={setFileUploadBtn('scPicad', idx)}
fieldName="scPicad" fieldName="scPicad"
index={idx} index={idx}
@ -369,9 +376,8 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
</Grid> </Grid>
<Grid container spacing={1} mt={1}> <Grid container spacing={1} mt={1}>
{_.range(1, 5, 1).map((idx) => ( {_.range(1, 5, 1).map((idx) => (
<Grid item xs={3}> <Grid item xs={3} key={idx}>
<FileInputForms <FileInputForms
key={idx}
isDisabled={setFileUploadBtn('scFrecad', idx)} isDisabled={setFileUploadBtn('scFrecad', idx)}
fieldName="scFrecad" fieldName="scFrecad"
index={idx} index={idx}
@ -387,9 +393,8 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
</Grid> </Grid>
<Grid container spacing={1} mt={1}> <Grid container spacing={1} mt={1}>
{_.range(1, 9, 1).map((idx) => ( {_.range(1, 9, 1).map((idx) => (
<Grid item xs={3}> <Grid item xs={3} key={idx}>
<FileInputForms <FileInputForms
key={idx}
isDisabled={setFileUploadBtn('scContad', idx)} isDisabled={setFileUploadBtn('scContad', idx)}
fieldName="scContad" fieldName="scContad"
index={idx} index={idx}

@ -266,7 +266,15 @@ const JudgeDataNewForm = ({ scDatagb, contDocs, ingbs, handleModalSave }) => {
/> />
</Grid> </Grid>
<Grid item sm={5} className="fix_address"> <Grid item sm={5} className="fix_address">
<TextField size="small" required disabled label="주소" fullWidth value={scJuso} onChange={(e) => setScJuso(e?.target?.value)} /> <TextField
size="small"
required
disabled
label="주소"
fullWidth
value={scJuso || ''}
onChange={(e) => setScJuso(e?.target?.value)}
/>
</Grid> </Grid>
<Grid item sm={5.3}> <Grid item sm={5.3}>
<TextField size="small" required label="번지" fullWidth value={scBunji} onChange={(e) => setScBunji(e?.target?.value)} /> <TextField size="small" required label="번지" fullWidth value={scBunji} onChange={(e) => setScBunji(e?.target?.value)} />
@ -275,9 +283,8 @@ const JudgeDataNewForm = ({ scDatagb, contDocs, ingbs, handleModalSave }) => {
<Grid container spacing={1} mt={1}> <Grid container spacing={1} mt={1}>
{_.range(1, 5, 1).map((idx) => ( {_.range(1, 5, 1).map((idx) => (
<Grid item sm={3}> <Grid item sm={3} key={idx}>
<FileInputForms <FileInputForms
key={idx}
isDisabled={idx === 1 ? false : typeof picads[`scPicad${idx - 1}`] === 'undefined'} isDisabled={idx === 1 ? false : typeof picads[`scPicad${idx - 1}`] === 'undefined'}
fieldName="scPicad" fieldName="scPicad"
index={idx} index={idx}
@ -292,9 +299,8 @@ const JudgeDataNewForm = ({ scDatagb, contDocs, ingbs, handleModalSave }) => {
</Grid> </Grid>
<Grid container spacing={1} mt={1}> <Grid container spacing={1} mt={1}>
{_.range(1, 5, 1).map((idx) => ( {_.range(1, 5, 1).map((idx) => (
<Grid item sm={3}> <Grid item sm={3} key={idx}>
<FileInputForms <FileInputForms
key={idx}
isDisabled={idx === 1 ? false : typeof frecads[`scFrecad${idx - 1}`] === 'undefined'} isDisabled={idx === 1 ? false : typeof frecads[`scFrecad${idx - 1}`] === 'undefined'}
fieldName="scFrecad" fieldName="scFrecad"
index={idx} index={idx}
@ -309,9 +315,8 @@ const JudgeDataNewForm = ({ scDatagb, contDocs, ingbs, handleModalSave }) => {
</Grid> </Grid>
<Grid container spacing={1} mt={1}> <Grid container spacing={1} mt={1}>
{_.range(1, 9, 1).map((idx) => ( {_.range(1, 9, 1).map((idx) => (
<Grid item sm={3}> <Grid item sm={3} key={idx}>
<FileInputForms <FileInputForms
key={idx}
isDisabled={idx === 1 ? false : typeof contads[`scContad${idx - 1}`] === 'undefined'} isDisabled={idx === 1 ? false : typeof contads[`scContad${idx - 1}`] === 'undefined'}
fieldName="scContad" fieldName="scContad"
index={idx} index={idx}

@ -33,7 +33,7 @@ const JudgeReview = ({ msDatagb, menuName }) => {
const [title, setTitle] = useState(); const [title, setTitle] = useState();
const [selectedYear, setSelectedYear] = useState(year); const [selectedYear, setSelectedYear] = useState(year);
const [searchTxt, setSearchTxt] = useState(''); const inputRef = useRef('');
const [totalCount, setTotalCount] = useState(0); const [totalCount, setTotalCount] = useState(0);
const [rowsState, setRowsState] = useState({ const [rowsState, setRowsState] = useState({
@ -56,29 +56,23 @@ const JudgeReview = ({ msDatagb, menuName }) => {
const search = useCallback(async () => { const search = useCallback(async () => {
const params = { const params = {
msDatagb, msDatagb,
msYear: selectedYear,
msChasu: inputRef.current,
page: rowsState.page, page: rowsState.page,
size: rowsState.pageSize size: rowsState.pageSize
}; };
let res = {}; let res = {};
if (msDatagb) { if (msDatagb) {
res = await findJudges({ ...params, msYear: selectedYear, msChasu: searchTxt }); res = await findJudges(params);
} else { } else {
res = await findParkings({ ...params, msYear: selectedYear, msChasu: searchTxt }); res = await findParkings(params);
} }
if (res && res.data) { if (res && res.data) {
console.log(res);
setTotalCount(res.count); setTotalCount(res.count);
setRowsState((prevState) => ({ ...prevState, rows: res.data })); setRowsState((prevState) => ({ ...prevState, rows: res.data }));
} }
}, [msDatagb, rowsState.page, rowsState.pageSize, selectedYear]);
// findJudges({ ...params, msYear: selectedYear, msChasu: searchTxt }).then((response) => {
// if (response && response.data) {
// setTotalCount(response.count);
// setRowsState((prevState) => ({ ...prevState, rows: response.data }));
// }
// });
}, [msDatagb, rowsState.page, rowsState.pageSize, selectedYear, searchTxt]);
const removeJudge = useCallback( const removeJudge = useCallback(
(row) => async () => { (row) => async () => {
@ -150,21 +144,11 @@ const JudgeReview = ({ msDatagb, menuName }) => {
if (!selectedYear) return; if (!selectedYear) return;
if (event.type === 'keydown' && event.key === 'Enter') { if (event.type === 'keydown' && event.key === 'Enter') {
const newString = event?.target.value; inputRef.current = event.target.value;
setSearchTxt(newString);
search(); search();
} }
}; };
useEffect(() => {
if (isInit.current) {
isInit.current = false;
return;
}
search();
// }, [rowsState.page, rowsState.pageSize, selectedYear, searchTxt]);
}, [search]);
const handleOnCellClick = async (e) => { const handleOnCellClick = async (e) => {
if (e?.field === 'msDate') { if (e?.field === 'msDate') {
const params = { const params = {

@ -1,3 +1,4 @@
import React from 'react';
import { Button, Grid, TextField } from '@mui/material'; import { Button, Grid, TextField } from '@mui/material';
import { FileUpload } from '@mui/icons-material'; import { FileUpload } from '@mui/icons-material';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
@ -14,19 +15,19 @@ const FileInputForms = ({ fieldName, index, labelName, selectedFile, fileName, h
return ( return (
<Grid container item spacing={0.5}> <Grid container item spacing={0.5}>
<Grid item xs={12} sm={7.5}> <Grid item xs={12} sm={7.5}>
<TextField <TextField placeholder={labelName} value={selectedFile || fileName || ''} size="small" onClick={() => {}} />
placeholder={labelName}
// label={labelName}
value={selectedFile ?? fileName}
size="small"
startIcon={<FileUpload />}
onClick={() => {}}
/>
</Grid> </Grid>
<Grid item xs={12} sm={4.5}> <Grid item xs={12} sm={4.5}>
<Button disabled={isDisabled} variant="contained" component="label" color="primary" size="small" startIcon={<FileUpload />}> <Button
disabled={isDisabled}
variant="contained"
component="label"
color="primary"
size="small"
startIcon={React.cloneElement(<FileUpload />)}
>
파일 파일
<input type="file" name={fieldName || ''} hidden onChange={onChangeFile} /> <input type="file" name={fieldName || ''} data-index={index} hidden onChange={onChangeFile} />
</Button> </Button>
</Grid> </Grid>
</Grid> </Grid>

@ -2,7 +2,7 @@ import { InputAdornment, TextField } from '@mui/material';
import { FileDownload } from '@mui/icons-material'; import { FileDownload } from '@mui/icons-material';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
const ImageFileTextForm = ({ labelName, fileName = '', methodName, handleViewImg }) => ( const ImageFileTextForm = ({ labelName = '', fileName, methodName = '', handleViewImg = () => {} }) => (
<> <>
{fileName && ( {fileName && (
<TextField <TextField
@ -22,9 +22,6 @@ const ImageFileTextForm = ({ labelName, fileName = '', methodName, handleViewImg
}} }}
/> />
)} )}
{/* {!fileName && ( */}
{/* <TextField disabled size="small" fullWidth label={labelName} value={fileName} onClick={() => handleViewImg(methodName)} /> */}
{/* )} */}
</> </>
); );
ImageFileTextForm.propTypes = { ImageFileTextForm.propTypes = {

Loading…
Cancel
Save