diff --git a/src/components/analysis/history/AnalysisHistorySearch.js b/src/components/analysis/history/AnalysisHistorySearch.js index e6a618d..dc4ba12 100644 --- a/src/components/analysis/history/AnalysisHistorySearch.js +++ b/src/components/analysis/history/AnalysisHistorySearch.js @@ -13,10 +13,8 @@ import { } from 'reactstrap'; export const AnalysisHistorySearch = props => { - useEffect(() => { if (props.isClick != -1) { - props.setParams({ ...props.params, stDate: moment().subtract(props.dateType, 'day').format('YYYY-MM-DD'), @@ -24,16 +22,14 @@ export const AnalysisHistorySearch = props => { groupId: props.searchData.groupId }); } - }, [props.dateType, props.isClick]); - return ( //
-
+

검색조건

@@ -61,7 +57,7 @@ export const AnalysisHistorySearch = props => {
{
*/} {props.stcsList?.map(item => { return ( -
{ - }, [playCount]); + useEffect(() => {}, [playCount]); return (
{/*
Default / Primary Color Slider
*/} {/* */} + { + // console.log(props.isMyGroup); return ( <>
@@ -34,6 +15,7 @@ export const BasisDronGrid = props => { color='primary' size='sm' onClick={props.handlerGroupCreate} + {...(props?.isMyGroup ? {} : { disabled: true })} > 기체등록 diff --git a/src/components/basis/flight/plan/FlightPlanGrid.js b/src/components/basis/flight/plan/FlightPlanGrid.js index 0418c36..aed58fa 100644 --- a/src/components/basis/flight/plan/FlightPlanGrid.js +++ b/src/components/basis/flight/plan/FlightPlanGrid.js @@ -5,7 +5,15 @@ import { Redirect } from 'react-router-dom'; import { Link, useHistory } from 'react-router-dom'; import { useSelector } from 'react-redux'; -const FlightPlanGrid = ({ movePage, planListData, pagination, paginationPerPage, paginationRowsPerPageOptions }) => { +const FlightPlanGrid = ({ + movePage, + planListData, + pagination, + paginationPerPage, + paginationRowsPerPageOptions, + isMyGroup, + user +}) => { const { loading } = useSelector(state => state.loadingReducer); const columns = [ { id: 'planSno', name: '번호', cell: (row, i) =>
{i + 1}
}, @@ -36,10 +44,28 @@ const FlightPlanGrid = ({ movePage, planListData, pagination, paginationPerPage, id: 'moveDetail', name: '상세보기', cell: row => { + let mine = false; + if (user.authId === 'SUPER') { + mine = true; + } else if (user.authId === 'ADMIN' || user.authId === 'USER') { + if (row.createUserId === user.userId) { + mine = true; + } + } + console.log(row.createUserId, user.userId); + return ( - - 상세보기 - + <> + {mine ? ( + <> + + 상세보기 + + + ) : ( + <>- + )} + ); } } @@ -57,7 +83,12 @@ const FlightPlanGrid = ({ movePage, planListData, pagination, paginationPerPage,
- + {/* 계획서 생성 */} 비행계획서 신청 @@ -82,7 +113,7 @@ const FlightPlanGrid = ({ movePage, planListData, pagination, paginationPerPage, pagination={pagination} paginationPerPage={paginationPerPage} paginationRowsPerPageOptions={paginationRowsPerPageOptions} - // pagination={props.pagination} + // pagination={props.pagination} /> {/* 검색된 데이터가 없습니다. */}
diff --git a/src/components/basis/flight/plan/FlightPlanGroupGrid.js b/src/components/basis/flight/plan/FlightPlanGroupGrid.js index 31e3dd1..466e8e2 100644 --- a/src/components/basis/flight/plan/FlightPlanGroupGrid.js +++ b/src/components/basis/flight/plan/FlightPlanGroupGrid.js @@ -9,7 +9,7 @@ const FlightPlanGroupGrid = ({ handlerGroupCancel, handleGroupSelect, paginationRowsPerPageOptions, - pagination, + pagination }) => { const columns = [ { diff --git a/src/components/basis/flight/plan/FlightPlanSearch.js b/src/components/basis/flight/plan/FlightPlanSearch.js index 533a60c..8b85067 100644 --- a/src/components/basis/flight/plan/FlightPlanSearch.js +++ b/src/components/basis/flight/plan/FlightPlanSearch.js @@ -1,172 +1,171 @@ -import React, {useState} from 'react'; -import {Button, Card, CardBody, Col, CustomInput, Row} from 'reactstrap'; -import {Search} from 'react-feather'; +import React, { useState } from 'react'; +import { Button, Card, CardBody, Col, CustomInput, Row } from 'reactstrap'; +import { Search } from 'react-feather'; import Flatpickr from 'react-flatpickr'; import moment from 'moment'; - -const FlightPlanSearch = ({searchData, handleChangeSearchData, handleSearch}) => { - - const {schFltStDt, schFltEndDt, aprvlYn} = searchData; - const initCheckState = { - 'all': aprvlYn == 'A', - 'yes': (aprvlYn == 'Y' || aprvlYn == 'A'), - 'no': (aprvlYn == 'N' || aprvlYn == 'A'), - } - const [checkState, setCheckState] = useState(initCheckState); - const handleClickSearch = (e) => { - handleSearch(searchData); - } - const handleChangeInput = (dates, value, config) => { - if (dates.length === 2) { - const schFltStDt = moment(dates[0]).format('YYYY-MM-DD HH:mm:ss'); - const schFltEndDt = moment(dates[1]).set({'h': 23, 'm': 59, 's': 59}).format('YYYY-MM-DD HH:mm:ss'); - handleChangeSearchData({schFltStDt, schFltEndDt}) - } +const FlightPlanSearch = ({ + searchData, + handleChangeSearchData, + handleSearch +}) => { + const { schFltStDt, schFltEndDt, aprvlYn } = searchData; + const initCheckState = { + all: aprvlYn == 'A', + yes: aprvlYn == 'Y' || aprvlYn == 'A', + no: aprvlYn == 'N' || aprvlYn == 'A' + }; + const [checkState, setCheckState] = useState(initCheckState); + const handleClickSearch = e => { + handleSearch(searchData); + }; + const handleChangeInput = (dates, value, config) => { + if (dates.length === 2) { + const schFltStDt = moment(dates[0]).format('YYYY-MM-DD HH:mm:ss'); + const schFltEndDt = moment(dates[1]) + .set({ h: 23, m: 59, s: 59 }) + .format('YYYY-MM-DD HH:mm:ss'); + handleChangeSearchData({ schFltStDt, schFltEndDt }); } - const handleChangeCheckbox = (e) => { - const {name, value, checked} = e.target; - let val; - switch (value) { - case 'A': - val = checked ? 'A' : ''; - handleChangeSearchData({[name]: val}) - setCheckState({ - 'all': checked, - 'yes': checked, - 'no': checked - }) - break; - case 'Y': - if (checked && checkState.no) val = 'A' - else if (checked && !checkState.no) val = 'Y' - else if (!checked && checkState.no) val = 'N' - else if (!checked && !checkState.no) val = '' - handleChangeSearchData({[name]: val}) - setCheckState(prevState => ({ - 'all': prevState.no && checked, - 'yes': checked, - 'no': prevState.no - })) - break; - case 'N': - if (checked && checkState.yes) val = 'A' - else if (checked && !checkState.yes) val = 'N' - else if (!checked && checkState.yes) val = 'Y' - else if (!checked && !checkState.yes) val = '' - handleChangeSearchData({[name]: val}) - setCheckState(prevState => ({ - 'all': prevState.yes && checked, - 'yes': prevState.yes, - 'no': checked - })) - break; - default: - break; - } + }; + const handleChangeCheckbox = e => { + const { name, value, checked } = e.target; + let val; + switch (value) { + case 'A': + val = checked ? 'A' : ''; + handleChangeSearchData({ [name]: val }); + setCheckState({ + all: checked, + yes: checked, + no: checked + }); + break; + case 'Y': + if (checked && checkState.no) val = 'A'; + else if (checked && !checkState.no) val = 'Y'; + else if (!checked && checkState.no) val = 'N'; + else if (!checked && !checkState.no) val = ''; + handleChangeSearchData({ [name]: val }); + setCheckState(prevState => ({ + all: prevState.no && checked, + yes: checked, + no: prevState.no + })); + break; + case 'N': + if (checked && checkState.yes) val = 'A'; + else if (checked && !checkState.yes) val = 'N'; + else if (!checked && checkState.yes) val = 'Y'; + else if (!checked && !checkState.yes) val = ''; + handleChangeSearchData({ [name]: val }); + setCheckState(prevState => ({ + all: prevState.yes && checked, + yes: prevState.yes, + no: checked + })); + break; + default: + break; } - return ( -
- - -
-
-

검색조건

-
-
- - - 검색 - -
-
- -
-
-
-
-
신청일
-
-
- - -
- -
- -
-
-
-
-
-
-
-
승인여부
-
-
- - - -
-
-
-
-
+ }; + return ( +
+ + +
+
+

검색조건

+
+
+ + + 검색 + +
+
+ +
+
+
+
+
신청일
+
+
+ + +
+
- - - -
-
- ) -} + + +
+
+
+ +
+
+
승인여부
+
+
+ + + +
+
+
+
+ +
+ + + +
+ ); +}; export default FlightPlanSearch; diff --git a/src/components/basis/flight/schedule/FlightScheduleGrid.js b/src/components/basis/flight/schedule/FlightScheduleGrid.js index aac29e6..26a96dd 100644 --- a/src/components/basis/flight/schedule/FlightScheduleGrid.js +++ b/src/components/basis/flight/schedule/FlightScheduleGrid.js @@ -95,7 +95,10 @@ function FlightScheduleGrid() { const endDate = moment(row.schFltEndDt); const startDate = moment(row.schFltStDt); - const hours = moment.duration(endDate.diff(startDate)).asHours(); + const hours = Math.floor( + moment.duration(endDate.diff(startDate)).asHours() + ); + const minute = moment.duration(endDate.diff(startDate)).asMinutes() % 60; @@ -129,9 +132,11 @@ function FlightScheduleGrid() { when: row => { if (row.statusCd !== 'S') { // 현재시간 - const currTime = timeRef.current.lastChild.data - .replace(/\:/g, '') - .substring(0, 4); + const currTime = + timeRef?.current?.lastChild?.data + .replace(/\:/g, '') + .substring(0, 4) || ''; + // 현재날짜 const currDay = Number(moment().format('YYYYMMDD')); diff --git a/src/containers/analysis/history/AnalysisHistoryContainer.js b/src/containers/analysis/history/AnalysisHistoryContainer.js index d4dbabc..2460a45 100644 --- a/src/containers/analysis/history/AnalysisHistoryContainer.js +++ b/src/containers/analysis/history/AnalysisHistoryContainer.js @@ -297,7 +297,7 @@ export const AnalysisHistoryContainer = props => { return ( {/*
*/} -
+
{/* { */} {/* */} - {user ? ( <> { const { list, count, detail, searchParams, log, stcsList, stcsCount } = useSelector(state => state.analysisSimulatorState); @@ -34,8 +37,6 @@ export const AnalysisSimulationContainer = props => { const [searchText, setSearchText] = useState(''); - let playCount = 0; - const [sliderVal, setSliderVal] = useState({ maxVal: 0, minVal: 0 @@ -59,7 +60,6 @@ export const AnalysisSimulationContainer = props => { } playCount++; - if (playCount == log.length) { playCount = 0; clearInterval(timer); @@ -76,7 +76,7 @@ export const AnalysisSimulationContainer = props => { setInfo({ ...log[playCount], playCount: playCount }); setIsPlay(false); } - }, [stcsList]) + }, [stcsList]); useEffect(() => { if (oepnReportList) { @@ -100,6 +100,11 @@ export const AnalysisSimulationContainer = props => { }, [sliderCount]); useEffect(() => { + playCount = 0; + if (log) { + setInfo({ ...log[playCount], playCount: 0 }); + } + // let arrDate = log?.map(date => { // const dateval = date.srvrRcvDt; // if (dateval) { diff --git a/src/containers/basis/dron/BasisDronContainer.js b/src/containers/basis/dron/BasisDronContainer.js index 3344bf9..707105b 100644 --- a/src/containers/basis/dron/BasisDronContainer.js +++ b/src/containers/basis/dron/BasisDronContainer.js @@ -2,11 +2,18 @@ import moment from 'moment'; import { useEffect, useState } from 'react'; import { shallowEqual, useDispatch, useSelector } from 'react-redux'; import { useHistory, Link } from 'react-router-dom'; -import { Button, Col, Row } from 'reactstrap'; +import { + Button, + Col, + Row, + Modal, + ModalHeader, + ModalBody, + ModalFooter +} from 'reactstrap'; import { BasisDronGrid } from '../../../components/basis/dron/BasisDronGrid'; import { BasisGroupDronGrid } from '../../../components/basis/dron/BasisGroupDronGrid'; import { CustomMainLayout } from '../../../components/layout/CustomMainLayout'; -// import { InfoModal } from '../../../components/modal/InfoModal'; import * as Actions from '../../../modules/basis/dron/actions/basisDronAction'; import * as GroupActions from '../../../modules/basis/group/actions/basisGroupAction'; import { GET_ARCTFT_TYPE_CD } from '../../../utility/CondeUtil'; @@ -30,43 +37,44 @@ export const BasisDronContainer = props => { desc: '' }); + const [isMyGroup, setIsMyGroup] = useState(); + const columns = [ { - name: '생성일시', - selector: row => row?.createDt, + name: '그룹명', + selector: row => row.groupNm, + minWidth: '102px', sortable: true, cell: row => { - return row?.createDt ? row.createDt : '-'; + return row?.groupNm; + // return selectData; } }, { - name: '가입일시', - selector: row => row?.joinDt, + name: '그룹 코드', + selector: row => row.groupId, + minWidth: '102px', sortable: true, cell: row => { - return row?.joinDt ? row.joinDt : '-'; + return row?.groupId; } }, { - name: '그룹명', - selector: row => row.groupNm, - minWidth: '102px', + name: '생성일시', + selector: row => row?.createDt, sortable: true, cell: row => { - return row?.groupNm; - // return selectData; + return row?.createDt ? row.createDt : '-'; } }, { - name: '그룹 코드', - selector: row => row.groupId, - minWidth: '102px', + name: '가입일시', + selector: row => row?.joinDt, sortable: true, cell: row => { - return row?.groupId; + return row?.joinDt ? row.joinDt : '-'; } }, - { name: '', // selector: 'cntrlStDate', @@ -144,11 +152,63 @@ export const BasisDronContainer = props => { // minWidth: '102px', sortable: true, cell: row => { - return 상세보기; + const [isHover, setIsHover] = useState(false); + const enter = () => { + setIsHover(true); + }; + const leave = () => { + setIsHover(false); + }; + + let mine = false; + if (user.authId === 'SUPER') { + mine = true; + } else if (user.authId === 'ADMIN' || user.authId === 'USER') { + if (row.createUserId === user.userId) { + mine = true; + } + } + + return ( + <> + {mine ? ( + <> + 상세보기 + + ) : ( + <> + {/* + 상세보기 + */} + - + + )} + + ); } } ]; + const handlerNotMine = () => { + setModal({ + isOpen: true, + title: '조회 불가', + desc: '사용자가 등록한 기체가 아닙니다.', + color: 'danger' + }); + return; + }; + useEffect(() => { handlerCancel(); // if (selectData) { @@ -193,26 +253,15 @@ export const BasisDronContainer = props => { }); dispatch(Actions.LIST.request({ groupId: groupId })); - // if ( - // // groupAuthCd === 'CREATER' || - // groupAuthCd === 'MASTER' || user.authId ==='SUPER' || - // // (aprvlYn === 'Y' && groupAuthCd === 'ADMIN') - // (aprvlYn === 'Y' && groupAuthCd === 'LEADER') - // ) { - // dispatch(Actions.SELECT({ groupId: groupId, groupNm: groupNm })); - // setParams({ - // ...params, - // groupId: groupId, - // groupNm: groupNm - // }); - // dispatch(Actions.LIST.request({ groupId: groupId })); - // } else { - // setModal({ - // isOpen: true, - // title: '권한 확인', - // desc: '기체정보 확인을 위해서는 운영자 권한이 필요합니다. 운영자에게 권한을 부여받고 다시 시도해 주세요.' - // }); - // } + let my = false; + if (user.authId === 'SUPER') { + my = true; + } else if (user.authId === 'ADMIN' || user.authId === 'USER') { + if (groupAuthCd) { + my = true; + } + } + setIsMyGroup(my); }; const handlerGroupCreate = () => { @@ -279,12 +328,35 @@ export const BasisDronContainer = props => { pagination={true} paginationPerPage={10} paginationRowsPerPageOptions={[10, 20, 30, 40]} + isMyGroup={isMyGroup} /> )}
- {/* */} +
+ setModal({ ...modal, isOpen: !modal.isOpen })} + modalClassName={'modal-' + `${modal.color}`} + className='modal-dialog-centered' + > + setModal({ ...modal, isOpen: !modal.isOpen })} + > + {modal.title} + + {modal.desc} + + {' '} + + +
); }; diff --git a/src/containers/basis/flight/plan/FlightPlanContainer.js b/src/containers/basis/flight/plan/FlightPlanContainer.js index 96e150d..5d0b399 100644 --- a/src/containers/basis/flight/plan/FlightPlanContainer.js +++ b/src/containers/basis/flight/plan/FlightPlanContainer.js @@ -39,9 +39,10 @@ const FlightPlanContainer = () => { state => state.groupState ); const { user } = useSelector(state => state.authState, shallowEqual); - const [params, setParams] = useState({}); + const [isMyGroup, setIsMyGroup] = useState(); + const moveFlightPlanDetailPage = () => { if (planDetailData) { dispatch(FlightAction.FLIGHT_PLAN_DETAIL_INIT()); @@ -91,6 +92,16 @@ const FlightPlanContainer = () => { }); dispatch(FlightAction.FLIGHT_PLAN_LIST.request(param)); + + let my = false; + if (user.authId === 'SUPER') { + my = true; + } else if (user.authId === 'ADMIN' || user.authId === 'USER') { + if (groupAuthCd) { + my = true; + } + } + setIsMyGroup(my); }; const handlerGroupCancel = () => { @@ -123,19 +134,8 @@ const FlightPlanContainer = () => { return ( - {/*
*/} -
+
- {/* - - */} - {/* */} {user ? ( <> @@ -156,9 +156,7 @@ const FlightPlanContainer = () => { ) : ( <> )} - - {/* */} {selectGroup.cstmrSno !== 0 ? ( <> @@ -173,12 +171,11 @@ const FlightPlanContainer = () => { pagination={true} paginationPerPage={10} paginationRowsPerPageOptions={[10, 20, 30, 40]} - // handlerPageChange={handlerPageChange} - // columns={columns} + isMyGroup={isMyGroup} + user={user} /> ) : ( - //
그룹 목록에서 상세보기를 클릭하세요.
diff --git a/src/containers/basis/group/BasisGroupUsersContainer.js b/src/containers/basis/group/BasisGroupUsersContainer.js index af6f2db..c82925a 100644 --- a/src/containers/basis/group/BasisGroupUsersContainer.js +++ b/src/containers/basis/group/BasisGroupUsersContainer.js @@ -313,30 +313,17 @@ export const BasisGroupUsersContainer = props => { }, [user]); const handlerDetail = (groupId, groupNm, groupAuthCd, aprvlYn) => { - if ( - user.authId === 'SUPER' || - user.authId === 'ADMIN' || - groupAuthCd === 'MASTER' || - (aprvlYn === 'Y' && groupAuthCd === 'LEADER') - ) { - dispatch(Actions.SELECT({ groupId: groupId, groupNm, groupNm })); - const param = params; - param.groupId = groupId; - param.memberNm = ''; + //권한 상관없이 조회 가능 + dispatch(Actions.SELECT({ groupId: groupId, groupNm, groupNm })); + const param = params; + param.groupId = groupId; + param.memberNm = ''; - dispatch( - Actions.USER_LIST.request({ - searchParams: param - }) - ); - } else { - setInfoModal({ - isOpen: true, - title: '권한 확인', - desc: '사용자관리 확인을 위해서는 운영자 권한이 필요합니다. 운영자에게 권한을 부여받고 다시 시도해 주세요.' - }); - return; - } + dispatch( + Actions.USER_LIST.request({ + searchParams: param + }) + ); }; const handlerCancel = () => {