feat: 자료관리 상세 반영
parent
1db73f0438
commit
2a6534630f
@ -0,0 +1,268 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
import PropTypes from 'prop-types';
|
||||
import NumberFormat from 'react-number-format';
|
||||
import { useAlert } from 'react-alert';
|
||||
|
||||
import _ from 'lodash';
|
||||
|
||||
import { Grid, TextField, MenuItem, Select, FormControl, InputLabel, InputAdornment, Divider } from '@mui/material';
|
||||
import Button from '@mui/material/Button';
|
||||
import { IconSearch, IconFileDownload } from '@tabler/icons';
|
||||
|
||||
import { judgeFileDownload } from '../../../apis/judge';
|
||||
import { Delete, FileDownload, FileUpload, List } from '@mui/icons-material';
|
||||
import ImageFileTextForm from '../../cmm/ImageFileTextForm';
|
||||
|
||||
// const toDate = new Date();
|
||||
|
||||
const ModifyJudgeDataForm = ({ rowData, handleModalSave, setOpen, contDocs, ingbs }) => {
|
||||
const showAlert = useAlert();
|
||||
|
||||
const [selectedContDoc, setSelectedContDoc] = useState(rowData.scContDoc);
|
||||
const [selectedIngb, setSelectedIngb] = useState(rowData.scIngb);
|
||||
|
||||
const onModify = () => {};
|
||||
|
||||
const onList = () => {
|
||||
setOpen(false);
|
||||
};
|
||||
|
||||
const onRemove = () => {
|
||||
handleModalSave('DELETE', rowData.scCode);
|
||||
};
|
||||
|
||||
const viewImg = (methodName) => {
|
||||
judgeFileDownload(
|
||||
{
|
||||
scDatagb: rowData.scDatagb,
|
||||
scCode: rowData.scCode,
|
||||
methodName
|
||||
},
|
||||
showAlert
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Grid mt={2}>
|
||||
<Grid container spacing={0.5} item xs={12} mb={1.5}>
|
||||
<Grid item sm={3}>
|
||||
<TextField disabled required label="차량번호" size="small" fullWidth value={rowData.scCarnum} autoFocus />
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<TextField disabled required label="성명" size="small" fullWidth value={rowData.scName} />
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<TextField disabled required label="동명" size="small" fullWidth value={rowData.scDong} />
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<FormControl fullWidth>
|
||||
<InputLabel disabled required>
|
||||
진술유형
|
||||
</InputLabel>
|
||||
<Select
|
||||
disabled
|
||||
size="small"
|
||||
defaultValue="11"
|
||||
value={selectedContDoc}
|
||||
onChange={(e) => setSelectedContDoc(e?.target?.value)}
|
||||
>
|
||||
{contDocs &&
|
||||
contDocs.map((contDoc) => (
|
||||
<MenuItem key={contDoc.code} value={contDoc.code}>
|
||||
{contDoc.value}
|
||||
</MenuItem>
|
||||
))}
|
||||
</Select>
|
||||
</FormControl>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container spacing={0.5} item xs={12} mb={1.5}>
|
||||
<Grid item sm={3}>
|
||||
<NumberFormat
|
||||
disabled
|
||||
size="small"
|
||||
customInput={TextField}
|
||||
required
|
||||
label="접수일자"
|
||||
format="####-##-##"
|
||||
fullWidth
|
||||
value={rowData.scCdate}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<FormControl fullWidth>
|
||||
<InputLabel disabled required>
|
||||
접수방법
|
||||
</InputLabel>
|
||||
<Select disabled size="small" defaultValue="1" value={selectedIngb} onChange={(e) => setSelectedIngb(e?.target?.value)}>
|
||||
{ingbs &&
|
||||
ingbs.map((ingb) => (
|
||||
<MenuItem key={ingb.code} value={ingb.code}>
|
||||
{ingb.value}
|
||||
</MenuItem>
|
||||
))}
|
||||
</Select>
|
||||
</FormControl>
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<NumberFormat
|
||||
disabled
|
||||
size="small"
|
||||
customInput={TextField}
|
||||
required
|
||||
label="위반일자"
|
||||
format="####-##-##"
|
||||
fullWidth
|
||||
value={rowData.scWdate}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<NumberFormat
|
||||
disabled
|
||||
size="small"
|
||||
customInput={TextField}
|
||||
required
|
||||
label="위반시간"
|
||||
format="##:##"
|
||||
fullWidth
|
||||
value={rowData.scJbtime}
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container spacing={0.5} item xs={12} mb={2}>
|
||||
<Grid item sm={6}>
|
||||
<TextField disabled size="small" required label="위반장소" fullWidth value={rowData.scPos} />
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<TextField disabled size="small" required label="전송상태" fullWidth value={rowData.scTransferNm} />
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<TextField disabled size="small" required label="자료상태" fullWidth value={rowData.scStateNm} />
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container spacing={0.5} item xs={12} mb={2}>
|
||||
<Grid item sm={1.7}>
|
||||
<TextField
|
||||
disabled
|
||||
size="small"
|
||||
fullWidth
|
||||
required
|
||||
label="우편번호"
|
||||
value={rowData.zippost1}
|
||||
InputProps={{
|
||||
display: 'none',
|
||||
readOnly: true,
|
||||
endAdornment: (
|
||||
<InputAdornment position="end">
|
||||
<IconSearch stroke={1.5} size="1rem" cursor="pointer" />
|
||||
</InputAdornment>
|
||||
)
|
||||
}}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item sm={7}>
|
||||
<TextField disabled size="small" required label="주소" fullWidth value={rowData.scJuso} />
|
||||
</Grid>
|
||||
<Grid item sm={3.3}>
|
||||
<TextField disabled size="small" required label="번지" fullWidth value={rowData.scBunji} />
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<Grid container spacing={1} item xs={12} mt={1}>
|
||||
<Grid item sm={3}>
|
||||
<ImageFileTextForm labelName="단속사진1" fileName={rowData.scPicad1} handleViewImg={viewImg} methodName="getScPicad1" />
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<ImageFileTextForm labelName="단속사진2" fileName={rowData.scPicad2} handleViewImg={viewImg} methodName="getScPicad2" />
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<ImageFileTextForm labelName="단속사진3" fileName={rowData.scPicad3} handleViewImg={viewImg} methodName="getScPicad3" />
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<ImageFileTextForm labelName="단속사진4" fileName={rowData.scPicad4} handleViewImg={viewImg} methodName="getScPicad4" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container spacing={1} item xs={12} mt={1}>
|
||||
<Grid item sm={3}>
|
||||
<ImageFileTextForm labelName="진술서1" fileName={rowData.scFrecad1} handleViewImg={viewImg} methodName="getScFrecad1" />
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<ImageFileTextForm labelName="진술서2" fileName={rowData.scFrecad2} handleViewImg={viewImg} methodName="getScFrecad2" />
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<ImageFileTextForm labelName="진술서3" fileName={rowData.scFrecad3} handleViewImg={viewImg} methodName="getScFrecad3" />
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<ImageFileTextForm labelName="진술서4" fileName={rowData.scFrecad4} handleViewImg={viewImg} methodName="getScFrecad4" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container spacing={1} item xs={12} mt={1}>
|
||||
{/* {_.range(1, 9, 1).map((idx) => { */}
|
||||
{/* // eslint-disable-next-line no-eval */}
|
||||
{/* const fName = `rowData.scContad${idx}`; */}
|
||||
{/* return ( */}
|
||||
{/* <Grid item sm={3}> */}
|
||||
{/* <ImageFileTextForm labelName={`첨부자료${idx}`} fileName={fName} handleViewImg={viewImg} methodName={`getScContad${idx}`} /> */}
|
||||
{/* </Grid> */}
|
||||
{/* ); */}
|
||||
{/* })} */}
|
||||
|
||||
<Grid item sm={3}>
|
||||
<ImageFileTextForm labelName="첨부자료1" fileName={rowData.scContad1} handleViewImg={viewImg} methodName="getScContad1" />
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<ImageFileTextForm labelName="첨부자료2" fileName={rowData.scContad2} handleViewImg={viewImg} methodName="getScContad2" />
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<ImageFileTextForm labelName="첨부자료3" fileName={rowData.scContad3} handleViewImg={viewImg} methodName="getScContad3" />
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<ImageFileTextForm labelName="첨부자료4" fileName={rowData.scContad4} handleViewImg={viewImg} methodName="getScContad4" />
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<ImageFileTextForm labelName="첨부자료5" fileName={rowData.scContad5} handleViewImg={viewImg} methodName="getScContad5" />
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<ImageFileTextForm labelName="첨부자료6" fileName={rowData.scContad6} handleViewImg={viewImg} methodName="getScContad6" />
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<ImageFileTextForm labelName="첨부자료7" fileName={rowData.scContad7} handleViewImg={viewImg} methodName="getScContad7" />
|
||||
</Grid>
|
||||
<Grid item sm={3}>
|
||||
<ImageFileTextForm labelName="첨부자료8" fileName={rowData.scContad8} handleViewImg={viewImg} methodName="getScContad8" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container spacing={1} item xs={12} mt={1}>
|
||||
<Grid item xs={12}>
|
||||
<Divider />
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid item container spacing={0.5} xs={12} mt={1}>
|
||||
<Grid item>
|
||||
<Button variant="contained" size="small" startIcon={<List />} onClick={onList}>
|
||||
목록
|
||||
</Button>
|
||||
</Grid>
|
||||
<Grid item style={{ marginLeft: 'auto' }}>
|
||||
<Button variant="contained" color="primary" size="small" onClick={onModify}>
|
||||
변경하기
|
||||
</Button>
|
||||
</Grid>
|
||||
<Grid item>
|
||||
<Button variant="contained" size="small" startIcon={<Delete />} onClick={onRemove}>
|
||||
삭제
|
||||
</Button>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</>
|
||||
);
|
||||
};
|
||||
ModifyJudgeDataForm.propTypes = {
|
||||
rowData: PropTypes.object.isRequired,
|
||||
handleModalSave: PropTypes.func.isRequired,
|
||||
setOpen: PropTypes.func.isRequired
|
||||
};
|
||||
export default ModifyJudgeDataForm;
|
@ -0,0 +1,37 @@
|
||||
import { InputAdornment, TextField } from '@mui/material';
|
||||
import { FileDownload } from '@mui/icons-material';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
const ImageFileTextForm = ({ labelName, fileName = '', methodName, handleViewImg }) => (
|
||||
<>
|
||||
{fileName && (
|
||||
<TextField
|
||||
disabled
|
||||
size="small"
|
||||
fullWidth
|
||||
label={labelName}
|
||||
value={fileName}
|
||||
onClick={(e) => handleViewImg(methodName)}
|
||||
InputProps={{
|
||||
display: 'none',
|
||||
endAdornment: (
|
||||
<InputAdornment position="end">
|
||||
<FileDownload stroke={1.5} size="1rem" cursor="pointer" />
|
||||
</InputAdornment>
|
||||
)
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{!fileName && (
|
||||
<TextField disabled size="small" fullWidth label={labelName} value={fileName} onClick={(e) => handleViewImg(methodName)} />
|
||||
)}
|
||||
</>
|
||||
);
|
||||
ImageFileTextForm.propTypes = {
|
||||
labelName: PropTypes.string.isRequired,
|
||||
fileName: PropTypes.string,
|
||||
methodName: PropTypes.string.isRequired,
|
||||
handleViewImg: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
export default ImageFileTextForm;
|
Loading…
Reference in New Issue