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/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} /> ) : ( - //
그룹 목록에서 상세보기를 클릭하세요.