From 681fd8060b753b65bcfc405b74aea975c58f54b6 Mon Sep 17 00:00:00 2001 From: minuk926 Date: Wed, 4 May 2022 14:23:38 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=8B=AC=EC=82=AC=EC=9E=90=20=EC=8B=AC?= =?UTF-8?q?=EC=9D=98=20=EC=A7=84=ED=96=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 11 ++++ src/apis/judge.js | 2 - src/views/biz/judge/JudgeByUserReview.jsx | 21 ++++--- src/views/biz/judge/ProcessJudge.jsx | 76 +++++++++++++++++++---- 4 files changed, 86 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index d4ae8e0..7658171 100755 --- a/README.md +++ b/README.md @@ -134,3 +134,14 @@ docker run --rm -d --name opst-fo-local -p 3000:80 opst-fo-local:latest docker build -t opst-fo . docker run --rm -d --name opst-fo -p 80:80 opst-fo:latest ``` + +### Array.from usage +```js + + {Array.from(Array(6)).map((_, index) => ( + + xs=2 + + ))} + +``` \ No newline at end of file diff --git a/src/apis/judge.js b/src/apis/judge.js index 93b5910..139b8ef 100644 --- a/src/apis/judge.js +++ b/src/apis/judge.js @@ -177,12 +177,10 @@ async function judgeImgList(res, scCode, fieldCnt, fieldName, dataGb, methodName if (res?.data[`${fieldName}${idx}`]) { // eslint-disable-next-line no-await-in-loop await judgeImgDownload({ scDatagb: dataGb, scCode, methodName: `${methodName}${idx}` }, alert).then((r) => { - console.log(r); if (r.size > 0) arrRtn.push(URL.createObjectURL(r)); }); // .then((r) => { } } - console.log(arrRtn); return arrRtn; } diff --git a/src/views/biz/judge/JudgeByUserReview.jsx b/src/views/biz/judge/JudgeByUserReview.jsx index 8d41348..815e8c4 100644 --- a/src/views/biz/judge/JudgeByUserReview.jsx +++ b/src/views/biz/judge/JudgeByUserReview.jsx @@ -56,12 +56,19 @@ const JudgeByUserReview = ({ msDatagb, menuName }) => { }); }, [msDatagb]); - const processJudge = (row) => () => { - setTitle(`${menuName} 심의 - ${row.msSeq}`); - setRowDatas([row]); + const onJudge = () => { + setRowDatas(rowsState?.rows); setOpen(true); }; + const processJudge = useCallback( + (row) => () => { + setRowDatas([row]); + setOpen(true); + }, + [] + ); + const columns = [ // { headerName: 'rowId', field: 'rowId' }, { @@ -152,16 +159,10 @@ const JudgeByUserReview = ({ msDatagb, menuName }) => { const handleSearch = async (event) => { if (event.type === 'keydown' && event.key === 'Enter') { - const newString = event?.target.value; search(); } }; - const onJudge = useCallback(() => { - setTitle(`${menuName} 심의`); - setRowDatas(rowsState?.rows); - setOpen(true); - }, []); useEffect(() => { search(); // }, [rowsState.page, rowsState.pageSize, selectedYear, searchTxt]); @@ -227,7 +228,7 @@ const JudgeByUserReview = ({ msDatagb, menuName }) => { // selectionModel={selectionModel} /> - + ); diff --git a/src/views/biz/judge/ProcessJudge.jsx b/src/views/biz/judge/ProcessJudge.jsx index 4609e0b..88c83d0 100644 --- a/src/views/biz/judge/ProcessJudge.jsx +++ b/src/views/biz/judge/ProcessJudge.jsx @@ -1,10 +1,15 @@ -import React, { useEffect, useState } from 'react'; -import { CardMedia, Grid } from '@mui/material'; -import { findImages } from '../../../apis/judge'; -import _ from 'lodash'; +import { useEffect, useRef, useState } from 'react'; +import PropTypes from 'prop-types'; + +import { Button, CardMedia, Divider, Grid } from '@mui/material'; +import { findImages } from 'apis/judge'; +import { SkipNext, SkipPrevious, Save } from '@mui/icons-material'; const ProcessJudge = (props) => { - const { rowDatas, showAlert } = props; + const { setTitle, rowDatas, showAlert } = props; + const title = rowDatas[0].msDatagb === '1' ? '거주자 심의' : '장애인 심의'; + const pageRef = useRef(0); + const totalPageRef = useRef(0); const [picadImgs, setPicadImgs] = useState([]); const [frecadImgs, setFrecadImgs] = useState([]); const [contadImgs, setContadImgs] = useState([]); @@ -13,20 +18,36 @@ const ProcessJudge = (props) => { findImages(row, showAlert).then((res) => { const { arrPicadImg, arrFrecadImg, arrContadImg } = res; console.log(res); - // console.log(arrPicadImg, arrFrecadImg, arrContadImg); setPicadImgs(arrPicadImg); setFrecadImgs(arrFrecadImg); setContadImgs(arrContadImg); }); }; + const onPrev = () => { + pageRef.current -= 1; + setTitle(`${title} [ 접수번호 : ${rowDatas[pageRef.current].msSeq}]`); + getImgList(rowDatas[pageRef.current]); + console.log(pageRef.current, rowDatas[pageRef.current]); + }; + const onNext = () => { + pageRef.current += 1; + setTitle(`${title} [ 접수번호 : ${rowDatas[pageRef.current].msSeq}]`); + getImgList(rowDatas[pageRef.current]); + console.log(pageRef.current, rowDatas[pageRef.current]); + }; + const onSave = () => {}; + useEffect(() => { - getImgList(rowDatas[0]); + pageRef.current = 0; + totalPageRef.current = rowDatas.length - 1; + setTitle(`${title} [ 접수번호 : ${rowDatas[pageRef.current].msSeq}]`); + getImgList(rowDatas[pageRef.current]); }, []); return ( <> - + {picadImgs?.map((img, idx) => ( { ))} + {frecadImgs?.map((img, idx) => ( @@ -58,6 +80,7 @@ const ProcessJudge = (props) => { ))} + {contadImgs?.map((img, idx) => ( @@ -74,13 +97,42 @@ const ProcessJudge = (props) => { ))} + + + + + + + + + + + + + + + + ); }; -// ProcessJudge.propTypes = { -// rowDatas: PropTypes.object.isRequired, -// showAlert: PropTypes.object -// }; +ProcessJudge.propTypes = { + rowDatas: PropTypes.object.isRequired, + showAlert: PropTypes.object, + setTitle: PropTypes.func.isRequired +}; export default ProcessJudge;