Compare commits
23 Commits
2263b190f5
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 8f1b0d287b | |||
| a9dce184ae | |||
| 2f61297bea | |||
| fd4e374add | |||
| 736645ac18 | |||
| 1d681316a7 | |||
| 91fd8a3457 | |||
| 9bf683e9c9 | |||
| c2bf8adbec | |||
| 93d9bc648f | |||
| ac60263a6c | |||
| ce924ddf66 | |||
| f342bc7648 | |||
| f318cba0b3 | |||
| 60583074bf | |||
| 2b887270b9 | |||
| 46c5236731 | |||
| 2d30219a49 | |||
| 54eebdfd15 | |||
| 4710b24ef3 | |||
| 6b527bc316 | |||
| 98500d14ff | |||
| c611b2a2dc |
BIN
2026年8月工作月度报告-葛昀.docx
Normal file
BIN
2026年8月工作月度报告-葛昀.docx
Normal file
Binary file not shown.
12
env.js
12
env.js
@@ -9,21 +9,15 @@ const currentEnv = import.meta.env?.MODE || process.env.NODE_ENV;
|
||||
// 环境配置映射
|
||||
const envConfig = {
|
||||
[ENV.DEV]: {
|
||||
//baseURL: 'http://1.95.137.212:8081',//http://192.168.2.56:8081
|
||||
baseURL: 'http://1.95.137.212:59003',//http://192.168.2.56:8081
|
||||
|
||||
//baseURL: 'http://192.168.2.59:8081',//http://192.168.2.56:8081
|
||||
////baseURL: 'http://1.95.137.212:59015',//http://192.168.2.56:8081
|
||||
//WS_URL: 'ws://192.168.2.59:9002/ws/',
|
||||
//mqtt_url: "ws://1.95.137.212:8083/mqtt",
|
||||
//geoserver_url: "http://192.168.2.59:7000/geoserver"
|
||||
|
||||
//baseURL: 'http://1.95.137.212:8081',//http://192.168.2.56:8081
|
||||
//baseURL: 'http://192.168.2.62:8081',//http://192.168.2.56:8081
|
||||
WS_URL: 'ws://1.95.137.212:59005/ws/',
|
||||
|
||||
baseURL: 'http://1.95.137.212:8081',//http://192.168.2.56:8081
|
||||
//baseURL: 'https://serviceri.satabot.com',
|
||||
//WS_URL: 'ws://1.95.137.212:9002/ws/',
|
||||
//WS_URL: 'ws://192.168.2.62:9002/ws/',
|
||||
WS_URL: 'ws://1.95.137.212:9002/ws/',
|
||||
mqtt_url: "ws://1.95.137.212:8083/mqtt",
|
||||
geoserver_url: "http://1.95.137.212:7900/geoserver"
|
||||
|
||||
|
||||
10
index.html
10
index.html
@@ -14,13 +14,9 @@
|
||||
<link rel="dns-prefetch" href="https://lf-unpkg.volccdn.com">
|
||||
|
||||
<!-- CSS 异步加载,不阻塞页面渲染 -->
|
||||
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" media="print"
|
||||
onload="this.media='all'">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/cesium@latest/Build/Cesium/Widgets/widgets.css"
|
||||
media="print" onload="this.media='all'">
|
||||
<link rel="stylesheet"
|
||||
href="https://lf-unpkg.volccdn.com/obj/vcloudfe/sdk/@volcengine/veplayer/2.11.2/umd/veplayer.production.css"
|
||||
media="print" onload="this.media='all'">
|
||||
<link rel="stylesheet" href="/css/leaflet.css" media="print" onload="this.media='all'">
|
||||
<link rel="stylesheet" href="/css/widgets.css" media="print" onload="this.media='all'">
|
||||
<link rel="stylesheet" href="/css/veplayer.css" media="print" onload="this.media='all'">
|
||||
<script src="/js/jswebrtc.min.js"></script>
|
||||
<script src="/js/cesium.js"></script>
|
||||
|
||||
|
||||
661
public/css/leaflet.css
Normal file
661
public/css/leaflet.css
Normal file
@@ -0,0 +1,661 @@
|
||||
/* required styles */
|
||||
|
||||
.leaflet-pane,
|
||||
.leaflet-tile,
|
||||
.leaflet-marker-icon,
|
||||
.leaflet-marker-shadow,
|
||||
.leaflet-tile-container,
|
||||
.leaflet-pane > svg,
|
||||
.leaflet-pane > canvas,
|
||||
.leaflet-zoom-box,
|
||||
.leaflet-image-layer,
|
||||
.leaflet-layer {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
.leaflet-container {
|
||||
overflow: hidden;
|
||||
}
|
||||
.leaflet-tile,
|
||||
.leaflet-marker-icon,
|
||||
.leaflet-marker-shadow {
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
user-select: none;
|
||||
-webkit-user-drag: none;
|
||||
}
|
||||
/* Prevents IE11 from highlighting tiles in blue */
|
||||
.leaflet-tile::selection {
|
||||
background: transparent;
|
||||
}
|
||||
/* Safari renders non-retina tile on retina better with this, but Chrome is worse */
|
||||
.leaflet-safari .leaflet-tile {
|
||||
image-rendering: -webkit-optimize-contrast;
|
||||
}
|
||||
/* hack that prevents hw layers "stretching" when loading new tiles */
|
||||
.leaflet-safari .leaflet-tile-container {
|
||||
width: 1600px;
|
||||
height: 1600px;
|
||||
-webkit-transform-origin: 0 0;
|
||||
}
|
||||
.leaflet-marker-icon,
|
||||
.leaflet-marker-shadow {
|
||||
display: block;
|
||||
}
|
||||
/* .leaflet-container svg: reset svg max-width decleration shipped in Joomla! (joomla.org) 3.x */
|
||||
/* .leaflet-container img: map is broken in FF if you have max-width: 100% on tiles */
|
||||
.leaflet-container .leaflet-overlay-pane svg {
|
||||
max-width: none !important;
|
||||
max-height: none !important;
|
||||
}
|
||||
.leaflet-container .leaflet-marker-pane img,
|
||||
.leaflet-container .leaflet-shadow-pane img,
|
||||
.leaflet-container .leaflet-tile-pane img,
|
||||
.leaflet-container img.leaflet-image-layer,
|
||||
.leaflet-container .leaflet-tile {
|
||||
max-width: none !important;
|
||||
max-height: none !important;
|
||||
width: auto;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.leaflet-container img.leaflet-tile {
|
||||
/* See: https://bugs.chromium.org/p/chromium/issues/detail?id=600120 */
|
||||
mix-blend-mode: plus-lighter;
|
||||
}
|
||||
|
||||
.leaflet-container.leaflet-touch-zoom {
|
||||
-ms-touch-action: pan-x pan-y;
|
||||
touch-action: pan-x pan-y;
|
||||
}
|
||||
.leaflet-container.leaflet-touch-drag {
|
||||
-ms-touch-action: pinch-zoom;
|
||||
/* Fallback for FF which doesn't support pinch-zoom */
|
||||
touch-action: none;
|
||||
touch-action: pinch-zoom;
|
||||
}
|
||||
.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom {
|
||||
-ms-touch-action: none;
|
||||
touch-action: none;
|
||||
}
|
||||
.leaflet-container {
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
}
|
||||
.leaflet-container a {
|
||||
-webkit-tap-highlight-color: rgba(51, 181, 229, 0.4);
|
||||
}
|
||||
.leaflet-tile {
|
||||
filter: inherit;
|
||||
visibility: hidden;
|
||||
}
|
||||
.leaflet-tile-loaded {
|
||||
visibility: inherit;
|
||||
}
|
||||
.leaflet-zoom-box {
|
||||
width: 0;
|
||||
height: 0;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
z-index: 800;
|
||||
}
|
||||
/* workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=888319 */
|
||||
.leaflet-overlay-pane svg {
|
||||
-moz-user-select: none;
|
||||
}
|
||||
|
||||
.leaflet-pane { z-index: 400; }
|
||||
|
||||
.leaflet-tile-pane { z-index: 200; }
|
||||
.leaflet-overlay-pane { z-index: 400; }
|
||||
.leaflet-shadow-pane { z-index: 500; }
|
||||
.leaflet-marker-pane { z-index: 600; }
|
||||
.leaflet-tooltip-pane { z-index: 650; }
|
||||
.leaflet-popup-pane { z-index: 700; }
|
||||
|
||||
.leaflet-map-pane canvas { z-index: 100; }
|
||||
.leaflet-map-pane svg { z-index: 200; }
|
||||
|
||||
.leaflet-vml-shape {
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
}
|
||||
.lvml {
|
||||
behavior: url(#default#VML);
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
|
||||
/* control positioning */
|
||||
|
||||
.leaflet-control {
|
||||
position: relative;
|
||||
z-index: 800;
|
||||
pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */
|
||||
pointer-events: auto;
|
||||
}
|
||||
.leaflet-top,
|
||||
.leaflet-bottom {
|
||||
position: absolute;
|
||||
z-index: 1000;
|
||||
pointer-events: none;
|
||||
}
|
||||
.leaflet-top {
|
||||
top: 0;
|
||||
}
|
||||
.leaflet-right {
|
||||
right: 0;
|
||||
}
|
||||
.leaflet-bottom {
|
||||
bottom: 0;
|
||||
}
|
||||
.leaflet-left {
|
||||
left: 0;
|
||||
}
|
||||
.leaflet-control {
|
||||
float: left;
|
||||
clear: both;
|
||||
}
|
||||
.leaflet-right .leaflet-control {
|
||||
float: right;
|
||||
}
|
||||
.leaflet-top .leaflet-control {
|
||||
margin-top: 10px;
|
||||
}
|
||||
.leaflet-bottom .leaflet-control {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.leaflet-left .leaflet-control {
|
||||
margin-left: 10px;
|
||||
}
|
||||
.leaflet-right .leaflet-control {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
|
||||
/* zoom and fade animations */
|
||||
|
||||
.leaflet-fade-anim .leaflet-popup {
|
||||
opacity: 0;
|
||||
-webkit-transition: opacity 0.2s linear;
|
||||
-moz-transition: opacity 0.2s linear;
|
||||
transition: opacity 0.2s linear;
|
||||
}
|
||||
.leaflet-fade-anim .leaflet-map-pane .leaflet-popup {
|
||||
opacity: 1;
|
||||
}
|
||||
.leaflet-zoom-animated {
|
||||
-webkit-transform-origin: 0 0;
|
||||
-ms-transform-origin: 0 0;
|
||||
transform-origin: 0 0;
|
||||
}
|
||||
svg.leaflet-zoom-animated {
|
||||
will-change: transform;
|
||||
}
|
||||
|
||||
.leaflet-zoom-anim .leaflet-zoom-animated {
|
||||
-webkit-transition: -webkit-transform 0.25s cubic-bezier(0,0,0.25,1);
|
||||
-moz-transition: -moz-transform 0.25s cubic-bezier(0,0,0.25,1);
|
||||
transition: transform 0.25s cubic-bezier(0,0,0.25,1);
|
||||
}
|
||||
.leaflet-zoom-anim .leaflet-tile,
|
||||
.leaflet-pan-anim .leaflet-tile {
|
||||
-webkit-transition: none;
|
||||
-moz-transition: none;
|
||||
transition: none;
|
||||
}
|
||||
|
||||
.leaflet-zoom-anim .leaflet-zoom-hide {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
|
||||
/* cursors */
|
||||
|
||||
.leaflet-interactive {
|
||||
cursor: pointer;
|
||||
}
|
||||
.leaflet-grab {
|
||||
cursor: -webkit-grab;
|
||||
cursor: -moz-grab;
|
||||
cursor: grab;
|
||||
}
|
||||
.leaflet-crosshair,
|
||||
.leaflet-crosshair .leaflet-interactive {
|
||||
cursor: crosshair;
|
||||
}
|
||||
.leaflet-popup-pane,
|
||||
.leaflet-control {
|
||||
cursor: auto;
|
||||
}
|
||||
.leaflet-dragging .leaflet-grab,
|
||||
.leaflet-dragging .leaflet-grab .leaflet-interactive,
|
||||
.leaflet-dragging .leaflet-marker-draggable {
|
||||
cursor: move;
|
||||
cursor: -webkit-grabbing;
|
||||
cursor: -moz-grabbing;
|
||||
cursor: grabbing;
|
||||
}
|
||||
|
||||
/* marker & overlays interactivity */
|
||||
.leaflet-marker-icon,
|
||||
.leaflet-marker-shadow,
|
||||
.leaflet-image-layer,
|
||||
.leaflet-pane > svg path,
|
||||
.leaflet-tile-container {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.leaflet-marker-icon.leaflet-interactive,
|
||||
.leaflet-image-layer.leaflet-interactive,
|
||||
.leaflet-pane > svg path.leaflet-interactive,
|
||||
svg.leaflet-image-layer.leaflet-interactive path {
|
||||
pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
/* visual tweaks */
|
||||
|
||||
.leaflet-container {
|
||||
background: #ddd;
|
||||
outline-offset: 1px;
|
||||
}
|
||||
.leaflet-container a {
|
||||
color: #0078A8;
|
||||
}
|
||||
.leaflet-zoom-box {
|
||||
border: 2px dotted #38f;
|
||||
background: rgba(255,255,255,0.5);
|
||||
}
|
||||
|
||||
|
||||
/* general typography */
|
||||
.leaflet-container {
|
||||
font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
|
||||
font-size: 12px;
|
||||
font-size: 0.75rem;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
|
||||
/* general toolbar styles */
|
||||
|
||||
.leaflet-bar {
|
||||
box-shadow: 0 1px 5px rgba(0,0,0,0.65);
|
||||
border-radius: 4px;
|
||||
}
|
||||
.leaflet-bar a {
|
||||
background-color: #fff;
|
||||
border-bottom: 1px solid #ccc;
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
line-height: 26px;
|
||||
display: block;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
color: black;
|
||||
}
|
||||
.leaflet-bar a,
|
||||
.leaflet-control-layers-toggle {
|
||||
background-position: 50% 50%;
|
||||
background-repeat: no-repeat;
|
||||
display: block;
|
||||
}
|
||||
.leaflet-bar a:hover,
|
||||
.leaflet-bar a:focus {
|
||||
background-color: #f4f4f4;
|
||||
}
|
||||
.leaflet-bar a:first-child {
|
||||
border-top-left-radius: 4px;
|
||||
border-top-right-radius: 4px;
|
||||
}
|
||||
.leaflet-bar a:last-child {
|
||||
border-bottom-left-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
border-bottom: none;
|
||||
}
|
||||
.leaflet-bar a.leaflet-disabled {
|
||||
cursor: default;
|
||||
background-color: #f4f4f4;
|
||||
color: #bbb;
|
||||
}
|
||||
|
||||
.leaflet-touch .leaflet-bar a {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
}
|
||||
.leaflet-touch .leaflet-bar a:first-child {
|
||||
border-top-left-radius: 2px;
|
||||
border-top-right-radius: 2px;
|
||||
}
|
||||
.leaflet-touch .leaflet-bar a:last-child {
|
||||
border-bottom-left-radius: 2px;
|
||||
border-bottom-right-radius: 2px;
|
||||
}
|
||||
|
||||
/* zoom control */
|
||||
|
||||
.leaflet-control-zoom-in,
|
||||
.leaflet-control-zoom-out {
|
||||
font: bold 18px 'Lucida Console', Monaco, monospace;
|
||||
text-indent: 1px;
|
||||
}
|
||||
|
||||
.leaflet-touch .leaflet-control-zoom-in, .leaflet-touch .leaflet-control-zoom-out {
|
||||
font-size: 22px;
|
||||
}
|
||||
|
||||
|
||||
/* layers control */
|
||||
|
||||
.leaflet-control-layers {
|
||||
box-shadow: 0 1px 5px rgba(0,0,0,0.4);
|
||||
background: #fff;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.leaflet-control-layers-toggle {
|
||||
background-image: url(images/layers.png);
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
}
|
||||
.leaflet-retina .leaflet-control-layers-toggle {
|
||||
background-image: url(images/layers-2x.png);
|
||||
background-size: 26px 26px;
|
||||
}
|
||||
.leaflet-touch .leaflet-control-layers-toggle {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
}
|
||||
.leaflet-control-layers .leaflet-control-layers-list,
|
||||
.leaflet-control-layers-expanded .leaflet-control-layers-toggle {
|
||||
display: none;
|
||||
}
|
||||
.leaflet-control-layers-expanded .leaflet-control-layers-list {
|
||||
display: block;
|
||||
position: relative;
|
||||
}
|
||||
.leaflet-control-layers-expanded {
|
||||
padding: 6px 10px 6px 6px;
|
||||
color: #333;
|
||||
background: #fff;
|
||||
}
|
||||
.leaflet-control-layers-scrollbar {
|
||||
overflow-y: scroll;
|
||||
overflow-x: hidden;
|
||||
padding-right: 5px;
|
||||
}
|
||||
.leaflet-control-layers-selector {
|
||||
margin-top: 2px;
|
||||
position: relative;
|
||||
top: 1px;
|
||||
}
|
||||
.leaflet-control-layers label {
|
||||
display: block;
|
||||
font-size: 13px;
|
||||
font-size: 1.08333em;
|
||||
}
|
||||
.leaflet-control-layers-separator {
|
||||
height: 0;
|
||||
border-top: 1px solid #ddd;
|
||||
margin: 5px -10px 5px -6px;
|
||||
}
|
||||
|
||||
/* Default icon URLs */
|
||||
.leaflet-default-icon-path { /* used only in path-guessing heuristic, see L.Icon.Default */
|
||||
background-image: url(images/marker-icon.png);
|
||||
}
|
||||
|
||||
|
||||
/* attribution and scale controls */
|
||||
|
||||
.leaflet-container .leaflet-control-attribution {
|
||||
background: #fff;
|
||||
background: rgba(255, 255, 255, 0.8);
|
||||
margin: 0;
|
||||
}
|
||||
.leaflet-control-attribution,
|
||||
.leaflet-control-scale-line {
|
||||
padding: 0 5px;
|
||||
color: #333;
|
||||
line-height: 1.4;
|
||||
}
|
||||
.leaflet-control-attribution a {
|
||||
text-decoration: none;
|
||||
}
|
||||
.leaflet-control-attribution a:hover,
|
||||
.leaflet-control-attribution a:focus {
|
||||
text-decoration: underline;
|
||||
}
|
||||
.leaflet-attribution-flag {
|
||||
display: inline !important;
|
||||
vertical-align: baseline !important;
|
||||
width: 1em;
|
||||
height: 0.6669em;
|
||||
}
|
||||
.leaflet-left .leaflet-control-scale {
|
||||
margin-left: 5px;
|
||||
}
|
||||
.leaflet-bottom .leaflet-control-scale {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.leaflet-control-scale-line {
|
||||
border: 2px solid #777;
|
||||
border-top: none;
|
||||
line-height: 1.1;
|
||||
padding: 2px 5px 1px;
|
||||
white-space: nowrap;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
background: rgba(255, 255, 255, 0.8);
|
||||
text-shadow: 1px 1px #fff;
|
||||
}
|
||||
.leaflet-control-scale-line:not(:first-child) {
|
||||
border-top: 2px solid #777;
|
||||
border-bottom: none;
|
||||
margin-top: -2px;
|
||||
}
|
||||
.leaflet-control-scale-line:not(:first-child):not(:last-child) {
|
||||
border-bottom: 2px solid #777;
|
||||
}
|
||||
|
||||
.leaflet-touch .leaflet-control-attribution,
|
||||
.leaflet-touch .leaflet-control-layers,
|
||||
.leaflet-touch .leaflet-bar {
|
||||
box-shadow: none;
|
||||
}
|
||||
.leaflet-touch .leaflet-control-layers,
|
||||
.leaflet-touch .leaflet-bar {
|
||||
border: 2px solid rgba(0,0,0,0.2);
|
||||
background-clip: padding-box;
|
||||
}
|
||||
|
||||
|
||||
/* popup */
|
||||
|
||||
.leaflet-popup {
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.leaflet-popup-content-wrapper {
|
||||
padding: 1px;
|
||||
text-align: left;
|
||||
border-radius: 12px;
|
||||
}
|
||||
.leaflet-popup-content {
|
||||
margin: 13px 24px 13px 20px;
|
||||
line-height: 1.3;
|
||||
font-size: 13px;
|
||||
font-size: 1.08333em;
|
||||
min-height: 1px;
|
||||
}
|
||||
.leaflet-popup-content p {
|
||||
margin: 17px 0;
|
||||
margin: 1.3em 0;
|
||||
}
|
||||
.leaflet-popup-tip-container {
|
||||
width: 40px;
|
||||
height: 20px;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
margin-top: -1px;
|
||||
margin-left: -20px;
|
||||
overflow: hidden;
|
||||
pointer-events: none;
|
||||
}
|
||||
.leaflet-popup-tip {
|
||||
width: 17px;
|
||||
height: 17px;
|
||||
padding: 1px;
|
||||
|
||||
margin: -10px auto 0;
|
||||
pointer-events: auto;
|
||||
|
||||
-webkit-transform: rotate(45deg);
|
||||
-moz-transform: rotate(45deg);
|
||||
-ms-transform: rotate(45deg);
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
.leaflet-popup-content-wrapper,
|
||||
.leaflet-popup-tip {
|
||||
background: white;
|
||||
color: #333;
|
||||
box-shadow: 0 3px 14px rgba(0,0,0,0.4);
|
||||
}
|
||||
.leaflet-container a.leaflet-popup-close-button {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
border: none;
|
||||
text-align: center;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
font: 16px/24px Tahoma, Verdana, sans-serif;
|
||||
color: #757575;
|
||||
text-decoration: none;
|
||||
background: transparent;
|
||||
}
|
||||
.leaflet-container a.leaflet-popup-close-button:hover,
|
||||
.leaflet-container a.leaflet-popup-close-button:focus {
|
||||
color: #585858;
|
||||
}
|
||||
.leaflet-popup-scrolled {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.leaflet-oldie .leaflet-popup-content-wrapper {
|
||||
-ms-zoom: 1;
|
||||
}
|
||||
.leaflet-oldie .leaflet-popup-tip {
|
||||
width: 24px;
|
||||
margin: 0 auto;
|
||||
|
||||
-ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";
|
||||
filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678);
|
||||
}
|
||||
|
||||
.leaflet-oldie .leaflet-control-zoom,
|
||||
.leaflet-oldie .leaflet-control-layers,
|
||||
.leaflet-oldie .leaflet-popup-content-wrapper,
|
||||
.leaflet-oldie .leaflet-popup-tip {
|
||||
border: 1px solid #999;
|
||||
}
|
||||
|
||||
|
||||
/* div icon */
|
||||
|
||||
.leaflet-div-icon {
|
||||
background: #fff;
|
||||
border: 1px solid #666;
|
||||
}
|
||||
|
||||
|
||||
/* Tooltip */
|
||||
/* Base styles for the element that has a tooltip */
|
||||
.leaflet-tooltip {
|
||||
position: absolute;
|
||||
padding: 6px;
|
||||
background-color: #fff;
|
||||
border: 1px solid #fff;
|
||||
border-radius: 3px;
|
||||
color: #222;
|
||||
white-space: nowrap;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
pointer-events: none;
|
||||
box-shadow: 0 1px 3px rgba(0,0,0,0.4);
|
||||
}
|
||||
.leaflet-tooltip.leaflet-interactive {
|
||||
cursor: pointer;
|
||||
pointer-events: auto;
|
||||
}
|
||||
.leaflet-tooltip-top:before,
|
||||
.leaflet-tooltip-bottom:before,
|
||||
.leaflet-tooltip-left:before,
|
||||
.leaflet-tooltip-right:before {
|
||||
position: absolute;
|
||||
pointer-events: none;
|
||||
border: 6px solid transparent;
|
||||
background: transparent;
|
||||
content: "";
|
||||
}
|
||||
|
||||
/* Directions */
|
||||
|
||||
.leaflet-tooltip-bottom {
|
||||
margin-top: 6px;
|
||||
}
|
||||
.leaflet-tooltip-top {
|
||||
margin-top: -6px;
|
||||
}
|
||||
.leaflet-tooltip-bottom:before,
|
||||
.leaflet-tooltip-top:before {
|
||||
left: 50%;
|
||||
margin-left: -6px;
|
||||
}
|
||||
.leaflet-tooltip-top:before {
|
||||
bottom: 0;
|
||||
margin-bottom: -12px;
|
||||
border-top-color: #fff;
|
||||
}
|
||||
.leaflet-tooltip-bottom:before {
|
||||
top: 0;
|
||||
margin-top: -12px;
|
||||
margin-left: -6px;
|
||||
border-bottom-color: #fff;
|
||||
}
|
||||
.leaflet-tooltip-left {
|
||||
margin-left: -6px;
|
||||
}
|
||||
.leaflet-tooltip-right {
|
||||
margin-left: 6px;
|
||||
}
|
||||
.leaflet-tooltip-left:before,
|
||||
.leaflet-tooltip-right:before {
|
||||
top: 50%;
|
||||
margin-top: -6px;
|
||||
}
|
||||
.leaflet-tooltip-left:before {
|
||||
right: 0;
|
||||
margin-right: -12px;
|
||||
border-left-color: #fff;
|
||||
}
|
||||
.leaflet-tooltip-right:before {
|
||||
left: 0;
|
||||
margin-left: -12px;
|
||||
border-right-color: #fff;
|
||||
}
|
||||
|
||||
/* Printing */
|
||||
|
||||
@media print {
|
||||
/* Prevent printers from removing background-images of controls. */
|
||||
.leaflet-control {
|
||||
-webkit-print-color-adjust: exact;
|
||||
print-color-adjust: exact;
|
||||
}
|
||||
}
|
||||
1
public/css/veplayer.css
Normal file
1
public/css/veplayer.css
Normal file
File diff suppressed because one or more lines are too long
1342
public/css/widgets.css
Normal file
1342
public/css/widgets.css
Normal file
File diff suppressed because it is too large
Load Diff
@@ -61,4 +61,3 @@ export default function App() {
|
||||
</I18nextProvider>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -455,15 +455,6 @@ export function hasPermission(params) {
|
||||
})
|
||||
}
|
||||
|
||||
///iot/workRecord/getTaskPath?taskId=74 get 获取算法回传的路径
|
||||
export function getTaskPath(params) {
|
||||
return request({
|
||||
url: '/iot/workRecord/getTaskPath',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
9
src/api/machine.ts
Normal file
9
src/api/machine.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import request from './request';
|
||||
|
||||
export function getDeviceRunningHistoryStatistics(data) {
|
||||
return request({
|
||||
url: `/iot/device/runningHistoryStatistics`,
|
||||
method: 'post',
|
||||
data,
|
||||
});
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { Outlet, useNavigate, useLocation } from 'react-router-dom';
|
||||
import {
|
||||
Layout, Menu, Button, Space, Select, Avatar, Card, Tag
|
||||
@@ -86,7 +86,6 @@ export default function AppLayout() {
|
||||
|
||||
list.forEach(item => {
|
||||
map.set(item.menuId, {
|
||||
...item,
|
||||
key: item.path,
|
||||
label: item.menuName,
|
||||
icon: getIcon(item.path),
|
||||
@@ -240,6 +239,11 @@ export default function AppLayout() {
|
||||
/>
|
||||
)}
|
||||
<span style={{ fontSize: 'clamp(12px, 1vw, 14px)' }}>{userInfo?.nickName || userInfo?.username}</span>
|
||||
{userInfo?.roleKey === "admin" && <Tag color="red">管理员</Tag>}
|
||||
{userInfo?.roleKey === "manager" && <Tag color="orange">组织管理员</Tag>}
|
||||
{userInfo?.roleKey === "siteManager" && <Tag color="blue">场站管理员</Tag>}
|
||||
|
||||
|
||||
</Space>
|
||||
<Button type="text" danger icon={<LogoutOutlined />} onClick={handleLogout} style={{ fontSize: 'clamp(12px, 1vw, 14px)' }}>
|
||||
{t('layout.logout')}
|
||||
|
||||
@@ -27,7 +27,7 @@ const CYAN_GLOW_COLOR = new window.Cesium.Color(
|
||||
);
|
||||
window.Cesium.Ion.defaultAccessToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJmNjk0NjI1MC0wZGYyLTQ1YzItYjJmZi0wY2M5ODEwODllYzIiLCJpZCI6Mzk3MTQxLCJpYXQiOjE3NzI1MjkwMjV9.U6qmakhDgXJVXwLFyWzSxAUOFZRrDkIsRUPP6CCdnKg";
|
||||
|
||||
const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine, finishPoint, drawRealTime, realtimePosition, realtimeType, pathPoints = [], devices = [], onCameraClick, focusLocation, points = [], markedPoints = [], onPathChange, from, onClearDraw, onMarkPoint }, ref) => {
|
||||
const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine, finishPoint, drawRealTime, realtimePosition, realtimeType, pathPoints = [], devices = [], onCameraClick, focusLocation, points = [], markedPoints = [], onPathChange, from, onClearDraw }, ref) => {
|
||||
const containerRef = useRef(null);
|
||||
const viewerRef = useRef(null);
|
||||
const tooltipRef = useRef(null);
|
||||
@@ -153,7 +153,6 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
|
||||
}
|
||||
});
|
||||
}
|
||||
console.log(newPoints, "newPoints")
|
||||
|
||||
onPathChange && onPathChange(newPoints);
|
||||
};
|
||||
@@ -203,7 +202,7 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
|
||||
}
|
||||
return;
|
||||
}
|
||||
const validPoints = points.filter(p => {
|
||||
const validPoints = points?.filter(p => {
|
||||
|
||||
const lon = Number(p.lng);
|
||||
const lat = Number(p.lat);
|
||||
@@ -402,6 +401,7 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log('已发布的图层:', publishedLayers);
|
||||
displayPublishedLayers(publishedLayers, baseUrl);
|
||||
})
|
||||
.catch(error => console.error('获取图层失败:', error));
|
||||
@@ -486,7 +486,7 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
|
||||
!isNaN(Number(realtimePosition.lon)) &&
|
||||
!isNaN(Number(realtimePosition.lat));
|
||||
|
||||
const hasTrack = points && points.length > 0;
|
||||
const hasTrack = (points && points.length > 0);
|
||||
|
||||
if (hasRealtime) return "realtime";
|
||||
if (hasTrack) return "track";
|
||||
@@ -497,12 +497,12 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
|
||||
const layerIdentifier = `${workspace}:${layerName}`;
|
||||
let baseUrl = wmsUrl;
|
||||
const cesiumLayers = [];
|
||||
if (index == 2 && from == "other") {
|
||||
//if (index == 2 && from == "other") {
|
||||
// //flyToLayer(layerIdentifier, baseUrl, 100);
|
||||
//}
|
||||
if (index == 1 && from == "other") {
|
||||
flyToLayer(layerIdentifier, baseUrl, 100);
|
||||
}
|
||||
//if (index == 0 && from == "other") {
|
||||
// flyToLayer(layerIdentifier, baseUrl, 100);
|
||||
//}
|
||||
//getLayerBoundsAndFit(wmsUrl, layerName);
|
||||
|
||||
if (baseUrl.includes('/gwc/service/wms')) {
|
||||
@@ -1032,7 +1032,7 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
|
||||
return;
|
||||
}
|
||||
|
||||
const validPoints = tracePoints.filter(p => {
|
||||
const validPoints = tracePoints?.filter(p => {
|
||||
const lng = Number(p.lng);
|
||||
const lat = Number(p.lat);
|
||||
return !isNaN(lng) && !isNaN(lat) && Math.abs(lng) < 180 && Math.abs(lat) < 90 && lng !== 0 && lat !== 0;
|
||||
@@ -1092,8 +1092,12 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
|
||||
if (viewer) {
|
||||
if (planLineRef.current) {
|
||||
viewer.entities.remove(planLineRef.current);
|
||||
|
||||
|
||||
planLineRef.current = null;
|
||||
}
|
||||
|
||||
|
||||
viewer.scene.requestRender();
|
||||
}
|
||||
prevIfClearPlanLine.current = ifClearPlanLine;
|
||||
@@ -1417,8 +1421,8 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
|
||||
}, window.Cesium.ScreenSpaceEventType.LEFT_CLICK);
|
||||
|
||||
handler.setInputAction((movement) => {
|
||||
if (from !== "deviceStatus")
|
||||
return;
|
||||
//if (from !== "device-control")
|
||||
return;
|
||||
const cartesian = viewer.camera.pickEllipsoid(movement.position, viewer.scene.globe.ellipsoid);
|
||||
if (!cartesian) return;
|
||||
const cartographic = window.Cesium.Cartographic.fromCartesian(cartesian);
|
||||
@@ -1428,7 +1432,6 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
|
||||
const newPoints = [...drawPoints, newPoint];
|
||||
setDrawPoints(newPoints);
|
||||
updateDrawPath(newPoints);
|
||||
onMarkPoint?.({ lon, lat });
|
||||
}, window.Cesium.ScreenSpaceEventType.LEFT_CLICK);
|
||||
|
||||
if (onClearDraw) {
|
||||
@@ -1859,17 +1862,27 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
|
||||
captureScreenshot
|
||||
}));
|
||||
|
||||
return <>
|
||||
<div ref={containerRef} className="w-full h-full bg-slate-900 overflow-hidden" />
|
||||
<div
|
||||
ref={tooltipRef}
|
||||
style={{
|
||||
position: "absolute", display: "none", pointerEvents: "none",
|
||||
background: "rgba(0,0,0,0.75)", color: "#fff", padding: "8px 10px",
|
||||
borderRadius: "4px", fontSize: "12px", zIndex: 9999, whiteSpace: "nowrap"
|
||||
}}
|
||||
/>
|
||||
</>;
|
||||
return (
|
||||
<div className="w-full h-full bg-slate-900 overflow-hidden relative">
|
||||
<div ref={containerRef} className="w-full h-full overflow-hidden" />
|
||||
<div
|
||||
ref={tooltipRef}
|
||||
style={{
|
||||
position: "absolute",
|
||||
display: "none",
|
||||
pointerEvents: "none",
|
||||
background: "rgba(0,0,0,0.75)",
|
||||
color: "#fff",
|
||||
padding: "8px 10px",
|
||||
borderRadius: "4px",
|
||||
fontSize: "12px",
|
||||
zIndex: 99999,
|
||||
whiteSpace: "nowrap",
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
export default CesiumMap;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState } from 'react';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import {
|
||||
Form,
|
||||
Input,
|
||||
@@ -58,12 +58,22 @@ import {
|
||||
} from 'lucide-react';
|
||||
import dayjs from 'dayjs';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { getRoleList } from '@/api/role';
|
||||
import { useSelector } from 'react-redux';
|
||||
import { RootState } from '@/src/store';
|
||||
import { getUser } from '@/api/user';
|
||||
|
||||
const { Text, Title } = Typography;
|
||||
|
||||
const BasicSettings = () => {
|
||||
const { t } = useTranslation();
|
||||
const [form] = Form.useForm();
|
||||
const [roles, setRoles] = useState<any[]>([]);
|
||||
const { userInfo } = useSelector((state: RootState) => state.user);
|
||||
const { currentStation, stationId } = useSelector((state: RootState) => state.station);
|
||||
const [userList, setUserList] = useState<any[]>([]);
|
||||
|
||||
|
||||
|
||||
// 响应式字体大小
|
||||
const fontNormal = 'clamp(12px, 0.75vw, 13px)';
|
||||
@@ -119,6 +129,7 @@ const BasicSettings = () => {
|
||||
|
||||
// 角色权限概览
|
||||
const roleOverview = [
|
||||
//平台管理员
|
||||
{
|
||||
title: t('roles.superAdmin'),
|
||||
users: 2,
|
||||
@@ -128,34 +139,68 @@ const BasicSettings = () => {
|
||||
bg: '#e6f4ff',
|
||||
icon: <ShieldCheck size={20} color="#1677ff" />
|
||||
},
|
||||
//普通用户
|
||||
{
|
||||
title: t('systemSetting.fixed2OM'),
|
||||
users: 5,
|
||||
perms: 18,
|
||||
tags: [t('router.devices'), '工单管理'],
|
||||
tags: ["处理工单", "处理任务"],
|
||||
color: '#52c41a',
|
||||
bg: '#f6ffed',
|
||||
icon: <Wrench size={20} color="#52c41a" />
|
||||
},
|
||||
//机构管理员
|
||||
{
|
||||
title: t('systemSetting.fixed2Inspection2'),
|
||||
users: 8,
|
||||
perms: 12,
|
||||
tags: ['巡检管理', '告警处理'],
|
||||
tags: ['管理机构下所有场站', '告警处理'],
|
||||
color: '#fa8c16',
|
||||
bg: '#fff7e6',
|
||||
icon: <Users size={20} color="#fa8c16" />
|
||||
},
|
||||
//场站管理员
|
||||
{
|
||||
title: t('systemSetting.s322'),
|
||||
users: 3,
|
||||
perms: 15,
|
||||
tags: ['数据分析', '报表查看'],
|
||||
tags: ['管理自己场站', '报表查看', '告警处理'],
|
||||
color: '#722ed1',
|
||||
bg: '#f9f0ff',
|
||||
icon: <LineChart size={20} color="#722ed1" />
|
||||
},
|
||||
];
|
||||
const matchRoleStyle = (roleName: string) => {
|
||||
const found = roleOverview.find(item => item.title === roleName);
|
||||
if (found) return found;
|
||||
// 兜底默认样式
|
||||
return {
|
||||
color: '#8c8c8c',
|
||||
bg: '#f5f5f5',
|
||||
icon: null,
|
||||
tags: []
|
||||
};
|
||||
};
|
||||
|
||||
const getUserData = () => {
|
||||
const params = {
|
||||
pageNum: 1,
|
||||
pageSize: 9999,
|
||||
orgId: userInfo?.roleKey == "manager" ? userInfo?.orgId : currentStation?.orgId,
|
||||
...(userInfo?.roleKey == "manager"
|
||||
? {}
|
||||
: { siteId: stationId }
|
||||
)
|
||||
};
|
||||
|
||||
getUser(params).then(res => {
|
||||
if (res.code === 200) {
|
||||
setUserList(res.rows || []);
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// 设备状态
|
||||
const deviceStatuses = [
|
||||
@@ -168,6 +213,21 @@ const BasicSettings = () => {
|
||||
{ name: t('systemSetting.api'), count: t('roles.normal'), status: t('roles.normal') },
|
||||
{ name: 'Modbus', count: t('roles.normal'), status: t('roles.normal') },
|
||||
];
|
||||
const getRoleData = () => {
|
||||
const params = { pageNum: 1, pageSize: 9999 };
|
||||
getRoleList(params).then(res => {
|
||||
if (res.code === 200) {
|
||||
let sortedRoles = (res.data || []).sort((a, b) => (a.roleSort || 999) - (b.roleSort || 999));
|
||||
setRoles(sortedRoles);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
getRoleData();
|
||||
getUserData();
|
||||
}, [])
|
||||
|
||||
|
||||
return (
|
||||
<div className="normal-spacing" style={{ padding: '8px 0px', background: '#f5f7fa', minHeight: '100vh' }}>
|
||||
@@ -182,9 +242,9 @@ const BasicSettings = () => {
|
||||
<Col key={idx} style={{ minWidth: '168px', flex: '1 0 auto', maxWidth: "250px" }}>
|
||||
<AntdCard bordered={false} bodyStyle={{ padding: '12px 16px' }} style={{ borderRadius: 10, boxShadow: '0 2px 8px rgba(0,0,0,0.04)' }}>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 10 }}>
|
||||
<div style={{ width: 40, height: 40, borderRadius: 10, background: item.bg, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
|
||||
{/*<div style={{ width: 40, height: 40, borderRadius: 10, background: item.bg, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
|
||||
{React.cloneElement(item.icon as React.ReactElement, { size: 20, style: item.icon.props.style ? { ...item.icon.props.style, fontSize: 20 } : { fontSize: 20 } })}
|
||||
</div>
|
||||
</div>*/}
|
||||
<div style={{ flex: 1 }}>
|
||||
<div style={{ color: '#8c8c8c', fontSize: fontSmall, marginBottom: 2 }}>{item.title}</div>
|
||||
<div style={{ display: 'flex', alignItems: 'baseline', gap: 6 }}>
|
||||
@@ -300,7 +360,7 @@ const BasicSettings = () => {
|
||||
<Col xs={24} sm={12} lg={6} key={idx}>
|
||||
<div style={{ display: 'flex', alignItems: 'center', padding: '10px 12px', background: '#f8fafc', borderRadius: 8, border: '1px solid #f1f5f9' }}>
|
||||
<div style={{ width: 32, height: 32, borderRadius: '50%', background: '#fff', display: 'flex', alignItems: 'center', justifyContent: 'center', boxShadow: '0 1px 4px rgba(0,0,0,0.04)', marginRight: 10 }}>
|
||||
{React.cloneElement(item.icon as React.ReactElement, { style: { color: item.color } })}
|
||||
{/*{React.cloneElement(item.icon as React.ReactElement, { style: { color: item.color } })}*/}
|
||||
</div>
|
||||
<div style={{ flex: 1 }}>
|
||||
<div style={{ fontSize: 10, color: '#8c8c8c' }}>{item.label}</div>
|
||||
@@ -342,39 +402,37 @@ const BasicSettings = () => {
|
||||
|
||||
pagination={{ size: 'small', total: 4, pageSize: 4, showTotal: (total) => `共 ${total} 条` }}
|
||||
columns={[
|
||||
{ title: t('systemSetting.s36'), dataIndex: 'name', key: 'name', fixed: 'left', width: 80 },
|
||||
{ title: t('systemSetting.s36'), dataIndex: 'userName', key: 'userName', fixed: 'left', },
|
||||
{
|
||||
title: t('users.role'),
|
||||
dataIndex: 'role',
|
||||
key: 'role',
|
||||
width: 100,
|
||||
render: (role) => {
|
||||
const config: any = {
|
||||
'超级管理员': { color: '#1677ff', bg: '#e6f4ff' },
|
||||
'运维工程师': { color: '#52c41a', bg: '#f6ffed' },
|
||||
'巡检主管': { color: '#fa8c16', bg: '#fff7e6' },
|
||||
'数据分析师': { color: '#722ed1', bg: '#f9f0ff' },
|
||||
};
|
||||
const s = config[role] || { color: '#8c8c8c', bg: '#f5f5f5' };
|
||||
return <Tag bordered={false} style={{ color: s.color, background: s.bg, fontSize: 10, margin: 0 }}>{role}</Tag>;
|
||||
render: (_val, record) => {
|
||||
const roleList = record.roles || [];
|
||||
return <>
|
||||
{roleList.map((rItem: any) => {
|
||||
//const conf = getRoleConfByKey(rItem.roleKey);
|
||||
return <Tag key={rItem.roleId}>{rItem.roleKey == "manager" ? t('systemSetting.fixed2Inspection2') : rItem.roleKey == "siteManager" ? t('systemSetting.s322') : t('systemSetting.fixed2OM')}</Tag>
|
||||
})}
|
||||
</>
|
||||
}
|
||||
},
|
||||
{ title: t('users.phone'), dataIndex: 'phone', key: 'phone', width: 110 },
|
||||
{ title: t('users.phone'), dataIndex: 'phonenumber', key: 'phonenumber', },
|
||||
{ title: t('users.email'), dataIndex: 'email', key: 'email', ellipsis: true },
|
||||
{
|
||||
title: t('roles.status'),
|
||||
dataIndex: 'status',
|
||||
key: 'status',
|
||||
width: 70,
|
||||
render: (status) => (
|
||||
<Space size={4}>
|
||||
<div style={{ width: 6, height: 6, borderRadius: '50%', background: status === t('devices.online') ? '#52c41a' : '#bfbfbf' }} />
|
||||
<span style={{ fontSize: 10 }}>{status}</span>
|
||||
<span style={{ fontSize: 10 }}>{status == 1 ? "在线" : "离线"}</span>
|
||||
</Space>
|
||||
)
|
||||
},
|
||||
{
|
||||
title: t('roles.actions'), key: 'action', width: 60, render: () => <Button
|
||||
title: t('roles.actions'), key: 'action', render: () => <Button
|
||||
type="link"
|
||||
size="small"
|
||||
icon={<EyeOutlined />}
|
||||
@@ -382,12 +440,7 @@ const BasicSettings = () => {
|
||||
>{t('common.view')}</Button>, fixed: 'right'
|
||||
},
|
||||
]}
|
||||
dataSource={[
|
||||
{ name: '张运维', role: '超级管理员', phone: '138****0001', email: 'zhangyw@pvsmart.com', status: t('devices.online') },
|
||||
{ name: '李工程师', role: '运维工程师', phone: '139****0002', email: 'li.gongcheng@pvsmart.com', status: t('devices.online') },
|
||||
{ name: '王班长', role: '巡检主管', phone: '137****0003', email: 'wang.banzhang@pvsmart.com', status: t('devices.online') },
|
||||
{ name: '赵分析师', role: '数据分析师', phone: '136****0004', email: 'zhao.fx@pvsmart.com', status: t('devices.online') },
|
||||
]}
|
||||
dataSource={userList}
|
||||
/>
|
||||
</AntdCard>
|
||||
</Col>
|
||||
@@ -402,25 +455,41 @@ const BasicSettings = () => {
|
||||
bodyStyle={{ padding: '10px' }}
|
||||
>
|
||||
<Row gutter={[8, 8]}>
|
||||
{roleOverview.map((role, idx) => (
|
||||
<Col xs={24} sm={12} key={idx}>
|
||||
<div style={{ background: role.bg, borderRadius: 8, padding: 8, height: '100%' }}>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 4 }}>
|
||||
{React.cloneElement(role.icon as React.ReactElement, { size: 16 })}
|
||||
<RightOutlined style={{ fontSize: 9, color: role.color }} />
|
||||
{roles.map((role, idx) => {
|
||||
const styleConf = matchRoleStyle(role.roleName);
|
||||
return (
|
||||
<Col xs={24} sm={12} key={idx}>
|
||||
<div style={{ background: styleConf.bg, borderRadius: 8, padding: 8, height: '100%' }}>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 4, alignItems: 'center' }}>
|
||||
{styleConf.icon}
|
||||
</div>
|
||||
<div style={{ fontWeight: 600, fontSize: 11, color: styleConf.color, marginBottom: 2 }}>
|
||||
{role.roleName}
|
||||
</div>
|
||||
<div style={{ fontSize: 9, color: '#8c8c8c', marginBottom: 6 }}>
|
||||
用户 {role.users} | 菜单权限 {role.menuIds?.length ?? 0}
|
||||
</div>
|
||||
<div style={{ display: 'flex', gap: 4, flexWrap: 'wrap' }}>
|
||||
{styleConf.tags.map((tag, tidx) => (
|
||||
<span
|
||||
key={tidx}
|
||||
style={{
|
||||
fontSize: 8,
|
||||
padding: '0 4px',
|
||||
background: '#fff',
|
||||
color: styleConf.color,
|
||||
borderRadius: 2,
|
||||
border: `1px solid ${styleConf.color}20`
|
||||
}}
|
||||
>
|
||||
{tag}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<div style={{ fontWeight: 600, fontSize: 11, color: role.color, marginBottom: 2 }}>{role.title}</div>
|
||||
<div style={{ fontSize: 9, color: '#8c8c8c', marginBottom: 6 }}>
|
||||
用户 {role.users} | 权限 {role.perms}
|
||||
</div>
|
||||
<div style={{ display: 'flex', gap: 4, flexWrap: 'wrap' }}>
|
||||
{role.tags.map((tag, tidx) => (
|
||||
<span key={tidx} style={{ fontSize: 8, padding: '0 4px', background: '#fff', color: role.color, borderRadius: 2, border: `1px solid ${role.color}20` }}>{tag}</span>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</Col>
|
||||
))}
|
||||
</Col>
|
||||
);
|
||||
})}
|
||||
</Row>
|
||||
</AntdCard>
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
getStationRegions, saveRegion, deleteRegion
|
||||
} from '../../api/stationManage';
|
||||
import { getOrgList } from '../../api/organization';
|
||||
import { fetchPublishedLayers } from '../../lib/geoServer';
|
||||
import { useSelector } from 'react-redux';
|
||||
import { RootState } from '../../store';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
@@ -26,6 +27,9 @@ export default function StationManage() {
|
||||
|
||||
// 组织列表
|
||||
const [orgList, setOrgList] = useState([]);
|
||||
// 发布图层列表(来自 GeoServer WMS)
|
||||
const [layerList, setLayerList] = useState<{ name: string; title: string }[]>([]);
|
||||
const [layerLoading, setLayerLoading] = useState(false);
|
||||
// 🔥 选中的组织ID(用于筛选)
|
||||
const [selectedOrgId, setSelectedOrgId] = useState<number | undefined>(undefined);
|
||||
|
||||
@@ -71,6 +75,15 @@ export default function StationManage() {
|
||||
});
|
||||
};
|
||||
|
||||
// ====================== 获取发布图层列表 ======================
|
||||
const getLayerData = () => {
|
||||
setLayerLoading(true);
|
||||
fetchPublishedLayers()
|
||||
.then(layers => setLayerList(layers || []))
|
||||
.catch(() => setLayerList([]))
|
||||
.finally(() => setLayerLoading(false));
|
||||
};
|
||||
|
||||
// ====================== 获取场站列表 ======================
|
||||
const getStationData = () => {
|
||||
const params = {
|
||||
@@ -81,6 +94,7 @@ export default function StationManage() {
|
||||
getStationList(params).then(res => {
|
||||
if (res.code === 200) {
|
||||
setStationList(res.rows || []);
|
||||
|
||||
setPagination({
|
||||
...pagination,
|
||||
total: res.total || res.rows?.length || 0
|
||||
@@ -131,6 +145,7 @@ export default function StationManage() {
|
||||
|
||||
// ====================== 新增 / 编辑 场站 ======================
|
||||
const handleAdd = () => {
|
||||
getLayerData();
|
||||
form.resetFields();
|
||||
setEditRecord(null);
|
||||
// 默认全部推送关闭
|
||||
@@ -145,6 +160,7 @@ export default function StationManage() {
|
||||
};
|
||||
|
||||
const handleEdit = (record) => {
|
||||
getLayerData();
|
||||
setEditRecord(record);
|
||||
// 后端数字转布尔给Switch
|
||||
form.setFieldsValue({
|
||||
@@ -246,6 +262,15 @@ export default function StationManage() {
|
||||
// ====================== 表格列 ======================
|
||||
const columns = [
|
||||
{ title: t('systemSetting.siteName'), dataIndex: 'siteName' },
|
||||
{
|
||||
title: t('systemSetting.mappingLayer'),
|
||||
dataIndex: 'site_map_name',
|
||||
render: (value) => value ? (
|
||||
<Tag color="blue">{value}</Tag>
|
||||
) : (
|
||||
<span style={{ color: '#86909C' }}>—</span>
|
||||
)
|
||||
},
|
||||
{
|
||||
title: t('systemSetting.belongingOrg'),
|
||||
dataIndex: 'orgId',
|
||||
@@ -262,7 +287,7 @@ export default function StationManage() {
|
||||
<Space wrap size="small">
|
||||
<Button icon={<EditOutlined />} onClick={() => handleEdit(record)}>{t('roles.edit')}</Button>
|
||||
<Button icon={<BgColorsOutlined />} onClick={() => handleOpenArea(record)}>{t('systemSetting.settingsFixed2')}</Button>
|
||||
<Button onClick={() => handleOpenMap(record)}>{t('systemSetting.s110')}</Button>
|
||||
<Button onClick={() => handleOpenMap(record)}>{t('systemSetting.BoundaryDrawing')}</Button>
|
||||
<Popconfirm title={t('common.confirmDelete')} onConfirm={() => handleDelete(record.id)}>
|
||||
<Button danger>{t('roles.delete')}</Button>
|
||||
</Popconfirm>
|
||||
@@ -363,6 +388,23 @@ export default function StationManage() {
|
||||
<Input placeholder={t('systemSetting.s14')} />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item name="site_map_name" label={t('systemSetting.mappingLayer')}>
|
||||
<Select
|
||||
placeholder={t('systemSetting.mappingLayerPlaceholder')}
|
||||
loading={layerLoading}
|
||||
allowClear
|
||||
showSearch
|
||||
optionFilterProp="label"
|
||||
>
|
||||
{layerList.map(item => (
|
||||
<Option key={item.name} value={item.name} label={item.title}>
|
||||
<span style={{ display: 'inline-block', verticalAlign: 'middle' }}>{item.title}</span>
|
||||
<span style={{ color: '#999', fontSize: 12 }}>({item.name})</span>
|
||||
</Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
|
||||
<Divider orientation="left">{t('systemSetting.s3')}</Divider>
|
||||
|
||||
<Row gutter={16}>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import {
|
||||
Layout, Tabs, Card, Row, Col, Button, Typography, Space, Modal, Form, Tree, message,
|
||||
Input, Popconfirm, Divider, InputNumber, Pagination, Table, Select,
|
||||
@@ -130,12 +130,13 @@ export default function UserRolePage() {
|
||||
const params = {
|
||||
pageNum: userPagination.pageNum,
|
||||
pageSize: userPagination.pageSize,
|
||||
orgId: userInfo?.roleKey == "manager" ? userInfo?.orgId : currentStation?.orgId,
|
||||
...(userInfo?.roleKey == "manager"
|
||||
orgId: userInfo?.roleKey === "manager" ? userInfo?.orgId : currentStation?.orgId,
|
||||
...(userInfo?.roleKey === "admin" && stationId
|
||||
? {}
|
||||
: { siteId: stationId }
|
||||
)
|
||||
};
|
||||
console.log(userInfo?.roleKey)
|
||||
|
||||
getUser(params).then(res => {
|
||||
if (res.code === 200) {
|
||||
@@ -171,7 +172,7 @@ export default function UserRolePage() {
|
||||
useEffect(() => {
|
||||
getUserData();
|
||||
getRoleForSelect();
|
||||
}, [userPagination.pageNum, userPagination.pageSize,]);
|
||||
}, [userPagination.pageNum, userPagination.pageSize, stationId]);
|
||||
|
||||
// ====================== 角色操作 ======================
|
||||
const handleAddRole = () => {
|
||||
|
||||
@@ -61,50 +61,44 @@ class WebSocketManager {
|
||||
// ==================== 连接管理 ====================
|
||||
|
||||
public connect(serialNumber: string, wsUrl: string): void {
|
||||
console.log("创建开始");
|
||||
|
||||
// 清除重连计时器
|
||||
console.log("创建开始");//ws://192.168.2.56:9002/ws/
|
||||
// 清除之前的重连计时器
|
||||
if (this.reconnectTimer) {
|
||||
clearTimeout(this.reconnectTimer);
|
||||
this.reconnectTimer = null;
|
||||
}
|
||||
|
||||
if (serialNumber == null || serialNumber.trim() === "") {
|
||||
console.log("serialNumber 是空/空白,停止执行");
|
||||
return;
|
||||
}
|
||||
|
||||
// 如果序列号相同且已连接,跳过
|
||||
if (this.ws && this.currentSerialRef === serialNumber && this.status === 'connected') {
|
||||
console.log('WebSocket already connected for this device');
|
||||
return;
|
||||
}
|
||||
|
||||
// ========== 重点修复:关闭旧连接,并且清空旧ws的事件监听,防止旧消息回调执行 ==========
|
||||
if (this.ws) {
|
||||
// 解绑所有事件,阻止旧ws继续触发onmessage/onclose
|
||||
this.ws.onopen = null;
|
||||
this.ws.onmessage = null;
|
||||
this.ws.onerror = null;
|
||||
this.ws.onclose = null;
|
||||
// 如果序列号不同,先关闭旧连接
|
||||
if (this.ws && this.currentSerialRef !== serialNumber) {
|
||||
this.close();
|
||||
this.ws = null;
|
||||
}
|
||||
|
||||
this.currentSerialRef = serialNumber;
|
||||
this.setStatus('connecting');
|
||||
this.isManualCloseRef = false;
|
||||
// 提前赋值,不要等到new WebSocket之后
|
||||
this.wsSerialRef = serialNumber;
|
||||
|
||||
console.log('Connecting WebSocket for', serialNumber);
|
||||
|
||||
|
||||
if (serialNumber == null || serialNumber.trim() === "") {
|
||||
console.log("serialNumber 是空/空白,停止执行");
|
||||
return;
|
||||
}
|
||||
|
||||
this.ws = new WebSocket(wsUrl);
|
||||
this.wsSerialRef = serialNumber;
|
||||
|
||||
this.ws.onopen = () => {
|
||||
console.log('WebSocket Connected');
|
||||
this.setStatus('connected');
|
||||
|
||||
|
||||
const dataStr = localStorage.getItem('userInfo');
|
||||
if (!dataStr) {
|
||||
console.error('用户信息未找到,无法发送认证包');
|
||||
@@ -115,21 +109,18 @@ class WebSocketManager {
|
||||
|
||||
console.log('WebSocket%', token);
|
||||
console.log('WebSocket%', parse);
|
||||
console.log("开始发送认证包");
|
||||
console.log("开始发送认证包");//ws://192.168.2.56:9002/ws/
|
||||
// 发送 AUTH 认证消息
|
||||
this.send({
|
||||
type: 'AUTH',
|
||||
token: token,
|
||||
userName: parse.username,
|
||||
deviceId: serialNumber,
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
this.ws.onmessage = (event) => {
|
||||
// 【防御二次校验】只有当前活跃serial才处理消息,旧连接残留消息直接丢弃
|
||||
if (this.wsSerialRef !== this.currentSerialRef) {
|
||||
console.log('丢弃过期ws消息');
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const data = JSON.parse(event.data);
|
||||
this.handleMessage(data);
|
||||
@@ -146,7 +137,7 @@ class WebSocketManager {
|
||||
const { code, reason, wasClean } = event;
|
||||
console.log('[WebSocket closed]', 'code =', code, 'reason =', reason || '(no reason)', 'wasClean =', wasClean);
|
||||
|
||||
// 不是当前设备直接忽略
|
||||
// 如果不是当前设备的 ws,忽略
|
||||
if (this.wsSerialRef !== this.currentSerialRef) {
|
||||
console.log('🟡 ignore old ws close');
|
||||
return;
|
||||
@@ -155,13 +146,15 @@ class WebSocketManager {
|
||||
this.ws = null;
|
||||
this.setStatus('disconnected');
|
||||
|
||||
// 主动关闭不重连
|
||||
if (this.isManualCloseRef || !this.currentSerialRef) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 5 秒后自动重连
|
||||
this.reconnectTimer = setTimeout(() => {
|
||||
if (this.currentSerialRef === this.wsSerialRef) {
|
||||
this.connect(this.currentSerialRef!, wsUrl);
|
||||
this.connect(this.currentSerialRef, wsUrl);
|
||||
}
|
||||
}, 5000);
|
||||
};
|
||||
@@ -171,17 +164,21 @@ class WebSocketManager {
|
||||
|
||||
public close(): void {
|
||||
this.isManualCloseRef = true;
|
||||
|
||||
if (this.reconnectTimer) {
|
||||
clearTimeout(this.reconnectTimer);
|
||||
this.reconnectTimer = null;
|
||||
}
|
||||
|
||||
if (this.ws) {
|
||||
try {
|
||||
this.ws.close(1000, 'manual close');
|
||||
} catch (e) {
|
||||
console.warn('ws close exception', e);
|
||||
}
|
||||
console.log('Closing WebSocket');
|
||||
this.ws.close();
|
||||
this.ws = null;
|
||||
}
|
||||
|
||||
this.currentSerialRef = null;
|
||||
this.wsSerialRef = null;
|
||||
this.setStatus('disconnected');
|
||||
}
|
||||
|
||||
// ==================== 消息发送 ====================
|
||||
|
||||
@@ -459,17 +459,8 @@ const RobotControlCenter = ({ setView }) => {
|
||||
}
|
||||
const getControl = (serialnum) => {
|
||||
setIsConnecting(true);
|
||||
let userParse = null;
|
||||
try {
|
||||
const dataStr = localStorage.getItem("userInfo");
|
||||
userParse = dataStr ? JSON.parse(dataStr) : null;
|
||||
} catch (e) {
|
||||
console.error("用户信息解析失败", e);
|
||||
}
|
||||
|
||||
const token = userParse.token || Cookies.get("Admin-Token");
|
||||
|
||||
const data = { platform: "web", deviceId: serialnum, token: token };
|
||||
const data = { platform: "web", deviceId: serialnum };
|
||||
getJurisdiction(data).then(res => {
|
||||
if (res?.data?.code === 200 && res?.data?.data?.remoteControl == true) {
|
||||
console.log("获取远程遥控权限成功");
|
||||
|
||||
@@ -750,8 +750,8 @@ export default function DeviceOverviewPage() {
|
||||
String(option?.label || "").toLowerCase().includes(input.toLowerCase())
|
||||
}
|
||||
options={[
|
||||
{ label: <span>{t('devices.robot')}</span>, options: devices.map(item => ({ value: item.device_sn || item.serialNumber, label: item.deviceAlias || item.deviceName || '未知设备' })) },
|
||||
{ label: <span>{t('constants.uav')}</span>, options: planedevices.map(item => ({ value: item.device_sn, label: item.drone_callsign || item.callsign || '未知设备' })) },
|
||||
{ label: <span>devices.robot</span>, options: devices.map(item => ({ value: item.device_sn || item.serialNumber, label: item.deviceAlias || item.deviceName || '未知设备' })) },
|
||||
{ label: <span>constants.uav</span>, options: planedevices.map(item => ({ value: item.device_sn, label: item.drone_callsign || item.callsign || '未知设备' })) },
|
||||
]}
|
||||
/>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, {
|
||||
import React, {
|
||||
useState,
|
||||
useEffect,
|
||||
useMemo,
|
||||
@@ -78,7 +78,6 @@ export default function DeviceStatusPage() {
|
||||
const [arrivedPoint, setArrivedPoint] = useState(null);//完成点
|
||||
const [isLoopMode, setIsLoopMode] = useState(true);
|
||||
const controllerRef = useRef<DeviceController | null>(null);
|
||||
const isFirstConnect = useRef(true);
|
||||
const [messageApi, contextHolder] = message.useMessage();
|
||||
|
||||
|
||||
@@ -96,7 +95,6 @@ export default function DeviceStatusPage() {
|
||||
const [connecting, setConnecting] = useState(false);
|
||||
const [wsStatus, setWsStatus] = useState('disconnected');
|
||||
const [wsDeviceInfo, setWsDeviceInfo] = useState({});
|
||||
const [locationInfo, setLocationInfo] = useState({});
|
||||
|
||||
|
||||
// 👇 加上这两个
|
||||
@@ -123,8 +121,7 @@ export default function DeviceStatusPage() {
|
||||
const [isSaveModalVisible, setIsSaveModalVisible] = useState(false); // 保存模态框可见性
|
||||
const [plotName, setPlotName] = useState(''); // 地块名称
|
||||
const [isSaving, setIsSaving] = useState(false); // 是否正在保存
|
||||
const mapRef = useRef(null);
|
||||
const clearDrawRef = useRef<(() => void) | null>(null); // 地图 ref
|
||||
const mapRef = useRef(null); // 地图 ref
|
||||
|
||||
const location = useLocation();
|
||||
const queryParams = new URLSearchParams(location.search);
|
||||
@@ -391,7 +388,7 @@ export default function DeviceStatusPage() {
|
||||
|
||||
const runningStatus = useMemo(() => {
|
||||
// 判断对象是否为空
|
||||
if ((!wsDeviceInfo || Object.keys(wsDeviceInfo).length === 0) && (!locationInfo || Object.keys(locationInfo).length === 0) && !isUAV) {
|
||||
if ((!wsDeviceInfo || Object.keys(wsDeviceInfo).length === 0) && !isUAV) {
|
||||
return {};
|
||||
}
|
||||
if (isUAV) {
|
||||
@@ -406,9 +403,8 @@ export default function DeviceStatusPage() {
|
||||
: {
|
||||
...base,
|
||||
...wsDeviceInfo,
|
||||
...locationInfo
|
||||
};
|
||||
}, [device, wsDeviceInfo, isUAV, locationInfo]);
|
||||
}, [device, wsDeviceInfo, isUAV]);
|
||||
|
||||
const { video: robotVideo, error, ready } = useWebRTCPlayer(
|
||||
(!isUAV && isVideoPlaying) ? (device?.serialNumber || '') : '',
|
||||
@@ -437,15 +433,15 @@ export default function DeviceStatusPage() {
|
||||
}
|
||||
|
||||
// 2. 机器人:从 wsDeviceInfo / runningStatus 取实时经纬度
|
||||
const robotLon = runningStatus.longitude || locationInfo.longitude;
|
||||
const robotLat = runningStatus.latitude || locationInfo.latitude;
|
||||
const robotLon = runningStatus?.longitude || wsDeviceInfo?.longitude;
|
||||
const robotLat = runningStatus?.latitude || wsDeviceInfo?.latitude;
|
||||
|
||||
if (robotLon && robotLat) {
|
||||
return {
|
||||
lon: robotLon,
|
||||
lat: robotLat,
|
||||
//heading: -98
|
||||
heading: runningStatus.yaw || wsDeviceInfo.yaw || 0,
|
||||
heading: runningStatus?.yaw || wsDeviceInfo?.yaw || 0,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -457,7 +453,6 @@ export default function DeviceStatusPage() {
|
||||
const controller = new DeviceController(userInfo, messageApi);
|
||||
|
||||
controller.onDeviceInfoUpdate = setWsDeviceInfo;
|
||||
controller.onLocationInfoUpdate = setLocationInfo;
|
||||
controller.onControlStatusChange = setIsControlled;
|
||||
controller.onHasControlRightChange = setHasControlRight;
|
||||
controller.onRequestControlStatusChange = setConnecting;
|
||||
@@ -485,19 +480,13 @@ export default function DeviceStatusPage() {
|
||||
|
||||
useEffect(() => {
|
||||
if (!device || !controllerRef.current || !device?.serialNumber || isUAV) {
|
||||
//controllerRef.current?.destroy();
|
||||
//setWsDeviceInfo({});
|
||||
return;
|
||||
}
|
||||
setWsDeviceInfo({});
|
||||
setLocationInfo({});
|
||||
|
||||
if (isFirstConnect.current) {
|
||||
|
||||
isFirstConnect.current = false;
|
||||
controllerRef.current.connectDevice(device);
|
||||
} else {
|
||||
|
||||
controllerRef.current.switchDevice(device);
|
||||
}
|
||||
controllerRef.current.connectDevice(device);
|
||||
|
||||
}, [device?.serialNumber]);
|
||||
|
||||
@@ -578,8 +567,8 @@ export default function DeviceStatusPage() {
|
||||
if (!device) return null;
|
||||
|
||||
// 优先使用持久化MQTT数据,其次使用uavState
|
||||
const lng = currentDroneData?.longitude ?? uavState?.longitude ?? runningStatus.longitude ?? device.longitude;
|
||||
const lat = currentDroneData?.latitude ?? uavState?.latitude ?? runningStatus.latitude ?? device.latitude;
|
||||
const lng = currentDroneData?.longitude ?? uavState?.longitude ?? runningStatus?.longitude ?? device.longitude;
|
||||
const lat = currentDroneData?.latitude ?? uavState?.latitude ?? runningStatus?.latitude ?? device.latitude;
|
||||
|
||||
return {
|
||||
...device,
|
||||
@@ -591,10 +580,10 @@ export default function DeviceStatusPage() {
|
||||
// 让地图取最新经纬度
|
||||
longitude: lng,
|
||||
latitude: lat,
|
||||
name: device.deviceAlias || device.callsign || device.deviceName || t('devices.device'),
|
||||
name: device?.deviceAlias || device?.callsign || device?.deviceName || t('devices.device'),
|
||||
type: isUAV
|
||||
? 'drone'
|
||||
: device.productName?.includes(t('constants.mower'))
|
||||
: device?.productName?.includes(t('constants.mower'))
|
||||
? 'mower'
|
||||
: 'robot',
|
||||
};
|
||||
@@ -659,35 +648,111 @@ export default function DeviceStatusPage() {
|
||||
messageApi.success(t('devices.pointMarked', { count: markedPoints.length + 1 }));
|
||||
};
|
||||
|
||||
// Map click to add marked point
|
||||
const handleMapMarkPoint = (point) => {
|
||||
setMarkedPoints([...markedPoints, { lon: Number(point.lon), lat: Number(point.lat) }]);
|
||||
messageApi.success(t('devices.pointMarked', { count: markedPoints.length + 1 }));
|
||||
};
|
||||
|
||||
// 清空标记点
|
||||
const handleClearPoints = () => {
|
||||
setMarkedPoints([]);
|
||||
setCompleteFlag(false);
|
||||
setSavePath(null);
|
||||
clearDrawRef.current?.();
|
||||
};
|
||||
|
||||
const getPathPoints = (coords) => {
|
||||
console.log("getPathPoints", coords)
|
||||
//setPathPoints(coords);
|
||||
if (!coords || coords.length === 0) return;
|
||||
const newWps = coords.map((p, i) => ({
|
||||
id: i + 1,
|
||||
lon: p.lon.toFixed(6),
|
||||
lat: p.lat.toFixed(6),
|
||||
}));
|
||||
console.log("newWps", newWps)
|
||||
//setWaypoints(newWps);
|
||||
};
|
||||
|
||||
|
||||
// 完成功能 - 调用路径规划接口
|
||||
const handleComplete = async () => {
|
||||
//如果时弓子模式
|
||||
if (isLoopMode) {
|
||||
if (markedPoints.length < 3) {
|
||||
messageApi.warning(t('devices.minThreePoints'));
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
// 准备路径规划请求参数
|
||||
const positionPoints = [...markedPoints];
|
||||
|
||||
|
||||
const requestParams = {
|
||||
reference: {
|
||||
lat: positionPoints[0].lat,
|
||||
lon: positionPoints[0].lon,
|
||||
},
|
||||
heading: 0,
|
||||
outer: {
|
||||
position: positionPoints.map(point => ({
|
||||
lat: point.lat,
|
||||
lon: point.lon,
|
||||
})),
|
||||
sideWidth: 0.0,
|
||||
},
|
||||
holes: [],
|
||||
workType: 0,
|
||||
};
|
||||
|
||||
const response = await fetch('https://servicepathplan.satabot.com/api/path', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(requestParams),
|
||||
});
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
if (result) {
|
||||
const path = result?.data?.path?.map(p => {
|
||||
return {
|
||||
lng: p.lon,
|
||||
lat: p.lat
|
||||
}
|
||||
})
|
||||
setPoints(path);
|
||||
setSavePath({
|
||||
path: path, // 存储返回的路径结果
|
||||
outer: requestParams?.outer?.position?.map(p => {
|
||||
return {
|
||||
lng: p.lon,
|
||||
lat: p.lat
|
||||
}
|
||||
}
|
||||
),
|
||||
planModel: 0,
|
||||
});
|
||||
setCompleteFlag(true);
|
||||
messageApi.success(t('devices.pathPlanDone'));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('路径规划失败:', error);
|
||||
messageApi.error(t('devices.pathPlanFailRetry'));
|
||||
}
|
||||
} else {
|
||||
const positionPoints = [...markedPoints].map(item => {
|
||||
return {
|
||||
lng: item.lon,
|
||||
lat: item.lat
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
setPoints(positionPoints);
|
||||
setSavePath({
|
||||
path: positionPoints, // 存储返回的路径结果
|
||||
outer: [],
|
||||
planModel: 2,
|
||||
});
|
||||
setCompleteFlag(true);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// 打开保存模态框
|
||||
const handleOpenSaveModal = () => {
|
||||
if (!completeFlag) {
|
||||
messageApi.warning(t('devices.completePathFirst'));
|
||||
return;
|
||||
}
|
||||
setPlotName('');
|
||||
setIsSaveModalVisible(true);
|
||||
};
|
||||
|
||||
// 保存功能
|
||||
const handleSave = async () => {
|
||||
if (!plotName.trim()) {
|
||||
messageApi.warning(t('devices.inputPlotName'));
|
||||
@@ -696,15 +761,6 @@ export default function DeviceStatusPage() {
|
||||
|
||||
setIsSaving(true);
|
||||
try {
|
||||
// ✅重点:接收handleComplete返回的path数据,不再读组件savePath state
|
||||
const pathResult = await handleComplete();
|
||||
if (!pathResult) {
|
||||
messageApi.warning(t('devices.saveFail'));
|
||||
|
||||
// 路径规划失败/校验不通过直接终止
|
||||
return;
|
||||
}
|
||||
|
||||
// 1. 获取地图截图
|
||||
let screenshotDataUrl = null;
|
||||
if (mapRef.current) {
|
||||
@@ -720,20 +776,18 @@ export default function DeviceStatusPage() {
|
||||
const file = dataUrlToFile(screenshotDataUrl, "screenshot.jpg");
|
||||
console.log("blob", file)
|
||||
|
||||
|
||||
if (file instanceof File) {
|
||||
formData.append('file', file);
|
||||
}
|
||||
}
|
||||
|
||||
// 4. 添加 workRecord,直接使用函数返回的 pathResult,不读取state savePath
|
||||
// 4. 添加 workRecord
|
||||
const workRecord = {
|
||||
workName: plotName,
|
||||
siteId: stationId,
|
||||
orgId: currentStation?.orgId,
|
||||
jsonData: pathResult, // 直接用返回值,彻底规避state异步延迟
|
||||
mode: isLoopMode ? "coverage" : "single_point",//"区域还是单点"
|
||||
jsonData: savePath,
|
||||
};
|
||||
console.log("workRecord", workRecord)
|
||||
formData.append(
|
||||
"workRecord",
|
||||
new Blob([JSON.stringify(workRecord)], {
|
||||
@@ -741,6 +795,8 @@ export default function DeviceStatusPage() {
|
||||
})
|
||||
);
|
||||
|
||||
//formData.append('workRecord', JSON.stringify(workRecord));
|
||||
|
||||
// 5. 调用保存接口
|
||||
const res = await addRoute(formData);
|
||||
|
||||
@@ -762,95 +818,6 @@ export default function DeviceStatusPage() {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* 修改handleComplete:计算完成后 return路径对象;失败返回null
|
||||
*/
|
||||
const handleComplete = async () => {
|
||||
//如果是闭环模式
|
||||
if (isLoopMode) {
|
||||
if (markedPoints.length < 3) {
|
||||
messageApi.warning(t('devices.minThreePoints'));
|
||||
return null; //校验失败返回null
|
||||
}
|
||||
|
||||
try {
|
||||
// 准备路径规划请求参数
|
||||
let positionPoints = [...markedPoints];
|
||||
|
||||
// =========新增:保证闭环,第一个点和最后一个点一致=========
|
||||
const firstPt = positionPoints[0];
|
||||
const lastPt = positionPoints[positionPoints.length - 1];
|
||||
// 判断经纬度是否相等,不相等就把首点追加到末尾
|
||||
if (!(firstPt.lat === lastPt.lat && firstPt.lon === lastPt.lon)) {
|
||||
positionPoints.push({ ...firstPt });
|
||||
}
|
||||
|
||||
const requestParams = {
|
||||
outer: {
|
||||
position: positionPoints.map(point => ({
|
||||
lat: point.lat,
|
||||
lng: point.lon,
|
||||
})),
|
||||
},
|
||||
};
|
||||
|
||||
const path = requestParams?.outer?.position
|
||||
setPoints(path);
|
||||
|
||||
const resultObj = {
|
||||
path: path,
|
||||
outer: requestParams?.outer?.position?.map(p => {
|
||||
return {
|
||||
lng: p.lon,
|
||||
lat: p.lat
|
||||
}
|
||||
}),
|
||||
};
|
||||
|
||||
setSavePath(resultObj);
|
||||
setCompleteFlag(true);
|
||||
messageApi.success(t('devices.pathPlanDone'));
|
||||
return resultObj; // ✅返回计算好的数据给上层调用
|
||||
} catch (error) {
|
||||
console.error('路径规划失败:', error);
|
||||
messageApi.error(t('devices.pathPlanFailRetry'));
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
// 单点模式
|
||||
const positionPoints = [...markedPoints].map(item => {
|
||||
return {
|
||||
lng: item.lon,
|
||||
lat: item.lat
|
||||
}
|
||||
});
|
||||
|
||||
setPoints(positionPoints);
|
||||
|
||||
const resultObj = {
|
||||
path: positionPoints,
|
||||
outer: [],
|
||||
};
|
||||
setSavePath(resultObj);
|
||||
setCompleteFlag(true);
|
||||
|
||||
return resultObj; // ✅返回
|
||||
}
|
||||
};
|
||||
|
||||
// 打开保存模态框
|
||||
const handleOpenSaveModal = () => {
|
||||
//if (!completeFlag) {
|
||||
// messageApi.warning(t('devices.completePathFirst'));
|
||||
// return;
|
||||
//}
|
||||
setPlotName('');
|
||||
setIsSaveModalVisible(true);
|
||||
};
|
||||
|
||||
|
||||
|
||||
const realtimeType = useMemo(() => {
|
||||
return isUAV ? 'plane' : 'car';
|
||||
}, [isUAV]);
|
||||
@@ -890,7 +857,7 @@ export default function DeviceStatusPage() {
|
||||
>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
|
||||
<Text strong>{t('devices.pathPlanning')}:</Text>
|
||||
<Text type="secondary">{t('devices.markedPointsCount', { count: markedPoints.length })}</Text>
|
||||
<Text type="secondary">{t('devices.markedPointsCount', { count: markedPoints?.length })}</Text>
|
||||
</div>
|
||||
<Space size="middle">
|
||||
<Space>
|
||||
@@ -915,18 +882,18 @@ export default function DeviceStatusPage() {
|
||||
>
|
||||
{t('devices.clearMarks')}
|
||||
</Button>
|
||||
{/*<Button
|
||||
<Button
|
||||
type="primary"
|
||||
ghost
|
||||
onClick={handleComplete}
|
||||
disabled={markedPoints.length < 2}
|
||||
disabled={markedPoints?.length < 2}
|
||||
>
|
||||
{t('devices.complete')}
|
||||
</Button>*/}
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={handleOpenSaveModal}
|
||||
//disabled={!completeFlag}
|
||||
disabled={!completeFlag}
|
||||
>
|
||||
{t('common.save')}
|
||||
</Button>
|
||||
@@ -953,12 +920,12 @@ export default function DeviceStatusPage() {
|
||||
optionFilterProp="label"
|
||||
placeholder={t('video.selectDevice')}
|
||||
allowClear={false}
|
||||
loading={devicesAll.length === 0}
|
||||
loading={devicesAll?.length === 0}
|
||||
options={[
|
||||
{
|
||||
label: t('devices.robot'),
|
||||
title: 'robot',
|
||||
options: devicesAll.filter(item => !item.gateway_sn && !item.drone_callsign && item.serialNumber).map(item => ({
|
||||
options: devicesAll?.filter(item => !item.gateway_sn && !item.drone_callsign && item.serialNumber).map(item => ({
|
||||
value: item.device_sn || item.serialNumber,
|
||||
label: `${item.deviceAlias || item.deviceName || t('devices.unknownDevice')} `,
|
||||
})),
|
||||
@@ -966,12 +933,12 @@ export default function DeviceStatusPage() {
|
||||
{
|
||||
label: t('constants.uav'),
|
||||
title: 'uav',
|
||||
options: devicesAll.filter(item => item.gateway_sn || item.drone_callsign).map(item => ({
|
||||
value: item.device_sn,
|
||||
label: `${item.drone_callsign || item.callsign || t('devices.unknownDrone')}`,
|
||||
options: devicesAll?.filter(item => item?.gateway_sn || item?.drone_callsign).map(item => ({
|
||||
value: item?.device_sn,
|
||||
label: `${item?.drone_callsign || item?.callsign || t('devices.unknownDrone')}`,
|
||||
})),
|
||||
},
|
||||
].filter(group => group.options.length > 0)}
|
||||
].filter(group => group?.options?.length > 0)}
|
||||
/>
|
||||
|
||||
<Tag color={isUAV ? 'cyan' : 'blue'}>
|
||||
@@ -1056,13 +1023,11 @@ export default function DeviceStatusPage() {
|
||||
markedPoints={markedPoints}
|
||||
realtimePosition={realtimePosition}
|
||||
realtimeType={realtimeType}
|
||||
onPathChange={getPathPoints}
|
||||
|
||||
drawRealTime={true}
|
||||
finishPoint={arrivedPoint}
|
||||
ifClearNavLine={clearNavLine}
|
||||
ifClearPlanLine={clearPlanLine}
|
||||
from="deviceStatus" onMarkPoint={handleMapMarkPoint} onClearDraw={(fn) => { clearDrawRef.current = fn; }}
|
||||
from="deviceStatus"
|
||||
/>
|
||||
</Card>
|
||||
</Col>
|
||||
@@ -1138,46 +1103,46 @@ export default function DeviceStatusPage() {
|
||||
}}>
|
||||
<div style={{ marginBottom: 6, fontWeight: 600, color: '#1890ff' }}>{t('devices.robotStatus')}</div>
|
||||
<div style={{ display: 'flex', gap: '3px 10px', flexWrap: 'wrap' }}>
|
||||
<span>{t('devices.rtBattery')}:</span>
|
||||
<span style={{ color: (runningStatus.battery || 0) < 20 ? '#ff4d4f' : '#52c41a' }}>
|
||||
{runningStatus.battery !== undefined ? `${runningStatus.battery}%` : '-'}
|
||||
<span>{t('devices.rtBattery')}</span>
|
||||
<span style={{ color: (runningStatus?.battery || 0) < 20 ? '#ff4d4f' : '#52c41a' }}>
|
||||
{runningStatus?.battery !== undefined ? `${runningStatus?.battery}%` : '-'}
|
||||
</span>
|
||||
<span>{t('devices.rtVoltage')}:</span>
|
||||
<span>{runningStatus.voltage !== undefined ? `${Number(runningStatus.voltage).toFixed(2)}V` : '-'}</span>
|
||||
<span>{t('devices.rtLeftMotor')}:</span>
|
||||
<span>{runningStatus.leftCurrent !== undefined ? `${Number(runningStatus.leftCurrent).toFixed(2)}A` : '-'}</span>
|
||||
<span>{t('devices.rtRightMotor')}:</span>
|
||||
<span>{runningStatus.rightCurrent !== undefined ? `${Number(runningStatus.rightCurrent).toFixed(2)}A` : '-'}</span>
|
||||
<span>{t('devices.rtLeftSpeed')}:</span>
|
||||
<span>{runningStatus.leftMeasureSpeed !== undefined ? `${Number(runningStatus.leftMeasureSpeed).toFixed(1)}rpm` : '-'}</span>
|
||||
<span>{t('devices.rtRightSpeed')}:</span>
|
||||
<span>{runningStatus.rightMeasureSpeed !== undefined ? `${Number(runningStatus.rightMeasureSpeed).toFixed(1)}rpm` : '-'}</span>
|
||||
<span>{t('devices.rtLeftTemp')}:</span>
|
||||
<span>{runningStatus.leftMotorTemp !== undefined ? `${Number(runningStatus.leftMotorTemp).toFixed(1)}℃` : '-'}</span>
|
||||
<span>{t('devices.rtRightTemp')}:</span>
|
||||
<span>{runningStatus.rightMotorTemp !== undefined ? `${Number(runningStatus.rightMotorTemp).toFixed(1)}℃` : '-'}</span>
|
||||
<span>{t('devices.rtMainTemp')}:</span>
|
||||
<span>{runningStatus.chipTemp !== undefined ? `${Number(runningStatus.chipTemp).toFixed(1)}℃` : '-'}</span>
|
||||
<span>{t('devices.rtHeadingAngle')}:</span>
|
||||
<span>{runningStatus.yaw !== undefined ? `${Number(runningStatus.yaw).toFixed(1)}°` : '-'}</span>
|
||||
<span>{t('devices.rtPitchAngle')}:</span>
|
||||
<span>{runningStatus.pitch !== undefined ? `${Number(runningStatus.pitch).toFixed(1)}°` : '-'}</span>
|
||||
<span>{t('devices.rtHeadingStatus')}:</span>
|
||||
<span>{runningStatus.headingStatus !== undefined ? `${runningStatus.headingStatus == 1 ? t('devices.rtInitialized') : t('devices.uninitialized')}` : '-'}</span>
|
||||
<span>{t('devices.rtPositioning')}:</span>
|
||||
<span>{t('devices.rtVoltage')}</span>
|
||||
<span>{runningStatus?.voltage !== undefined ? `${Number(runningStatus?.voltage).toFixed(2)}V` : '-'}</span>
|
||||
<span>{t('devices.rtLeftMotor')}</span>
|
||||
<span>{runningStatus?.leftCurrent !== undefined ? `${Number(runningStatus?.leftCurrent).toFixed(2)}A` : '-'}</span>
|
||||
<span>{t('devices.rtRightMotor')}</span>
|
||||
<span>{runningStatus?.rightCurrent !== undefined ? `${Number(runningStatus?.rightCurrent).toFixed(2)}A` : '-'}</span>
|
||||
<span>{t('devices.rtLeftSpeed')}</span>
|
||||
<span>{runningStatus?.leftMeasureSpeed !== undefined ? `${Number(runningStatus?.leftMeasureSpeed).toFixed(1)}rpm` : '-'}</span>
|
||||
<span>{t('devices.rtRightSpeed')}</span>
|
||||
<span>{runningStatus?.rightMeasureSpeed !== undefined ? `${Number(runningStatus?.rightMeasureSpeed).toFixed(1)}rpm` : '-'}</span>
|
||||
<span>{t('devices.rtLeftTemp')}</span>
|
||||
<span>{runningStatus?.leftMotorTemp !== undefined ? `${Number(runningStatus?.leftMotorTemp).toFixed(1)}℃` : '-'}</span>
|
||||
<span>{t('devices.rtRightTemp')}</span>
|
||||
<span>{runningStatus?.rightMotorTemp !== undefined ? `${Number(runningStatus?.rightMotorTemp).toFixed(1)}℃` : '-'}</span>
|
||||
<span>{t('devices.rtMainTemp')}</span>
|
||||
<span>{runningStatus?.chipTemp !== undefined ? `${Number(runningStatus?.chipTemp).toFixed(1)}℃` : '-'}</span>
|
||||
<span>{t('devices.rtHeadingAngle')}</span>
|
||||
<span>{runningStatus?.yaw !== undefined ? `${Number(runningStatus?.yaw).toFixed(1)}°` : '-'}</span>
|
||||
<span>{t('devices.rtPitchAngle')}</span>
|
||||
<span>{runningStatus?.pitch !== undefined ? `${Number(runningStatus?.pitch).toFixed(1)}°` : '-'}</span>
|
||||
<span>{t('devices.rtHeadingStatus')}</span>
|
||||
<span>{runningStatus?.headingStatus !== undefined ? `${runningStatus?.headingStatus == 1 ? t('devices.rtInitialized') : t('devices.uninitialized')}` : '-'}</span>
|
||||
<span>{t('devices.rtPositioning')}</span>
|
||||
<span>
|
||||
{runningStatus.qual == 0 ? t('constants.locationInvalid') :
|
||||
runningStatus.qual == 1 ? t('devices.gpsSingle') :
|
||||
runningStatus.qual == 2 ? t('devices.dgpsDiff') :
|
||||
runningStatus.qual == 4 ? t('devices.rtkFixed2') :
|
||||
runningStatus.qual == 5 ? t('devices.rtkFloat') : t('constants.locationUnknown')}
|
||||
{runningStatus?.qual == 0 ? t('constants.locationInvalid') :
|
||||
runningStatus?.qual == 1 ? t('devices.gpsSingle') :
|
||||
runningStatus?.qual == 2 ? t('devices.dgpsDiff') :
|
||||
runningStatus?.qual == 4 ? t('devices.rtkFixed2') :
|
||||
runningStatus?.qual == 5 ? t('devices.rtkFloat') : t('constants.locationUnknown')}
|
||||
</span>
|
||||
<span>{t('devices.rtSatellites')}:</span>
|
||||
<span>{t('devices.satelliteCount', { count: runningStatus.satelliteCnt || 0 })}</span>
|
||||
<span>{t('devices.rtMode')}:</span>
|
||||
<span>{t('devices.rtSatellites')}</span>
|
||||
<span>{t('devices.satelliteCount', { count: runningStatus?.satelliteCnt || 0 })}</span>
|
||||
<span>{t('devices.rtMode')}</span>
|
||||
<span>
|
||||
{runningStatus.controlMode == 1 ? t('devices.localMode') :
|
||||
runningStatus.controlMode == 3 ? t('devices.remoteMode') : t('constants.locationUnknown')}
|
||||
{runningStatus?.controlMode == 1 ? t('devices.localMode') :
|
||||
runningStatus?.controlMode == 3 ? t('devices.remoteMode') : t('constants.locationUnknown')}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1252,45 +1217,45 @@ export default function DeviceStatusPage() {
|
||||
<div style={{ marginBottom: 6, fontWeight: 600, color: '#1890ff' }}>{t('devices.robotStatus')}</div>
|
||||
<div style={{ display: 'grid', gridTemplateColumns: 'auto auto', gap: '3px 10px' }}>
|
||||
<span>{t('devices.rtBattery')}</span>
|
||||
<span style={{ color: (runningStatus.battery || 0) < 20 ? '#ff4d4f' : '#52c41a' }}>
|
||||
{runningStatus.battery !== undefined ? `${runningStatus.battery}%` : '-'}
|
||||
<span style={{ color: (runningStatus?.battery || 0) < 20 ? '#ff4d4f' : '#52c41a' }}>
|
||||
{runningStatus?.battery !== undefined ? `${runningStatus?.battery}%` : '-'}
|
||||
</span>
|
||||
<span>{t('devices.rtVoltage')}</span>
|
||||
<span>{runningStatus.voltage !== undefined ? `${Number(runningStatus.voltage).toFixed(2)}V` : '-'}</span>
|
||||
<span>{runningStatus?.voltage !== undefined ? `${Number(runningStatus?.voltage).toFixed(2)}V` : '-'}</span>
|
||||
<span>{t('devices.rtLeftMotor')}</span>
|
||||
<span>{runningStatus.leftCurrent !== undefined ? `${Number(runningStatus.leftCurrent).toFixed(2)}A` : '-'}</span>
|
||||
<span>{runningStatus?.leftCurrent !== undefined ? `${Number(runningStatus?.leftCurrent).toFixed(2)}A` : '-'}</span>
|
||||
<span>{t('devices.rtRightMotor')}</span>
|
||||
<span>{runningStatus.rightCurrent !== undefined ? `${Number(runningStatus.rightCurrent).toFixed(2)}A` : '-'}</span>
|
||||
<span>{runningStatus?.rightCurrent !== undefined ? `${Number(runningStatus?.rightCurrent).toFixed(2)}A` : '-'}</span>
|
||||
<span>{t('devices.rtLeftSpeed')}</span>
|
||||
<span>{runningStatus.leftMeasureSpeed !== undefined ? `${Number(runningStatus.leftMeasureSpeed).toFixed(1)}rpm` : '-'}</span>
|
||||
<span>{runningStatus?.leftMeasureSpeed !== undefined ? `${Number(runningStatus?.leftMeasureSpeed).toFixed(1)}rpm` : '-'}</span>
|
||||
<span>{t('devices.rtRightSpeed')}</span>
|
||||
<span>{runningStatus.rightMeasureSpeed !== undefined ? `${Number(runningStatus.rightMeasureSpeed).toFixed(1)}rpm` : '-'}</span>
|
||||
<span>{runningStatus?.rightMeasureSpeed !== undefined ? `${Number(runningStatus?.rightMeasureSpeed).toFixed(1)}rpm` : '-'}</span>
|
||||
<span>{t('devices.rtLeftTemp')}</span>
|
||||
<span>{runningStatus.leftMotorTemp !== undefined ? `${Number(runningStatus.leftMotorTemp).toFixed(1)}℃` : '-'}</span>
|
||||
<span>{runningStatus?.leftMotorTemp !== undefined ? `${Number(runningStatus?.leftMotorTemp).toFixed(1)}℃` : '-'}</span>
|
||||
<span>{t('devices.rtRightTemp')}</span>
|
||||
<span>{runningStatus.rightMotorTemp !== undefined ? `${Number(runningStatus.rightMotorTemp).toFixed(1)}℃` : '-'}</span>
|
||||
<span>{runningStatus?.rightMotorTemp !== undefined ? `${Number(runningStatus?.rightMotorTemp).toFixed(1)}℃` : '-'}</span>
|
||||
<span>{t('devices.rtMainTemp')}</span>
|
||||
<span>{runningStatus.chipTemp !== undefined ? `${Number(runningStatus.chipTemp).toFixed(1)}℃` : '-'}</span>
|
||||
<span>{runningStatus?.chipTemp !== undefined ? `${Number(runningStatus?.chipTemp).toFixed(1)}℃` : '-'}</span>
|
||||
<span>{t('devices.rtHeadingAngle')}</span>
|
||||
<span>{runningStatus.yaw !== undefined ? `${Number(runningStatus.yaw).toFixed(1)}°` : '-'}</span>
|
||||
<span>{runningStatus?.yaw !== undefined ? `${Number(runningStatus?.yaw).toFixed(1)}°` : '-'}</span>
|
||||
<span>{t('devices.rtPitchAngle')}</span>
|
||||
<span>{runningStatus.pitch !== undefined ? `${Number(runningStatus.pitch).toFixed(1)}°` : '-'}</span>
|
||||
<span>{runningStatus?.pitch !== undefined ? `${Number(runningStatus?.pitch).toFixed(1)}°` : '-'}</span>
|
||||
<span>{t('devices.rtHeadingStatus')}</span>
|
||||
<span>{runningStatus.headingStatus !== undefined ? `${runningStatus.headingStatus == 1 ? t('devices.rtInitialized') : t('devices.uninitialized')}` : '-'}</span>
|
||||
<span>{runningStatus?.headingStatus !== undefined ? `${runningStatus?.headingStatus == 1 ? t('devices.rtInitialized') : t('devices.uninitialized')}` : '-'}</span>
|
||||
<span>{t('devices.rtPositioning')}</span>
|
||||
<span>
|
||||
{runningStatus.qual == 0 ? t('constants.locationInvalid') :
|
||||
runningStatus.qual == 1 ? t('devices.gpsSingle') :
|
||||
runningStatus.qual == 2 ? t('devices.dgpsDiff') :
|
||||
runningStatus.qual == 4 ? t('devices.rtkFixed2') :
|
||||
runningStatus.qual == 5 ? t('devices.rtkFloat') : t('constants.locationUnknown')}
|
||||
{runningStatus?.qual == 0 ? t('constants.locationInvalid') :
|
||||
runningStatus?.qual == 1 ? t('devices.gpsSingle') :
|
||||
runningStatus?.qual == 2 ? t('devices.dgpsDiff') :
|
||||
runningStatus?.qual == 4 ? t('devices.rtkFixed2') :
|
||||
runningStatus?.qual == 5 ? t('devices.rtkFloat') : t('constants.locationUnknown')}
|
||||
</span>
|
||||
<span>{t('devices.rtSatellites')}</span>
|
||||
<span>{t('devices.satelliteCount', { count: runningStatus.satelliteCnt || 0 })}</span>
|
||||
<span>{t('devices.satelliteCount', { count: runningStatus?.satelliteCnt || 0 })}</span>
|
||||
<span>{t('devices.rtMode')}</span>
|
||||
<span>
|
||||
{runningStatus.controlMode == 1 ? t('devices.localMode') :
|
||||
runningStatus.controlMode == 3 ? t('devices.remoteMode') : t('constants.locationUnknown')}
|
||||
{runningStatus?.controlMode == 1 ? t('devices.localMode') :
|
||||
runningStatus?.controlMode == 3 ? t('devices.remoteMode') : t('constants.locationUnknown')}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1348,7 +1313,7 @@ export default function DeviceStatusPage() {
|
||||
finishPoint={arrivedPoint}
|
||||
ifClearNavLine={clearNavLine}
|
||||
ifClearPlanLine={clearPlanLine}
|
||||
from="deviceStatus" onMarkPoint={handleMapMarkPoint} onClearDraw={(fn) => { clearDrawRef.current = fn; }}
|
||||
from="deviceStatus"
|
||||
/>
|
||||
</Card>
|
||||
|
||||
@@ -1381,11 +1346,11 @@ export default function DeviceStatusPage() {
|
||||
open={isModalOpen}
|
||||
onOk={handleOk}
|
||||
onCancel={handleCancel}
|
||||
title={modalContent.title}
|
||||
title={modalContent?.title}
|
||||
okText={t('common.ok')}
|
||||
cancelText={t('common.cancel')}
|
||||
>
|
||||
<p>{modalContent.content}</p>
|
||||
<p>{modalContent?.content}</p>
|
||||
</Modal>
|
||||
|
||||
{/* 保存路径模态框 */}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import React, { useState, useEffect, useRef, useMemo } from 'react';
|
||||
import React, { useState, useEffect, useRef, useMemo } from 'react';
|
||||
import {
|
||||
Row, Col, Card, Button, Space, Table, Tag, Typography, Progress, Badge,
|
||||
Tabs, Input, Switch, Divider, Tooltip, Timeline, Select, message, DatePicker,
|
||||
Modal, InputNumber,
|
||||
TimePicker,
|
||||
Popconfirm,
|
||||
App,
|
||||
Radio
|
||||
App
|
||||
} from 'antd';
|
||||
import {
|
||||
PlusOutlined, ImportOutlined, NodeIndexOutlined,
|
||||
@@ -36,7 +35,6 @@ import {
|
||||
getSiteDeviceTaskHistory,
|
||||
getRouteByTask,
|
||||
deleteRoute,
|
||||
getTaskPath,
|
||||
} from '../../api/device';
|
||||
import dayjs from 'dayjs';
|
||||
import DraggableBox from '../Draggable';
|
||||
@@ -118,8 +116,6 @@ export default function RobotTaskPage() {
|
||||
robot: null,
|
||||
dateRange: null,
|
||||
});
|
||||
// 取消任务模式 normal普通取消 force强制取消
|
||||
const [cancelMode, setCancelMode] = useState<'normal' | 'force'>('normal');
|
||||
|
||||
|
||||
|
||||
@@ -141,12 +137,13 @@ export default function RobotTaskPage() {
|
||||
});
|
||||
const [messageApi, contextHolder] = message.useMessage();
|
||||
const controllerRef = useRef<DeviceController | null>(null);
|
||||
const isFirstConnect = useRef(true);
|
||||
const handleFinish = (data) => {
|
||||
setExecute(false);
|
||||
setShowVideo(false); // 任务完成关闭视频
|
||||
utils.message.success(t('devices.fixed2TaskSuspended2Fixed2CompletedFixed2'));
|
||||
|
||||
//if (controllerRef.current) {
|
||||
// controllerRef.current.destroy?.();
|
||||
//}
|
||||
setClearNavLine(clearNavLine + 1);
|
||||
setSelectedRobotForExecute(null);
|
||||
setSelectedRouteForExecute(null);
|
||||
@@ -155,7 +152,6 @@ export default function RobotTaskPage() {
|
||||
fetchTaskPoolList();
|
||||
|
||||
|
||||
|
||||
}
|
||||
const handleFinishEdPoint = (point) => {
|
||||
setArrivedPoint(point);
|
||||
@@ -240,7 +236,7 @@ export default function RobotTaskPage() {
|
||||
setExecute(true);
|
||||
setExecutingRobot(targetDevice);
|
||||
setClearNavLine(v => v + 1); // 清空地图轨迹
|
||||
if (isFirstConnect.current) { isFirstConnect.current = false; controllerRef.current?.connectDevice(targetDevice); } else { controllerRef.current?.switchDevice(targetDevice); }
|
||||
controllerRef.current?.connectDevice(targetDevice);
|
||||
setShowVideo(true);
|
||||
};
|
||||
|
||||
@@ -248,12 +244,9 @@ export default function RobotTaskPage() {
|
||||
useEffect(() => {
|
||||
const controller = new DeviceController(userInfo, messageApi);
|
||||
|
||||
controller.onLocationInfoUpdate = setRobotRealtimePosition;
|
||||
controller.onDeviceInfoUpdate = setRobotRealtimePosition;
|
||||
controller.onIsFinished = handleFinish;
|
||||
controller.handleArrivedPoint = handleFinishEdPoint;
|
||||
controller.onRoutePost = setPoints;
|
||||
|
||||
|
||||
|
||||
controller.init();
|
||||
|
||||
@@ -286,7 +279,6 @@ export default function RobotTaskPage() {
|
||||
const runningTask = taskPoolList.find(item => ['EXECUTING', 'PAUSE'].includes(item.taskStaus));
|
||||
|
||||
if (!runningTask) return;
|
||||
fetchRouteDetail(runningTask?.id);
|
||||
|
||||
// 找到对应的设备
|
||||
const targetDevice = devices.find(d => d.serialNumber === runningTask.deviceId);
|
||||
@@ -304,7 +296,7 @@ export default function RobotTaskPage() {
|
||||
setExecute(true);
|
||||
setExecutingRobot(targetDevice);
|
||||
setClearNavLine(v => v + 1); // 清空地图轨迹
|
||||
if (isFirstConnect.current) { isFirstConnect.current = false; controllerRef.current?.connectDevice(targetDevice); } else { controllerRef.current?.switchDevice(targetDevice); }
|
||||
controllerRef.current?.connectDevice(targetDevice);
|
||||
setShowVideo(true);
|
||||
|
||||
}, [devices, taskPoolList, executingRobot, runningPoolTask]);
|
||||
@@ -394,14 +386,57 @@ export default function RobotTaskPage() {
|
||||
}
|
||||
};
|
||||
useEffect(() => {
|
||||
//console.log('获取任务列表', selectedPathWork?.id);
|
||||
if (!selectedRobotForExecute?.id || !execute) {
|
||||
if (!selectedPathWork?.id) {
|
||||
setPoints([]);
|
||||
return;
|
||||
}
|
||||
|
||||
// 调用接口获取路线详情
|
||||
const fetchRouteDetail = async () => {
|
||||
try {
|
||||
const res = await getSingleRouteList({ id: selectedPathWork.id });
|
||||
if (res?.code === 200 && res?.data) {
|
||||
let pathPoints = [];
|
||||
let outerPoints = [];
|
||||
let method = '';//0弓子 2 回子
|
||||
try {
|
||||
// 尝试解析 JSON
|
||||
if (res.data.jsonData) {
|
||||
const data = typeof res.data.jsonData === 'string'
|
||||
? JSON.parse(res.data.jsonData)
|
||||
: res.data.jsonData;
|
||||
pathPoints = data?.path || [];
|
||||
outerPoints = data?.outer || [];
|
||||
method = data?.planModel;
|
||||
|
||||
}, [selectedRobotForExecute?.id]);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('解析路线数据失败:', err);
|
||||
}
|
||||
|
||||
if (pathPoints.length === 0) {
|
||||
utils.message.warning(t('devices.route2'));
|
||||
}
|
||||
//if (outerPoints.length === 0 && method == 2) {
|
||||
// utils.message.warning(t('devices.route2'));
|
||||
//}
|
||||
//if (method == 0) {
|
||||
setPoints(pathPoints);
|
||||
//} else {
|
||||
// setPoints(outerPoints);
|
||||
|
||||
//}
|
||||
} else {
|
||||
setPoints([]);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取路线详情失败:', err);
|
||||
setPoints([]);
|
||||
}
|
||||
};
|
||||
|
||||
fetchRouteDetail();
|
||||
}, [selectedPathWork]);
|
||||
|
||||
// 监听任务池列表变化,自动加载第一个任务的路径
|
||||
useEffect(() => {
|
||||
@@ -410,41 +445,6 @@ export default function RobotTaskPage() {
|
||||
|
||||
}
|
||||
}, [taskPoolList]);
|
||||
// 调用接口获取路线详情
|
||||
const fetchRouteDetail = async (id) => {
|
||||
console.log(id, "获取正在执行任务的id")
|
||||
try {
|
||||
const params = {
|
||||
taskId: id,
|
||||
}
|
||||
|
||||
const res = await getTaskPath(params)
|
||||
//const res = await getSingleRouteList({ id: selectedPathWork.id });
|
||||
if (res?.code === 200 && res?.data) {
|
||||
let pathPoints = [];
|
||||
|
||||
try {
|
||||
// 尝试解析 JSON
|
||||
pathPoints = res.data || [];
|
||||
} catch (err) {
|
||||
console.error('解析路线数据失败:', err);
|
||||
}
|
||||
|
||||
if (pathPoints.length === 0) {
|
||||
utils.message.warning(t('devices.route2'));
|
||||
}
|
||||
|
||||
setPoints(pathPoints);
|
||||
|
||||
} else {
|
||||
setPoints([]);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取路线详情失败:', err);
|
||||
setPoints([]);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -460,7 +460,7 @@ export default function RobotTaskPage() {
|
||||
setExecute(true);
|
||||
setExecutingRobot(targetDevice);
|
||||
setClearNavLine(v => v + 1); // 清空地图轨迹
|
||||
if (isFirstConnect.current) { isFirstConnect.current = false; controllerRef.current?.connectDevice(targetDevice); } else { controllerRef.current?.switchDevice(targetDevice); }
|
||||
controllerRef.current?.connectDevice(targetDevice);
|
||||
setShowVideo(true);
|
||||
}
|
||||
}
|
||||
@@ -566,7 +566,7 @@ export default function RobotTaskPage() {
|
||||
fetchTaskList();
|
||||
fetchTaskPoolList();
|
||||
fetchTaskHistoryList();
|
||||
if (isFirstConnect.current) { isFirstConnect.current = false; controllerRef.current?.connectDevice(selectedRobotForExecute); } else { controllerRef.current?.switchDevice(selectedRobotForExecute); }
|
||||
controllerRef.current?.connectDevice(selectedRobotForExecute);
|
||||
setShowVideo(true); // 连接成功后自动打开视频
|
||||
|
||||
} else {
|
||||
@@ -653,14 +653,13 @@ export default function RobotTaskPage() {
|
||||
};
|
||||
|
||||
// 取消任务
|
||||
const handleCancelTask = async (task, mode) => {
|
||||
const handleCancelTask = async (task) => {
|
||||
try {
|
||||
const params = {
|
||||
taskId: task.id,
|
||||
//deviceId: task.deviceId,
|
||||
siteId: stationId,
|
||||
orgId: task.orgId,
|
||||
forceCancel: mode === 'force' ? true : false,
|
||||
};
|
||||
const res = await cancelRoute(params);
|
||||
if (res.code === 200 && res.data == true) {
|
||||
@@ -674,8 +673,6 @@ export default function RobotTaskPage() {
|
||||
setSelectedRobotForExecute(null);
|
||||
setSelectedRouteForExecute(null);
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
utils.message.error(t('devices.taskCancelFail'));
|
||||
}
|
||||
@@ -835,17 +832,15 @@ export default function RobotTaskPage() {
|
||||
dataIndex: 'taskStaus',
|
||||
width: 100,
|
||||
render: (status, record) => {
|
||||
console.log('status', status, record);
|
||||
const statusMap = {
|
||||
'NEW': { color: 'default', text: t('devices.statusNew') },
|
||||
'EXECUTING': { color: 'processing', text: t('workOrder.inProgress') },
|
||||
'PAUSE': { color: 'warning', text: t('devices.statusPaused') },
|
||||
'FINISH': { color: 'success', text: t('devices.statusFinished') },
|
||||
'FAILED': { color: 'error', text: t('devices.statusFailed') },
|
||||
"CANCELING": { color: 'warning', text: t('devices.statusCanceling') },
|
||||
'FAILED': { color: 'error', text: t('devices.statusFailed') }
|
||||
};
|
||||
const item = statusMap[status] || { color: 'default', text: record.taskStausTranslate || t('constants.locationUnknown') };
|
||||
return <Tag color={item.color}>{record.taskStausTranslate}</Tag>;
|
||||
return <Tag color={item.color}>{item.text}</Tag>;
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -894,8 +889,7 @@ export default function RobotTaskPage() {
|
||||
'EXECUTING': { color: 'processing', text: t('workOrder.inProgress') },
|
||||
'PAUSE': { color: 'warning', text: t('devices.statusPaused') },
|
||||
'FINISH': { color: 'success', text: t('devices.statusFinished') },
|
||||
'FAILED': { color: 'error', text: t('devices.statusFailed') },
|
||||
"CANCELING": { color: 'warning', text: t('devices.statusCanceling') },
|
||||
'FAILED': { color: 'error', text: t('devices.statusFailed') }
|
||||
};
|
||||
const item = statusMap[status] || { color: 'default', text: t('constants.locationUnknown') };
|
||||
return <Tag color={item.color}>{item.text}</Tag>;
|
||||
@@ -915,46 +909,27 @@ export default function RobotTaskPage() {
|
||||
|
||||
<>
|
||||
{/*{record.taskStaus === 'NEW' && (*/}
|
||||
<Popconfirm
|
||||
title={t('devices.confirmCancelTask')}
|
||||
description={
|
||||
<Radio.Group
|
||||
value={cancelMode}
|
||||
onChange={(e) => setCancelMode(e.target.value)}
|
||||
style={{ marginTop: 8 }}
|
||||
>
|
||||
<Space direction="vertical">
|
||||
<Radio value="normal">{t('devices.normalCancel')}</Radio>
|
||||
<Radio value="force">{t('devices.forceCancel')}</Radio>
|
||||
</Space>
|
||||
</Radio.Group>
|
||||
}
|
||||
onConfirm={() => handleCancelTask(record, cancelMode)}
|
||||
okText={t('common.ok')}
|
||||
cancelText={t('common.cancel')}
|
||||
>
|
||||
<Button
|
||||
type="text"
|
||||
size="small"
|
||||
danger
|
||||
icon={<CloseOutlined />}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
{t('common.cancel')}
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
<Popconfirm
|
||||
title={t('devices.confirmCancelTask')}
|
||||
onConfirm={() => handleCancelTask(record)}
|
||||
okText={t('common.ok')} cancelText={t('common.cancel')}
|
||||
>
|
||||
<Button type="text" size="small" danger icon={<CloseOutlined />} onClick={(e) => e.stopPropagation()}>
|
||||
{t('common.cancel')}
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
{/*//)}*/}
|
||||
|
||||
{/*{record.taskStaus === 'EXECUTING' && (*/}
|
||||
<Popconfirm
|
||||
title={t('devices.confirmPauseTask')}
|
||||
onConfirm={() => handlePauseTask(record)}
|
||||
okText={t('common.ok')} cancelText={t('common.cancel')}
|
||||
>
|
||||
<Button type="text" size="small" style={{ color: '#FF9500' }} onClick={(e) => e.stopPropagation()}>
|
||||
{t('video.pause')}
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
<Popconfirm
|
||||
title={t('devices.confirmPauseTask')}
|
||||
onConfirm={() => handlePauseTask(record)}
|
||||
okText={t('common.ok')} cancelText={t('common.cancel')}
|
||||
>
|
||||
<Button type="text" size="small" style={{ color: '#FF9500' }} onClick={(e) => e.stopPropagation()}>
|
||||
{t('video.pause')}
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
{/*)}/*/}
|
||||
|
||||
{record.taskStaus === 'PAUSE' && (
|
||||
@@ -1180,7 +1155,7 @@ export default function RobotTaskPage() {
|
||||
focusLocation={focusLocation}
|
||||
realtimePosition={realtimePosition}
|
||||
realtimeType="robot"
|
||||
from="deviceStatus"
|
||||
from="device-control"
|
||||
drawRealTime={execute}
|
||||
finishPoint={arrivedPoint}
|
||||
ifClearNavLine={clearNavLine}
|
||||
|
||||
@@ -116,7 +116,7 @@ const XboxController = ({ onGamepadUpdate, handleControlModal, isControlled, isC
|
||||
return (
|
||||
<div className="relative h-[252px] aspect-[4/3] flex items-center justify-center "
|
||||
onClick={() => {
|
||||
if (!isControlled) {
|
||||
if (connected && !isControlled && hasControlRight) {
|
||||
console.log("点击了无控制权限,发起权限请求");
|
||||
// 示例:调用你代码中已有的权限请求弹窗逻辑
|
||||
handleControlModal({ control: true, type: "switchPermission" });
|
||||
@@ -125,7 +125,7 @@ const XboxController = ({ onGamepadUpdate, handleControlModal, isControlled, isC
|
||||
{/* Gamepad Status Badge */}
|
||||
<div
|
||||
className={`absolute top-0 right-0 px-2 py-0.5 rounded text-[8px] font-bold tracking-widest border
|
||||
${connected
|
||||
${connected || !hasControlRight
|
||||
? isConnecting
|
||||
? 'bg-yellow-500/20 text-yellow-400 border-yellow-500/30'
|
||||
: isControlled
|
||||
@@ -137,6 +137,8 @@ const XboxController = ({ onGamepadUpdate, handleControlModal, isControlled, isC
|
||||
>
|
||||
{!connected ? (
|
||||
t('devices.controllerNotConnected')
|
||||
) : !hasControlRight ? (
|
||||
t('devices.otherWebConnected')
|
||||
) : isConnecting ? (
|
||||
t('devices.control2')
|
||||
) : isControlled ? (
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import throttle from 'lodash/throttle';
|
||||
import { wsManager } from '../WebSocketManager.ts';
|
||||
import {
|
||||
getControlRight,
|
||||
getJurisdiction,
|
||||
releaseControl
|
||||
} from '../../api/device.ts';
|
||||
|
||||
import envConfig from '../../../env';
|
||||
@@ -17,7 +17,7 @@ export default class DeviceController {
|
||||
envConfig.WS_URL || 'wss://ri.satabot.com/ws/';
|
||||
|
||||
this.connectedDeviceSn = null;
|
||||
this.currentDevice = null;
|
||||
this.currentDevice = null; // 保存当前设备
|
||||
|
||||
this.requestDeviceId = '';
|
||||
|
||||
@@ -27,27 +27,22 @@ export default class DeviceController {
|
||||
|
||||
this.wsStatus = 'disconnected';
|
||||
this.wsDeviceInfo = {};
|
||||
this.locationInfo = {};
|
||||
|
||||
this.controlTimeout = null;
|
||||
this.keepAliveInterval = null;
|
||||
this.keepAliveInterval = null; // 后台保活定时器
|
||||
|
||||
this.onDeviceInfoUpdate = null;
|
||||
this.onLocationInfoUpdate = null;
|
||||
|
||||
this.onControlStatusChange = null;
|
||||
this.onWsStatusChange = null;
|
||||
this.onHasControlRightChange = null;
|
||||
this.onRequestControlStatusChange = null;
|
||||
this.onPermissionRequest = null;
|
||||
this.onRoutePost = null;
|
||||
this.onIsFinished = null;
|
||||
this.handleArrivedPoint = null;
|
||||
|
||||
this.handleWsMessage = this.handleWsMessage.bind(this);
|
||||
this.handleWsStatus = this.handleWsStatus.bind(this);
|
||||
this.handleVisibilityChange = this.handleVisibilityChange.bind(this);
|
||||
this.handleBeforeUnload = this.handleBeforeUnload.bind(this);
|
||||
|
||||
this.sendGamepad = throttle(
|
||||
this.sendGamepad.bind(this),
|
||||
@@ -60,38 +55,36 @@ export default class DeviceController {
|
||||
this.unSubMessage = wsManager.onMessage(this.handleWsMessage);
|
||||
this.unSubStatus = wsManager.onStatusChange(this.handleWsStatus);
|
||||
|
||||
// ========== 【集成】页面可见性监听 ==========
|
||||
document.addEventListener('visibilitychange', this.handleVisibilityChange);
|
||||
document.addEventListener('beforeunload', this.handleBeforeUnload);
|
||||
}
|
||||
levae() {
|
||||
wsManager.close();
|
||||
|
||||
// ========== 【集成】后台保活定时 ==========
|
||||
//this.startKeepAlive();
|
||||
}
|
||||
|
||||
// ========== 【集成】页面切前台重连 ==========
|
||||
handleVisibilityChange() {
|
||||
// 切后台:关闭 WS
|
||||
if (document.visibilityState === 'hidden') {
|
||||
console.log('Page hidden, release control');
|
||||
console.log('🔌 页面切后台,关闭 WebSocket');
|
||||
//this.release();
|
||||
wsManager.close();
|
||||
this.connectedDeviceSn = null;
|
||||
|
||||
|
||||
this.isControlled = false;
|
||||
this.onControlStatusChange?.(false);
|
||||
}
|
||||
if (document.visibilityState === 'visible' && this.currentDevice) {
|
||||
if (!this.currentDevice?.serialNumber) return;
|
||||
console.log('Page visible, reconnect WebSocket');
|
||||
console.log('✅ 页面切回前台,自动重连 WebSocket');
|
||||
setTimeout(() => {
|
||||
this.connectDevice(this.currentDevice);
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
|
||||
handleBeforeUnload() {
|
||||
console.log('Browser closing/refreshing, release control');
|
||||
this.release();
|
||||
}
|
||||
|
||||
// ========== 【集成】后台保活 ==========
|
||||
startKeepAlive() {
|
||||
this.keepAliveInterval = setInterval(() => {
|
||||
if (
|
||||
@@ -99,50 +92,47 @@ export default class DeviceController {
|
||||
this.wsStatus !== 'connected' &&
|
||||
this.currentDevice?.serialNumber
|
||||
) {
|
||||
console.log('Keep alive: reconnect WebSocket');
|
||||
console.log('🔄 后台保活:尝试重连 WebSocket');
|
||||
this.connectDevice(this.currentDevice);
|
||||
}
|
||||
}, 8000);
|
||||
}
|
||||
release() {
|
||||
if (this.isControlled && this.connectedDeviceSn) {
|
||||
const data = {
|
||||
platform: "web",
|
||||
type: 1
|
||||
};
|
||||
const url = `${envConfig.baseURL}/forward/device/releaseControl`;
|
||||
|
||||
async release() {
|
||||
if (!this.connectedDeviceSn) return;
|
||||
const data = {
|
||||
platform: 'web',
|
||||
type: 1,
|
||||
deviceId: this.connectedDeviceSn,
|
||||
token: this.userInfo.token,
|
||||
};
|
||||
const url = `${envConfig.baseURL}/forward/device/releaseControl`;
|
||||
|
||||
try {
|
||||
await releaseControl(data);
|
||||
const blob = new Blob([JSON.stringify(data)], { type: 'application/json' });
|
||||
navigator.sendBeacon(url, blob);
|
||||
console.log('releaseControl sent');
|
||||
} catch (e) {
|
||||
console.error('Failed to send releaseControl:', e);
|
||||
try {
|
||||
const blob = new Blob([JSON.stringify(data)], { type: 'application/json' });
|
||||
navigator.sendBeacon(url, blob);
|
||||
} catch (e) {
|
||||
console.error('Failed to send releaseControl beacon:', e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
destroy() {
|
||||
this.clearControlTimeout();
|
||||
|
||||
// 清理保活
|
||||
if (this.keepAliveInterval) {
|
||||
clearInterval(this.keepAliveInterval);
|
||||
this.keepAliveInterval = null;
|
||||
}
|
||||
|
||||
// 移除监听
|
||||
document.removeEventListener('visibilitychange', this.handleVisibilityChange);
|
||||
document.removeEventListener('beforeunload', this.handleBeforeUnload);
|
||||
|
||||
this.release();
|
||||
this.levae();
|
||||
|
||||
this.unSubMessage?.();
|
||||
this.unSubStatus?.();
|
||||
//this.release();
|
||||
|
||||
//wsManager.close();
|
||||
this.connectedDeviceSn = null;
|
||||
|
||||
}
|
||||
|
||||
handleWsStatus(status) {
|
||||
@@ -158,6 +148,7 @@ export default class DeviceController {
|
||||
async connectDevice(device) {
|
||||
if (!device) return;
|
||||
|
||||
// 保存当前设备,用于保活/重连
|
||||
this.currentDevice = device;
|
||||
if (!device.serialNumber) return;
|
||||
|
||||
@@ -165,17 +156,31 @@ export default class DeviceController {
|
||||
|
||||
this.connectedDeviceSn = null;
|
||||
this.wsDeviceInfo = {};
|
||||
this.locationInfo = {};
|
||||
this.isControlled = false;
|
||||
this.onControlStatusChange?.(false);
|
||||
|
||||
wsManager.close();
|
||||
|
||||
try {
|
||||
console.log('Connecting to', this.wsUrl);
|
||||
const res = await getControlRight({
|
||||
userName: this.userInfo.username,
|
||||
sourceType: 1,
|
||||
token: this.userInfo.token,
|
||||
});
|
||||
|
||||
this.hasControlRight = res?.code === 200 && res.data == true;
|
||||
this.onHasControlRightChange?.(this.hasControlRight);
|
||||
|
||||
wsManager.connect(sn, this.wsUrl);
|
||||
this.connectedDeviceSn = sn;
|
||||
|
||||
if (!this.hasControlRight) {
|
||||
this.messageApi.warning(i18n.t('devices.fixed2OthersControlFixed2'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
await this.getControl(sn);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
@@ -183,42 +188,11 @@ export default class DeviceController {
|
||||
}
|
||||
}
|
||||
|
||||
async switchDevice(device) {
|
||||
if (!device) return;
|
||||
if (!device.serialNumber) return;
|
||||
|
||||
const newSn = device.serialNumber;
|
||||
|
||||
if (this.connectedDeviceSn === newSn && this.wsStatus === 'connected') {
|
||||
console.log('switchDevice: same device, skip');
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('Connecting to switchDevice: switching to', newSn);
|
||||
|
||||
this.currentDevice = device;
|
||||
this.connectedDeviceSn = newSn;
|
||||
this.wsDeviceInfo = {};
|
||||
this.locationInfo = {};
|
||||
this.isControlled = false;
|
||||
this.onControlStatusChange?.(false);
|
||||
|
||||
wsManager.send({
|
||||
type: 'AUTH',
|
||||
token: this.userInfo.token,
|
||||
userName: this.userInfo.username,
|
||||
deviceId: newSn,
|
||||
});
|
||||
|
||||
await this.getControl(newSn);
|
||||
}
|
||||
|
||||
async getControl(serialnum) {
|
||||
try {
|
||||
const res = await getJurisdiction({
|
||||
platform: 'web',
|
||||
deviceId: serialnum,
|
||||
token: this.userInfo.token,
|
||||
});
|
||||
|
||||
this.isControlled = res?.code === 200 && res?.data?.remoteControl === true;
|
||||
@@ -232,7 +206,10 @@ export default class DeviceController {
|
||||
|
||||
requestControl() {
|
||||
if (this.isRequestControl) return;
|
||||
|
||||
if (!this.hasControlRight) {
|
||||
this.messageApi.warning(i18n.t('devices.noneControl'));
|
||||
return;
|
||||
}
|
||||
|
||||
this.isRequestControl = true;
|
||||
this.onRequestControlStatusChange?.(true);
|
||||
@@ -275,7 +252,7 @@ export default class DeviceController {
|
||||
}
|
||||
|
||||
handleWsMessage(msg) {
|
||||
console.log('WS message:', msg);
|
||||
console.log('📨 收到消息:', msg);
|
||||
switch (msg.type) {
|
||||
case 'deviceInfo': {
|
||||
const data = {};
|
||||
@@ -286,15 +263,6 @@ export default class DeviceController {
|
||||
this.onDeviceInfoUpdate?.(data);
|
||||
break;
|
||||
}
|
||||
case 'locationInfo': {
|
||||
const data = {};
|
||||
msg.data.forEach((item) => {
|
||||
data[item.name] = item.value;
|
||||
});
|
||||
this.locationInfo = data;
|
||||
this.onLocationInfoUpdate?.(data);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'AUTH': {
|
||||
if (msg.isAuth) {
|
||||
@@ -309,7 +277,7 @@ export default class DeviceController {
|
||||
this.isRequestControl = false;
|
||||
this.onRequestControlStatusChange?.(false);
|
||||
|
||||
if (msg?.success === false || msg?.respond?.switchResult === false) {
|
||||
if (msg.success === false || msg?.respond?.switchResult === false) {
|
||||
this.isControlled = false;
|
||||
this.onControlStatusChange?.(false);
|
||||
this.messageApi.error({ key: 'control', content: msg.message || i18n.t('devices.controlFailed') });
|
||||
@@ -323,16 +291,19 @@ export default class DeviceController {
|
||||
case "device_task_change": {
|
||||
if (msg.deviceId != this.connectedDeviceSn) return;
|
||||
this.onIsFinished?.(true);
|
||||
console.log('task change:', msg);
|
||||
break;
|
||||
console.log('🔌 控制结果任务变更,', msg);
|
||||
|
||||
}
|
||||
//完成点
|
||||
case "device_task_arrive_point": {
|
||||
if (msg.deviceId != this.connectedDeviceSn) return;
|
||||
|
||||
this.handleArrivedPoint?.(msg.entity);
|
||||
console.log('arrive point:', msg);
|
||||
break;
|
||||
console.log('🔌 到达完成点,', msg);
|
||||
|
||||
}
|
||||
|
||||
|
||||
case 'switchPermission': {
|
||||
const platform = (msg.platform || '').toLowerCase();
|
||||
if (!platform || platform === 'null') return;
|
||||
@@ -359,14 +330,6 @@ export default class DeviceController {
|
||||
});
|
||||
break;
|
||||
|
||||
case 'route_post':
|
||||
console.log('route post:', msg);
|
||||
if (msg.deviceId) {
|
||||
this.onRoutePost?.(msg.data);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import React from 'react';
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import {
|
||||
ResponsiveContainer,
|
||||
LineChart,
|
||||
Line,
|
||||
XAxis,
|
||||
@@ -15,8 +14,10 @@ import {
|
||||
Bar,
|
||||
} from 'recharts';
|
||||
|
||||
|
||||
// =========================
|
||||
// 默认颜色池
|
||||
// =========================
|
||||
|
||||
const DEFAULT_COLORS = [
|
||||
'#1677ff',
|
||||
'#52c41a',
|
||||
@@ -29,11 +30,114 @@ const DEFAULT_COLORS = [
|
||||
];
|
||||
|
||||
|
||||
// =========================
|
||||
// 通用自适应容器
|
||||
// =========================
|
||||
//
|
||||
// 不再使用 ResponsiveContainer。
|
||||
// 通过 ResizeObserver 获取真实尺寸,
|
||||
// 只有 width / height > 0 时才渲染 Recharts。
|
||||
// 这样可以彻底避免:
|
||||
//
|
||||
// width(-1) and height(-1)
|
||||
//
|
||||
// =========================
|
||||
|
||||
const ChartResizeContainer = ({
|
||||
children,
|
||||
width = '100%',
|
||||
height = 360,
|
||||
className,
|
||||
style,
|
||||
}) => {
|
||||
const containerRef = useRef(null);
|
||||
|
||||
const [size, setSize] = useState({
|
||||
width: 0,
|
||||
height: 0,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
const element = containerRef.current;
|
||||
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
|
||||
const updateSize = () => {
|
||||
const rect = element.getBoundingClientRect();
|
||||
|
||||
const nextWidth = Math.floor(rect.width);
|
||||
const nextHeight = Math.floor(rect.height);
|
||||
|
||||
// 非法尺寸直接忽略
|
||||
if (nextWidth <= 0 || nextHeight <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
setSize((prev) => {
|
||||
if (
|
||||
prev.width === nextWidth &&
|
||||
prev.height === nextHeight
|
||||
) {
|
||||
return prev;
|
||||
}
|
||||
|
||||
return {
|
||||
width: nextWidth,
|
||||
height: nextHeight,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
// 首次主动测量
|
||||
updateSize();
|
||||
|
||||
// 后续监听尺寸变化
|
||||
const observer = new ResizeObserver(() => {
|
||||
updateSize();
|
||||
});
|
||||
|
||||
observer.observe(element);
|
||||
|
||||
return () => {
|
||||
observer.disconnect();
|
||||
};
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={containerRef}
|
||||
className={className}
|
||||
style={{
|
||||
width,
|
||||
height,
|
||||
minWidth: 0,
|
||||
minHeight: 0,
|
||||
boxSizing: 'border-box',
|
||||
overflow: 'hidden',
|
||||
...style,
|
||||
}}
|
||||
>
|
||||
{size.width > 0 && size.height > 0
|
||||
? React.cloneElement(children, {
|
||||
width: size.width,
|
||||
height: size.height,
|
||||
})
|
||||
: null}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// =========================
|
||||
// Universal Line Chart
|
||||
// =========================
|
||||
|
||||
export const UniversalLineChart = ({
|
||||
data,
|
||||
data = [],
|
||||
xKey,
|
||||
series,
|
||||
series = [],
|
||||
width = '100%',
|
||||
height = 360,
|
||||
showGrid = true,
|
||||
@@ -43,6 +147,7 @@ export const UniversalLineChart = ({
|
||||
smooth = true,
|
||||
dot = false,
|
||||
className,
|
||||
style,
|
||||
}) => {
|
||||
return (
|
||||
<div
|
||||
@@ -50,48 +155,80 @@ export const UniversalLineChart = ({
|
||||
style={{
|
||||
width,
|
||||
height,
|
||||
minWidth: 0,
|
||||
minHeight: 0,
|
||||
boxSizing: 'border-box',
|
||||
background: backgroundColor,
|
||||
borderRadius: 12,
|
||||
padding: 12,
|
||||
overflow: 'hidden',
|
||||
...style,
|
||||
}}
|
||||
>
|
||||
<ResponsiveContainer width="100%" height="100%">
|
||||
<ChartResizeContainer
|
||||
width="100%"
|
||||
height="100%"
|
||||
>
|
||||
<LineChart data={data}>
|
||||
{showGrid && (
|
||||
<CartesianGrid strokeDasharray="3 3" opacity={0.25} />
|
||||
<CartesianGrid
|
||||
strokeDasharray="3 3"
|
||||
opacity={0.25}
|
||||
/>
|
||||
)}
|
||||
|
||||
<XAxis dataKey={xKey} />
|
||||
|
||||
<YAxis />
|
||||
|
||||
{showTooltip && <Tooltip />}
|
||||
|
||||
{showLegend && <Legend />}
|
||||
|
||||
{series.map((item, index) => (
|
||||
<Line
|
||||
key={item.key}
|
||||
type={smooth ? 'monotone' : 'linear'}
|
||||
type={
|
||||
smooth
|
||||
? 'monotone'
|
||||
: 'linear'
|
||||
}
|
||||
dataKey={item.key}
|
||||
name={item.name}
|
||||
stroke={item.color || DEFAULT_COLORS[index % DEFAULT_COLORS.length]}
|
||||
strokeWidth={item.strokeWidth || 2}
|
||||
strokeDasharray={item.dashed ? '6 6' : undefined}
|
||||
stroke={
|
||||
item.color ||
|
||||
DEFAULT_COLORS[
|
||||
index %
|
||||
DEFAULT_COLORS.length
|
||||
]
|
||||
}
|
||||
strokeWidth={
|
||||
item.strokeWidth || 2
|
||||
}
|
||||
strokeDasharray={
|
||||
item.dashed
|
||||
? '6 6'
|
||||
: undefined
|
||||
}
|
||||
dot={dot}
|
||||
activeDot={{ r: 6 }}
|
||||
/>
|
||||
))}
|
||||
</LineChart>
|
||||
</ResponsiveContainer>
|
||||
</ChartResizeContainer>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// =========================
|
||||
// Universal Bar Chart
|
||||
// =========================
|
||||
|
||||
export const UniversalBarChart = ({
|
||||
data,
|
||||
data = [],
|
||||
xKey,
|
||||
series,
|
||||
series = [],
|
||||
width = '100%',
|
||||
height = 360,
|
||||
showGrid = true,
|
||||
@@ -102,6 +239,7 @@ export const UniversalBarChart = ({
|
||||
radius = 6,
|
||||
stack = false,
|
||||
className,
|
||||
style,
|
||||
}) => {
|
||||
return (
|
||||
<div
|
||||
@@ -109,21 +247,34 @@ export const UniversalBarChart = ({
|
||||
style={{
|
||||
width,
|
||||
height,
|
||||
minWidth: 0,
|
||||
minHeight: 0,
|
||||
boxSizing: 'border-box',
|
||||
background: backgroundColor,
|
||||
borderRadius: 12,
|
||||
padding: 12,
|
||||
overflow: 'hidden',
|
||||
...style,
|
||||
}}
|
||||
>
|
||||
<ResponsiveContainer width="100%" height="100%">
|
||||
<ChartResizeContainer
|
||||
width="100%"
|
||||
height="100%"
|
||||
>
|
||||
<BarChart data={data}>
|
||||
{showGrid && (
|
||||
<CartesianGrid strokeDasharray="3 3" opacity={0.25} />
|
||||
<CartesianGrid
|
||||
strokeDasharray="3 3"
|
||||
opacity={0.25}
|
||||
/>
|
||||
)}
|
||||
|
||||
<XAxis dataKey={xKey} />
|
||||
|
||||
<YAxis />
|
||||
|
||||
{showTooltip && <Tooltip />}
|
||||
|
||||
{showLegend && <Legend />}
|
||||
|
||||
{series.map((item, index) => (
|
||||
@@ -131,22 +282,35 @@ export const UniversalBarChart = ({
|
||||
key={item.key}
|
||||
dataKey={item.key}
|
||||
name={item.name}
|
||||
fill={item.color || DEFAULT_COLORS[index % DEFAULT_COLORS.length]}
|
||||
fill={
|
||||
item.color ||
|
||||
DEFAULT_COLORS[
|
||||
index %
|
||||
DEFAULT_COLORS.length
|
||||
]
|
||||
}
|
||||
barSize={barSize}
|
||||
radius={radius}
|
||||
stackId={stack ? 'stack' : undefined}
|
||||
stackId={
|
||||
stack
|
||||
? 'stack'
|
||||
: undefined
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</BarChart>
|
||||
</ResponsiveContainer>
|
||||
</ChartResizeContainer>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// =========================
|
||||
// Universal Pie Chart
|
||||
// =========================
|
||||
|
||||
export const UniversalPieChart = ({
|
||||
data,
|
||||
data = [],
|
||||
width = '100%',
|
||||
height = 360,
|
||||
showLegend = true,
|
||||
@@ -157,7 +321,7 @@ export const UniversalPieChart = ({
|
||||
paddingAngle = 2,
|
||||
showLabel = true,
|
||||
className,
|
||||
style
|
||||
style,
|
||||
}) => {
|
||||
return (
|
||||
<div
|
||||
@@ -165,15 +329,23 @@ export const UniversalPieChart = ({
|
||||
style={{
|
||||
width,
|
||||
height,
|
||||
minWidth: 0,
|
||||
minHeight: 0,
|
||||
boxSizing: 'border-box',
|
||||
background: backgroundColor,
|
||||
borderRadius: 12,
|
||||
padding: 12,
|
||||
...style
|
||||
overflow: 'hidden',
|
||||
...style,
|
||||
}}
|
||||
>
|
||||
<ResponsiveContainer width="100%" height="100%">
|
||||
<ChartResizeContainer
|
||||
width="100%"
|
||||
height="100%"
|
||||
>
|
||||
<PieChart>
|
||||
{showTooltip && <Tooltip />}
|
||||
|
||||
{showLegend && <Legend />}
|
||||
|
||||
<Pie
|
||||
@@ -190,37 +362,86 @@ export const UniversalPieChart = ({
|
||||
{data.map((entry, index) => (
|
||||
<Cell
|
||||
key={`cell-${index}`}
|
||||
fill={entry.color || DEFAULT_COLORS[index % DEFAULT_COLORS.length]}
|
||||
fill={
|
||||
entry.color ||
|
||||
DEFAULT_COLORS[
|
||||
index %
|
||||
DEFAULT_COLORS.length
|
||||
]
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</Pie>
|
||||
</PieChart>
|
||||
</ResponsiveContainer>
|
||||
</ChartResizeContainer>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// =========================
|
||||
// 使用示例
|
||||
// =========================
|
||||
|
||||
export const DemoCharts = () => {
|
||||
const lineData = [
|
||||
{ month: '1月', uv: 400, pv: 240, amt: 240 },
|
||||
{ month: '2月', uv: 300, pv: 456, amt: 300 },
|
||||
{ month: '3月', uv: 500, pv: 139, amt: 200 },
|
||||
{ month: '4月', uv: 278, pv: 390, amt: 278 },
|
||||
{ month: '5月', uv: 189, pv: 480, amt: 189 },
|
||||
{
|
||||
month: '1月',
|
||||
uv: 400,
|
||||
pv: 240,
|
||||
amt: 240,
|
||||
},
|
||||
{
|
||||
month: '2月',
|
||||
uv: 300,
|
||||
pv: 456,
|
||||
amt: 300,
|
||||
},
|
||||
{
|
||||
month: '3月',
|
||||
uv: 500,
|
||||
pv: 139,
|
||||
amt: 200,
|
||||
},
|
||||
{
|
||||
month: '4月',
|
||||
uv: 278,
|
||||
pv: 390,
|
||||
amt: 278,
|
||||
},
|
||||
{
|
||||
month: '5月',
|
||||
uv: 189,
|
||||
pv: 480,
|
||||
amt: 189,
|
||||
},
|
||||
];
|
||||
|
||||
const pieData = [
|
||||
{ name: 'Vue', value: 40 },
|
||||
{ name: 'React', value: 35 },
|
||||
{ name: 'Angular', value: 25 },
|
||||
{
|
||||
name: 'Vue',
|
||||
value: 40,
|
||||
},
|
||||
{
|
||||
name: 'React',
|
||||
value: 35,
|
||||
},
|
||||
{
|
||||
name: 'Angular',
|
||||
value: 25,
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<div className="grid grid-cols-1 gap-6 p-6">
|
||||
<div
|
||||
className="
|
||||
grid
|
||||
grid-cols-1
|
||||
gap-6
|
||||
p-6
|
||||
min-w-0
|
||||
"
|
||||
>
|
||||
<UniversalLineChart
|
||||
data={lineData}
|
||||
xKey="month"
|
||||
|
||||
388
src/components/reports/MachineDataReport.tsx
Normal file
388
src/components/reports/MachineDataReport.tsx
Normal file
@@ -0,0 +1,388 @@
|
||||
import React, { useEffect, useState, useMemo, useCallback } from 'react';
|
||||
import {
|
||||
Card, Row, Col, Select, DatePicker, Button, Space, Checkbox, Table, Tag,
|
||||
Typography, message, Empty, Spin
|
||||
} from 'antd';
|
||||
import {
|
||||
RobotOutlined, SearchOutlined, DownloadOutlined, LineChartOutlined
|
||||
} from '@ant-design/icons';
|
||||
import dayjs from 'dayjs';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useSelector } from 'react-redux';
|
||||
import { RootState } from '../../store';
|
||||
import { getSiteDevice } from '../../api/device';
|
||||
import { getDeviceRunningHistoryStatistics } from '../../api/machine';
|
||||
import { UniversalLineChart } from '../recharts';
|
||||
import utils from '@/lib/utils';
|
||||
|
||||
|
||||
const { RangePicker } = DatePicker;
|
||||
const { Option } = Select;
|
||||
const { Title } = Typography;
|
||||
|
||||
// 参数配置:i18n key + 后端字段 + 单位 + 颜色
|
||||
const PARAM_CONFIG = [
|
||||
{ key: 'voltage', labelKey: 'devices.rtVoltage', unit: 'V', color: '#1677ff' },
|
||||
{ key: 'leftCurrent', labelKey: 'devices.rtLeftMotor', unit: 'A', color: '#52c41a' },
|
||||
{ key: 'rightCurrent', labelKey: 'devices.rtRightMotor', unit: 'A', color: '#fa8c16' },
|
||||
{ key: 'leftMeasureSpeed', labelKey: 'devices.rtLeftSpeed', unit: 'rpm', color: '#eb2f96' },
|
||||
{ key: 'rightMeasureSpeed', labelKey: 'devices.rtRightSpeed', unit: 'rpm', color: '#722ed1' },
|
||||
{ key: 'leftMotorTemp', labelKey: 'devices.rtLeftTemp', unit: '℃', color: '#13c2c2' },
|
||||
{ key: 'rightMotorTemp', labelKey: 'devices.rtRightTemp', unit: '℃', color: '#f5222d' },
|
||||
{ key: 'chipTemp', labelKey: 'devices.rtMainTemp', unit: '℃', color: '#2f54eb' },
|
||||
];
|
||||
|
||||
// 默认选中全部参数
|
||||
const DEFAULT_PARAM_KEYS = PARAM_CONFIG.map(p => p.key);
|
||||
|
||||
// 兼容多种时间字段
|
||||
function getRowTime(row: any): string {
|
||||
const t = row.createTime || row.ts || row.timestamp || row.time || row.recordTime || row.collectTime;
|
||||
if (!t) return '';
|
||||
return dayjs(typeof t === 'number' ? t : String(t)).format('YYYY-MM-DD HH:mm:ss');
|
||||
}
|
||||
|
||||
// 兼容多种返回结构
|
||||
function extractRows(res: any): any[] {
|
||||
if (!res) return [];
|
||||
if (Array.isArray(res)) return res;
|
||||
if (Array.isArray(res.rows)) return res.rows;
|
||||
if (Array.isArray(res.data)) return res.data;
|
||||
if (res.data && Array.isArray(res.data.list)) return res.data.list;
|
||||
if (res.data && Array.isArray(res.data.records)) return res.data.records;
|
||||
return [];
|
||||
}
|
||||
|
||||
export default function MachineDataReport() {
|
||||
const { t } = useTranslation();
|
||||
const { stationId, currentStation } = useSelector((state: RootState) => state.station);
|
||||
|
||||
const [deviceList, setDeviceList] = useState<any[]>([]);
|
||||
const [deviceLoading, setDeviceLoading] = useState(false);
|
||||
const [selectedDeviceSn, setSelectedDeviceSn] = useState<string | undefined>();
|
||||
const [dateRange, setDateRange] = useState<[dayjs.Dayjs, dayjs.Dayjs]>([
|
||||
dayjs().startOf('day'),
|
||||
dayjs(),
|
||||
]);
|
||||
const [selectedParams, setSelectedParams] = useState<string[]>(DEFAULT_PARAM_KEYS);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [rawRows, setRawRows] = useState<any[]>([]);
|
||||
|
||||
// 获取机器人列表
|
||||
const fetchDevices = useCallback(async () => {
|
||||
if (!stationId) return;
|
||||
setDeviceLoading(true);
|
||||
try {
|
||||
const res = await getSiteDevice({
|
||||
siteId: stationId,
|
||||
pageSize: 9999,
|
||||
pageNum: 1,
|
||||
orgId: currentStation?.orgId,
|
||||
});
|
||||
const rows = res?.code === 200 ? (res.rows || []) : [];
|
||||
setDeviceList(rows);
|
||||
if (rows.length > 0) {
|
||||
setSelectedDeviceSn(rows[0].serialNumber);
|
||||
} else {
|
||||
setSelectedDeviceSn(undefined);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('fetch devices failed', e);
|
||||
} finally {
|
||||
setDeviceLoading(false);
|
||||
}
|
||||
}, [stationId, currentStation, selectedDeviceSn]);
|
||||
|
||||
useEffect(() => {
|
||||
fetchDevices();
|
||||
}, [fetchDevices]);
|
||||
|
||||
// 查询报表数据
|
||||
const handleQuery = useCallback(async () => {
|
||||
if (!selectedDeviceSn) {
|
||||
utils.message.warning(t('report.selectRobot'));
|
||||
return;
|
||||
}
|
||||
if (selectedParams.length === 0) {
|
||||
utils.message.warning(t('report.selectParameters'));
|
||||
return;
|
||||
}
|
||||
setLoading(true);
|
||||
try {
|
||||
const params: any = {
|
||||
deviceId: selectedDeviceSn,
|
||||
|
||||
startTime: dateRange[0].format('YYYY-MM-DD HH:mm:ss'),
|
||||
endTime: dateRange[1].format('YYYY-MM-DD HH:mm:ss'),
|
||||
};
|
||||
const res = await getDeviceRunningHistoryStatistics(params);
|
||||
const rows = extractRows(res);
|
||||
setRawRows(rows);
|
||||
if (rows.length === 0) {
|
||||
utils.message.info(t('common.noData'));
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('fetch intraday data failed', e);
|
||||
utils.message.error(t('common.noData'));
|
||||
setRawRows([]);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}, [selectedDeviceSn, dateRange, selectedParams, t]);
|
||||
|
||||
// 进入页面自动查询一次(如果有默认设备)
|
||||
useEffect(() => {
|
||||
if (selectedDeviceSn && dateRange) {
|
||||
handleQuery();
|
||||
}
|
||||
}, [selectedDeviceSn]);
|
||||
|
||||
// 整理图表数据:每行 { time, [paramKey]: value }
|
||||
const chartData = useMemo(() => {
|
||||
return rawRows.map(row => {
|
||||
const item: any = { time: getRowTime(row) };
|
||||
selectedParams.forEach(k => {
|
||||
const v = row[k];
|
||||
item[k] = (typeof v === 'number') ? v : (v != null ? Number(v) : null);
|
||||
});
|
||||
return item;
|
||||
}).sort((a, b) => (a.time < b.time ? -1 : a.time > b.time ? 1 : 0));
|
||||
}, [rawRows, selectedParams]);
|
||||
|
||||
// 图表 series 配置
|
||||
const chartSeries = useMemo(() => {
|
||||
return PARAM_CONFIG
|
||||
.filter(p => selectedParams.includes(p.key))
|
||||
.map(p => ({
|
||||
key: p.key,
|
||||
name: `${t(p.labelKey)}(${p.unit})`,
|
||||
color: p.color,
|
||||
}));
|
||||
}, [selectedParams, t]);
|
||||
|
||||
// 表格列
|
||||
const tableColumns = useMemo(() => {
|
||||
const cols: any[] = [
|
||||
{
|
||||
title: t('report.generateTime') || '时间',
|
||||
dataIndex: '_time',
|
||||
key: '_time',
|
||||
width: 180,
|
||||
fixed: 'left',
|
||||
render: (v: string) => v || '-',
|
||||
},
|
||||
];
|
||||
PARAM_CONFIG
|
||||
.filter(p => selectedParams.includes(p.key))
|
||||
.forEach(p => {
|
||||
cols.push({
|
||||
title: `${t(p.labelKey)}(${p.unit})`,
|
||||
dataIndex: p.key,
|
||||
key: p.key,
|
||||
width: 140,
|
||||
render: (v: any) => (v != null && !isNaN(Number(v))) ? Number(v).toFixed(2) : '-',
|
||||
});
|
||||
});
|
||||
return cols;
|
||||
}, [selectedParams, t]);
|
||||
|
||||
// 表格数据源
|
||||
const tableData = useMemo(() => {
|
||||
return rawRows.map((row, idx) => {
|
||||
const item: any = {
|
||||
key: idx,
|
||||
_time: getRowTime(row),
|
||||
};
|
||||
PARAM_CONFIG.forEach(p => {
|
||||
const v = row[p.key];
|
||||
item[p.key] = (typeof v === 'number') ? v : (v != null ? Number(v) : null);
|
||||
});
|
||||
return item;
|
||||
}).sort((a, b) => (a._time < b._time ? -1 : a._time > b._time ? 1 : 0));
|
||||
}, [rawRows]);
|
||||
|
||||
// 导出 CSV
|
||||
const handleExport = useCallback(() => {
|
||||
if (tableData.length === 0) {
|
||||
utils.message.warning(t('common.noData'));
|
||||
return;
|
||||
}
|
||||
const headers = tableColumns.map((c: any) => c.title);
|
||||
const keys = tableColumns.map((c: any) => c.dataIndex);
|
||||
const lines = [headers.join(',')];
|
||||
tableData.forEach(row => {
|
||||
lines.push(keys.map(k => {
|
||||
const v = row[k];
|
||||
if (v == null) return '';
|
||||
const s = typeof v === 'number' ? v.toFixed(2) : String(v);
|
||||
return `"${s.replace(/"/g, '""')}"`;
|
||||
}).join(','));
|
||||
});
|
||||
const csv = '\uFEFF' + lines.join('\r\n');
|
||||
const blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' });
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = document.createElement('a');
|
||||
const deviceName = deviceList.find(d => d.serialNumber === selectedDeviceSn)?.deviceAlias || selectedDeviceSn || 'machine';
|
||||
a.href = url;
|
||||
a.download = `machine_data_${deviceName}_${dayjs().format('YYYYMMDD_HHmmss')}.csv`;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
URL.revokeObjectURL(url);
|
||||
}, [tableData, tableColumns, deviceList, selectedDeviceSn, t]);
|
||||
|
||||
const cardStyle = {
|
||||
borderRadius: 12,
|
||||
border: '1px solid #f0f0f0',
|
||||
boxShadow: '0 4px 12px rgba(0,0,0,0.05)',
|
||||
};
|
||||
|
||||
return (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
|
||||
{/* 筛选栏 */}
|
||||
<Card bordered={false} style={cardStyle} bodyStyle={{ padding: '16px 20px' }}>
|
||||
<div style={{ display: 'flex', alignItems: 'center', flexWrap: 'wrap', gap: 20 }}>
|
||||
<div style={{ display: 'flex', alignItems: 'center' }}>
|
||||
<span style={{ fontSize: 13, color: '#86909C', marginRight: 8, whiteSpace: 'nowrap' }}>
|
||||
<RobotOutlined style={{ marginRight: 4 }} />{t('report.selectRobot')}:
|
||||
</span>
|
||||
<Select
|
||||
showSearch
|
||||
value={selectedDeviceSn}
|
||||
onChange={setSelectedDeviceSn}
|
||||
style={{ width: 420 }}
|
||||
placeholder={t('common.pleaseSelect')}
|
||||
loading={deviceLoading}
|
||||
optionFilterProp="children"
|
||||
filterOption={(input, option) =>
|
||||
String(option?.children ?? '').toLowerCase().includes(input.toLowerCase())
|
||||
}
|
||||
>
|
||||
{deviceList.map((d) => (
|
||||
<Option key={d.serialNumber} value={d.serialNumber}>
|
||||
{d.deviceAlias || d.deviceName || d.serialNumber}
|
||||
</Option>
|
||||
))}
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
<div style={{ display: 'flex', alignItems: 'center' }}>
|
||||
<span style={{ fontSize: 13, color: '#86909C', marginRight: 8, whiteSpace: 'nowrap' }}>
|
||||
{t('common.timeRange')}:
|
||||
</span>
|
||||
<RangePicker
|
||||
showTime
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
value={dateRange}
|
||||
onChange={(v) => v && v[0] && v[1] && setDateRange([v[0], v[1]])}
|
||||
style={{ width: 380 }}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div style={{ display: 'flex', alignItems: 'center' }}>
|
||||
<span style={{ fontSize: 13, color: '#86909C', marginRight: 8, whiteSpace: 'nowrap' }}>
|
||||
{t('report.selectParameters')}:
|
||||
</span>
|
||||
<Checkbox.Group
|
||||
value={selectedParams}
|
||||
onChange={(v) => setSelectedParams(v as string[])}
|
||||
style={{ maxWidth: 700 }}
|
||||
>
|
||||
<Row gutter={[8, 4]}>
|
||||
{PARAM_CONFIG.map(p => (
|
||||
<Col key={p.key}>
|
||||
<Checkbox value={p.key}>{t(p.labelKey)}</Checkbox>
|
||||
</Col>
|
||||
))}
|
||||
</Row>
|
||||
</Checkbox.Group>
|
||||
</div>
|
||||
|
||||
<div style={{ marginLeft: 'auto' }}>
|
||||
<Space size={8}>
|
||||
<Button
|
||||
type="primary"
|
||||
icon={<SearchOutlined />}
|
||||
onClick={handleQuery}
|
||||
loading={loading}
|
||||
style={{ borderRadius: 6, height: 32, padding: '0 16px' }}
|
||||
>
|
||||
{t('report.query')}
|
||||
</Button>
|
||||
<Button
|
||||
icon={<DownloadOutlined />}
|
||||
onClick={handleExport}
|
||||
disabled={tableData.length === 0}
|
||||
style={{ borderRadius: 6, height: 32, color: '#00B42A', borderColor: '#00B42A' }}
|
||||
>
|
||||
{t('report.exportTable')}
|
||||
</Button>
|
||||
</Space>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
{/* 统计曲线图 */}
|
||||
<Card
|
||||
bordered={false}
|
||||
style={cardStyle}
|
||||
bodyStyle={{ padding: '20px' }}
|
||||
title={
|
||||
<Space>
|
||||
<LineChartOutlined style={{ color: '#165DFF' }} />
|
||||
<span style={{ fontSize: 15, fontWeight: 700, color: '#1D2129' }}>
|
||||
{t('report.aiAnalysisStatistics')}
|
||||
</span>
|
||||
</Space>
|
||||
}
|
||||
extra={
|
||||
selectedParams.length > 0 && (
|
||||
<span style={{ fontSize: 12, color: '#86909C' }}>
|
||||
{t('common.total', { count: chartData.length })} {t('report.unitItem')}
|
||||
</span>
|
||||
)
|
||||
}
|
||||
>
|
||||
<Spin spinning={loading}>
|
||||
{chartData.length > 0 && chartSeries.length > 0 ? (
|
||||
<UniversalLineChart
|
||||
data={chartData}
|
||||
xKey="time"
|
||||
series={chartSeries}
|
||||
height={420}
|
||||
/>
|
||||
) : (
|
||||
<Empty
|
||||
style={{ margin: '60px 0' }}
|
||||
description={loading ? '' : t('common.noData')}
|
||||
/>
|
||||
)}
|
||||
</Spin>
|
||||
</Card>
|
||||
|
||||
{/* 数据表格 */}
|
||||
<Card
|
||||
bordered={false}
|
||||
style={cardStyle}
|
||||
bodyStyle={{ padding: 0 }}
|
||||
title={
|
||||
<span style={{ fontSize: 15, fontWeight: 700, color: '#1D2129' }}>
|
||||
{t('report.machineRecords')}
|
||||
</span>
|
||||
}
|
||||
>
|
||||
<Table
|
||||
rowKey="key"
|
||||
columns={tableColumns}
|
||||
dataSource={tableData}
|
||||
size="small"
|
||||
loading={loading}
|
||||
scroll={{ x: 'max-content', y: 400 }}
|
||||
pagination={{ pageSize: 20, showSizeChanger: true, showTotal: (total) => `${total}` }}
|
||||
className="compact-table"
|
||||
locale={{ emptyText: t('common.noData') }}
|
||||
/>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
35
src/lib/geoServer.ts
Normal file
35
src/lib/geoServer.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import envConfig from '../../env';
|
||||
|
||||
// 获取发布图层列表
|
||||
// 通过 GetCapabilities 解析 WMS 发布的所有图层(workspace:layer)
|
||||
export function fetchPublishedLayers(): Promise<{ name: string; title: string }[]> {
|
||||
const baseUrl = envConfig.geoserver_url;
|
||||
const getCapabilitiesUrl = `${baseUrl}/wms?service=WMS&version=1.1.1&request=GetCapabilities`;
|
||||
|
||||
return fetch(getCapabilitiesUrl)
|
||||
.then(response => response.text())
|
||||
.then(xmlText => {
|
||||
const parser = new DOMParser();
|
||||
const xmlDoc = parser.parseFromString(xmlText, 'text/xml');
|
||||
const layerElements = xmlDoc.getElementsByTagName('Layer');
|
||||
const uniqueLayerNames = new Set();
|
||||
const publishedLayers: { name: string; title: string }[] = [];
|
||||
|
||||
for (let i = 0; i < layerElements.length; i++) {
|
||||
const layer = layerElements[i];
|
||||
const nameElement = layer.getElementsByTagName('Name')[0];
|
||||
const titleElement = layer.getElementsByTagName('Title')[0];
|
||||
if (nameElement && nameElement.textContent) {
|
||||
const layerName = nameElement.textContent;
|
||||
if (layerName.includes(':') && !uniqueLayerNames.has(layerName)) {
|
||||
uniqueLayerNames.add(layerName);
|
||||
publishedLayers.push({
|
||||
name: layerName,
|
||||
title: titleElement ? titleElement.textContent : layerName
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
return publishedLayers;
|
||||
});
|
||||
}
|
||||
@@ -241,7 +241,6 @@ const en = {
|
||||
},
|
||||
devices: {
|
||||
deviceManagement: 'Device Management',
|
||||
distributable: 'Distributable',
|
||||
deviceOverview: 'Device Overview',
|
||||
deviceStatus: 'Device Status',
|
||||
waylineTask: 'Wayline Tasks',
|
||||
@@ -660,8 +659,6 @@ const en = {
|
||||
optimize: 'Optimize',
|
||||
optionalEmpty: 'Optional Empty',
|
||||
otherWebControlling: 'Other Web Controlling',
|
||||
platformRequestControl: "{{platform}} platformRequestControl",
|
||||
|
||||
outDock: 'Out Dock',
|
||||
outdoor: 'Outdoor',
|
||||
panorama: 'Panorama',
|
||||
@@ -992,9 +989,6 @@ const en = {
|
||||
working: 'Working',
|
||||
workingCurrent: 'Working Current',
|
||||
zoomLens: 'Zoom Lens',
|
||||
controllerNotConnected: "controllerNotConnected",
|
||||
otherWebConnected: "otherWebConnected",
|
||||
clickToRequestControl: "clickToRequestControl",
|
||||
|
||||
fixed2TaskSuspended2: 'Fixed2 Task Suspended2 态势',
|
||||
|
||||
@@ -1033,6 +1027,7 @@ const en = {
|
||||
s62: 'Signal/Satellite',
|
||||
|
||||
s72: 'Wind Speed',
|
||||
distributable: 'Distributable',
|
||||
UnitsRobot: '',
|
||||
UnitsDrone: '',
|
||||
executing: 'Executing',
|
||||
@@ -1287,10 +1282,9 @@ const en = {
|
||||
|
||||
failedFixed22: '权限校验 Failed Fixed2',
|
||||
|
||||
noneControl: 'None Control jurisdiction',
|
||||
noneControl: 'None Control 权限',
|
||||
|
||||
fixed2ControlFixed2: 'Fixed2 Control 请求 超时 Fixed2',
|
||||
controlFailed: "controlFailed",
|
||||
},
|
||||
video: {
|
||||
onlineVideo: 'Online Video',
|
||||
@@ -2274,7 +2268,12 @@ const en = {
|
||||
totalWorkOrders: 'Total Work Orders',
|
||||
completionRate: 'Completion Rate',
|
||||
averageEfficiency: 'Average Efficiency',
|
||||
aiAnalysisReport: 'ai Analysis Report',
|
||||
machineAnalysisReport: 'Machine Data Report',
|
||||
selectRobot: 'Select Robot',
|
||||
selectParameters: 'Select Parameters',
|
||||
query: 'Query',
|
||||
exportTable: 'Export Table',
|
||||
machineRecords: 'Machine Records',
|
||||
aiAnalysisStatistics: 'ai Analysis Statistics',
|
||||
aiDiagnosisDaily: 'ai Diagnosis Daily',
|
||||
alarmCount: 'Alarm Count',
|
||||
@@ -3060,7 +3059,11 @@ const en = {
|
||||
|
||||
s412: 'Auto Backup',
|
||||
|
||||
s110: 'Boundary Drawing',
|
||||
BoundaryDrawing: 'Boundary Drawing',
|
||||
|
||||
s110: 'Unbind person',
|
||||
mappingLayer: 'Mapped Layer',
|
||||
mappingLayerPlaceholder: 'Select a published layer to map',
|
||||
|
||||
fixed2Camera2: 'Total Cameras',
|
||||
|
||||
|
||||
@@ -237,14 +237,13 @@ const zh = {
|
||||
|
||||
failedFixed2: '❌ 工单生成接口调用失败',
|
||||
solarPanel: "组件阵列",
|
||||
weatherStation: "气象站",
|
||||
WeatherStation: "气象站",
|
||||
environmentalSensor: "环境传感器",
|
||||
distributable: "可调度",
|
||||
|
||||
},
|
||||
devices: {
|
||||
deviceManagement: '设备管理',
|
||||
distributable: '可调度',
|
||||
deviceOverview: '设备总览',
|
||||
deviceStatus: '设备状态',
|
||||
waylineTask: '航线任务',
|
||||
@@ -488,9 +487,10 @@ const zh = {
|
||||
connectionFailed: '连接失败',
|
||||
controlLogTitle: '控制日志标题',
|
||||
controlRequestContent: '控制请求内容',
|
||||
controllerNotConnected: "控制器未连接",
|
||||
countUnit: '数量单位',
|
||||
coverClosed: '覆盖已关闭',
|
||||
coverOpen: '覆盖打开',
|
||||
coverClosed: '已关闭',
|
||||
coverOpen: '打开',
|
||||
coverageEquipment: '覆盖设备',
|
||||
coverageValue: '{{types}}/{{units}}',
|
||||
createSuccess: '创建成功',
|
||||
@@ -559,12 +559,6 @@ const zh = {
|
||||
fillRequiredFields: '填写必填字段',
|
||||
firmwareVersion: '固件版本',
|
||||
fixed: '固定',
|
||||
controllerNotConnected: "控制器未连接",
|
||||
otherWebConnected: "其他网页已连接",
|
||||
clickToRequestControl: "点击请求控制",
|
||||
|
||||
controlling: "控制中",
|
||||
|
||||
fixed2: '',
|
||||
fixedEnv: '固定环境',
|
||||
flightAltitude: '飞行高度',
|
||||
@@ -586,7 +580,7 @@ const zh = {
|
||||
headingAngle: '航向角度',
|
||||
horizontalSpeed: '水平速度',
|
||||
hotspotSuspect: '热斑疑似',
|
||||
inDock: '内停靠',
|
||||
inDock: '舱内',
|
||||
inProgressDesc: '进行中',
|
||||
indoor: '室内',
|
||||
inputCustomAlias: '输入自定义别名',
|
||||
@@ -673,7 +667,9 @@ const zh = {
|
||||
optimize: '优化',
|
||||
optionalEmpty: '可选空',
|
||||
otherWebControlling: '其他网页控制中',
|
||||
outDock: '外停靠',
|
||||
controlling: "控制中",
|
||||
clickToRequestControl: "点击请求控制",
|
||||
outDock: '舱外',
|
||||
outdoor: '室外',
|
||||
panorama: '全景',
|
||||
paramArmChannel: '参数布防渠道',
|
||||
@@ -1303,9 +1299,6 @@ const zh = {
|
||||
cancel: "取消",
|
||||
UnitsRobot: "台",
|
||||
UnitsDrone: "架",
|
||||
platformRequestControl: "{{platform}} 正在请求控制权限",
|
||||
controlFailed: "controlFailed",
|
||||
|
||||
},
|
||||
video: {
|
||||
onlineVideo: '在线视频',
|
||||
@@ -2303,7 +2296,13 @@ const zh = {
|
||||
totalWorkOrders: '工单总数',
|
||||
completionRate: '完成率',
|
||||
averageEfficiency: '平均效率',
|
||||
aiAnalysisReport: 'AI分析报表',
|
||||
machineAnalysisReport: '机器数据报表',
|
||||
selectRobot: '机器人',
|
||||
selectParameters: '选择参数',
|
||||
query: '查询',
|
||||
exportTable: '导出表格',
|
||||
machineRecords: '机器记录',
|
||||
|
||||
aiAnalysisStatistics: 'AI分析统计',
|
||||
aiDiagnosisDaily: 'AI诊断每日',
|
||||
alarmCount: '告警数量',
|
||||
@@ -2646,7 +2645,7 @@ const zh = {
|
||||
|
||||
s28: '开启钉钉推送时必须填写加密密钥',
|
||||
|
||||
fixed2OM: '运维工程师',
|
||||
fixed2OM: '普通用户',
|
||||
|
||||
fixed2Inspection: '巡检区',
|
||||
|
||||
@@ -3087,15 +3086,19 @@ const zh = {
|
||||
|
||||
s282: '最近更新',
|
||||
|
||||
fixed2Inspection2: '巡检主管',
|
||||
fixed2Inspection2: '机构管理员',
|
||||
|
||||
s322: '数据分析师',
|
||||
s322: '场站管理员',
|
||||
|
||||
fixed2Login2: '登录审计',
|
||||
|
||||
s412: '自动备份',
|
||||
|
||||
s110: '边界绘制',
|
||||
s110: '人员',
|
||||
BoundaryDrawing: '边界绘制',
|
||||
|
||||
mappingLayer: '映射图层',
|
||||
mappingLayerPlaceholder: '请选择要映射的发布图层',
|
||||
|
||||
fixed2Camera2: '摄像头总数',
|
||||
|
||||
@@ -3425,7 +3428,7 @@ const zh = {
|
||||
roleNamePlaceholder: '角色名称占位',
|
||||
rolePermission: '角色权限',
|
||||
roleSortLabel: '角色排序标签',
|
||||
superAdmin: '超级管理员',
|
||||
superAdmin: '平台管理员',
|
||||
},
|
||||
constants: {
|
||||
// 工单类型
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useEffect, useRef } from 'react';
|
||||
import React, { useState, useEffect, useRef } from 'react';
|
||||
import { Card, Row, Col, Statistic, Button, Space, Tag, Typography, Table, message } from 'antd';
|
||||
import {
|
||||
CloudOutlined, ThunderboltOutlined, BarChartOutlined,
|
||||
@@ -471,7 +471,7 @@ export default function StationDashboard() {
|
||||
{ name: t('home.solarPanel'), count: '320/320', icon: <AppstoreOutlined /> },
|
||||
{ name: t('home.inverter'), count: '5/5', icon: <ThunderboltOutlined /> },
|
||||
{ name: t('home.combinerBox'), count: '20/20', icon: <BranchesOutlined /> },
|
||||
{ name: t('home.weatherStation'), count: '1/1', icon: <CloudOutlined /> },
|
||||
{ name: t('home.WeatherStation'), count: '1/1', icon: <CloudOutlined /> },
|
||||
{ name: t('devices.camera'), count: '12/12', icon: <VideoCameraOutlined /> },
|
||||
{ name: t('home.environmentalSensor'), count: '8/8', icon: <ExperimentOutlined /> },
|
||||
{ name: t('constants.uav'), count: '1/1', icon: <RocketOutlined /> },
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState } from 'react';
|
||||
import React, { useState } from 'react';
|
||||
import {
|
||||
Card, Row, Col, Table, Select, Input, Tag,
|
||||
Typography, Button, Space, Avatar, Pagination
|
||||
|
||||
@@ -20,6 +20,7 @@ import dayjs from 'dayjs';
|
||||
import { ChevronRight } from 'lucide-react';
|
||||
import { UniversalBarChart, UniversalLineChart, UniversalPieChart } from '../components/recharts';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import MachineDataReport from '../components/reports/MachineDataReport';
|
||||
|
||||
const { TabPane } = Tabs;
|
||||
const { RangePicker } = DatePicker;
|
||||
@@ -207,405 +208,409 @@ export default function ReportCenterPage() {
|
||||
<TabPane tab={t('report.generationReport')} key="power" />
|
||||
<TabPane tab={t('report.operationReport')} key="operation" />
|
||||
<TabPane tab={t('report.alertReport')} key="alarm" />
|
||||
<TabPane tab={t('report.aiAnalysisReport')} key="ai" />
|
||||
<TabPane tab={t('report.machineAnalysisReport')} key="ai" />
|
||||
</Tabs>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<Row
|
||||
gutter={[12, 12]}
|
||||
style={{
|
||||
marginBottom: 8,
|
||||
flexWrap: 'wrap',
|
||||
}}
|
||||
>
|
||||
{overviewCards.map((card, idx) => (
|
||||
<Col key={idx} style={{ minWidth: '180px', flex: '1 0 auto', }}>
|
||||
<Card
|
||||
bordered={false}
|
||||
bodyStyle={{ padding: '20px 20px', display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}
|
||||
style={{ borderRadius: 8, boxShadow: '0 2px 8px rgba(0,0,0,0.06)' }}
|
||||
>
|
||||
{/* 左侧文字区域 */}
|
||||
<div style={{ flex: 1, display: 'flex', flexDirection: 'column', alignItems: 'flex-start' }}>
|
||||
<div style={{ fontSize: 14, color: '#86909C', marginBottom: 8, fontWeight: 500 }}>
|
||||
{card.title}
|
||||
</div>
|
||||
<div style={{ fontSize: 28, fontWeight: 700, color: card.color, lineHeight: 1, marginBottom: 8 }}>
|
||||
{card.value}
|
||||
<span style={{ fontSize: 14, fontWeight: 500, marginLeft: 2, color: '#1D2129' }}>{card.unit}</span>
|
||||
</div>
|
||||
{/* 底部环比/备注 */}
|
||||
<div style={{ fontSize: 12, color: '#86909C', fontWeight: 500 }}>
|
||||
{card.trend}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 右侧圆形图标区域 */}
|
||||
|
||||
<div
|
||||
style={{
|
||||
width: 48,
|
||||
height: 48,
|
||||
borderRadius: '50%',
|
||||
backgroundColor: card.iconBg || '#f0f7ff',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
flexShrink: 0,
|
||||
marginLeft: 8
|
||||
}}
|
||||
>
|
||||
{card.icon}
|
||||
</div>
|
||||
|
||||
</Card>
|
||||
</Col>
|
||||
))}
|
||||
</Row>
|
||||
|
||||
{/* 筛选栏 */}
|
||||
<div style={{ display: 'flex', alignItems: 'center', marginBottom: 8, gap: 20, flexWrap: 'wrap' }}>
|
||||
<div style={{ display: 'flex', alignItems: 'center' }}>
|
||||
<span className="filter-label">{t('report.reportCycle')}:</span>
|
||||
<Select value={reportCycle} onChange={setReportCycle} style={{ width: 100 }} size="small">
|
||||
<Option value="day">{t('report.daily')}</Option>
|
||||
<Option value="week">{t('report.weekly')}</Option>
|
||||
<Option value="month">{t('report.monthly')}</Option>
|
||||
</Select>
|
||||
</div>
|
||||
<div style={{ display: 'flex', alignItems: 'center' }}>
|
||||
<span className="filter-label">{t('report.reportType')}:</span>
|
||||
<Select value={reportType} onChange={setReportType} style={{ width: 120 }} size="small">
|
||||
<Option value="all">{t('common.all')}</Option>
|
||||
<Option value="power">{t('report.generationReport')}</Option>
|
||||
<Option value="operation">{t('report.operationReport')}</Option>
|
||||
<Option value="alarm">{t('report.alertReport')}</Option>
|
||||
<Option value="ai">{t('report.aiAnalysisReport')}</Option>
|
||||
</Select>
|
||||
</div>
|
||||
<div style={{ display: 'flex', alignItems: 'center' }}>
|
||||
<span className="filter-label">{t('report.dateRange')}:</span>
|
||||
<RangePicker
|
||||
value={dateRange}
|
||||
onChange={setDateRange}
|
||||
style={{ width: 260 }}
|
||||
size="small"
|
||||
/>
|
||||
</div>
|
||||
<div style={{ marginLeft: 'auto' }}>
|
||||
<Space size={12}>
|
||||
<Button type="primary" icon={<FileTextOutlined />} size="small" style={{ borderRadius: 6, height: 32, padding: '0 16px' }}>{t('report.generateReport')}</Button>
|
||||
<Button icon={<FilePdfOutlined />} size="small" style={{ borderRadius: 6, height: 32, color: '#F53F3F', borderColor: '#F53F3F' }}>{t('report.exportPdf')}</Button>
|
||||
<Button icon={<FileExcelOutlined />} size="small" style={{ borderRadius: 6, height: 32, color: '#00B42A', borderColor: '#00B42A' }}>{t('report.exportExcel')}</Button>
|
||||
</Space>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Row gutter={[8, 8]}>
|
||||
{/* 左侧主内容区 */}
|
||||
<Col xs={24} xl={16} >
|
||||
{/* 月度综合经营分析 */}
|
||||
<Card bordered={false} style={cardStyle} bodyStyle={{ padding: '20px' }} title={<span style={{ fontSize: 15, fontWeight: 700, color: '#1D2129' }}>{t('report.monthlyOperationAnalysis')}</span>}>
|
||||
<Row gutter={24}>
|
||||
<Col span={17}>
|
||||
<div style={{ fontSize: 11, color: '#86909C', marginBottom: 16, display: 'flex', justifyContent: 'flex-start', gap: 20 }}>
|
||||
<Space size={4}><div style={{ width: 10, height: 3, background: '#00B42A' }}></div>{t('report.generation')} (MWh)</Space>
|
||||
<Space size={4}><div style={{ width: 10, height: 1, borderTop: '1.5px dashed #165DFF' }}></div>{t('report.predictedGeneration')} (MWh)</Space>
|
||||
<Space size={4}><div style={{ width: 10, height: 1, borderTop: '1.5px solid #FF7D00' }}></div>PR (%)</Space>
|
||||
</div>
|
||||
<UniversalLineChart
|
||||
data={monthlyPowerData}
|
||||
xKey="date"
|
||||
height={260}
|
||||
series={[
|
||||
{
|
||||
key: 'generation',
|
||||
name: t('report.generation') + '(MWh)',
|
||||
color: '#52c41a',
|
||||
},
|
||||
{
|
||||
key: 'predicted',
|
||||
name: t('report.predictedGeneration') + '(MWh)',
|
||||
color: '#1890ff',
|
||||
dashed: true,
|
||||
},
|
||||
{
|
||||
key: 'pr',
|
||||
name: 'PR(%)',
|
||||
color: '#fa8c16',
|
||||
strokeWidth: 2,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</Col>
|
||||
<Col span={7}>
|
||||
<div style={{ background: '#f8fafc', padding: '16px', borderRadius: 12, height: '100%' }}>
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
|
||||
{[
|
||||
{ label: t('report.monthlyAccumulatedGeneration'), value: '138.6', unit: 'MWh' },
|
||||
{ label: t('report.theoreticalGeneration'), value: '166.8', unit: 'MWh' },
|
||||
{ label: t('report.prAverage'), value: '82.8', unit: '%' },
|
||||
{ label: t('report.generationDeviation'), value: '-3.4', unit: '%', color: '#F53F3F' },
|
||||
{ label: t('report.averageIrradiance'), value: '5.3', unit: t('report.unitIrradiancePerDay') },
|
||||
].map((item, idx) => (
|
||||
<div key={idx} style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
|
||||
<span style={{ fontSize: 12, color: '#4E5969' }}>{item.label}</span>
|
||||
<span style={{ fontSize: 14, fontWeight: 700, color: item.color || '#1D2129' }}>{item.value} <span style={{ fontSize: 10, fontWeight: 400, color: '#86909C' }}>{item.unit}</span></span>
|
||||
</div>
|
||||
))}
|
||||
{activeTab === 'ai' ? (
|
||||
<MachineDataReport />
|
||||
) : (
|
||||
<>
|
||||
<Row
|
||||
gutter={[12, 12]}
|
||||
style={{
|
||||
marginBottom: 8,
|
||||
flexWrap: 'wrap',
|
||||
}}
|
||||
>
|
||||
{overviewCards.map((card, idx) => (
|
||||
<Col key={idx} style={{ minWidth: '180px', flex: '1 0 auto', }}>
|
||||
<Card
|
||||
bordered={false}
|
||||
bodyStyle={{ padding: '20px 20px', display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}
|
||||
style={{ borderRadius: 8, boxShadow: '0 2px 8px rgba(0,0,0,0.06)' }}
|
||||
>
|
||||
{/* 左侧文字区域 */}
|
||||
<div style={{ flex: 1, display: 'flex', flexDirection: 'column', alignItems: 'flex-start' }}>
|
||||
<div style={{ fontSize: 14, color: '#86909C', marginBottom: 8, fontWeight: 500 }}>
|
||||
{card.title}
|
||||
</div>
|
||||
<div style={{ fontSize: 28, fontWeight: 700, color: card.color, lineHeight: 1, marginBottom: 8 }}>
|
||||
{card.value}
|
||||
<span style={{ fontSize: 14, fontWeight: 500, marginLeft: 2, color: '#1D2129' }}>{card.unit}</span>
|
||||
</div>
|
||||
{/* 底部环比/备注 */}
|
||||
<div style={{ fontSize: 12, color: '#86909C', fontWeight: 500 }}>
|
||||
{card.trend}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 右侧圆形图标区域 */}
|
||||
|
||||
<div
|
||||
style={{
|
||||
width: 48,
|
||||
height: 48,
|
||||
borderRadius: '50%',
|
||||
backgroundColor: card.iconBg || '#f0f7ff',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
flexShrink: 0,
|
||||
marginLeft: 8
|
||||
}}
|
||||
>
|
||||
{card.icon}
|
||||
</div>
|
||||
|
||||
</Card>
|
||||
</Col>
|
||||
</Row>
|
||||
</Card>
|
||||
))}
|
||||
</Row>
|
||||
|
||||
{/* 第二排:三个图表 */}
|
||||
<Row gutter={[8, 8]} style={{ marginTop: 8 }}>
|
||||
<Col span={8}>
|
||||
<Card
|
||||
bordered={false}
|
||||
style={{ ...cardStyle, height: "100%" }}
|
||||
bodyStyle={{ padding: '16px' }}
|
||||
title={<span style={{ fontSize: 14, fontWeight: 700 }}>{t('report.generationMeteorology')}</span>}
|
||||
>
|
||||
<div style={{ fontSize: 10, color: '#86909C', marginBottom: 12 }}>
|
||||
<Space size={8} wrap>
|
||||
<Badge color="#165DFF" text={`${t('report.generation')} (MWh)`} style={{ fontSize: 10 }} />
|
||||
<Badge color="#00B42A" text={`${t('home.irradiance')} (kWh/㎡)`} style={{ fontSize: 10 }} />
|
||||
<Badge color="#FF7D00" text={`${t('home.temperature')} (℃)`} style={{ fontSize: 10 }} />
|
||||
</Space>
|
||||
</div>
|
||||
<UniversalBarChart
|
||||
data={powerMeteorologyData}
|
||||
xKey="date"
|
||||
height={200}
|
||||
series={[
|
||||
{ key: 'generation', name: t('report.generation'), color: '#1890ff' },
|
||||
{ key: 'irradiance', name: t('home.irradiance'), color: '#52c41a' },
|
||||
{ key: 'temp', name: t('home.temperature'), color: '#fa8c16' },
|
||||
]}
|
||||
/>
|
||||
{/* 筛选栏 */}
|
||||
<div style={{ display: 'flex', alignItems: 'center', marginBottom: 8, gap: 20, flexWrap: 'wrap' }}>
|
||||
<div style={{ display: 'flex', alignItems: 'center' }}>
|
||||
<span className="filter-label">{t('report.reportCycle')}:</span>
|
||||
<Select value={reportCycle} onChange={setReportCycle} style={{ width: 100 }} size="small">
|
||||
<Option value="day">{t('report.daily')}</Option>
|
||||
<Option value="week">{t('report.weekly')}</Option>
|
||||
<Option value="month">{t('report.monthly')}</Option>
|
||||
</Select>
|
||||
</div>
|
||||
<div style={{ display: 'flex', alignItems: 'center' }}>
|
||||
<span className="filter-label">{t('report.reportType')}:</span>
|
||||
<Select value={reportType} onChange={setReportType} style={{ width: 120 }} size="small">
|
||||
<Option value="all">{t('common.all')}</Option>
|
||||
<Option value="power">{t('report.generationReport')}</Option>
|
||||
<Option value="operation">{t('report.operationReport')}</Option>
|
||||
<Option value="alarm">{t('report.alertReport')}</Option>
|
||||
<Option value="ai">{t('report.machineAnalysisReport')}</Option>
|
||||
</Select>
|
||||
</div>
|
||||
<div style={{ display: 'flex', alignItems: 'center' }}>
|
||||
<span className="filter-label">{t('report.dateRange')}:</span>
|
||||
<RangePicker
|
||||
value={dateRange}
|
||||
onChange={setDateRange}
|
||||
style={{ width: 260 }}
|
||||
size="small"
|
||||
/>
|
||||
</div>
|
||||
<div style={{ marginLeft: 'auto' }}>
|
||||
<Space size={12}>
|
||||
<Button type="primary" icon={<FileTextOutlined />} size="small" style={{ borderRadius: 6, height: 32, padding: '0 16px' }}>{t('report.generateReport')}</Button>
|
||||
<Button icon={<FilePdfOutlined />} size="small" style={{ borderRadius: 6, height: 32, color: '#F53F3F', borderColor: '#F53F3F' }}>{t('report.exportPdf')}</Button>
|
||||
<Button icon={<FileExcelOutlined />} size="small" style={{ borderRadius: 6, height: 32, color: '#00B42A', borderColor: '#00B42A' }}>{t('report.exportExcel')}</Button>
|
||||
</Space>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Row gutter={[8, 8]}>
|
||||
{/* 左侧主内容区 */}
|
||||
<Col xs={24} xl={16} >
|
||||
{/* 月度综合经营分析 */}
|
||||
<Card bordered={false} style={cardStyle} bodyStyle={{ padding: '20px' }} title={<span style={{ fontSize: 15, fontWeight: 700, color: '#1D2129' }}>{t('report.monthlyOperationAnalysis')}</span>}>
|
||||
<Row gutter={24}>
|
||||
<Col span={17}>
|
||||
<div style={{ fontSize: 11, color: '#86909C', marginBottom: 16, display: 'flex', justifyContent: 'flex-start', gap: 20 }}>
|
||||
<Space size={4}><div style={{ width: 10, height: 3, background: '#00B42A' }}></div>{t('report.generation')} (MWh)</Space>
|
||||
<Space size={4}><div style={{ width: 10, height: 1, borderTop: '1.5px dashed #165DFF' }}></div>{t('report.predictedGeneration')} (MWh)</Space>
|
||||
<Space size={4}><div style={{ width: 10, height: 1, borderTop: '1.5px solid #FF7D00' }}></div>PR (%)</Space>
|
||||
</div>
|
||||
<UniversalLineChart
|
||||
data={monthlyPowerData}
|
||||
xKey="date"
|
||||
height={260}
|
||||
series={[
|
||||
{
|
||||
key: 'generation',
|
||||
name: t('report.generation') + '(MWh)',
|
||||
color: '#52c41a',
|
||||
},
|
||||
{
|
||||
key: 'predicted',
|
||||
name: t('report.predictedGeneration') + '(MWh)',
|
||||
color: '#1890ff',
|
||||
dashed: true,
|
||||
},
|
||||
{
|
||||
key: 'pr',
|
||||
name: 'PR(%)',
|
||||
color: '#fa8c16',
|
||||
strokeWidth: 2,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</Col>
|
||||
<Col span={7}>
|
||||
<div style={{ background: '#f8fafc', padding: '16px', borderRadius: 12, height: '100%' }}>
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
|
||||
{[
|
||||
{ label: t('report.monthlyAccumulatedGeneration'), value: '138.6', unit: 'MWh' },
|
||||
{ label: t('report.theoreticalGeneration'), value: '166.8', unit: 'MWh' },
|
||||
{ label: t('report.prAverage'), value: '82.8', unit: '%' },
|
||||
{ label: t('report.generationDeviation'), value: '-3.4', unit: '%', color: '#F53F3F' },
|
||||
{ label: t('report.averageIrradiance'), value: '5.3', unit: t('report.unitIrradiancePerDay') },
|
||||
].map((item, idx) => (
|
||||
<div key={idx} style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
|
||||
<span style={{ fontSize: 12, color: '#4E5969' }}>{item.label}</span>
|
||||
<span style={{ fontSize: 14, fontWeight: 700, color: item.color || '#1D2129' }}>{item.value} <span style={{ fontSize: 10, fontWeight: 400, color: '#86909C' }}>{item.unit}</span></span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</Col>
|
||||
</Row>
|
||||
</Card>
|
||||
</Col>
|
||||
|
||||
<Col span={8}>
|
||||
<Card
|
||||
bordered={false}
|
||||
style={{ ...cardStyle, height: "100%" }}
|
||||
bodyStyle={{ padding: '16px' }}
|
||||
title={<span style={{ fontSize: 14, fontWeight: 700 }}>{t('report.workOrderAlertClosure')}</span>}
|
||||
>
|
||||
<div style={{ fontSize: 10, color: '#86909C', marginBottom: 12 }}>
|
||||
<Space size={8} wrap>
|
||||
<Badge color="#165DFF" text={t('workOrder.newOrders')} style={{ fontSize: 10 }} />
|
||||
<Badge color="#00B42A" text={t('workOrder.completeOrder')} style={{ fontSize: 10 }} />
|
||||
<Badge color="#722ED1" text={`${t('report.closureRate')} (%)`} style={{ fontSize: 10 }} />
|
||||
</Space>
|
||||
</div>
|
||||
<UniversalBarChart
|
||||
data={orderAlarmData}
|
||||
xKey="date"
|
||||
height={200}
|
||||
series={[
|
||||
{ key: 'newOrder', name: t('workOrder.newOrders'), color: '#1890ff' },
|
||||
{ key: 'completed', name: t('workOrder.completeOrder'), color: '#52c41a' },
|
||||
{ key: 'alarmCount', name: t('report.alarmCount'), color: '#fa8c16' },
|
||||
{ key: 'closedRate', name: t('report.closureRate'), color: '#722ed1' },
|
||||
]}
|
||||
/>
|
||||
</Card>
|
||||
</Col>
|
||||
{/* 第二排:三个图表 */}
|
||||
<Row gutter={[8, 8]} style={{ marginTop: 8 }}>
|
||||
<Col span={8}>
|
||||
<Card
|
||||
bordered={false}
|
||||
style={{ ...cardStyle, height: "100%" }}
|
||||
bodyStyle={{ padding: '16px' }}
|
||||
title={<span style={{ fontSize: 14, fontWeight: 700 }}>{t('report.generationMeteorology')}</span>}
|
||||
>
|
||||
<div style={{ fontSize: 10, color: '#86909C', marginBottom: 12 }}>
|
||||
<Space size={8} wrap>
|
||||
<Badge color="#165DFF" text={`${t('report.generation')} (MWh)`} style={{ fontSize: 10 }} />
|
||||
<Badge color="#00B42A" text={`${t('home.irradiance')} (kWh/㎡)`} style={{ fontSize: 10 }} />
|
||||
<Badge color="#FF7D00" text={`${t('home.temperature')} (℃)`} style={{ fontSize: 10 }} />
|
||||
</Space>
|
||||
</div>
|
||||
<UniversalBarChart
|
||||
data={powerMeteorologyData}
|
||||
xKey="date"
|
||||
height={200}
|
||||
series={[
|
||||
{ key: 'generation', name: t('report.generation'), color: '#1890ff' },
|
||||
{ key: 'irradiance', name: t('home.irradiance'), color: '#52c41a' },
|
||||
{ key: 'temp', name: t('home.temperature'), color: '#fa8c16' },
|
||||
]}
|
||||
/>
|
||||
</Card>
|
||||
</Col>
|
||||
|
||||
<Col span={8}>
|
||||
<Card
|
||||
bordered={false}
|
||||
style={{ ...cardStyle, height: "100%" }}
|
||||
bodyStyle={{ padding: '16px' }}
|
||||
title={<span style={{ fontSize: 14, fontWeight: 700 }}>{t('report.aiAnalysisStatistics')}</span>}
|
||||
>
|
||||
<div style={{ width: '100%', boxSizing: 'border-box' }}>
|
||||
<UniversalPieChart
|
||||
data={aiPieData}
|
||||
width={220}
|
||||
height={220}
|
||||
innerRadius={40}
|
||||
outerRadius={65}
|
||||
style={{ padding: 0 }}
|
||||
/>
|
||||
<Col span={8}>
|
||||
<Card
|
||||
bordered={false}
|
||||
style={{ ...cardStyle, height: "100%" }}
|
||||
bodyStyle={{ padding: '16px' }}
|
||||
title={<span style={{ fontSize: 14, fontWeight: 700 }}>{t('report.workOrderAlertClosure')}</span>}
|
||||
>
|
||||
<div style={{ fontSize: 10, color: '#86909C', marginBottom: 12 }}>
|
||||
<Space size={8} wrap>
|
||||
<Badge color="#165DFF" text={t('workOrder.newOrders')} style={{ fontSize: 10 }} />
|
||||
<Badge color="#00B42A" text={t('workOrder.completeOrder')} style={{ fontSize: 10 }} />
|
||||
<Badge color="#722ED1" text={`${t('report.closureRate')} (%)`} style={{ fontSize: 10 }} />
|
||||
</Space>
|
||||
</div>
|
||||
<UniversalBarChart
|
||||
data={orderAlarmData}
|
||||
xKey="date"
|
||||
height={200}
|
||||
series={[
|
||||
{ key: 'newOrder', name: t('workOrder.newOrders'), color: '#1890ff' },
|
||||
{ key: 'completed', name: t('workOrder.completeOrder'), color: '#52c41a' },
|
||||
{ key: 'alarmCount', name: t('report.alarmCount'), color: '#fa8c16' },
|
||||
{ key: 'closedRate', name: t('report.closureRate'), color: '#722ed1' },
|
||||
]}
|
||||
/>
|
||||
</Card>
|
||||
</Col>
|
||||
|
||||
<div style={{
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
gap: 10,
|
||||
paddingLeft: 8,
|
||||
width: '100%',
|
||||
boxSizing: 'border-box'
|
||||
}}>
|
||||
{aiAnalysisData.map((item, idx) => (
|
||||
<div key={idx} style={{
|
||||
<Col span={8}>
|
||||
<Card
|
||||
bordered={false}
|
||||
style={{ ...cardStyle, height: "100%" }}
|
||||
bodyStyle={{ padding: '16px' }}
|
||||
title={<span style={{ fontSize: 14, fontWeight: 700 }}>{t('report.aiAnalysisStatistics')}</span>}
|
||||
>
|
||||
<div style={{ width: '100%', boxSizing: 'border-box' }}>
|
||||
<UniversalPieChart
|
||||
data={aiPieData}
|
||||
width={220}
|
||||
height={220}
|
||||
innerRadius={40}
|
||||
outerRadius={65}
|
||||
style={{ padding: 0 }}
|
||||
/>
|
||||
|
||||
<div style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
alignItems: 'center',
|
||||
flexDirection: 'column',
|
||||
gap: 10,
|
||||
paddingLeft: 8,
|
||||
width: '100%',
|
||||
flexWrap: 'wrap',
|
||||
wordBreak: 'break-all',
|
||||
whiteSpace: 'normal'
|
||||
boxSizing: 'border-box'
|
||||
}}>
|
||||
<Space size={6} style={{
|
||||
fontSize: 11,
|
||||
color: '#4E5969',
|
||||
flex: 1,
|
||||
minWidth: '60%',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
flexWrap: 'wrap'
|
||||
}}>
|
||||
<div style={{ width: 6, height: 6, borderRadius: '50%', background: item.color, flexShrink: 0 }}></div>
|
||||
<span style={{ wordBreak: 'break-all', whiteSpace: 'normal' }}>{item.type}</span>
|
||||
</Space>
|
||||
<span style={{
|
||||
fontSize: 12,
|
||||
fontWeight: 700,
|
||||
whiteSpace: 'nowrap',
|
||||
flexShrink: 0
|
||||
}}>
|
||||
{item.value} <Text type="secondary" style={{ fontSize: 10, fontWeight: 400 }}>{t('report.unitItem')}</Text>
|
||||
</span>
|
||||
{aiAnalysisData.map((item, idx) => (
|
||||
<div key={idx} style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
alignItems: 'center',
|
||||
width: '100%',
|
||||
flexWrap: 'wrap',
|
||||
wordBreak: 'break-all',
|
||||
whiteSpace: 'normal'
|
||||
}}>
|
||||
<Space size={6} style={{
|
||||
fontSize: 11,
|
||||
color: '#4E5969',
|
||||
flex: 1,
|
||||
minWidth: '60%',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
flexWrap: 'wrap'
|
||||
}}>
|
||||
<div style={{ width: 6, height: 6, borderRadius: '50%', background: item.color, flexShrink: 0 }}></div>
|
||||
<span style={{ wordBreak: 'break-all', whiteSpace: 'normal' }}>{item.type}</span>
|
||||
</Space>
|
||||
<span style={{
|
||||
fontSize: 12,
|
||||
fontWeight: 700,
|
||||
whiteSpace: 'nowrap',
|
||||
flexShrink: 0
|
||||
}}>
|
||||
{item.value} <Text type="secondary" style={{ fontSize: 10, fontWeight: 400 }}>{t('report.unitItem')}</Text>
|
||||
</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
</Col>
|
||||
</Row>
|
||||
{/* 订阅与分发 */}
|
||||
<Card bordered={false} style={{ ...cardStyle, marginTop: 8 }} bodyStyle={{ padding: '20px' }} title={<span style={{ fontSize: 15, fontWeight: 700, color: '#1D2129' }}>{t('report.subscriptionDispatch')}</span>}>
|
||||
<Row gutter={[16, 16]} wrap>
|
||||
<Col xs={24} sm={12} md={8}>
|
||||
<div style={{ fontSize: 12, color: '#86909C', marginBottom: 12 }}>{t('report.subscribers', { count: 6 })}</div>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 8, flexWrap: 'wrap' }}>
|
||||
{[
|
||||
{ name: '张运维', role: t('report.roleOmSupervisor'), img: 'https://img.icons8.com/fluency/48/user-male-circle.png' },
|
||||
{ name: '李工程师', role: t('report.roleStationEngineer'), img: 'https://img.icons8.com/fluency/48/user-male-circle.png' },
|
||||
{ name: '王运维', role: t('report.roleDeviceOm'), img: 'https://img.icons8.com/fluency/48/user-male-circle.png' },
|
||||
{ name: '陈经理', role: t('report.roleOmManager'), img: 'https://img.icons8.com/fluency/48/user-male-circle.png' },
|
||||
].map((p, idx) => (
|
||||
<Tooltip title={`${p.name} - ${p.role}`} key={idx}>
|
||||
<Avatar src={p.img} size={32} style={{ border: '2px solid #fff' }} />
|
||||
</Tooltip>
|
||||
))}
|
||||
<Avatar size={32} style={{ background: '#F2F3F5', color: '#165DFF', fontSize: 12, fontWeight: 700, border: '2px solid #fff' }}>+2</Avatar>
|
||||
</div>
|
||||
</Col>
|
||||
|
||||
<Col xs={24} sm={12} md={8}>
|
||||
<div style={{ fontSize: 12, color: '#86909C', marginBottom: 12 }}>{t('report.dispatchChannels')}</div>
|
||||
<Space size={12} wrap>
|
||||
<Button size="small" icon={<MailOutlined />} style={{ borderRadius: 6, background: '#E8F3FF', border: 'none', color: '#165DFF' }}>{t('report.email')} <CheckCircleFilled style={{ fontSize: 10, marginLeft: 4 }} /></Button>
|
||||
<Button size="small" style={{ borderRadius: 6, background: '#E8F3FF', border: 'none', color: '#165DFF' }}>Telegram <CheckCircleFilled style={{ fontSize: 10, marginLeft: 4 }} /></Button>
|
||||
<Button size="small" icon={<BellOutlined />} style={{ borderRadius: 6, background: '#E8F3FF', border: 'none', color: '#165DFF' }}>{t('report.systemNotification')} <CheckCircleFilled style={{ fontSize: 10, marginLeft: 4 }} /></Button>
|
||||
</Space>
|
||||
</Col>
|
||||
|
||||
<Col xs={24} sm={24} md={8}>
|
||||
<div style={{ fontSize: 12, color: '#86909C', marginBottom: 12 }}>{t('report.sendPlan')}</div>
|
||||
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', background: '#f8fafc', padding: '8px 12px', borderRadius: 8, gap: 8 }}>
|
||||
<Space size={8} wrap>
|
||||
<CalendarOutlined style={{ color: '#165DFF' }} />
|
||||
<span style={{ fontSize: 13, fontWeight: 700 }}>{t('report.weeklyAutoSend')}</span>
|
||||
</Space>
|
||||
<Button type="link" size="small" icon={<EditOutlined />} style={{ fontSize: 12, whiteSpace: 'nowrap' }}>{t('roles.edit')}</Button>
|
||||
</div>
|
||||
</Col>
|
||||
</Row>
|
||||
</Card>
|
||||
</Col>
|
||||
|
||||
{/* 右侧边栏 */}
|
||||
<Col xs={24} xl={8}>
|
||||
{/* 报表目录 / 快捷下载 */}
|
||||
<Card bordered={false} style={cardStyle} bodyStyle={{ padding: 0 }} title={<span style={{ fontSize: 15, fontWeight: 700 }}>{t('report.reportDirectory')}</span>} extra={<Button type="link" size="small">{t('common.more')} <ChevronRight size={14} /></Button>}>
|
||||
<Table
|
||||
rowKey="name"
|
||||
columns={[
|
||||
{
|
||||
title: t('report.reportName'), dataIndex: 'name',
|
||||
render: (text) => <Space size={8}><FilePdfOutlined style={{ color: '#F53F3F' }} />{text}</Space>
|
||||
},
|
||||
{
|
||||
title: t('roles.status'), dataIndex: 'status', width: 80,
|
||||
render: (v) => <Tag color={v === t('report.generated') ? 'success' : 'warning'} style={{ borderRadius: 4, fontSize: 10, margin: 0 }}>{v}</Tag>
|
||||
},
|
||||
{
|
||||
title: t('roles.actions'), width: 120,
|
||||
render: () => (
|
||||
<Space split={<Divider type="vertical" />}>
|
||||
<Button type="link" size="small" icon={<EyeOutlined />} style={{ fontSize: 12, padding: 0 }}>{t('common.view')}</Button>
|
||||
<Button type="link" size="small" icon={<DownloadOutlined />} style={{ fontSize: 12, padding: 0 }}>{t('common.download')}</Button>
|
||||
</Space>
|
||||
)
|
||||
}
|
||||
]}
|
||||
dataSource={reportFileList}
|
||||
pagination={false}
|
||||
size="small"
|
||||
className="compact-table"
|
||||
/>
|
||||
</Card>
|
||||
|
||||
{/* 模板中心 */}
|
||||
<Card bordered={false} style={{ ...cardStyle, marginTop: 8 }} bodyStyle={{ padding: '16px' }} title={<span style={{ fontSize: 15, fontWeight: 700 }}>{t('report.templateCenter')}</span>} extra={<Button type="link" size="small">{t('common.more')} <ChevronRight size={14} /></Button>}>
|
||||
<Row gutter={[12, 12]}>
|
||||
{reportTemplates.map((tpl, idx) => (
|
||||
<Col span={12} key={idx}>
|
||||
<div style={{ background: '#f8fafc', padding: '12px', borderRadius: 10, height: '100%', border: '1px solid #f0f0f0' }}>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 10, marginBottom: 8 }}>
|
||||
<div style={{ width: 32, height: 32, borderRadius: 8, background: tpl.bg, color: tpl.color, display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: 16 }}>
|
||||
{tpl.icon}
|
||||
</div>
|
||||
<div style={{ fontSize: 13, fontWeight: 700, color: '#1D2129' }}>{tpl.name}</div>
|
||||
</div>
|
||||
<div style={{ fontSize: 11, color: '#86909C', lineHeight: 1.4 }}>{tpl.desc}</div>
|
||||
</div>
|
||||
</Col>
|
||||
))}
|
||||
</Row>
|
||||
</Card>
|
||||
|
||||
{/* 报表生成记录 */}
|
||||
<Card bordered={false} style={{ ...cardStyle, marginTop: 8 }} bodyStyle={{ padding: 0 }} title={<span style={{ fontSize: 15, fontWeight: 700 }}>{t('report.generationRecords')}</span>} extra={<Button type="link" size="small">{t('common.more')} <ChevronRight size={14} /></Button>}>
|
||||
<Table
|
||||
rowKey="name"
|
||||
columns={[
|
||||
{ title: t('report.reportName'), dataIndex: 'name', width: 100, ellipsis: true },
|
||||
{ title: t('report.generateTime'), dataIndex: 'time', width: 130 },
|
||||
{ title: t('report.generator'), dataIndex: 'operator', width: 80 },
|
||||
{ title: t('common.type'), dataIndex: 'type', width: 80 },
|
||||
{
|
||||
title: t('roles.status'), dataIndex: 'status', width: 70,
|
||||
render: (v) => <Tag color={v === t('report.generated') ? 'success' : 'warning'} style={{ borderRadius: 4, fontSize: 10, margin: 0 }}>{v}</Tag>
|
||||
},
|
||||
{
|
||||
title: t('roles.actions'), width: 90,
|
||||
render: () => (
|
||||
<Space size={8}>
|
||||
<Button type="text" icon={<EyeOutlined />} size="small" />
|
||||
<Button type="text" icon={<DownloadOutlined />} size="small" />
|
||||
</Space>
|
||||
)
|
||||
}
|
||||
]}
|
||||
dataSource={generationRecord}
|
||||
pagination={false}
|
||||
size="small"
|
||||
className="compact-table"
|
||||
scroll={{ y: 240 }}
|
||||
/>
|
||||
</Card>
|
||||
</Col>
|
||||
</Row>
|
||||
{/* 订阅与分发 */}
|
||||
<Card bordered={false} style={{ ...cardStyle, marginTop: 8 }} bodyStyle={{ padding: '20px' }} title={<span style={{ fontSize: 15, fontWeight: 700, color: '#1D2129' }}>{t('report.subscriptionDispatch')}</span>}>
|
||||
<Row gutter={[16, 16]} wrap>
|
||||
<Col xs={24} sm={12} md={8}>
|
||||
<div style={{ fontSize: 12, color: '#86909C', marginBottom: 12 }}>{t('report.subscribers', { count: 6 })}</div>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 8, flexWrap: 'wrap' }}>
|
||||
{[
|
||||
{ name: '张运维', role: t('report.roleOmSupervisor'), img: 'https://img.icons8.com/fluency/48/user-male-circle.png' },
|
||||
{ name: '李工程师', role: t('report.roleStationEngineer'), img: 'https://img.icons8.com/fluency/48/user-male-circle.png' },
|
||||
{ name: '王运维', role: t('report.roleDeviceOm'), img: 'https://img.icons8.com/fluency/48/user-male-circle.png' },
|
||||
{ name: '陈经理', role: t('report.roleOmManager'), img: 'https://img.icons8.com/fluency/48/user-male-circle.png' },
|
||||
].map((p, idx) => (
|
||||
<Tooltip title={`${p.name} - ${p.role}`} key={idx}>
|
||||
<Avatar src={p.img} size={32} style={{ border: '2px solid #fff' }} />
|
||||
</Tooltip>
|
||||
))}
|
||||
<Avatar size={32} style={{ background: '#F2F3F5', color: '#165DFF', fontSize: 12, fontWeight: 700, border: '2px solid #fff' }}>+2</Avatar>
|
||||
</div>
|
||||
</Col>
|
||||
|
||||
<Col xs={24} sm={12} md={8}>
|
||||
<div style={{ fontSize: 12, color: '#86909C', marginBottom: 12 }}>{t('report.dispatchChannels')}</div>
|
||||
<Space size={12} wrap>
|
||||
<Button size="small" icon={<MailOutlined />} style={{ borderRadius: 6, background: '#E8F3FF', border: 'none', color: '#165DFF' }}>{t('report.email')} <CheckCircleFilled style={{ fontSize: 10, marginLeft: 4 }} /></Button>
|
||||
<Button size="small" style={{ borderRadius: 6, background: '#E8F3FF', border: 'none', color: '#165DFF' }}>Telegram <CheckCircleFilled style={{ fontSize: 10, marginLeft: 4 }} /></Button>
|
||||
<Button size="small" icon={<BellOutlined />} style={{ borderRadius: 6, background: '#E8F3FF', border: 'none', color: '#165DFF' }}>{t('report.systemNotification')} <CheckCircleFilled style={{ fontSize: 10, marginLeft: 4 }} /></Button>
|
||||
</Space>
|
||||
</Col>
|
||||
|
||||
<Col xs={24} sm={24} md={8}>
|
||||
<div style={{ fontSize: 12, color: '#86909C', marginBottom: 12 }}>{t('report.sendPlan')}</div>
|
||||
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', background: '#f8fafc', padding: '8px 12px', borderRadius: 8, gap: 8 }}>
|
||||
<Space size={8} wrap>
|
||||
<CalendarOutlined style={{ color: '#165DFF' }} />
|
||||
<span style={{ fontSize: 13, fontWeight: 700 }}>{t('report.weeklyAutoSend')}</span>
|
||||
</Space>
|
||||
<Button type="link" size="small" icon={<EditOutlined />} style={{ fontSize: 12, whiteSpace: 'nowrap' }}>{t('roles.edit')}</Button>
|
||||
</div>
|
||||
</Col>
|
||||
</Row>
|
||||
</Card>
|
||||
</Col>
|
||||
|
||||
{/* 右侧边栏 */}
|
||||
<Col xs={24} xl={8}>
|
||||
{/* 报表目录 / 快捷下载 */}
|
||||
<Card bordered={false} style={cardStyle} bodyStyle={{ padding: 0 }} title={<span style={{ fontSize: 15, fontWeight: 700 }}>{t('report.reportDirectory')}</span>} extra={<Button type="link" size="small">{t('common.more')} <ChevronRight size={14} /></Button>}>
|
||||
<Table
|
||||
rowKey="name"
|
||||
columns={[
|
||||
{
|
||||
title: t('report.reportName'), dataIndex: 'name',
|
||||
render: (text) => <Space size={8}><FilePdfOutlined style={{ color: '#F53F3F' }} />{text}</Space>
|
||||
},
|
||||
{
|
||||
title: t('roles.status'), dataIndex: 'status', width: 80,
|
||||
render: (v) => <Tag color={v === t('report.generated') ? 'success' : 'warning'} style={{ borderRadius: 4, fontSize: 10, margin: 0 }}>{v}</Tag>
|
||||
},
|
||||
{
|
||||
title: t('roles.actions'), width: 120,
|
||||
render: () => (
|
||||
<Space split={<Divider type="vertical" />}>
|
||||
<Button type="link" size="small" icon={<EyeOutlined />} style={{ fontSize: 12, padding: 0 }}>{t('common.view')}</Button>
|
||||
<Button type="link" size="small" icon={<DownloadOutlined />} style={{ fontSize: 12, padding: 0 }}>{t('common.download')}</Button>
|
||||
</Space>
|
||||
)
|
||||
}
|
||||
]}
|
||||
dataSource={reportFileList}
|
||||
pagination={false}
|
||||
size="small"
|
||||
className="compact-table"
|
||||
/>
|
||||
</Card>
|
||||
|
||||
{/* 模板中心 */}
|
||||
<Card bordered={false} style={{ ...cardStyle, marginTop: 8 }} bodyStyle={{ padding: '16px' }} title={<span style={{ fontSize: 15, fontWeight: 700 }}>{t('report.templateCenter')}</span>} extra={<Button type="link" size="small">{t('common.more')} <ChevronRight size={14} /></Button>}>
|
||||
<Row gutter={[12, 12]}>
|
||||
{reportTemplates.map((tpl, idx) => (
|
||||
<Col span={12} key={idx}>
|
||||
<div style={{ background: '#f8fafc', padding: '12px', borderRadius: 10, height: '100%', border: '1px solid #f0f0f0' }}>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 10, marginBottom: 8 }}>
|
||||
<div style={{ width: 32, height: 32, borderRadius: 8, background: tpl.bg, color: tpl.color, display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: 16 }}>
|
||||
{tpl.icon}
|
||||
</div>
|
||||
<div style={{ fontSize: 13, fontWeight: 700, color: '#1D2129' }}>{tpl.name}</div>
|
||||
</div>
|
||||
<div style={{ fontSize: 11, color: '#86909C', lineHeight: 1.4 }}>{tpl.desc}</div>
|
||||
</div>
|
||||
</Col>
|
||||
))}
|
||||
</Row>
|
||||
</Card>
|
||||
|
||||
{/* 报表生成记录 */}
|
||||
<Card bordered={false} style={{ ...cardStyle, marginTop: 8 }} bodyStyle={{ padding: 0 }} title={<span style={{ fontSize: 15, fontWeight: 700 }}>{t('report.generationRecords')}</span>} extra={<Button type="link" size="small">{t('common.more')} <ChevronRight size={14} /></Button>}>
|
||||
<Table
|
||||
rowKey="name"
|
||||
columns={[
|
||||
{ title: t('report.reportName'), dataIndex: 'name', width: 100, ellipsis: true },
|
||||
{ title: t('report.generateTime'), dataIndex: 'time', width: 130 },
|
||||
{ title: t('report.generator'), dataIndex: 'operator', width: 80 },
|
||||
{ title: t('common.type'), dataIndex: 'type', width: 80 },
|
||||
{
|
||||
title: t('roles.status'), dataIndex: 'status', width: 70,
|
||||
render: (v) => <Tag color={v === t('report.generated') ? 'success' : 'warning'} style={{ borderRadius: 4, fontSize: 10, margin: 0 }}>{v}</Tag>
|
||||
},
|
||||
{
|
||||
title: t('roles.actions'), width: 90,
|
||||
render: () => (
|
||||
<Space size={8}>
|
||||
<Button type="text" icon={<EyeOutlined />} size="small" />
|
||||
<Button type="text" icon={<DownloadOutlined />} size="small" />
|
||||
</Space>
|
||||
)
|
||||
}
|
||||
]}
|
||||
dataSource={generationRecord}
|
||||
pagination={false}
|
||||
size="small"
|
||||
className="compact-table"
|
||||
scroll={{ y: 240 }}
|
||||
/>
|
||||
</Card>
|
||||
</Col>
|
||||
</Row>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
BIN
智慧运维系统平台-月度工作总结报告-2026年8月-葌昀.docx
Normal file
BIN
智慧运维系统平台-月度工作总结报告-2026年8月-葌昀.docx
Normal file
Binary file not shown.
Reference in New Issue
Block a user