fix: 심의결과 반영

main
minuk926 3 years ago
parent b875d6c2d7
commit 3ea29bb96c

@ -55,6 +55,11 @@
rel="stylesheet"
crossorigin="anonymous"
/>
<style>
.alert-swal{
z-index: 100000;
}
</style>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>

@ -10,7 +10,8 @@ import {
GET_JUDGE_TARGET_LIST,
GET_JUDGE_LIST,
SAVE_JUDGE_TARGET_LIST,
GET_JUDGE_DETAIL_LIST
GET_JUDGE_RESULT_LIST,
GET_PARKING_JUDGE_RESULT_LIST
} from 'commons/ApiUrl';
import { setRowId } from './common';
@ -50,8 +51,8 @@ export async function findJudges(params) {
return res;
}
export async function findJudgeDetails(params) {
const res = await axios.get(GET_JUDGE_DETAIL_LIST, { params });
export async function findJudgeResults2(params) {
const res = await axios.get(GET_JUDGE_RESULT_LIST, { params });
if (res.success) {
// res.data = res.data.map((d, idx) => ({ ...d, rowId: setRowId(params, idx) }));
return res;
@ -59,6 +60,50 @@ export async function findJudgeDetails(params) {
return res;
}
/**
* 심의 결과 가공 처리
* @param params
* @param isParking 주정차 심의결과 요청 인지 여부
* @returns {Promise<{judgeData: ([]|*), judgeTeam: *, totJudgeUserData: *[][], simsaUser: *}|*>}
*/
export async function findJudgeResults(params, isParking) {
const res = await axios.get(isParking ? GET_PARKING_JUDGE_RESULT_LIST : GET_JUDGE_RESULT_LIST, { params });
if (res && res.data) {
const totData = res.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 = res.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 }));
});
return {
totJudgeUserData: totUserData,
judgeData: res.data?.judgeData,
simsaUser: judgeDataList[0].simsa,
judgeTeam: totData[totData.length - 1].msuTeam
};
}
return res;
}
export async function findJudgeTargets(params) {
const res = await axios.get(GET_JUDGE_TARGET_LIST, { params });
if (res.success) {

@ -3,7 +3,7 @@
//----------------------------------------------------------------------------
import axios from 'utils/axios';
import { GET_PARKING_DETAIL_LIST, GET_PARKING_JUDGE_TARGET_LIST, GET_PARKING_LIST, SAVE_PARKING_JUDGE_TARGET_LIST } from 'commons/ApiUrl';
import { GET_PARKING_JUDGE_TARGET_LIST, GET_PARKING_LIST, SAVE_PARKING_JUDGE_TARGET_LIST } from 'commons/ApiUrl';
import { setRowId } from './common';
// eslint-disable-next-line no-return-await
@ -16,15 +16,6 @@ export async function findParkings(params) {
return res;
}
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) }));
return res;
}
return res;
}
export async function findParkingJudgeTargets(params) {
const res = await axios.get(GET_PARKING_JUDGE_TARGET_LIST, { params });
if (res.success) {

@ -16,7 +16,7 @@ export const GET_BOARD_LIST = '/api/v1/ctgy/board';
// 주정차 의견 진술
export const GET_PARKING_LIST = '/api/v1/ctgy/parking';
export const GET_PARKING_DETAIL_LIST = '/api/v1/ctgy/parking/detail';
export const GET_PARKING_JUDGE_RESULT_LIST = '/api/v1/ctgy/parking/result';
export const GET_PARKING_JUDGE_TARGET_LIST = '/api/v1/ctgy/parking/target';
export const SAVE_PARKING_JUDGE_TARGET_LIST = '/api/v1/ctgy/parking/target';
@ -25,7 +25,7 @@ export const GET_JUDGE_DATA_LIST = '/api/v1/ctgy/judge/data';
export const SAVE_JUDGE_DATA = '/api/v1/ctgy/judge/data';
export const GET_JUDGE_DATA = '/api/v1/ctgy/judge/data/';
export const GET_JUDGE_LIST = '/api/v1/ctgy/judge';
export const GET_JUDGE_DETAIL_LIST = '/api/v1/ctgy/judge/detail';
export const GET_JUDGE_RESULT_LIST = '/api/v1/ctgy/judge/result';
export const GET_JUDGE_TARGET_LIST = '/api/v1/ctgy/judge/target';
export const SAVE_JUDGE_TARGET_LIST = '/api/v1/ctgy/judge/target';

@ -1,5 +1,6 @@
const combo = {
teams: [
{ code: '', value: '-- 선택 --' },
{ code: '001', value: '1팀' },
{ code: '002', value: '2팀' },
{ code: '003', value: '3팀' },

@ -16,7 +16,6 @@ const Board = Loadable(lazy(() => import('views/biz/board/Board')));
// parking
const ParkingReview = Loadable(lazy(() => import('views/biz/parking/ParkingReview')));
const ParkingDetails = Loadable(lazy(() => import('views/biz/parking/ModalDetails')));
const ParkingRegister = Loadable(lazy(() => import('views/biz/parking/ParkingRegister')));
// Resident /Disabled
@ -114,11 +113,6 @@ const MainRoutes = {
element: <Board />
},
{
path: '/parking/details',
element: <ParkingDetails />
},
// ----------------------------------------
{
path: '/sample-page',

@ -32,6 +32,9 @@ const alertError = (config, request, response, error) => {
icon: 'error',
title: 'Api Error',
html: `${response.message}`,
customClass: {
container: 'alert-swal'
},
// imageUrl:
timer: 5000
}).then((r) => r);
@ -42,11 +45,15 @@ const alertError = (config, request, response, error) => {
const errMsg = response.data?.message || response.data?.error;
console.error(`============= ${errCode}: ${errMsg} ====================`);
Swal.close();
// Alert.error(`${errCode}: ${errMsg}`);
Swal.fire({
icon: 'error',
title: 'Api Error',
html: `${errMsg} [ ${errCode} ]`,
customClass: {
container: 'alert-swal'
},
// imageUrl:
timer: 5000
}).then((r) => r);
@ -61,6 +68,9 @@ const alertError = (config, request, response, error) => {
icon: 'error',
title: 'Api Error',
html: errMsg,
customClass: {
container: 'alert-swal'
},
// imageUrl:
timer: 5000
}).then((r) => r);
@ -107,6 +117,9 @@ axiosService.interceptors.response.use(
icon: 'error',
title: 'Api Error',
html: `${response.data.message}`,
customClass: {
container: 'alert-swal'
},
// imageUrl:
timer: 5000
}).then((r) => r);

@ -16,9 +16,9 @@ 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 { findJudgeDetails, findJudges } from 'apis/judge';
import { findJudgeResults, findJudges } from 'apis/judge';
import CmmModal from 'views/form/Modal/CmmModal';
import ModalJudgeDetail from './ModalJudgeDetail';
import ModalJudgeResult from './ModalJudgeResult';
import PropTypes from 'prop-types';
const JudgeReview = ({ msDatagb, menuName }) => {
@ -39,10 +39,12 @@ const JudgeReview = ({ msDatagb, menuName }) => {
rows: []
// loading: false
});
const [judgeDetailData, setJudgeDetailData] = useState({
const [judgeResultData, setJudgeResultData] = useState({
totJudgeUserData: [],
judgeData: [],
simsaUser: []
simsaUser: [],
selectedRow: {},
judgeTeam: ''
});
const removeJudge = useCallback(
@ -149,44 +151,14 @@ const JudgeReview = ({ msDatagb, menuName }) => {
msChasu: e.row.msChasu,
msuTeam: e.row.msuTeam
};
await findJudgeDetails(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(`${menuName} 의견진술 심의 상세 목록`);
setOpen(true);
}
const res = await findJudgeResults(params);
setJudgeResultData({
...res,
selectedRow: e.row
});
setTitle(`${e.row.msCdate} ${menuName} 심사 결과 (${e.row.msChasu}차)`);
setOpen(true);
}
};
@ -245,7 +217,7 @@ const JudgeReview = ({ msDatagb, menuName }) => {
handleCellClick={handleOnCellClick}
/>
<CmmModal isBackdrop title={title} open={open} setOpen={setOpen}>
<ModalJudgeDetail {...judgeDetailData} />
<ModalJudgeResult {...judgeResultData} />
</CmmModal>
</MainCard>
);

@ -1,117 +0,0 @@
import Paper from '@mui/material/Paper';
import Table from '@mui/material/Table';
import TableBody from '@mui/material/TableBody';
import TableCell, { tableCellClasses } from '@mui/material/TableCell';
import TableContainer from '@mui/material/TableContainer';
import TableHead from '@mui/material/TableHead';
import TableRow from '@mui/material/TableRow';
import { styled } from '@mui/material/styles';
import { Divider, Grid } from '@mui/material';
import PropTypes from 'prop-types';
const StyledTableCell = styled(TableCell)(({ theme }) => ({
[`&.${tableCellClasses.head}`]: {
backgroundColor: theme.palette.common.black,
color: theme.palette.common.white
},
[`&.${tableCellClasses.body}`]: {
// fontSize: 14
}
}));
const StyledTableRow = styled(TableRow)(({ theme }) => ({
'&:nth-of-type(odd)': {
backgroundColor: theme.palette.action.hover
},
// hide last border
'&:last-child td, &:last-child th': {
border: 0
}
}));
const ModalJudgeDetail = ({ totJudgeUserData, judgeData, simsaUser }) => {
const totLabel = ['부과', '서손', '미부과', '계'];
return (
<Paper sx={{ width: '100%', overflow: 'hidden' }}>
<TableContainer sx={{ maxwidth: 950, maxHeight: 700 }}>
<Table stickyHeader aria-label="sticky table">
<TableHead>
<TableRow>
{/* <StyledTableCell align="center" style={{ minWidth: 80 }} hidden> */}
{/* 민원코드 */}
{/* </StyledTableCell> */}
<StyledTableCell align="center" style={{ width: 95 }}>
접수번호
</StyledTableCell>
<StyledTableCell align="center" style={{ width: 130 }}>
차량번호
</StyledTableCell>
{simsaUser.map((u) => (
<StyledTableCell align="center" style={{ width: 80 }}>
{u.NAME}
</StyledTableCell>
))}
<StyledTableCell align="center" style={{ width: 80 }}>
결과
</StyledTableCell>
</TableRow>
</TableHead>
<TableBody>
{/* 심사 통계 */}
{totJudgeUserData.map((totData, idx) => (
<StyledTableRow hover key={idx}>
<StyledTableCell align="center" style={{ width: 95 }}>
{totLabel[idx]}
</StyledTableCell>
<StyledTableCell align="center" style={{ width: 130 }} />
{totData.map((data) => (
<StyledTableCell align="center" style={{ width: 80 }}>
{data}
</StyledTableCell>
))}
</StyledTableRow>
))}
</TableBody>
<TableBody sx={{ mt: 3 }}>
<Grid item xs={12}>
<Divider />
<Divider />
</Grid>
{/* 접수번호별 심사 결과 */}
{judgeData.map((row) => (
<StyledTableRow hover key={row.msSeq}>
{/* <StyledTableCell>{row.msMaincode}</StyledTableCell> */}
<StyledTableCell align="center" style={{ width: 95 }}>
{row.msSeq}
</StyledTableCell>
<StyledTableCell align="center" style={{ width: 130 }}>
{row.msCarnum}
</StyledTableCell>
{/* 심사위원별 심사결과 */}
{row.simsa.map((r) => (
<StyledTableCell align="center" style={{ width: 80 }}>
{r.msuResult}
</StyledTableCell>
))}
{/* 최종심사결과 */}
<StyledTableCell align="center" style={{ width: 80 }}>
{row.simsa[0].msResult}
</StyledTableCell>
</StyledTableRow>
))}
</TableBody>
</Table>
</TableContainer>
</Paper>
);
};
ModalJudgeDetail.propTypes = {
totJudgeUserData: PropTypes.array.isRequired,
judgeData: PropTypes.array.isRequired,
simsaUser: PropTypes.array.isRequired
};
export default ModalJudgeDetail;

@ -0,0 +1,201 @@
import Paper from '@mui/material/Paper';
import Table from '@mui/material/Table';
import TableBody from '@mui/material/TableBody';
import TableCell, { tableCellClasses } from '@mui/material/TableCell';
import TableContainer from '@mui/material/TableContainer';
import TableHead from '@mui/material/TableHead';
import TableRow from '@mui/material/TableRow';
import { styled } from '@mui/material/styles';
import { Divider, FormControl, Grid, InputLabel, MenuItem, Select, Typography } from '@mui/material';
import PropTypes from 'prop-types';
import Box from '@mui/material/Box';
import combo from 'commons/combo_data';
import { useState } from 'react';
import Button from '@mui/material/Button';
import { IconSearch } from '@tabler/icons';
import { findJudgeResults } from 'apis/judge';
import { useAlert } from 'react-alert';
const StyledTableCell = styled(TableCell)(({ theme }) => ({
[`&.${tableCellClasses.head}`]: {
backgroundColor: theme.palette.common.black,
color: theme.palette.common.white
},
[`&.${tableCellClasses.body}`]: {
// fontSize: 14
}
}));
const StyledTableRow = styled(TableRow)(({ theme }) => ({
'&:nth-of-type(odd)': {
backgroundColor: theme.palette.action.hover
},
// hide last border
'&:last-child td, &:last-child th': {
border: 0
}
}));
const ModalJudgeResult = ({ totJudgeUserData, judgeData, simsaUser, selectedRow, judgeTeam }) => {
const alert = useAlert();
const [judgeResult, setJudgeResult] = useState({
totJudgeUserData,
judgeData,
simsaUser
});
const [msuTeam, setMsuTeam] = useState(judgeTeam);
const totLabel = ['부과', '서손', '미부과', '계'];
console.log(totJudgeUserData, judgeData, simsaUser, selectedRow, judgeTeam);
const onSearch = async () => {
if (msuTeam) {
const params = {
msDatagb: selectedRow.msDatagb ?? '',
msSdate: selectedRow.msSdate,
msEdate: selectedRow.msEdate,
msChasu: selectedRow.msChasu,
msuTeam
};
const res = await findJudgeResults(params, params.msDatagb === '');
// TODO: alert
if (res && res.isAxiosError) {
setJudgeResult({
...judgeResult,
totJudgeUserData: [],
judgeData: [],
simsaUser: []
});
alert.show('조회된 데이타가 없습니다.');
return;
}
setJudgeResult({
...judgeResult,
totJudgeUserData: res.totJudgeUserData,
judgeData: res.judgeData,
simsaUser: res.simsaUser
});
// totJudgeUserData = res.totJudgeUserData;
// judgeData = res.judgeData;
// simsaUser = res.simsaUser;
// selectedRow,
// judgeTeam: msuTeam
// });
}
};
return (
<Box>
<Grid container spacing={2} alignItems="center">
<Grid item xs={12}>
<Grid container spacing={1}>
<Grid item>
<Typography variant="subtitle1">
심의차수: {selectedRow.msChasu} 심의기간: {selectedRow.msSdate} ~ {selectedRow.msEdate}
</Typography>
</Grid>
<Grid item xs={12} sm={2}>
<FormControl fullWidth>
<InputLabel required></InputLabel>
<Select defaultValue={msuTeam} onChange={(e) => setMsuTeam(e.target.value)}>
{combo.teams.map((team) => (
<MenuItem key={team.code} value={team.code}>
{team.value}
</MenuItem>
))}
</Select>
</FormControl>
</Grid>
<Grid item sx={{ marginTop: 3 }}>
<Button variant="contained" color="primary" size="small" startIcon={<IconSearch />} onClick={onSearch}>
조회
</Button>
</Grid>
</Grid>
</Grid>
</Grid>
<Paper sx={{ width: '100%', overflow: 'hidden' }}>
<TableContainer sx={{ maxwidth: 950, maxHeight: 700 }}>
<Table stickyHeader aria-label="sticky table">
<TableHead>
<TableRow>
{/* <StyledTableCell align="center" style={{ minWidth: 80 }} hidden> */}
{/* 민원코드 */}
{/* </StyledTableCell> */}
<StyledTableCell align="center" style={{ width: 95 }}>
접수번호
</StyledTableCell>
<StyledTableCell align="center" style={{ width: 130 }}>
차량번호
</StyledTableCell>
{judgeResult.simsaUser.map((u) => (
<StyledTableCell align="center" style={{ width: 80 }}>
{u.NAME}
</StyledTableCell>
))}
<StyledTableCell align="center" style={{ width: 80 }}>
결과
</StyledTableCell>
</TableRow>
</TableHead>
<TableBody>
{/* 심사 통계 */}
{judgeResult.totJudgeUserData.map((totData, idx) => (
<StyledTableRow hover key={idx}>
<StyledTableCell align="center" style={{ width: 95 }}>
{totLabel[idx]}
</StyledTableCell>
<StyledTableCell align="center" style={{ width: 130 }} />
{totData.map((data) => (
<StyledTableCell align="center" style={{ width: 80 }}>
{data}
</StyledTableCell>
))}
</StyledTableRow>
))}
</TableBody>
<TableBody sx={{ mt: 3 }}>
<Grid item xs={12}>
<Divider />
<Divider />
</Grid>
{/* 접수번호별 심사 결과 */}
{judgeResult.judgeData.map((row) => (
<StyledTableRow hover key={row.msSeq}>
{/* <StyledTableCell>{row.msMaincode}</StyledTableCell> */}
<StyledTableCell align="center" style={{ width: 95 }}>
{row.msSeq}
</StyledTableCell>
<StyledTableCell align="center" style={{ width: 130 }}>
{row.msCarnum}
</StyledTableCell>
{/* 심사위원별 심사결과 */}
{row.simsa.map((r) => (
<StyledTableCell align="center" style={{ width: 80 }}>
{r.msuResult}
</StyledTableCell>
))}
{/* 최종심사결과 */}
<StyledTableCell align="center" style={{ width: 80 }}>
{row.simsa[0].msResult}
</StyledTableCell>
</StyledTableRow>
))}
</TableBody>
</Table>
</TableContainer>
</Paper>
</Box>
);
};
ModalJudgeResult.propTypes = {
totJudgeUserData: PropTypes.array.isRequired,
judgeData: PropTypes.array.isRequired,
simsaUser: PropTypes.array.isRequired,
selectedRow: PropTypes.object.isRequired,
judgeTeam: PropTypes.string
};
export default ModalJudgeResult;

@ -94,7 +94,7 @@ const SaveJudgeTargetForm = ({ handleModalSave }) => {
<Grid item xs={12} sm={2}>
<FormControl fullWidth>
<InputLabel required></InputLabel>
<Select name="reviewYear" defaultValue={msuTeam} onChange={(e) => setMsuTeam(e.target.value)}>
<Select defaultValue={msuTeam} onChange={(e) => setMsuTeam(e.target.value)}>
{combo.teams.map((team) => (
<MenuItem key={team.code} value={team.code}>
{team.value}

@ -1,8 +0,0 @@
import Board from '../board/Board';
const ModalDetails = () => (
<>
<Board />
</>
);
export default ModalDetails;

@ -17,15 +17,15 @@ import MainCard from 'ui-component/cards/MainCard';
// project imports
import MuiDataGrid from 'views/form/MuiDataGrid';
import xitCmm from 'commons/XitCmm';
import { findParkings, findParkingDetails } from 'apis/parking';
import { findParkings } from 'apis/parking';
import { findJudgeResults } from 'apis/judge';
import InputLabel from '../../../ui-component/extended/Form/InputLabel';
import ModalJudgeDetail from 'views/biz/judge/ModalJudgeDetail';
import ModalJudgeResult from 'views/biz/judge/ModalJudgeResult';
import CmmModal from 'views/form/Modal/CmmModal';
const ParkingReview = () => {
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,10 +41,12 @@ const ParkingReview = () => {
rows: []
// loading: false
});
const [judgeDetailData, setJudgeDetailData] = useState({
const [judgeResultData, setJudgeResultData] = useState({
totJudgeUserData: [],
judgeData: [],
simsaUser: []
simsaUser: [],
selectedRow: {},
judgeTeam: ''
});
const removeJudge = useCallback(
@ -144,50 +146,21 @@ const ParkingReview = () => {
const handleOnCellClick = async (e) => {
if (e?.field === 'msDate') {
const params = {
msDatagb: e.row.msDatagb,
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);
}
const res = await findJudgeResults(params, true);
setJudgeResultData({
...res,
selectedRow: e.row
});
setTitle(`${e.row.msCdate} 주정차 심사 결과 (${e.row.msChasu}차)`);
setOpen(true);
}
};
@ -246,7 +219,7 @@ const ParkingReview = () => {
handleCellClick={handleOnCellClick}
/>
<CmmModal isBackdrop title={title} open={open} setOpen={setOpen}>
<ModalJudgeDetail {...judgeDetailData} />
<ModalJudgeResult {...judgeResultData} />
</CmmModal>
</MainCard>
);

Loading…
Cancel
Save