From 3aa8376a0b4f159b6fff13da9f62d67a3f3d6140 Mon Sep 17 00:00:00 2001 From: donggyu97 Date: Mon, 9 May 2022 15:36:34 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20confirm=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../biz/admin/judge/JudgeDataDetailForm.jsx | 6 +- .../biz/admin/judge/JudgeDataModifyForm.jsx | 34 +++++++++++ .../biz/admin/judge/JudgeDataNewForm.jsx | 41 ++++++++++++++ src/views/biz/admin/judge/JudgeDataReview.jsx | 26 +++++---- .../biz/admin/judge/JudgeRegistReview.jsx | 14 +++-- src/views/biz/admin/judge/JudgeReview.jsx | 26 +++++---- .../biz/admin/parking/ParkingRegister.jsx | 12 ++-- src/views/biz/admin/parking/ParkingReview.jsx | 26 +++++---- src/views/biz/board/Board.jsx | 40 +++++++------ src/views/biz/board/ModifyBoardForm.jsx | 14 +++++ src/views/biz/board/NewBoardForm.jsx | 13 +++++ .../biz/pboard/ModifyPublicBoardForm.jsx | 10 +++- src/views/biz/pboard/NewPublicBoardForm.jsx | 8 ++- src/views/biz/pboard/PublicBoard.jsx | 32 +++++++---- src/views/biz/user/UserManager.jsx | 56 +++++++++++-------- src/views/biz/user/UserManagerForm.jsx | 8 +++ 16 files changed, 268 insertions(+), 98 deletions(-) diff --git a/src/views/biz/admin/judge/JudgeDataDetailForm.jsx b/src/views/biz/admin/judge/JudgeDataDetailForm.jsx index 2348aa7..c48315d 100644 --- a/src/views/biz/admin/judge/JudgeDataDetailForm.jsx +++ b/src/views/biz/admin/judge/JudgeDataDetailForm.jsx @@ -23,7 +23,11 @@ const ModifyJudgeDataForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav }; const onRemove = () => { - handleModalSave('DELETE', { scCode: rowData.scCode }); + if (window.confirm('삭제 하시겠습니까?')) { + handleModalSave('DELETE', { scCode: rowData.scCode }); + } else { + window.close(); + } }; const viewImg = (methodName) => { diff --git a/src/views/biz/admin/judge/JudgeDataModifyForm.jsx b/src/views/biz/admin/judge/JudgeDataModifyForm.jsx index 0ff1f52..961c689 100644 --- a/src/views/biz/admin/judge/JudgeDataModifyForm.jsx +++ b/src/views/biz/admin/judge/JudgeDataModifyForm.jsx @@ -93,6 +93,40 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav // 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); }; diff --git a/src/views/biz/admin/judge/JudgeDataNewForm.jsx b/src/views/biz/admin/judge/JudgeDataNewForm.jsx index 71d9d6d..1f488dd 100644 --- a/src/views/biz/admin/judge/JudgeDataNewForm.jsx +++ b/src/views/biz/admin/judge/JudgeDataNewForm.jsx @@ -65,6 +65,47 @@ const JudgeDataNewForm = ({ scDatagb, contDocs, ingbs, handleModalSave }) => { Object.values(contads).forEach((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); }; diff --git a/src/views/biz/admin/judge/JudgeDataReview.jsx b/src/views/biz/admin/judge/JudgeDataReview.jsx index 71aeb64..00e928d 100644 --- a/src/views/biz/admin/judge/JudgeDataReview.jsx +++ b/src/views/biz/admin/judge/JudgeDataReview.jsx @@ -128,17 +128,21 @@ const JudgeDataReview = ({ scDatagb, menuName }) => { const handleSaveResident = (type, payload) => { switch (type) { case 'SAVE': - saveJudgeData(payload).then((res) => { - if (res?.success) { - setCreate(false); - setModify(false); - setDetail(false); - setOpen(false); - search(); - } else { - showAlert.show(`${res?.data.message}`); - } - }); + if (window.confirm('저장 하시겠습니까?')) { + saveJudgeData(payload).then((res) => { + if (res?.success) { + setCreate(false); + setModify(false); + setDetail(false); + setOpen(false); + search(); + } else { + showAlert.show(`${res?.data.message}`); + } + }); + } else { + window.close(); + } break; case 'DELETE': removeJudgeData(payload).then((res) => { diff --git a/src/views/biz/admin/judge/JudgeRegistReview.jsx b/src/views/biz/admin/judge/JudgeRegistReview.jsx index 0453381..daf3441 100644 --- a/src/views/biz/admin/judge/JudgeRegistReview.jsx +++ b/src/views/biz/admin/judge/JudgeRegistReview.jsx @@ -75,12 +75,16 @@ const JudgeRegistReview = ({ scDatagb, menuName }) => { }; const handleSave = () => { - if (selectionModel.length === 0) { - xitCmm.alertParam(`처리할 데이타가 없습니다`); + if (window.confirm('저장 하시겠습니까?')) { + if (selectionModel.length === 0) { + xitCmm.alertParam(`처리할 데이타가 없습니다`); + } else { + setTitle(`${menuName} 의견진술 심의목록 저장`); + setOpen(true); + // alert(`저장할 데이타 => ${selectRows}`); + } } else { - setTitle(`${menuName} 의견진술 심의목록 저장`); - setOpen(true); - // alert(`저장할 데이타 => ${selectRows}`); + window.close(); } }; diff --git a/src/views/biz/admin/judge/JudgeReview.jsx b/src/views/biz/admin/judge/JudgeReview.jsx index c558399..2008579 100644 --- a/src/views/biz/admin/judge/JudgeReview.jsx +++ b/src/views/biz/admin/judge/JudgeReview.jsx @@ -67,17 +67,21 @@ const JudgeReview = ({ msDatagb, menuName }) => { const deleteJudge = useCallback( (row) => () => { - removeJudge(row).then((response) => { - if (response && response.success) { - setRowsState({ - ...rowsState, - page: 0 - }); - search(); - } else { - alert.show(response.message); - } - }); + if (window.confirm('삭제 하시겠습니까?')) { + removeJudge(row).then((response) => { + if (response && response.success) { + setRowsState({ + ...rowsState, + page: 0 + }); + search(); + } else { + alert.show(response.message); + } + }); + } else { + window.close(); + } }, [] ); diff --git a/src/views/biz/admin/parking/ParkingRegister.jsx b/src/views/biz/admin/parking/ParkingRegister.jsx index 0237aa2..9bb2a1e 100644 --- a/src/views/biz/admin/parking/ParkingRegister.jsx +++ b/src/views/biz/admin/parking/ParkingRegister.jsx @@ -68,11 +68,15 @@ const ParkingRegister = () => { }; const handleSave = () => { - if (selectionModel.length === 0) { - xitCmm.alertParam(`처리할 데이타가 없습니다`); + if (window.confirm('저장 하시겠습니까?')) { + if (selectionModel.length === 0) { + xitCmm.alertParam(`처리할 데이타가 없습니다`); + } else { + setOpen(true); + // alert(`저장할 데이타 => ${selectRows}`); + } } else { - setOpen(true); - // alert(`저장할 데이타 => ${selectRows}`); + window.close(); } }; diff --git a/src/views/biz/admin/parking/ParkingReview.jsx b/src/views/biz/admin/parking/ParkingReview.jsx index ef1fa43..aafff45 100644 --- a/src/views/biz/admin/parking/ParkingReview.jsx +++ b/src/views/biz/admin/parking/ParkingReview.jsx @@ -68,17 +68,21 @@ const ParkingReview = () => { const removeJudge = useCallback( (row) => () => { - removeParkingJudge(row).then((response) => { - if (response && response.success) { - setRowsState({ - ...rowsState, - page: 0 - }); - search(); - } else { - alert.show(response.message); - } - }); + if (window.confirm('삭제 하시겠습니까?')) { + removeParkingJudge(row).then((response) => { + if (response && response.success) { + setRowsState({ + ...rowsState, + page: 0 + }); + search(); + } else { + alert.show(response.message); + } + }); + } else { + window.close(); + } }, [] ); diff --git a/src/views/biz/board/Board.jsx b/src/views/biz/board/Board.jsx index a6e8370..8952cd5 100644 --- a/src/views/biz/board/Board.jsx +++ b/src/views/biz/board/Board.jsx @@ -119,24 +119,32 @@ const Board = () => { const submitBoard = (type, payload) => { switch (type) { case 'SAVE': - saveBoard(payload).then((res) => { - if (res?.success) { - search(); - setOpen(false); - } else { - alert.show(`${res?.data.message}`); - } - }); // .then((res) => { + if (window.confirm('저장 하시겠습니까?')) { + saveBoard(payload).then((res) => { + if (res?.success) { + search(); + setOpen(false); + } else { + alert.show(`${res?.data.message}`); + } + }); // .then((res) => { + } else { + window.close(); + } break; case 'DELETE': - removeBoard(payload).then((res) => { - if (res?.success) { - search(); - setOpen(false); - } else { - alert.show(`${res?.data.message}`); - } - }); // .then((res) => { + if (window.confirm('삭제 하시겠습니까?')) { + removeBoard(payload).then((res) => { + if (res?.success) { + search(); + setOpen(false); + } else { + alert.show(`${res?.data.message}`); + } + }); // .then((res) => { + } else { + window.close(); + } break; default: } diff --git a/src/views/biz/board/ModifyBoardForm.jsx b/src/views/biz/board/ModifyBoardForm.jsx index eb389ac..e2d1146 100644 --- a/src/views/biz/board/ModifyBoardForm.jsx +++ b/src/views/biz/board/ModifyBoardForm.jsx @@ -32,6 +32,20 @@ const ModifyBoardForm = (props) => { ciPass: pass }; + const replaceContents = contents.replace('


', '').length; + if (subject.length < 1) { + alert('제목은 필수입니다.'); + return; + } + if (replaceContents < 1) { + alert('내용은 필수입니다.'); + return; + } + if (pass === undefined || pass === '') { + alert('비밀번호는 필수입니다.'); + return; + } + handleModalSave('SAVE', saveData); }; diff --git a/src/views/biz/board/NewBoardForm.jsx b/src/views/biz/board/NewBoardForm.jsx index 803a005..1a9d6a2 100644 --- a/src/views/biz/board/NewBoardForm.jsx +++ b/src/views/biz/board/NewBoardForm.jsx @@ -32,6 +32,19 @@ const BoardForm = (props) => { ciContents: contents, ciPass: pass }; + const replaceContents = contents.replace('


', '').length; + if (subject.length < 1) { + alert('제목은 필수입니다.'); + return; + } + if (replaceContents < 1) { + alert('내용은 필수입니다.'); + return; + } + if (pass === undefined || pass === '') { + alert('비밀번호는 필수입니다.'); + return; + } handleModalSave('SAVE', saveData); }; diff --git a/src/views/biz/pboard/ModifyPublicBoardForm.jsx b/src/views/biz/pboard/ModifyPublicBoardForm.jsx index 86a5330..d3e238e 100644 --- a/src/views/biz/pboard/ModifyPublicBoardForm.jsx +++ b/src/views/biz/pboard/ModifyPublicBoardForm.jsx @@ -21,8 +21,8 @@ const ModifyPublicBoardForm = (props) => { const alert = useAlert(); const quillRef = useRef(); const [dept, setDept] = useState(rowData?.inDept); - const [subject, setSubject] = useState(rowData?.inTitle); - const [contents, setContents] = useState(rowData?.inContents); + const [subject, setSubject] = useState(rowData?.inTitle ?? ''); + const [contents, setContents] = useState(rowData?.inContents ?? ''); const [filesInfo, setFilesInfo] = useState(); const [selectedFile, setSelectedFile] = useState(rowData?.inFilename); // 파일 // const [fileData, setFileData] = useState(); @@ -43,6 +43,12 @@ const ModifyPublicBoardForm = (props) => { // eslint-disable-next-line no-plusplus for (let i = 0; i < filesInfo.length; i++) formData.append('files', filesInfo[i]); } + + const replaceContent = contents.replace('


', '').length; + if (subject.length < 1 || replaceContent < 1) { + alert.show('제목과 내용은 필수입니다.'); + return; + } handleModalSave('SAVE', formData); }; diff --git a/src/views/biz/pboard/NewPublicBoardForm.jsx b/src/views/biz/pboard/NewPublicBoardForm.jsx index 962d657..3e90bb3 100644 --- a/src/views/biz/pboard/NewPublicBoardForm.jsx +++ b/src/views/biz/pboard/NewPublicBoardForm.jsx @@ -13,6 +13,7 @@ import InputLabel from 'ui-component/extended/Form/InputLabel'; import { List, Save } from '@mui/icons-material'; import FileForm from 'views/cmm/file-ctl/FileForm'; import PropTypes from 'prop-types'; +import { value } from 'lodash/seq'; const NewPublicBoardForm = (props) => { // eslint-disable-next-line react/prop-types @@ -41,6 +42,11 @@ const NewPublicBoardForm = (props) => { // eslint-disable-next-line no-plusplus for (let i = 0; i < filesInfo.length; i++) formData.append('files', filesInfo[i]); } + const replaceContent = contents.replace('


', '').length; + if (subject.length < 1 || replaceContent < 1) { + alert.show('제목과 내용은 필수입니다.'); + return; + } handleModalSave('SAVE', formData); }; @@ -98,7 +104,7 @@ const NewPublicBoardForm = (props) => { - 업무구분 + 업무구분