From faeec3f1d92889a2c6f339efef35e6494ff591f0 Mon Sep 17 00:00:00 2001 From: geun <1416geun@naver.com> Date: Mon, 6 Nov 2023 16:39:26 +0900 Subject: [PATCH 1/4] . --- src/views/statistics/FlightView.js | 126 ++++++++++++++++++++++++++++- 1 file changed, 124 insertions(+), 2 deletions(-) diff --git a/src/views/statistics/FlightView.js b/src/views/statistics/FlightView.js index 950ff29..536a4a2 100644 --- a/src/views/statistics/FlightView.js +++ b/src/views/statistics/FlightView.js @@ -7,17 +7,106 @@ import { Col, Row, Card, + CardHeader, + CardTitle, CardBody, FormGroup, Input, CustomInput, Label } from 'reactstrap'; -import { Search } from 'react-feather'; +import { Search, Calendar } from 'react-feather'; import { FcAlarmClock, FcWorkflow, FcBarChart } from 'react-icons/fc'; +import { Bar } from 'react-chartjs-2'; +import Flatpickr from 'react-flatpickr'; -export default function Flight() { +export default function Flight({ + tooltipShadow, + gridLineColor, + labelColor, + successColorShade +}) { const titleName = '비행 통계'; + const options = { + elements: { + rectangle: { + borderWidth: 2, + borderSkipped: 'bottom' + } + }, + responsive: true, + maintainAspectRatio: false, + responsiveAnimationDuration: 500, + legend: { + display: false + }, + tooltips: { + // Updated default tooltip UI + shadowOffsetX: 1, + shadowOffsetY: 1, + shadowBlur: 8, + shadowColor: tooltipShadow, + backgroundColor: '#fff', + titleFontColor: '#000', + bodyFontColor: '#000' + }, + scales: { + xAxes: [ + { + display: true, + gridLines: { + display: true, + color: gridLineColor, + zeroLineColor: gridLineColor + }, + scaleLabel: { + display: false + }, + ticks: { + fontColor: labelColor + } + } + ], + yAxes: [ + { + display: true, + gridLines: { + color: gridLineColor, + zeroLineColor: gridLineColor + }, + ticks: { + stepSize: 100, + min: 0, + max: 400, + fontColor: labelColor + } + } + ] + } + }, + data = { + labels: [ + '7/12', + '8/12', + '9/12', + '10/12', + '11/12', + '12/12', + '13/12', + '14/12', + '15/12', + '16/12', + '17/12' + ], + datasets: [ + { + data: [275, 90, 190, 205, 125, 85, 55, 87, 127, 150, 230, 280, 190], + backgroundColor: successColorShade, + borderColor: 'transparent', + barThickness: 15 + } + ] + }; return (
@@ -160,6 +249,39 @@ export default function Flight() {
+
+
+
+

비행시간 통계

+
+
+ + + 검색 + +
+
+ + + Latest Statistics +
+ + +
+
+ +
+ +
+
+
+
); From 906ad786275c42f180da78d7152cf3229f207c6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?junh=5Feee=28=EC=9D=B4=EC=A4=80=ED=9D=AC=29?= Date: Tue, 7 Nov 2023 13:48:51 +0900 Subject: [PATCH 2/4] =?UTF-8?q?laanc=20=EB=B9=84=ED=96=89=EA=B5=AC?= =?UTF-8?q?=EC=97=AD=20=EC=A2=8C=ED=91=9C=EC=A0=95=EB=B3=B4=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/laanc/map/FlightArea.js | 30 +++- src/components/laanc/map/LaancAreaMap.js | 149 +++++++++--------- src/components/laanc/map/LaancDrawControl.js | 2 + .../map/LaancDrawModal.js} | 2 +- 4 files changed, 106 insertions(+), 77 deletions(-) rename src/components/{map/mapbox/draw/LaancModal.js => laanc/map/LaancDrawModal.js} (93%) diff --git a/src/components/laanc/map/FlightArea.js b/src/components/laanc/map/FlightArea.js index b42e6e5..972564d 100644 --- a/src/components/laanc/map/FlightArea.js +++ b/src/components/laanc/map/FlightArea.js @@ -41,6 +41,7 @@ import { FeatureAirZone } from '../../map/mapbox/feature/FeatureAirZone'; import { WeatherContainer } from '../../../containers/basis/flight/plan/WeatherContainer'; import { initFlightBas } from '../../../modules/laanc/models/laancModels'; import * as LaancAction from '../../../modules/laanc/actions/laancActions'; +import LaancDrawModal from './LaancDrawModal'; const initialAddData = { isAddable: false, @@ -72,6 +73,12 @@ export default function FlightArea({ const [previewLayer, setPreviewLayer] = useState(); const [formModal, setFormModal] = useState(false); + const [modal, setModal] = useState({ + title: '', + desc: '', + isOpen: false + }); + const [isSaveable, setIsSaveable] = useState(false); const [addData, setAddData] = useState(initialAddData); @@ -169,8 +176,27 @@ export default function FlightArea({ }); }; + const handlerModal = () => { + setModal(!modal); + }; + const handlerDrawType = val => { - dispatch(drawTypeChangeAction(val)); + if (drawObj.getMode().includes('draw')) { + // alert('비행구역설정 완료 후 타입을 변경해주세요.'); + setModal({ + title: '비행 구역 설정', + desc: ( + <> + 비행구역 설정이 완료되지 않았습니다. +
+ 비행구역 설정 완료 후 타입 변경 부탁드립니다. + + ), + isOpen: true + }); + } else { + dispatch(drawTypeChangeAction(val)); + } }; const handlerSave = async () => { @@ -564,6 +590,7 @@ export default function FlightArea({ addData={addData} setSaveData={setSaveData} handlerSaveElev={handlerSaveElev} + setModal={setModal} /> @@ -657,6 +684,7 @@ export default function FlightArea({ ) : null} + {modal ? : null} state.controlMapReducer); @@ -57,11 +57,11 @@ export default function LaancAreaMap({ ); const [number, setNumber] = useState(0); - const [modal, setModal] = useState({ - title: '', - desc: '', - isOpen: false - }); + // const [modal, setModal] = useState({ + // title: '', + // desc: '', + // isOpen: false + // }); const [detailLayer, setDetailLayer] = useState(); @@ -315,9 +315,9 @@ export default function LaancAreaMap({ dispatch(AREA_COORDINATE_LIST_SAVE(areaList)); }; - const handlerModal = () => { - setModal(!modal); - }; + // const handlerModal = () => { + // setModal(!modal); + // }; return ( @@ -325,73 +325,72 @@ export default function LaancAreaMap({
- {mapObject && viewCoordObj.length > 0 ? ( -
- {/* {console.log(viewCoordObj, '----')} */} - {viewCoordObj?.map((obj, i) => { - let coord = - obj.properties.id === 'LINE' - ? obj.geometry.coordinates - : obj.geometry.coordinates[0]; - if (obj.properties.id === 'POLYGON') { - coord = coord.slice(0, coord.length - 1); - } else if (obj.properties.id === 'CIRCLE') { - coord = [obj.properties.center]; - } - - return ( -
{ - const allObj = drawObj - .getAll() - .features.filter(o => o.properties.id !== 'BUFFER'); - - drawObj.changeMode('direct_select', { - featureId: allObj[i].id - }); - }} - > -
비행구역 {i + 1}
-
- {coord?.map((co, idx) => { - if (idx % 2 === 0) { - const fCoord = FormattingCoord(co); - const current = fCoord.join(', '); - if (idx !== coord.length - 1) { - const next = FormattingCoord(coord[idx + 1]).join( - ', ' - ); - - return ( -
- - {current} - / - {next} - -
- ); - } else { - return ( -
- - {current} - -
- ); - } + {viewCoordObj?.map((obj, i) => { + let coord = + obj.properties.id === 'LINE' + ? obj.geometry.coordinates + : obj.geometry.coordinates[0]; + if (obj.properties.id === 'POLYGON') { + coord = coord.slice(0, coord.length - 1); + } else if (obj.properties.id === 'CIRCLE') { + coord = [obj.properties.center]; + } + + return ( +
{ + const allObj = drawObj + .getAll() + .features.filter(o => o.properties.id !== 'BUFFER'); + + drawObj.changeMode('direct_select', { + featureId: allObj[i].id + }); + }} + > +
+
비행구역 {i + 1}
+
+ {coord?.map((co, idx) => { + if (idx % 2 === 0) { + const fCoord = FormattingCoord(co); + const current = fCoord.join(', '); + if (idx !== coord.length - 1) { + const next = FormattingCoord(coord[idx + 1]).join( + ', ' + ); + + return ( +
+ + {current} + / + {next} + +
+ ); } else { - return null; + return ( +
+ + {current} + +
+ ); } - })} -
+ } else { + return null; + } + })}
- ); - })} -
- ) : null} +
+
+ ); + })}
+
- {modal ? ( + {/* {modal ? ( - ) : null} + ) : null} */} ) : null}
diff --git a/src/components/laanc/map/LaancDrawControl.js b/src/components/laanc/map/LaancDrawControl.js index ea6dddc..abba619 100644 --- a/src/components/laanc/map/LaancDrawControl.js +++ b/src/components/laanc/map/LaancDrawControl.js @@ -357,8 +357,10 @@ export const LaancDrawControl = props => { const remainObj = drawObj .getAll() .features.filter(o => o.properties.id !== 'BUFFER' && o.id !== id); + if (remainObj.length === 0) { props.handlerSaveCheck(false); + dispatch(drawTypeChangeAction('RESET')); } else { props.handlerSaveCheck(true); } diff --git a/src/components/map/mapbox/draw/LaancModal.js b/src/components/laanc/map/LaancDrawModal.js similarity index 93% rename from src/components/map/mapbox/draw/LaancModal.js rename to src/components/laanc/map/LaancDrawModal.js index c3761dc..c97c27d 100644 --- a/src/components/map/mapbox/draw/LaancModal.js +++ b/src/components/laanc/map/LaancDrawModal.js @@ -1,6 +1,6 @@ import { Button, Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap'; -export default function LaancModal({ modal, handler }) { +export default function LaancDrawModal({ modal, handler }) { const handlerDroneOneStop = () => { window.open('https://drone.onestop.go.kr/', '드론원스탑'); handler(); From 8cb76f6cdc695c4dc5c60ffe3d11f4c146082f60 Mon Sep 17 00:00:00 2001 From: geun <1416geun@naver.com> Date: Tue, 7 Nov 2023 14:30:17 +0900 Subject: [PATCH 3/4] =?UTF-8?q?=ED=86=B5=EA=B3=84=ED=99=94=EB=A9=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/css/custom.css | 5 + src/views/statistics/FlightView.js | 198 +++++++++++++++++++++++------ 2 files changed, 166 insertions(+), 37 deletions(-) diff --git a/src/assets/css/custom.css b/src/assets/css/custom.css index 8b26ba8..f4061b9 100644 --- a/src/assets/css/custom.css +++ b/src/assets/css/custom.css @@ -1131,3 +1131,8 @@ caption {overflow: hidden; line-height: 0;text-indent: -2000px;} background: #ffefec!important; border-color: #ffefec!important; box-shadow: -5px 0 0 #ffefec, 5px 0 0 #ffefec!important; } + +.statistics .chart-wrap .card {min-height:520px} +.statistics .card .card-title{font-size:1.125rem} +.statistics .select-date-wrap{padding-left:1rem;padding-right:1rem} +.statistics .select-date + .select-date{margin-left:0.5rem} \ No newline at end of file diff --git a/src/views/statistics/FlightView.js b/src/views/statistics/FlightView.js index 536a4a2..fc1d41e 100644 --- a/src/views/statistics/FlightView.js +++ b/src/views/statistics/FlightView.js @@ -15,16 +15,25 @@ import { CustomInput, Label } from 'reactstrap'; -import { Search, Calendar } from 'react-feather'; +import { + Search, + Calendar, + Monitor, + Tablet, + ArrowDown, + ArrowUp +} from 'react-feather'; import { FcAlarmClock, FcWorkflow, FcBarChart } from 'react-icons/fc'; -import { Bar } from 'react-chartjs-2'; +import { Bar, Doughnut, Polar } from 'react-chartjs-2'; import Flatpickr from 'react-flatpickr'; export default function Flight({ tooltipShadow, gridLineColor, labelColor, - successColorShade + successColorShade, + warningLightColor, + primary }) { const titleName = '비행 통계'; const options = { @@ -101,15 +110,79 @@ export default function Flight({ datasets: [ { data: [275, 90, 190, 205, 125, 85, 55, 87, 127, 150, 230, 280, 190], - backgroundColor: successColorShade, - borderColor: 'transparent', + backgroundColor: '#00bcd4', + borderColor: '#00bcd4', barThickness: 15 } ] }; + + const options2 = { + responsive: true, + maintainAspectRatio: true, + responsiveAnimationDuration: 500, + cutoutPercentage: 60, + legend: { + position: 'bottom', + labels: { + usePointStyle: true, + padding: 18, + boxWidth: 8, + fontColor: labelColor, + fontSize: 14, + fontWeight: 500, + fontFamily: ['Rubik', 'Montserrat', 'NotoSansKR'] + } + }, + tooltips: { + callbacks: { + label(tooltipItem, data) { + const label = data.datasets[0].labels[tooltipItem.index] || '', + value = data.datasets[0].data[tooltipItem.index]; + const output = ` ${label} : ${value} %`; + return output; + } + }, + shadowOffsetX: 1, + shadowOffsetY: 1, + shadowBlur: 8, + shadowColor: tooltipShadow, + backgroundColor: '#fff', + titleFontColor: '#000', + bodyFontColor: '#000' + } + }, + data2 = { + labels: ['PA0001', 'PA0002', 'PA0003', 'PA0004', 'PA0005'], + datasets: [ + { + labels: ['PA0001', 'PA0002', 'PA0003', 'PA0004', 'PA0005'], + data: [10, 20, 30, 40, 80], + //레드버전 + // backgroundColor: [ + // '#ffe8d1', + // '#ffb59e', + // '#f0826b', + // '#Bd4f38', + // '#8a1c05' + // ], + + backgroundColor: [ + '#ccffff', + '#99ffff', + '#66ffff', + '#33efff', + '#00bcd4' + ], + borderWidth: 0, + pointStyle: 'rectRounded' + } + ] + }; + return ( -
+
@@ -250,37 +323,88 @@ export default function Flight({
-
-
-

비행시간 통계

-
-
- - - 검색 - -
-
- - - Latest Statistics -
- - -
-
- -
- -
-
-
+ + + + + 비행 시간 통계 +
+ +
+ + + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ {/* + */} +
+
+ +
+ +
+
+
+ + + + + 비행시간 TOP5 + + +
+ +
+ {/*
+
+
*/} +
+
+ +
From 04f9988bb9aca0656ce62b955bd998242fd570b7 Mon Sep 17 00:00:00 2001 From: geun <1416geun@naver.com> Date: Tue, 7 Nov 2023 14:35:22 +0900 Subject: [PATCH 4/4] css --- src/assets/css/custom.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/assets/css/custom.css b/src/assets/css/custom.css index f4061b9..d9082c0 100644 --- a/src/assets/css/custom.css +++ b/src/assets/css/custom.css @@ -1118,7 +1118,7 @@ caption {overflow: hidden; line-height: 0;text-indent: -2000px;} .statistics-table tr th, .statistics-table tr td{vertical-align:middle;background:#fff;} .statistics-table tr + tr{border-top:1px solid #ddd} .statistics-table tr span{display:block;font-size:0.875rem} -.statistics-table tr th{background:#f4f4f4;text-align:center;padding:1rem 0.4rem;width:90px;border-right:1px solid #ddd} +.statistics-table tr th{background:#ddd;text-align:center;padding:1rem 0.4rem;width:90px;border-right:1px solid #ddd} .statistics-table tr th svg{font-size: 20px;margin-bottom:6px} .statistics-table tr th span{font-weight:500;line-height:1.3} .statistics-table tr td{padding:0.4rem 0.8rem}