|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
import { useState } from 'react';
|
|
|
|
|
import { useCallback, useEffect, useState } from 'react';
|
|
|
|
|
|
|
|
|
|
// material-ui
|
|
|
|
|
import { Button, Divider, FormControl, FormControlLabel, FormLabel, Grid, Radio, RadioGroup, TextField } from '@mui/material';
|
|
|
|
@ -19,19 +19,21 @@ import SaveJudgeTargetForm from 'views/biz/judge/SaveJudgeTargetForm';
|
|
|
|
|
import NumberFormat from 'react-number-format';
|
|
|
|
|
import ExcelDownload from 'views/form/ExcelDownload';
|
|
|
|
|
import { findJudgeTargets, saveJudgeTargets } from 'apis/judge';
|
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
|
|
|
|
|
const ResidentRegister = () => {
|
|
|
|
|
const JudgeRegistReview = ({ scDatagb, menuName }) => {
|
|
|
|
|
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({
|
|
|
|
|
const [rowsState, setRowsState] = useState({
|
|
|
|
|
page: 0,
|
|
|
|
|
pageSize: 100,
|
|
|
|
|
rows: []
|
|
|
|
|
});
|
|
|
|
|
const [open, setOpen] = useState(false);
|
|
|
|
|
const [title, setTitle] = useState();
|
|
|
|
|
|
|
|
|
|
const columns = [
|
|
|
|
|
{ headerName: 'No', headerAlign: 'center', field: 'rowId', align: 'center', width: 70 },
|
|
|
|
@ -50,9 +52,9 @@ const ResidentRegister = () => {
|
|
|
|
|
{ headerName: '접수방법', headerAlign: 'center', field: 'scIngbNm', align: 'center' }
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const search = () => {
|
|
|
|
|
const search = useCallback(() => {
|
|
|
|
|
const params = {
|
|
|
|
|
scDatagb: '1', // 거주자
|
|
|
|
|
scDatagb, // 거주자
|
|
|
|
|
scTransfer,
|
|
|
|
|
scSeq1,
|
|
|
|
|
scSeq2
|
|
|
|
@ -62,15 +64,16 @@ const ResidentRegister = () => {
|
|
|
|
|
if (response && response.data) {
|
|
|
|
|
setSelectionModel([]);
|
|
|
|
|
setTotalCount(response.count);
|
|
|
|
|
setRowsStatus((prevRows) => ({ ...prevRows, rows: response.data }));
|
|
|
|
|
setRowsState((prevRows) => ({ ...prevRows, rows: response.data }));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
}, [rowsState.page, rowsState.pageSize, scDatagb]);
|
|
|
|
|
|
|
|
|
|
const handleSave = () => {
|
|
|
|
|
if (selectionModel.length === 0) {
|
|
|
|
|
xitCmm.alertParam(`처리할 데이타가 없습니다`);
|
|
|
|
|
} else {
|
|
|
|
|
setTitle(`${menuName} 의견진술 심의목록 저장`);
|
|
|
|
|
setOpen(true);
|
|
|
|
|
// alert(`저장할 데이타 => ${selectRows}`);
|
|
|
|
|
}
|
|
|
|
@ -79,11 +82,11 @@ const ResidentRegister = () => {
|
|
|
|
|
const submitResidentTargets = (params) => {
|
|
|
|
|
const param = {
|
|
|
|
|
...params,
|
|
|
|
|
scDatagb: '1', // 거주자
|
|
|
|
|
scDatagb, // 거주자
|
|
|
|
|
scTransfer,
|
|
|
|
|
scSeq1,
|
|
|
|
|
scSeq2,
|
|
|
|
|
scCodes: selectionModel.map((d) => rowsStatus.rows[d - 1].scCode)
|
|
|
|
|
scCodes: selectionModel.map((d) => rowsState.rows[d - 1].scCode)
|
|
|
|
|
};
|
|
|
|
|
setOpen(false);
|
|
|
|
|
console.log(param);
|
|
|
|
@ -100,6 +103,10 @@ const ResidentRegister = () => {
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
search();
|
|
|
|
|
}, [search]);
|
|
|
|
|
|
|
|
|
|
const handleOnKeyDown = (event) => {
|
|
|
|
|
if (event.type === 'keydown' && event.key === 'Enter' && scSeq1 && scSeq2) {
|
|
|
|
|
search();
|
|
|
|
@ -179,7 +186,12 @@ const ResidentRegister = () => {
|
|
|
|
|
</Button>
|
|
|
|
|
</Grid>
|
|
|
|
|
<Grid item>
|
|
|
|
|
<ExcelDownload fileName="심사등록대상" gridColumns={columns} excelDatas={rowsStatus.rows} isDisabled={totalCount === 0} />
|
|
|
|
|
<ExcelDownload
|
|
|
|
|
fileName={`${menuName} 의견진술 심의목록`}
|
|
|
|
|
gridColumns={columns}
|
|
|
|
|
excelDatas={rowsState.rows}
|
|
|
|
|
isDisabled={totalCount === 0}
|
|
|
|
|
/>
|
|
|
|
|
</Grid>
|
|
|
|
|
</Grid>
|
|
|
|
|
</Grid>
|
|
|
|
@ -195,16 +207,20 @@ const ResidentRegister = () => {
|
|
|
|
|
isCheckbox
|
|
|
|
|
isHideFooter
|
|
|
|
|
columns={columns}
|
|
|
|
|
rowsState={rowsStatus}
|
|
|
|
|
rowsState={rowsState}
|
|
|
|
|
totalCount={totalCount}
|
|
|
|
|
setRowsStatus={setRowsStatus}
|
|
|
|
|
setrowsState={setRowsState}
|
|
|
|
|
handleSelection={handleSelection}
|
|
|
|
|
selectionModel={selectionModel}
|
|
|
|
|
/>
|
|
|
|
|
<CmmModal isBackdrop title="심의등록" open={open} setOpen={setOpen}>
|
|
|
|
|
<CmmModal isBackdrop title={title} open={open} setOpen={setOpen}>
|
|
|
|
|
<SaveJudgeTargetForm isDisabled={selectionModel.length === 0} handleModalSave={submitResidentTargets} />
|
|
|
|
|
</CmmModal>
|
|
|
|
|
</MainCard>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
export default ResidentRegister;
|
|
|
|
|
JudgeRegistReview.propTypes = {
|
|
|
|
|
scDatagb: PropTypes.string.isRequired,
|
|
|
|
|
menuName: PropTypes.string.isRequired
|
|
|
|
|
};
|
|
|
|
|
export default JudgeRegistReview;
|