refactor: 개발자도구 콘솔 에러 fix

main
minuk926 3 years ago
parent f1e8cfdf96
commit 06c08b756b

@ -40,7 +40,7 @@ const ModifyJudgeDataForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
return (
<>
<Grid mt={1}>
<Grid container spacing={0.5} item xs={12} mb={1.5}>
<Grid container spacing={0.5} mb={1.5}>
<Grid item xs={3}>
<TextField disabled size="small" required label="접수번호" fullWidth value={rowData?.scSeq} />
</Grid>
@ -54,7 +54,7 @@ const ModifyJudgeDataForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
<TextField disabled required label="차량번호" size="small" fullWidth value={rowData?.scCarnum} autoFocus />
</Grid>
</Grid>
<Grid container spacing={1} xs={12} mt={1}>
<Grid container spacing={1} mt={1}>
<Grid item xs={3}>
<TextField disabled required label="성명" size="small" fullWidth value={rowData?.scName} />
</Grid>
@ -104,7 +104,7 @@ const ModifyJudgeDataForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
</FormControl>
</Grid>
</Grid>
<Grid container spacing={1} xs={12} mt={1}>
<Grid container spacing={1} mt={1}>
<Grid item xs={3}>
<NumberFormat
disabled
@ -156,7 +156,7 @@ const ModifyJudgeDataForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
/>
</Grid>
</Grid>
<Grid container spacing={1} xs={12} mt={1}>
<Grid container spacing={1} mt={1}>
<Grid item xs={2}>
<TextField disabled size="small" fullWidth required label="우편번호" value={rowData?.zipcode1 + rowData?.zipcode2} />
</Grid>
@ -168,43 +168,52 @@ const ModifyJudgeDataForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
</Grid>
</Grid>
<Grid container spacing={1} item xs={12} mt={1}>
<Grid container spacing={1} mt={1}>
{_.range(1, 5, 1).map((idx) => (
<ImageFileTextForm
labelName={`단속사진${idx}`}
fileName={rowData[`scPicad${idx}`]}
handleViewImg={viewImg}
methodName={`getScPicad${idx}`}
/>
<Grid item xs={3}>
<ImageFileTextForm
key={idx}
labelName={`단속사진${idx}`}
fileName={rowData[`scPicad${idx}`]}
handleViewImg={viewImg}
methodName={`getScPicad${idx}`}
/>
</Grid>
))}
</Grid>
<Grid container spacing={1} item xs={12} mt={1}>
<Grid container spacing={1} mt={1}>
{_.range(1, 5, 1).map((idx) => (
<ImageFileTextForm
labelName={`진술서${idx}`}
fileName={rowData[`scFrecad${idx}`]}
handleViewImg={viewImg}
methodName={`getScFrecad${idx}`}
/>
<Grid item xs={3}>
<ImageFileTextForm
key={idx}
labelName={`진술서${idx}`}
fileName={rowData[`scFrecad${idx}`]}
handleViewImg={viewImg}
methodName={`getScFrecad${idx}`}
/>
</Grid>
))}
</Grid>
<Grid container spacing={1} item xs={12} mt={1}>
<Grid container spacing={1} mt={1}>
{_.range(1, 9, 1).map((idx) => (
<ImageFileTextForm
labelName={`첨부자료${idx}`}
fileName={rowData[`scContad${idx}`]}
handleViewImg={viewImg}
methodName={`getScContad${idx}`}
/>
<Grid item xs={3}>
<ImageFileTextForm
key={idx}
labelName={`첨부자료${idx}`}
fileName={rowData[`scContad${idx}`]}
handleViewImg={viewImg}
methodName={`getScContad${idx}`}
/>
</Grid>
))}
</Grid>
</Grid>
<Grid container spacing={1} item xs={12} mt={1}>
<Grid container mt={1}>
<Grid item xs={12}>
<Divider />
</Grid>
</Grid>
<Grid item container spacing={0.5} xs={12} mt={1}>
<Grid container spacing={0.5} mt={1}>
<Grid item>
<Button variant="contained" size="small" startIcon={<List />} onClick={onList}>
목록

@ -12,22 +12,6 @@ import { IconSearch } from '@tabler/icons';
import FileInputForms from 'views/cmm/file-ctl/FileInputForms';
import DaumPost from '../../../cmm/DaumPost';
// const toDate = new Date();
function FileReadInputForms() {
return null;
}
FileReadInputForms.propTypes = {
selectedFile: PropTypes.any,
handleChangeFile: PropTypes.func,
fileName: PropTypes.any,
fieldName: PropTypes.string,
index: PropTypes.number,
isDisabled: PropTypes.bool,
labelName: PropTypes.string,
isOrgFileInfo: PropTypes.bool
};
const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSave }) => {
const alert = useAlert();
const [isPostOpen, setIsPostOpen] = useState(false);
@ -188,7 +172,7 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
return (
<>
<Grid mt={2}>
<Grid container spacing={0.5} item xs={12} mb={1.5}>
<Grid container spacing={0.5} mb={1.5}>
<Grid item xs={3}>
<TextField disabled size="small" required label="접수번호" fullWidth value={rowData.scSeq} />
</Grid>
@ -210,7 +194,7 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
/>
</Grid>
</Grid>
<Grid container spacing={0.5} item xs={12} mb={1.5}>
<Grid container spacing={0.5} mb={1.5}>
<Grid item xs={3}>
<TextField required label="성명" size="small" fullWidth value={scName} onChange={(e) => setScName(e?.target?.value)} />
</Grid>
@ -249,7 +233,7 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
</FormControl>
</Grid>
</Grid>
<Grid container spacing={0.5} item xs={12} mb={2}>
<Grid container spacing={0.5} mb={2}>
<Grid item xs={3}>
<NumberFormat
size="small"
@ -301,7 +285,7 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
/>
</Grid>
</Grid>
<Grid container spacing={0.5} item xs={12} mb={2}>
<Grid container spacing={0.5} mb={2}>
<Grid item xs={1.7}>
<TextField
size="small"
@ -330,10 +314,11 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
</Grid>
</Grid>
<Grid container spacing={1} item xs={12} mt={1}>
<Grid container spacing={1} mt={1}>
{_.range(1, 5, 1).map((idx) => (
<Grid item xs={3}>
<FileInputForms
key={idx}
isDisabled={setFileUploadBtn('scPicad', idx)}
fieldName="scPicad"
index={idx}
@ -347,10 +332,11 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
</Grid>
))}
</Grid>
<Grid container spacing={1} item xs={12} mt={1}>
<Grid container spacing={1} mt={1}>
{_.range(1, 5, 1).map((idx) => (
<Grid item xs={3}>
<FileInputForms
key={idx}
isDisabled={setFileUploadBtn('scFrecad', idx)}
fieldName="scFrecad"
index={idx}
@ -364,10 +350,11 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
</Grid>
))}
</Grid>
<Grid container spacing={1} item xs={12} mt={1}>
<Grid container spacing={1} mt={1}>
{_.range(1, 9, 1).map((idx) => (
<Grid item xs={3}>
<FileInputForms
key={idx}
isDisabled={setFileUploadBtn('scContad', idx)}
fieldName="scContad"
index={idx}
@ -382,7 +369,7 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
))}
</Grid>
</Grid>
<Grid container spacing={1} item xs={12} mt={1}>
<Grid container spacing={1} mt={1}>
<Grid item xs={12}>
<Divider />
</Grid>

@ -110,7 +110,7 @@ const JudgeDataNewForm = ({ scDatagb, contDocs, ingbs, handleModalSave }) => {
return (
<>
<Grid mt={2}>
<Grid container spacing={0.5} item xs={12} mb={1.5}>
<Grid container spacing={0.5} mb={1.5}>
<Grid item sm={3}>
<TextField
required
@ -141,7 +141,7 @@ const JudgeDataNewForm = ({ scDatagb, contDocs, ingbs, handleModalSave }) => {
/>
</Grid>
</Grid>
<Grid container spacing={0.5} item xs={12} mb={1.5}>
<Grid container spacing={0.5} mb={1.5}>
<Grid item sm={3}>
<FormControl fullWidth>
<InputLabel required>진술유형</InputLabel>
@ -198,7 +198,7 @@ const JudgeDataNewForm = ({ scDatagb, contDocs, ingbs, handleModalSave }) => {
/>
</Grid>
</Grid>
<Grid container spacing={0.5} item xs={12} mb={2}>
<Grid container spacing={0.5} mb={2}>
<Grid item sm={12}>
<TextField size="small" required label="위반장소" fullWidth value={scPos} onChange={(e) => setScPos(e?.target?.value)} />
</Grid>
@ -232,10 +232,11 @@ const JudgeDataNewForm = ({ scDatagb, contDocs, ingbs, handleModalSave }) => {
</Grid>
</Grid>
<Grid container spacing={1} item xs={12} mt={1}>
<Grid container spacing={1} mt={1}>
{_.range(1, 5, 1).map((idx) => (
<Grid item sm={3}>
<FileInputForms
key={idx}
isDisabled={idx === 1 ? false : typeof picads[`scPicad${idx - 1}`] === 'undefined'}
fieldName="scPicad"
index={idx}
@ -248,10 +249,11 @@ const JudgeDataNewForm = ({ scDatagb, contDocs, ingbs, handleModalSave }) => {
</Grid>
))}
</Grid>
<Grid container spacing={1} item xs={12} mt={1}>
<Grid container spacing={1} mt={1}>
{_.range(1, 5, 1).map((idx) => (
<Grid item sm={3}>
<FileInputForms
key={idx}
isDisabled={idx === 1 ? false : typeof frecads[`scFrecad${idx - 1}`] === 'undefined'}
fieldName="scFrecad"
index={idx}
@ -264,10 +266,11 @@ const JudgeDataNewForm = ({ scDatagb, contDocs, ingbs, handleModalSave }) => {
</Grid>
))}
</Grid>
<Grid container spacing={1} item xs={12} mt={1}>
<Grid container spacing={1} mt={1}>
{_.range(1, 9, 1).map((idx) => (
<Grid item sm={3}>
<FileInputForms
key={idx}
isDisabled={idx === 1 ? false : typeof contads[`scContad${idx - 1}`] === 'undefined'}
fieldName="scContad"
index={idx}
@ -281,12 +284,12 @@ const JudgeDataNewForm = ({ scDatagb, contDocs, ingbs, handleModalSave }) => {
))}
</Grid>
</Grid>
<Grid container spacing={1} item xs={12} mt={1}>
<Grid container spacing={1} mt={1}>
<Grid item xs={12}>
<Divider />
</Grid>
</Grid>
<Grid item container spacing={0.5} xs={12} mt={1}>
<Grid container spacing={0.5} mt={1}>
<Grid item style={{ marginLeft: 'auto' }}>
{/* <Button variant="contained" color="primary" size="small" startIcon={<IconFileExport />} onClick={onSave}> */}
<Button variant="contained" color="primary" size="small" onClick={onSave}>

@ -168,7 +168,7 @@ const ModifyPublicBoardForm = (props) => {
<Grid container spacing={1} mt={1}>
<Grid item xs={8}>
<FileForm
isDownload={!!rowData?.inFilename}
isDownload={!!rowData?.inFilename || false}
isDisabled={!owner}
labelName="첨부파일"
savedFilename={rowData.inFilename}

@ -1,42 +0,0 @@
import { Button, Grid, TextField } from '@mui/material';
import { FileUpload } from '@mui/icons-material';
import PropTypes from 'prop-types';
const FileInputForm = ({ labelName, selectedFile, handleChangeFile, alert }) => {
const onChangeFile = (e) => {
const file = e.target.files[0];
if (file.type.includes('image')) {
alert.show(<img alt={`${file.name}`} src={URL.createObjectURL(file)} style={{ margin: 'auto' }} />);
}
handleChangeFile(file);
};
return (
<Grid container item spacing={0.5}>
<Grid item xs={12} sm={7.5}>
<TextField
placeholder={labelName}
value={selectedFile}
size="small"
startIcon={<FileUpload stroke={1.5} size="1rem" />}
onClick={() => {}}
/>
</Grid>
<Grid item xs={12} sm={4.5}>
<Button variant="contained" component="label" color="primary" size="small" startIcon={<FileUpload stroke={1.5} size="1rem" />}>
파일
<input type="file" hidden onChange={onChangeFile} />
</Button>
</Grid>
</Grid>
);
};
FileInputForm.propTypes = {
labelName: PropTypes.string.isRequired,
selectedFile: PropTypes.string,
handleChangeFile: PropTypes.func.isRequired,
alert: PropTypes.object.isRequired
};
export default FileInputForm;

@ -26,7 +26,7 @@ const FileInputForms = ({ fieldName, index, labelName, selectedFile, fileName, h
<Grid item xs={12} sm={4.5}>
<Button disabled={isDisabled} variant="contained" component="label" color="primary" size="small" startIcon={<FileUpload />}>
파일
<input type="file" name={fieldName} data-index={index} hidden onChange={onChangeFile} />
<input type="file" name={fieldName || ''} hidden onChange={onChangeFile} />
</Button>
</Grid>
</Grid>
@ -36,7 +36,7 @@ const FileInputForms = ({ fieldName, index, labelName, selectedFile, fileName, h
FileInputForms.propTypes = {
fieldName: PropTypes.string.isRequired,
index: PropTypes.number.isRequired,
labelName: PropTypes.number.isRequired,
labelName: PropTypes.string.isRequired,
selectedFile: PropTypes.string,
fileName: PropTypes.string,
isDisabled: PropTypes.bool.isRequired,

@ -1,45 +0,0 @@
import { Button, Grid, TextField, Typography } from '@mui/material';
import { FileUpload } from '@mui/icons-material';
import PropTypes from 'prop-types';
const FileReadInputForm = ({ labelName, selectedFile, handleChangeFile, alert }) => {
const onChangeFile = (e) => {
const file = e.target.files[0];
if (file.type.includes('image')) {
alert.show(<img alt={`${file.name}`} src={URL.createObjectURL(file)} style={{ margin: 'auto' }} />);
}
handleChangeFile(file);
};
return (
<Grid container item spacing={0.5}>
<Grid item xs={12} sm={7.5}>
<TextField
placeholder={labelName}
value={selectedFile}
size="small"
startIcon={<FileUpload stroke={1.5} size="1rem" />}
onClick={() => {}}
/>
</Grid>
<Grid item xs={12} sm={4.5}>
<Button variant="contained" component="label" color="primary" size="small" startIcon={<FileUpload stroke={1.5} size="1rem" />}>
파일
<input type="file" hidden onChange={onChangeFile} />
</Button>
</Grid>
<Grid>
<Typography variant="h4">{selectedFile}</Typography>
</Grid>
</Grid>
);
};
FileReadInputForm.propTypes = {
labelName: PropTypes.number.isRequired,
selectedFile: PropTypes.string,
handleChangeFile: PropTypes.func.isRequired,
alert: PropTypes.object.isRequired
};
export default FileReadInputForm;

@ -1,23 +0,0 @@
import React from 'react';
const Filedownload = () => {
useEffect(() => {
if (fileData) {
const url = window.URL.createObjectURL(new Blob([fileData.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'test.xlsx');
link.setAttribute('id', 'tempLink');
document.body.appendChild(link);
link.click();
}
return () => {
const link = document.querySelector('#tempLink');
link && link.remove();
};
}, [fileData]);
return <div />;
};
export default Filedownload;
Loading…
Cancel
Save