diff --git a/zlt-business/order-center/src/main/java/com/central/order/controller/TourismController.java b/zlt-business/order-center/src/main/java/com/central/order/controller/TourismController.java index f89b7870..dff15d09 100644 --- a/zlt-business/order-center/src/main/java/com/central/order/controller/TourismController.java +++ b/zlt-business/order-center/src/main/java/com/central/order/controller/TourismController.java @@ -192,4 +192,20 @@ public class TourismController { } } + + + @Operation(summary = "获取景区以及设备信息") + @GetMapping("/{tourismId}/device-sn") + public Result> getTourismAndDeviceSn(@PathVariable("tourismId") Long tourismId) { + try { + if(tourismId==null || tourismId ==0L){ + return Result.failed("tourismId不能为空或者不能为0"); + } + return tourismService.getTourismInfo(tourismId); + } catch (Exception e) { + log.error("获取景区设备列表失败", e); + return Result.failed("获取景区设备列表失败:" + e.getMessage()); + } + } + } diff --git a/zlt-business/order-center/src/main/java/com/central/order/service/ITourismService.java b/zlt-business/order-center/src/main/java/com/central/order/service/ITourismService.java index 16eb27fc..548018a2 100644 --- a/zlt-business/order-center/src/main/java/com/central/order/service/ITourismService.java +++ b/zlt-business/order-center/src/main/java/com/central/order/service/ITourismService.java @@ -95,5 +95,8 @@ public interface ITourismService extends ISuperService { * @return 去重后的设备SN列表 */ List getDeviceSnsByTourismId(Long tourismId); + + + Result> getTourismInfo(Long tourismId); } diff --git a/zlt-business/order-center/src/main/java/com/central/order/service/impl/TourismServiceImpl.java b/zlt-business/order-center/src/main/java/com/central/order/service/impl/TourismServiceImpl.java index 8de9e0db..2c6a1196 100644 --- a/zlt-business/order-center/src/main/java/com/central/order/service/impl/TourismServiceImpl.java +++ b/zlt-business/order-center/src/main/java/com/central/order/service/impl/TourismServiceImpl.java @@ -23,10 +23,7 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.math.BigDecimal; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; +import java.util.*; import java.util.stream.Collectors; /** @@ -265,4 +262,41 @@ public class TourismServiceImpl extends SuperServiceImpl return deviceSns; } + @Override + public Result> getTourismInfo(Long tourismId) { + Tourism tourism = baseMapper.getTourismById(tourismId); + if(Objects.isNull(tourism)){ + return Result.failed("获取景区失败"); + } + if(tourism.getStatus()==0){ + return Result.failed("景区被禁用"); + } + Map map =new HashMap<>(); + map.put("tourismDec",tourism.getTourismDesc()); + LambdaQueryWrapper wrapper =new LambdaQueryWrapper<>() ; + wrapper.eq(TourismFile::getTourismId,tourismId) + .eq(TourismFile::getType,6); + List tourismFiles = tourismFileService.list(wrapper); + if(tourismFiles!=null && tourismFiles.size()>0){ + List list = new ArrayList<>(); + for(TourismFile tourismFile:tourismFiles){ + if (tourismFile != null && tourismFile.getImageUrl() != null) { + // 获取图片的完整URL + String imageUrl = fileCenterService.getViewUrlByPath(tourismFile.getImageUrl()); + list.add(imageUrl); + } + } + map.put("images",list); + } + LambdaQueryWrapper wrapperQrcod =new LambdaQueryWrapper<>() ; + wrapperQrcod.eq(QrCode::getTourismId,tourismId); + wrapperQrcod.eq(QrCode::getIsTest,0); + wrapperQrcod.orderByDesc(QrCode::getId); + List qrCodes= qrCodeMapper.selectList(wrapperQrcod); + if(qrCodes!=null && qrCodes.size()>0){ + map.put("deviceSn",qrCodes.get(0).getDeviceSn()); + } + return Result.succeed(map,"获取成功"); + } + } diff --git a/zlt-web/react-web-next/dist.zip b/zlt-web/react-web-next/dist.zip index 861b1a37..c8f67843 100644 Binary files a/zlt-web/react-web-next/dist.zip and b/zlt-web/react-web-next/dist.zip differ diff --git a/zlt-web/yingyan/config/routes.ts b/zlt-web/yingyan/config/routes.ts index 3935a81b..65ab10cf 100644 --- a/zlt-web/yingyan/config/routes.ts +++ b/zlt-web/yingyan/config/routes.ts @@ -1,6 +1,6 @@ /** * 鹰眼管控平台 - 路由配置 - * 精简版路由:登录 → 大屏 → 3D地图 + * 支持多平台切换:通用监控大屏 / 海事智慧监控平台 */ export default [ // 登录页 - 无布局 @@ -14,17 +14,23 @@ export default [ path: '/', component: '@/layouts/BlankLayout', routes: [ - // 默认跳转大屏 + // 默认跳转海事大屏 { path: '/', - redirect: '/dashboard', + redirect: '/maritime', }, - // 大屏首页 + // 通用监控大屏首页 { path: '/dashboard', component: '@/pages/dashboard', name: '监控大屏', }, + // 海事智慧监控平台 + { + path: '/maritime', + component: '@/pages/maritime/dashboard', + name: '海事监控', + }, // 3D地图 { path: '/map3d', diff --git a/zlt-web/yingyan/src/components/PlatformSwitcher/PlatformSwitcher.less b/zlt-web/yingyan/src/components/PlatformSwitcher/PlatformSwitcher.less new file mode 100644 index 00000000..3a608911 --- /dev/null +++ b/zlt-web/yingyan/src/components/PlatformSwitcher/PlatformSwitcher.less @@ -0,0 +1,149 @@ +/* 平台切换器样式 */ + +.platform-switcher { + display: flex; + align-items: center; + padding: 6px 14px; + background: rgba(0, 212, 255, 0.08); + border: 1px solid rgba(0, 212, 255, 0.2); + border-radius: 6px; + cursor: pointer; + transition: all 0.3s ease; + + &:hover { + background: rgba(0, 212, 255, 0.15); + border-color: rgba(0, 212, 255, 0.35); + } + + &--ocean { + background: rgba(0, 150, 200, 0.1); + border-color: rgba(0, 180, 230, 0.25); + + &:hover { + background: rgba(0, 150, 200, 0.18); + border-color: rgba(0, 180, 230, 0.4); + } + } + + &__icon { + display: flex; + align-items: center; + justify-content: center; + font-size: 18px; + + &--cyan { + color: #00d4ff; + } + + &--ocean { + color: #00b4d8; + } + } + + &__label { + font-size: 13px; + color: rgba(255, 255, 255, 0.9); + font-weight: 500; + letter-spacing: 0.5px; + } + + &__arrow { + font-size: 12px; + color: rgba(255, 255, 255, 0.5); + transition: transform 0.3s; + } + + &:hover &__arrow { + transform: rotate(180deg); + } +} + +/* 下拉菜单样式 */ +.platform-switcher-dropdown { + :global(.ant-dropdown-menu) { + background: rgba(15, 25, 45, 0.95) !important; + backdrop-filter: blur(12px); + border: 1px solid rgba(0, 180, 230, 0.2); + border-radius: 10px; + box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4); + padding: 8px; + min-width: 260px; + } + + :global(.ant-dropdown-menu-item) { + padding: 0 !important; + border-radius: 8px; + margin-bottom: 4px; + background: transparent !important; + + &:last-child { + margin-bottom: 0; + } + + &:hover { + background: rgba(0, 150, 200, 0.15) !important; + } + } +} + +.platform-menu-item { + display: flex; + align-items: center; + padding: 12px 14px; + gap: 12px; + border-radius: 8px; + transition: all 0.2s; + + &.active { + background: rgba(0, 180, 230, 0.12); + } + + &__icon { + width: 40px; + height: 40px; + border-radius: 10px; + display: flex; + align-items: center; + justify-content: center; + font-size: 20px; + flex-shrink: 0; + + &--cyan { + background: rgba(0, 212, 255, 0.15); + color: #00d4ff; + box-shadow: 0 0 12px rgba(0, 212, 255, 0.2); + } + + &--ocean { + background: rgba(0, 180, 230, 0.15); + color: #00b4d8; + box-shadow: 0 0 12px rgba(0, 180, 230, 0.2); + } + } + + &__content { + flex: 1; + min-width: 0; + } + + &__label { + font-size: 14px; + font-weight: 500; + color: #fff; + margin-bottom: 2px; + } + + &__desc { + font-size: 11px; + color: rgba(200, 230, 255, 0.5); + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + + &__check { + color: #00e5a0; + font-size: 14px; + font-weight: bold; + } +} diff --git a/zlt-web/yingyan/src/components/PlatformSwitcher/index.tsx b/zlt-web/yingyan/src/components/PlatformSwitcher/index.tsx new file mode 100644 index 00000000..8454a3e0 --- /dev/null +++ b/zlt-web/yingyan/src/components/PlatformSwitcher/index.tsx @@ -0,0 +1,104 @@ +import React from 'react'; +import { history, useLocation } from 'umi'; +import { Dropdown, Space } from 'antd'; +import { SwapOutlined } from '@ant-design/icons'; +import type { MenuProps } from 'antd'; +import './PlatformSwitcher.less'; + +// 船舶图标 +const ShipIcon = () => ( + + + +); + +// 仪表盘图标 +const DashboardIcon = () => ( + + + +); + +interface Platform { + key: string; + label: string; + path: string; + icon: React.ReactNode; + description: string; + theme: 'cyan' | 'ocean'; +} + +const platforms: Platform[] = [ + { + key: 'dashboard', + label: '通用监控大屏', + path: '/dashboard', + icon: , + description: '设备监控与任务管理', + theme: 'cyan', + }, + { + key: 'maritime', + label: '海事智慧监控', + path: '/maritime', + icon: , + description: '船舶追踪与海域监控', + theme: 'ocean', + }, +]; + +interface PlatformSwitcherProps { + className?: string; +} + +const PlatformSwitcher: React.FC = ({ className }) => { + const location = useLocation(); + + // 确定当前平台 + const currentPlatform = platforms.find(p => location.pathname.startsWith(p.path)) || platforms[0]; + const isMaritime = currentPlatform.key === 'maritime'; + + const handlePlatformChange = (path: string) => { + history.push(path); + }; + + const menuItems: MenuProps['items'] = platforms.map(platform => ({ + key: platform.key, + label: ( +
+ + {platform.icon} + +
+
{platform.label}
+
{platform.description}
+
+ {platform.key === currentPlatform.key && ( + ✓ + )} +
+ ), + onClick: () => handlePlatformChange(platform.path), + })); + + return ( + +
+ + + {currentPlatform.icon} + + {currentPlatform.label} + + +
+
+ ); +}; + +export default PlatformSwitcher; diff --git a/zlt-web/yingyan/src/layouts/BlankLayout.less b/zlt-web/yingyan/src/layouts/BlankLayout.less index f95d3054..5653ad81 100644 --- a/zlt-web/yingyan/src/layouts/BlankLayout.less +++ b/zlt-web/yingyan/src/layouts/BlankLayout.less @@ -293,6 +293,13 @@ background: rgba(19, 26, 61, 0.42); backdrop-filter: blur(8px); + .filter-divider { + width: 1px; + height: 24px; + background: rgba(0, 212, 255, 0.25); + margin: 0 4px; + } + .dashboard-filter__label { color: rgba(255, 255, 255, 0.72); font-size: 12px; @@ -351,6 +358,233 @@ 100% { transform: translateX(520%) skewX(-18deg); opacity: 0; } } +/* 海事智慧监控平台 Header 样式 - 深海蓝主题 */ +.blank-header--maritime { + height: 88px; + line-height: 88px; + padding: 0 24px; + background: linear-gradient(180deg, + rgba(2, 12, 27, 0.98) 0%, + rgba(8, 25, 45, 0.95) 50%, + rgba(12, 35, 60, 0.92) 100%) !important; + border-bottom: none; + overflow: hidden; + box-shadow: + 0 4px 24px rgba(0, 0, 0, 0.5), + inset 0 -2px 0 rgba(0, 150, 200, 0.3), + inset 0 1px 0 rgba(0, 200, 255, 0.15); + position: sticky; + + /* 顶部海洋蓝光线 - 更亮更粗 */ + &::before { + content: ''; + position: absolute; + left: 0; + right: 0; + top: 0; + height: 3px; + background: linear-gradient(90deg, + transparent 5%, + rgba(0, 180, 230, 0.4) 20%, + rgba(0, 220, 255, 0.9) 50%, + rgba(0, 180, 230, 0.4) 80%, + transparent 95%); + opacity: 0.9; + pointer-events: none; + animation: headerGlow 3s ease-in-out infinite; + } + + /* 海洋波纹光扫效果 - 更明显 */ + &::after { + content: ''; + position: absolute; + top: 0; + left: -40%; + width: 40%; + height: 100%; + background: linear-gradient(90deg, + transparent, + rgba(0, 180, 230, 0.08), + rgba(0, 220, 255, 0.15), + rgba(0, 180, 230, 0.08), + transparent); + transform: skewX(-20deg); + animation: maritimeSweep 5s ease-in-out infinite; + opacity: 0.8; + pointer-events: none; + } + + .header-left { + flex: 1.3; + display: flex; + align-items: center; + justify-content: flex-start; + } + + .header-center { + flex: 1.4; + display: flex; + align-items: center; + justify-content: center; + padding: 0 16px; + } + + .header-right { + flex: 1.3; + display: flex; + align-items: center; + justify-content: flex-end; + gap: 14px; + } + + /* 海事标题样式 - 更大更醒目 */ + .dashboard-title--maritime { + position: relative; + display: flex; + align-items: center; + justify-content: center; + width: 100%; + max-width: 900px; + padding: 0 24px; + + &::before, + &::after { + content: ''; + flex: 1; + height: 2px; + opacity: 0.7; + } + + &::before { + background: linear-gradient(90deg, transparent, rgba(0, 180, 230, 0.8)); + } + + &::after { + background: linear-gradient(90deg, rgba(0, 180, 230, 0.8), transparent); + } + + .dashboard-title__text { + display: inline-flex; + align-items: center; + justify-content: center; + padding: 12px 36px; + margin: 0 18px; + border-radius: 999px; + border: 2px solid rgba(0, 180, 230, 0.4); + background: linear-gradient(135deg, rgba(8, 30, 55, 0.8) 0%, rgba(15, 45, 75, 0.6) 100%); + font-size: 32px; + font-weight: 800; + letter-spacing: 10px; + line-height: 1.1; + font-family: 'DIN Alternate', 'HarmonyOS Sans', 'Microsoft YaHei', 'PingFang SC', sans-serif; + color: #fff; + text-shadow: + 0 0 20px rgba(0, 200, 255, 0.6), + 0 0 40px rgba(0, 150, 200, 0.4), + 0 2px 4px rgba(0, 0, 0, 0.3); + background-image: linear-gradient(180deg, #ffffff 0%, #7dd3fc 50%, #0ea5e9 100%); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; + background-clip: text; + position: relative; + + /* 发光边框效果 */ + box-shadow: + 0 0 20px rgba(0, 180, 230, 0.3), + inset 0 1px 0 rgba(255, 255, 255, 0.1); + } + + .dashboard-title__deco--maritime { + position: absolute; + bottom: 8px; + left: 50%; + transform: translateX(-50%); + width: 280px; + height: 3px; + background: linear-gradient(90deg, transparent, rgba(0, 200, 255, 1), transparent); + filter: drop-shadow(0 0 12px rgba(0, 200, 255, 0.6)); + opacity: 0.9; + animation: decoGlow 2s ease-in-out infinite alternate; + } + } + + /* 海事风格筛选器 - 调整垂直居中 */ + .dashboard-filter { + display: flex; + align-items: center; + gap: 12px; + padding: 10px 16px; + border-radius: 12px; + border: 1px solid rgba(0, 180, 230, 0.35); + background: linear-gradient(135deg, rgba(8, 25, 45, 0.7) 0%, rgba(12, 35, 60, 0.5) 100%); + backdrop-filter: blur(12px); + box-shadow: + 0 2px 12px rgba(0, 0, 0, 0.2), + inset 0 1px 0 rgba(0, 200, 255, 0.1); + + .filter-divider { + width: 1px; + height: 28px; + background: linear-gradient(180deg, transparent, rgba(0, 180, 230, 0.5), transparent); + margin: 0 6px; + } + + :global(.ant-tree-select) { + min-width: 240px; + } + + :global(.ant-select-selector) { + background: rgba(0, 150, 200, 0.1) !important; + border: 1px solid rgba(0, 180, 230, 0.3) !important; + border-radius: 8px !important; + } + + :global(.ant-checkbox-wrapper) { + color: rgba(200, 230, 255, 0.75) !important; + } + } + + /* 海事风格用户区域 */ + .dashboard-user--dashboard { + padding: 8px 14px; + border-radius: 999px; + border: 1px solid rgba(0, 180, 230, 0.35); + background: linear-gradient(135deg, rgba(8, 25, 45, 0.7) 0%, rgba(12, 35, 60, 0.5) 100%); + backdrop-filter: blur(12px); + + .user-name { + color: rgba(200, 230, 255, 0.9); + } + } +} + +.blank-content--maritime { + height: calc(100vh - 88px); + overflow: hidden; + background: linear-gradient(180deg, + #020c1b 0%, + #071a2f 30%, + #0c2340 60%, + #0f2847 100%); +} + +@keyframes maritimeSweep { + 0% { transform: translateX(0) skewX(-20deg); opacity: 0; } + 15% { opacity: 0.8; } + 50% { opacity: 0.4; } + 100% { transform: translateX(450%) skewX(-20deg); opacity: 0; } +} + +@keyframes headerGlow { + 0%, 100% { opacity: 0.7; } + 50% { opacity: 1; } +} + +@keyframes decoGlow { + 0% { opacity: 0.7; width: 260px; } + 100% { opacity: 1; width: 300px; } +} + @media (max-width: 768px) { .blank-header { padding: 0 12px; diff --git a/zlt-web/yingyan/src/layouts/BlankLayout.tsx b/zlt-web/yingyan/src/layouts/BlankLayout.tsx index 7ee085db..4546fc5b 100644 --- a/zlt-web/yingyan/src/layouts/BlankLayout.tsx +++ b/zlt-web/yingyan/src/layouts/BlankLayout.tsx @@ -4,6 +4,7 @@ import { Layout, Space, Avatar, Dropdown, message } from 'antd'; import { LogoutOutlined, UserOutlined, EnvironmentOutlined } from '@ant-design/icons'; import type { MenuProps } from 'antd'; import TenantScopeFilter from '@/components/TenantScopeFilter'; +import PlatformSwitcher from '@/components/PlatformSwitcher'; import { outLogin, currentUser } from '@/services/login'; import { clearTenantCache } from '@/utils/tenantCache'; import './BlankLayout.less'; @@ -14,12 +15,13 @@ const { Header, Content } = Layout; const BlankLayout: React.FC<{ children?: React.ReactNode }> = ({ children }) => { const location = useLocation(); const isDashboard = location.pathname === '/dashboard'; + const isMaritime = location.pathname === '/maritime' || location.pathname.startsWith('/maritime/'); const isMap3d = location.pathname === '/map3d' || location.pathname.startsWith('/map3d/'); const [currentTime, setCurrentTime] = useState(''); const [userName, setUserName] = useState(''); useEffect(() => { - if (isDashboard || isMap3d) return; + if (isDashboard || isMaritime || isMap3d) return; // 更新时间 const updateTime = () => { const now = new Date(); @@ -79,11 +81,12 @@ const BlankLayout: React.FC<{ children?: React.ReactNode }> = ({ children }) => return ( -
+
- {isDashboard ? ( + {(isDashboard || isMaritime) ? (
-
租户范围
+ +
) : isMap3d ? ( @@ -98,9 +101,14 @@ const BlankLayout: React.FC<{ children?: React.ReactNode }> = ({ children }) =>
{isDashboard ? (
- 鹰眼管控平台 -运营总览 + 鹰眼管控平台 - 运营总览
+ ) : isMaritime ? ( +
+ 海事智慧监控服务平台 + +
) : isMap3d ? (
) : ( @@ -108,9 +116,9 @@ const BlankLayout: React.FC<{ children?: React.ReactNode }> = ({ children }) => )}
- {!isDashboard && !isMap3d && {currentTime}} + {!isDashboard && !isMaritime && !isMap3d && {currentTime}} {isMap3d &&
} -
+
} /> @@ -120,7 +128,7 @@ const BlankLayout: React.FC<{ children?: React.ReactNode }> = ({ children }) =>
- + {children} diff --git a/zlt-web/yingyan/src/pages/dashboard/index.tsx b/zlt-web/yingyan/src/pages/dashboard/index.tsx index 21d44e55..9912593e 100644 --- a/zlt-web/yingyan/src/pages/dashboard/index.tsx +++ b/zlt-web/yingyan/src/pages/dashboard/index.tsx @@ -8,7 +8,7 @@ import { EnvironmentOutlined, PieChartOutlined } from '@ant-design/icons'; -import { Line, Pie, Column, Area, Gauge, Rose } from '@ant-design/plots'; +import { Line, Pie, Column, Area, Rose } from '@ant-design/plots'; import { history } from 'umi'; import dayjs from 'dayjs'; import { @@ -169,8 +169,14 @@ const Dashboard: React.FC = () => { radius: 0.7, innerRadius: 0.5, label: { - type: 'outer', - content: '{name} {percentage}', + text: (datum: any) => { + const name = datum?.name || ''; + const count = datum?.count ?? 0; + const data = (deviceStats?.byType || []) as { name: string; count: number }[]; + const total = data.reduce((sum, d) => sum + (d.count || 0), 0); + const percent = total > 0 ? ((count / total) * 100).toFixed(1) : 0; + return `${name} ${percent}%`; + }, style: { fill: 'rgba(255,255,255,0.65)' }, }, legend: { position: 'bottom', itemValue: { style: { fill: 'rgba(255,255,255,0.65)' } }, itemName: { style: { fill: 'rgba(255,255,255,0.65)' } } }, @@ -192,7 +198,7 @@ const Dashboard: React.FC = () => { return '#8b9dc3'; }, label: { - position: 'middle', + text: (datum: any) => datum?.value?.toString() || '0', style: { fill: '#fff' }, }, xAxis: { label: { style: { fill: 'rgba(255,255,255,0.65)' } } }, @@ -230,7 +236,7 @@ const Dashboard: React.FC = () => { smooth: true, height: 220, }; - + const roseConfig: any = { data: failureAnalysisData, xField: 'type', @@ -238,8 +244,7 @@ const Dashboard: React.FC = () => { seriesField: 'type', radius: 0.9, label: { - offset: -15, - content: '{name}', + text: (datum: any) => datum?.type || '', style: { fill: '#fff' }, }, legend: { position: 'bottom', itemName: { style: { fill: 'rgba(255,255,255,0.65)' } } }, @@ -258,8 +263,13 @@ const Dashboard: React.FC = () => { radius: 0.85, innerRadius: 0.55, label: { - type: 'outer', - content: '{name} {percentage}', + text: (datum: any) => { + const name = datum?.name || ''; + const value = datum?.value ?? 0; + const total = (taskStats?.pending || 0) + (taskStats?.running || 0) + (taskStats?.completed || 0) + (taskStats?.failed || 0); + const percent = total > 0 ? ((value / total) * 100).toFixed(1) : 0; + return `${name} ${percent}%`; + }, style: { fill: 'rgba(255,255,255,0.65)' }, }, legend: { position: 'bottom', itemValue: { style: { fill: 'rgba(255,255,255,0.65)' } }, itemName: { style: { fill: 'rgba(255,255,255,0.65)' } } }, @@ -457,21 +467,13 @@ const Dashboard: React.FC = () => {
已失败
-
- `${taskPeriodText}成功率`, - }, - }} - height={100} - /> +
+
+ {taskStats?.successRate || 0}% +
+
+ {taskPeriodText}成功率 +
diff --git a/zlt-web/yingyan/src/pages/map3d/index.tsx b/zlt-web/yingyan/src/pages/map3d/index.tsx index b0effb52..6a553f5c 100644 --- a/zlt-web/yingyan/src/pages/map3d/index.tsx +++ b/zlt-web/yingyan/src/pages/map3d/index.tsx @@ -107,9 +107,15 @@ const Map3D: React.FC = () => { setSelectedTourism(null); }; - // 返回大屏 + // 返回大屏 - 返回到进入时的来源页面 const goBack = () => { - history.push('/dashboard'); + // 检查是否有历史记录可以返回 + if (window.history.length > 1) { + history.goBack(); + } else { + // 没有历史记录时返回默认首页 + history.push('/'); + } }; // 全屏切换 diff --git a/zlt-web/yingyan/src/pages/maritime/dashboard/index.less b/zlt-web/yingyan/src/pages/maritime/dashboard/index.less new file mode 100644 index 00000000..26076528 --- /dev/null +++ b/zlt-web/yingyan/src/pages/maritime/dashboard/index.less @@ -0,0 +1,668 @@ +/* 海事智慧监控服务平台 - 主题样式 */ +/* 采用深海蓝色调 + 波浪动效 + 海事元素 - 区别于通用大屏 */ + +.maritime-dashboard { + position: relative; + width: 100%; + height: 100%; + background: linear-gradient(180deg, + #020c1b 0%, + #051525 25%, + #071e35 50%, + #0a2845 75%, + #0c3050 100%); + overflow: hidden; + display: flex; + flex-direction: column; + + /* 深海光晕效果 - 更强烈的海洋感 */ + &::before { + content: ''; + position: absolute; + inset: 0; + background: + radial-gradient(ellipse 120% 80% at 15% 25%, rgba(0, 120, 180, 0.25), transparent 50%), + radial-gradient(ellipse 100% 60% at 85% 15%, rgba(0, 180, 220, 0.2), transparent 45%), + radial-gradient(ellipse 140% 100% at 50% 95%, rgba(0, 80, 150, 0.3), transparent 55%), + radial-gradient(ellipse 80% 50% at 70% 60%, rgba(0, 150, 200, 0.12), transparent 40%); + z-index: 0; + pointer-events: none; + } + + /* 深海粒子/气泡效果背景 */ + &::after { + content: ''; + position: absolute; + inset: 0; + background-image: + radial-gradient(circle at 10% 20%, rgba(0, 200, 255, 0.03) 2px, transparent 2px), + radial-gradient(circle at 30% 40%, rgba(0, 180, 230, 0.04) 1px, transparent 1px), + radial-gradient(circle at 50% 60%, rgba(0, 220, 255, 0.03) 2px, transparent 2px), + radial-gradient(circle at 70% 30%, rgba(0, 200, 255, 0.04) 1px, transparent 1px), + radial-gradient(circle at 90% 80%, rgba(0, 180, 230, 0.03) 2px, transparent 2px); + background-size: 100px 100px, 80px 80px, 120px 120px, 90px 90px, 110px 110px; + animation: bubbleFloat 20s linear infinite; + z-index: 0; + pointer-events: none; + opacity: 0.6; + } + + /* 波浪网格动画背景 - 更细密的海图网格 */ + .wave-bg-animation { + position: absolute; + inset: 0; + background-image: + linear-gradient(rgba(0, 150, 200, 0.08) 1px, transparent 1px), + linear-gradient(90deg, rgba(0, 150, 200, 0.08) 1px, transparent 1px), + linear-gradient(rgba(0, 180, 230, 0.04) 1px, transparent 1px), + linear-gradient(90deg, rgba(0, 180, 230, 0.04) 1px, transparent 1px); + background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px; + animation: waveGrid 30s ease-in-out infinite; + z-index: 0; + pointer-events: none; + } + + /* 波浪层动画 - 更多层次 */ + .wave-layer { + position: absolute; + bottom: 0; + left: 0; + right: 0; + height: 150px; + background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 100'%3E%3Cpath fill='%230077b6' fill-opacity='0.12' d='M0,64L48,58.7C96,53,192,43,288,48C384,53,480,75,576,80C672,85,768,75,864,64C960,53,1056,43,1152,42.7C1248,43,1344,53,1392,58.7L1440,64L1440,100L1392,100C1344,100,1248,100,1152,100C1056,100,960,100,864,100C768,100,672,100,576,100C480,100,384,100,288,100C192,100,96,100,48,100L0,100Z'%3E%3C/path%3E%3C/svg%3E") repeat-x; + background-size: 1440px 120px; + animation: waveMove 10s linear infinite; + z-index: 0; + pointer-events: none; + opacity: 0.8; + } + + .wave-layer-2 { + position: absolute; + bottom: 0; + left: 0; + right: 0; + height: 100px; + background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 100'%3E%3Cpath fill='%2300b4d8' fill-opacity='0.08' d='M0,32L48,37.3C96,43,192,53,288,58.7C384,64,480,64,576,58.7C672,53,768,43,864,48C960,53,1056,75,1152,74.7C1248,75,1344,53,1392,42.7L1440,32L1440,100L1392,100C1344,100,1248,100,1152,100C1056,100,960,100,864,100C768,100,672,100,576,100C480,100,384,100,288,100C192,100,96,100,48,100L0,100Z'%3E%3C/path%3E%3C/svg%3E") repeat-x; + background-size: 1440px 80px; + animation: waveMove 7s linear infinite reverse; + z-index: 0; + pointer-events: none; + opacity: 0.6; + } + + /* 第三层波浪 - 更有层次感 */ + .wave-layer-3 { + position: absolute; + bottom: 0; + left: 0; + right: 0; + height: 60px; + background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 100'%3E%3Cpath fill='%2348cae4' fill-opacity='0.05' d='M0,50L60,45C120,40,240,30,360,35C480,40,600,60,720,65C840,70,960,60,1080,50C1200,40,1320,30,1380,25L1440,20L1440,100L1380,100C1320,100,1200,100,1080,100C960,100,840,100,720,100C600,100,480,100,360,100C240,100,120,100,60,100L0,100Z'%3E%3C/path%3E%3C/svg%3E") repeat-x; + background-size: 1440px 60px; + animation: waveMove 5s linear infinite; + z-index: 0; + pointer-events: none; + opacity: 0.5; + } +} + +/* 主内容区域 */ +.maritime-spin { + height: 100%; + :global(.ant-spin-container) { + height: 100%; + display: flex; + flex-direction: column; + } +} + +.maritime-content { + flex: 1; + padding: 16px 18px; + overflow: hidden; + position: relative; + z-index: 1; + height: 100%; +} + +.maritime-grid { + display: grid; + grid-template-columns: 25% 50% 25%; + grid-template-rows: 100%; + gap: 14px; + height: 100%; + width: 100%; +} + +.grid-col { + display: flex; + flex-direction: column; + gap: 14px; + height: 100%; + overflow: hidden; +} + +/* 海事风格玻璃面板 */ +.panel-card { + background: transparent !important; + border-radius: 10px; + display: flex; + flex-direction: column; + + &.ocean-glass { + position: relative; + background: linear-gradient(135deg, rgba(13, 33, 55, 0.85) 0%, rgba(10, 40, 70, 0.75) 100%) !important; + border: 1px solid rgba(0, 180, 230, 0.25) !important; + backdrop-filter: blur(12px); + box-shadow: + 0 4px 20px rgba(0, 0, 0, 0.3), + inset 0 1px 0 rgba(0, 200, 255, 0.1); + overflow: hidden; + + /* 四角装饰线 - 海事风格 */ + &::before { + content: ''; + position: absolute; + inset: 0; + pointer-events: none; + background: + linear-gradient(90deg, rgba(0, 180, 230, 0.7), transparent 50px) top left / 50px 2px no-repeat, + linear-gradient(180deg, rgba(0, 180, 230, 0.7), transparent 50px) top left / 2px 50px no-repeat, + linear-gradient(270deg, rgba(0, 180, 230, 0.7), transparent 50px) top right / 50px 2px no-repeat, + linear-gradient(180deg, rgba(0, 180, 230, 0.7), transparent 50px) top right / 2px 50px no-repeat, + linear-gradient(90deg, rgba(0, 180, 230, 0.7), transparent 50px) bottom left / 50px 2px no-repeat, + linear-gradient(0deg, rgba(0, 180, 230, 0.7), transparent 50px) bottom left / 2px 50px no-repeat, + linear-gradient(270deg, rgba(0, 180, 230, 0.7), transparent 50px) bottom right / 50px 2px no-repeat, + linear-gradient(0deg, rgba(0, 180, 230, 0.7), transparent 50px) bottom right / 2px 50px no-repeat; + opacity: 0.4; + } + } + + :global(.ant-card-head) { + min-height: 42px; + padding: 0 14px; + border-bottom: 1px solid rgba(0, 180, 230, 0.15); + background: linear-gradient(90deg, rgba(0, 100, 150, 0.2), transparent); + + .ant-card-head-title { + font-size: 15px; + color: #e0f7ff; + padding: 10px 0; + letter-spacing: 1px; + } + } + + :global(.ant-card-body) { + flex: 1; + padding: 12px; + overflow: hidden; + position: relative; + display: flex; + flex-direction: column; + } +} + +.chart-wrapper { + flex: 1; + width: 100%; + position: relative; + min-height: 0; + + > div { + height: 100% !important; + } +} + +.flex-grow { + flex: 1; +} + +/* 海事KPI卡片行 */ +.kpi-row { + display: grid; + grid-template-columns: repeat(4, 1fr); + gap: 12px; + height: 85px; +} + +.kpi-card { + background: linear-gradient(135deg, rgba(0, 60, 100, 0.6) 0%, rgba(0, 80, 130, 0.4) 100%); + border: 1px solid rgba(0, 180, 230, 0.2); + border-radius: 8px; + display: flex; + align-items: center; + padding: 0 16px; + position: relative; + overflow: hidden; + + /* 卡片顶部光线 */ + &::before { + content: ''; + position: absolute; + top: 0; + left: 0; + right: 0; + height: 2px; + background: linear-gradient(90deg, transparent, rgba(0, 200, 255, 0.5), transparent); + } + + .kpi-icon { + font-size: 26px; + margin-right: 14px; + width: 46px; + height: 46px; + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + background: rgba(0, 150, 200, 0.15); + + &.ship { color: #00d4ff; box-shadow: 0 0 15px rgba(0, 212, 255, 0.3); } + &.anchor { color: #00e5a0; box-shadow: 0 0 15px rgba(0, 229, 160, 0.3); } + &.alert { color: #ff9f43; box-shadow: 0 0 15px rgba(255, 159, 67, 0.3); } + &.route { color: #54a0ff; box-shadow: 0 0 15px rgba(84, 160, 255, 0.3); } + } + + .kpi-info { + .label { font-size: 12px; color: rgba(200, 230, 255, 0.7); } + .value { + font-size: 26px; + font-weight: bold; + color: #fff; + font-family: 'Segoe UI', sans-serif; + line-height: 1.2; + text-shadow: 0 0 10px rgba(0, 200, 255, 0.3); + } + small { font-size: 14px; margin-left: 2px; color: rgba(255,255,255,0.7); } + } +} + +/* 中央海图监控区域 */ +.map-portal-wrapper { + flex: 2; + position: relative; + background: linear-gradient(180deg, rgba(0, 40, 80, 0.5) 0%, rgba(0, 60, 100, 0.3) 100%); + border: 1px solid rgba(0, 180, 230, 0.35); + border-radius: 12px; + overflow: hidden; + display: flex; + justify-content: center; + align-items: center; + + /* 海图网格背景 */ + .nautical-grid { + position: absolute; + inset: 0; + background-image: + linear-gradient(rgba(0, 150, 200, 0.15) 1px, transparent 1px), + linear-gradient(90deg, rgba(0, 150, 200, 0.15) 1px, transparent 1px); + background-size: 60px 60px; + opacity: 0.5; + } + + /* 罗盘扫描效果 */ + .compass-sweep { + position: absolute; + inset: 0; + z-index: 2; + pointer-events: none; + display: flex; + align-items: center; + justify-content: center; + + &::before { + content: ''; + width: 480px; + height: 480px; + border-radius: 50%; + background: + repeating-radial-gradient(circle, rgba(0, 180, 230, 0.2) 0 1px, transparent 1px 35px), + radial-gradient(circle, rgba(0, 150, 200, 0.15), transparent 65%); + filter: drop-shadow(0 0 20px rgba(0, 180, 230, 0.2)); + opacity: 0.6; + } + + &::after { + content: ''; + position: absolute; + width: 480px; + height: 480px; + border-radius: 50%; + background: conic-gradient( + from 0deg, + rgba(0, 180, 230, 0) 0deg, + rgba(0, 180, 230, 0.35) 15deg, + rgba(0, 200, 255, 0.08) 40deg, + rgba(0, 180, 230, 0) 70deg, + rgba(0, 180, 230, 0) 360deg + ); + mix-blend-mode: screen; + animation: compassRotate 4s linear infinite; + opacity: 0.85; + } + } + + .map-content { + position: relative; + z-index: 3; + display: flex; + justify-content: center; + align-items: center; + } + + .portal-center { + text-align: center; + width: 320px; + height: 320px; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + background: linear-gradient(135deg, rgba(10, 30, 50, 0.9) 0%, rgba(15, 40, 70, 0.85) 100%); + padding: 0 30px; + border-radius: 50%; + border: 2px solid rgba(0, 180, 230, 0.4); + box-shadow: + 0 0 40px rgba(0, 180, 230, 0.25), + inset 0 0 30px rgba(0, 100, 150, 0.2); + backdrop-filter: blur(8px); + position: relative; + overflow: hidden; + + /* 内部光晕 */ + &::before { + content: ''; + position: absolute; + inset: 15px; + border-radius: 50%; + background: + radial-gradient(circle at 30% 30%, rgba(0, 200, 255, 0.2), transparent 50%), + radial-gradient(circle at 70% 70%, rgba(0, 150, 200, 0.15), transparent 50%); + opacity: 0.7; + pointer-events: none; + } + + .portal-title { + color: #e0f7ff; + margin-bottom: 20px; + font-size: 20px; + letter-spacing: 3px; + text-shadow: 0 0 15px rgba(0, 200, 255, 0.5); + } + + .portal-btn { + height: 46px; + padding: 0 36px; + font-size: 15px; + background: linear-gradient(135deg, #0096c7 0%, #0077b6 100%); + border: none; + box-shadow: 0 4px 20px rgba(0, 150, 200, 0.4); + transition: all 0.3s ease; + letter-spacing: 1px; + + &:hover { + transform: translateY(-3px); + box-shadow: 0 8px 30px rgba(0, 180, 230, 0.5); + background: linear-gradient(135deg, #00b4d8 0%, #0096c7 100%); + } + } + } +} + +/* 告警列表 - 海事风格 */ +.alert-list-container { + height: 100%; + overflow-y: auto; + + &::-webkit-scrollbar { + width: 4px; + } + &::-webkit-scrollbar-thumb { + background: rgba(0, 180, 230, 0.3); + border-radius: 2px; + } +} + +.alert-item { + padding: 10px 0 !important; + border-bottom: 1px solid rgba(0, 150, 200, 0.1) !important; + + .alert-row { + display: flex; + width: 100%; + align-items: flex-start; + + .alert-badge { + margin-right: 10px; + margin-top: 2px; + } + + .alert-content { + flex: 1; + + .alert-head { + display: flex; + justify-content: space-between; + margin-bottom: 3px; + + .alert-name { color: #e0f7ff; font-weight: 500; font-size: 13px; } + .alert-time { color: #00b4d8; font-size: 12px; font-family: monospace; } + } + + .alert-msg { + color: rgba(200, 230, 255, 0.6); + font-size: 12px; + line-height: 1.3; + } + } + } +} + +/* 船舶状态统计 */ +.ship-status-grid { + display: grid; + grid-template-columns: repeat(2, 1fr); + gap: 10px; + + .ship-stat-box { + background: linear-gradient(135deg, rgba(0, 80, 120, 0.4) 0%, rgba(0, 60, 100, 0.3) 100%); + padding: 12px; + text-align: center; + border-radius: 6px; + border: 1px solid rgba(0, 150, 200, 0.15); + + .val { + font-size: 20px; + font-weight: bold; + color: #fff; + text-shadow: 0 0 8px rgba(0, 200, 255, 0.3); + } + .lbl { font-size: 11px; color: rgba(200, 230, 255, 0.6); margin-top: 4px; } + + .val.sailing { color: #00e5a0; } + .val.anchored { color: #00b4d8; } + .val.docked { color: #54a0ff; } + .val.warning { color: #ff9f43; } + } +} + +/* 气象信息面板 */ +.weather-panel { + display: flex; + flex-wrap: wrap; + gap: 12px; + + .weather-item { + flex: 1; + min-width: 80px; + text-align: center; + padding: 10px 8px; + background: rgba(0, 100, 150, 0.2); + border-radius: 6px; + border: 1px solid rgba(0, 150, 200, 0.1); + + .weather-icon { + font-size: 24px; + margin-bottom: 6px; + color: #00b4d8; + } + + .weather-value { + font-size: 16px; + font-weight: bold; + color: #fff; + } + + .weather-label { + font-size: 11px; + color: rgba(200, 230, 255, 0.6); + margin-top: 2px; + } + } +} + +/* 港口状态 */ +.port-status-list { + .port-item { + display: flex; + align-items: center; + justify-content: space-between; + padding: 10px 12px; + background: rgba(0, 80, 120, 0.25); + border-radius: 6px; + margin-bottom: 8px; + border-left: 3px solid #00b4d8; + + .port-name { + color: #e0f7ff; + font-size: 13px; + font-weight: 500; + } + + .port-stats { + display: flex; + gap: 16px; + + .stat { + text-align: center; + + .num { font-size: 14px; font-weight: bold; color: #00e5a0; } + .txt { font-size: 10px; color: rgba(200, 230, 255, 0.5); } + } + } + } +} + +/* 任务过滤器 */ +.task-filter { + :global(.ant-segmented) { + background: rgba(0, 100, 150, 0.15); + border: 1px solid rgba(0, 150, 200, 0.2); + } + + :global(.ant-segmented-item-label) { + color: rgba(200, 230, 255, 0.75); + font-size: 12px; + } + + :global(.ant-segmented-item-selected) { + background: rgba(0, 150, 200, 0.3) !important; + } + + :global(.ant-picker) { + background: rgba(0, 100, 150, 0.15); + border: 1px solid rgba(0, 150, 200, 0.2); + color: rgba(200, 230, 255, 0.85); + } + + :global(.ant-picker-input > input) { + color: rgba(200, 230, 255, 0.85); + font-size: 12px; + } + + :global(.ant-picker-suffix) { + color: rgba(200, 230, 255, 0.55); + } +} + +/* 动画关键帧 */ +@keyframes waveGrid { + 0%, 100% { + background-position: 0 0; + transform: perspective(500px) rotateX(0deg); + } + 50% { + background-position: 25px 25px; + transform: perspective(500px) rotateX(2deg); + } +} + +@keyframes waveMove { + 0% { background-position-x: 0; } + 100% { background-position-x: 1440px; } +} + +@keyframes compassRotate { + 0% { transform: rotate(0deg); } + 100% { transform: rotate(360deg); } +} + +/* 气泡上浮动画 */ +@keyframes bubbleFloat { + 0% { + background-position: 0 0, 0 0, 0 0, 0 0, 0 0; + opacity: 0.6; + } + 50% { + opacity: 0.8; + } + 100% { + background-position: 0 -100px, 0 -80px, 0 -120px, 0 -90px, 0 -110px; + opacity: 0.6; + } +} + +/* 图标告警闪烁 */ +.icon-warning { + color: #ff9f43; + animation: warningPulse 1.5s ease-in-out infinite; +} + +@keyframes warningPulse { + 0%, 100% { opacity: 1; } + 50% { opacity: 0.5; } +} + +/* 响应式布局 */ +@media (max-width: 1400px) { + .maritime-grid { + grid-template-columns: 28% 44% 28%; + } +} + +@media (max-width: 1200px) { + .maritime-dashboard { + height: auto; + overflow-y: auto; + } + + .maritime-content { + height: auto; + overflow: visible; + } + + .maritime-grid { + grid-template-columns: 1fr; + grid-template-rows: auto; + } + + .grid-col { + height: auto; + min-height: 400px; + } + + .map-portal-wrapper { + min-height: 320px; + } +} diff --git a/zlt-web/yingyan/src/pages/maritime/dashboard/index.tsx b/zlt-web/yingyan/src/pages/maritime/dashboard/index.tsx new file mode 100644 index 00000000..887e3f09 --- /dev/null +++ b/zlt-web/yingyan/src/pages/maritime/dashboard/index.tsx @@ -0,0 +1,540 @@ +import React, { useState, useEffect, useCallback, useMemo } from 'react'; +import { Card, Button, List, Tag, Spin, message, DatePicker, Segmented, Space } from 'antd'; +import { + CheckCircleOutlined, + WarningOutlined, + RocketOutlined, + CompassOutlined, + PieChartOutlined, +} from '@ant-design/icons'; +import { Line, Pie, Column, Area, Rose } from '@ant-design/plots'; +import { history } from 'umi'; +import dayjs from 'dayjs'; +import { + getDeviceStats, + getTaskStats, + getTrendData, + getMockAlerts, + DeviceStats, + TaskStats, + TrendItem, + AlertItem, +} from '@/services/dashboard'; +import './index.less'; + +// 无人船图标组件 +const USVIcon = () => ( + + + +); + +const MaritimeDashboard: React.FC = () => { + const [loading, setLoading] = useState(true); + const [deviceStats, setDeviceStats] = useState(null); + const [taskStats, setTaskStats] = useState(null); + const [taskTrend, setTaskTrend] = useState([]); + const [deviceTrend, setDeviceTrend] = useState([]); + const [alerts, setAlerts] = useState([]); + const [annualData, setAnnualData] = useState([]); + const [violationAnalysisData, setViolationAnalysisData] = useState([]); + const [taskStatType, setTaskStatType] = useState<'day' | 'month' | 'year'>('day'); + const [taskStatDate, setTaskStatDate] = useState(dayjs()); + const [tenantId, setTenantId] = useState(); + const [includeChildren, setIncludeChildren] = useState(true); + + useEffect(() => { + // 模拟年度数据 + const mockAnnual: any[] = []; + for (let i = 1; i <= 12; i++) { + mockAnnual.push({ + month: `${i}月`, + value: Math.floor(Math.random() * 500) + 100, + type: '巡检任务', + }); + mockAnnual.push({ + month: `${i}月`, + value: Math.floor(Math.random() * 450) + 80, + type: '完成任务', + }); + } + setAnnualData(mockAnnual); + + // 违规类型分析数据 + setViolationAnalysisData([ + { type: '超速航行', value: 32 }, + { type: '违规锚泊', value: 25 }, + { type: '未按航道行驶', value: 20 }, + { type: '证照过期', value: 12 }, + { type: '污染排放', value: 8 }, + { type: '其他违规', value: 3 }, + ]); + }, []); + + useEffect(() => { + const handler = (e: any) => { + const nextTenantId = e?.detail?.tenantId as string | undefined; + const nextIncludeChildren = !!e?.detail?.includeChildren; + setTenantId(nextTenantId); + setIncludeChildren(nextIncludeChildren); + }; + window.addEventListener('tenant-change', handler as any); + return () => window.removeEventListener('tenant-change', handler as any); + }, []); + + const fetchData = useCallback(async () => { + setLoading(true); + try { + const [deviceRes, taskRes, trendRes] = await Promise.all([ + getDeviceStats({ tenantId, includeChildren }), + getTaskStats({ + tenantId, + includeChildren, + statType: taskStatType, + date: + taskStatType === 'day' + ? taskStatDate.format('YYYY-MM-DD') + : taskStatType === 'month' + ? taskStatDate.format('YYYY-MM') + : taskStatDate.format('YYYY'), + }), + getTrendData(7), + ]); + setDeviceStats(deviceRes); + setTaskStats(taskRes); + setTaskTrend(trendRes.taskTrend); + setDeviceTrend(trendRes.deviceTrend); + // 模拟海事告警数据 + setAlerts(getMaritimeAlerts()); + } catch (error) { + console.error('获取数据失败:', error); + message.error('数据加载异常'); + } finally { + setLoading(false); + } + }, [includeChildren, taskStatDate, taskStatType, tenantId]); + + // 海事专用告警数据 + const getMaritimeAlerts = (): AlertItem[] => { + return [ + { id: '1', type: 'device_fault', level: 'critical', deviceName: '巡检船-01', message: '检测到船只超速航行,航速28节', timestamp: new Date(Date.now() - 120000).toISOString() }, + { id: '2', type: 'device_offline', level: 'error', deviceName: '巡检船-03', message: '设备信号丢失超过10分钟', timestamp: new Date(Date.now() - 300000).toISOString() }, + { id: '3', type: 'task_failed', level: 'warning', taskName: '巡检任务#1024', message: '发现违规锚泊船只1艘', timestamp: new Date(Date.now() - 600000).toISOString() }, + { id: '4', type: 'low_battery', level: 'warning', deviceName: '巡检船-02', message: '电池电量低于20%', timestamp: new Date(Date.now() - 900000).toISOString() }, + { id: '5', type: 'task_failed', level: 'warning', taskName: '巡检任务#1023', message: '巡检完成,未发现违规', timestamp: new Date(Date.now() - 1200000).toISOString() }, + ]; + }; + + useEffect(() => { + if (!tenantId) return; + fetchData(); + }, [fetchData]); + + // 定时刷新 + useEffect(() => { + const dataTimer = setInterval(fetchData, 30000); + return () => { + clearInterval(dataTimer); + }; + }, [fetchData]); + + const goTo3D = () => { + history.push('/map3d'); + }; + + // --- 图表配置 --- + + const taskTrendSeriesData = useMemo(() => { + return taskTrend.flatMap((t) => [ + { date: t.date, type: '下发', value: t.created || 0 }, + { date: t.date, type: '完成', value: t.completed || 0 }, + { date: t.date, type: '失败', value: t.failed || 0 }, + ]); + }, [taskTrend]); + + const deviceOnlineRateTrendData = useMemo(() => { + return deviceTrend.map((t) => { + const total = t.total || 0; + const online = t.online || 0; + return { + date: t.date, + value: total > 0 ? Math.round((online / total) * 100) : 0, + }; + }); + }, [deviceTrend]); + + const taskTrendConfig: any = { + data: taskTrendSeriesData, + xField: 'date', + yField: 'value', + seriesField: 'type', + smooth: true, + color: ['#00b4d8', '#00e5a0', '#ff9f43'], + areaStyle: { + fill: 'l(270) 0:#ffffff 0.5:#7ec2f3 1:#0077b6', + fillOpacity: 0.1, + }, + xAxis: { label: { style: { fill: 'rgba(200,230,255,0.65)' } }, grid: null }, + yAxis: { label: { style: { fill: 'rgba(200,230,255,0.65)' } }, grid: { line: { style: { stroke: 'rgba(0,150,200,0.1)' } } } }, + tooltip: { showMarkers: true }, + height: 180, + }; + + // 设备类型分布 - 模拟数据 + const usvTypeData: { name: string; count: number }[] = useMemo(() => { + return (deviceStats?.byType || [ + { name: '巡检型', count: 12 }, + { name: '监测型', count: 8 }, + { name: '救援型', count: 5 }, + { name: '测量型', count: 3 }, + ]).map(item => ({ name: item.name, count: item.count })); + }, [deviceStats]); + + const pieConfig: any = { + data: usvTypeData, + angleField: 'count', + colorField: 'name', + radius: 0.7, + innerRadius: 0.5, + color: ['#00b4d8', '#0096c7', '#00e5a0', '#48cae4'], + label: { + text: (datum: any) => { + const name = datum?.name || ''; + const count = datum?.count ?? 0; + const data = usvTypeData as { name: string; count: number }[]; + const total = data.reduce((sum, d) => sum + (d.count || 0), 0); + const percent = total > 0 ? ((count / total) * 100).toFixed(1) : 0; + return `${name} ${percent}%`; + }, + style: { fill: 'rgba(200,230,255,0.65)' }, + }, + legend: { position: 'bottom', itemValue: { style: { fill: 'rgba(200,230,255,0.65)' } }, itemName: { style: { fill: 'rgba(200,230,255,0.65)' } } }, + height: 200, + }; + + const columnConfig: any = { + data: [ + { type: '在线', value: deviceStats?.online || 0 }, + { type: '离线', value: deviceStats?.offline || 0 }, + { type: '故障', value: deviceStats?.fault || 0 }, + ], + xField: 'type', + yField: 'value', + seriesField: 'type', + color: ({ type }: any) => { + if (type === '在线') return '#00e5a0'; + if (type === '故障') return '#ff4d4f'; + return '#8b9dc3'; + }, + label: { + text: (datum: any) => datum?.value?.toString() || '0', + style: { fill: '#fff' }, + }, + xAxis: { label: { style: { fill: 'rgba(200,230,255,0.65)' } } }, + yAxis: { label: { style: { fill: 'rgba(200,230,255,0.65)' } }, grid: { line: { style: { stroke: 'rgba(0,150,200,0.1)' } } } }, + legend: false, + height: 180, + }; + + const deviceOnlineRateConfig: any = { + data: deviceOnlineRateTrendData, + xField: 'date', + yField: 'value', + smooth: true, + color: '#00b4d8', + areaStyle: { fillOpacity: 0.2 }, + xAxis: { label: { style: { fill: 'rgba(200,230,255,0.65)' } }, grid: null }, + yAxis: { + label: { style: { fill: 'rgba(200,230,255,0.65)' } }, + grid: { line: { style: { stroke: 'rgba(0,150,200,0.08)' } } }, + }, + tooltip: { showMarkers: true }, + height: 160, + }; + + const areaConfig: any = { + data: annualData, + xField: 'month', + yField: 'value', + seriesField: 'type', + color: ['#00b4d8', '#00e5a0'], + areaStyle: { fillOpacity: 0.25 }, + xAxis: { label: { style: { fill: 'rgba(200,230,255,0.65)' } } }, + yAxis: { label: { style: { fill: 'rgba(200,230,255,0.65)' } }, grid: { line: { style: { stroke: 'rgba(0,150,200,0.1)' } } } }, + legend: { position: 'top-right', itemName: { style: { fill: 'rgba(200,230,255,0.8)' } } }, + smooth: true, + height: 220, + }; + + const roseConfig: any = { + data: violationAnalysisData, + xField: 'type', + yField: 'value', + seriesField: 'type', + radius: 0.9, + color: ['#ff6b6b', '#ffa502', '#ff9f43', '#00b4d8', '#48cae4', '#90e0ef'], + label: { + text: (datum: any) => datum?.type || '', + style: { fill: '#fff', fontSize: 10 }, + }, + legend: { position: 'bottom', itemName: { style: { fill: 'rgba(200,230,255,0.65)' } } }, + height: 200, + }; + + const taskStatusPieConfig: any = { + data: [ + { name: '待执行', value: taskStats?.pending || 0 }, + { name: '执行中', value: taskStats?.running || 0 }, + { name: '已完成', value: taskStats?.completed || 0 }, + { name: '已失败', value: taskStats?.failed || 0 }, + ], + angleField: 'value', + colorField: 'name', + radius: 0.85, + innerRadius: 0.55, + color: ['#ffa502', '#00b4d8', '#00e5a0', '#ff6b6b'], + label: { + text: (datum: any) => { + const name = datum?.name || ''; + const value = datum?.value ?? 0; + const total = (taskStats?.pending || 0) + (taskStats?.running || 0) + (taskStats?.completed || 0) + (taskStats?.failed || 0); + const percent = total > 0 ? ((value / total) * 100).toFixed(1) : 0; + return `${name} ${percent}%`; + }, + style: { fill: 'rgba(200,230,255,0.65)' }, + }, + legend: { position: 'bottom', itemValue: { style: { fill: 'rgba(200,230,255,0.65)' } }, itemName: { style: { fill: 'rgba(200,230,255,0.65)' } } }, + height: 190, + }; + + const getAlertColor = (level: string) => { + switch (level) { + case 'critical': return '#ff4757'; + case 'error': return '#ff9f43'; + case 'warning': return '#feca57'; + default: return '#54a0ff'; + } + }; + + const taskPeriodText = useMemo(() => { + if (taskStatType === 'day') return '当日'; + if (taskStatType === 'month') return '当月'; + return '当年'; + }, [taskStatType]); + + const taskNewLabel = useMemo(() => { + if (taskStatType === 'day') return '当日任务'; + if (taskStatType === 'month') return '当月任务'; + return '当年任务'; + }, [taskStatType]); + + const datePickerFormat = useMemo(() => { + if (taskStatType === 'day') return 'YYYY-MM-DD'; + if (taskStatType === 'month') return 'YYYY-MM'; + return 'YYYY'; + }, [taskStatType]); + + return ( +
+
+
+
+
+ + +
+
+ + {/* 左侧栏:设备态势 */} +
+ +
+ +
+
+ + +
+ +
+
+ + +
+ +
+
+ + 实时告警} + className="panel-card ocean-glass flex-grow" + size="small" + extra={LIVE} + > +
+ ( + +
+
+ {item.level.toUpperCase().slice(0, 1)} +
+
+
+ {item.deviceName || item.taskName} + {dayjs(item.timestamp).format('HH:mm')} +
+
{item.message}
+
+
+
+ )} + /> +
+
+
+ + {/* 中间栏:核心监控 */} +
+ {/* 顶部KPI */} +
+
+
+
+
设备总数
+
{deviceStats?.total || 0}
+
+
+
+
+
+
在线率
+
{deviceStats?.onlineRate || 0}%
+
+
+
+
+
+
{taskNewLabel}
+
{taskStats?.todayNew || 0}
+
+
+
+
+
+
执行成功率
+
{taskStats?.successRate || 0}%
+
+
+
+ + {/* 海域监控入口 */} +
+
+
+
+
+ +

海域智慧巡检监控中心

+ +
+
+
+ + {/* 年度巡检任务趋势 */} + +
+ +
+
+
+ + {/* 右侧栏:任务与运维 */} +
+ + setTaskStatType(v as any)} + /> + v && setTaskStatDate(v)} + picker={taskStatType === 'day' ? 'date' : taskStatType} + allowClear={false} + format={datePickerFormat} + disabledDate={(d) => !!d && d.isAfter(dayjs(), 'day')} + /> + + } + > +
+
+
{taskStats?.pending || 0}
+
待执行
+
+
+
{taskStats?.running || 0}
+
执行中
+
+
+
{taskStats?.completed || 0}
+
已完成
+
+
+
{taskStats?.failed || 0}
+
已失败
+
+
+
+
+ {taskStats?.successRate || 0}% +
+
+ {taskPeriodText}成功率 +
+
+
+ + +
+ +
+
+ + +
+ +
+
+ + +
+ +
+
+
+ +
+
+
+
+ ); +}; + +export default MaritimeDashboard; diff --git a/zlt-web/yingyan/src/pages/user/Login/index.tsx b/zlt-web/yingyan/src/pages/user/Login/index.tsx index a0e61b6b..b5fded7c 100644 --- a/zlt-web/yingyan/src/pages/user/Login/index.tsx +++ b/zlt-web/yingyan/src/pages/user/Login/index.tsx @@ -52,8 +52,8 @@ const LoginPage: React.FC = () => { setTimeout(() => { const { query } = history.location as any; const { redirect } = query || {}; - // 跳转到大屏首页 - const targetPath = redirect || '/dashboard'; + // 跳转到首页(由路由配置决定默认页面) + const targetPath = redirect || '/'; history.push(targetPath); }, 1000); } else { diff --git a/zlt-web/yingyan/src/services/maritime.ts b/zlt-web/yingyan/src/services/maritime.ts new file mode 100644 index 00000000..a1c777a0 --- /dev/null +++ b/zlt-web/yingyan/src/services/maritime.ts @@ -0,0 +1,381 @@ +/** + * 海事智慧监控服务平台 - 数据服务层 + * 提供船舶、港口、航线、气象等数据接口 + */ + +import { request } from 'umi'; + +// 类型定义 +export interface ShipInfo { + id: string; + name: string; + mmsi: string; // 海上移动业务标识 + imo?: string; // 国际海事组织编号 + callSign?: string; // 呼号 + type: 'cargo' | 'container' | 'tanker' | 'fishing' | 'passenger' | 'other'; + typeName: string; + status: 'sailing' | 'anchored' | 'docked' | 'warning'; + position: { + lat: number; + lng: number; + }; + speed: number; // 节 + course: number; // 航向 + destination?: string; + eta?: string; // 预计到达时间 + lastUpdate: number; +} + +export interface MaritimeStats { + totalShips: number; + sailingShips: number; + anchoredShips: number; + dockedShips: number; + warningShips: number; + totalRoutes: number; + activeRoutes: number; + byType: Array<{ name: string; count: number }>; + ports: PortInfo[]; +} + +export interface PortInfo { + id: string; + name: string; + code: string; + ships: number; + capacity: number; + status: 'normal' | 'busy' | 'full'; + position: { + lat: number; + lng: number; + }; + berthsTotal: number; + berthsOccupied: number; +} + +export interface RouteInfo { + id: string; + name: string; + startPort: string; + endPort: string; + distance: number; // 海里 + activeShips: number; + status: 'active' | 'congested' | 'closed'; + waypoints: Array<{ lat: number; lng: number }>; +} + +export interface WeatherData { + windSpeed: number; // m/s + windDirection: string; + windDegree: number; + waveHeight: number; // 米 + wavePeriod: number; // 秒 + visibility: number; // 公里 + temperature: number; // 摄氏度 + humidity: number; // 百分比 + pressure: number; // 百帕 + seaTemp: number; // 海水温度 + tideHeight: number; // 潮高 + tideStatus: 'rising' | 'falling' | 'high' | 'low'; + forecast: string; + warningLevel?: 'blue' | 'yellow' | 'orange' | 'red'; + warningMessage?: string; +} + +export interface MaritimeAlert { + id: string; + level: 'critical' | 'error' | 'warning' | 'info'; + type: 'signal' | 'route' | 'area' | 'weather' | 'collision' | 'speed' | 'other'; + typeName: string; + shipId?: string; + shipName?: string; + message: string; + description?: string; + position?: { lat: number; lng: number }; + timestamp: number; + acknowledged: boolean; + acknowledgedBy?: string; + acknowledgedAt?: number; +} + +export interface TrendItem { + date: string; + departures: number; + arrivals: number; + alerts: number; + incidents?: number; +} + +export interface ShipMovementStats { + period: 'day' | 'month' | 'year'; + date: string; + arrivals: number; + departures: number; + throughput: number; + averageStayHours: number; + peakHour?: string; +} + +// API 接口封装 + +/** + * 获取海事统计概览 + */ +export async function getMaritimeStats(params?: { + tenantId?: string; + includeChildren?: boolean; +}): Promise { + // 模拟数据,实际项目中替换为真实API调用 + // return request('/api-device/maritime/stats', { params }); + + return Promise.resolve({ + totalShips: 156, + sailingShips: 78, + anchoredShips: 32, + dockedShips: 41, + warningShips: 5, + totalRoutes: 24, + activeRoutes: 18, + byType: [ + { name: '货轮', count: 45 }, + { name: '集装箱船', count: 38 }, + { name: '油轮', count: 28 }, + { name: '渔船', count: 25 }, + { name: '客轮', count: 12 }, + { name: '其他', count: 8 }, + ], + ports: [ + { id: '1', name: '深圳港', code: 'SZPORT', ships: 28, capacity: 40, status: 'busy', position: { lat: 22.5, lng: 114.1 }, berthsTotal: 40, berthsOccupied: 32 }, + { id: '2', name: '广州港', code: 'GZPORT', ships: 35, capacity: 50, status: 'normal', position: { lat: 23.1, lng: 113.3 }, berthsTotal: 50, berthsOccupied: 35 }, + { id: '3', name: '香港港', code: 'HKPORT', ships: 22, capacity: 35, status: 'normal', position: { lat: 22.3, lng: 114.2 }, berthsTotal: 35, berthsOccupied: 22 }, + { id: '4', name: '珠海港', code: 'ZHPORT', ships: 15, capacity: 20, status: 'busy', position: { lat: 22.3, lng: 113.6 }, berthsTotal: 20, berthsOccupied: 17 }, + ], + }); +} + +/** + * 获取船舶列表 + */ +export async function getShipList(params?: { + status?: string; + type?: string; + portId?: string; + page?: number; + pageSize?: number; +}): Promise<{ list: ShipInfo[]; total: number }> { + // return request('/api-device/maritime/ships', { params }); + + // 模拟数据 + const mockShips: ShipInfo[] = []; + for (let i = 1; i <= 20; i++) { + const types = ['cargo', 'container', 'tanker', 'fishing', 'passenger', 'other'] as const; + const typeNames = ['货轮', '集装箱船', '油轮', '渔船', '客轮', '其他']; + const statuses = ['sailing', 'anchored', 'docked'] as const; + const typeIndex = i % 6; + + mockShips.push({ + id: `ship-${i}`, + name: `远洋${typeNames[typeIndex]}${i.toString().padStart(2, '0')}`, + mmsi: `4123456${i.toString().padStart(2, '0')}`, + type: types[typeIndex], + typeName: typeNames[typeIndex], + status: statuses[i % 3], + position: { + lat: 22.3 + Math.random() * 0.5, + lng: 113.8 + Math.random() * 0.6, + }, + speed: Math.floor(Math.random() * 15) + 5, + course: Math.floor(Math.random() * 360), + destination: ['深圳港', '广州港', '香港港'][i % 3], + lastUpdate: Date.now() - Math.floor(Math.random() * 600000), + }); + } + + return Promise.resolve({ list: mockShips, total: 156 }); +} + +/** + * 获取港口列表 + */ +export async function getPortList(): Promise { + // return request('/api-device/maritime/ports'); + + return Promise.resolve([ + { id: '1', name: '深圳港', code: 'SZPORT', ships: 28, capacity: 40, status: 'busy', position: { lat: 22.5, lng: 114.1 }, berthsTotal: 40, berthsOccupied: 32 }, + { id: '2', name: '广州港', code: 'GZPORT', ships: 35, capacity: 50, status: 'normal', position: { lat: 23.1, lng: 113.3 }, berthsTotal: 50, berthsOccupied: 35 }, + { id: '3', name: '香港港', code: 'HKPORT', ships: 22, capacity: 35, status: 'normal', position: { lat: 22.3, lng: 114.2 }, berthsTotal: 35, berthsOccupied: 22 }, + { id: '4', name: '珠海港', code: 'ZHPORT', ships: 15, capacity: 20, status: 'busy', position: { lat: 22.3, lng: 113.6 }, berthsTotal: 20, berthsOccupied: 17 }, + { id: '5', name: '中山港', code: 'ZSPORT', ships: 12, capacity: 18, status: 'normal', position: { lat: 22.5, lng: 113.4 }, berthsTotal: 18, berthsOccupied: 12 }, + ]); +} + +/** + * 获取航线列表 + */ +export async function getRouteList(): Promise { + // return request('/api-device/maritime/routes'); + + return Promise.resolve([ + { id: '1', name: '深圳-香港航线', startPort: '深圳港', endPort: '香港港', distance: 35, activeShips: 8, status: 'active', waypoints: [] }, + { id: '2', name: '广州-深圳航线', startPort: '广州港', endPort: '深圳港', distance: 120, activeShips: 12, status: 'active', waypoints: [] }, + { id: '3', name: '珠海-澳门航线', startPort: '珠海港', endPort: '澳门港', distance: 15, activeShips: 5, status: 'active', waypoints: [] }, + { id: '4', name: '东南亚主航线', startPort: '深圳港', endPort: '新加坡', distance: 1580, activeShips: 15, status: 'active', waypoints: [] }, + { id: '5', name: '东北亚航线', startPort: '广州港', endPort: '釜山港', distance: 1200, activeShips: 10, status: 'congested', waypoints: [] }, + ]); +} + +/** + * 获取气象海况数据 + */ +export async function getWeatherData(params?: { + lat?: number; + lng?: number; + areaCode?: string; +}): Promise { + // return request('/api-device/maritime/weather', { params }); + + return Promise.resolve({ + windSpeed: 18, + windDirection: '东南风', + windDegree: 135, + waveHeight: 1.2, + wavePeriod: 6, + visibility: 12, + temperature: 26, + humidity: 78, + pressure: 1013, + seaTemp: 24, + tideHeight: 2.3, + tideStatus: 'rising', + forecast: '多云转晴,风力3-4级', + }); +} + +/** + * 获取海事告警列表 + */ +export async function getMaritimeAlerts(params?: { + level?: string; + type?: string; + acknowledged?: boolean; + page?: number; + pageSize?: number; +}): Promise<{ list: MaritimeAlert[]; total: number }> { + // return request('/api-device/maritime/alerts', { params }); + + const mockAlerts: MaritimeAlert[] = [ + { id: '1', level: 'critical', type: 'signal', typeName: '信号异常', shipId: 's1', shipName: '远洋货轮01', message: 'AIS信号丢失超过30分钟', timestamp: Date.now() - 120000, acknowledged: false }, + { id: '2', level: 'error', type: 'route', typeName: '航线偏离', shipId: 's2', shipName: '集装箱船12', message: '偏离预定航线3海里', timestamp: Date.now() - 300000, acknowledged: false }, + { id: '3', level: 'warning', type: 'area', typeName: '区域告警', shipId: 's3', shipName: '油轮A7', message: '进入限制航行区域', timestamp: Date.now() - 600000, acknowledged: true }, + { id: '4', level: 'warning', type: 'weather', typeName: '气象预警', message: '珠江口区域大雾预警', timestamp: Date.now() - 900000, acknowledged: false }, + { id: '5', level: 'info', type: 'area', typeName: '区域提醒', shipId: 's5', shipName: '渔船F23', message: '即将进入港口管控区', timestamp: Date.now() - 1200000, acknowledged: true }, + ]; + + return Promise.resolve({ list: mockAlerts, total: mockAlerts.length }); +} + +/** + * 获取趋势数据 + */ +export async function getTrendData(days: number = 7): Promise { + // return request('/api-device/maritime/trend', { params: { days } }); + + const data: TrendItem[] = []; + const dayjs = require('dayjs'); + for (let i = days - 1; i >= 0; i--) { + const date = dayjs().subtract(i, 'day').format('MM-DD'); + data.push({ + date, + departures: Math.floor(Math.random() * 30) + 20, + arrivals: Math.floor(Math.random() * 35) + 18, + alerts: Math.floor(Math.random() * 10) + 2, + incidents: Math.floor(Math.random() * 3), + }); + } + return Promise.resolve(data); +} + +/** + * 获取船舶动态统计 + */ +export async function getShipMovementStats(params: { + period: 'day' | 'month' | 'year'; + date: string; +}): Promise { + // return request('/api-device/maritime/movement-stats', { params }); + + return Promise.resolve({ + period: params.period, + date: params.date, + arrivals: Math.floor(Math.random() * 50) + 30, + departures: Math.floor(Math.random() * 45) + 28, + throughput: Math.floor(Math.random() * 100) + 60, + averageStayHours: Math.floor(Math.random() * 24) + 12, + peakHour: '14:00-16:00', + }); +} + +/** + * 确认告警 + */ +export async function acknowledgeAlert(alertId: string): Promise { + // return request('/api-device/maritime/alerts/acknowledge', { method: 'POST', data: { alertId } }); + + return Promise.resolve(true); +} + +/** + * 获取船舶详情 + */ +export async function getShipDetail(shipId: string): Promise { + // return request(`/api-device/maritime/ships/${shipId}`); + + return Promise.resolve({ + id: shipId, + name: '远洋货轮01', + mmsi: '412345601', + imo: '9123456', + callSign: 'VRBC7', + type: 'cargo', + typeName: '货轮', + status: 'sailing', + position: { lat: 22.45, lng: 114.05 }, + speed: 12.5, + course: 180, + destination: '深圳港', + eta: '2024-01-15 14:30', + lastUpdate: Date.now() - 60000, + }); +} + +/** + * 获取年度统计数据 + */ +export async function getAnnualStats(year?: number): Promise> { + // return request('/api-device/maritime/annual-stats', { params: { year } }); + + const data = []; + for (let i = 1; i <= 12; i++) { + data.push({ + month: `${i}月`, + arrivals: Math.floor(Math.random() * 800) + 400, + departures: Math.floor(Math.random() * 750) + 380, + }); + } + return Promise.resolve(data); +} + +/** + * 获取航线分布统计 + */ +export async function getRouteDistribution(): Promise> { + // return request('/api-device/maritime/route-distribution'); + + return Promise.resolve([ + { type: '东南亚航线', value: 35 }, + { type: '东北亚航线', value: 28 }, + { type: '欧洲航线', value: 18 }, + { type: '美洲航线', value: 12 }, + { type: '内河航线', value: 7 }, + ]); +}