feat: confirm 적용

main
donggyu97 3 years ago
parent 23a1adfb05
commit 3aa8376a0b

@ -23,7 +23,11 @@ const ModifyJudgeDataForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
}; };
const onRemove = () => { const onRemove = () => {
handleModalSave('DELETE', { scCode: rowData.scCode }); if (window.confirm('삭제 하시겠습니까?')) {
handleModalSave('DELETE', { scCode: rowData.scCode });
} else {
window.close();
}
}; };
const viewImg = (methodName) => { const viewImg = (methodName) => {

@ -93,6 +93,40 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
// console.log(pair[0], pair[1]); // console.log(pair[0], pair[1]);
// } // }
//
if (scCarnum.length < 1) {
alert.show('차량번호는 필수입니다.');
return;
}
if (scName.length < 1) {
alert.show('성명은 필수입니다.');
return;
}
if (scDong.length < 1) {
alert.show('동명은(는) 필수입니다.');
return;
}
if (scCdate.length < 1) {
alert.show('접수일자는 필수입니다.');
return;
}
if (scWdate.length < 1) {
alert.show('위반일자는 필수입니다.');
return;
}
if (scJbtime.length < 1) {
alert.show('위반시간은 필수입니다.');
return;
}
if (zipcode1.length < 1) {
alert.show('우편번호는 필수입니다.');
return;
}
if (rowData.scPicad1.length < 1 || rowData.scFrecad1.length < 1 || rowData.scContad1.length < 1) {
alert.show('단속사진,진술서,첨부자료는 하나씩 업로드 되야합니다.');
return;
}
handleModalSave('SAVE', formData); handleModalSave('SAVE', formData);
}; };

@ -65,6 +65,47 @@ const JudgeDataNewForm = ({ scDatagb, contDocs, ingbs, handleModalSave }) => {
Object.values(contads).forEach((v) => { Object.values(contads).forEach((v) => {
formData.append('contadFiles', v); formData.append('contadFiles', v);
}); });
// console.log(Object.values(picads)[0]);
//
if (scCarnum.length < 1) {
alert.show('차량번호는 필수입니다.');
return;
}
if (scName.length < 1) {
alert.show('성명은 필수입니다.');
return;
}
if (scDong.length < 1) {
alert.show('동명은(는) 필수입니다.');
return;
}
if (scCdate.length < 1) {
alert.show('접수일자는 필수입니다.');
return;
}
if (scWdate === null || scWdate === '') {
alert.show('위반일자는 필수입니다.');
return;
}
if (scJbtime === null || scJbtime === '') {
alert.show('위반시간은 필수입니다.');
return;
}
if (scPos.length < 1) {
alert.show('위반장소는 필수입니다.');
return;
}
if (zipcode1 === null || zipcode1 === '') {
alert.show('우편번호는 필수입니다.');
return;
}
if (Object.values(picads)[0] === undefined) {
alert.show('단속사진은 하나이상 업로드 해야 합니다.');
return;
}
handleModalSave('SAVE', formData); handleModalSave('SAVE', formData);
}; };

