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

main
minuk926 3 years ago
parent 86ade7e4ee
commit 88ccb1c6c7

@ -1,6 +1,26 @@
import Board from '../board/Board'; import Board from '../board/Board';
import { useCallback, useEffect, useState } from 'react'; import { useCallback, useEffect, useState } from 'react';
import { findJudgeDetails } from 'apis/judge'; import { findJudge, findJudgeDetails } from 'apis/judge';
import {
Box,
Checkbox,
IconButton,
Table,
TableBody,
TableCell,
TableContainer,
TableHead,
TablePagination,
TableSortLabel,
TableRow,
Toolbar,
Tooltip,
Typography
} from '@mui/material';
import { visuallyHidden } from '@mui/utils';
// project imports
import MainCard from 'ui-component/cards/MainCard';
const ModalDetails = ({ msDatagb, msSdate, msEdate, msChasu, msuTeam }) => { const ModalDetails = ({ msDatagb, msSdate, msEdate, msChasu, msuTeam }) => {
const [rowData, setRowData] = useState({}); const [rowData, setRowData] = useState({});
@ -12,6 +32,11 @@ const ModalDetails = ({ msDatagb, msSdate, msEdate, msChasu, msuTeam }) => {
rows: [] rows: []
// loading: false // loading: false
}); });
const [rows, setRows] = useState([]);
const columns = [];
const tableHeader = null;
const search = useCallback(() => { const search = useCallback(() => {
const params = { const params = {
@ -27,27 +52,36 @@ const ModalDetails = ({ msDatagb, msSdate, msEdate, msChasu, msuTeam }) => {
console.log(response.data); console.log(response.data);
const totUserList = response.data?.totUserList; const totUserList = response.data?.totUserList;
const resultList = response.data?.resultList; const resultList = response.data?.resultList;
const gridRows = []; setRows(() => {
const aaa = resultList.map((m) => { resultList.map((m) => {
// const users = m.simsa.map((u) => ({ ...m, name: u.NAME, msResult: u.msResult, msuResult: u.msuResult })); let result = { ...m };
m.simsa.reduce((pre, cur) => { const users = [...m.simsa];
console.log(pre, cur); delete result.simsa;
// return pre.concat(cur); users.map((u) => {
return { pre, ...cur }; result = { ...result, [u.NAME]: u.msResult };
return result;
});
return result;
// return users.map((u) => ({ ...result, [u.NAME]: u.msResult }));
});
Object.keys(rows[0]).forEach((k) => {
columns.push(k);
}); });
return m;
}); });
/*
gridRows.push({
msMainCode: m.msMainCode,
msSeq: m.msSeq,
msCarnum: m.msCarnum,
}) // Object.keys(gridRows[0]).forEach((k) => {
*/ // // console.log(k, v);
// columns.push({ headerName: k, headerAlign: 'center', field: k, align: 'center' });
// });
// setColdef(columns);
// for (const k in gridRows[0]) {
// columns.push({ headerName: k, headerAlign: 'center', field: k, align: 'center' });
// }
setTotalCount(totUserList.length); setTotalCount(rows.length);
setRowsState((prevState) => ({ ...prevState, rows: response.data })); setRowsState((prevState) => ({ ...prevState, rows }));
// apiRef.current.forceUpdate(); // .updateRowData([]); // apiRef.current.forceUpdate(); // .updateRowData([]);
// apiRef.current.updateRowData([]); // apiRef.current.updateRowData([]);
} }
@ -64,9 +98,34 @@ const ModalDetails = ({ msDatagb, msSdate, msEdate, msChasu, msuTeam }) => {
}, [search]); }, [search]);
return ( return (
<> <MainCard content={false}>
<h2>dkdkkdkd</h2> <TableContainer>
</> <Table sx={{ minWidth: 650 }} size="small" aria-label="a dense table">
<TableHead>
<TableRow>
{columns.map((k) => (
<TableCell sx={{ pl: 3 }}>{k}</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> */}
{/* ))} */}
</TableBody>
</Table>
</TableContainer>
</MainCard>
); );
}; };
export default ModalDetails; export default ModalDetails;

@ -112,9 +112,6 @@ const ResidentDataReview = ({ scDatagb, menuName }) => {
<Grid item xs={12}> <Grid item xs={12}>
<Divider /> <Divider />
</Grid> </Grid>
<Grid item xs={12}>
<Divider />
</Grid>
<MuiDataGrid <MuiDataGrid
columns={columns} columns={columns}
rowsState={rowsState} rowsState={rowsState}

Loading…
Cancel
Save