diff --git a/src/apis/parking.js b/src/apis/parking.js index 858de21..b65449b 100644 --- a/src/apis/parking.js +++ b/src/apis/parking.js @@ -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; diff --git a/src/views/biz/judge/JudgeReview.jsx b/src/views/biz/judge/JudgeReview.jsx index f9498a1..71019d1 100644 --- a/src/views/biz/judge/JudgeReview.jsx +++ b/src/views/biz/judge/JudgeReview.jsx @@ -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, diff --git a/src/views/biz/parking/ParkingReview.jsx b/src/views/biz/parking/ParkingReview.jsx index b534b8b..7102840 100644 --- a/src/views/biz/parking/ParkingReview.jsx +++ b/src/views/biz/parking/ParkingReview.jsx @@ -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 = () => ; - - /* - 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: '심사기간', + headerName: '심사 기간', + headerAlign: 'center', field: 'msDate', - minWidth: 180, - description: '심사기간', + minWidth: 200, + width: 250, + 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} - // - ) + ), + align: 'center' }, { - headerName: '심사마감일시', + 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) => [} label="Delete" onClick={removeSimsa(params.row)} />] + getActions: (params) => [} 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 ( @@ -191,7 +238,16 @@ const ParkingReview = () => { - + + + + ); };