Compare commits
5 Commits
100656b50f
...
ac4625a174
| Author | SHA1 | Date |
|---|---|---|
|
|
ac4625a174 | |
|
|
cbefc9f74f | |
|
|
44b2507d99 | |
|
|
11ca97d87c | |
|
|
4d60a15104 |
|
|
@ -6,6 +6,7 @@
|
|||
"@ant-design/colors": "^6.0.0",
|
||||
"@ant-design/icons": "^4.7.0",
|
||||
"@babel/runtime": "^7.23.9",
|
||||
"@base2/pretty-print-object": "^1.0.2",
|
||||
"@emotion/react": "^11.11.3",
|
||||
"@emotion/styled": "^11.11.0",
|
||||
"@material-ui/core": "^4.12.4",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,214 @@
|
|||
import React, { useState, useEffect } from 'react';
|
||||
import AttachFileIcon from '@mui/icons-material/AttachFile';
|
||||
import IconButton from '@mui/material/IconButton';
|
||||
import DeleteIcon from '@mui/icons-material/Delete';
|
||||
import styled from "styled-components";
|
||||
import FileDragDrop from "./FileDragDrop";
|
||||
|
||||
const StyledDiv = styled.div`
|
||||
label {
|
||||
//background: red;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
border: 2px dashed #888;
|
||||
border-radius: 6px;
|
||||
& > div {
|
||||
height: 100%;
|
||||
line-height: 37px;
|
||||
padding: 20px;
|
||||
color: #999999;
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
|
||||
function AttachFile(props) {
|
||||
|
||||
const multiple = props.multiple ? props.multiple : false;
|
||||
|
||||
// 삭제 버튼 눌렀을 때 파일선택 dialog가 뜨는 것을 방지
|
||||
let oldTagName;
|
||||
useEffect(function () {
|
||||
|
||||
const labelEle = document.querySelectorAll("label[for='preDataFile']")[0];
|
||||
console.log(labelEle); // NodeList(3) [li, li, li]
|
||||
// event
|
||||
const onClickLabel = (e) => {
|
||||
|
||||
const tagName = String(e.target.tagName).toLowerCase();
|
||||
|
||||
if( tagName !== 'input' ) {
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
oldTagName = tagName;
|
||||
e.preventDefault();
|
||||
return false;
|
||||
} else {
|
||||
if(
|
||||
oldTagName === 'path' ||
|
||||
oldTagName === 'svg' ||
|
||||
oldTagName === 'button'
|
||||
) {
|
||||
oldTagName = undefined;
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// remove Event
|
||||
labelEle.removeEventListener("click", onClickLabel);
|
||||
labelEle.addEventListener("click", onClickLabel);
|
||||
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
|
||||
//기존 server에 upload된 file인 props.serverFiles file들을 렌더링 초기에 넣어 놓기
|
||||
useEffect(function () {
|
||||
|
||||
|
||||
if( !props.serverFiles ) {
|
||||
return;
|
||||
}
|
||||
|
||||
let items = [];
|
||||
let nNewIndex = 0;
|
||||
for( let idx in props.serverFiles ) {
|
||||
props.serverFiles[idx].index=nNewIndex++;
|
||||
items.push( props.serverFiles[idx] );
|
||||
}
|
||||
setFileItem(items);
|
||||
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [props.serverFiles]);
|
||||
|
||||
|
||||
|
||||
|
||||
const [disabled, setDisabled] = useState( props.disabled ? props.disabled : false );
|
||||
useEffect(function () {
|
||||
if( !props.disabled ) {
|
||||
return;
|
||||
}
|
||||
setDisabled(props.disabled);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [props.disabled]);
|
||||
|
||||
|
||||
const [maxSize, setMaxSize] = useState(props.maxSize ? props.maxSize : 100);
|
||||
useEffect(function () {
|
||||
if( !props.maxSize ) {
|
||||
return;
|
||||
}
|
||||
setMaxSize(props.maxSize);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [props.maxSize]);
|
||||
|
||||
|
||||
const [fileItem, setFileItem] = useState();
|
||||
|
||||
const onDrop = (e) => {
|
||||
//alert('ddd');
|
||||
};
|
||||
|
||||
|
||||
const handleChange = (files) => {
|
||||
|
||||
|
||||
if( !files ) {
|
||||
return;
|
||||
}
|
||||
|
||||
let items = [];
|
||||
let nNewIndex = 0;
|
||||
|
||||
//파일이 이미 첨부되어 있는 상태에서 추가로 첨부한 경우 기존 것을 먼저 추가 후 새로운 항목을 추가한다.
|
||||
for( let idx in fileItem ) {
|
||||
fileItem[idx].index=nNewIndex++;
|
||||
items.push( fileItem[idx] );
|
||||
}
|
||||
|
||||
Object.keys(files).forEach(function(key, index) {
|
||||
//console.log(key, props.files[key]);
|
||||
if( typeof files[key].name === 'undefined' ) {
|
||||
return;
|
||||
}
|
||||
files[key].index=nNewIndex++;
|
||||
items.push( files[key] );
|
||||
});
|
||||
console.log('%o\n%o', files, items);
|
||||
setFileItem(items);
|
||||
props.setFiles(items);
|
||||
};
|
||||
|
||||
|
||||
const onClickDeleteItem = (e, targetEle) => {
|
||||
|
||||
const dataIndex = Number(targetEle.getAttribute('data-index'));
|
||||
|
||||
let items = [];
|
||||
let nNewIndex = 0;
|
||||
Object.keys(fileItem).forEach(function(key, index) {
|
||||
if( dataIndex !== index ) {
|
||||
fileItem[key].index=nNewIndex++;
|
||||
items.push( fileItem[key] );
|
||||
}
|
||||
});
|
||||
|
||||
setFileItem(items);
|
||||
props.setFiles(items);
|
||||
}
|
||||
|
||||
return (
|
||||
<StyledDiv>
|
||||
<FileDragDrop
|
||||
className="file-drag-drop"
|
||||
multiple={multiple}
|
||||
name={props.name}
|
||||
fileTypes={props.fileTypes}
|
||||
onDrop={onDrop}
|
||||
handleChange={handleChange}
|
||||
dropMessageStyle={{backgroundColor: '#cfe2ff'}}
|
||||
maxSize={maxSize}
|
||||
disabled={disabled}
|
||||
>
|
||||
<div>
|
||||
|
||||
{fileItem && fileItem.length > 0
|
||||
?
|
||||
fileItem.map((item) => (
|
||||
<span key={item.index} data-index={item.index}>
|
||||
<IconButton aria-label="delete" size="small"
|
||||
onClick={(e)=> {
|
||||
e = e || window.event;
|
||||
const target = e.target || e.srcElement;
|
||||
|
||||
console.log('%o', target);
|
||||
const tagName = String(target.tagName).toLowerCase();
|
||||
|
||||
// target 보정
|
||||
let targetEle = target.parentNode.parentNode.parentNode;
|
||||
if( tagName === 'svg' ) {
|
||||
targetEle = target.parentNode.parentNode;
|
||||
} else if( tagName === 'button' ) {
|
||||
targetEle = target.parentNode;
|
||||
}
|
||||
|
||||
onClickDeleteItem(e, targetEle);
|
||||
}}
|
||||
>
|
||||
<DeleteIcon fontSize="small" />
|
||||
</IconButton>
|
||||
{item.name}<br />
|
||||
</span>
|
||||
))
|
||||
:
|
||||
<span><AttachFileIcon /> 파일을 마우스로 끌어놓으세요.</span>
|
||||
}
|
||||
</div>
|
||||
</FileDragDrop>
|
||||
</StyledDiv>
|
||||
);
|
||||
|
||||
}
|
||||
export default AttachFile;
|
||||
|
|
@ -7,17 +7,25 @@ import { FileUploader } from "react-drag-drop-files";
|
|||
* @param {fileTypes} const fileTypes = ["JPG", "PNG", "GIF"];
|
||||
* @returns
|
||||
*/
|
||||
function FileDragDrop({fileTypes, children, multiple, label, onDrop, handleChange, file, setFile, dropMessageStyle}) {
|
||||
function FileDragDrop({fileTypes, children, multiple, label, onDrop, handleChange, file, setFile, dropMessageStyle, name, maxSize, disabled}) {
|
||||
|
||||
const temp = 0;
|
||||
|
||||
return (
|
||||
<FileUploader
|
||||
hoverTitle="여기에 파일을 놓아주세요"
|
||||
handleChange={handleChange}
|
||||
name="file"
|
||||
name={name}
|
||||
types={fileTypes ? fileTypes : "*"}
|
||||
multiple={multiple && false}
|
||||
multiple={multiple ? multiple : false}
|
||||
label={label}
|
||||
onDrop={onDrop}
|
||||
dropMessageStyle={dropMessageStyle}
|
||||
maxSize={maxSize}
|
||||
disabled={disabled}
|
||||
onSelect={(e)=> {
|
||||
e = e || window.event;
|
||||
}}
|
||||
>
|
||||
{children && children}
|
||||
</FileUploader>
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ function ProgressStatus(props) {
|
|||
getList({ ...searchCondition, pageIndex: passedPage })
|
||||
}} />
|
||||
<div className="right_col btn1">
|
||||
<Link to={URL.ADMIN__CONTENTS__POP_UP__CREATE} className="btn btn_blue_h46 w_100">등록</Link>
|
||||
<Link to={URL.ADMIN__COMMITTEE__PROGRESS_STATUS__CREATE} className="btn btn_blue_h46 w_100">등록</Link>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,17 +1,13 @@
|
|||
import React, { useState, useEffect } from 'react';
|
||||
import { Link, useLocation, useNavigate } from 'react-router-dom';
|
||||
import DatePicker from "react-datepicker";
|
||||
|
||||
|
||||
|
||||
import AttachFile from "components/file/AttachFile";
|
||||
import * as EgovNet from 'api/egovFetch';
|
||||
import URL from 'constants/url';
|
||||
import CODE from 'constants/code';
|
||||
|
||||
import { default as EgovLeftNav } from 'components/leftmenu/EgovLeftNavAdmin';
|
||||
|
||||
import 'react-datepicker/dist/react-datepicker.css';
|
||||
|
||||
import styled from "styled-components";
|
||||
import { makeStyles } from "@mui/styles";
|
||||
|
||||
|
|
@ -31,15 +27,6 @@ const useStyles = makeStyles(() => ({
|
|||
}));
|
||||
|
||||
const StyledDiv = styled.div`
|
||||
.org-under-id {
|
||||
margin-left: 20px;
|
||||
@media only screen and (max-width: 768px) {
|
||||
display: block;
|
||||
margin-left: 0px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.f_select.w_250 {
|
||||
@media only screen and (max-width: 768px) {
|
||||
width: 100%;
|
||||
|
|
@ -51,9 +38,17 @@ const StyledDiv = styled.div`
|
|||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.org-group-id-1 {
|
||||
margin: 0px 29px;
|
||||
@media only screen and (max-width: 768px) {
|
||||
margin: 0px;
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
function SchedulesEdit(props) {
|
||||
|
||||
function ProgressStatusEdit(props) {
|
||||
console.group("EgovAdminScheduleEdit");
|
||||
console.log("[Start] EgovAdminScheduleEdit ------------------------------");
|
||||
console.log("EgovAdminScheduleEdit [props] : ", props);
|
||||
|
|
@ -79,22 +74,19 @@ function SchedulesEdit(props) {
|
|||
console.log("EgovAdminScheduleEdit [location] : ", location);
|
||||
|
||||
const [modeInfo, setModeInfo] = useState({ mode: props.mode });
|
||||
const [scheduleDetail, setScheduleDetail] = useState
|
||||
const [requestItems, setRequestItems] = useState
|
||||
(
|
||||
{
|
||||
startDate: new Date(),
|
||||
endDate: new Date(),
|
||||
orgGroupId: 1,
|
||||
startDate: new Date(),
|
||||
eventId : 0,
|
||||
}
|
||||
);
|
||||
|
||||
const [schdulBgndeHH, setSchdulBgndeHH] = useState();
|
||||
const [schdulBgndeMM, setSchdulBgndeMM] = useState();
|
||||
const [schdulEnddeHH, setSchdulEnddeHH] = useState();
|
||||
const [schdulEnddeMM, setSchdulEnddeMM] = useState();
|
||||
const [drftDatetimeHH, setDrftDatetimeHH] = useState();
|
||||
const [drftDatetimeMM, setDrftDatetimeMM] = useState();
|
||||
|
||||
const [scheduleInit, setScheduleInit] = useState({});
|
||||
const [scheduleApiOrgApiDepthList, setScheduleApiOrgApiDepthList] = useState({ });
|
||||
|
||||
|
||||
const initMode = () => {
|
||||
|
|
@ -120,7 +112,8 @@ function SchedulesEdit(props) {
|
|||
default:
|
||||
navigate({pathname: URL.ERROR}, {state: {msg : ""}});
|
||||
}
|
||||
retrieveDetail();
|
||||
|
||||
getList(orgSearchCondition);
|
||||
}
|
||||
|
||||
const convertDate = (str) => {
|
||||
|
|
@ -139,65 +132,120 @@ function SchedulesEdit(props) {
|
|||
}
|
||||
}
|
||||
|
||||
const retrieveDetail = () => {
|
||||
|
||||
EgovNet.requestFetch("/schedule/init",
|
||||
const [orgSearchCondition, setOrgSearchCondition] = useState({ paramCodeGroup: null, paramCodeLevel: 'LV_01' });
|
||||
const [orgArray, setOrgArray] = useState([]);
|
||||
const [orgSelectedIndex, setOrgSelectedIndex] = useState([]);
|
||||
|
||||
|
||||
|
||||
|
||||
useEffect(function () {
|
||||
getList(orgSearchCondition);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [orgSearchCondition]);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
useEffect(function () {
|
||||
if ( typeof orgArray[0] === 'undefined' || typeof orgSelectedIndex[0] === 'undefined' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if( orgSelectedIndex[0] === 0) {
|
||||
orgArray[1] = undefined;
|
||||
orgArray[2] = undefined;
|
||||
let forChangeObject = [...orgArray];
|
||||
setOrgArray(forChangeObject);
|
||||
setOrgSelectedIndex([orgSelectedIndex[0], undefined, undefined]);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( typeof orgArray[0][orgSelectedIndex[0]-1] === 'undefined' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
const paramCodeLevel = 'LV_02';
|
||||
const paramCodeGroup = orgArray[0][orgSelectedIndex[0]-1].orgId;
|
||||
setOrgSearchCondition({ paramCodeGroup, paramCodeLevel });
|
||||
orgArray[1] = undefined;
|
||||
orgArray[2] = undefined;
|
||||
let forChangeObject = [...orgArray];
|
||||
setOrgArray(forChangeObject);
|
||||
setOrgSelectedIndex([orgSelectedIndex[0], undefined, undefined]);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [orgSelectedIndex[0]]);
|
||||
|
||||
|
||||
|
||||
|
||||
useEffect(function () {
|
||||
if ( typeof orgArray[1] === 'undefined' || typeof orgSelectedIndex[1] === 'undefined' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if( orgSelectedIndex[1] === 0) {
|
||||
orgArray[2] = undefined;
|
||||
let forChangeObject = [...orgArray];
|
||||
setOrgArray(forChangeObject);
|
||||
setOrgSelectedIndex([orgSelectedIndex[0], orgSelectedIndex[1], undefined]);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( typeof orgArray[0][orgSelectedIndex[1]-1] === 'undefined' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
const paramCodeLevel = 'LV_03';
|
||||
const paramCodeGroup = orgArray[1][orgSelectedIndex[1]-1].orgId;
|
||||
setOrgSearchCondition({ paramCodeGroup, paramCodeLevel });
|
||||
|
||||
orgArray[2] = undefined;
|
||||
let forChangeObject = [...orgArray];
|
||||
setOrgArray(forChangeObject);
|
||||
setOrgSelectedIndex([orgSelectedIndex[0], orgSelectedIndex[1], undefined]);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [orgSelectedIndex[1]]);
|
||||
|
||||
|
||||
|
||||
|
||||
useEffect(function () {
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [orgSelectedIndex[2]]);
|
||||
|
||||
|
||||
|
||||
|
||||
const getList = (orgSearchCondition) => {
|
||||
|
||||
EgovNet.requestFetch(`/admin/config/committee-code-management?paramCodeGroup=${orgSearchCondition.paramCodeGroup}¶mCodeLevel=${orgSearchCondition.paramCodeLevel}`,
|
||||
requestOptions,
|
||||
function (resp) {
|
||||
setScheduleInit(
|
||||
resp
|
||||
);
|
||||
|
||||
if (modeInfo.mode === CODE.MODE_CREATE) {// 조회/등록이면 조회 안함
|
||||
setScheduleDetail({
|
||||
...scheduleDetail,
|
||||
schdulBgnde: location.state.iUseDate,
|
||||
schdulEndde: location.state.iUseDate,
|
||||
startDate: convertDate(location.state.iUseDate),
|
||||
endDate: convertDate(location.state.iUseDate),
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const retrieveDetailURL = `/schedule/${location.state?.schdulId}`;
|
||||
const requestOptions = {
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Content-type': 'application/json'
|
||||
}
|
||||
}
|
||||
EgovNet.requestFetch(retrieveDetailURL,
|
||||
requestOptions,
|
||||
function (resp) {
|
||||
|
||||
let rawScheduleDetail = resp.result;
|
||||
//기본값 설정
|
||||
setScheduleDetail({
|
||||
...scheduleDetail,
|
||||
...rawScheduleDetail,
|
||||
startDate: convertDate(rawScheduleDetail.schdulBgnde),
|
||||
endDate: convertDate(rawScheduleDetail.schdulEndde),
|
||||
});
|
||||
}
|
||||
);
|
||||
const myIndex = Number(String(orgSearchCondition.paramCodeLevel).replace('LV_','')) - 1;
|
||||
const forCopy = [...orgArray];
|
||||
forCopy[myIndex] = resp.result.list;
|
||||
setOrgArray(forCopy);
|
||||
}
|
||||
);
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
const updateSchedule = () => {
|
||||
const formData = new FormData();
|
||||
|
||||
for (let key in scheduleDetail) {
|
||||
for (let key in requestItems) {
|
||||
if ( key === 'startDate' ) {
|
||||
formData.append(key, getDateFourteenDigit( scheduleDetail[key] ));
|
||||
formData.append(key, getDateFourteenDigit( requestItems[key] ));
|
||||
} else if( key === 'endDate' ) {
|
||||
formData.append(key, getDateFourteenDigit( scheduleDetail[key] ));
|
||||
formData.append(key, getDateFourteenDigit( requestItems[key] ));
|
||||
} else {
|
||||
formData.append(key, scheduleDetail[key]);
|
||||
formData.append(key, requestItems[key]);
|
||||
}
|
||||
|
||||
console.log("scheduleDetail [%s] ", key, scheduleDetail[key]);
|
||||
console.log("requestItems [%s] ", key, requestItems[key]);
|
||||
}
|
||||
|
||||
if ( formValidator(formData) ) {
|
||||
|
|
@ -263,49 +311,28 @@ function SchedulesEdit(props) {
|
|||
}, []);
|
||||
|
||||
useEffect(function () {
|
||||
console.log("------------------------------EgovAdminScheduleEdit [%o]", scheduleDetail);
|
||||
console.log("------------------------------EgovAdminScheduleEdit [%o]", requestItems);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [scheduleDetail]);
|
||||
|
||||
useEffect(function () {
|
||||
|
||||
EgovNet.requestFetch(`/schedule/api/org-api/depth/list?paramCodeGroup=${scheduleDetail.upCommittee}`,
|
||||
requestOptions,
|
||||
function (resp) {
|
||||
setScheduleApiOrgApiDepthList(
|
||||
resp
|
||||
);
|
||||
}
|
||||
);
|
||||
console.log("------------------------------EgovAdminScheduleEdit [%o]", scheduleDetail);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [scheduleDetail && scheduleDetail.upCommittee]);
|
||||
}, [requestItems]);
|
||||
|
||||
const fileTypes = ["JPG", "PNG", "GIF", "PDF", "HWP", "HWPX", "ZIP", "JPEG", "MP4", "TXT"];
|
||||
//사전검토자료
|
||||
const [preDataFile, setPreDataFile] = useState(null);
|
||||
const [preDataFileName, setPreDataFileName] = useState(null);
|
||||
//사전검토양식
|
||||
const [preFormFile, setPreFormFile] = useState(null);
|
||||
const [preFormFileName, setPreFormFileName] = useState(null);
|
||||
//관계기관의견
|
||||
const [partnerFile, setPartnerFile] = useState(null);
|
||||
const [partnerFileName, setPartnerFileName] = useState(null);
|
||||
//조치계획서
|
||||
const [actionPlanFile, setActionPlanFile] = useState(null);
|
||||
const [actionPlanFileName, setActionPlanFileName] = useState(null);
|
||||
//조치결과서
|
||||
const [actionResultReportFile, setActionResultReportFile] = useState(null);
|
||||
const [actionResultReportFileName, setActionResultReportFileName] = useState(null);
|
||||
|
||||
const onClickDeleteSchedule = (schdulId) => {
|
||||
const deleteBoardURL = `/schedule/${schdulId}`;
|
||||
|
||||
const requestOptions = {
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
'Content-type': 'application/json',
|
||||
}
|
||||
}
|
||||
|
||||
EgovNet.requestFetch(deleteBoardURL,
|
||||
requestOptions,
|
||||
(resp) => {
|
||||
console.log("====>>> Schdule delete= ", resp);
|
||||
if (Number(resp.resultCode) === Number(CODE.RCV_SUCCESS)) {
|
||||
alert("게시글이 삭제되었습니다.")
|
||||
navigate(URL.ADMIN__COMMITTEE__SCHEDULES ,{ replace: true });
|
||||
} else {
|
||||
navigate({pathname: URL.ERROR}, {state: {msg : resp.resultMessage}});
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
console.log("------------------------------EgovAdminScheduleEdit [End]");
|
||||
console.groupEnd("EgovAdminScheduleEdit");
|
||||
|
|
@ -318,7 +345,7 @@ function SchedulesEdit(props) {
|
|||
<li><Link to={URL.MAIN} className="home">Home</Link></li>
|
||||
<li><Link to={URL.ADMIN}>사이트 관리</Link></li>
|
||||
<li>위원회 관리</li>
|
||||
<li>위원회 일정 관리</li>
|
||||
<li>진행현황 관리</li>
|
||||
</ul>
|
||||
</div>
|
||||
{/* <!--// Location --> */}
|
||||
|
|
@ -332,20 +359,36 @@ function SchedulesEdit(props) {
|
|||
{/* <!-- 본문 --> */}
|
||||
|
||||
<div className="top_tit">
|
||||
<h1 className="tit_1">위원회 일정 관리</h1>
|
||||
<h1 className="tit_1">진행현황 관리</h1>
|
||||
</div>
|
||||
|
||||
{/* <!-- <h2 className="tit_2">위원회 일정 추가</h2> --> */}
|
||||
|
||||
{/* <!-- 게시판 상세보기 --> */}
|
||||
<StyledDiv className="board_view2">
|
||||
<dl>
|
||||
<dt>구분<span className="req">필수</span></dt>
|
||||
<dt><label>안건</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
<label className="f_select w_150" htmlFor="div-meet">
|
||||
<select id="div-meet" name="div-meet" title="일정구분"
|
||||
value={scheduleDetail.divMeet}
|
||||
onChange={(e) => setScheduleDetail({ ...scheduleDetail, divMeet: e.target.value })}>
|
||||
<input className="f_input2 w_full" type="text" name="title" title="안건" placeholder="안건을 입력하세요"
|
||||
value={requestItems.title}
|
||||
onChange={(e) => setRequestItems({ ...requestItems, title: e.target.value })}
|
||||
/>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label>기준코드</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
<input className="f_input2 w_full" type="text" name="categoryId" title="기준코드" placeholder="여기를 눌러 기준코드를 선택하세요"
|
||||
value={requestItems.categoryId}
|
||||
onChange={(e) => setRequestItems({ ...requestItems, categoryId: e.target.value })}
|
||||
/>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label>구분</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
<label className="f_select w_150" >
|
||||
<select name="div-meet" title="재정 개정 재개정 선택"
|
||||
value={requestItems.drftTypeCode}
|
||||
onChange={(e) => setRequestItems({ ...requestItems, drftTypeCode: e.target.value })}>
|
||||
<option key={"none"} value="">선택</option>
|
||||
{scheduleInit && scheduleInit.result && scheduleInit.result.listCodes
|
||||
&& scheduleInit.result.listCodes.map((item) => (
|
||||
|
|
@ -356,95 +399,129 @@ function SchedulesEdit(props) {
|
|||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>심의위원회<span className="req">필수</span></dt>
|
||||
<dt><label>회의일자</label><span className="req">필수</span></dt>
|
||||
<dd className="datetime">
|
||||
<span className="line_break">
|
||||
<DatePicker
|
||||
selected={requestItems.drftDatetime}
|
||||
name="drftDatetime"
|
||||
className="f_input"
|
||||
dateFormat="yyyy-MM-dd"
|
||||
onChange={(date) => {
|
||||
setRequestItems({ ...requestItems, schdulBgnde: getDateFourteenDigit(date), drftDatetimeYYYMMDD: getYYYYMMDD(date), drftDatetime: date });
|
||||
setDrftDatetimeHH(date.getHours());
|
||||
setDrftDatetimeMM(date.getMinutes());
|
||||
}} />
|
||||
<input type="hidden" name="drftDatetimeMM" defaultValue={drftDatetimeMM} readOnly />
|
||||
</span>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label>위원회</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
<label className="f_select w_250 up-committe" htmlFor="up-committee">
|
||||
<select id="up-committe" name="up-committe" title="심의위원회-상위"
|
||||
value={scheduleDetail.upCommittee}
|
||||
onChange={(e) => setScheduleDetail({ ...scheduleDetail, upCommittee: e.target.value })}>
|
||||
<option value="">선택</option>
|
||||
{scheduleInit && scheduleInit.result && scheduleInit.result.listTopOrg
|
||||
&& scheduleInit.result.listTopOrg.map((item) => (
|
||||
<option key={item.id} value={item.id}>{item.name}</option>
|
||||
{/** top org */}
|
||||
<label className="f_select w_250 org-group-id" htmlFor="org-group-id">
|
||||
<select id="org-group-id" name="orgGroupId" title="중앙건설기술심의 선택"
|
||||
value={requestItems.orgGroupId}
|
||||
onChange={(e) => {
|
||||
setRequestItems({ ...requestItems, orgGroupId: e.target.value });
|
||||
orgSelectedIndex[0] = e.target.options.selectedIndex;
|
||||
let forChangeObject = [...orgSelectedIndex];
|
||||
setOrgSelectedIndex(forChangeObject);
|
||||
}}>
|
||||
<option value="">중앙건설기술심의 선택</option>
|
||||
{orgArray && orgArray[0] && orgArray[0].map && orgArray[0].map((item, index) => (
|
||||
<option key={item.orgId} value={item.orgId} data-index={index}>{item.orgNm}</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label className="f_select w_250 org-under-id" htmlFor="committee">
|
||||
<select id="committee" name="committee" title="심의위원회-하위"
|
||||
value={scheduleDetail.committee}
|
||||
onChange={(e) => setScheduleDetail({ ...scheduleDetail, committee: e.target.value })}>
|
||||
<option value="">선택</option>
|
||||
{scheduleApiOrgApiDepthList && scheduleApiOrgApiDepthList.result && scheduleApiOrgApiDepthList.result.list
|
||||
&& scheduleApiOrgApiDepthList.result.list.map((item) => (
|
||||
<option key={item.id} value={item.id}>{item.name}</option>
|
||||
<label className="f_select w_250 org-group-id-1" htmlFor="org-group-id-1">
|
||||
<select id="org-group-id-1" name="orgGroupId1" title="총괄건설기준위원회 선택"
|
||||
value={requestItems.orgGroupId1}
|
||||
defaultValue='1'
|
||||
onChange={(e) => {
|
||||
setRequestItems({ ...requestItems, orgGroupId1: e.target.value });
|
||||
orgSelectedIndex[1] = e.target.options.selectedIndex;
|
||||
let forChangeObject = [...orgSelectedIndex];
|
||||
setOrgSelectedIndex(forChangeObject);
|
||||
}}>
|
||||
<option value="">총괄건설기준위원회 선택</option>
|
||||
{orgArray && orgArray[1] && orgArray[1].map((item, index) => (
|
||||
<option key={item.orgId} value={item.orgId} data-index={index}>{item.orgNm}</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label className="f_select w_250 org-group-id-2" htmlFor="org-group-id-2">
|
||||
<select id="org-group-id-2" name="orgGroupId2" title="기준위원회 선택"
|
||||
value={requestItems.orgGroupId2}
|
||||
onChange={(e) => {
|
||||
setRequestItems({ ...requestItems, orgGroupId2: e.target.value });
|
||||
orgSelectedIndex[2] = e.target.options.selectedIndex;
|
||||
let forChangeObject = [...orgSelectedIndex];
|
||||
setOrgSelectedIndex(forChangeObject);
|
||||
}}>
|
||||
<option value="">기준위원회 선택</option>
|
||||
{orgArray && orgArray[2] && orgArray[2].map((item, index) => (
|
||||
<option key={item.orgId} value={item.orgId} data-index={index}>{item.orgNm}</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label htmlFor="title">제목</label><span className="req">필수</span></dt>
|
||||
<dt><label htmlFor="title">사전검토자료</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
<input className="f_input2 w_full" type="text" name="title" title="제목" id="title" placeholder="제목을 입력하세요."
|
||||
value={scheduleDetail.title}
|
||||
onChange={(e) => setScheduleDetail({ ...scheduleDetail, title: e.target.value })}
|
||||
<AttachFile name="preDataFile" file={preDataFile} setFile={setPreDataFile} fileName={preDataFileName} fileTypes={fileTypes} />
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label htmlFor="title">사전검토양식</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
<AttachFile name="preFormFile" file={preFormFile} setFile={setPreFormFile} fileName={preFormFileName} fileTypes={fileTypes} />
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label htmlFor="title">관계기관의견</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
<AttachFile name="partnerFile" file={partnerFile} setFile={setPartnerFile} fileName={partnerFileName} fileTypes={fileTypes} />
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label htmlFor="title">조치계획서</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
<AttachFile name="actionPlanFile" file={actionPlanFile} setFile={setActionPlanFile} fileName={actionPlanFileName} fileTypes={fileTypes} />
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label>조치결과서</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
<AttachFile name="actionResultReportFile" file={actionResultReportFile} setFile={setActionResultReportFile} fileName={actionResultReportFileName} fileTypes={fileTypes} />
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label>회의담당자</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
<input className="f_input2 w_full" type="text" name="drftConfeCharger" title="회의 담당자" placeholder="여기를 눌러 회의담당자를 선택하세요"
|
||||
value={requestItems.drftConfeCharger}
|
||||
onChange={(e) => setRequestItems({ ...requestItems, drftConfeCharger: e.target.value })}
|
||||
/>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label htmlFor="location">장소</label><span className="req">필수</span></dt>
|
||||
<dt><label>회의실 비밀번호</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
<input className="f_input2 w_full" type="text" name="location" title="장소" id="location" placeholder="장소를 입력하세요."
|
||||
defaultValue={scheduleDetail.location}
|
||||
onChange={(e) => setScheduleDetail({ ...scheduleDetail, location: e.target.value })} />
|
||||
<input className="f_input2 w_full" type="text" name="drftConfePw" title="제목" placeholder="회의실 비밀번호를 입력하세요"
|
||||
value={requestItems.drftConfePw}
|
||||
onChange={(e) => setRequestItems({ ...requestItems, drftConfePw: e.target.value })}
|
||||
/>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>날짜/시간<span className="req">필수</span></dt>
|
||||
<dd className="datetime">
|
||||
<span className="line_break">
|
||||
<DatePicker
|
||||
selected={scheduleDetail.startDate}
|
||||
name="schdulBgnde"
|
||||
className="f_input"
|
||||
dateFormat="yyyy-MM-dd HH:mm"
|
||||
showTimeInput
|
||||
onChange={(date) => {
|
||||
console.log("setStartDate : ", date);
|
||||
setScheduleDetail({ ...scheduleDetail, schdulBgnde: getDateFourteenDigit(date), schdulBgndeYYYMMDD: getYYYYMMDD(date), schdulBgndeHH: date.getHours(), schdulBgndeMM: date.getMinutes(), startDate: date });
|
||||
setSchdulBgndeHH(date.getHours());
|
||||
setSchdulBgndeMM(date.getMinutes());
|
||||
}} />
|
||||
<input type="hidden" name="schdulBgndeHH" defaultValue={schdulBgndeHH} readOnly />
|
||||
<input type="hidden" name="schdulBgndeMM" defaultValue={schdulBgndeMM} readOnly />
|
||||
<span className="f_inn_txt">~</span>
|
||||
</span>
|
||||
<span className="line_break">
|
||||
<DatePicker
|
||||
selected={scheduleDetail.endDate}
|
||||
name="schdulEndde"
|
||||
className="f_input"
|
||||
dateFormat="yyyy-MM-dd HH:mm"
|
||||
showTimeInput
|
||||
minDate={scheduleDetail.startDate}
|
||||
onChange={(date) => {
|
||||
console.log("setEndDate: ", date);
|
||||
setScheduleDetail({ ...scheduleDetail, schdulEndde: getDateFourteenDigit(date), schdulEnddeYYYMMDD: getYYYYMMDD(date), schdulEnddeHH: date.getHours(), schdulEnddeMM: date.getMinutes(), endDate: date });
|
||||
setSchdulEnddeHH(date.getHours());
|
||||
setSchdulEnddeMM(date.getMinutes());
|
||||
}
|
||||
} />
|
||||
<input type="hidden" name="schdulEnddeHH" defaultValue={schdulEnddeHH} readOnly />
|
||||
<input type="hidden" name="schdulEnddeMM" defaultValue={schdulEnddeMM} readOnly />
|
||||
</span>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label htmlFor="contents">내용</label><span className="req">필수</span></dt>
|
||||
<dt><label>회의 안건</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
<textarea className="f_txtar w_full h_100" name="contents" id="contents" cols="30" rows="10" placeholder="일정 내용을 입력하세요."
|
||||
defaultValue={scheduleDetail.contents}
|
||||
onChange={(e) => setScheduleDetail({ ...scheduleDetail, contents: e.target.value })}
|
||||
<textarea className="f_txtar w_full h_100" name="drftSummery" cols="30" rows="10" placeholder="회의 안건 내용을 입력하세요."
|
||||
defaultValue={requestItems.drftSummery}
|
||||
onChange={(e) => setRequestItems({ ...requestItems, drftSummery: e.target.value })}
|
||||
></textarea>
|
||||
</dd>
|
||||
</dl>
|
||||
|
|
@ -454,18 +531,12 @@ function SchedulesEdit(props) {
|
|||
<div className="left_col btn1">
|
||||
<button className="btn btn_skyblue_h46 w_100"
|
||||
onClick={() => updateSchedule()}
|
||||
> 저장</button>
|
||||
{modeInfo.mode === CODE.MODE_MODIFY &&
|
||||
<button className="btn btn_skyblue_h46 w_100"
|
||||
onClick={(e) => {
|
||||
onClickDeleteSchedule(location.state?.schdulId);
|
||||
}}>삭제</button>
|
||||
}
|
||||
> 저장</button>
|
||||
|
||||
</div>
|
||||
|
||||
<div className="right_col btn1">
|
||||
<Link to={URL.ADMIN__COMMITTEE__SCHEDULES} className="btn btn_blue_h46 w_100">목록</Link>
|
||||
<Link to={URL.ADMIN__COMMITTEE__PROGRESS_STATUS} className="btn btn_blue_h46 w_100">목록</Link>
|
||||
</div>
|
||||
</div>
|
||||
{/* <!--// 버튼영역 --> */}
|
||||
|
|
@ -480,4 +551,4 @@ function SchedulesEdit(props) {
|
|||
);
|
||||
}
|
||||
|
||||
export default SchedulesEdit;
|
||||
export default ProgressStatusEdit;
|
||||
|
|
@ -1,10 +1,7 @@
|
|||
import React, { useState, useEffect } from 'react';
|
||||
import { Link, useLocation, useNavigate } from 'react-router-dom';
|
||||
import DatePicker from "react-datepicker";
|
||||
import FileDragDrop from "../../../../components/file/FileDragDrop";
|
||||
import AttachFileIcon from '@mui/icons-material/AttachFile';
|
||||
|
||||
import EgovAttachFile from 'components/EgovAttachFile';
|
||||
import AttachFile from "../../../../components/file/AttachFile";
|
||||
import RichTextEditor from "../../../../components/editor/RichTextEditor";
|
||||
import AlertDialogSlide from "../../../../components/alert/AlertDialogSlide";
|
||||
import CODE from 'constants/code';
|
||||
|
|
@ -59,7 +56,7 @@ function PopupEditor(props) {
|
|||
const [schdulBgndeMM, setSchdulBgndeMM] = useState();
|
||||
const [schdulEnddeHH, setSchdulEnddeHH] = useState();
|
||||
const [schdulEnddeMM, setSchdulEnddeMM] = useState();
|
||||
const [fileName, setFileName] = useState();
|
||||
|
||||
|
||||
const [confirm, setConfirm] = React.useState();
|
||||
|
||||
|
|
@ -140,11 +137,11 @@ function PopupEditor(props) {
|
|||
setText(rawDetail.contents);
|
||||
setTextOriginal(rawDetail.contents);
|
||||
|
||||
if( rawDetail.fileName ) {
|
||||
setFileName(rawDetail.fileName);
|
||||
if( rawDetail.files ) {
|
||||
setServerFiles(rawDetail.files);
|
||||
}
|
||||
}
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -167,7 +164,14 @@ function PopupEditor(props) {
|
|||
formData.append("contents", text);
|
||||
|
||||
//첨부파일
|
||||
formData.append("file", file);
|
||||
//formData.append("files", files);
|
||||
for(let i=0; i<files.length; i++) {
|
||||
// seq 항목을 가지고 있다면 그건 server에 이미 upload된 file이므로 continue
|
||||
if( files[i].seq ) {
|
||||
continue;
|
||||
}
|
||||
formData.append("files", files[i]);
|
||||
}
|
||||
|
||||
if (formValidator(formData)) {
|
||||
const requestOptions = {
|
||||
|
|
@ -264,22 +268,15 @@ function PopupEditor(props) {
|
|||
}
|
||||
|
||||
const fileTypes = ["JPG", "PNG", "GIF", "PDF", "HWP", "HWPX", "ZIP", "JPEG", "MP4", "TXT"];
|
||||
const onDrop = (e) => {
|
||||
//alert('ddd');
|
||||
};
|
||||
|
||||
const [file, setFile] = useState(null);
|
||||
const handleChange = (file) => {
|
||||
setFile(file);
|
||||
const [serverFiles, setServerFiles] = useState();
|
||||
const [files, setFiles] = useState();
|
||||
/*
|
||||
let files = null;
|
||||
const setFiles = (myFiles) => {
|
||||
files = myFiles;
|
||||
};
|
||||
|
||||
|
||||
useEffect(function () {
|
||||
if( file ) {
|
||||
console.log('%o', file);
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [file]);
|
||||
*/
|
||||
|
||||
|
||||
const Location = React.memo(function Location() {
|
||||
|
|
@ -367,21 +364,7 @@ function PopupEditor(props) {
|
|||
<dl className="file-attach-wrapper">
|
||||
<dt>첨부파일</dt>
|
||||
<dd>
|
||||
<span className="file_attach">
|
||||
<FileDragDrop
|
||||
className="file-drag-drop"
|
||||
multiple={false}
|
||||
fileTypes={fileTypes}
|
||||
onDrop={onDrop}
|
||||
handleChange={handleChange}
|
||||
dropMessageStyle={{backgroundColor: '#cfe2ff'}}
|
||||
>
|
||||
<div>
|
||||
<AttachFileIcon />
|
||||
{file ? file.name : fileName ? fileName : "파일을 마우스로 끌어놓으세요."}
|
||||
</div>
|
||||
</FileDragDrop>
|
||||
</span>
|
||||
<AttachFile name="preDataFile" multiple={true} files={files} setFiles={setFiles} serverFiles={serverFiles} fileTypes={fileTypes} />
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
|
|
|||
|
|
@ -1135,6 +1135,11 @@
|
|||
resolved "https://registry.npmjs.org/@base2/pretty-print-object/-/pretty-print-object-1.0.1.tgz"
|
||||
integrity sha512-4iri8i1AqYHJE2DstZYkyEprg6Pq6sKx3xn5FpySk9sNhH7qN2LLlHJCfDTZRILNwQNPD7mATWM0TBui7uC1pA==
|
||||
|
||||
"@base2/pretty-print-object@^1.0.2":
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@base2/pretty-print-object/-/pretty-print-object-1.0.2.tgz#e30192222fd13e3c1e97040163d6628a95f70844"
|
||||
integrity sha512-rBha0UDfV7EmBRjWrGG7Cpwxg8WomPlo0q+R2so47ZFf9wy4YKJzLuHcVa0UGFjdcLZj/4F/1FNC46GIQhe7sA==
|
||||
|
||||
"@bcoe/v8-coverage@^0.2.3":
|
||||
version "0.2.3"
|
||||
resolved "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz"
|
||||
|
|
@ -8623,7 +8628,7 @@ react-drag-drop-files@^2.3.10:
|
|||
|
||||
react-element-to-jsx-string@^15.0.0:
|
||||
version "15.0.0"
|
||||
resolved "https://registry.npmjs.org/react-element-to-jsx-string/-/react-element-to-jsx-string-15.0.0.tgz"
|
||||
resolved "https://registry.yarnpkg.com/react-element-to-jsx-string/-/react-element-to-jsx-string-15.0.0.tgz#1cafd5b6ad41946ffc8755e254da3fc752a01ac6"
|
||||
integrity sha512-UDg4lXB6BzlobN60P8fHWVPX3Kyw8ORrTeBtClmIlGdkOOE+GYQSFvmEU5iLLpwp/6v42DINwNcwOhOLfQ//FQ==
|
||||
dependencies:
|
||||
"@base2/pretty-print-object" "1.0.1"
|
||||
|
|
|
|||
|
|
@ -88,13 +88,13 @@ public class PopUpApiController {
|
|||
@AuthenticationPrincipal LoginVO loginVO,
|
||||
final MultipartHttpServletRequest multiRequest,
|
||||
CreatePopupVO createPopupVO,
|
||||
@RequestParam(required = false) MultipartFile file
|
||||
@RequestParam(required = false) MultipartFile[] files
|
||||
) throws Exception {
|
||||
|
||||
ResultVO resultVO = new ResultVO();
|
||||
|
||||
try {
|
||||
resultVO = popUpApiService.contentsApiPopUpManageCreate(resultVO, request, loginVO, multiRequest, createPopupVO, file);
|
||||
resultVO = popUpApiService.contentsApiPopUpManageCreate(resultVO, request, loginVO, multiRequest, createPopupVO, files);
|
||||
} catch (Exception e) {
|
||||
resultVO.setResultCode(ResponseCode.FAILED.getCode());
|
||||
resultVO.setResultMessage(e.getMessage());
|
||||
|
|
@ -129,14 +129,14 @@ public class PopUpApiController {
|
|||
HttpServletRequest request,
|
||||
@AuthenticationPrincipal LoginVO loginVO,
|
||||
UpdatePopupVO updatePopupVO,
|
||||
@RequestParam(required = false) MultipartFile file,
|
||||
@RequestParam(required = false) MultipartFile[] files,
|
||||
@PathVariable("popupId") Long popupId
|
||||
) throws Exception {
|
||||
|
||||
ResultVO resultVO = new ResultVO();
|
||||
|
||||
try {
|
||||
resultVO = popUpApiService.contentsApiPopUpManageUpdate(resultVO, request, loginVO, updatePopupVO, file, popupId);
|
||||
resultVO = popUpApiService.contentsApiPopUpManageUpdate(resultVO, request, loginVO, updatePopupVO, files, popupId);
|
||||
} catch (Exception e) {
|
||||
resultVO.setResultCode(ResponseCode.FAILED.getCode());
|
||||
resultVO.setResultMessage(e.getMessage());
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@ import javax.servlet.http.HttpServletRequest;
|
|||
|
||||
public interface PopUpApiService {
|
||||
public ResultVO contentsApiPopUpManageList(ResultVO resultVO, HttpServletRequest request, LoginVO user, Pageable pageable) throws Exception;
|
||||
public ResultVO contentsApiPopUpManageCreate(ResultVO resultVO, HttpServletRequest request, LoginVO user, final MultipartHttpServletRequest multiRequest, CreatePopupVO createPopupVO, MultipartFile file) throws Exception;
|
||||
public ResultVO contentsApiPopUpManageRead(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long popupId) throws Exception;
|
||||
public ResultVO contentsApiPopUpManageUpdate(ResultVO resultVO, HttpServletRequest request, LoginVO user, UpdatePopupVO updatePopupVO, MultipartFile file, Long popupId) throws Exception;
|
||||
public ResultVO contentsApiPopUpManageDelete(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long popupId) throws Exception;
|
||||
public ResultVO contentsApiPopUpManageUpdateActivationSwitch(ResultVO resultVO, HttpServletRequest request, LoginVO user, String checked, Long popupId) throws Exception;
|
||||
public ResultVO contentsApiPopUpManageCreate(ResultVO resultVO, HttpServletRequest request, LoginVO user, final MultipartHttpServletRequest multiRequest, CreatePopupVO createPopupVO, MultipartFile[] files) throws Exception;
|
||||
public ResultVO contentsApiPopUpManageRead(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long popupSeq) throws Exception;
|
||||
public ResultVO contentsApiPopUpManageUpdate(ResultVO resultVO, HttpServletRequest request, LoginVO user, UpdatePopupVO updatePopupVO, MultipartFile[] files, Long popupSeq) throws Exception;
|
||||
public ResultVO contentsApiPopUpManageDelete(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long popupSeq) throws Exception;
|
||||
public ResultVO contentsApiPopUpManageUpdateActivationSwitch(ResultVO resultVO, HttpServletRequest request, LoginVO user, String checked, Long popupSeq) throws Exception;
|
||||
|
||||
}
|
||||
|
|
@ -103,7 +103,7 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
|
|||
|
||||
|
||||
@Override
|
||||
public ResultVO contentsApiPopUpManageCreate(ResultVO resultVO, HttpServletRequest request, LoginVO user, final MultipartHttpServletRequest multiRequest, CreatePopupVO createPopupVO, MultipartFile file) throws Exception {
|
||||
public ResultVO contentsApiPopUpManageCreate(ResultVO resultVO, HttpServletRequest request, LoginVO user, final MultipartHttpServletRequest multiRequest, CreatePopupVO createPopupVO, MultipartFile[] files) throws Exception {
|
||||
|
||||
System.out.println(
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
|
|
@ -115,7 +115,7 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
|
|||
);
|
||||
|
||||
|
||||
String fileGrpId = fileService.addTnAttachFile(request, user, file, this.getMiddlePath());
|
||||
String fileGrpId = fileService.addTnAttachFile(request, user, files, this.getMiddlePath());
|
||||
|
||||
Map<String, Object> response = tnPopupMngRepository.spAddTnPopupMng(
|
||||
createPopupVO.getTitle(),
|
||||
|
|
@ -173,14 +173,25 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
|
|||
dto.put("schdulEndde", tnPopupMng.getPopupEndDate().plusHours(9).format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); // 날짜/시간의 종료 일시 - yyyyMMddHHmmss
|
||||
|
||||
//첨부파일명을 가져온다.
|
||||
TnAttachFile tnAttachFile = tnAttachFileRepository.findByFileGrpId(tnPopupMng.getFileGrpId()).orElse(null);
|
||||
List<TnAttachFile> tnAttachFileList = tnAttachFileRepository.findByFileGrpId(tnPopupMng.getFileGrpId()).orElse(null);
|
||||
|
||||
if( tnAttachFile != null ) {
|
||||
dto.put("fileName", tnAttachFile.getFileOldName());
|
||||
if( tnAttachFileList != null ) {
|
||||
List<Map<String, Object>> files = new ArrayList<Map<String, Object>>();
|
||||
for (TnAttachFile item : tnAttachFileList) {
|
||||
Map<String, Object> fileDto = new HashMap<String, Object>();
|
||||
fileDto.put("seq", item.getFileSeq());
|
||||
fileDto.put("name", item.getFileOldName());
|
||||
files.add(fileDto);
|
||||
}
|
||||
dto.put("files", files);
|
||||
} else {
|
||||
dto.put("fileName", null);
|
||||
dto.put("files", null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
resultVO.setResult(dto);
|
||||
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
||||
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
|
||||
|
|
@ -189,33 +200,37 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
|
|||
}
|
||||
|
||||
@Override
|
||||
public ResultVO contentsApiPopUpManageUpdate(ResultVO resultVO, HttpServletRequest request, LoginVO user, UpdatePopupVO updatePopupVO, MultipartFile file, Long popupId) throws Exception {
|
||||
public ResultVO contentsApiPopUpManageUpdate(ResultVO resultVO, HttpServletRequest request, LoginVO user, UpdatePopupVO updatePopupVO, MultipartFile[] files, Long popupSeq) throws Exception {
|
||||
System.out.println(
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
request.getRequestURI() + " IN:" +
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
"updatePopupVO:" + "\n" +
|
||||
updatePopupVO.toString() + "\n" +
|
||||
"popupId:" + "\n" +
|
||||
popupId + "\n" +
|
||||
"popupSeq:" + "\n" +
|
||||
popupSeq + "\n" +
|
||||
"\n--------------------------------------------------------------\n"
|
||||
);
|
||||
|
||||
// 유효성 검사 실시
|
||||
int isValid = tnPopupMngRepository.spIsValidTnPopupMngId( popupId.intValue() );
|
||||
int isValid = tnPopupMngRepository.spIsValidTnPopupMngId( popupSeq.intValue() );
|
||||
|
||||
if( isValid == 0 ) {
|
||||
throw new Exception("대상이 존재하지 않습니다.");
|
||||
}
|
||||
|
||||
if( Long.parseLong(updatePopupVO.getStartDate()) > Long.parseLong(updatePopupVO.getEndDate()) ) {
|
||||
if( Long.parseLong(updatePopupVO.getStartDate()) > Long.parseLong(updatePopupVO.getEndDate()) ) {
|
||||
throw new Exception("종료일시는 시작일시보다 앞 설 수 없습니다.");
|
||||
}
|
||||
|
||||
String fileGrpId = fileService.addTnAttachFile(request, user, file, this.getMiddlePath());
|
||||
// 기존 첨부된 file이 있다면 기존 fileGrpId을 활용한다.
|
||||
TnPopupMng tnPopupMng = tnPopupMngRepository.findByPopupSeq(popupSeq);
|
||||
|
||||
String fileGrpId = tnPopupMng.getFileGrpId();
|
||||
fileGrpId = fileService.addTnAttachFile(request, user, files, this.getMiddlePath(), fileGrpId);
|
||||
|
||||
Map<String, Object> response = tnPopupMngRepository.spUpdateTnPopupMng(
|
||||
popupId.intValue(),
|
||||
popupSeq.intValue(),
|
||||
updatePopupVO.getTitle(),
|
||||
updatePopupVO.getStartDate(),
|
||||
updatePopupVO.getEndDate(),
|
||||
|
|
@ -230,7 +245,7 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
|
|||
|
||||
Map<String, Object> dto = new HashMap<String, Object>();
|
||||
dto.put("errorMessage", response.get("_error_message") );
|
||||
dto.put("popupId", popupId);
|
||||
dto.put("popupId", popupSeq);
|
||||
|
||||
resultVO.setResult(dto);
|
||||
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
||||
|
|
|
|||
|
|
@ -6,12 +6,13 @@ import org.springframework.data.jpa.repository.Query;
|
|||
import org.springframework.data.jpa.repository.query.Procedure;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface TnAttachFileRepository extends JpaRepository<TnAttachFile, Integer> {
|
||||
|
||||
Optional<TnAttachFile> findByFileGrpId(String fileGrpId);
|
||||
Optional<List<TnAttachFile>> findByFileGrpId(String fileGrpId);
|
||||
|
||||
@Procedure("make_file_grp_id")
|
||||
String makeFileGrpId( String modiId );
|
||||
|
|
|
|||
|
|
@ -13,10 +13,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
|
|
@ -32,7 +29,7 @@ public class FileService {
|
|||
if(tnAttachFile.getFileSeq()!=null){
|
||||
tnAttachFile = tnAttachFileRepository.findById(tnAttachFile.getFileSeq()).orElse(null);
|
||||
}else{
|
||||
tnAttachFile = tnAttachFileRepository.findByFileGrpId(tnAttachFile.getFileGrpId()).orElse(null);
|
||||
tnAttachFile = Objects.requireNonNull(tnAttachFileRepository.findByFileGrpId(tnAttachFile.getFileGrpId()).orElse(null)).get(0);
|
||||
}
|
||||
int downCnt = tnAttachFile.getDownCnt()==null?0: tnAttachFile.getDownCnt();
|
||||
tnAttachFile.setDownCnt(downCnt+1);
|
||||
|
|
@ -50,50 +47,77 @@ public class FileService {
|
|||
* TN_ATTACH_FILE 참고.
|
||||
* @param request
|
||||
* @param user
|
||||
* @param file
|
||||
* @param files
|
||||
* @param middlePath 파일이 저장될 중간 경로다.
|
||||
* D:/kcscUploadFiles/XXXX/abc.jpg XXXX에 해당하는 경로다.
|
||||
* 참고로 D:/kcscUploadFiles 값은 application-xxx.properties에 있는 Globals.fileStorePath를 통해 얻는다.
|
||||
* @return 파일 그룹 ID
|
||||
* @throws Exception
|
||||
*/
|
||||
public String addTnAttachFile(HttpServletRequest request, LoginVO user, MultipartFile[] files, String middlePath) throws Exception {
|
||||
return this.addTnAttachFile(request, user, files, middlePath, null);
|
||||
}
|
||||
|
||||
public String addTnAttachFile(HttpServletRequest request, LoginVO user, MultipartFile file, String middlePath) throws Exception {
|
||||
MultipartFile[] files = new MultipartFile[1];
|
||||
return this.addTnAttachFile(request, user, files, middlePath);
|
||||
}
|
||||
|
||||
/**
|
||||
* TN_ATTACH_FILE table에 insert 후, 파일 그룹 ID를 return 한다.
|
||||
* TN_ATTACH_FILE 참고.
|
||||
* @param request
|
||||
* @param user
|
||||
* @param files
|
||||
* @param middlePath 파일이 저장될 중간 경로다.
|
||||
* D:/kcscUploadFiles/XXXX/abc.jpg XXXX에 해당하는 경로다.
|
||||
* 참고로 D:/kcscUploadFiles 값은 application-xxx.properties에 있는 Globals.fileStorePath를 통해 얻는다.
|
||||
* @return 파일 그룹 ID
|
||||
* @throws Exception
|
||||
*/
|
||||
public String addTnAttachFile(HttpServletRequest request, LoginVO user, MultipartFile[] files, String middlePath, String fileGrpId) throws Exception {
|
||||
String ipAddress = NetworkUtil.getClientIpAddress(request);
|
||||
|
||||
String fileGrpId = null;
|
||||
if( file != null && !file.isEmpty()) {
|
||||
|
||||
if( fileGrpId == null || fileGrpId.trim().isEmpty()) {
|
||||
//String fileGrpId = UUID.randomUUID().toString();
|
||||
fileGrpId = tnAttachFileRepository.makeFileGrpId(user.getId());
|
||||
}
|
||||
|
||||
|
||||
for (MultipartFile file : files) {if( file != null && !file.isEmpty()) {
|
||||
|
||||
Map<String, MultipartFile> filesMap = new HashMap<String, MultipartFile>();
|
||||
filesMap.put("file", file);
|
||||
|
||||
//String fileGrpId = UUID.randomUUID().toString();
|
||||
fileGrpId = tnAttachFileRepository.makeFileGrpId(user.getId());
|
||||
|
||||
List<FileVO> files = fileUtil.parseFileInf(filesMap, "", 0, middlePath, null);
|
||||
List<FileVO> fileVoList = fileUtil.parseFileInf(filesMap, "", 0, middlePath, null);
|
||||
|
||||
int nCount = 1;
|
||||
// 업로드된 file을 tnAttachFile에 insert한다.
|
||||
for (Iterator<FileVO> iter = files.iterator(); iter.hasNext(); nCount++) {
|
||||
for (Iterator<FileVO> iter = fileVoList.iterator(); iter.hasNext(); nCount++) {
|
||||
|
||||
FileVO item = iter.next();
|
||||
|
||||
tnAttachFileRepository.spAddTnAttachFile(
|
||||
fileGrpId,
|
||||
nCount,
|
||||
item.getOrignlFileNm(),
|
||||
item.getStreFileNm() + "." + item.getFileExtsn(),
|
||||
(item.getFileStreCours() + File.separator + item.getAtchFileId()).replaceAll("\\\\", "/"),
|
||||
Long.parseLong(item.getFileMg()),
|
||||
item.getFileExtsn(),
|
||||
ipAddress,
|
||||
user.getId(),
|
||||
null,
|
||||
null,
|
||||
null
|
||||
fileGrpId,
|
||||
nCount,
|
||||
item.getOrignlFileNm(),
|
||||
item.getStreFileNm() + "." + item.getFileExtsn(),
|
||||
(item.getFileStreCours() + File.separator + item.getAtchFileId()).replaceAll("\\\\", "/"),
|
||||
Long.parseLong(item.getFileMg()),
|
||||
item.getFileExtsn(),
|
||||
ipAddress,
|
||||
user.getId(),
|
||||
null,
|
||||
null,
|
||||
null
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return fileGrpId;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue