Browse Source

드론 관제 -> 드론 클릭 풀리는 현상 및 코드 정리

pull/2/head
김장현 2 years ago
parent
commit
b9f01387f5
  1. 2
      src/containers/analysis/history/AnalysisHistoryContainer.js
  2. 42
      src/views/control/main/ControlMain.js
  3. 18
      src/views/control/report/ControlReportDetail.js

2
src/containers/analysis/history/AnalysisHistoryContainer.js

@ -91,7 +91,7 @@ export const AnalysisHistoryContainer = props => {
// const param = params; // const param = params;
// param.groupId = groupId; // param.groupId = groupId;
console.log(groupId);
dispatch(FlightAction.FLIGHT_PLAN_GROUP_SELECT({ groupId: groupId })); dispatch(FlightAction.FLIGHT_PLAN_GROUP_SELECT({ groupId: groupId }));
// groupId sessionStorage에 보관 (1 브라우저 1 tab에만 유효) // groupId sessionStorage에 보관 (1 브라우저 1 tab에만 유효)

42
src/views/control/main/ControlMain.js

@ -31,8 +31,8 @@ const ControlMain = () => {
const [alarm, setAlarm] = useState(false); const [alarm, setAlarm] = useState(false);
const [oepnReportList, setOpenReportList] = useState(false); const [oepnReportList, setOpenReportList] = useState(false);
const [openReportDetail, setOpenReportDetail] = useState(false); // const [openReportDetail, setOpenReportDetail] = useState(false);
const [openWeatherList, setOpenWeatherList] = useState(false); // const [openWeatherList, setOpenWeatherList] = useState(false);
const [openAlarmList, setOpenAlarmList] = useState(false); const [openAlarmList, setOpenAlarmList] = useState(false);
@ -41,29 +41,29 @@ const ControlMain = () => {
const openMenu = val => { const openMenu = val => {
if (val === 'reportList') { if (val === 'reportList') {
setOpenReportList(true); setOpenReportList(true);
setOpenReportDetail(false); // setOpenReportDetail(false);
setOpenWeatherList(false); // setOpenWeatherList(false);
setOpenAlarmList(false); setOpenAlarmList(false);
} else if (val === 'weatherList') { } else if (val === 'weatherList') {
setOpenReportList(false); setOpenReportList(false);
setOpenReportDetail(false); // setOpenReportDetail(false);
setOpenWeatherList(true); // setOpenWeatherList(true);
setOpenAlarmList(false); setOpenAlarmList(false);
} else if (val === 'alarmList') { } else if (val === 'alarmList') {
dispatch(objectUnClickAction()); dispatch(objectUnClickAction());
setOpenReportList(false); setOpenReportList(false);
setOpenReportDetail(false); // setOpenReportDetail(false);
setOpenWeatherList(false); // setOpenWeatherList(false);
setOpenAlarmList(true); setOpenAlarmList(true);
setAlarm(false); setAlarm(false);
} }
}; };
const openReportDetailParam = val => { // const openReportDetailParam = val => {
setOpenReportDetail(true); // setOpenReportDetail(true);
}; // };
const handlerLogout = () => { const handlerLogout = () => {
dispatch(Actions.logout.request()); dispatch(Actions.logout.request());
@ -81,6 +81,18 @@ const ControlMain = () => {
} }
}, [controlGpList]); }, [controlGpList]);
useEffect(() => {
if (isClickObject) {
setOpenReportList(false);
setOpenAlarmList(false);
}
}, [isClickObject]);
const handlerClose = () => {
setOpenReportList(true);
dispatch(objectUnClickAction());
};
return ( return (
<> <>
<ControlAlarmNotice /> <ControlAlarmNotice />
@ -131,22 +143,22 @@ const ControlMain = () => {
{oepnReportList ? ( {oepnReportList ? (
<ControlReportList <ControlReportList
openReportDetailParam={openReportDetailParam} // openReportDetailParam={openReportDetailParam}
setOpenReportList={setOpenReportList} setOpenReportList={setOpenReportList}
/> />
) : ( ) : (
<div /> <div />
)} )}
{isClickObject ? ( {isClickObject ? (
<ControlReportDetail setOpenReportDetail={setOpenReportDetail} /> <ControlReportDetail handlerClose={handlerClose} />
) : ( ) : (
<div /> <div />
)} )}
{openWeatherList ? ( {/* {openWeatherList ? (
<WeatherList setOpenWeatherList={setOpenWeatherList} /> <WeatherList setOpenWeatherList={setOpenWeatherList} />
) : ( ) : (
<div /> <div />
)} )} */}
{openAlarmList ? ( {openAlarmList ? (
<ControlAlarmList setOpenAlarmList={setOpenAlarmList} /> <ControlAlarmList setOpenAlarmList={setOpenAlarmList} />

18
src/views/control/report/ControlReportDetail.js

@ -11,7 +11,10 @@ import {
GET_ARCTFT_TYPE_CD, GET_ARCTFT_TYPE_CD,
GET_WGHT_TYPE_CD GET_WGHT_TYPE_CD
} from '../../../utility/CondeUtil'; } from '../../../utility/CondeUtil';
import { controlGpLogAction, controlweatherAction } from '../../../modules/control/gp'; import {
controlGpLogAction,
controlweatherAction
} from '../../../modules/control/gp';
import ControlAlarmDetail from '../alarm/ControlAlarmDetail'; import ControlAlarmDetail from '../alarm/ControlAlarmDetail';
import axios from '../../../modules/utils/customAxiosUtil'; import axios from '../../../modules/utils/customAxiosUtil';
import { import {
@ -35,7 +38,6 @@ const ControlReportDetail = props => {
//const { controlWheather } = useSelector(state => state.ControlGpWeatherState); //const { controlWheather } = useSelector(state => state.ControlGpWeatherState);
const { controlGpWarnLog } = useSelector(state => state.controlGpLogState); const { controlGpWarnLog } = useSelector(state => state.controlGpLogState);
function weathericon() { function weathericon() {
if (controlDetail) { if (controlDetail) {
let wheatherDetail = controlDetail.items.item; let wheatherDetail = controlDetail.items.item;
@ -58,10 +60,6 @@ const ControlReportDetail = props => {
} }
}, [historyModal]); }, [historyModal]);
const handlerClose = () => {
dispatch(objectUnClickAction());
};
const nullMessage = val => { const nullMessage = val => {
if (val) { if (val) {
return val; return val;
@ -78,7 +76,7 @@ const ControlReportDetail = props => {
className='btn-icon' className='btn-icon'
color='primary' color='primary'
// onClick={() => props.setOpenReportDetail(false)} // onClick={() => props.setOpenReportDetail(false)}
onClick={() => handlerClose()} onClick={() => props.handlerClose()}
> >
<X size={20} /> <X size={20} />
</button> </button>
@ -290,7 +288,9 @@ const ControlReportDetail = props => {
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td>{controlDetail?.items.item[0].baseTime.substring(0, 2)}</td> <td>
{controlDetail?.items.item[0].baseTime.substring(0, 2)}
</td>
<td>{weathericon()}</td> <td>{weathericon()}</td>
<td>{controlDetail?.items.item[12].fcstValue}</td> <td>{controlDetail?.items.item[12].fcstValue}</td>
<td> <td>
@ -313,7 +313,7 @@ const ControlReportDetail = props => {
setHistoryModal={setHistoryModal} setHistoryModal={setHistoryModal}
controlGpWarnLog={controlGpWarnLog} controlGpWarnLog={controlGpWarnLog}
/> />
</div > </div>
); );
}; };

Loading…
Cancel
Save