@ -128,17 +128,21 @@ const JudgeDataReview = ({ scDatagb, menuName }) => {
const handleSaveResident = (type, payload) => { const handleSaveResident = (type, payload) => {
switch (type) { switch (type) {
case 'SAVE': case 'SAVE':
saveJudgeData(payload).then((res) => { if (window.confirm('저장 하시겠습니까?')) {
if (res?.success) { saveJudgeData(payload).then((res) => {
setCreate(false); if (res?.success) {
setModify(false); setCreate(false);
setDetail(false); setModify(false);
setOpen(false); setDetail(false);
search(); setOpen(false);
} else { search();
showAlert.show(`${res?.data.message}`); } else {
} showAlert.show(`${res?.data.message}`);
}); }
});
} else {
window.close();
}
break; break;
case 'DELETE': case 'DELETE':
removeJudgeData(payload).then((res) => { removeJudgeData(payload).then((res) => {

@ -75,12 +75,16 @@ const JudgeRegistReview = ({ scDatagb, menuName }) => {
}; };
const handleSave = () => { const handleSave = () => {
if (selectionModel.length === 0) { if (window.confirm('저장 하시겠습니까?')) {
xitCmm.alertParam(`처리할 데이타가 없습니다`); if (selectionModel.length === 0) {
xitCmm.alertParam(`처리할 데이타가 없습니다`);
} else {
setTitle(`${menuName} 의견진술 심의목록 저장`);
setOpen(true);
// alert(` => ${selectRows}`);
}
} else { } else {
setTitle(`${menuName} 의견진술 심의목록 저장`); window.close();
setOpen(true);
// alert(` => ${selectRows}`);
} }
}; };

@ -67,17 +67,21 @@ const JudgeReview = ({ msDatagb, menuName }) => {
const deleteJudge = useCallback( const deleteJudge = useCallback(
(row) => () => { (row) => () => {
removeJudge(row).then((response) => { if (window.confirm('삭제 하시겠습니까?')) {
if (response && response.success) { removeJudge(row).then((response) => {
setRowsState({ if (response && response.success) {
...rowsState, setRowsState({
page: 0 ...rowsState,
}); page: 0
search(); });
} else { search();
alert.show(response.message); } else {
} alert.show(response.message);
}); }
});
} else {
window.close();
}
}, },
[] []
); );

@ -68,11 +68,15 @@ const ParkingRegister = () => {
}; };
const handleSave = () => { const handleSave = () => {
if (selectionModel.length === 0) { if (window.confirm('저장 하시겠습니까?')) {
xitCmm.alertParam(`처리할 데이타가 없습니다`); if (selectionModel.length === 0) {
xitCmm.alertParam(`처리할 데이타가 없습니다`);
} else {
setOpen(true);
// alert(` => ${selectRows}`);
}
} else { } else {
setOpen(true); window.close();
// alert(` => ${selectRows}`);
} }
}; };

@ -68,17 +68,21 @@ const ParkingReview = () => {
const removeJudge = useCallback( const removeJudge = useCallback(
(row) => () => { (row) => () => {
removeParkingJudge(row).then((response) => { if (window.confirm('삭제 하시겠습니까?')) {
if (response && response.success) { removeParkingJudge(row).then((response) => {
setRowsState({ if (response && response.success) {
...rowsState, setRowsState({
page: 0 ...rowsState,
}); page: 0
search(); });
} else { search();
alert.show(response.message); } else {
} alert.show(response.message);
}); }
});
} else {
window.close();
}
}, },
[] []
); );

@ -119,24 +119,32 @@ const Board = () => {
const submitBoard = (type, payload) => { const submitBoard = (type, payload) => {
switch (type) { switch (type) {
case 'SAVE': case 'SAVE':
saveBoard(payload).then((res) => { if (window.confirm('저장 하시겠습니까?')) {
if (res?.success) { saveBoard(payload).then((res) => {
search(); if (res?.success) {
setOpen(false); search();
} else { setOpen(false);
alert.show(`${res?.data.message}`); } else {
} alert.show(`${res?.data.message}`);
}); // .then((res) => { }
}); // .then((res) => {
} else {
window.close();
}
break; break;
case 'DELETE': case 'DELETE':
removeBoard(payload).then((res) => { if (window.confirm('삭제 하시겠습니까?')) {
if (res?.success) { removeBoard(payload).then((res) => {
search(); if (res?.success) {
setOpen(false); search();
} else { setOpen(false);
alert.show(`${res?.data.message}`); } else {
} alert.show(`${res?.data.message}`);
}); // .then((res) => { }
}); // .then((res) => {
} else {
window.close();
}
break; break;
default: default:
} }

@ -32,6 +32,20 @@ const ModifyBoardForm = (props) => {
ciPass: pass ciPass: pass
}; };
const replaceContents = contents.replace('<p><br></p>', '').length;
if (subject.length < 1) {
alert('제목은 필수입니다.');
return;
}
if (replaceContents < 1) {
alert('내용은 필수입니다.');
return;
}
if (pass === undefined || pass === '') {
alert('비밀번호는 필수입니다.');
return;
}
handleModalSave('SAVE', saveData); handleModalSave('SAVE', saveData);
}; };

@ -32,6 +32,19 @@ const BoardForm = (props) => {
ciContents: contents, ciContents: contents,
ciPass: pass ciPass: pass
}; };
const replaceContents = contents.replace('<p><br></p>', '').length;
if (subject.length < 1) {
alert('제목은 필수입니다.');
return;
}
if (replaceContents < 1) {
alert('내용은 필수입니다.');
return;
}
if (pass === undefined || pass === '') {
alert('비밀번호는 필수입니다.');
return;
}
handleModalSave('SAVE', saveData); handleModalSave('SAVE', saveData);
}; };

@ -21,8 +21,8 @@ const ModifyPublicBoardForm = (props) => {
const alert = useAlert(); const alert = useAlert();
const quillRef = useRef(); const quillRef = useRef();
const [dept, setDept] = useState(rowData?.inDept); const [dept, setDept] = useState(rowData?.inDept);
const [subject, setSubject] = useState(rowData?.inTitle); const [subject, setSubject] = useState(rowData?.inTitle ?? '');
const [contents, setContents] = useState(rowData?.inContents); const [contents, setContents] = useState(rowData?.inContents ?? '');
const [filesInfo, setFilesInfo] = useState(); const [filesInfo, setFilesInfo] = useState();
const [selectedFile, setSelectedFile] = useState(rowData?.inFilename); // const [selectedFile, setSelectedFile] = useState(rowData?.inFilename); //
// const [fileData, setFileData] = useState(); // const [fileData, setFileData] = useState();
@ -43,6 +43,12 @@ const ModifyPublicBoardForm = (props) => {
// eslint-disable-next-line no-plusplus // eslint-disable-next-line no-plusplus
for (let i = 0; i < filesInfo.length; i++) formData.append('files', filesInfo[i]); for (let i = 0; i < filesInfo.length; i++) formData.append('files', filesInfo[i]);
} }
const replaceContent = contents.replace('<p><br></p>', '').length;
if (subject.length < 1 || replaceContent < 1) {
alert.show('제목과 내용은 필수입니다.');
return;
}
handleModalSave('SAVE', formData); handleModalSave('SAVE', formData);
}; };

@ -13,6 +13,7 @@ import InputLabel from 'ui-component/extended/Form/InputLabel';
import { List, Save } from '@mui/icons-material'; import { List, Save } from '@mui/icons-material';
import FileForm from 'views/cmm/file-ctl/FileForm'; import FileForm from 'views/cmm/file-ctl/FileForm';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { value } from 'lodash/seq';
const NewPublicBoardForm = (props) => { const NewPublicBoardForm = (props) => {
// eslint-disable-next-line react/prop-types // eslint-disable-next-line react/prop-types
@ -41,6 +42,11 @@ const NewPublicBoardForm = (props) => {
// eslint-disable-next-line no-plusplus // eslint-disable-next-line no-plusplus
for (let i = 0; i < filesInfo.length; i++) formData.append('files', filesInfo[i]); for (let i = 0; i < filesInfo.length; i++) formData.append('files', filesInfo[i]);
} }
const replaceContent = contents.replace('<p><br></p>', '').length;
if (subject.length < 1 || replaceContent < 1) {
alert.show('제목과 내용은 필수입니다.');
return;
}
handleModalSave('SAVE', formData); handleModalSave('SAVE', formData);
}; };
@ -98,7 +104,7 @@ const NewPublicBoardForm = (props) => {
</Grid> </Grid>
<Grid item xs={4}> <Grid item xs={4}>
<FormControl fullWidth> <FormControl fullWidth>
<InputLabel required>업무구분</InputLabel> <InputLabel>업무구분</InputLabel>
<Select size="small" label="업무구분" required value={dept} onChange={(e) => setDept(e.target.value)} fullWidth> <Select size="small" label="업무구분" required value={dept} onChange={(e) => setDept(e.target.value)} fullWidth>
<MenuItem value="주정차위반">주정차위반</MenuItem> <MenuItem value="주정차위반">주정차위반</MenuItem>
<MenuItem value="장애인위반">장애인위반</MenuItem> <MenuItem value="장애인위반">장애인위반</MenuItem>

@ -103,20 +103,28 @@ const PublicBoard = () => {
const submitPublicBoard = (type, payload) => { const submitPublicBoard = (type, payload) => {
switch (type) { switch (type) {
case 'SAVE': case 'SAVE':
savePublicBoard(payload).then((res) => { if (window.confirm('저장 하시겠습니까?')) {
if (res?.success) { savePublicBoard(payload).then((res) => {
search(); if (res?.success) {
setOpen(false); search();
} else { setOpen(false);
alert.show(`${res?.data.message}`); } else {
} alert.show(`${res?.data.message}`);
}); // .then((res) => { }
}); // .then((res) => {
} else {
window.close();
}
break; break;
case 'DELETE': case 'DELETE':
removePublicBoard(payload).then(() => { if (window.confirm('삭제 하시겠습니까?')) {
search(); removePublicBoard(payload).then(() => {
setOpen(false); search();
}); // .then((res) => { setOpen(false);
}); // .then((res) => {
} else {
window.close();
}
break; break;
default: default:
} }

@ -184,32 +184,40 @@ const UserManager = () => {
const handleModalSave = (type, payload) => { const handleModalSave = (type, payload) => {
switch (type) { switch (type) {
case 'SAVE': case 'SAVE':
saveUser(payload).then((res) => { if (window.confirm('저장 하시겠습니까?')) {
if (res?.success) { saveUser(payload).then((res) => {
setRowsState((prevState) => ({ if (res?.success) {
...prevState, setRowsState((prevState) => ({
page: 0 ...prevState,
})); page: 0
search(); }));
setOpen(false); search();
} else { setOpen(false);
alert.show(`${res?.data.message}`); } else {
} alert.show(`${res?.data.message}`);
}); // .then((res) => { }
}); // .then((res) => {
} else {
window.close();
}
break; break;
case 'DELETE': case 'DELETE':
removeUser(payload).then((res) => { if (window.confirm('삭제 하시겠습니까?')) {
if (res?.success) { removeUser(payload).then((res) => {
setRowsState({ if (res?.success) {
...rowsState, setRowsState({
page: 0 ...rowsState,
}); page: 0
search(); });
setOpen(false); search();
} else { setOpen(false);
alert.show(`${res?.data.message}`); } else {
} alert.show(`${res?.data.message}`);
}); // .then((res) => { }
}); // .then((res) => {
} else {
window.close();
}
break; break;
default: default:
} }

@ -37,6 +37,14 @@ const UserManagementForm = (props) => {
isenable, isenable,
newYn: create ? 'Y' : 'N' newYn: create ? 'Y' : 'N'
}; };
if (userid.length < 1) {
alert('사용자 ID는 필수입니다.');
return;
}
if (passwd.length < 1) {
alert('비밀번호는 필수입니다.');
return;
}
handleModalSave('SAVE', saveParam); handleModalSave('SAVE', saveParam);
}; };

Loading…
Cancel
Save