From f6366a6818be5b39d9ec486773f44f5a617eda74 Mon Sep 17 00:00:00 2001 From: minuk926 Date: Wed, 6 Apr 2022 21:06:39 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=A3=BC=EC=A0=95=EC=B0=A8=EC=9D=98?= =?UTF-8?q?=EA=B2=AC=EC=A7=84=EC=88=A0=20=EC=9E=90=EB=A3=8C=20=EB=93=B1?= =?UTF-8?q?=EB=A1=9D=20=EB=B0=98=EC=98=81=20=20=20=20=20=20=20=EC=86=8C?= =?UTF-8?q?=EC=8A=A4=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/board.js | 2 +- src/apis/parking.js | 36 +- src/apis/public.js | 2 +- src/apis/resident.js | 4 +- src/commons/ApiUrl.js | 8 +- src/views/biz/board/Board.jsx | 4 +- src/views/biz/board/PublicBoard.jsx | 4 +- src/views/biz/parking/Regist.jsx | 6 +- src/views/biz/parking/Review.jsx | 4 +- .../biz/resident/ModifyResidentDataForm.jsx | 454 ++++++++++++++++++ ...ntDataForm.jsx => NewResidentDataForm.jsx} | 13 +- src/views/biz/resident/Regist.jsx | 207 ++++++++ src/views/biz/resident/Review.jsx | 44 +- .../biz/resident/SaveResidentSimsaForm.jsx | 172 +++++++ src/views/form/FileInputForms.jsx | 5 +- 15 files changed, 915 insertions(+), 50 deletions(-) create mode 100644 src/views/biz/resident/ModifyResidentDataForm.jsx rename src/views/biz/resident/{SaveResidentDataForm.jsx => NewResidentDataForm.jsx} (96%) create mode 100644 src/views/biz/resident/Regist.jsx create mode 100644 src/views/biz/resident/SaveResidentSimsaForm.jsx diff --git a/src/apis/board.js b/src/apis/board.js index e006e25..8f6b8c3 100644 --- a/src/apis/board.js +++ b/src/apis/board.js @@ -7,7 +7,7 @@ import { GET_BOARD_LIST } from 'commons/ApiUrl'; import { setRowId } from './common'; // eslint-disable-next-line import/prefer-default-export -export async function getBoardList(params) { +export async function findBoars(params) { const res = await axios.get(GET_BOARD_LIST, { params }); if (res.success) { res.data = res.data.map((d, idx) => ({ ...d, rowId: setRowId(params, idx) })); diff --git a/src/apis/parking.js b/src/apis/parking.js index b1d0bf2..5341ce7 100644 --- a/src/apis/parking.js +++ b/src/apis/parking.js @@ -3,17 +3,12 @@ //---------------------------------------------------------------------------- import axios from 'utils/axios'; -import { - GET_PARKING_SIMSA_DETAILS_LIST, - GET_PARKING_SIMSA_LIST, - GET_PARKING_SIMSA_TARGET_LIST, - SAVE_PARKING_SIMSA_TARGET -} from 'commons/ApiUrl'; +import { GET_PARKING_LIST, GET_PARKING_TARGET_LIST, SAVE_PARKING_TARGET_LIST } from 'commons/ApiUrl'; import { setRowId } from './common'; // eslint-disable-next-line no-return-await -export async function getSimsa680GroupList(params) { - const res = await axios.get(GET_PARKING_SIMSA_LIST, { params }); +export async function findParkings(params) { + const res = await axios.get(GET_PARKING_LIST, { params }); if (res.success) { res.data = res.data.map((d, idx) => ({ ...d, rowId: setRowId(params, idx) })); return res; @@ -21,8 +16,8 @@ export async function getSimsa680GroupList(params) { return res; } -export async function getSimsa680DetailList(params) { - const res = await axios.get(GET_PARKING_SIMSA_DETAILS_LIST, { params }); +export async function findParkingTargets(params) { + const res = await axios.get(GET_PARKING_TARGET_LIST, { params }); if (res.success) { res.data = res.data.map((d, idx) => ({ ...d, rowId: setRowId(params, idx) })); return res; @@ -30,20 +25,19 @@ export async function getSimsa680DetailList(params) { return res; } -export async function getSimsaTargetList(params) { - const res = await axios.get(GET_PARKING_SIMSA_TARGET_LIST, { params }); +export async function saveParkingTargets(params) { + const res = await axios.post(SAVE_PARKING_TARGET_LIST, params); if (res.success) { - res.data = res.data.map((d, idx) => ({ ...d, rowId: setRowId(params, idx) })); return res; } return res; } -export async function saveSimsaTargetList(params) { - const res = await axios.post(SAVE_PARKING_SIMSA_TARGET, params); - if (res.success) { - res.data = res.data.map((d, idx) => ({ ...d, rowId: setRowId(params, idx) })); - return res; - } - return res; -} +// export async function findParkingDetails(params) { +// const res = await axios.get(GET_PARKING_DETAILS_LIST, { params }); +// if (res.success) { +// res.data = res.data.map((d, idx) => ({ ...d, rowId: setRowId(params, idx) })); +// return res; +// } +// return res; +// } diff --git a/src/apis/public.js b/src/apis/public.js index f310456..5187f24 100644 --- a/src/apis/public.js +++ b/src/apis/public.js @@ -6,7 +6,7 @@ import axios from 'utils/axios'; import { DELETE_PUBLIC_BOARD, GET_PUBLIC_BOARD_LIST, SAVE_PUBLIC_BOARD, SAVE_PUBLIC_BOARD_HIT_CNT } from 'commons/ApiUrl'; import { setRowId } from './common'; -export async function getPublicBoardList(params) { +export async function findPublicBoards(params) { // return async () => { const res = await axios.get(GET_PUBLIC_BOARD_LIST, { params }); if (res.success) { diff --git a/src/apis/resident.js b/src/apis/resident.js index 46beae0..297ece2 100644 --- a/src/apis/resident.js +++ b/src/apis/resident.js @@ -7,7 +7,7 @@ import { GET_RESIDENT, GET_RESIDENT_DATA_LIST, SAVE_RESIDENT_DATA } from 'common import { setRowId } from './common'; // eslint-disable-next-line no-return-await -export async function getResidents(params) { +export async function findResidents(params) { const res = await axios.get(GET_RESIDENT_DATA_LIST, { params }); if (res.success) { res.data = res.data.map((d, idx) => ({ ...d, rowId: setRowId(params, idx) })); @@ -25,7 +25,7 @@ export async function saveResidentData(formData) { }); } -export async function getResident(scCode) { +export async function findResident(scCode) { const res = await axios.get(GET_RESIDENT + scCode); if (res.success) { return res; diff --git a/src/commons/ApiUrl.js b/src/commons/ApiUrl.js index 17653af..df8d4a6 100644 --- a/src/commons/ApiUrl.js +++ b/src/commons/ApiUrl.js @@ -15,10 +15,10 @@ export const DELETE_PUBLIC_BOARD = '/api/v1/ctgy/file/pboard/'; export const GET_BOARD_LIST = '/api/v1/ctgy/board'; // 주정차 의견 진술 -export const GET_PARKING_SIMSA_LIST = '/api/v1/ctgy/parking'; -export const GET_PARKING_SIMSA_DETAILS_LIST = '/api/v1/ctgy/parking/details'; -export const GET_PARKING_SIMSA_TARGET_LIST = '/api/v1/ctgy/parking/target'; -export const SAVE_PARKING_SIMSA_TARGET = '/api/v1/ctgy/parking/target'; +export const GET_PARKING_LIST = '/api/v1/ctgy/parking'; +export const GET_PARKING_TARGET_LIST = '/api/v1/ctgy/parking/target'; +export const SAVE_PARKING_TARGET_LIST = '/api/v1/ctgy/parking/target'; +// export const GET_PARKING_DETAILS_LIST = '/api/v1/ctgy/parking/details'; // 거주자 의견 진술 export const GET_RESIDENT_DATA_LIST = '/api/v1/ctgy/resident/data'; diff --git a/src/views/biz/board/Board.jsx b/src/views/biz/board/Board.jsx index de2fe3f..82063c8 100644 --- a/src/views/biz/board/Board.jsx +++ b/src/views/biz/board/Board.jsx @@ -11,7 +11,7 @@ import MainCard from 'ui-component/cards/MainCard'; // project imports import MuiDataGrid from 'views/form/MuiDataGrid'; -import { getBoardList } from '../../../apis/board'; +import { findBoars } from '../../../apis/board'; const Board = () => { const [category, setCategory] = useState('ciTitle'); @@ -63,7 +63,7 @@ const Board = () => { }; } - getBoardList(params).then((response) => { + findBoars(params).then((response) => { if (response && response.data) { setTotalCount(response.count); setRowsState((prevState) => ({ ...prevState, rows: response.data })); diff --git a/src/views/biz/board/PublicBoard.jsx b/src/views/biz/board/PublicBoard.jsx index 50f5a65..ec62bd3 100644 --- a/src/views/biz/board/PublicBoard.jsx +++ b/src/views/biz/board/PublicBoard.jsx @@ -13,7 +13,7 @@ import MainCard from 'ui-component/cards/MainCard'; import MuiDataGrid from 'views/form/MuiDataGrid'; import CmmModal from '../../form/Modal/CmmModal'; import PublicBoardForm from './PublicBoardForm'; -import { deletePublicBoard, getPublicBoardList, modifyPublicBoardHitCount, savePublicBoard } from '../../../apis/public'; +import { deletePublicBoard, findPublicBoards, modifyPublicBoardHitCount, savePublicBoard } from '../../../apis/public'; const PublicBoard = () => { const [totalCount, setTotalCount] = useState(0); @@ -67,7 +67,7 @@ const PublicBoard = () => { size: rowsState.pageSize }; - getPublicBoardList(params).then((response) => { + findPublicBoards(params).then((response) => { // console.log(response); if (response && response.data) { setTotalCount(response.count); diff --git a/src/views/biz/parking/Regist.jsx b/src/views/biz/parking/Regist.jsx index f31ae58..b2f754d 100644 --- a/src/views/biz/parking/Regist.jsx +++ b/src/views/biz/parking/Regist.jsx @@ -18,7 +18,7 @@ import CmmModal from 'views/form/Modal/CmmModal'; import SaveParkingSimsaForm from './SaveParkingSimsaForm'; import NumberFormat from 'react-number-format'; import ExcelDownload from 'views/form/ExcelDownload'; -import { getSimsaTargetList, saveSimsaTargetList } from 'apis/parking'; +import { findParkingTargets, saveParkingTargets } from 'apis/parking'; const ParkingRegister = () => { const [rcIrTransfer, setRcIrTransfer] = useState('1'); @@ -58,7 +58,7 @@ const ParkingRegister = () => { rcSeq2 }; - getSimsaTargetList(params).then((response) => { + findParkingTargets(params).then((response) => { if (response && response.data) { setTotalCount(response.count); setRowsStatus((prevRows) => ({ ...prevRows, rows: response.data })); @@ -86,7 +86,7 @@ const ParkingRegister = () => { setOpen(false); // return false; - saveSimsaTargetList(param).then(() => { + saveParkingTargets(param).then(() => { setSelection([]); search(); }); diff --git a/src/views/biz/parking/Review.jsx b/src/views/biz/parking/Review.jsx index 1c5213d..15f0d56 100644 --- a/src/views/biz/parking/Review.jsx +++ b/src/views/biz/parking/Review.jsx @@ -18,7 +18,7 @@ import MainCard from 'ui-component/cards/MainCard'; import MuiDataGrid from 'views/form/MuiDataGrid'; import xitCmm from 'commons/XitCmm'; import ModalDetails from './ModalDetails'; -import { getSimsa680GroupList } from 'apis/parking'; +import { findParkings } from 'apis/parking'; import InputLabel from '../../../ui-component/extended/Form/InputLabel'; const ParkingReview = () => { @@ -115,7 +115,7 @@ const ParkingReview = () => { size: rowsState.pageSize }; - getSimsa680GroupList({ ...params, msYear: selectedYear, msChasu: searchTxt }).then((response) => { + findParkings({ ...params, msYear: selectedYear, msChasu: searchTxt }).then((response) => { if (response && response.data) { setTotalCount(response.count); setRowsState((prevState) => ({ ...prevState, rows: response.data })); diff --git a/src/views/biz/resident/ModifyResidentDataForm.jsx b/src/views/biz/resident/ModifyResidentDataForm.jsx new file mode 100644 index 0000000..e57e368 --- /dev/null +++ b/src/views/biz/resident/ModifyResidentDataForm.jsx @@ -0,0 +1,454 @@ +import { useEffect, useState } from 'react'; + +import PropTypes from 'prop-types'; +import NumberFormat from 'react-number-format'; +import { useAlert } from 'react-alert'; +import format from 'date-fns/format'; + +import { Grid, TextField, MenuItem, Select, FormControl, InputLabel, InputAdornment } from '@mui/material'; +import Button from '@mui/material/Button'; +import { IconSearch } from '@tabler/icons'; + +import { getComboCodeList } from 'apis/common'; +import FileInputForms from 'views/form/FileInputForms'; + +const toDate = new Date(); + +const ModifyResidentDataForm = ({ rowData, handleModalSave }) => { + const alert = useAlert(); + + const [scCarnum, setScCarnum] = useState(rowData.scCarnum); + const [scName, setScName] = useState(rowData.scName); + const [scDong, setScDong] = useState(rowData.scDong); + const [scContDoc, setScContDoc] = useState(); + const [selectedContDoc, setSelectedContDoc] = useState(rowData.scContDoc); + const [scIngb, setScIngb] = useState(); + const [selectedIngb, setSelectedIngb] = useState(rowData.scIngb); + const [zippost1, setZippost1] = useState(`${rowData.zippost1}${rowData.zippost2}`); + const [scJuso, setScJuso] = useState(rowData.scJuso); + const [scBunji, setScBunji] = useState(rowData.scBunji); + const [scWdate, setScWdate] = useState(rowData.scWdate); + const [scCdate, setScCdate] = useState(rowData.scCdate); + const [scJbtime, setScJbtime] = useState(rowData.scJbtime); + const [scPos, setScPos] = useState(''); + + const [picads, setPicads] = useState({}); + const [frecads, setFrecads] = useState({}); + const [contads, setContads] = useState({}); + + const onSave = () => { + // TODO : validation check 추가 + const formData = new FormData(); + formData.append('scCarnum', scCarnum); + formData.append('scName', scName); + formData.append('scDong', scDong); + formData.append('scContDoc', selectedContDoc); + formData.append('scCdate', scCdate); + formData.append('scIngb', selectedIngb); + formData.append('scWdate', scWdate); + formData.append('scJbtime', scJbtime); + formData.append('scPos', scPos); + formData.append('zippost1', zippost1); + formData.append('scJuso', scJuso); + formData.append('scBunji', scBunji); + + Object.values(picads).forEach((v) => { + formData.append('picadFiles', v); + }); + + Object.values(frecads).forEach((v) => { + formData.append('frecadFiles', v); + }); + + Object.values(contads).forEach((v) => { + formData.append('contadFiles', v); + }); + + handleModalSave(formData); + }; + + useEffect(() => { + // setSelectedContDoc('11'); + setScContDoc([]); + getComboCodeList({ codeMcd: 'SC_CONT_DOC' }).then((res) => { + console.log(res); + setScContDoc(res.data); + }); + getComboCodeList({ codeMcd: 'RC_INGB' }).then((res) => { + console.log(res); + setScIngb(res.data); + }); + }, []); + + const handleChangeFile = (e) => { + const fileKey = e.target.name; + const fileArrKey = fileKey + e.target.dataset.index; + + if (fileKey === 'scPicad') { + setPicads((picads) => { + const updated = { ...picads }; + updated[fileArrKey] = e.target.files[0]; + return updated; + }); + } else if (fileKey === 'scFrecad') { + setFrecads((frecads) => { + const updated = { ...frecads }; + updated[fileArrKey] = e.target.files[0]; + return updated; + }); + } else if (fileKey === 'scContad') { + setContads((contads) => { + const updated = { ...contads }; + updated[fileArrKey] = e.target.files[0]; + return updated; + }); + } + }; + + return ( + <> + + + + setScCarnum(e?.target?.value)} + autoFocus + /> + + + setScName(e?.target?.value)} /> + + + setScDong(e?.target?.value)} /> + + + + 진술유형 + + + + + + + setScCdate(e?.target?.value)} + /> + + + + 접수방법 + + + + + setScWdate(e?.target?.value)} + /> + + + setScJbtime(e?.target?.value)} + /> + + + + + setScPos(e?.target?.value)} + /> + + + + + setZippost1(e?.target?.value)} + InputProps={{ + display: 'none', + readOnly: true, + endAdornment: ( + + + + ) + }} + /> + + + setScJuso(e?.target?.value)} + InputProps={{ readOnly: true }} + /> + + + setScBunji(e?.target?.value)} /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {/* + + + ); +}; +ModifyResidentDataForm.propTypes = { + rowData: PropTypes.object.isRequired, + handleModalSave: PropTypes.func.isRequired +}; +export default ModifyResidentDataForm; diff --git a/src/views/biz/resident/SaveResidentDataForm.jsx b/src/views/biz/resident/NewResidentDataForm.jsx similarity index 96% rename from src/views/biz/resident/SaveResidentDataForm.jsx rename to src/views/biz/resident/NewResidentDataForm.jsx index 0029397..abc7248 100644 --- a/src/views/biz/resident/SaveResidentDataForm.jsx +++ b/src/views/biz/resident/NewResidentDataForm.jsx @@ -14,7 +14,7 @@ import FileInputForms from 'views/form/FileInputForms'; const toDate = new Date(); -const SaveResidentDataForm = ({ handleModalSave }) => { +const NewResidentDataForm = ({ handleModalSave }) => { const alert = useAlert(); const [scCarnum, setScCarnum] = useState(''); @@ -30,6 +30,7 @@ const SaveResidentDataForm = ({ handleModalSave }) => { const [scWdate, setScWdate] = useState(null); const [scCdate, setScCdate] = useState(format(toDate, 'yyyyMMdd')); const [scJbtime, setScJbtime] = useState(null); + const [scPos, setScPos] = useState(''); const [picads, setPicads] = useState({}); const [frecads, setFrecads] = useState({}); @@ -46,6 +47,7 @@ const SaveResidentDataForm = ({ handleModalSave }) => { formData.append('scIngb', selectedIngb); formData.append('scWdate', scWdate); formData.append('scJbtime', scJbtime); + formData.append('scPos', scPos); formData.append('zippost1', zippost1); formData.append('scJuso', scJuso); formData.append('scBunji', scBunji); @@ -189,6 +191,11 @@ const SaveResidentDataForm = ({ handleModalSave }) => { /> + + + setScPos(e?.target?.value)} /> + + { ); }; -SaveResidentDataForm.propTypes = { +NewResidentDataForm.propTypes = { handleModalSave: PropTypes.func.isRequired }; -export default SaveResidentDataForm; +export default NewResidentDataForm; diff --git a/src/views/biz/resident/Regist.jsx b/src/views/biz/resident/Regist.jsx new file mode 100644 index 0000000..e39f0e2 --- /dev/null +++ b/src/views/biz/resident/Regist.jsx @@ -0,0 +1,207 @@ +import { useState } from 'react'; + +// material-ui +import { Button, Divider, FormControl, FormControlLabel, FormLabel, Grid, Radio, RadioGroup, TextField } from '@mui/material'; + +// assets +import { IconSearch } from '@tabler/icons'; +import PersonAddTwoToneIcon from '@mui/icons-material/PersonAddTwoTone'; + +// berry ui +import MainCard from 'ui-component/cards/MainCard'; + +// project imports +import MuiDataGrid from 'views/form/MuiDataGrid'; + +import xitCmm from 'commons/XitCmm'; +import CmmModal from 'views/form/Modal/CmmModal'; +import SaveResidentSimsaForm from './SaveResidentSimsaForm'; +import NumberFormat from 'react-number-format'; +import ExcelDownload from 'views/form/ExcelDownload'; +import { findParkingTargets, saveParkingTargets } from 'apis/parking'; + +const ResidentRegister = () => { + const [rcIrTransfer, setRcIrTransfer] = useState('1'); + const [rcSeq1, setRcSeq1] = useState('2022200801'); + const [rcSeq2, setRcSeq2] = useState('2022200899'); + const [selection, setSelection] = useState([]); + const [totalCount, setTotalCount] = useState(0); + const [rowsStatus, setRowsStatus] = useState({ + page: 0, + pageSize: 100, + rows: [] + }); + const [open, setOpen] = useState(false); + + const columns = [ + { headerName: 'No', headerAlign: 'center', field: 'rowId', align: 'center', width: 70 }, + { headerName: '접수번호', headerAlign: 'center', field: 'rcSeq', align: 'center' }, + { headerName: '최초차량번호', headerAlign: 'center', field: 'mmOcarno', align: 'center', minWidth: 110 }, + { headerName: '최종차량번호', headerAlign: 'center', field: 'mmNcarno', align: 'center', minWidth: 110 }, + { headerName: '성명', headerAlign: 'center', field: 'rcName', minWidth: 150 }, + { headerName: '진술유형', headerAlign: 'center', field: 'rcContDocNm', minWidth: 130 }, + { + headerName: '접수일자', + headerAlign: 'center', + field: 'rcDate', + align: 'center', + format: '####-##-##' + // valueGetter: (params) => `${params.row.msSdate} ~ ${params.row.msEdate}` + }, + { headerName: '접수방법', headerAlign: 'center', field: 'rcIngbNm', align: 'center' } + ]; + + const search = () => { + const params = { + rcIrTransfer, + rcSeq1, + rcSeq2 + }; + + findParkingTargets(params).then((response) => { + if (response && response.data) { + setTotalCount(response.count); + setRowsStatus((prevRows) => ({ ...prevRows, rows: response.data })); + } + }); + }; + + const handleSave = () => { + if (selection.length === 0) { + xitCmm.alertParam(`처리할 데이타가 없습니다`); + } else { + setOpen(true); + // alert(`저장할 데이타 => ${selectRows}`); + } + }; + + const submitParkingSimsa = (params) => { + const param = { + ...params, + rcIrTransfer, + rcSeq1, + rcSeq2, + rcCodes: selection.map((d) => rowsStatus.rows[d - 1].rcCode) + }; + setOpen(false); + // return false; + + saveParkingTargets(param).then(() => { + setSelection([]); + search(); + }); + }; + + const handleSearch = () => { + if (rcSeq1 && rcSeq2) { + search(); + } + }; + + const handleOnKeyDown = (event) => { + if (event.type === 'keydown' && event.key === 'Enter' && rcSeq1 && rcSeq2) { + search(); + } + }; + + const handleSelection = (newSelection) => { + setSelection(newSelection); + }; + + return ( + + + + + + + + 자료등록여부 + + setRcIrTransfer(e.target.value)} + > + } label="미등록" /> + } label="등록" /> + + + + + setRcSeq1(e.target.value.replace(/-/g, ''))} + placeholder="yyyy-MM-9999" + onKeyDown={handleOnKeyDown} + label="접수번호(시작)" + format="####-######" + /> +  -  + setRcSeq2(e.target.value.replace(/-/g, ''))} + placeholder="yyyy-MM-9999" + onKeyDown={handleOnKeyDown} + label="접수번호(종료)" + format="####-######" + /> + + + + + + + + + + + + + + + + + + + + + + + + + ); +}; +export default ResidentRegister; diff --git a/src/views/biz/resident/Review.jsx b/src/views/biz/resident/Review.jsx index df6b596..9dd38e7 100644 --- a/src/views/biz/resident/Review.jsx +++ b/src/views/biz/resident/Review.jsx @@ -1,6 +1,6 @@ import { useEffect, useState } from 'react'; -import { Button, Divider, Grid } from '@mui/material'; +import { Button, Divider, Grid, Link } from '@mui/material'; // berry ui import MainCard from 'ui-component/cards/MainCard'; @@ -8,13 +8,16 @@ import MainCard from 'ui-component/cards/MainCard'; // project imports import MuiDataGrid from 'views/form/MuiDataGrid'; import CmmModal from 'views/form/Modal/CmmModal'; -import { getResidents, saveResidentData } from 'apis/resident'; -import SaveResidentDataForm from './SaveResidentDataForm'; +import { findResident, findResidents, saveResidentData } from 'apis/resident'; +import NewResidentDataForm from './NewResidentDataForm'; +import ModifyResidentDataForm from './ModifyResidentDataForm'; const ResidentDataReview = () => { const [open, setOpen] = useState(false); const [create, setCreate] = useState(false); + const [selectedRow, setSelectedRow] = useState({}); const [title, setTitle] = useState(); + const [rowData, setRowData] = useState({}); const [totalCount, setTotalCount] = useState(0); const [rowsState, setRowsState] = useState({ @@ -27,7 +30,16 @@ const ResidentDataReview = () => { const columns = [ { headerName: 'No.', headerAlign: 'center', field: 'rowId', align: 'center', width: 70 }, { headerName: '심사코드?', field: 'scCode', hide: true }, - { headerName: '접수번호', headerAlign: 'center', field: 'scSeq' }, + { + headerName: '접수번호', + headerAlign: 'center', + field: 'scSeq', + renderCell: (params) => ( + + {params.value} + + ) + }, { headerName: '동명', headerAlign: 'center', field: 'scDong' }, { headerName: '차량번호', headerAlign: 'center', field: 'scCarnum' }, { headerName: '성명', headerAlign: 'center', field: 'scName' }, @@ -48,7 +60,7 @@ const ResidentDataReview = () => { size: rowsState.pageSize }; - getResidents(params).then((response) => { + findResidents(params).then((response) => { console.log(response); if (response && response.data) { setTotalCount(response.count); @@ -69,6 +81,17 @@ const ResidentDataReview = () => { setOpen(true); }; + const handleOnCellClick = (e) => { + if (e?.field === 'scSeq') { + findResident(e.row?.scCode).then((res) => { + setRowData(res.data); + setCreate(false); + setTitle('거주자 의견진술 자료 변경'); + setOpen(true); + }); + } + }; + const handleSaveResident = (payload) => { saveResidentData(payload).then(() => { search(); @@ -91,9 +114,16 @@ const ResidentDataReview = () => { - + - + {create && } + {!create && } ); diff --git a/src/views/biz/resident/SaveResidentSimsaForm.jsx b/src/views/biz/resident/SaveResidentSimsaForm.jsx new file mode 100644 index 0000000..210fff0 --- /dev/null +++ b/src/views/biz/resident/SaveResidentSimsaForm.jsx @@ -0,0 +1,172 @@ +import { useState } from 'react'; + +import NumberFormat from 'react-number-format'; +import format from 'date-fns/format'; +import getHours from 'date-fns/getHours'; +import koLocale from 'date-fns/locale/ko'; + +import { Grid, TextField, MenuItem, Select, FormControl, InputLabel } from '@mui/material'; +import DateAdapter from '@mui/lab/AdapterDateFns'; +import LocalizationProvider from '@mui/lab/LocalizationProvider'; +import { DatePicker, TimePicker } from '@mui/lab'; +import Button from '@mui/material/Button'; +import PropTypes from 'prop-types'; +import { IconFileExport } from '@tabler/icons'; + +import combo from 'commons/combo_data'; + +const toDate = new Date(); + +const SaveResidentSimsaForm = ({ handleModalSave }) => { + const [msuTeam, setMsuTeam] = useState(combo.teams[0].code); + const [msSdate, setMsSdate] = useState(format(toDate, 'yyyy-MM-dd')); + const [msStartsi, setMsStartsi] = useState(getHours(toDate)); + const [msEdate, setMsEdate] = useState(format(toDate, 'yyyy-MM-dd')); + const [msChasu, setMsChasu] = useState(99); + const [msCdate, setMsCdate] = useState(format(toDate, 'yyyy-MM-dd')); + const [msClosesi, setMsClosesi] = useState(getHours(toDate)); + + const onSave = () => { + // TODO : validation check 추가 + handleModalSave({ + msuTeam, + msSdate, + msStartsi, + msEdate, + msChasu, + msCdate, + msClosesi + }); + }; + + return ( + <> + + + + } + label="심의시작일" + value={msSdate} + inputFormat="yyyy-MM-dd" + mask="____-__-__" + onChange={(newValue) => { + setMsSdate(format(newValue, 'yyyy-MM-dd')); + }} + /> + + {/* */} + + + + } + label="심의시작시간" + value={msStartsi} + inputFormat="HH" + mask="__" + onChange={(newValue) => { + // setMsStartsi(format(newValue, 'HH')); + setMsStartsi(getHours(newValue)); + }} + /> + + {/* */} + + + + } + label="심의종료일" + value={msEdate} + inputFormat="yyyy-MM-dd" + mask="____-__-__" + onChange={(newValue) => { + setMsEdate(format(newValue, 'yyyy-MM-dd')); + }} + /> + + + + + + + + + + setMsChasu(values.value)} + /> + + + + } + label="심의마감일" + value={msCdate} + inputFormat="yyyy-MM-dd" + mask="____-__-__" + onChange={(newValue) => { + setMsCdate(format(newValue, 'yyyy-MM-dd')); + }} + /> + + + {/* setMsCdate(format(e.target.value), 'yyyy-MM-dd')} */} + {/* /> */} + + + + } + renderInput={(props) => } + label="심의마감시간" + value={msClosesi} + inputFormat="HH" + mask="__" + onChange={(newValue) => { + setMsClosesi(getHours(newValue)); + }} + /> + + + + + + + + ); +}; +SaveResidentSimsaForm.propTypes = { + handleModalSave: PropTypes.func.isRequired + // isDisabled: PropTypes.bool.isRequired +}; +export default SaveResidentSimsaForm; diff --git a/src/views/form/FileInputForms.jsx b/src/views/form/FileInputForms.jsx index 27c3819..ea84269 100644 --- a/src/views/form/FileInputForms.jsx +++ b/src/views/form/FileInputForms.jsx @@ -2,7 +2,7 @@ import { Button, Grid, TextField } from '@mui/material'; import { FileUpload } from '@mui/icons-material'; import PropTypes from 'prop-types'; -const FileInputForms = ({ fieldName, index, labelName, selectedFile, handleChangeFile, alert, isDisabled = true }) => { +const FileInputForms = ({ fieldName, index, labelName, selectedFile, fileName, handleChangeFile, alert, isDisabled = true }) => { const onChangeFile = (e) => { const file = e.target.files[0]; if (file.type.includes('image')) { @@ -14,7 +14,7 @@ const FileInputForms = ({ fieldName, index, labelName, selectedFile, handleChang return ( - } onClick={() => {}} /> + } onClick={() => {}} />