feat: 거주자/장애인 자료 삭제 반영

main
minuk926 3 years ago
parent 2a6534630f
commit ce0a274712

@ -13,7 +13,8 @@ import {
GET_JUDGE_RESULT_LIST,
GET_PARKING_JUDGE_RESULT_LIST,
REMOVE_JUDGE,
GET_JUDGE_FILE_DOWNLOAD
GET_JUDGE_FILE_DOWNLOAD,
REMOVE_JUDGE_DATA
} from 'commons/ApiUrl';
import { setRowId } from './common';
import FileSaver from 'file-saver';
@ -37,6 +38,11 @@ export async function saveJudgeData(formData) {
});
}
export async function removeJudgeData(params) {
// eslint-disable-next-line no-return-await
return await axios.post(REMOVE_JUDGE_DATA, params);
}
export async function findJudge(scCode) {
// eslint-disable-next-line no-return-await
return await axios.get(GET_JUDGE_DATA + scCode);

@ -28,12 +28,15 @@ export const REMOVE_PARKING_JUDGE = '/api/v1/ctgy/parking/remove';
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 REMOVE_JUDGE_DATA = '/api/v1/ctgy/judge/data/remove';
export const GET_JUDGE_LIST = '/api/v1/ctgy/judge';
export const GET_JUDGE_RESULT_LIST = '/api/v1/ctgy/judge/result';
export const GET_JUDGE_FILE_DOWNLOAD = '/api/v1/ctgy/cmm/download/judge';
export const GET_JUDGE_TARGET_LIST = '/api/v1/ctgy/judge/target';
export const SAVE_JUDGE_TARGET_LIST = '/api/v1/ctgy/judge/target';
export const REMOVE_JUDGE = '/api/v1/ctgy/judge/remove';
export const GET_JUDGE_FILE_DOWNLOAD = '/api/v1/ctgy/cmm/download/judge';
// 사용자 관리
export const GET_USER_LIST = '/api/v1/ctgy/user';

@ -1,35 +1,29 @@
import { useEffect, useState } from 'react';
import { useState } from 'react';
import PropTypes from 'prop-types';
import NumberFormat from 'react-number-format';
import { useAlert } from 'react-alert';
import _ from 'lodash';
import { Grid, TextField, MenuItem, Select, FormControl, InputLabel, InputAdornment, Divider } from '@mui/material';
import Button from '@mui/material/Button';
import { IconSearch, IconFileDownload } from '@tabler/icons';
import { IconSearch } from '@tabler/icons';
import { judgeFileDownload } from '../../../apis/judge';
import { Delete, FileDownload, FileUpload, List } from '@mui/icons-material';
import { Delete, List } from '@mui/icons-material';
import ImageFileTextForm from '../../cmm/ImageFileTextForm';
// const toDate = new Date();
const ModifyJudgeDataForm = ({ rowData, handleModalSave, setOpen, contDocs, ingbs }) => {
const ModifyJudgeDataForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSave, onModify }) => {
const showAlert = useAlert();
const [selectedContDoc, setSelectedContDoc] = useState(rowData.scContDoc);
const [selectedIngb, setSelectedIngb] = useState(rowData.scIngb);
const onModify = () => {};
const onList = () => {
setOpen(false);
};
const onRemove = () => {
handleModalSave('DELETE', rowData.scCode);
handleModalSave('DELETE', { scCode: rowData.scCode });
};
const viewImg = (methodName) => {
@ -150,7 +144,7 @@ const ModifyJudgeDataForm = ({ rowData, handleModalSave, setOpen, contDocs, ingb
fullWidth
required
label="우편번호"
value={rowData.zippost1}
value={rowData.zipcode1}
InputProps={{
display: 'none',
readOnly: true,
@ -262,7 +256,10 @@ const ModifyJudgeDataForm = ({ rowData, handleModalSave, setOpen, contDocs, ingb
};
ModifyJudgeDataForm.propTypes = {
rowData: PropTypes.object.isRequired,
contDocs: PropTypes.array.isRequired,
ingbs: PropTypes.array.isRequired,
handleModalSave: PropTypes.func.isRequired,
setOpen: PropTypes.func.isRequired
setOpen: PropTypes.func.isRequired,
onModify: PropTypes.func.isRequired
};
export default ModifyJudgeDataForm;

@ -1,4 +1,4 @@
import { useEffect, useState } from 'react';
import { useState } from 'react';
import PropTypes from 'prop-types';
import NumberFormat from 'react-number-format';
@ -9,22 +9,19 @@ import { Grid, TextField, MenuItem, Select, FormControl, InputLabel, InputAdornm
import Button from '@mui/material/Button';
import { IconSearch } from '@tabler/icons';
import { getComboCodeList } from 'apis/common';
import FileInputForms from 'views/cmm/FileInputForms';
// const toDate = new Date();
const JudgeDataModifyForm = ({ rowData, handleModalSave }) => {
const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSave }) => {
const alert = useAlert();
const [scCarnum, setScCarnum] = useState(rowData.scCarnum);
const [scName, setScName] = useState(rowData.scName);
const [scDong, setScDong] = useState(rowData.scDong);
const [scContDoc, setScContDoc] = useState();
const [selectedContDoc, setSelectedContDoc] = useState(rowData.scContDoc);
const [scIngb, setScIngb] = useState();
const [selectedIngb, setSelectedIngb] = useState(rowData.scIngb);
const [zippost1, setZippost1] = useState(`${rowData.zippost1}${rowData.zippost2}`);
const [zipcode1, setZipcode1] = useState((rowData.zipcode1 ?? '') + (rowData.zipcode2 ?? ''));
const [scJuso, setScJuso] = useState(rowData.scJuso);
const [scBunji, setScBunji] = useState(rowData.scBunji);
const [scWdate, setScWdate] = useState(rowData.scWdate);
@ -48,7 +45,7 @@ const JudgeDataModifyForm = ({ rowData, handleModalSave }) => {
formData.append('scWdate', scWdate);
formData.append('scJbtime', scJbtime);
formData.append('scPos', scPos);
formData.append('zippost1', zippost1);
formData.append('zipcode1', zipcode1);
formData.append('scJuso', scJuso);
formData.append('scBunji', scBunji);
@ -67,19 +64,6 @@ const JudgeDataModifyForm = ({ rowData, handleModalSave }) => {
handleModalSave(formData);
};
useEffect(() => {
// setSelectedContDoc('11');
setScContDoc([]);
getComboCodeList({ codeMcd: 'SC_CONT_DOC' }).then((res) => {
console.log(res);
setScContDoc(res.data);
});
getComboCodeList({ codeMcd: 'RC_INGB' }).then((res) => {
console.log(res);
setScIngb(res.data);
});
}, []);
const handleChangeFile = (e) => {
const fileKey = e.target.name;
const fileArrKey = fileKey + e.target.dataset.index;
@ -129,9 +113,14 @@ const JudgeDataModifyForm = ({ rowData, handleModalSave }) => {
<Grid item sm={3}>
<FormControl fullWidth>
<InputLabel required>진술유형</InputLabel>
<Select size="small" defaultValue="11" onChange={(e) => setSelectedContDoc(e?.target?.value)}>
{scContDoc &&
scContDoc.map((contDoc) => (
<Select
size="small"
defaultValue={selectedContDoc}
value={selectedContDoc}
onChange={(e) => setSelectedContDoc(e?.target?.value)}
>
{contDocs &&
contDocs.map((contDoc) => (
<MenuItem key={contDoc.code} value={contDoc.code}>
{contDoc.value}
</MenuItem>
@ -156,9 +145,9 @@ const JudgeDataModifyForm = ({ rowData, handleModalSave }) => {
<Grid item sm={3}>
<FormControl fullWidth>
<InputLabel required>접수방법</InputLabel>
<Select size="small" defaultValue="1" onChange={(e) => setSelectedIngb(e?.target?.value)}>
{scIngb &&
scIngb.map((ingb) => (
<Select size="small" defaultValue={selectedIngb} value={selectedIngb} onChange={(e) => setSelectedIngb(e?.target?.value)}>
{ingbs &&
ingbs.map((ingb) => (
<MenuItem key={ingb.code} value={ingb.code}>
{ingb.value}
</MenuItem>
@ -192,7 +181,7 @@ const JudgeDataModifyForm = ({ rowData, handleModalSave }) => {
</Grid>
</Grid>
<Grid container spacing={0.5} item xs={12} mb={2}>
<Grid item sm={12}>
<Grid item sm={6}>
<TextField
size="small"
required
@ -202,6 +191,12 @@ const JudgeDataModifyForm = ({ rowData, handleModalSave }) => {
onChange={(e) => setScPos(e?.target?.value)}
/>
</Grid>
<Grid item sm={3}>
<TextField disabled size="small" required label="전송상태" fullWidth value={rowData.scTransferNm} />
</Grid>
<Grid item sm={3}>
<TextField disabled size="small" required label="자료상태" fullWidth value={rowData.scStateNm} />
</Grid>
</Grid>
<Grid container spacing={0.5} item xs={12} mb={2}>
<Grid item sm={1.7}>
@ -210,8 +205,8 @@ const JudgeDataModifyForm = ({ rowData, handleModalSave }) => {
fullWidth
required
label="우편번호"
value={zippost1}
onChange={(e) => setZippost1(e?.target?.value)}
value={zipcode1 ?? ''}
onChange={(e) => setZipcode1(e?.target?.value)}
InputProps={{
display: 'none',
readOnly: true,
@ -456,6 +451,9 @@ const JudgeDataModifyForm = ({ rowData, handleModalSave }) => {
};
JudgeDataModifyForm.propTypes = {
rowData: PropTypes.object.isRequired,
handleModalSave: PropTypes.func.isRequired
contDocs: PropTypes.array.isRequired,
ingbs: PropTypes.array.isRequired,
handleModalSave: PropTypes.func.isRequired,
setOpen: PropTypes.func.isRequired
};
export default JudgeDataModifyForm;

@ -1,4 +1,4 @@
import { useEffect, useState } from 'react';
import { useState } from 'react';
import PropTypes from 'prop-types';
import NumberFormat from 'react-number-format';
@ -9,22 +9,19 @@ import { Grid, TextField, MenuItem, Select, FormControl, InputLabel, InputAdornm
import Button from '@mui/material/Button';
import { IconSearch } from '@tabler/icons';
import { getComboCodeList } from 'apis/common';
import FileInputForms from 'views/cmm/FileInputForms';
const toDate = new Date();
const JudgeDataNewForm = ({ handleModalSave, scDatagb, contDocs, ingbs }) => {
const JudgeDataNewForm = ({ scDatagb, contDocs, ingbs, handleModalSave }) => {
const alert = useAlert();
const [scCarnum, setScCarnum] = useState('');
const [scName, setScName] = useState('');
const [scDong, setScDong] = useState('');
// const [scContDoc, setScContDoc] = useState();
const [selectedContDoc, setSelectedContDoc] = useState('11');
// const [scIngb, setScIngb] = useState();
const [selectedIngb, setSelectedIngb] = useState('1');
const [zippost1, setZippost1] = useState(null);
const [zipcode1, setZipcode1] = useState(null);
const [scJuso, setScJuso] = useState('');
const [scBunji, setScBunji] = useState('');
const [scWdate, setScWdate] = useState(null);
@ -49,7 +46,7 @@ const JudgeDataNewForm = ({ handleModalSave, scDatagb, contDocs, ingbs }) => {
formData.append('scWdate', scWdate ? scWdate?.replace(/-/g, '') : '');
formData.append('scJbtime', scJbtime ? scJbtime?.replace(/:/g, '') : '');
formData.append('scPos', scPos);
formData.append('zippost1', zippost1);
formData.append('zipcode1', zipcode1);
formData.append('scJuso', scJuso);
formData.append('scBunji', scBunji);
@ -68,19 +65,6 @@ const JudgeDataNewForm = ({ handleModalSave, scDatagb, contDocs, ingbs }) => {
handleModalSave('SAVE', formData);
};
// useEffect(() => {
// // setSelectedContDoc('11');
// setScContDoc([]);
// getComboCodeList({ codeMcd: 'SC_CONT_DOC' }).then((res) => {
// console.log(res);
// setScContDoc(res.data);
// });
// getComboCodeList({ codeMcd: 'RC_INGB' }).then((res) => {
// console.log(res);
// setScIngb(res.data);
// });
// }, []);
const handleChangeFile = (e) => {
const fileKey = e.target.name;
const fileArrKey = fileKey + e.target.dataset.index;
@ -209,8 +193,8 @@ const JudgeDataNewForm = ({ handleModalSave, scDatagb, contDocs, ingbs }) => {
fullWidth
required
label="우편번호"
value={zippost1}
onChange={(e) => setZippost1(e?.target?.value)}
value={zipcode1}
onChange={(e) => setZipcode1(e?.target?.value)}
InputProps={{
display: 'none',
readOnly: true,
@ -446,7 +430,9 @@ const JudgeDataNewForm = ({ handleModalSave, scDatagb, contDocs, ingbs }) => {
);
};
JudgeDataNewForm.propTypes = {
handleModalSave: PropTypes.func.isRequired,
scDatagb: PropTypes.string.isRequired
scDatagb: PropTypes.string.isRequired,
contDocs: PropTypes.array.isRequired,
ingbs: PropTypes.array.isRequired,
handleModalSave: PropTypes.func.isRequired
};
export default JudgeDataNewForm;

@ -8,14 +8,14 @@ import MainCard from 'ui-component/cards/MainCard';
// project imports
import MuiDataGrid from 'views/cmm/MuiDataGrid';
import CmmModal from 'views/cmm/CmmModal';
import { findJudge, findJudgeDatas, saveJudgeData } from 'apis/judge';
import { findJudge, findJudgeDatas, removeJudgeData, saveJudgeData } from 'apis/judge';
import JudgeDataNewForm from 'views/biz/judge/JudgeDataNewForm';
import PropTypes from 'prop-types';
import xitCmm from 'commons/XitCmm';
import DetailJudgeDataForm from './JudgeDataDetailForm';
import JudgeDataDetailForm from './JudgeDataDetailForm';
import { useAlert } from 'react-alert';
import { removePublicBoard, savePublicBoard } from '../../../apis/public';
import { getComboCodeList } from '../../../apis/common';
import JudgeDataModifyForm from './JudgeDataModifyForm';
const JudgeDataReview = ({ scDatagb, menuName }) => {
const showAlert = useAlert();
@ -24,6 +24,8 @@ const JudgeDataReview = ({ scDatagb, menuName }) => {
const [open, setOpen] = useState(false);
const [create, setCreate] = useState(false);
const [detail, setDetail] = useState(false);
const [modify, setModify] = useState(false);
// const [selectedRow, setSelectedRow] = useState({});
const [title, setTitle] = useState();
const [rowData, setRowData] = useState({});
@ -88,12 +90,6 @@ const JudgeDataReview = ({ scDatagb, menuName }) => {
}, [rowsState.page, rowsState.pageSize, scDatagb]);
useEffect(() => {
getComboCodeList({ codeMcd: 'SC_CONT_DOC' }).then((res) => {
setScContDocs(res.data);
});
getComboCodeList({ codeMcd: 'RC_INGB' }).then((res) => {
setScIngbs(res.data);
});
search();
}, [search]);
@ -107,17 +103,21 @@ const JudgeDataReview = ({ scDatagb, menuName }) => {
}, []);
const handleCreate = () => {
setTitle(`${menuName} 의견진술 자료 신규 등록`);
setModify(false);
setDetail(false);
setCreate(true);
setTitle(`${menuName} 의견진술 자료 신규 등록`);
setOpen(true);
};
const handleOnCellClick = (e) => {
if (e?.field === 'scSeq') {
findJudge(e.row?.scCode).then((res) => {
setRowData(res.data);
setCreate(false);
setTitle(`${menuName} 의견진술 자료 변경`);
setModify(false);
setDetail(true);
setRowData(res.data);
setTitle(`${menuName} 의견진술 자료 상세`);
setOpen(true);
});
}
@ -128,20 +128,43 @@ const JudgeDataReview = ({ scDatagb, menuName }) => {
case 'SAVE':
saveJudgeData(payload).then((res) => {
if (res?.success) {
search();
setCreate(false);
setModify(false);
setDetail(false);
setOpen(false);
search();
} else {
showAlert.show(`${res?.data.message}`);
}
});
break;
case 'DELETE':
alert('~~~~~~삭제 구현~~~~~~');
removeJudgeData(payload).then((res) => {
if (res?.success) {
setCreate(false);
setModify(false);
setDetail(false);
setOpen(false);
search();
} else {
showAlert.show(`${res?.data.message}`);
}
});
break;
default:
}
};
const openModify = () => {
setOpen(false);
setCreate(false);
setDetail(false);
setModify(true);
setTitle(`${menuName} 의견진술 자료 변경`);
setOpen(true);
};
return (
<MainCard>
<Grid container>
@ -166,13 +189,24 @@ const JudgeDataReview = ({ scDatagb, menuName }) => {
<CmmModal isBackdrop title={title} open={open} setOpen={setOpen}>
{create && <JudgeDataNewForm handleModalSave={handleSaveResident} scDatagb={scDatagb} contDocs={scContDocs} ingbs={scIngbs} />}
{/* {!create && <JudgeDataModifyForm handleModalSave={handleSaveResident} rowData={rowData} />} */}
{!create && (
<DetailJudgeDataForm
handleModalSave={handleSaveResident}
{detail && (
<JudgeDataDetailForm
rowData={rowData}
contDocs={scContDocs}
ingbs={scIngbs}
setOpen={setOpen}
handleModalSave={handleSaveResident}
onModify={openModify}
/>
)}
{modify && (
<JudgeDataModifyForm
rowData={rowData}
contDocs={scContDocs}
ingbs={scIngbs}
setOpen={setOpen}
handleModalSave={handleSaveResident}
onModify={openModify}
/>
)}
</CmmModal>

@ -11,7 +11,7 @@ const ImageFileTextForm = ({ labelName, fileName = '', methodName, handleViewImg
fullWidth
label={labelName}
value={fileName}
onClick={(e) => handleViewImg(methodName)}
onClick={() => handleViewImg(methodName)}
InputProps={{
display: 'none',
endAdornment: (
@ -23,7 +23,7 @@ const ImageFileTextForm = ({ labelName, fileName = '', methodName, handleViewImg
/>
)}
{!fileName && (
<TextField disabled size="small" fullWidth label={labelName} value={fileName} onClick={(e) => handleViewImg(methodName)} />
<TextField disabled size="small" fullWidth label={labelName} value={fileName} onClick={() => handleViewImg(methodName)} />
)}
</>
);

Loading…
Cancel
Save