Compare commits

...

7 Commits

Author SHA1 Message Date
mmc
ac60263a6c 修复 2026-08-31 14:56:09 +08:00
mmc
ce924ddf66 修复地图 2026-08-31 14:46:29 +08:00
mmc
f342bc7648 绑定 2026-08-31 14:38:52 +08:00
mmc
f318cba0b3 修复 控制台警告信息 图标大小在初始化 会警告 长宽-1 2026-08-31 14:23:47 +08:00
mmc
60583074bf 修复admin可以看到所有用户 2026-08-31 14:21:29 +08:00
mmc
2b887270b9 修复地图中 鼠标悬浮显示机器 优化显示登录用用户的角色 2026-08-31 14:21:29 +08:00
mmc
46c5236731 修复 地图 地址 2026-08-31 12:45:16 +08:00
7 changed files with 312 additions and 69 deletions

4
env.js
View File

@@ -19,7 +19,7 @@ const envConfig = {
//baseURL: 'https://serviceri.satabot.com',
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:59018/geoserver"
geoserver_url: "http://1.95.137.212:7900/geoserver"
//baseURL: 'http://1.95.137.212:59015',//http://192.168.2.56:8081
////baseURL: 'https://serviceri.satabot.com',
@@ -40,7 +40,7 @@ const envConfig = {
//baseURL: 'https://serviceri.satabot.com',
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:59018/geoserver"
geoserver_url: "http://1.95.137.212:7900/geoserver"
},
};

View File

@@ -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')}

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useRef, useState, useMemo, useImperativeHandle, forwardRef, useCallback } from 'react';
import React, { useEffect, useRef, useState, useMemo, useImperativeHandle, forwardRef, useCallback } from 'react';
import carImg from '../assets/images/carplane.png';
import inspectImg from "../assets/images/inspectCar.png"
import planeImg from '../assets/images/planeicon.png';
@@ -39,6 +39,8 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
const planLineRef = useRef(null); // points 规划航线
const navLineRef = useRef(null); // 完成点实时轨迹
const markedPointsRef = useRef([]); // 标记点实体
const { t } = useTranslation();
const realtimeEntityRef = useRef(null);
const realtimeLineRef = useRef(null);
@@ -200,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);
@@ -343,8 +345,7 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
}
}, [markedPoints]);
function showRobotTooltip(tooltip, robot, position) {
const { t } = useTranslation();
function showRobotTooltip(tooltip, robot, position, t) {
const statusMap = {
1: { text: t('common.working'), color: "#10b981" },
2: { text: t('devices.idle'), color: "#f59e0b" },
@@ -484,7 +485,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";
@@ -495,9 +496,12 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
const layerIdentifier = `${workspace}:${layerName}`;
let baseUrl = wmsUrl;
const cesiumLayers = [];
if (index == 2 && from == "other") {
flyToLayer(layerIdentifier, baseUrl, 100);
}
//if (index == 2 && from == "other") {
// //flyToLayer(layerIdentifier, baseUrl, 100);
//}
//if (index == 0 && from == "other") {
// flyToLayer(layerIdentifier, baseUrl, 100);
//}
//getLayerBoundsAndFit(wmsUrl, layerName);
if (baseUrl.includes('/gwc/service/wms')) {
@@ -1027,7 +1031,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;
@@ -1087,8 +1091,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;
@@ -1397,7 +1405,7 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
const picked = viewer.scene.pick(movement.endPosition);
if (window.Cesium.defined(picked) && picked.id?.properties?.robot) {
const robot = picked.id.properties.robot.getValue();
showRobotTooltip(tooltipRef.current, robot, movement.endPosition);
showRobotTooltip(tooltipRef.current, robot, movement.endPosition, t);
} else {
tooltipRef.current.style.display = "none";
}
@@ -1599,7 +1607,6 @@ const CesiumMap = React.forwardRef(({ ifClear, ifClearPlanLine, ifClearNavLine,
// 如果有航向角,设置旋转
let rotation = 0;
console.log('realtimePosition.heading:', realtimePosition.heading);
if (realtimePosition?.heading !== undefined && !isNaN(Number(realtimePosition.heading))) {
@@ -1854,17 +1861,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;

View File

@@ -484,7 +484,7 @@ export default function SmartDeviceManagement({
))}
</Select>
</Form.Item>
<Form.Item label={t('systemSetting.leader')} name="userId" rules={[{ required: true, message: t('systemSetting.fixed2PleaseSelectFixed2LeaderFixed2') }]}>
<Form.Item label={t('systemSetting.leader')} name="userId" >
<Select
placeholder={t('systemSetting.leaderFixed2')}
allowClear

View File

@@ -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 = () => {

View File

@@ -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"

View File

@@ -488,8 +488,8 @@ const zh = {
controlLogTitle: '控制日志标题',
controlRequestContent: '控制请求内容',
countUnit: '数量单位',
coverClosed: '覆盖已关闭',
coverOpen: '覆盖打开',
coverClosed: '已关闭',
coverOpen: '打开',
coverageEquipment: '覆盖设备',
coverageValue: '{{types}}/{{units}}',
createSuccess: '创建成功',
@@ -579,7 +579,7 @@ const zh = {
headingAngle: '航向角度',
horizontalSpeed: '水平速度',
hotspotSuspect: '热斑疑似',
inDock: '内停靠',
inDock: '舱内',
inProgressDesc: '进行中',
indoor: '室内',
inputCustomAlias: '输入自定义别名',
@@ -666,7 +666,7 @@ const zh = {
optimize: '优化',
optionalEmpty: '可选空',
otherWebControlling: '其他网页控制中',
outDock: '外停靠',
outDock: '舱外',
outdoor: '室外',
panorama: '全景',
paramArmChannel: '参数布防渠道',