From 5103cac429bd009ea85db12b5b6f64866c7a7b2d Mon Sep 17 00:00:00 2001 From: donggyu97 Date: Fri, 8 Apr 2022 17:47:34 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=9E=A5=EC=95=A0=EC=9D=B8=20=EC=9D=98?= =?UTF-8?q?=EA=B2=AC=20=EC=A7=84=EC=88=A0=20=ED=99=94=EB=A9=B4=20=EB=B0=98?= =?UTF-8?q?=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/disabled.js | 43 ++ src/apis/parking.js | 10 +- src/apis/resident.js | 26 +- src/commons/ApiUrl.js | 12 +- src/routes/MainRoutes.js | 11 +- src/views/biz/disabled/DisabledDataReview.jsx | 131 +++++ src/views/biz/disabled/DisabledRegist.jsx | 208 ++++++++ src/views/biz/disabled/DisabledReview.jsx | 198 ++++++++ .../biz/disabled/ModifyDisabledDataForm.jsx | 454 ++++++++++++++++++ .../biz/disabled/NewDisabledDataForm.jsx | 438 +++++++++++++++++ .../biz/disabled/SaveDisabledTargetForm.jsx | 172 +++++++ src/views/biz/parking/ParkingRegister.jsx | 6 +- src/views/biz/resident/ResidentRegist.jsx | 58 +-- 13 files changed, 1724 insertions(+), 43 deletions(-) create mode 100644 src/apis/disabled.js create mode 100644 src/views/biz/disabled/DisabledDataReview.jsx create mode 100644 src/views/biz/disabled/DisabledRegist.jsx create mode 100644 src/views/biz/disabled/DisabledReview.jsx create mode 100644 src/views/biz/disabled/ModifyDisabledDataForm.jsx create mode 100644 src/views/biz/disabled/NewDisabledDataForm.jsx create mode 100644 src/views/biz/disabled/SaveDisabledTargetForm.jsx diff --git a/src/apis/disabled.js b/src/apis/disabled.js new file mode 100644 index 0000000..da0c818 --- /dev/null +++ b/src/apis/disabled.js @@ -0,0 +1,43 @@ +//---------------------------------------------------------------------------- +// Parking : 주정차의견진술관리 +//---------------------------------------------------------------------------- + +import axios from 'utils/axios'; +import { GET_DISABLED, GET_DISABLED_DATA_LIST, GET_DISABLED_LIST, SAVE_DISABLED_DATA } from 'commons/ApiUrl'; +import { setRowId } from './common'; + +// eslint-disable-next-line no-return-await +export async function findDisabledDatas(params) { + const res = await axios.get(GET_DISABLED_DATA_LIST, { params }); + if (res.success) { + res.data = res.data.map((d, idx) => ({ ...d, rowId: setRowId(params, idx) })); + return res; + } + return res; +} + +export async function saveDisabledData(formData) { + // eslint-disable-next-line no-return-await + return await axios(SAVE_DISABLED_DATA, { + method: 'post', + data: formData, + headers: { 'Content-Type': 'multipart/form-data' } // , Authorization: localStorage.getItem('access_token') } + }); +} + +export async function findDisabled(scCode) { + const res = await axios.get(GET_DISABLED + scCode); + if (res.success) { + return res; + } + return res; +} + +export async function findDisableds(params) { + const res = await axios.get(GET_DISABLED_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/parking.js b/src/apis/parking.js index 5341ce7..522b054 100644 --- a/src/apis/parking.js +++ b/src/apis/parking.js @@ -3,7 +3,7 @@ //---------------------------------------------------------------------------- import axios from 'utils/axios'; -import { GET_PARKING_LIST, GET_PARKING_TARGET_LIST, SAVE_PARKING_TARGET_LIST } from 'commons/ApiUrl'; +import { GET_PARKING_JUDGE_TARGET_LIST, GET_PARKING_LIST, SAVE_PARKING_JUDGE_TARGET_LIST } from 'commons/ApiUrl'; import { setRowId } from './common'; // eslint-disable-next-line no-return-await @@ -16,8 +16,8 @@ export async function findParkings(params) { return res; } -export async function findParkingTargets(params) { - const res = await axios.get(GET_PARKING_TARGET_LIST, { params }); +export async function findParkingJudgeTargets(params) { + const res = await axios.get(GET_PARKING_JUDGE_TARGET_LIST, { params }); if (res.success) { res.data = res.data.map((d, idx) => ({ ...d, rowId: setRowId(params, idx) })); return res; @@ -25,8 +25,8 @@ export async function findParkingTargets(params) { return res; } -export async function saveParkingTargets(params) { - const res = await axios.post(SAVE_PARKING_TARGET_LIST, params); +export async function saveParkingJudgeTargets(params) { + const res = await axios.post(SAVE_PARKING_JUDGE_TARGET_LIST, params); if (res.success) { return res; } diff --git a/src/apis/resident.js b/src/apis/resident.js index ea0d737..69553b0 100644 --- a/src/apis/resident.js +++ b/src/apis/resident.js @@ -3,7 +3,14 @@ //---------------------------------------------------------------------------- import axios from 'utils/axios'; -import { GET_RESIDENT, GET_RESIDENT_DATA_LIST, GET_RESIDENT_LIST, SAVE_RESIDENT_DATA } from 'commons/ApiUrl'; +import { + GET_RESIDENT, + GET_RESIDENT_DATA_LIST, + GET_RESIDENT_JUDGE_TARGET_LIST, + GET_RESIDENT_LIST, + SAVE_RESIDENT_DATA, + SAVE_RESIDENT_JUDGE_TARGET_LIST +} from 'commons/ApiUrl'; import { setRowId } from './common'; // eslint-disable-next-line no-return-await @@ -41,3 +48,20 @@ export async function findResidents(params) { } return res; } + +export async function findResidentJudgeTargets(params) { + const res = await axios.get(GET_RESIDENT_JUDGE_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 saveResidentJudgeTargets(params) { + const res = await axios.post(SAVE_RESIDENT_JUDGE_TARGET_LIST, params); + if (res.success) { + return res; + } + return res; +} diff --git a/src/commons/ApiUrl.js b/src/commons/ApiUrl.js index 3f58e2e..6bf0ec9 100644 --- a/src/commons/ApiUrl.js +++ b/src/commons/ApiUrl.js @@ -16,8 +16,8 @@ export const GET_BOARD_LIST = '/api/v1/ctgy/board'; // 주정차 의견 진술 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_JUDGE_TARGET_LIST = '/api/v1/ctgy/parking/target'; +export const SAVE_PARKING_JUDGE_TARGET_LIST = '/api/v1/ctgy/parking/target'; // export const GET_PARKING_DETAILS_LIST = '/api/v1/ctgy/parking/details'; // 거주자 의견 진술 @@ -25,6 +25,14 @@ export const GET_RESIDENT_DATA_LIST = '/api/v1/ctgy/resident/data'; export const SAVE_RESIDENT_DATA = '/api/v1/ctgy/resident/data'; export const GET_RESIDENT = '/api/v1/ctgy/resident/'; export const GET_RESIDENT_LIST = '/api/v1/ctgy/resident'; +export const GET_RESIDENT_JUDGE_TARGET_LIST = '/api/v1/ctgy/resident/target'; +export const SAVE_RESIDENT_JUDGE_TARGET_LIST = '/api/v1/ctgy/resident/target'; + +// 장애인 의견 진술 +export const GET_DISABLED_DATA_LIST = '/api/v1/ctgy/resident/data'; +export const SAVE_DISABLED_DATA = '/api/v1/ctgy/resident/data'; +export const GET_DISABLED = '/api/v1/ctgy/resident/'; +export const GET_DISABLED_LIST = '/api/v1/ctgy/resident'; // 사용자 관리 export const GET_USER_BOARD_LIST = '/api/v1/ctgy/pboard/'; diff --git a/src/routes/MainRoutes.js b/src/routes/MainRoutes.js index a7f477a..37045a6 100755 --- a/src/routes/MainRoutes.js +++ b/src/routes/MainRoutes.js @@ -24,6 +24,11 @@ const ResidentDataReview = Loadable(lazy(() => import('views/biz/resident/Reside const ResidentRegister = Loadable(lazy(() => import('views/biz/resident/ResidentRegist'))); const ResidentReview = Loadable(lazy(() => import('views/biz/resident/ResidentReview'))); +// disabled +const DisabledDataReview = Loadable(lazy(() => import('views/biz/disabled/DisabledDataReview'))); +const DisabledRegister = Loadable(lazy(() => import('views/biz/disabled/DisabledRegist'))); +const DisabledReview = Loadable(lazy(() => import('views/biz/disabled/DisabledReview'))); + // user const UserManager = Loadable(lazy(() => import('views/biz/user/UserManager'))); const Juror = Loadable(lazy(() => import('views/biz/user/Juror'))); @@ -80,15 +85,15 @@ const MainRoutes = { /* 장애인 */ { path: '/disabled/data', - element: + element: }, { path: '/disabled/review', - element: + element: }, { path: '/disabled/register', - element: + element: }, /* 사용자 */ { diff --git a/src/views/biz/disabled/DisabledDataReview.jsx b/src/views/biz/disabled/DisabledDataReview.jsx new file mode 100644 index 0000000..a2e75b8 --- /dev/null +++ b/src/views/biz/disabled/DisabledDataReview.jsx @@ -0,0 +1,131 @@ +import { useCallback, useEffect, useState } from 'react'; + +import { Button, Divider, Grid, Link } from '@mui/material'; + +// berry ui +import MainCard from 'ui-component/cards/MainCard'; + +// project imports +import MuiDataGrid from 'views/form/MuiDataGrid'; +import CmmModal from 'views/form/Modal/CmmModal'; +import { findDisabled, findDisabledDatas, saveDisabledData } from 'apis/disabled'; +import NewDisabledDataForm from './NewDisabledDataForm'; +import ModifyDisabledDataForm from './ModifyDisabledDataForm'; + +const DisabledDataReview = () => { + 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({ + page: 0, + pageSize: 20, + rows: [] + // loading: false + }); + + const columns = [ + { headerName: 'No.', headerAlign: 'center', field: 'rowId', align: 'center', width: 70 }, + { headerName: '심사코드?', field: 'scCode', hide: true }, + { + headerName: '접수번호', + headerAlign: 'center', + field: 'scSeq', + renderCell: (params) => ( + + {params.value} + + ) + }, + { headerName: '동명', headerAlign: 'center', field: 'scDong' }, + { headerName: '차량번호', headerAlign: 'center', field: 'scCarnum' }, + { headerName: '성명', headerAlign: 'center', field: 'scName' }, + { headerName: '진술유형', headerAlign: 'center', field: 'scContDocNm' }, + { + headerName: '접수일자', + headerAlign: 'center', + field: 'scCdate' + // type: 'date', + // valueGetter: ({ value }) => value && new Date(value) + }, + { headerName: '접수방법', headerAlign: 'center', field: 'scIngbNm' } + ]; + + const search = useCallback(() => { + const params = { + page: rowsState.page, + size: rowsState.pageSize + }; + + findDisabledDatas(params).then((response) => { + console.log(response); + if (response && response.data) { + setTotalCount(response.count); + setRowsState((prevState) => ({ ...prevState, rows: response.data })); + // apiRef.current.forceUpdate(); // .updateRowData([]); + // apiRef.current.updateRowData([]); + } + }); + }, [rowsState.page, rowsState.pageSize]); + + useEffect(() => { + search(); + }, [search]); // search, rowsState.page, rowsState.pageSize]); + + const handleCreate = () => { + setTitle('장애인 의견진술 자료 신규 등록'); + setCreate(true); + setOpen(true); + }; + + const handleOnCellClick = (e) => { + if (e?.field === 'scSeq') { + findDisabled(e.row?.scCode).then((res) => { + setRowData(res.data); + setCreate(false); + setTitle('장애인 의견진술 자료 변경'); + setOpen(true); + }); + } + }; + + const handleSaveResident = (payload) => { + saveDisabledData(payload).then(() => { + search(); + setOpen(false); + }); + }; + + return ( + + + + + + + + + + + + + + + {create && } + {!create && } + + + ); +}; +export default DisabledDataReview; diff --git a/src/views/biz/disabled/DisabledRegist.jsx b/src/views/biz/disabled/DisabledRegist.jsx new file mode 100644 index 0000000..89acb47 --- /dev/null +++ b/src/views/biz/disabled/DisabledRegist.jsx @@ -0,0 +1,208 @@ +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 SaveDisabledTargetForm from './SaveDisabledTargetForm'; +import NumberFormat from 'react-number-format'; +import ExcelDownload from 'views/form/ExcelDownload'; +import { findParkingJudgeTargets, saveParkingJudgeTargets } from 'apis/parking'; + +const DisabledRegister = () => { + const [rcIrTransfer, setRcIrTransfer] = useState('1'); + const [rcSeq1, setRcSeq1] = useState('2022200801'); + const [rcSeq2, setRcSeq2] = useState('2022200899'); + const [selectionModel, setSelectionModel] = 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 + }; + + findParkingJudgeTargets(params).then((response) => { + if (response && response.data) { + setSelectionModel([]); + setTotalCount(response.count); + setRowsStatus((prevRows) => ({ ...prevRows, rows: response.data })); + } + }); + }; + + const handleSave = () => { + if (selectionModel.length === 0) { + xitCmm.alertParam(`처리할 데이타가 없습니다`); + } else { + setOpen(true); + // alert(`저장할 데이타 => ${selectRows}`); + } + }; + + const submitDisabledTargets = (params) => { + const param = { + ...params, + rcIrTransfer, + rcSeq1, + rcSeq2, + rcCodes: selectionModel.map((d) => rowsStatus.rows[d - 1].rcCode) + }; + setOpen(false); + // return false; + + saveParkingJudgeTargets(param).then(() => { + setSelectionModel([]); + search(); + }); + }; + + const handleSearch = () => { + if (rcSeq1 && rcSeq2) { + search(); + } + }; + + const handleOnKeyDown = (event) => { + if (event.type === 'keydown' && event.key === 'Enter' && rcSeq1 && rcSeq2) { + search(); + } + }; + + const handleSelection = (newSelection) => { + setSelectionModel(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 DisabledRegister; diff --git a/src/views/biz/disabled/DisabledReview.jsx b/src/views/biz/disabled/DisabledReview.jsx new file mode 100644 index 0000000..1090be1 --- /dev/null +++ b/src/views/biz/disabled/DisabledReview.jsx @@ -0,0 +1,198 @@ +import { useCallback, useEffect, useRef, useState } from 'react'; + +import _ from 'lodash'; +import getYear from 'date-fns/getYear'; + +// material-ui +import { GridActionsCellItem } from '@mui/x-data-grid'; +import { Divider, FormControl, Grid, InputAdornment, Link, MenuItem, OutlinedInput, Select } from '@mui/material'; +import DeleteIcon from '@mui/icons-material/Delete'; +import { IconSearch } from '@tabler/icons'; + +// berry ui +import MainCard from 'ui-component/cards/MainCard'; + +// project imports +import MuiDataGrid from 'views/form/MuiDataGrid'; +import xitCmm from 'commons/XitCmm'; +import InputLabel from 'ui-component/extended/Form/InputLabel'; +import { findDisableds } from 'apis/disabled'; + +const DisabledReview = () => { + const isInit = useRef(true); + const year = getYear(new Date()); + console.log(typeof year); + const years = _.range(year, year - 14, -1); + + const [selectedYear, setSelectedYear] = useState(year); + const [searchTxt, setSearchTxt] = useState(''); + + const [totalCount, setTotalCount] = useState(0); + const [rowsState, setRowsState] = useState({ + page: 0, + pageSize: 20, + rows: [] + // loading: false + }); + const removeSimsa = useCallback( + (row) => () => { + // setTimeout(() => { + // setRowsState((prevRows) => prevRows.filter((row) => row.rowId !== rowId)); + // }); + xitCmm.alertParam(`삭제대상
${JSON.stringify(row)}`); + console.log(row); + }, + [] + ); + + const openModalDetails = () => {}; + + /* + ms_maincode : '민원코드' + ms_seq : '접수번호' + ms_carnum : '차량번호' + ms_year : '년도' + ms_chasu : '차수' + ms_sdate : '심사시작일시' + ms_startsi : '심사시작시간' + ms_edate : '심사종료일시' + ms_cdate : '심사마감일시' + ms_closesi : '심사마감시간' + ms_wdate : '단속일자' + ms_pos : '단속장소' + ms_result : '결과코드' + ms_jbtime : '단속시간' + */ + const columns = [ + // { headerName: 'rowId', field: 'rowId' }, + { headerName: '심의차수', headerAlign: 'center', field: 'msChasu' }, + { headerName: '심사건수', headerAlign: 'center', field: 'cnt' }, + { + headerName: '심사기간', + headerAlign: 'center', + field: 'msDate', + minWidth: 180, + description: '심사기간', + valueGetter: (params) => `${params.row.msSdate} ~ ${params.row.msEdate}`, + renderCell: (params) => ( + // + navigate(`/parking/details?msChasu=${params.msChasu}&msSdate=${params.msSdate}&msEdate=${params.msEdate}`)} + onClick={openModalDetails} + data-target="modalDetails" + rel="noopener" + > + {/* }> */} + {/* }> */} + {params.value} + + // + ) + }, + { + headerName: '심사마감일시', + headerAlign: 'center', + field: 'msCdate', + type: 'dateTime', + minWidth: 125, + valueGetter: (params) => `${params.row.msCdate} ${params.row.msClosesi}` + }, + { headerName: '상태', field: 'msResult', renderCell: (params) => <>{params.row.msResult === '1' ? '진행중' : '심사완료'} }, + { + headerName: '삭제', + headerAlign: 'center', + field: 'actions', + type: 'actions', + width: 80, + getActions: (params) => [} label="Delete" onClick={removeSimsa(params.row)} />] + } + ]; + + const search = useCallback(() => { + const params = { + page: rowsState.page, + size: rowsState.pageSize + }; + + findDisableds({ ...params, msYear: selectedYear, msChasu: searchTxt }).then((response) => { + if (response && response.data) { + setTotalCount(response.count); + setRowsState((prevState) => ({ ...prevState, rows: response.data })); + // apiRef.current.forceUpdate(); // .updateRowData([]); + // apiRef.current.updateRowData([]); + } + }); + }, [rowsState.page, rowsState.pageSize, selectedYear, searchTxt]); + + const handleSearch = async (event) => { + if (!selectedYear) return; + + if (event.type === 'keydown' && event.key === 'Enter') { + const newString = event?.target.value; + setSearchTxt(newString); + search(); + } + }; + + useEffect(() => { + if (isInit.current) { + isInit.current = false; + return; + } + search(); + // }, [rowsState.page, rowsState.pageSize, selectedYear, searchTxt]); + }, [search]); + + return ( + + + + + + + 심의 년도 + + + + + + + + } + /> + + + + + + + + + + + + + ); +}; +export default DisabledReview; diff --git a/src/views/biz/disabled/ModifyDisabledDataForm.jsx b/src/views/biz/disabled/ModifyDisabledDataForm.jsx new file mode 100644 index 0000000..bd98b51 --- /dev/null +++ b/src/views/biz/disabled/ModifyDisabledDataForm.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 ModifyDisabledDataForm = ({ 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)} /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {/* + + + ); +}; +ModifyDisabledDataForm.propTypes = { + rowData: PropTypes.object.isRequired, + handleModalSave: PropTypes.func.isRequired +}; +export default ModifyDisabledDataForm; diff --git a/src/views/biz/disabled/NewDisabledDataForm.jsx b/src/views/biz/disabled/NewDisabledDataForm.jsx new file mode 100644 index 0000000..a31f7f5 --- /dev/null +++ b/src/views/biz/disabled/NewDisabledDataForm.jsx @@ -0,0 +1,438 @@ +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 NewDisabledDataForm = ({ handleModalSave }) => { + const alert = useAlert(); + + const [scCarnum, setScCarnum] = useState(''); + const [scName, setScName] = useState(''); + const [scDong, setScDong] = useState(''); + const [scContDoc, setScContDoc] = useState(); + const [selectedContDoc, setSelectedContDoc] = useState('11'); + const [scIngb, setScIngb] = useState(); + const [selectedIngb, setSelectedIngb] = useState('1'); + const [zippost1, setZippost1] = useState(null); + const [scJuso, setScJuso] = useState(''); + const [scBunji, setScBunji] = useState(''); + 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({}); + 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)} /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {/* + + + ); +}; +NewDisabledDataForm.propTypes = { + handleModalSave: PropTypes.func.isRequired +}; +export default NewDisabledDataForm; diff --git a/src/views/biz/disabled/SaveDisabledTargetForm.jsx b/src/views/biz/disabled/SaveDisabledTargetForm.jsx new file mode 100644 index 0000000..46ea271 --- /dev/null +++ b/src/views/biz/disabled/SaveDisabledTargetForm.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 SaveDisabledTargetForm = ({ 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)); + }} + /> + + + + + + + + ); +}; +SaveDisabledTargetForm.propTypes = { + handleModalSave: PropTypes.func.isRequired + // isDisabled: PropTypes.bool.isRequired +}; +export default SaveDisabledTargetForm; diff --git a/src/views/biz/parking/ParkingRegister.jsx b/src/views/biz/parking/ParkingRegister.jsx index 4da22eb..3f0cf07 100644 --- a/src/views/biz/parking/ParkingRegister.jsx +++ b/src/views/biz/parking/ParkingRegister.jsx @@ -18,7 +18,7 @@ import CmmModal from 'views/form/Modal/CmmModal'; import SaveParkingTargetForm from './SaveParkingTargetForm'; import NumberFormat from 'react-number-format'; import ExcelDownload from 'views/form/ExcelDownload'; -import { findParkingTargets, saveParkingTargets } from 'apis/parking'; +import { findParkingJudgeTargets, saveParkingJudgeTargets } from 'apis/parking'; const ParkingRegister = () => { const [rcIrTransfer, setRcIrTransfer] = useState('1'); @@ -58,7 +58,7 @@ const ParkingRegister = () => { rcSeq2 }; - findParkingTargets(params).then((response) => { + findParkingJudgeTargets(params).then((response) => { if (response && response.data) { setSelectionModel([]); setTotalCount(response.count); @@ -87,7 +87,7 @@ const ParkingRegister = () => { setOpen(false); // return false; - saveParkingTargets(param).then(() => { + saveParkingJudgeTargets(param).then(() => { setSelectionModel([]); search(); }); diff --git a/src/views/biz/resident/ResidentRegist.jsx b/src/views/biz/resident/ResidentRegist.jsx index 356808c..1fa2f3a 100644 --- a/src/views/biz/resident/ResidentRegist.jsx +++ b/src/views/biz/resident/ResidentRegist.jsx @@ -18,12 +18,12 @@ import CmmModal from 'views/form/Modal/CmmModal'; import SaveResidentTargetForm from './SaveResidentTargetForm'; import NumberFormat from 'react-number-format'; import ExcelDownload from 'views/form/ExcelDownload'; -import { findParkingTargets, saveParkingTargets } from 'apis/parking'; +import { findResidentJudgeTargets, saveResidentJudgeTargets } from 'apis/resident'; const ResidentRegister = () => { - const [rcIrTransfer, setRcIrTransfer] = useState('1'); - const [rcSeq1, setRcSeq1] = useState('2022200801'); - const [rcSeq2, setRcSeq2] = useState('2022200899'); + const [scTransfer, setScTransfer] = useState('1'); + const [scSeq1, setScSeq1] = useState(2022000001); + const [scSeq2, setScSeq2] = useState(2022000899); const [selectionModel, setSelectionModel] = useState([]); const [totalCount, setTotalCount] = useState(0); const [rowsStatus, setRowsStatus] = useState({ @@ -35,30 +35,29 @@ const ResidentRegister = () => { 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: 'scSeq', align: 'center' }, + { headerName: '차량번호', headerAlign: 'center', field: 'scCarnum', align: 'center', minWidth: 110 }, + { headerName: '성명', headerAlign: 'center', field: 'scName', minWidth: 150 }, + { headerName: '진술유형', headerAlign: 'center', field: 'scContDocNm', minWidth: 130 }, { headerName: '접수일자', headerAlign: 'center', - field: 'rcDate', + field: 'scCdate', align: 'center', format: '####-##-##' // valueGetter: (params) => `${params.row.msSdate} ~ ${params.row.msEdate}` }, - { headerName: '접수방법', headerAlign: 'center', field: 'rcIngbNm', align: 'center' } + { headerName: '접수방법', headerAlign: 'center', field: 'scIngbNm', align: 'center' } ]; const search = () => { const params = { - rcIrTransfer, - rcSeq1, - rcSeq2 + scTransfer, + scSeq1, + scSeq2 }; - findParkingTargets(params).then((response) => { + findResidentJudgeTargets(params).then((response) => { if (response && response.data) { setSelectionModel([]); setTotalCount(response.count); @@ -79,28 +78,28 @@ const ResidentRegister = () => { const submitResidentTargets = (params) => { const param = { ...params, - rcIrTransfer, - rcSeq1, - rcSeq2, - rcCodes: selectionModel.map((d) => rowsStatus.rows[d - 1].rcCode) + scTransfer, + scSeq1, + scSeq2, + scCodes: selectionModel.map((d) => rowsStatus.rows[d - 1].scCode) }; setOpen(false); - // return false; + console.log(param); - saveParkingTargets(param).then(() => { + saveResidentJudgeTargets(param).then(() => { setSelectionModel([]); search(); }); }; const handleSearch = () => { - if (rcSeq1 && rcSeq2) { + if (scSeq1 && scSeq2) { search(); } }; const handleOnKeyDown = (event) => { - if (event.type === 'keydown' && event.key === 'Enter' && rcSeq1 && rcSeq2) { + if (event.type === 'keydown' && event.key === 'Enter' && scSeq1 && scSeq2) { search(); } }; @@ -123,8 +122,8 @@ const ResidentRegister = () => { row aria-label="category" name="row-radio-buttons-group" - value={rcIrTransfer} - onChange={(e) => setRcIrTransfer(e.target.value)} + value={scTransfer} + onChange={(e) => setScTransfer(e.target.value)} > } label="미등록" /> } label="등록" /> @@ -138,8 +137,8 @@ const ResidentRegister = () => { required id="rcSeq1" name="rcSeq1" - value={rcSeq1} - onChange={(e) => setRcSeq1(e.target.value.replace(/-/g, ''))} + value={scSeq1} + onChange={(e) => setScSeq1(e.target.value.replace(/-/g, ''))} placeholder="yyyy-MM-9999" onKeyDown={handleOnKeyDown} label="접수번호(시작)" @@ -152,8 +151,8 @@ const ResidentRegister = () => { required id="rcSeq2" name="rcSeq2" - value={rcSeq2} - onChange={(e) => setRcSeq2(e.target.value.replace(/-/g, ''))} + value={scSeq2} + onChange={(e) => setScSeq2(e.target.value.replace(/-/g, ''))} placeholder="yyyy-MM-9999" onKeyDown={handleOnKeyDown} label="접수번호(종료)" @@ -198,6 +197,7 @@ const ResidentRegister = () => { totalCount={totalCount} setRowsStatus={setRowsStatus} handleSelection={handleSelection} + selectionModel={selectionModel} />