fix: 거주자/장애인 상세 목록 진행

main
Lim Jonguk 3 years ago
parent 88ccb1c6c7
commit 2d5c549f59

@ -16,14 +16,13 @@ import MainCard from 'ui-component/cards/MainCard';
import MuiDataGrid from 'views/form/MuiDataGrid';
import xitCmm from 'commons/XitCmm';
import InputLabel from 'ui-component/extended/Form/InputLabel';
import { findJudge, findJudges } from 'apis/judge';
import { findJudge, findJudgeDetails, findJudges } from 'apis/judge';
import CmmModal from 'views/form/Modal/CmmModal';
import ModalJudgeDetail from './ModalJudgeDetail';
const JudgeReview = ({ msDatagb, menuName }) => {
const isInit = useRef(true);
const year = getYear(new Date());
console.log(typeof year);
const years = _.range(year, year - 14, -1);
const [open, setOpen] = useState(false);
@ -41,7 +40,12 @@ const JudgeReview = ({ msDatagb, menuName }) => {
rows: []
// loading: false
});
const [selectedRowData, setSelectedRowData] = useState({});
const [judgeDetailData, setJudgeDetailData] = useState({
totData: [],
judgeData: [],
colNames: []
});
const removeJudge = useCallback(
(row) => () => {
// setTimeout(() => {
@ -134,22 +138,51 @@ const JudgeReview = ({ msDatagb, menuName }) => {
// }, [rowsState.page, rowsState.pageSize, selectedYear, searchTxt]);
}, [search]);
const handleOnCellClick = (e) => {
const handleOnCellClick = async (e) => {
if (e?.field === 'msDate') {
// findJudge(e.row?.msDate).then((res) => {
// setRowData(res.data);
// setCreate(false);
setSelectedRowData({
...selectedRowData,
const params = {
msDatagb: e.row.msDatagb,
msSdate: e.row.msSdate,
msEdate: e.row.msEdate,
msChasu: e.row.msChasu,
msuTeam: e.row.msuTeam
};
await findJudgeDetails(params).then((response) => {
if (response && response.data) {
const totData = response.data?.totData;
const judgeDataList = response.data?.judgeData;
const rows = judgeDataList.map((m) => {
let result = { ...m };
const users = [...m.simsa];
delete result.simsa;
users.map((u) => {
result = { ...result, [u.NAME]: u.msResult };
return result;
});
return result;
// return users.map((u) => ({ ...result, [u.NAME]: u.msResult }));
});
const cols = [];
Object.keys(rows[0]).forEach((k) => {
cols.push(k);
});
setJudgeDetailData({
...judgeDetailData,
totData,
judgeData: response.data?.judgeData,
colNames: cols
});
setTitle(`${menuName} 의견진술 심의 상세 목록`);
setOpen(true);
}
});
setTitle(`${menuName} 의견진술 심의 상세 목록`);
setOpen(true);
// });
}
};
@ -208,7 +241,7 @@ const JudgeReview = ({ msDatagb, menuName }) => {
handleCellClick={handleOnCellClick}
/>
<CmmModal isBackdrop title={title} open={open} setOpen={setOpen}>
<ModalJudgeDetail {...selectedRowData} />
<ModalJudgeDetail {...judgeDetailData} />
</CmmModal>
</MainCard>
);

@ -1,5 +1,5 @@
import Board from '../board/Board';
import { useCallback, useEffect, useState } from 'react';
import { useCallback, useEffect, useMemo, useState } from 'react';
import { findJudge, findJudgeDetails } from 'apis/judge';
import {
Box,
@ -22,22 +22,23 @@ import { visuallyHidden } from '@mui/utils';
// project imports
import MainCard from 'ui-component/cards/MainCard';
const ModalDetails = ({ msDatagb, msSdate, msEdate, msChasu, msuTeam }) => {
const [rowData, setRowData] = useState({});
const [totalCount, setTotalCount] = useState(0);
const [rowsState, setRowsState] = useState({
page: 0,
pageSize: 20,
rows: []
// loading: false
});
const [rows, setRows] = useState([]);
const columns = [];
const tableHeader = null;
const ModalJudgeDetail = ({ totData, judgeData, colNames }) => {
// const [rowData, setRowData] = useState({});
//
// const [totalCount, setTotalCount] = useState(0);
// const [rowsState, setRowsState] = useState({
// page: 0,
// pageSize: 20,
// rows: []
// // loading: false
// });
// const [rows, setRows] = useState([]);
//
// const columns = [];
//
// const tableHeader = null;
/*
const search = useCallback(() => {
const params = {
msDatagb,
@ -87,15 +88,20 @@ const ModalDetails = ({ msDatagb, msSdate, msEdate, msChasu, msuTeam }) => {
}
});
}, [msDatagb, msSdate, msEdate, msChasu, msuTeam]);
*/
const init = useMemo(() => {
console.log(totData, judgeData, colNames);
}, []);
useEffect(() => {
// if (isInit.current) {
// isInit.current = false;
// return;
// }
search();
// }, [rowsState.page, rowsState.pageSize, selectedYear, searchTxt]);
}, [search]);
// useEffect(() => {
// // if (isInit.current) {
// // isInit.current = false;
// // return;
// // }
// init();
// // }, [rowsState.page, rowsState.pageSize, selectedYear, searchTxt]);
// }, []);
return (
<MainCard content={false}>
@ -103,29 +109,24 @@ const ModalDetails = ({ msDatagb, msSdate, msEdate, msChasu, msuTeam }) => {
<Table sx={{ minWidth: 650 }} size="small" aria-label="a dense table">
<TableHead>
<TableRow>
{columns.map((k) => (
<TableCell sx={{ pl: 3 }}>{k}</TableCell>
{colNames.map((name, idx) => (
<TableCell sx={{ pl: 3 }}>{name}</TableCell>
))}
</TableRow>
</TableHead>
<TableBody>
{/* {rows.map((row) => ( */}
{/* <TableRow hover key={row.name}> */}
{/* <TableCell sx={{ pl: 3 }} component="th" scope="row"> */}
{/* {row.name} */}
{/* </TableCell> */}
{/* <TableCell align="right">{row.calories}</TableCell> */}
{/* <TableCell align="right">{row.fat}</TableCell> */}
{/* <TableCell align="right">{row.carbs}</TableCell> */}
{/* <TableCell sx={{ pr: 3 }} align="right"> */}
{/* {row.protein} */}
{/* </TableCell> */}
{/* </TableRow> */}
{/* ))} */}
{judgeData.map((row) => (
<TableRow hover key={row.scSeq}>
<TableCell sx={{ pl: 3 }} component="th" scope="row">
{row.scSeq}
</TableCell>
<TableCell align="right">{row.scCarnum}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</TableContainer>
</MainCard>
);
};
export default ModalDetails;
export default ModalJudgeDetail;

@ -223,7 +223,7 @@ const MuiDataGrid = ({
MuiDataGrid.propTypes = {
// apiRef: PropTypes.func,
isToolbar: PropTypes.bool.isRequired,
isToolbar: PropTypes.bool,
children: PropTypes.node,
isCheckbox: PropTypes.bool,
// isDisableSelection: PropTypes.bool,

Loading…
Cancel
Save