From 971fb3c18079f438d091437d5e5df7db67b66ca4 Mon Sep 17 00:00:00 2001 From: Lim Jonguk Date: Mon, 28 Mar 2022 00:34:32 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EA=B3=B5=EC=A7=80=EC=82=AC=ED=95=AD=20?= =?UTF-8?q?=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/OpstBizService.js | 12 +++- src/commons/ApiUrl.js | 1 + src/views/biz/board/PublicBoard.jsx | 42 ++++++++++++- src/views/biz/board/PublicBoardForm.jsx | 84 +++++++++++++++++++++++++ src/views/biz/parking/Regist.jsx | 6 +- src/views/form/CustomPagination.js | 6 +- 6 files changed, 141 insertions(+), 10 deletions(-) create mode 100644 src/views/biz/board/PublicBoardForm.jsx diff --git a/src/apis/OpstBizService.js b/src/apis/OpstBizService.js index 70ef059..019dac7 100644 --- a/src/apis/OpstBizService.js +++ b/src/apis/OpstBizService.js @@ -4,7 +4,8 @@ import { GET_PARKING_SIMSA_DETAILS_LIST, GET_PARKING_SIMSA_LIST, GET_PARKING_SIMSA_TARGET_LIST, - SAVE_PARKING_SIMSA_TARGET + SAVE_PARKING_SIMSA_TARGET, + GET_PUBLIC_BOARD } from 'commons/ApiUrl'; import axios from 'utils/axios'; @@ -24,6 +25,15 @@ class OpstBizService { return res; }; + getPublicBoard = async (inCode) => { + const res = await axios.get(GET_PUBLIC_BOARD + inCode); + if (res.success) { + // res.data = res.data.map((d, idx) => ({ ...d, rowId: this.setRowId(params, idx) })); + return res; + } + return res; + }; + // eslint-disable-next-line no-return-await getBoardList = async (params) => { const res = await axios.get(GET_BOARD_LIST, { params }); diff --git a/src/commons/ApiUrl.js b/src/commons/ApiUrl.js index d320281..758632f 100644 --- a/src/commons/ApiUrl.js +++ b/src/commons/ApiUrl.js @@ -5,6 +5,7 @@ export const GET_CMM_CODE_LIST = '/api/v1/biz/cmm/combo'; // 공지사항 export const GET_PUBLIC_BOARD_LIST = '/api/v1/ctgy/pboard'; +export const GET_PUBLIC_BOARD = '/api/v1/ctgy/pboard/'; // 게시판 export const GET_BOARD_LIST = '/api/v1/ctgy/board'; diff --git a/src/views/biz/board/PublicBoard.jsx b/src/views/biz/board/PublicBoard.jsx index 2a2e9f6..1cee2d2 100644 --- a/src/views/biz/board/PublicBoard.jsx +++ b/src/views/biz/board/PublicBoard.jsx @@ -1,7 +1,7 @@ import { useEffect, useState } from 'react'; // material-ui -import { Button, Divider, FormControlLabel, Grid, InputAdornment, Radio, RadioGroup, TextField } from '@mui/material'; +import { Button, Divider, FormControlLabel, Grid, InputAdornment, Link, Radio, RadioGroup, TextField } from '@mui/material'; // assets import { IconFile, IconFileCheck, IconFileText } from '@tabler/icons'; @@ -14,6 +14,10 @@ import MuiDataGrid from 'views/form/MuiDataGrid'; import InputLabel from 'ui-component/extended/Form/InputLabel'; import opstBizService from '../../../apis/OpstBizService'; import * as React from 'react'; +import SaveParkingSimsaForm from '../parking/SaveParkingSimsaForm'; +import CmmModal from '../../form/Modal/CmmModal'; +import * as PropTypes from 'prop-types'; +import PublicBoardForm from './PublicBoardForm'; const PublicBoard = () => { const [totalCount, setTotalCount] = useState(0); @@ -23,6 +27,8 @@ const PublicBoard = () => { rows: [] // loading: false }); + const [open, setOpen] = useState(false); + const [selectedRow, setSelectedRow] = useState({}); const columns = [ { headerName: 'No.', headerAlign: 'center', field: 'rowId', align: 'center', width: 70 }, @@ -32,7 +38,17 @@ const PublicBoard = () => { field: 'inDept', align: 'center' }, - { headerName: '제목', headerAlign: 'center', field: 'inTitle', minWidth: 200 }, + { + headerName: '제목', + headerAlign: 'center', + field: 'inTitle', + minWidth: 200, + renderCell: (params) => ( + + {params.value} + + ) + }, { headerName: '첨부파일', headerAlign: 'center', @@ -62,6 +78,17 @@ const PublicBoard = () => { }); }, [rowsState.page, rowsState.pageSize]); // rowsState.page, rowsState.pageSize, rowsState.rows]); + const handleOnCellClick = (e) => { + if (e?.field === 'inTitle') { + setSelectedRow(e?.row); + setOpen(true); + } + }; + + const submitPublicBoard = () => { + console.log('save'); + }; + return ( @@ -71,7 +98,16 @@ const PublicBoard = () => { - + + + + ); }; diff --git a/src/views/biz/board/PublicBoardForm.jsx b/src/views/biz/board/PublicBoardForm.jsx new file mode 100644 index 0000000..4f1e2cc --- /dev/null +++ b/src/views/biz/board/PublicBoardForm.jsx @@ -0,0 +1,84 @@ +import { useEffect, useState } from 'react'; + +// material-ui +import { Button, Divider, FormControlLabel, Grid, InputAdornment, Radio, RadioGroup, TextField } from '@mui/material'; + +// assets +import { IconFile, IconFileCheck, IconFileText } from '@tabler/icons'; + +// berry ui +import ReactQuill from 'react-quill'; +import 'react-quill/dist/quill.snow.css'; + +// project imports +import MuiDataGrid from 'views/form/MuiDataGrid'; +import InputLabel from 'ui-component/extended/Form/InputLabel'; +import opstBizService from '../../../apis/OpstBizService'; +import * as React from 'react'; +import SaveParkingSimsaForm from '../parking/SaveParkingSimsaForm'; +import CmmModal from '../../form/Modal/CmmModal'; +import * as PropTypes from 'prop-types'; + +const PublicBoardForm = (props) => { + console.log(props); + const { inCode, inBgubun, inTitle, inHit, inName, inNalja, inFileName, inContents, setOpen } = props; + const [contents, setContents] = useState(inContents); + // const [editorState, setEditorState] = useState(() => EditorState.createWithContent(ContentState.createFormText(inContents))); + const onList = (e) => { + setOpen(false); + }; + const onSave = (e) => { + const data = { + inCode, + inTitle, + inBgubun, + inContents: contents, + inFileName + }; + alert(JSON.stringify(data)); + }; + const onDelete = (e) => {}; + const onEditorStateChange = (editorState) => {}; + // (editorState) => setEditorState(editorState) + + useEffect(() => {}, []); + + return ( + <> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ); +}; +export default PublicBoardForm; diff --git a/src/views/biz/parking/Regist.jsx b/src/views/biz/parking/Regist.jsx index c6e6a3a..4996d7f 100644 --- a/src/views/biz/parking/Regist.jsx +++ b/src/views/biz/parking/Regist.jsx @@ -53,7 +53,7 @@ const ParkingRegister = () => { pageSize: 100, rows: [] }); - const [open, setOpen] = React.useState(false); + const [open, setOpen] = useState(false); const columns = [ { headerName: 'No', headerAlign: 'center', field: 'rowId', align: 'center', width: 70 }, @@ -207,8 +207,8 @@ const ParkingRegister = () => { setRowsStatus={setRowsStatus} handleSelection={handleSelection} /> - alert('~~~~')}> - + + ); diff --git a/src/views/form/CustomPagination.js b/src/views/form/CustomPagination.js index ec329ed..7d60963 100644 --- a/src/views/form/CustomPagination.js +++ b/src/views/form/CustomPagination.js @@ -3,7 +3,7 @@ import { gridPageSelector, gridPageCountSelector, useGridApiContext, useGridSele import Pagination from '@mui/material/Pagination'; import { PaginationItem } from '@mui/lab'; import { Box } from '@mui/system'; -import { Stack } from '@mui/material'; +import { Grid, Stack } from '@mui/material'; const CustomPagination = () => { const apiRef = useGridApiContext(); @@ -12,7 +12,7 @@ const CustomPagination = () => { console.log(apiRef.current.getRowsCount()); return ( - <> + Total : {apiRef.current.getRowsCount()} ({ padding: theme.spacing(1.5, 0) })} @@ -32,7 +32,7 @@ const CustomPagination = () => { apiRef.current.setPage(value - 1); }} /> - + ); }; export default CustomPagination;