Compare commits
No commits in common. "ac4625a1746d22802fcce1801b812a1d3cb9a32c" and "100656b50faebae18271df095fea15caf3b90af9" have entirely different histories.
ac4625a174
...
100656b50f
|
|
@ -6,7 +6,6 @@
|
||||||
"@ant-design/colors": "^6.0.0",
|
"@ant-design/colors": "^6.0.0",
|
||||||
"@ant-design/icons": "^4.7.0",
|
"@ant-design/icons": "^4.7.0",
|
||||||
"@babel/runtime": "^7.23.9",
|
"@babel/runtime": "^7.23.9",
|
||||||
"@base2/pretty-print-object": "^1.0.2",
|
|
||||||
"@emotion/react": "^11.11.3",
|
"@emotion/react": "^11.11.3",
|
||||||
"@emotion/styled": "^11.11.0",
|
"@emotion/styled": "^11.11.0",
|
||||||
"@material-ui/core": "^4.12.4",
|
"@material-ui/core": "^4.12.4",
|
||||||
|
|
|
||||||
|
|
@ -1,214 +0,0 @@
|
||||||
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,25 +7,17 @@ import { FileUploader } from "react-drag-drop-files";
|
||||||
* @param {fileTypes} const fileTypes = ["JPG", "PNG", "GIF"];
|
* @param {fileTypes} const fileTypes = ["JPG", "PNG", "GIF"];
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
function FileDragDrop({fileTypes, children, multiple, label, onDrop, handleChange, file, setFile, dropMessageStyle, name, maxSize, disabled}) {
|
function FileDragDrop({fileTypes, children, multiple, label, onDrop, handleChange, file, setFile, dropMessageStyle}) {
|
||||||
|
|
||||||
const temp = 0;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FileUploader
|
<FileUploader
|
||||||
hoverTitle="여기에 파일을 놓아주세요"
|
|
||||||
handleChange={handleChange}
|
handleChange={handleChange}
|
||||||
name={name}
|
name="file"
|
||||||
types={fileTypes ? fileTypes : "*"}
|
types={fileTypes ? fileTypes : "*"}
|
||||||
multiple={multiple ? multiple : false}
|
multiple={multiple && false}
|
||||||
label={label}
|
label={label}
|
||||||
onDrop={onDrop}
|
onDrop={onDrop}
|
||||||
dropMessageStyle={dropMessageStyle}
|
dropMessageStyle={dropMessageStyle}
|
||||||
maxSize={maxSize}
|
|
||||||
disabled={disabled}
|
|
||||||
onSelect={(e)=> {
|
|
||||||
e = e || window.event;
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
{children && children}
|
{children && children}
|
||||||
</FileUploader>
|
</FileUploader>
|
||||||
|
|
|
||||||
|
|
@ -213,7 +213,7 @@ function ProgressStatus(props) {
|
||||||
getList({ ...searchCondition, pageIndex: passedPage })
|
getList({ ...searchCondition, pageIndex: passedPage })
|
||||||
}} />
|
}} />
|
||||||
<div className="right_col btn1">
|
<div className="right_col btn1">
|
||||||
<Link to={URL.ADMIN__COMMITTEE__PROGRESS_STATUS__CREATE} className="btn btn_blue_h46 w_100">등록</Link>
|
<Link to={URL.ADMIN__CONTENTS__POP_UP__CREATE} className="btn btn_blue_h46 w_100">등록</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,17 @@
|
||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import { Link, useLocation, useNavigate } from 'react-router-dom';
|
import { Link, useLocation, useNavigate } from 'react-router-dom';
|
||||||
import DatePicker from "react-datepicker";
|
import DatePicker from "react-datepicker";
|
||||||
import AttachFile from "components/file/AttachFile";
|
|
||||||
|
|
||||||
|
|
||||||
import * as EgovNet from 'api/egovFetch';
|
import * as EgovNet from 'api/egovFetch';
|
||||||
import URL from 'constants/url';
|
import URL from 'constants/url';
|
||||||
import CODE from 'constants/code';
|
import CODE from 'constants/code';
|
||||||
|
|
||||||
import { default as EgovLeftNav } from 'components/leftmenu/EgovLeftNavAdmin';
|
import { default as EgovLeftNav } from 'components/leftmenu/EgovLeftNavAdmin';
|
||||||
|
|
||||||
|
import 'react-datepicker/dist/react-datepicker.css';
|
||||||
|
|
||||||
import styled from "styled-components";
|
import styled from "styled-components";
|
||||||
import { makeStyles } from "@mui/styles";
|
import { makeStyles } from "@mui/styles";
|
||||||
|
|
||||||
|
|
@ -27,6 +31,15 @@ const useStyles = makeStyles(() => ({
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const StyledDiv = styled.div`
|
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 {
|
.f_select.w_250 {
|
||||||
@media only screen and (max-width: 768px) {
|
@media only screen and (max-width: 768px) {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
@ -38,17 +51,9 @@ const StyledDiv = styled.div`
|
||||||
width: 100%;
|
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.group("EgovAdminScheduleEdit");
|
||||||
console.log("[Start] EgovAdminScheduleEdit ------------------------------");
|
console.log("[Start] EgovAdminScheduleEdit ------------------------------");
|
||||||
console.log("EgovAdminScheduleEdit [props] : ", props);
|
console.log("EgovAdminScheduleEdit [props] : ", props);
|
||||||
|
|
@ -74,19 +79,22 @@ function ProgressStatusEdit(props) {
|
||||||
console.log("EgovAdminScheduleEdit [location] : ", location);
|
console.log("EgovAdminScheduleEdit [location] : ", location);
|
||||||
|
|
||||||
const [modeInfo, setModeInfo] = useState({ mode: props.mode });
|
const [modeInfo, setModeInfo] = useState({ mode: props.mode });
|
||||||
const [requestItems, setRequestItems] = useState
|
const [scheduleDetail, setScheduleDetail] = useState
|
||||||
(
|
(
|
||||||
{
|
{
|
||||||
orgGroupId: 1,
|
startDate: new Date(),
|
||||||
startDate: new Date(),
|
endDate: new Date(),
|
||||||
eventId : 0,
|
eventId : 0,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const [drftDatetimeHH, setDrftDatetimeHH] = useState();
|
const [schdulBgndeHH, setSchdulBgndeHH] = useState();
|
||||||
const [drftDatetimeMM, setDrftDatetimeMM] = useState();
|
const [schdulBgndeMM, setSchdulBgndeMM] = useState();
|
||||||
|
const [schdulEnddeHH, setSchdulEnddeHH] = useState();
|
||||||
|
const [schdulEnddeMM, setSchdulEnddeMM] = useState();
|
||||||
|
|
||||||
const [scheduleInit, setScheduleInit] = useState({});
|
const [scheduleInit, setScheduleInit] = useState({});
|
||||||
|
const [scheduleApiOrgApiDepthList, setScheduleApiOrgApiDepthList] = useState({ });
|
||||||
|
|
||||||
|
|
||||||
const initMode = () => {
|
const initMode = () => {
|
||||||
|
|
@ -112,8 +120,7 @@ function ProgressStatusEdit(props) {
|
||||||
default:
|
default:
|
||||||
navigate({pathname: URL.ERROR}, {state: {msg : ""}});
|
navigate({pathname: URL.ERROR}, {state: {msg : ""}});
|
||||||
}
|
}
|
||||||
|
retrieveDetail();
|
||||||
getList(orgSearchCondition);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const convertDate = (str) => {
|
const convertDate = (str) => {
|
||||||
|
|
@ -132,120 +139,65 @@ function ProgressStatusEdit(props) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const retrieveDetail = () => {
|
||||||
|
|
||||||
const [orgSearchCondition, setOrgSearchCondition] = useState({ paramCodeGroup: null, paramCodeLevel: 'LV_01' });
|
EgovNet.requestFetch("/schedule/init",
|
||||||
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,
|
requestOptions,
|
||||||
function (resp) {
|
function (resp) {
|
||||||
const myIndex = Number(String(orgSearchCondition.paramCodeLevel).replace('LV_','')) - 1;
|
setScheduleInit(
|
||||||
const forCopy = [...orgArray];
|
resp
|
||||||
forCopy[myIndex] = resp.result.list;
|
);
|
||||||
setOrgArray(forCopy);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
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 updateSchedule = () => {
|
const updateSchedule = () => {
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
|
|
||||||
for (let key in requestItems) {
|
for (let key in scheduleDetail) {
|
||||||
if ( key === 'startDate' ) {
|
if ( key === 'startDate' ) {
|
||||||
formData.append(key, getDateFourteenDigit( requestItems[key] ));
|
formData.append(key, getDateFourteenDigit( scheduleDetail[key] ));
|
||||||
} else if( key === 'endDate' ) {
|
} else if( key === 'endDate' ) {
|
||||||
formData.append(key, getDateFourteenDigit( requestItems[key] ));
|
formData.append(key, getDateFourteenDigit( scheduleDetail[key] ));
|
||||||
} else {
|
} else {
|
||||||
formData.append(key, requestItems[key]);
|
formData.append(key, scheduleDetail[key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("requestItems [%s] ", key, requestItems[key]);
|
console.log("scheduleDetail [%s] ", key, scheduleDetail[key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( formValidator(formData) ) {
|
if ( formValidator(formData) ) {
|
||||||
|
|
@ -311,28 +263,49 @@ function ProgressStatusEdit(props) {
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(function () {
|
useEffect(function () {
|
||||||
console.log("------------------------------EgovAdminScheduleEdit [%o]", requestItems);
|
console.log("------------------------------EgovAdminScheduleEdit [%o]", scheduleDetail);
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [requestItems]);
|
}, [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]);
|
||||||
|
|
||||||
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.log("------------------------------EgovAdminScheduleEdit [End]");
|
||||||
console.groupEnd("EgovAdminScheduleEdit");
|
console.groupEnd("EgovAdminScheduleEdit");
|
||||||
|
|
@ -345,7 +318,7 @@ function ProgressStatusEdit(props) {
|
||||||
<li><Link to={URL.MAIN} className="home">Home</Link></li>
|
<li><Link to={URL.MAIN} className="home">Home</Link></li>
|
||||||
<li><Link to={URL.ADMIN}>사이트 관리</Link></li>
|
<li><Link to={URL.ADMIN}>사이트 관리</Link></li>
|
||||||
<li>위원회 관리</li>
|
<li>위원회 관리</li>
|
||||||
<li>진행현황 관리</li>
|
<li>위원회 일정 관리</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
{/* <!--// Location --> */}
|
{/* <!--// Location --> */}
|
||||||
|
|
@ -359,36 +332,20 @@ function ProgressStatusEdit(props) {
|
||||||
{/* <!-- 본문 --> */}
|
{/* <!-- 본문 --> */}
|
||||||
|
|
||||||
<div className="top_tit">
|
<div className="top_tit">
|
||||||
<h1 className="tit_1">진행현황 관리</h1>
|
<h1 className="tit_1">위원회 일정 관리</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* <!-- <h2 className="tit_2">위원회 일정 추가</h2> --> */}
|
||||||
|
|
||||||
{/* <!-- 게시판 상세보기 --> */}
|
{/* <!-- 게시판 상세보기 --> */}
|
||||||
<StyledDiv className="board_view2">
|
<StyledDiv className="board_view2">
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label>안건</label><span className="req">필수</span></dt>
|
<dt>구분<span className="req">필수</span></dt>
|
||||||
<dd>
|
<dd>
|
||||||
<input className="f_input2 w_full" type="text" name="title" title="안건" placeholder="안건을 입력하세요"
|
<label className="f_select w_150" htmlFor="div-meet">
|
||||||
value={requestItems.title}
|
<select id="div-meet" name="div-meet" title="일정구분"
|
||||||
onChange={(e) => setRequestItems({ ...requestItems, title: e.target.value })}
|
value={scheduleDetail.divMeet}
|
||||||
/>
|
onChange={(e) => setScheduleDetail({ ...scheduleDetail, divMeet: 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>
|
<option key={"none"} value="">선택</option>
|
||||||
{scheduleInit && scheduleInit.result && scheduleInit.result.listCodes
|
{scheduleInit && scheduleInit.result && scheduleInit.result.listCodes
|
||||||
&& scheduleInit.result.listCodes.map((item) => (
|
&& scheduleInit.result.listCodes.map((item) => (
|
||||||
|
|
@ -399,129 +356,95 @@ function ProgressStatusEdit(props) {
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label>회의일자</label><span className="req">필수</span></dt>
|
<dt>심의위원회<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>
|
||||||
|
))}
|
||||||
|
</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>
|
||||||
|
))}
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
<dl>
|
||||||
|
<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 })}
|
||||||
|
/>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
<dl>
|
||||||
|
<dt><label htmlFor="location">장소</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 })} />
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
<dl>
|
||||||
|
<dt>날짜/시간<span className="req">필수</span></dt>
|
||||||
<dd className="datetime">
|
<dd className="datetime">
|
||||||
<span className="line_break">
|
<span className="line_break">
|
||||||
<DatePicker
|
<DatePicker
|
||||||
selected={requestItems.drftDatetime}
|
selected={scheduleDetail.startDate}
|
||||||
name="drftDatetime"
|
name="schdulBgnde"
|
||||||
className="f_input"
|
className="f_input"
|
||||||
dateFormat="yyyy-MM-dd"
|
dateFormat="yyyy-MM-dd HH:mm"
|
||||||
|
showTimeInput
|
||||||
onChange={(date) => {
|
onChange={(date) => {
|
||||||
setRequestItems({ ...requestItems, schdulBgnde: getDateFourteenDigit(date), drftDatetimeYYYMMDD: getYYYYMMDD(date), drftDatetime: date });
|
console.log("setStartDate : ", date);
|
||||||
setDrftDatetimeHH(date.getHours());
|
setScheduleDetail({ ...scheduleDetail, schdulBgnde: getDateFourteenDigit(date), schdulBgndeYYYMMDD: getYYYYMMDD(date), schdulBgndeHH: date.getHours(), schdulBgndeMM: date.getMinutes(), startDate: date });
|
||||||
setDrftDatetimeMM(date.getMinutes());
|
setSchdulBgndeHH(date.getHours());
|
||||||
|
setSchdulBgndeMM(date.getMinutes());
|
||||||
}} />
|
}} />
|
||||||
<input type="hidden" name="drftDatetimeMM" defaultValue={drftDatetimeMM} readOnly />
|
<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>
|
</span>
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label>위원회</label><span className="req">필수</span></dt>
|
<dt><label htmlFor="contents">내용</label><span className="req">필수</span></dt>
|
||||||
<dd>
|
<dd>
|
||||||
{/** top org */}
|
<textarea className="f_txtar w_full h_100" name="contents" id="contents" cols="30" rows="10" placeholder="일정 내용을 입력하세요."
|
||||||
<label className="f_select w_250 org-group-id" htmlFor="org-group-id">
|
defaultValue={scheduleDetail.contents}
|
||||||
<select id="org-group-id" name="orgGroupId" title="중앙건설기술심의 선택"
|
onChange={(e) => setScheduleDetail({ ...scheduleDetail, contents: e.target.value })}
|
||||||
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-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>
|
|
||||||
<dd>
|
|
||||||
<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>회의실 비밀번호</label><span className="req">필수</span></dt>
|
|
||||||
<dd>
|
|
||||||
<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><label>회의 안건</label><span className="req">필수</span></dt>
|
|
||||||
<dd>
|
|
||||||
<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>
|
></textarea>
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
@ -531,12 +454,18 @@ function ProgressStatusEdit(props) {
|
||||||
<div className="left_col btn1">
|
<div className="left_col btn1">
|
||||||
<button className="btn btn_skyblue_h46 w_100"
|
<button className="btn btn_skyblue_h46 w_100"
|
||||||
onClick={() => updateSchedule()}
|
onClick={() => updateSchedule()}
|
||||||
> 저장</button>
|
> 저장</button>
|
||||||
|
{modeInfo.mode === CODE.MODE_MODIFY &&
|
||||||
|
<button className="btn btn_skyblue_h46 w_100"
|
||||||
|
onClick={(e) => {
|
||||||
|
onClickDeleteSchedule(location.state?.schdulId);
|
||||||
|
}}>삭제</button>
|
||||||
|
}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="right_col btn1">
|
<div className="right_col btn1">
|
||||||
<Link to={URL.ADMIN__COMMITTEE__PROGRESS_STATUS} className="btn btn_blue_h46 w_100">목록</Link>
|
<Link to={URL.ADMIN__COMMITTEE__SCHEDULES} className="btn btn_blue_h46 w_100">목록</Link>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/* <!--// 버튼영역 --> */}
|
{/* <!--// 버튼영역 --> */}
|
||||||
|
|
@ -551,4 +480,4 @@ function ProgressStatusEdit(props) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ProgressStatusEdit;
|
export default SchedulesEdit;
|
||||||
|
|
@ -1,7 +1,10 @@
|
||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import { Link, useLocation, useNavigate } from 'react-router-dom';
|
import { Link, useLocation, useNavigate } from 'react-router-dom';
|
||||||
import DatePicker from "react-datepicker";
|
import DatePicker from "react-datepicker";
|
||||||
import AttachFile from "../../../../components/file/AttachFile";
|
import FileDragDrop from "../../../../components/file/FileDragDrop";
|
||||||
|
import AttachFileIcon from '@mui/icons-material/AttachFile';
|
||||||
|
|
||||||
|
import EgovAttachFile from 'components/EgovAttachFile';
|
||||||
import RichTextEditor from "../../../../components/editor/RichTextEditor";
|
import RichTextEditor from "../../../../components/editor/RichTextEditor";
|
||||||
import AlertDialogSlide from "../../../../components/alert/AlertDialogSlide";
|
import AlertDialogSlide from "../../../../components/alert/AlertDialogSlide";
|
||||||
import CODE from 'constants/code';
|
import CODE from 'constants/code';
|
||||||
|
|
@ -56,7 +59,7 @@ function PopupEditor(props) {
|
||||||
const [schdulBgndeMM, setSchdulBgndeMM] = useState();
|
const [schdulBgndeMM, setSchdulBgndeMM] = useState();
|
||||||
const [schdulEnddeHH, setSchdulEnddeHH] = useState();
|
const [schdulEnddeHH, setSchdulEnddeHH] = useState();
|
||||||
const [schdulEnddeMM, setSchdulEnddeMM] = useState();
|
const [schdulEnddeMM, setSchdulEnddeMM] = useState();
|
||||||
|
const [fileName, setFileName] = useState();
|
||||||
|
|
||||||
const [confirm, setConfirm] = React.useState();
|
const [confirm, setConfirm] = React.useState();
|
||||||
|
|
||||||
|
|
@ -137,11 +140,11 @@ function PopupEditor(props) {
|
||||||
setText(rawDetail.contents);
|
setText(rawDetail.contents);
|
||||||
setTextOriginal(rawDetail.contents);
|
setTextOriginal(rawDetail.contents);
|
||||||
|
|
||||||
if( rawDetail.files ) {
|
if( rawDetail.fileName ) {
|
||||||
setServerFiles(rawDetail.files);
|
setFileName(rawDetail.fileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -164,14 +167,7 @@ function PopupEditor(props) {
|
||||||
formData.append("contents", text);
|
formData.append("contents", text);
|
||||||
|
|
||||||
//첨부파일
|
//첨부파일
|
||||||
//formData.append("files", files);
|
formData.append("file", file);
|
||||||
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)) {
|
if (formValidator(formData)) {
|
||||||
const requestOptions = {
|
const requestOptions = {
|
||||||
|
|
@ -268,15 +264,22 @@ function PopupEditor(props) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const fileTypes = ["JPG", "PNG", "GIF", "PDF", "HWP", "HWPX", "ZIP", "JPEG", "MP4", "TXT"];
|
const fileTypes = ["JPG", "PNG", "GIF", "PDF", "HWP", "HWPX", "ZIP", "JPEG", "MP4", "TXT"];
|
||||||
|
const onDrop = (e) => {
|
||||||
const [serverFiles, setServerFiles] = useState();
|
//alert('ddd');
|
||||||
const [files, setFiles] = useState();
|
|
||||||
/*
|
|
||||||
let files = null;
|
|
||||||
const setFiles = (myFiles) => {
|
|
||||||
files = myFiles;
|
|
||||||
};
|
};
|
||||||
*/
|
|
||||||
|
const [file, setFile] = useState(null);
|
||||||
|
const handleChange = (file) => {
|
||||||
|
setFile(file);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
useEffect(function () {
|
||||||
|
if( file ) {
|
||||||
|
console.log('%o', file);
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [file]);
|
||||||
|
|
||||||
|
|
||||||
const Location = React.memo(function Location() {
|
const Location = React.memo(function Location() {
|
||||||
|
|
@ -364,7 +367,21 @@ function PopupEditor(props) {
|
||||||
<dl className="file-attach-wrapper">
|
<dl className="file-attach-wrapper">
|
||||||
<dt>첨부파일</dt>
|
<dt>첨부파일</dt>
|
||||||
<dd>
|
<dd>
|
||||||
<AttachFile name="preDataFile" multiple={true} files={files} setFiles={setFiles} serverFiles={serverFiles} fileTypes={fileTypes} />
|
<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>
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1135,11 +1135,6 @@
|
||||||
resolved "https://registry.npmjs.org/@base2/pretty-print-object/-/pretty-print-object-1.0.1.tgz"
|
resolved "https://registry.npmjs.org/@base2/pretty-print-object/-/pretty-print-object-1.0.1.tgz"
|
||||||
integrity sha512-4iri8i1AqYHJE2DstZYkyEprg6Pq6sKx3xn5FpySk9sNhH7qN2LLlHJCfDTZRILNwQNPD7mATWM0TBui7uC1pA==
|
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":
|
"@bcoe/v8-coverage@^0.2.3":
|
||||||
version "0.2.3"
|
version "0.2.3"
|
||||||
resolved "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz"
|
resolved "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz"
|
||||||
|
|
@ -8628,7 +8623,7 @@ react-drag-drop-files@^2.3.10:
|
||||||
|
|
||||||
react-element-to-jsx-string@^15.0.0:
|
react-element-to-jsx-string@^15.0.0:
|
||||||
version "15.0.0"
|
version "15.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/react-element-to-jsx-string/-/react-element-to-jsx-string-15.0.0.tgz#1cafd5b6ad41946ffc8755e254da3fc752a01ac6"
|
resolved "https://registry.npmjs.org/react-element-to-jsx-string/-/react-element-to-jsx-string-15.0.0.tgz"
|
||||||
integrity sha512-UDg4lXB6BzlobN60P8fHWVPX3Kyw8ORrTeBtClmIlGdkOOE+GYQSFvmEU5iLLpwp/6v42DINwNcwOhOLfQ//FQ==
|
integrity sha512-UDg4lXB6BzlobN60P8fHWVPX3Kyw8ORrTeBtClmIlGdkOOE+GYQSFvmEU5iLLpwp/6v42DINwNcwOhOLfQ//FQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@base2/pretty-print-object" "1.0.1"
|
"@base2/pretty-print-object" "1.0.1"
|
||||||
|
|
|
||||||
|
|
@ -88,13 +88,13 @@ public class PopUpApiController {
|
||||||
@AuthenticationPrincipal LoginVO loginVO,
|
@AuthenticationPrincipal LoginVO loginVO,
|
||||||
final MultipartHttpServletRequest multiRequest,
|
final MultipartHttpServletRequest multiRequest,
|
||||||
CreatePopupVO createPopupVO,
|
CreatePopupVO createPopupVO,
|
||||||
@RequestParam(required = false) MultipartFile[] files
|
@RequestParam(required = false) MultipartFile file
|
||||||
) throws Exception {
|
) throws Exception {
|
||||||
|
|
||||||
ResultVO resultVO = new ResultVO();
|
ResultVO resultVO = new ResultVO();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
resultVO = popUpApiService.contentsApiPopUpManageCreate(resultVO, request, loginVO, multiRequest, createPopupVO, files);
|
resultVO = popUpApiService.contentsApiPopUpManageCreate(resultVO, request, loginVO, multiRequest, createPopupVO, file);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
resultVO.setResultCode(ResponseCode.FAILED.getCode());
|
resultVO.setResultCode(ResponseCode.FAILED.getCode());
|
||||||
resultVO.setResultMessage(e.getMessage());
|
resultVO.setResultMessage(e.getMessage());
|
||||||
|
|
@ -129,14 +129,14 @@ public class PopUpApiController {
|
||||||
HttpServletRequest request,
|
HttpServletRequest request,
|
||||||
@AuthenticationPrincipal LoginVO loginVO,
|
@AuthenticationPrincipal LoginVO loginVO,
|
||||||
UpdatePopupVO updatePopupVO,
|
UpdatePopupVO updatePopupVO,
|
||||||
@RequestParam(required = false) MultipartFile[] files,
|
@RequestParam(required = false) MultipartFile file,
|
||||||
@PathVariable("popupId") Long popupId
|
@PathVariable("popupId") Long popupId
|
||||||
) throws Exception {
|
) throws Exception {
|
||||||
|
|
||||||
ResultVO resultVO = new ResultVO();
|
ResultVO resultVO = new ResultVO();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
resultVO = popUpApiService.contentsApiPopUpManageUpdate(resultVO, request, loginVO, updatePopupVO, files, popupId);
|
resultVO = popUpApiService.contentsApiPopUpManageUpdate(resultVO, request, loginVO, updatePopupVO, file, popupId);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
resultVO.setResultCode(ResponseCode.FAILED.getCode());
|
resultVO.setResultCode(ResponseCode.FAILED.getCode());
|
||||||
resultVO.setResultMessage(e.getMessage());
|
resultVO.setResultMessage(e.getMessage());
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,10 @@ import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
public interface PopUpApiService {
|
public interface PopUpApiService {
|
||||||
public ResultVO contentsApiPopUpManageList(ResultVO resultVO, HttpServletRequest request, LoginVO user, Pageable pageable) throws Exception;
|
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[] files) 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 popupSeq) 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[] files, Long popupSeq) 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 popupSeq) 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 popupSeq) throws Exception;
|
public ResultVO contentsApiPopUpManageUpdateActivationSwitch(ResultVO resultVO, HttpServletRequest request, LoginVO user, String checked, Long popupId) throws Exception;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -103,7 +103,7 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResultVO contentsApiPopUpManageCreate(ResultVO resultVO, HttpServletRequest request, LoginVO user, final MultipartHttpServletRequest multiRequest, CreatePopupVO createPopupVO, MultipartFile[] files) throws Exception {
|
public ResultVO contentsApiPopUpManageCreate(ResultVO resultVO, HttpServletRequest request, LoginVO user, final MultipartHttpServletRequest multiRequest, CreatePopupVO createPopupVO, MultipartFile file) throws Exception {
|
||||||
|
|
||||||
System.out.println(
|
System.out.println(
|
||||||
"\n--------------------------------------------------------------\n" +
|
"\n--------------------------------------------------------------\n" +
|
||||||
|
|
@ -115,7 +115,7 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
String fileGrpId = fileService.addTnAttachFile(request, user, files, this.getMiddlePath());
|
String fileGrpId = fileService.addTnAttachFile(request, user, file, this.getMiddlePath());
|
||||||
|
|
||||||
Map<String, Object> response = tnPopupMngRepository.spAddTnPopupMng(
|
Map<String, Object> response = tnPopupMngRepository.spAddTnPopupMng(
|
||||||
createPopupVO.getTitle(),
|
createPopupVO.getTitle(),
|
||||||
|
|
@ -173,25 +173,14 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
|
||||||
dto.put("schdulEndde", tnPopupMng.getPopupEndDate().plusHours(9).format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); // 날짜/시간의 종료 일시 - yyyyMMddHHmmss
|
dto.put("schdulEndde", tnPopupMng.getPopupEndDate().plusHours(9).format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); // 날짜/시간의 종료 일시 - yyyyMMddHHmmss
|
||||||
|
|
||||||
//첨부파일명을 가져온다.
|
//첨부파일명을 가져온다.
|
||||||
List<TnAttachFile> tnAttachFileList = tnAttachFileRepository.findByFileGrpId(tnPopupMng.getFileGrpId()).orElse(null);
|
TnAttachFile tnAttachFile = tnAttachFileRepository.findByFileGrpId(tnPopupMng.getFileGrpId()).orElse(null);
|
||||||
|
|
||||||
if( tnAttachFileList != null ) {
|
if( tnAttachFile != null ) {
|
||||||
List<Map<String, Object>> files = new ArrayList<Map<String, Object>>();
|
dto.put("fileName", tnAttachFile.getFileOldName());
|
||||||
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 {
|
} else {
|
||||||
dto.put("files", null);
|
dto.put("fileName", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
resultVO.setResult(dto);
|
resultVO.setResult(dto);
|
||||||
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
||||||
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
|
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
|
||||||
|
|
@ -200,37 +189,33 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResultVO contentsApiPopUpManageUpdate(ResultVO resultVO, HttpServletRequest request, LoginVO user, UpdatePopupVO updatePopupVO, MultipartFile[] files, Long popupSeq) throws Exception {
|
public ResultVO contentsApiPopUpManageUpdate(ResultVO resultVO, HttpServletRequest request, LoginVO user, UpdatePopupVO updatePopupVO, MultipartFile file, Long popupId) throws Exception {
|
||||||
System.out.println(
|
System.out.println(
|
||||||
"\n--------------------------------------------------------------\n" +
|
"\n--------------------------------------------------------------\n" +
|
||||||
request.getRequestURI() + " IN:" +
|
request.getRequestURI() + " IN:" +
|
||||||
"\n--------------------------------------------------------------\n" +
|
"\n--------------------------------------------------------------\n" +
|
||||||
"updatePopupVO:" + "\n" +
|
"updatePopupVO:" + "\n" +
|
||||||
updatePopupVO.toString() + "\n" +
|
updatePopupVO.toString() + "\n" +
|
||||||
"popupSeq:" + "\n" +
|
"popupId:" + "\n" +
|
||||||
popupSeq + "\n" +
|
popupId + "\n" +
|
||||||
"\n--------------------------------------------------------------\n"
|
"\n--------------------------------------------------------------\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
// 유효성 검사 실시
|
// 유효성 검사 실시
|
||||||
int isValid = tnPopupMngRepository.spIsValidTnPopupMngId( popupSeq.intValue() );
|
int isValid = tnPopupMngRepository.spIsValidTnPopupMngId( popupId.intValue() );
|
||||||
|
|
||||||
if( isValid == 0 ) {
|
if( isValid == 0 ) {
|
||||||
throw new Exception("대상이 존재하지 않습니다.");
|
throw new Exception("대상이 존재하지 않습니다.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if( Long.parseLong(updatePopupVO.getStartDate()) > Long.parseLong(updatePopupVO.getEndDate()) ) {
|
if( Long.parseLong(updatePopupVO.getStartDate()) > Long.parseLong(updatePopupVO.getEndDate()) ) {
|
||||||
throw new Exception("종료일시는 시작일시보다 앞 설 수 없습니다.");
|
throw new Exception("종료일시는 시작일시보다 앞 설 수 없습니다.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 기존 첨부된 file이 있다면 기존 fileGrpId을 활용한다.
|
String fileGrpId = fileService.addTnAttachFile(request, user, file, this.getMiddlePath());
|
||||||
TnPopupMng tnPopupMng = tnPopupMngRepository.findByPopupSeq(popupSeq);
|
|
||||||
|
|
||||||
String fileGrpId = tnPopupMng.getFileGrpId();
|
|
||||||
fileGrpId = fileService.addTnAttachFile(request, user, files, this.getMiddlePath(), fileGrpId);
|
|
||||||
|
|
||||||
Map<String, Object> response = tnPopupMngRepository.spUpdateTnPopupMng(
|
Map<String, Object> response = tnPopupMngRepository.spUpdateTnPopupMng(
|
||||||
popupSeq.intValue(),
|
popupId.intValue(),
|
||||||
updatePopupVO.getTitle(),
|
updatePopupVO.getTitle(),
|
||||||
updatePopupVO.getStartDate(),
|
updatePopupVO.getStartDate(),
|
||||||
updatePopupVO.getEndDate(),
|
updatePopupVO.getEndDate(),
|
||||||
|
|
@ -245,7 +230,7 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
|
||||||
|
|
||||||
Map<String, Object> dto = new HashMap<String, Object>();
|
Map<String, Object> dto = new HashMap<String, Object>();
|
||||||
dto.put("errorMessage", response.get("_error_message") );
|
dto.put("errorMessage", response.get("_error_message") );
|
||||||
dto.put("popupId", popupSeq);
|
dto.put("popupId", popupId);
|
||||||
|
|
||||||
resultVO.setResult(dto);
|
resultVO.setResult(dto);
|
||||||
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,12 @@ import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.data.jpa.repository.query.Procedure;
|
import org.springframework.data.jpa.repository.query.Procedure;
|
||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
public interface TnAttachFileRepository extends JpaRepository<TnAttachFile, Integer> {
|
public interface TnAttachFileRepository extends JpaRepository<TnAttachFile, Integer> {
|
||||||
|
|
||||||
Optional<List<TnAttachFile>> findByFileGrpId(String fileGrpId);
|
Optional<TnAttachFile> findByFileGrpId(String fileGrpId);
|
||||||
|
|
||||||
@Procedure("make_file_grp_id")
|
@Procedure("make_file_grp_id")
|
||||||
String makeFileGrpId( String modiId );
|
String makeFileGrpId( String modiId );
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,10 @@ import org.springframework.web.multipart.MultipartFile;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
|
|
@ -29,7 +32,7 @@ public class FileService {
|
||||||
if(tnAttachFile.getFileSeq()!=null){
|
if(tnAttachFile.getFileSeq()!=null){
|
||||||
tnAttachFile = tnAttachFileRepository.findById(tnAttachFile.getFileSeq()).orElse(null);
|
tnAttachFile = tnAttachFileRepository.findById(tnAttachFile.getFileSeq()).orElse(null);
|
||||||
}else{
|
}else{
|
||||||
tnAttachFile = Objects.requireNonNull(tnAttachFileRepository.findByFileGrpId(tnAttachFile.getFileGrpId()).orElse(null)).get(0);
|
tnAttachFile = tnAttachFileRepository.findByFileGrpId(tnAttachFile.getFileGrpId()).orElse(null);
|
||||||
}
|
}
|
||||||
int downCnt = tnAttachFile.getDownCnt()==null?0: tnAttachFile.getDownCnt();
|
int downCnt = tnAttachFile.getDownCnt()==null?0: tnAttachFile.getDownCnt();
|
||||||
tnAttachFile.setDownCnt(downCnt+1);
|
tnAttachFile.setDownCnt(downCnt+1);
|
||||||
|
|
@ -47,77 +50,50 @@ public class FileService {
|
||||||
* TN_ATTACH_FILE 참고.
|
* TN_ATTACH_FILE 참고.
|
||||||
* @param request
|
* @param request
|
||||||
* @param user
|
* @param user
|
||||||
* @param files
|
* @param file
|
||||||
* @param middlePath 파일이 저장될 중간 경로다.
|
* @param middlePath 파일이 저장될 중간 경로다.
|
||||||
* D:/kcscUploadFiles/XXXX/abc.jpg XXXX에 해당하는 경로다.
|
* D:/kcscUploadFiles/XXXX/abc.jpg XXXX에 해당하는 경로다.
|
||||||
* 참고로 D:/kcscUploadFiles 값은 application-xxx.properties에 있는 Globals.fileStorePath를 통해 얻는다.
|
* 참고로 D:/kcscUploadFiles 값은 application-xxx.properties에 있는 Globals.fileStorePath를 통해 얻는다.
|
||||||
* @return 파일 그룹 ID
|
* @return 파일 그룹 ID
|
||||||
* @throws Exception
|
* @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 {
|
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 ipAddress = NetworkUtil.getClientIpAddress(request);
|
||||||
|
|
||||||
|
String fileGrpId = null;
|
||||||
if( fileGrpId == null || fileGrpId.trim().isEmpty()) {
|
if( file != null && !file.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>();
|
Map<String, MultipartFile> filesMap = new HashMap<String, MultipartFile>();
|
||||||
filesMap.put("file", file);
|
filesMap.put("file", file);
|
||||||
|
|
||||||
List<FileVO> fileVoList = fileUtil.parseFileInf(filesMap, "", 0, middlePath, null);
|
//String fileGrpId = UUID.randomUUID().toString();
|
||||||
|
fileGrpId = tnAttachFileRepository.makeFileGrpId(user.getId());
|
||||||
|
|
||||||
|
List<FileVO> files = fileUtil.parseFileInf(filesMap, "", 0, middlePath, null);
|
||||||
|
|
||||||
int nCount = 1;
|
int nCount = 1;
|
||||||
// 업로드된 file을 tnAttachFile에 insert한다.
|
// 업로드된 file을 tnAttachFile에 insert한다.
|
||||||
for (Iterator<FileVO> iter = fileVoList.iterator(); iter.hasNext(); nCount++) {
|
for (Iterator<FileVO> iter = files.iterator(); iter.hasNext(); nCount++) {
|
||||||
|
|
||||||
FileVO item = iter.next();
|
FileVO item = iter.next();
|
||||||
|
|
||||||
tnAttachFileRepository.spAddTnAttachFile(
|
tnAttachFileRepository.spAddTnAttachFile(
|
||||||
fileGrpId,
|
fileGrpId,
|
||||||
nCount,
|
nCount,
|
||||||
item.getOrignlFileNm(),
|
item.getOrignlFileNm(),
|
||||||
item.getStreFileNm() + "." + item.getFileExtsn(),
|
item.getStreFileNm() + "." + item.getFileExtsn(),
|
||||||
(item.getFileStreCours() + File.separator + item.getAtchFileId()).replaceAll("\\\\", "/"),
|
(item.getFileStreCours() + File.separator + item.getAtchFileId()).replaceAll("\\\\", "/"),
|
||||||
Long.parseLong(item.getFileMg()),
|
Long.parseLong(item.getFileMg()),
|
||||||
item.getFileExtsn(),
|
item.getFileExtsn(),
|
||||||
ipAddress,
|
ipAddress,
|
||||||
user.getId(),
|
user.getId(),
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return fileGrpId;
|
return fileGrpId;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue