fix: 경고 및 debugging 에러 fix

공지사항 처리
     디자인 적용
main
Lim Jonguk 3 years ago
parent ff4955f351
commit 51bc985152

@ -11,7 +11,7 @@ const DashboardDefault = Loadable(lazy(() => import('views/dashboard/Default')))
const DashboardAnalytics = Loadable(lazy(() => import('views/dashboard/Analytics')));
// admin page routing
const PublicBoard = Loadable(lazy(() => import('views/biz/board/PublicBoard')));
const PublicBoard = Loadable(lazy(() => import('views/biz/pboard/PublicBoard')));
const Board = Loadable(lazy(() => import('views/biz/board/Board')));
// parking

@ -15,8 +15,8 @@ import ImageFileTextForm from '../../../cmm/file-ctl/ImageFileTextForm';
const ModifyJudgeDataForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSave, onModify }) => {
const showAlert = useAlert();
const [selectedContDoc, setSelectedContDoc] = useState(rowData.scContDoc);
const [selectedIngb, setSelectedIngb] = useState(rowData.scIngb);
const [selectedContDoc, setSelectedContDoc] = useState(rowData?.scContDoc);
const [selectedIngb, setSelectedIngb] = useState(rowData?.scIngb);
const onList = () => {
setOpen(false);
@ -41,27 +41,27 @@ const ModifyJudgeDataForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
<>
<Grid mt={1}>
<Grid container spacing={0.5} item xs={12} mb={1.5}>
<Grid item sm={3}>
<TextField disabled size="small" required label="접수번호" fullWidth value={rowData.scSeq} />
<Grid item xs={3}>
<TextField disabled size="small" required label="접수번호" fullWidth value={rowData?.scSeq} />
</Grid>
<Grid item sm={3}>
<TextField disabled size="small" required label="전송상태" fullWidth value={rowData.scTransferNm} />
<Grid item xs={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 item xs={3}>
<TextField disabled size="small" required label="자료상태" fullWidth value={rowData?.scStateNm} />
</Grid>
<Grid item sm={3}>
<TextField disabled required label="차량번호" size="small" fullWidth value={rowData.scCarnum} autoFocus />
<Grid item xs={3}>
<TextField disabled required label="차량번호" size="small" fullWidth value={rowData?.scCarnum} autoFocus />
</Grid>
</Grid>
<Grid container spacing={1} xs={12} mt={1}>
<Grid item sm={3}>
<TextField disabled required label="성명" size="small" fullWidth value={rowData.scName} />
<Grid item xs={3}>
<TextField disabled required label="성명" size="small" fullWidth value={rowData?.scName} />
</Grid>
<Grid item sm={3}>
<TextField disabled required label="동명" size="small" fullWidth value={rowData.scDong} />
<Grid item xs={3}>
<TextField disabled required label="동명" size="small" fullWidth value={rowData?.scDong} />
</Grid>
<Grid item sm={3}>
<Grid item xs={3}>
<FormControl fullWidth>
<InputLabel disabled required>
진술유형
@ -82,7 +82,7 @@ const ModifyJudgeDataForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
</Select>
</FormControl>
</Grid>
<Grid item sm={3}>
<Grid item xs={3}>
<FormControl fullWidth>
<InputLabel disabled required>
접수방법
@ -99,7 +99,7 @@ const ModifyJudgeDataForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
</Grid>
</Grid>
<Grid container spacing={1} xs={12} mt={1}>
<Grid item sm={3}>
<Grid item xs={3}>
<NumberFormat
disabled
size="small"
@ -108,10 +108,10 @@ const ModifyJudgeDataForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
label="접수일자"
format="####-##-##"
fullWidth
value={rowData.scCdate}
value={rowData?.scCdate}
/>
</Grid>
<Grid item sm={2}>
<Grid item xs={2}>
<NumberFormat
disabled
size="small"
@ -120,10 +120,10 @@ const ModifyJudgeDataForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
label="위반일자"
format="####-##-##"
fullWidth
value={rowData.scWdate}
value={rowData?.scWdate}
/>
</Grid>
<Grid item sm={1}>
<Grid item xs={1}>
<NumberFormat
disabled
size="small"
@ -132,10 +132,10 @@ const ModifyJudgeDataForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
label="위반시간"
format="##:##"
fullWidth
value={rowData.scJbtime}
value={rowData?.scJbtime}
/>
</Grid>
<Grid item sm={6}>
<Grid item xs={6}>
<TextField
sx={{
border: '0px solid red',
@ -146,19 +146,19 @@ const ModifyJudgeDataForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
required
label="위반장소"
fullWidth
value={rowData.scPos}
value={rowData?.scPos}
/>
</Grid>
</Grid>
<Grid container spacing={1} xs={12} mt={1}>
<Grid item sm={1.7}>
<TextField disabled size="small" fullWidth required label="우편번호" value={rowData.zipcode1 + rowData.zipcode2} />
<Grid item xs={2}>
<TextField disabled size="small" fullWidth required label="우편번호" value={rowData?.zipcode1 + rowData?.zipcode2} />
</Grid>
<Grid item sm={7}>
<TextField disabled size="small" required label="주소" fullWidth value={rowData.scJuso} />
<Grid item xs={7}>
<TextField disabled size="small" required label="주소" fullWidth value={rowData?.scJuso} />
</Grid>
<Grid item sm={3.3}>
<TextField disabled size="small" required label="번지" fullWidth value={rowData.scBunji} />
<Grid item xs={3}>
<TextField disabled size="small" required label="번지" fullWidth value={rowData?.scBunji} />
</Grid>
</Grid>

@ -32,17 +32,17 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
const alert = useAlert();
const [isPostOpen, setIsPostOpen] = useState(false);
const [scCarnum, setScCarnum] = useState(rowData.scCarnum);
const [scName, setScName] = useState(rowData.scName);
const [scDong, setScDong] = useState(rowData.scDong);
const [selectedContDoc, setSelectedContDoc] = useState(rowData.scContDoc);
const [selectedIngb, setSelectedIngb] = useState(rowData.scIngb);
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);
const [scCdate, setScCdate] = useState(rowData.scCdate);
const [scJbtime, setScJbtime] = useState(rowData.scJbtime);
const [scCarnum, setScCarnum] = useState(rowData?.scCarnum);
const [scName, setScName] = useState(rowData?.scName);
const [scDong, setScDong] = useState(rowData?.scDong);
const [selectedContDoc, setSelectedContDoc] = useState(rowData?.scContDoc);
const [selectedIngb, setSelectedIngb] = useState(rowData?.scIngb);
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);
const [scCdate, setScCdate] = useState(rowData?.scCdate);
const [scJbtime, setScJbtime] = useState(rowData?.scJbtime);
const [scPos, setScPos] = useState('');
const [picads, setPicads] = useState({});
@ -189,16 +189,16 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
<>
<Grid mt={2}>
<Grid container spacing={0.5} item xs={12} mb={1.5}>
<Grid item sm={3}>
<Grid item xs={3}>
<TextField disabled size="small" required label="접수번호" fullWidth value={rowData.scSeq} />
</Grid>
<Grid item sm={3}>
<Grid item xs={3}>
<TextField disabled size="small" required label="전송상태" fullWidth value={rowData.scTransferNm} />
</Grid>
<Grid item sm={3}>
<Grid item xs={3}>
<TextField disabled size="small" required label="자료상태" fullWidth value={rowData.scStateNm} />
</Grid>
<Grid item sm={3}>
<Grid item xs={3}>
<TextField
required
label="차량번호"
@ -211,13 +211,13 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
</Grid>
</Grid>
<Grid container spacing={0.5} item xs={12} mb={1.5}>
<Grid item sm={3}>
<Grid item xs={3}>
<TextField required label="성명" size="small" fullWidth value={scName} onChange={(e) => setScName(e?.target?.value)} />
</Grid>
<Grid item sm={3}>
<Grid item xs={3}>
<TextField required label="동명" size="small" fullWidth value={scDong} onChange={(e) => setScDong(e?.target?.value)} />
</Grid>
<Grid item sm={3}>
<Grid item xs={3}>
<FormControl fullWidth>
<InputLabel required>진술유형</InputLabel>
<Select
@ -235,7 +235,7 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
</Select>
</FormControl>
</Grid>
<Grid item sm={3}>
<Grid item xs={3}>
<FormControl fullWidth>
<InputLabel required>접수방법</InputLabel>
<Select size="small" defaultValue={selectedIngb} value={selectedIngb} onChange={(e) => setSelectedIngb(e?.target?.value)}>
@ -250,7 +250,7 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
</Grid>
</Grid>
<Grid container spacing={0.5} item xs={12} mb={2}>
<Grid item sm={3}>
<Grid item xs={3}>
<NumberFormat
size="small"
customInput={TextField}
@ -262,7 +262,7 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
onChange={(e) => setScCdate(e?.target?.value)}
/>
</Grid>
<Grid item sm={2}>
<Grid item xs={2}>
<NumberFormat
size="small"
customInput={TextField}
@ -274,7 +274,7 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
onChange={(e) => setScWdate(e?.target?.value)}
/>
</Grid>
<Grid item sm={1}>
<Grid item xs={1}>
<NumberFormat
size="small"
customInput={TextField}
@ -286,7 +286,7 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
onChange={(e) => setScJbtime(e?.target?.value)}
/>
</Grid>
<Grid item sm={6}>
<Grid item xs={6}>
<TextField
sx={{
border: '0px solid red',
@ -302,7 +302,7 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
</Grid>
</Grid>
<Grid container spacing={0.5} item xs={12} mb={2}>
<Grid item sm={1.7}>
<Grid item xs={1.7}>
<TextField
size="small"
fullWidth
@ -322,17 +322,17 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
}}
/>
</Grid>
<Grid item sm={7}>
<Grid item xs={7}>
<TextField size="small" required disabled label="주소" fullWidth value={scJuso} onChange={(e) => setScJuso(e?.target?.value)} />
</Grid>
<Grid item sm={3.3}>
<Grid item xs={3.3}>
<TextField size="small" required label="번지" fullWidth value={scBunji} onChange={(e) => setScBunji(e?.target?.value)} />
</Grid>
</Grid>
<Grid container spacing={1} item xs={12} mt={1}>
{_.range(1, 5, 1).map((idx) => (
<Grid item sm={3}>
<Grid item xs={3}>
<FileInputForms
isDisabled={setFileUploadBtn('scPicad', idx)}
fieldName="scPicad"
@ -349,7 +349,7 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
</Grid>
<Grid container spacing={1} item xs={12} mt={1}>
{_.range(1, 5, 1).map((idx) => (
<Grid item sm={3}>
<Grid item xs={3}>
<FileInputForms
isDisabled={setFileUploadBtn('scFrecad', idx)}
fieldName="scFrecad"
@ -366,7 +366,7 @@ const JudgeDataModifyForm = ({ rowData, contDocs, ingbs, setOpen, handleModalSav
</Grid>
<Grid container spacing={1} item xs={12} mt={1}>
{_.range(1, 9, 1).map((idx) => (
<Grid item sm={3}>
<Grid item xs={3}>
<FileInputForms
isDisabled={setFileUploadBtn('scContad', idx)}
fieldName="scContad"

@ -208,7 +208,7 @@ const JudgeRegistReview = ({ scDatagb, menuName }) => {
columns={columns}
rowsState={rowsState}
totalCount={totalCount}
setrowsState={setRowsState}
setRowsState={setRowsState}
handleSelection={handleSelection}
selectionModel={selectionModel}
/>

@ -199,6 +199,7 @@ const JudgeReview = ({ msDatagb, menuName }) => {
id="reviewYear"
name="reviewYear"
defaultValue={year}
value={year}
onChange={(e) => setSelectedYear(e.target.value)}
>
{years.map((year, idx) => (
@ -215,7 +216,6 @@ const JudgeReview = ({ msDatagb, menuName }) => {
placeholder="심의차수"
onKeyDown={handleSearch}
size="small"
autoComplete
autoFocus
endAdornment={
<InputAdornment position="end">

@ -14,7 +14,6 @@ import { useState } from 'react';
import Button from '@mui/material/Button';
import { IconSearch } from '@tabler/icons';
import { findJudgeResults } from 'apis/judge';
import MuiAlert from 'views/cmm/MuiAlert';
import _ from 'lodash';
import { useAlert } from 'react-alert';
@ -38,23 +37,20 @@ const StyledTableRow = styled(TableRow)(({ theme }) => ({
}
}));
const totLabel = ['부과', '서손', '미부과', '계'];
const ModalJudgeResult = ({ totJudgeUsers, totJudgeUserData, judgeCars, judgeUserData, selectedRow, judgeTeam }) => {
const alert = useAlert();
const [judgeResult, setJudgeResult] = useState({
totJudgeUsers,
totJudgeUserData,
judgeCars,
judgeUserData
// judgeData
// simsaUser
});
const [msuTeam, setMsuTeam] = useState(judgeTeam);
const [alertOpen, setAlertOpen] = useState(false);
const [msuTeam, setMsuTeam] = useState(judgeTeam ?? '001');
const totLabel = ['부과', '서손', '미부과', '계'];
const alert = useAlert();
console.log(totJudgeUsers, totJudgeUserData, judgeCars, judgeUserData, judgeTeam);
const onSearch = async () => {
setAlertOpen(false);
// setAlertOpen(false);
if (msuTeam) {
const params = {
msDatagb: selectedRow.msDatagb ?? '',
@ -80,15 +76,8 @@ const ModalJudgeResult = ({ totJudgeUsers, totJudgeUserData, judgeCars, judgeUse
totJudgeUserData: [],
judgeCars: [],
judgeUserData: []
// judgeData: [],
// simsaUser: []
});
alert.show('조회된 데이타가 없습니다.');
// setAlertState({
// ...alertState,
// message: ' .'
// });
// setAlertOpen(true);
}
}
};
@ -114,7 +103,7 @@ const ModalJudgeResult = ({ totJudgeUsers, totJudgeUserData, judgeCars, judgeUse
<Grid item sm={2}>
<FormControl fullWidth>
<InputLabel required></InputLabel>
<Select defaultValue={msuTeam} onChange={(e) => setMsuTeam(e.target.value)}>
<Select defaultValue={msuTeam} value={msuTeam} onChange={(e) => setMsuTeam(e.target.value)}>
{combo.teams.map((team) => (
<MenuItem key={team.code} value={team.code}>
{team.value}
@ -204,7 +193,6 @@ const ModalJudgeResult = ({ totJudgeUsers, totJudgeUserData, judgeCars, judgeUse
</Table>
</TableContainer>
</Paper>
<MuiAlert open={alertOpen} setOpen={setAlertOpen} />
<TableFooter
sx={{
border: '0px solid red',
@ -219,10 +207,10 @@ const ModalJudgeResult = ({ totJudgeUsers, totJudgeUserData, judgeCars, judgeUse
);
};
ModalJudgeResult.propTypes = {
totJudgeUsers: PropTypes.array.isRequired,
totJudgeUserData: PropTypes.array.isRequired,
judgeCars: PropTypes.array.isRequired,
judgeUserData: PropTypes.array.isRequired,
totJudgeUsers: PropTypes.array,
totJudgeUserData: PropTypes.array,
judgeCars: PropTypes.array,
judgeUserData: PropTypes.array,
selectedRow: PropTypes.object.isRequired,
judgeTeam: PropTypes.string
};

@ -26,7 +26,7 @@ const ParkingRegister = () => {
const [rcSeq2, setRcSeq2] = useState('2022200899');
const [selectionModel, setSelectionModel] = useState([]);
const [totalCount, setTotalCount] = useState(0);
const [rowsStatus, setRowsStatus] = useState({
const [rowsState, setRowsState] = useState({
page: 0,
pageSize: 100,
rows: []
@ -62,7 +62,7 @@ const ParkingRegister = () => {
if (response && response.data) {
setSelectionModel([]);
setTotalCount(response.count);
setRowsStatus((prevRows) => ({ ...prevRows, rows: response.data }));
setRowsState((prevRows) => ({ ...prevRows, rows: response.data }));
}
});
};
@ -82,7 +82,7 @@ const ParkingRegister = () => {
rcIrTransfer,
rcSeq1,
rcSeq2,
rcCodes: selectionModel.map((d) => rowsStatus.rows[d - 1].rcCode)
rcCodes: selectionModel.map((d) => rowsState.rows[d - 1].rcCode)
};
setOpen(false);
// return false;
@ -178,7 +178,7 @@ const ParkingRegister = () => {
</Button>
</Grid>
<Grid item>
<ExcelDownload fileName="심사등록대상" gridColumns={columns} excelDatas={rowsStatus.rows} isDisabled={totalCount === 0} />
<ExcelDownload fileName="심사등록대상" gridColumns={columns} excelDatas={rowsState.rows} isDisabled={totalCount === 0} />
</Grid>
</Grid>
</Grid>
@ -194,9 +194,9 @@ const ParkingRegister = () => {
isCheckbox
isHideFooter
columns={columns}
rowsState={rowsStatus}
rowsState={rowsState}
totalCount={totalCount}
setRowsStatus={setRowsStatus}
setRowsState={setRowsState}
handleSelection={handleSelection}
selectionModel={selectionModel}
/>

@ -203,7 +203,6 @@ const ParkingReview = () => {
placeholder="심의차수"
onKeyDown={handleSearch}
size="small"
autoComplete
autoFocus
endAdornment={
<InputAdornment position="end">
@ -228,7 +227,7 @@ const ParkingReview = () => {
handleCellClick={handleOnCellClick}
/>
<CmmModal isBackdrop title={title} open={open} setOpen={setOpen}>
<ModalJudgeResult {...judgeResultData} />
{judgeResultData?.selectedRow && <ModalJudgeResult {...judgeResultData} />}
</CmmModal>
</MainCard>
);

@ -1,224 +0,0 @@
import { useMemo, useRef, useState } from 'react';
import { useAlert } from 'react-alert';
// material-ui
import { Button, Divider, FormControl, Grid, MenuItem, Select, TextField } from '@mui/material';
import ReactQuill from 'react-quill';
import 'react-quill/dist/quill.snow.css';
// project imports
import InputLabel from 'ui-component/extended/Form/InputLabel';
import { Delete, List, Save } from '@mui/icons-material';
import { fileDownload } from 'apis/common';
import FileForm from 'views/cmm/file-ctl/FileForm';
import PropTypes from 'prop-types';
const PublicBoardForm = (props) => {
// eslint-disable-next-line react/prop-types
const { create, setOpen, handleModalSave, rowData = {}, owner = false } = props;
const alert = useAlert();
const quillRef = useRef();
const [dept, setDept] = useState(create ? '주정차위반' : rowData.inDept);
const [subject, setSubject] = useState(create ? '' : rowData.inTitle);
const [contents, setContents] = useState(create ? '' : rowData.inContents);
const [filesInfo, setFilesInfo] = useState();
const [selectedFile, setSelectedFile] = useState(create ? '' : rowData.inFilename); //
// const [fileData, setFileData] = useState();
const onList = () => {
setOpen(false);
};
const onSave = () => {
// TODO : validation check
const formData = new FormData();
formData.append('inCode', rowData.inCode ?? '');
formData.append('inTitle', subject);
formData.append('inDept', dept);
formData.append('inContents', contents);
formData.append('inFilename', selectedFile ?? '');
if (filesInfo && filesInfo.length > 0) {
// eslint-disable-next-line no-plusplus
for (let i = 0; i < filesInfo.length; i++) formData.append('files', filesInfo[i]);
}
handleModalSave('SAVE', formData);
};
const onRemove = () => {
handleModalSave('DELETE', rowData.inCode);
};
const modules = useMemo(
() => ({
toolbar: {
container: [
[{ header: [1, 2, false] }],
['bold', 'italic', 'underline', 'strike', 'blockquote'],
[{ list: 'ordered' }, { list: 'bullet' }, { indent: '-1' }, { indent: '+1' }],
['link'],
[{ align: [] }, { color: [] }, { background: [] }], // dropdown with defaults from theme
['clean']
// ['image', 'video']
]
}
}),
[]
);
const formats = useMemo(
() => [
// 'font',
'header',
'bold',
'italic',
'underline',
'strike',
'blockquote',
'list',
'bullet',
'indent',
'link',
'align',
'color',
'background'
],
[]
);
const onChangeFile = (file) => {
setSelectedFile(file.name);
setFilesInfo([file]);
};
// const onChangeFile = (e) => {
// setSelectedFile(e.target.files[0].name);
// setFilesInfo(e.target.files);
// };
const handleFileDownload = () => {
if (!rowData.inFilename) {
alert.show('등록된 파일이 없습니다.');
return;
}
fileDownload(rowData.inCode, rowData.inFilename, alert).then(() => {});
};
return (
<>
<Grid mt={2}>
<Grid container spacing={1} item xs={12} mb={1}>
<Grid item xs={12} sm={6}>
<TextField
size="small"
disabled={!create}
required
label="제목"
value={subject}
onChange={(e) => setSubject(e.target.value)}
fullWidth
/>
</Grid>
<Grid item xs={12} sm={3}>
<FormControl fullWidth>
<InputLabel required>업무구분</InputLabel>
<Select
size="small"
disabled={!create}
label="업무구분"
required
value={dept}
onChange={(e) => setDept(e.target.value)}
fullWidth
>
<MenuItem value="주정차위반">주정차위반</MenuItem>
<MenuItem value="장애인위반">장애인위반</MenuItem>
<MenuItem value="기타">기타</MenuItem>
</Select>
</FormControl>
</Grid>
<Grid item xs={12} sm={3}>
<TextField size="small" disabled label="작성자" value={rowData.inName} fullWidth />
</Grid>
</Grid>
<Grid container spacing={1} item xs={12} mt={1}>
<Grid item xs={12} sm={3}>
<TextField size="small" disabled label="등록일" value={rowData.inNalja} fullWidth />
</Grid>
<Grid item xs={12} sm={3}>
<TextField size="small" disabled label="번호" value={rowData.inCode} fullWidth />
</Grid>
<Grid item xs={12} sm={3}>
<TextField size="small" disabled label="조회수" value={rowData.inHit} fullWidth />
</Grid>
</Grid>
<Grid container spacing={1} item xs={12} mt={1}>
<Grid item xs={12}>
<ReactQuill
ref={(element) => {
if (element !== null) {
quillRef.current = element;
}
}}
readOnly={!create}
value={contents}
onChange={setContents}
modules={modules}
formats={formats}
theme="snow"
placeholder="내용을 입력해주세요."
/>
</Grid>
</Grid>
<Grid container spacing={1} item xs={12} mt={1}>
<Grid item sm={6}>
<FileForm
isDownload={rowData.inFilename}
isDisabled={false}
labelName="첨부파일"
savedFilename={rowData.inFilename}
selectedFile={selectedFile}
handleChangeFile={onChangeFile}
handleFileDownload={handleFileDownload}
alert={alert}
/>
</Grid>
</Grid>
</Grid>
<Grid container spacing={1} item xs={12} mt={1} mb={1}>
<Grid item xs={12}>
<Divider />
</Grid>
</Grid>
<Grid item container spacing={0.5} xs={12}>
<Grid item>
<Button variant="contained" size="small" startIcon={<List />} onClick={onList}>
목록
</Button>
</Grid>
<Grid item style={{ marginLeft: 'auto' }}>
<Button disabled={false} variant="contained" size="small" startIcon={<Save />} onClick={onSave}>
저장
</Button>
</Grid>
{!create && (
<Grid item>
<Button disabled={false} variant="contained" size="small" startIcon={<Delete />} onClick={onRemove}>
삭제
</Button>
</Grid>
)}
</Grid>
</>
);
};
PublicBoardForm.propTypes = {
rowData: PropTypes.object.isRequired,
handleModalSave: PropTypes.func.isRequired,
setOpen: PropTypes.func.isRequired,
owner: PropTypes.bool.isRequired
};
export default PublicBoardForm;

@ -16,7 +16,7 @@ import MainCard from 'ui-component/cards/MainCard';
// project imports
import MuiDataGrid from 'views/cmm/mui-grid/MuiDataGrid';
import InputLabel from 'ui-component/extended/Form/InputLabel';
import { findByUserJudges, findJudges, removeJudge } from 'apis/judge';
import { findByUserJudges } from 'apis/judge';
import CmmModal from 'views/cmm/CmmModal';
const JudgeReview = ({ msDatagb, menuName }) => {
@ -235,7 +235,6 @@ const JudgeReview = ({ msDatagb, menuName }) => {
placeholder="심의차수"
onKeyDown={handleSearch}
size="small"
autoComplete
autoFocus
endAdornment={
<InputAdornment position="end">

@ -0,0 +1,215 @@
import { useMemo, useRef, useState } from 'react';
import { useAlert } from 'react-alert';
// material-ui
import { Button, Divider, FormControl, Grid, MenuItem, Select, TextField } from '@mui/material';
import ReactQuill from 'react-quill';
import 'react-quill/dist/quill.snow.css';
// project imports
import InputLabel from 'ui-component/extended/Form/InputLabel';
import { Delete, List, Save } from '@mui/icons-material';
import { fileDownload } from 'apis/common';
import FileForm from 'views/cmm/file-ctl/FileForm';
import PropTypes from 'prop-types';
const ModifyPublicBoardForm = (props) => {
// eslint-disable-next-line react/prop-types
const { setOpen, handleModalSave, rowData = {}, owner } = 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 [filesInfo, setFilesInfo] = useState();
const [selectedFile, setSelectedFile] = useState(rowData?.inFilename); //
// const [fileData, setFileData] = useState();
const onList = () => {
setOpen(false);
};
const onSave = () => {
// TODO : validation check
const formData = new FormData();
formData.append('inCode', rowData.inCode ?? '');
formData.append('inTitle', subject);
formData.append('inDept', dept);
formData.append('inContents', contents);
formData.append('inFilename', selectedFile ?? '');
if (filesInfo && filesInfo.length > 0) {
// eslint-disable-next-line no-plusplus
for (let i = 0; i < filesInfo.length; i++) formData.append('files', filesInfo[i]);
}
handleModalSave('SAVE', formData);
};
const onRemove = () => {
handleModalSave('DELETE', rowData.inCode);
};
const modules = useMemo(
() => ({
toolbar: {
container: [
[{ header: [1, 2, false] }],
['bold', 'italic', 'underline', 'strike', 'blockquote'],
[{ list: 'ordered' }, { list: 'bullet' }, { indent: '-1' }, { indent: '+1' }],
['link'],
[{ align: [] }, { color: [] }, { background: [] }], // dropdown with defaults from theme
['clean']
// ['image', 'video']
]
}
}),
[]
);
const formats = useMemo(
() => [
// 'font',
'header',
'bold',
'italic',
'underline',
'strike',
'blockquote',
'list',
'bullet',
'indent',
'link',
'align',
'color',
'background'
],
[]
);
const onChangeFile = (file) => {
setSelectedFile(file.name);
setFilesInfo([file]);
};
const handleFileDownload = () => {
if (!rowData.inFilename) {
alert.show('등록된 파일이 없습니다.');
return;
}
fileDownload(rowData.inCode, rowData.inFilename, alert).then(() => {});
};
return (
<>
<Grid container spacing={1} mt={1.5}>
<Grid item xs={6}>
<TextField
size="small"
disabled={!owner}
required
label="제목"
value={subject}
onChange={(e) => setSubject(e.target.value)}
fullWidth
/>
</Grid>
<Grid item xs={3}>
<FormControl fullWidth>
<InputLabel required>업무구분</InputLabel>
<Select
size="small"
disabled={!owner}
label="업무구분"
required
value={dept}
onChange={(e) => setDept(e.target.value)}
fullWidth
>
<MenuItem value="주정차위반">주정차위반</MenuItem>
<MenuItem value="장애인위반">장애인위반</MenuItem>
<MenuItem value="기타">기타</MenuItem>
</Select>
</FormControl>
</Grid>
<Grid item xs={3}>
<TextField size="small" disabled label="작성자" value={rowData.inName} fullWidth />
</Grid>
</Grid>
<Grid container spacing={1} mt={1}>
<Grid item xs={3}>
<TextField size="small" disabled label="등록일" value={rowData.inNalja} fullWidth />
</Grid>
<Grid item xs={3}>
<TextField size="small" disabled label="번호" value={rowData.inCode} fullWidth />
</Grid>
<Grid item xs={3}>
<TextField size="small" disabled label="조회수" value={rowData.inHit} fullWidth />
</Grid>
</Grid>
<Grid container spacing={1} mt={1}>
<Grid item xs={12}>
<ReactQuill
ref={(element) => {
if (element !== null) {
quillRef.current = element;
}
}}
readOnly={!owner}
value={contents}
onChange={setContents}
modules={modules}
formats={formats}
theme="snow"
placeholder="내용을 입력해주세요."
/>
</Grid>
</Grid>
<Grid container spacing={1} mt={1}>
<Grid item xs={8}>
<FileForm
isDownload={typeof rowData?.inFilename === 'undefined'}
isDisabled={!owner}
labelName="첨부파일"
savedFilename={rowData.inFilename}
selectedFile={selectedFile}
handleChangeFile={onChangeFile}
handleFileDownload={handleFileDownload}
alert={alert}
/>
</Grid>
</Grid>
<Grid container spacing={1} mt={1} mb={1}>
<Grid item xs={12}>
<Divider />
</Grid>
</Grid>
<Grid item container spacing={0.5}>
<Grid item>
<Button variant="contained" size="small" startIcon={<List />} onClick={onList}>
목록
</Button>
</Grid>
<Grid item style={{ marginLeft: 'auto' }}>
<Button disabled={!owner} variant="contained" size="small" startIcon={<Save />} onClick={onSave}>
저장
</Button>
</Grid>
<Grid item>
<Button disabled={!owner} variant="contained" size="small" startIcon={<Delete />} onClick={onRemove}>
삭제
</Button>
</Grid>
</Grid>
</>
);
};
ModifyPublicBoardForm.propTypes = {
rowData: PropTypes.object.isRequired,
handleModalSave: PropTypes.func.isRequired,
setOpen: PropTypes.func.isRequired,
owner: PropTypes.bool.isRequired
};
export default ModifyPublicBoardForm;

@ -0,0 +1,167 @@
import { useEffect, useMemo, useRef, useState } from 'react';
import { useAlert } from 'react-alert';
// material-ui
import { Button, Divider, FormControl, Grid, MenuItem, Select, TextField } from '@mui/material';
import ReactQuill from 'react-quill';
import 'react-quill/dist/quill.snow.css';
// project imports
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';
const NewPublicBoardForm = (props) => {
// eslint-disable-next-line react/prop-types
const { setOpen, handleModalSave, rowData = {} } = props;
const alert = useAlert();
const quillRef = useRef();
const [dept, setDept] = useState('');
const [subject, setSubject] = useState('');
const [contents, setContents] = useState('');
const [filesInfo, setFilesInfo] = useState();
const [selectedFile, setSelectedFile] = useState(''); //
// const [fileData, setFileData] = useState();
const onList = () => {
setOpen(false);
};
const onSave = () => {
// TODO : validation check
const formData = new FormData();
formData.append('inTitle', subject);
formData.append('inDept', dept);
formData.append('inContents', contents);
formData.append('inFilename', selectedFile ?? '');
if (filesInfo && filesInfo.length > 0) {
// eslint-disable-next-line no-plusplus
for (let i = 0; i < filesInfo.length; i++) formData.append('files', filesInfo[i]);
}
handleModalSave('SAVE', formData);
};
const modules = useMemo(
() => ({
toolbar: {
container: [
[{ header: [1, 2, false] }],
['bold', 'italic', 'underline', 'strike', 'blockquote'],
[{ list: 'ordered' }, { list: 'bullet' }, { indent: '-1' }, { indent: '+1' }],
['link'],
[{ align: [] }, { color: [] }, { background: [] }], // dropdown with defaults from theme
['clean']
// ['image', 'video']
]
}
}),
[]
);
const formats = useMemo(
() => [
// 'font',
'header',
'bold',
'italic',
'underline',
'strike',
'blockquote',
'list',
'bullet',
'indent',
'link',
'align',
'color',
'background'
],
[]
);
const onChangeFile = (file) => {
setSelectedFile(file.name);
setFilesInfo([file]);
};
useEffect(() => {
setDept('주정차위반');
}, []);
return (
<>
<Grid container spacing={1} mt={1.5}>
<Grid item xs={8}>
<TextField size="small" required label="제목" value={subject} onChange={(e) => setSubject(e.target.value)} fullWidth />
</Grid>
<Grid item xs={4}>
<FormControl fullWidth>
<InputLabel required>업무구분</InputLabel>
<Select size="small" label="업무구분" required value={dept} onChange={(e) => setDept(e.target.value)} fullWidth>
<MenuItem value="주정차위반">주정차위반</MenuItem>
<MenuItem value="장애인위반">장애인위반</MenuItem>
<MenuItem value="기타">기타</MenuItem>
</Select>
</FormControl>
</Grid>
</Grid>
<Grid container spacing={1} mt={1}>
<Grid item xs={12}>
<ReactQuill
ref={(element) => {
if (element !== null) {
quillRef.current = element;
}
}}
value={contents}
onChange={setContents}
modules={modules}
formats={formats}
theme="snow"
placeholder="내용을 입력해주세요."
/>
</Grid>
</Grid>
<Grid container spacing={1} mt={1}>
<Grid item xs={8}>
<FileForm
isDownload={rowData.inFilename}
isDisabled={false}
labelName="첨부파일"
savedFilename={rowData.inFilename}
selectedFile={selectedFile}
handleChangeFile={onChangeFile}
alert={alert}
/>
</Grid>
</Grid>
<Grid container spacing={1} mt={1} mb={1}>
<Grid item xs={12}>
<Divider />
</Grid>
</Grid>
<Grid item container spacing={0.5} xs={12}>
<Grid item>
<Button variant="contained" size="small" startIcon={<List />} onClick={onList}>
목록
</Button>
</Grid>
<Grid item style={{ marginLeft: 'auto' }}>
<Button disabled={false} variant="contained" size="small" startIcon={<Save />} onClick={onSave}>
저장
</Button>
</Grid>
</Grid>
</>
);
};
NewPublicBoardForm.propTypes = {
rowData: PropTypes.object.isRequired,
handleModalSave: PropTypes.func.isRequired,
setOpen: PropTypes.func.isRequired
};
export default NewPublicBoardForm;

@ -12,11 +12,12 @@ import MainCard from 'ui-component/cards/MainCard';
// project imports
import MuiDataGrid from 'views/cmm/mui-grid/MuiDataGrid';
import CmmModal from 'views/cmm/CmmModal';
import PublicBoardForm from './PublicBoardForm';
import NewPublicBoardForm from './NewPublicBoardForm';
import { removePublicBoard, findPublicBoards, modifyPublicBoardHitCount, savePublicBoard } from 'apis/public';
import { useAlert } from 'react-alert';
import useAuth from 'hooks/useAuth';
import ModifyPublicBoardForm from './ModifyPublicBoardForm';
const PublicBoard = () => {
const { user } = useAuth();
@ -93,8 +94,6 @@ const PublicBoard = () => {
setCreate(false);
setTitle('공지사항 변경');
setSelectedRow(e?.row);
console.log(user.name === e?.row.inName);
console.log(user.name, e?.row.inName);
setOwner(user.name === e?.row.inName);
modifyPublicBoardHitCount(e?.row?.inCode);
setOpen(true);
@ -139,10 +138,6 @@ const PublicBoard = () => {
</Button>
</Grid>
</Grid>
{/* <Grid item xs={12} mt={1} mb={1}>
<Divider />
</Grid> */}
<MuiDataGrid
columns={columns}
rowsState={rowsState}
@ -151,7 +146,16 @@ const PublicBoard = () => {
handleCellClick={handleOnCellClick}
/>
<CmmModal isBackdrop title={title} open={open} setOpen={setOpen}>
<PublicBoardForm create={create} setOpen={setOpen} owner={owner} rowData={selectedRow} handleModalSave={submitPublicBoard} />
{create && <NewPublicBoardForm setOpen={setOpen} rowData={selectedRow} handleModalSave={submitPublicBoard} />}
{!create && (
<ModifyPublicBoardForm
create={create}
setOpen={setOpen}
owner={owner}
rowData={selectedRow}
handleModalSave={submitPublicBoard}
/>
)}
</CmmModal>
</MainCard>
);

@ -2,7 +2,15 @@ import { Button, Grid, InputAdornment, TextField } from '@mui/material';
import { FileDownload, FileUpload } from '@mui/icons-material';
import PropTypes from 'prop-types';
const FileForm = ({ isDownload = false, isDisabled = false, labelName, selectedFile, handleChangeFile, handleFileDownload, alert }) => {
const FileForm = ({
isDownload = false,
isDisabled = false,
labelName,
selectedFile,
handleChangeFile,
handleFileDownload = () => {},
alert
}) => {
const onChangeFile = (e) => {
const file = e.target.files[0];
if (file.type.includes('image')) {
@ -12,10 +20,11 @@ const FileForm = ({ isDownload = false, isDisabled = false, labelName, selectedF
};
return (
<Grid container item spacing={0.5}>
<Grid item sm={7.5} className="image_Down">
<Grid container columnSpacing={{ xs: 0.5 }}>
<Grid item xs={7.5} className="image_Down">
{isDownload ? (
<TextField
fullWidth
placeholder={labelName}
value={selectedFile}
size="small"
@ -30,10 +39,10 @@ const FileForm = ({ isDownload = false, isDisabled = false, labelName, selectedF
onClick={handleFileDownload}
/>
) : (
<TextField placeholder={labelName} value={selectedFile} size="small" />
<TextField fullWidth placeholder={labelName} value={selectedFile} size="small" />
)}
</Grid>
<Grid item sm={4.5}>
<Grid item xs={4.5}>
<Button disabled={isDisabled} variant="contained" component="label" color="primary" size="small" startIcon={<FileUpload />}>
파일 업로드
<input type="file" hidden onChange={onChangeFile} />
@ -45,11 +54,11 @@ const FileForm = ({ isDownload = false, isDisabled = false, labelName, selectedF
FileForm.propTypes = {
isDownload: PropTypes.bool.isRequired,
labelName: PropTypes.number.isRequired,
labelName: PropTypes.string.isRequired,
selectedFile: PropTypes.string,
isDisabled: PropTypes.bool.isRequired,
handleChangeFile: PropTypes.func.isRequired,
handleFileDownload: PropTypes.func.isRequired,
handleFileDownload: PropTypes.func,
alert: PropTypes.object.isRequired
};

Loading…
Cancel
Save