feat: 주정차 심의 상세 반영

main
Lim Jonguk 3 years ago
parent 58d7eb3fad
commit b875d6c2d7

@ -19,7 +19,7 @@ export async function findParkings(params) {
export async function findParkingDetails(params) {
const res = await axios.get(GET_PARKING_DETAIL_LIST, { params });
if (res.success) {
res.data = res.data.map((d, idx) => ({ ...d, rowId: setRowId(params, idx) }));
// res.data = res.data.map((d, idx) => ({ ...d, rowId: setRowId(params, idx) }));
return res;
}
return res;

@ -27,8 +27,6 @@ const JudgeReview = ({ msDatagb, menuName }) => {
const years = _.range(year, year - 14, -1);
const [open, setOpen] = useState(false);
// const [create, setCreate] = useState(false);
// const [selectedRow, setSelectedRow] = useState({});
const [title, setTitle] = useState();
const [selectedYear, setSelectedYear] = useState(year);
@ -166,7 +164,7 @@ const JudgeReview = ({ msDatagb, menuName }) => {
});
const judgeDataList = response.data?.judgeData;
const rows = judgeDataList.map((m) => {
judgeDataList.map((m) => {
let result = { ...m };
const users = [...m.simsa];
delete result.simsa;
@ -178,11 +176,6 @@ const JudgeReview = ({ msDatagb, menuName }) => {
// return users.map((u) => ({ ...result, [u.NAME]: u.msResult }));
});
const cols = [];
Object.keys(rows[0]).forEach((k) => {
cols.push(k);
});
setJudgeDetailData({
...judgeDetailData,
totJudgeUserData: totUserData,

@ -17,9 +17,10 @@ import MainCard from 'ui-component/cards/MainCard';
// project imports
import MuiDataGrid from 'views/form/MuiDataGrid';
import xitCmm from 'commons/XitCmm';
import ModalDetails from './ModalDetails';
import { findParkings } from 'apis/parking';
import { findParkings, findParkingDetails } from 'apis/parking';
import InputLabel from '../../../ui-component/extended/Form/InputLabel';
import ModalJudgeDetail from 'views/biz/judge/ModalJudgeDetail';
import CmmModal from 'views/form/Modal/CmmModal';
const ParkingReview = () => {
const isInit = useRef(true);
@ -27,6 +28,9 @@ const ParkingReview = () => {
console.log(typeof year);
const years = _.range(year, year - 14, -1);
const [open, setOpen] = useState(false);
const [title, setTitle] = useState();
const [selectedYear, setSelectedYear] = useState(year);
const [searchTxt, setSearchTxt] = useState('');
@ -37,7 +41,13 @@ const ParkingReview = () => {
rows: []
// loading: false
});
const removeSimsa = useCallback(
const [judgeDetailData, setJudgeDetailData] = useState({
totJudgeUserData: [],
judgeData: [],
simsaUser: []
});
const removeJudge = useCallback(
(row) => () => {
// setTimeout(() => {
// setRowsState((prevRows) => prevRows.filter((row) => row.rowId !== rowId));
@ -48,64 +58,51 @@ const ParkingReview = () => {
[]
);
const openModalDetails = () => <ModalDetails />;
/*
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: '심의차수', field: 'msChasu' },
{ headerName: '심사건수', field: 'cnt' },
{ headerName: '심의 차수', headerAlign: 'center', field: 'msChasu', align: 'center', width: 100 },
{ headerName: '심사 건수', headerAlign: 'center', field: 'cnt', align: 'center', width: 100 },
{
headerName: '심사 기간',
headerAlign: 'center',
field: 'msDate',
minWidth: 180,
minWidth: 200,
width: 250,
description: '심사 기간',
valueGetter: (params) => `${params.row.msSdate} ~ ${params.row.msEdate}`,
renderCell: (params) => (
// <Link underline="hover" href="/parking/details" rel="noopener">
<Link
underline="hover"
// onClick={() => navigate(`/parking/details?msChasu=${params.msChasu}&msSdate=${params.msSdate}&msEdate=${params.msEdate}`)}
onClick={openModalDetails}
data-target="modalDetails"
rel="noopener"
>
{/* <Link underline="hover" href="#" onClick={() => <ModalDetails />}> */}
{/* <Link underline="hover" onClick={() => <ModalDetails />}> */}
<Link underline="hover" href="#">
{params.value}
</Link>
// <ModalDetails />
)
),
align: 'center'
},
{
headerName: '심사 마감 일시',
headerAlign: 'center',
field: 'msCdate',
type: 'dateTime',
minWidth: 125,
valueGetter: (params) => `${params.row.msCdate} ${params.row.msClosesi}`
minWidth: 150,
width: 200,
valueGetter: (params) => `${params.row.msCdate} ${params.row.msClosesi}`,
align: 'center'
},
{
headerName: '상태',
headerAlign: 'center',
field: 'msResult',
width: 150,
renderCell: (params) => <>{params.row.msResult === '1' ? '진행중' : '심사완료'}</>,
align: 'center'
},
{ headerName: '상태', field: 'msResult', renderCell: (params) => <>{params.row.msResult === '1' ? '진행중' : '심사완료'}</> },
{
headerName: '삭제',
headerAlign: 'center',
field: 'actions',
type: 'actions',
width: 80,
getActions: (params) => [<GridActionsCellItem icon={<DeleteIcon />} label="Delete" onClick={removeSimsa(params.row)} />]
getActions: (params) => [<GridActionsCellItem icon={<DeleteIcon />} label="Delete" onClick={removeJudge(params.row)} />],
align: 'center'
}
];
@ -144,6 +141,56 @@ const ParkingReview = () => {
// }, [rowsState.page, rowsState.pageSize, selectedYear, searchTxt]);
}, [search]);
const handleOnCellClick = async (e) => {
if (e?.field === 'msDate') {
const params = {
msDatagb: e.row.msDatagb,
msSdate: e.row.msSdate,
msEdate: e.row.msEdate,
msChasu: e.row.msChasu,
msuTeam: e.row.msuTeam
};
await findParkingDetails(params).then((response) => {
if (response && response.data) {
const totData = response.data?.totData;
// tot
const totUserData = [[], [], [], []];
totData.forEach((data) => {
totUserData[0].push(data.BU);
totUserData[1].push(data.SEO);
totUserData[2].push(data.MIBU);
totUserData[3].push(data.TOT);
});
const judgeDataList = response.data?.judgeData;
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 }));
});
setJudgeDetailData({
...judgeDetailData,
totJudgeUserData: totUserData,
judgeData: response.data?.judgeData,
simsaUser: judgeDataList[0].simsa
});
setTitle(`주정차 의견진술 심의 상세 목록`);
setOpen(true);
}
});
}
};
return (
<MainCard>
<Grid container spacing={2} alignItems="center">
@ -191,7 +238,16 @@ const ParkingReview = () => {
<Grid item xs={12}>
<Divider />
</Grid>
<MuiDataGrid columns={columns} rowsState={rowsState} totalCount={totalCount} setRowsState={setRowsState} />
<MuiDataGrid
columns={columns}
rowsState={rowsState}
totalCount={totalCount}
setRowsState={setRowsState}
handleCellClick={handleOnCellClick}
/>
<CmmModal isBackdrop title={title} open={open} setOpen={setOpen}>
<ModalJudgeDetail {...judgeDetailData} />
</CmmModal>
</MainCard>
);
};

Loading…
Cancel
Save