From ed10d9bf2ab1af189cb1ed87e36239a5a10eb4be Mon Sep 17 00:00:00 2001 From: minuk926 Date: Mon, 9 May 2022 18:41:48 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=8B=AC=EC=82=AC=EC=9E=90=20=EC=8B=AC?= =?UTF-8?q?=EC=82=AC=ED=99=94=EB=A9=B4=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/judge.js | 16 +- src/views/biz/judge/ProcessJudge.jsx | 100 ++++------ src/views/biz/judge/ProcessParkingJudge.jsx | 181 +++++++++--------- src/views/cmm/ImgItem.js | 39 ++++ .../auth-forms/AuthForgotPassword.js | 2 +- .../authentication/auth-forms/AuthRegister.js | 4 +- 6 files changed, 174 insertions(+), 168 deletions(-) create mode 100644 src/views/cmm/ImgItem.js diff --git a/src/apis/judge.js b/src/apis/judge.js index 1cc4243..faf64a1 100644 --- a/src/apis/judge.js +++ b/src/apis/judge.js @@ -179,14 +179,14 @@ async function judgeImgList(res, scCode, fieldCnt, fieldName, dataGb, methodName // eslint-disable-next-line no-await-in-loop await judgeImgDownload({ scDatagb: dataGb, scCode, methodName: `${methodName}${idx}` }, alert).then((r) => { if (r.size > 0) { - arrRtn.push(URL.createObjectURL(r)); + arrRtn.push({ imgName: res?.data[`${fieldName}${idx}`], url: URL.createObjectURL(r) }); } else { - arrRtn.push('/images/noFile.png'); + arrRtn.push({ imgName: res?.data[`${fieldName}${idx}`], url: '/images/noFile.png' }); } // else }); // .then((r) => { } else { - arrRtn.push('/images/noImage.png'); + arrRtn.push({ imgName: '', url: '/images/noImage.png' }); } } return arrRtn; @@ -198,16 +198,16 @@ export async function findImages(row, alert) { const res = await findJudge(scCode); if (res.success) { - const [picadImgs, frecadImgs, contadImgs] = await Promise.all([ - judgeImgList(res, scCode, 5, 'scPicad', dataGb, 'getScPicad', alert), + 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, 9, 'scContad', dataGb, 'getScContad', alert), + judgeImgList(res, scCode, 5, 'scPicad', dataGb, 'getScPicad', alert) ]); return { - arrPicadImg: picadImgs, arrFrecadImg: frecadImgs, - arrContadImg: contadImgs + arrContadImg: contadImgs, + arrPicadImg: picadImgs }; } return res; diff --git a/src/views/biz/judge/ProcessJudge.jsx b/src/views/biz/judge/ProcessJudge.jsx index 1849cd8..56ca859 100644 --- a/src/views/biz/judge/ProcessJudge.jsx +++ b/src/views/biz/judge/ProcessJudge.jsx @@ -1,43 +1,29 @@ import { useEffect, useRef, useState } from 'react'; import PropTypes from 'prop-types'; -import ReactPDF, { PDFViewer, Page, Text, View, Document, StyleSheet } from '@react-pdf/renderer'; - -import { Button, CardMedia, Divider, FormControl, Grid, InputLabel, MenuItem, Select, TextField } from '@mui/material'; +import { Button, Divider, FormControl, Grid, ImageList, InputLabel, MenuItem, Select, TextField } from '@mui/material'; import { findImages, saveJudgeResult } from 'apis/judge'; import { SkipNext, SkipPrevious, Save } from '@mui/icons-material'; -import BasicDocument from './BasicDocument'; - -// Create styles -const styles = StyleSheet.create({ - page: { - flexDirection: 'row', - backgroundColor: '#E4E4E4' - }, - section: { - margin: 10, - padding: 10, - flexGrow: 1 - } -}); +import ImgItem from '../../cmm/ImgItem'; const ProcessJudge = (props) => { const { rowDatas, setOpen, showAlert } = props; const pageRef = useRef(0); const totalPageRef = useRef(0); const curDataRef = useRef({}); - const [picadImgs, setPicadImgs] = useState([]); const [frecadImgs, setFrecadImgs] = useState([]); const [contadImgs, setContadImgs] = useState([]); + const [picadImgs, setPicadImgs] = useState([]); const [reason, setReason] = useState(); const [selectedResult, setSelectedResult] = useState(); + const [selectedImg, setSelectedImg] = useState({}); const getImgList = (row) => { findImages(row, showAlert).then((res) => { - const { arrPicadImg, arrFrecadImg, arrContadImg } = res; - setPicadImgs(arrPicadImg); + const { arrFrecadImg, arrContadImg, arrPicadImg } = res; setFrecadImgs(arrFrecadImg); setContadImgs(arrContadImg); + setPicadImgs(arrPicadImg); }); }; @@ -71,11 +57,13 @@ const ProcessJudge = (props) => { setOpen(false); }; - const printPdf = () => { - alert('적용예정'); - // ReactPDF.render(, `${__dirname}/example.pdf`); - // ReactPDF.renderToStream(); - // ReactPDF.PDFViewer(); + const viewImage = (imgInfo) => () => { + if (imgInfo.url === '/images/noFile.png') { + showAlert.show(`업로드 파일[${imgInfo.imgName}]을 찾을수 없습니다`); + } else { + setSelectedImg(imgInfo); + } + // viewImages(imgName, url); }; useEffect(() => { @@ -91,52 +79,33 @@ const ProcessJudge = (props) => { <> - - {picadImgs?.map((img, idx) => ( - - - - ))} - - - + {frecadImgs?.map((img, idx) => ( - - - + ))} - - - + + {contadImgs?.map((img, idx) => ( - - - + ))} - + + + {picadImgs?.map((img, idx) => ( + + ))} + - + {selectedImg && ( + {selectedImg.imgName} + )} @@ -221,11 +190,6 @@ const ProcessJudge = (props) => { 심의처리 - - -