diff --git a/src/apis/judge.js b/src/apis/judge.js index 16047e3..db95379 100644 --- a/src/apis/judge.js +++ b/src/apis/judge.js @@ -169,7 +169,7 @@ export async function findByUserJudges(params) { } // eslint-disable-next-line consistent-return -async function judgeImgDownload(params, alert) { +export async function judgeImgDownload(params) { // const res = await // eslint-disable-next-line no-return-await return await axios.get(GET_JUDGE_FILE_DOWNLOAD, { @@ -178,13 +178,13 @@ async function judgeImgDownload(params, alert) { }); } -async function judgeImgList(res, scCode, fieldCnt, fieldName, dataGb, methodName, alert) { +async function judgeImgList(res, scCode, fieldCnt, fieldName, dataGb, methodName) { const arrRtn = []; // eslint-disable-next-line no-restricted-syntax for (const idx of _.range(1, fieldCnt, 1)) { if (res?.data[`${fieldName}${idx}`]) { // eslint-disable-next-line no-await-in-loop - await judgeImgDownload({ scDatagb: dataGb, scCode, methodName: `${methodName}${idx}` }, alert).then((r) => { + await judgeImgDownload({ scDatagb: dataGb, scCode, methodName: `${methodName}${idx}` }).then((r) => { if (r.size > 0) { arrRtn.push({ imgName: res?.data[`${fieldName}${idx}`], url: URL.createObjectURL(r) }); } else { @@ -199,16 +199,16 @@ async function judgeImgList(res, scCode, fieldCnt, fieldName, dataGb, methodName return arrRtn; } -export async function findImages(row, alert) { +export async function findImages(row) { const dataGb = row?.msDatagb; const scCode = row?.msMaincode; const res = await findJudge(scCode); if (res.success) { const [frecadImgs, contadImgs, picadImgs] = await Promise.all([ - judgeImgList(res, scCode, 5, 'scFrecad', dataGb, 'getScFrecad', alert), - judgeImgList(res, scCode, 9, 'scContad', dataGb, 'getScContad', alert), - judgeImgList(res, scCode, 5, 'scPicad', dataGb, 'getScPicad', alert) + judgeImgList(res, scCode, 5, 'scFrecad', dataGb, 'getScFrecad'), + judgeImgList(res, scCode, 9, 'scContad', dataGb, 'getScContad'), + judgeImgList(res, scCode, 5, 'scPicad', dataGb, 'getScPicad') ]); return { diff --git a/src/views/biz/admin/judge/JudgeDataDetailForm.jsx b/src/views/biz/admin/judge/JudgeDataDetailForm.jsx index 85e03cf..0a50791 100644 --- a/src/views/biz/admin/judge/JudgeDataDetailForm.jsx +++ b/src/views/biz/admin/judge/JudgeDataDetailForm.jsx @@ -9,14 +9,19 @@ import { Grid, TextField, MenuItem, Select, FormControl, InputLabel, Divider } f import Button from '@mui/material/Button'; import { Delete, List } from '@mui/icons-material'; -import { judgeFileDownload } from 'apis/judge'; +import { judgeFileDownload, judgeImgDownload } from 'apis/judge'; import ImageFileViewForm from '../../../cmm/file-ctl/ImageFileViewForm'; +import CmmImgViewModal from '../../../cmm/CmmImgViewModal'; const ModifyJudgeDataForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSave, onModify }) => { const showAlert = useAlert(); const [selectedContDoc, setSelectedContDoc] = useState(rowData?.scContDoc); const [selectedIngb, setSelectedIngb] = useState(rowData?.scIngb); + const [childOpen, setChildOpen] = useState(false); + const [childTitle, setChildTitle] = useState(); + const [imgUrl, setImgUrl] = useState(); + const [imgName, setImgName] = useState(); const onList = () => { setOpen(false); @@ -30,15 +35,18 @@ const ModifyJudgeDataForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav } }; - const viewImg = (methodName) => { - judgeFileDownload( - { - scDatagb: rowData.scDatagb, - scCode: rowData.scCode, - methodName - }, - showAlert - ); + const viewImg = async (methodName) => { + // judgeFileDownload( + const res = await judgeImgDownload({ + scDatagb: rowData.scDatagb, + scCode: rowData.scCode, + methodName + }); + console.log(res); + setChildTitle('ddd'); + setChildOpen(true); + setImgUrl(res); + setImgName('dddd'); }; return ( @@ -156,7 +164,7 @@ const ModifyJudgeDataForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav required label="위반장소" fullWidth - value={rowData?.scPos} + value={rowData?.scPos || ''} /> @@ -231,6 +239,7 @@ const ModifyJudgeDataForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav + ); }; diff --git a/src/views/biz/judge/ProcessJudge.jsx b/src/views/biz/judge/ProcessJudge.jsx index 56ca859..e4e7f28 100644 --- a/src/views/biz/judge/ProcessJudge.jsx +++ b/src/views/biz/judge/ProcessJudge.jsx @@ -19,7 +19,7 @@ const ProcessJudge = (props) => { const [selectedImg, setSelectedImg] = useState({}); const getImgList = (row) => { - findImages(row, showAlert).then((res) => { + findImages(row).then((res) => { const { arrFrecadImg, arrContadImg, arrPicadImg } = res; setFrecadImgs(arrFrecadImg); setContadImgs(arrContadImg); diff --git a/src/views/biz/judge/ProcessParkingJudge.jsx b/src/views/biz/judge/ProcessParkingJudge.jsx index cfc8f0a..d80aa2f 100644 --- a/src/views/biz/judge/ProcessParkingJudge.jsx +++ b/src/views/biz/judge/ProcessParkingJudge.jsx @@ -19,7 +19,7 @@ const ProcessParkingJudge = (props) => { const [selectedImg, setSelectedImg] = useState({}); const getImgList = (row) => { - findImages(row, showAlert).then((res) => { + findImages(row).then((res) => { const { arrFrecadImg, arrContadImg, arrPicadImg } = res; setFrecadImgs(arrFrecadImg); setContadImgs(arrContadImg); diff --git a/src/views/cmm/CmmImgViewModal.jsx b/src/views/cmm/CmmImgViewModal.jsx new file mode 100644 index 0000000..8559b45 --- /dev/null +++ b/src/views/cmm/CmmImgViewModal.jsx @@ -0,0 +1,60 @@ +import PropTypes from 'prop-types'; + +import Modal from '@mui/material/Modal'; +import { Grid, IconButton } from '@mui/material'; +import CloseOutlined from '@mui/icons-material/CloseOutlined'; +import MainCard from 'ui-component/cards/MainCard'; + +const style = { + position: 'relative', + top: '50%', + left: '50%', + transform: 'translate(-50%, -50%)', + width: 1050, + minHeight: 500, + bgcolor: 'background.paper', + border: '2px solid #000', + boxShadow: 24, + p: 3 +}; + +const CmmImgViewModal = ({ isBackdrop = false, open, setOpen, title, imgUrl, imgName }) => { + const handleClose = () => { + setOpen(false); + }; + + return ( +
+ {/* */} + + + + + } + > + + + {imgName} + + + + +
+ ); +}; + +CmmImgViewModal.propTypes = { + isBackdrop: PropTypes.bool, + open: PropTypes.bool, + setOpen: PropTypes.func, + title: PropTypes.string, + imgUrl: PropTypes.object, + imgName: PropTypes.string +}; + +export default CmmImgViewModal;