feat: 1:手机号发送验证码
2:手机号验证码登录
This commit is contained in:
Binary file not shown.
@@ -1,64 +1,65 @@
|
|||||||
|
已配置在nacos中,此配置文件作废
|
||||||
# 消息中心配置文件
|
# 消息中心配置文件
|
||||||
spring:
|
#spring:
|
||||||
datasource:
|
# datasource:
|
||||||
url: jdbc:mysql://${zlt.datasource.ip}/msg-center?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai
|
# url: jdbc:mysql://${zlt.datasource.ip}/msg-center?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai
|
||||||
username: ${zlt.datasource.username}
|
# username: ${zlt.datasource.username}
|
||||||
password: ${zlt.datasource.password}
|
# password: ${zlt.datasource.password}
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
# driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
#
|
||||||
mybatis-plus:
|
#mybatis-plus:
|
||||||
mapper-locations: classpath:/mapper/*Mapper.xml
|
# mapper-locations: classpath:/mapper/*Mapper.xml
|
||||||
type-aliases-package: com.central.msg.model.entity
|
# type-aliases-package: com.central.msg.model.entity
|
||||||
global-config:
|
# global-config:
|
||||||
db-config:
|
# db-config:
|
||||||
id-type: auto
|
# id-type: auto
|
||||||
|
#
|
||||||
springdoc:
|
#springdoc:
|
||||||
group-configs:
|
# group-configs:
|
||||||
- group: 'default'
|
# - group: 'default'
|
||||||
paths-to-match: '/**'
|
# paths-to-match: '/**'
|
||||||
packages-to-scan: com.central.msg.controller
|
# packages-to-scan: com.central.msg.controller
|
||||||
|
#
|
||||||
knife4j:
|
#knife4j:
|
||||||
enable: true
|
# enable: true
|
||||||
setting:
|
# setting:
|
||||||
swagger-model-name: 消息中心接口文档
|
# swagger-model-name: 消息中心接口文档
|
||||||
|
#
|
||||||
# 短信服务配置
|
## 短信服务配置
|
||||||
sms:
|
#sms:
|
||||||
# 短信服务提供商: TENCENT(腾讯云) 或 ALIYUN(阿里云)
|
# # 短信服务提供商: TENCENT(腾讯云) 或 ALIYUN(阿里云)
|
||||||
# 默认提供商,用于未指定提供商的接口
|
# # 默认提供商,用于未指定提供商的接口
|
||||||
provider: ${SMS_PROVIDER:TENCENT}
|
# provider: ${SMS_PROVIDER :TENCENT}
|
||||||
|
#
|
||||||
# 腾讯云短信配置
|
# # 腾讯云短信配置
|
||||||
tencent:
|
# tencent:
|
||||||
# 腾讯云短信应用ID (在腾讯云短信控制台获取)
|
# # 腾讯云短信应用ID (在腾讯云短信控制台获取)
|
||||||
app-id: ${SMS_TENCENT_APP_ID:}
|
# app-id: 1401077992
|
||||||
# 腾讯云SecretId (在腾讯云控制台获取)
|
# # 腾讯云SecretId (在腾讯云控制台获取)
|
||||||
secret-id: ${SMS_TENCENT_SECRET_ID:}
|
# secret-id: AKIDuiNrAF7mETXO5au1vgFbjfOuCIG3cx62
|
||||||
# 腾讯云SecretKey (在腾讯云控制台获取)
|
# # 腾讯云SecretKey (在腾讯云控制台获取)
|
||||||
secret-key: ${SMS_TENCENT_SECRET_KEY:}
|
# secret-key: nMkvsb6OSJwQjphLlxxmQsAGF6kBGF3d
|
||||||
# 短信签名 (在腾讯云短信控制台配置)
|
# # 短信签名 (在腾讯云短信控制台配置)
|
||||||
sign-name: ${SMS_TENCENT_SIGN_NAME:}
|
# sign-name: 北京高飞智航科技
|
||||||
# 验证码模板ID
|
# # 验证码模板ID
|
||||||
verify-code-template-id: ${SMS_TENCENT_VERIFY_CODE_TEMPLATE_ID:}
|
# verify-code-template-id: 2589777
|
||||||
|
#
|
||||||
# 阿里云短信配置
|
# # 阿里云短信配置
|
||||||
aliyun:
|
# aliyun:
|
||||||
# 阿里云AccessKeyId (在阿里云控制台获取)
|
# # 阿里云AccessKeyId (在阿里云控制台获取)
|
||||||
access-key-id: ${SMS_ALIYUN_ACCESS_KEY_ID:}
|
# access-key-id: LTAI5tS3aRqJ4Et55s1g3Bkw
|
||||||
# 阿里云AccessKeySecret (在阿里云控制台获取)
|
# # 阿里云AccessKeySecret (在阿里云控制台获取)
|
||||||
access-key-secret: ${SMS_ALIYUN_ACCESS_KEY_SECRET:}
|
# access-key-secret: 0A7SumjhpzRmHEhK5aOkcysLu3zAcq
|
||||||
# 短信签名 (在阿里云短信控制台配置)
|
# # 短信签名 (在阿里云短信控制台配置)
|
||||||
sign-name: ${SMS_ALIYUN_SIGN_NAME:}
|
# sign-name: 阿里云短信测试
|
||||||
# 验证码模板ID
|
# # 验证码模板ID
|
||||||
verify-code-template-id: ${SMS_ALIYUN_VERIFY_CODE_TEMPLATE_ID:}
|
# verify-code-template-id: SMS_154950909
|
||||||
|
#
|
||||||
# 是否保存短信发送记录到数据库
|
# # 是否保存短信发送记录到数据库
|
||||||
save-log: ${SMS_SAVE_LOG:true}
|
# save-log: ${SMS_SAVE_LOG:true}
|
||||||
|
#
|
||||||
# 多租户配置
|
## 多租户配置
|
||||||
zlt:
|
#zlt:
|
||||||
tenant:
|
# tenant:
|
||||||
enable: true
|
# enable: true
|
||||||
|
|
||||||
|
|||||||
+12
@@ -120,6 +120,18 @@ public class SysUserController {
|
|||||||
return appUserService.findByOpenId(openId);
|
return appUserService.findByOpenId(openId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过手机号注册用户
|
||||||
|
*
|
||||||
|
* @param mobile 手机号
|
||||||
|
* @return 注册后的用户信息(包含openId)
|
||||||
|
*/
|
||||||
|
@PostMapping(value = "/users-anon/register/mobile")
|
||||||
|
@Operation(summary = "通过手机号注册用户")
|
||||||
|
public SysUser registerByMobile(@RequestParam("mobile") String mobile) throws Exception {
|
||||||
|
return appUserService.registerByMobile(mobile);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据WxOpenId查询用户信息
|
* 根据WxOpenId查询用户信息
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -116,4 +116,12 @@ public interface ISysUserService extends ISuperService<SysUser> {
|
|||||||
* @return 删除结果
|
* @return 删除结果
|
||||||
*/
|
*/
|
||||||
boolean completelyDeleteUser(Long userId);
|
boolean completelyDeleteUser(Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过手机号注册用户
|
||||||
|
* @param mobile 手机号
|
||||||
|
* @return 注册后的用户信息(包含openId)
|
||||||
|
* @throws Exception 注册异常
|
||||||
|
*/
|
||||||
|
SysUser registerByMobile(String mobile) throws Exception;
|
||||||
}
|
}
|
||||||
|
|||||||
+37
@@ -449,4 +449,41 @@ public class SysUserServiceImpl extends SuperServiceImpl<SysUserMapper, SysUser>
|
|||||||
}
|
}
|
||||||
return sysUserExcels;
|
return sysUserExcels;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public SysUser registerByMobile(String mobile) throws Exception {
|
||||||
|
// 先检查手机号是否已注册
|
||||||
|
SysUser existUser = this.selectByMobile(mobile);
|
||||||
|
if (existUser != null) {
|
||||||
|
// 已存在,直接返回
|
||||||
|
return existUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 生成openId(使用UUID)
|
||||||
|
String openId = java.util.UUID.randomUUID().toString().replace("-", "");
|
||||||
|
|
||||||
|
// 创建新用户
|
||||||
|
SysUser sysUser = new SysUser();
|
||||||
|
sysUser.setMobile(mobile);
|
||||||
|
sysUser.setUsername(mobile); // 使用手机号作为用户名
|
||||||
|
sysUser.setOpenId(openId);
|
||||||
|
sysUser.setType(UserType.APP.name());
|
||||||
|
sysUser.setPassword(passwordEncoder.encode(openId)); // 使用openId作为初始密码
|
||||||
|
sysUser.setEnabled(Boolean.TRUE);
|
||||||
|
|
||||||
|
String username = sysUser.getUsername();
|
||||||
|
boolean result = super.saveOrUpdateIdempotency(sysUser, lock,
|
||||||
|
LOCK_KEY_USERNAME + username,
|
||||||
|
new QueryWrapper<SysUser>().eq("username", username),
|
||||||
|
username + "已存在");
|
||||||
|
|
||||||
|
if (result) {
|
||||||
|
log.info("通过手机号注册用户成功,mobile:{}, openId:{}", mobile, openId);
|
||||||
|
return sysUser;
|
||||||
|
} else {
|
||||||
|
log.error("通过手机号注册用户失败,mobile:{}", mobile);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
@@ -24,4 +24,9 @@ public interface ServiceNameConstants {
|
|||||||
String FILE_SERVICE = "file-center";
|
String FILE_SERVICE = "file-center";
|
||||||
|
|
||||||
String ORDER_SERVICE = "order-center";
|
String ORDER_SERVICE = "order-center";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息中心服务
|
||||||
|
*/
|
||||||
|
String MSG_SERVICE = "msg-center";
|
||||||
}
|
}
|
||||||
|
|||||||
+45
@@ -0,0 +1,45 @@
|
|||||||
|
package com.central.common.feign;
|
||||||
|
|
||||||
|
import com.central.common.constant.ServiceNameConstants;
|
||||||
|
import com.central.common.feign.fallback.MsgCenterServiceFallbackFactory;
|
||||||
|
import com.central.common.model.Result;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息中心服务 Feign客户端
|
||||||
|
*/
|
||||||
|
@FeignClient(name = ServiceNameConstants.MSG_SERVICE, fallbackFactory = MsgCenterServiceFallbackFactory.class, dismiss404 = true)
|
||||||
|
public interface MsgCenterService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送验证码短信(使用默认服务商)
|
||||||
|
*
|
||||||
|
* @param phone 手机号
|
||||||
|
* @param code 验证码
|
||||||
|
* @return 发送结果
|
||||||
|
*/
|
||||||
|
@PostMapping("/sms/send-verify-code")
|
||||||
|
Result<?> sendVerifyCode(@RequestParam("phone") String phone, @RequestParam("code") String code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送验证码短信(使用腾讯云)
|
||||||
|
*
|
||||||
|
* @param phone 手机号
|
||||||
|
* @param code 验证码
|
||||||
|
* @return 发送结果
|
||||||
|
*/
|
||||||
|
@PostMapping("/sms/tencent/send-verify-code")
|
||||||
|
Result<?> sendTencentVerifyCode(@RequestParam("phone") String phone, @RequestParam("code") String code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送验证码短信(使用阿里云)
|
||||||
|
*
|
||||||
|
* @param phone 手机号
|
||||||
|
* @param code 验证码
|
||||||
|
* @return 发送结果
|
||||||
|
*/
|
||||||
|
@PostMapping("/sms/aliyun/send-verify-code")
|
||||||
|
Result<?> sendAliyunVerifyCode(@RequestParam("phone") String phone, @RequestParam("code") String code);
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@ import com.central.common.model.SysUser;
|
|||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -91,4 +92,13 @@ public interface UserService {
|
|||||||
*/
|
*/
|
||||||
@GetMapping(value = "/tenant/hierarchy/son/tenantId", params = "tenantId")
|
@GetMapping(value = "/tenant/hierarchy/son/tenantId", params = "tenantId")
|
||||||
List<String> getSonTenantIds(@RequestParam("tenantId") String tenantId);
|
List<String> getSonTenantIds(@RequestParam("tenantId") String tenantId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过手机号注册用户(返回用户信息,包含openId)
|
||||||
|
*
|
||||||
|
* @param mobile 手机号
|
||||||
|
* @return 注册后的用户信息
|
||||||
|
*/
|
||||||
|
@PostMapping(value = "/users-anon/register/mobile")
|
||||||
|
SysUser registerByMobile(@RequestParam("mobile") String mobile);
|
||||||
}
|
}
|
||||||
|
|||||||
+35
@@ -0,0 +1,35 @@
|
|||||||
|
package com.central.common.feign.fallback;
|
||||||
|
|
||||||
|
import com.central.common.feign.MsgCenterService;
|
||||||
|
import com.central.common.model.Result;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MsgCenterService降级工厂
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class MsgCenterServiceFallbackFactory implements FallbackFactory<MsgCenterService> {
|
||||||
|
@Override
|
||||||
|
public MsgCenterService create(Throwable throwable) {
|
||||||
|
return new MsgCenterService() {
|
||||||
|
@Override
|
||||||
|
public Result<?> sendVerifyCode(String phone, String code) {
|
||||||
|
log.error("发送验证码短信异常, phone:{}", phone, throwable);
|
||||||
|
return Result.failed("短信服务不可用");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<?> sendTencentVerifyCode(String phone, String code) {
|
||||||
|
log.error("发送腾讯云验证码短信异常, phone:{}", phone, throwable);
|
||||||
|
return Result.failed("腾讯云短信服务不可用");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<?> sendAliyunVerifyCode(String phone, String code) {
|
||||||
|
log.error("发送阿里云验证码短信异常, phone:{}", phone, throwable);
|
||||||
|
return Result.failed("阿里云短信服务不可用");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
+6
@@ -89,6 +89,12 @@ public class UserServiceFallbackFactory implements FallbackFactory<UserService>
|
|||||||
log.error("获取自己以及子孙租户列表异常:{}", tenantId, throwable);
|
log.error("获取自己以及子孙租户列表异常:{}", tenantId, throwable);
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SysUser registerByMobile(String mobile) {
|
||||||
|
log.error("通过手机号注册用户异常:{}", mobile, throwable);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -1,2 +1,3 @@
|
|||||||
com.central.common.feign.fallback.UserServiceFallbackFactory
|
com.central.common.feign.fallback.UserServiceFallbackFactory
|
||||||
|
com.central.common.feign.fallback.MsgCenterServiceFallbackFactory
|
||||||
com.central.common.lock.LockAspect
|
com.central.common.lock.LockAspect
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
package com.central.oauth.controller;
|
package com.central.oauth.controller;
|
||||||
|
|
||||||
import com.central.common.constant.SecurityConstants;
|
import com.central.common.constant.SecurityConstants;
|
||||||
|
import com.central.common.feign.MsgCenterService;
|
||||||
import com.central.common.model.CodeEnum;
|
import com.central.common.model.CodeEnum;
|
||||||
import com.central.common.model.Result;
|
import com.central.common.model.Result;
|
||||||
|
import com.central.common.model.SysUser;
|
||||||
import com.central.common.utils.RSAUtil;
|
import com.central.common.utils.RSAUtil;
|
||||||
import com.central.common.utils.StringUtils;
|
import com.central.common.utils.StringUtils;
|
||||||
import com.central.oauth.model.Client;
|
import com.central.oauth.model.Client;
|
||||||
@@ -21,11 +23,14 @@ import com.central.oauth2.common.properties.SecurityProperties;
|
|||||||
import com.central.oauth2.common.token.OpenIdAuthenticationToken;
|
import com.central.oauth2.common.token.OpenIdAuthenticationToken;
|
||||||
import com.central.oauth2.common.token.TencentAuthenticationToken;
|
import com.central.oauth2.common.token.TencentAuthenticationToken;
|
||||||
import com.central.oauth2.common.util.AuthUtils;
|
import com.central.oauth2.common.util.AuthUtils;
|
||||||
|
import com.central.common.feign.UserService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletRequestWrapper;
|
import jakarta.servlet.http.HttpServletRequestWrapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
import org.springframework.security.oauth2.core.AuthorizationGrantType;
|
import org.springframework.security.oauth2.core.AuthorizationGrantType;
|
||||||
import org.springframework.security.oauth2.core.ClientAuthenticationMethod;
|
import org.springframework.security.oauth2.core.ClientAuthenticationMethod;
|
||||||
@@ -48,6 +53,8 @@ import java.time.temporal.ChronoUnit;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@Tag(name = "登录接口")
|
@Tag(name = "登录接口")
|
||||||
@RestController
|
@RestController
|
||||||
@@ -86,6 +93,31 @@ public class LoginController {
|
|||||||
@Resource
|
@Resource
|
||||||
private UnifiedLogoutService unifiedLogoutService;
|
private UnifiedLogoutService unifiedLogoutService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private StringRedisTemplate stringRedisTemplate;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MsgCenterService msgCenterService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 短信验证码Redis Key前缀
|
||||||
|
*/
|
||||||
|
private static final String SMS_CODE_PREFIX = "sms:code:";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 短信验证码有效期(分钟)
|
||||||
|
*/
|
||||||
|
private static final long SMS_CODE_EXPIRE_MINUTES = 5;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 短信服务商类型:tencent-腾讯云, aliyun-阿里云
|
||||||
|
*/
|
||||||
|
@org.springframework.beans.factory.annotation.Value("${sms.provider:tencent}")
|
||||||
|
private String smsProvider;
|
||||||
|
|
||||||
@PostMapping(value = "/login")
|
@PostMapping(value = "/login")
|
||||||
public Result<Map<String, Object>> login(@RequestBody LoginReq req) {
|
public Result<Map<String, Object>> login(@RequestBody LoginReq req) {
|
||||||
try {
|
try {
|
||||||
@@ -133,6 +165,148 @@ public class LoginController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送手机验证码
|
||||||
|
*
|
||||||
|
* @param mobile 手机号
|
||||||
|
* @return 发送结果
|
||||||
|
*/
|
||||||
|
@Operation(summary = "发送手机验证码")
|
||||||
|
@PostMapping(value = "/sendSmsCode")
|
||||||
|
public Result<String> sendSmsCode(@RequestParam("mobile") String mobile) {
|
||||||
|
try {
|
||||||
|
// 1) 校验手机号格式
|
||||||
|
if (StringUtils.isBlank(mobile) || !mobile.matches("^1[3-9]\\d{9}$")) {
|
||||||
|
return Result.failed("手机号格式不正确");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2) 检查是否频繁发送(防刷)
|
||||||
|
String redisKey = SMS_CODE_PREFIX + mobile;
|
||||||
|
String existCode = stringRedisTemplate.opsForValue().get(redisKey);
|
||||||
|
if (StringUtils.isNotBlank(existCode)) {
|
||||||
|
Long ttl = stringRedisTemplate.getExpire(redisKey, TimeUnit.SECONDS);
|
||||||
|
if (ttl != null && ttl > (SMS_CODE_EXPIRE_MINUTES - 1) * 60) {
|
||||||
|
return Result.failed("验证码发送过于频繁,请稍后再试");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3) 生成4位随机验证码
|
||||||
|
String code = String.format("%04d", new Random().nextInt(10000));
|
||||||
|
|
||||||
|
// 4) 根据配置选择短信服务商发送短信
|
||||||
|
Result<?> sendResult;
|
||||||
|
if ("aliyun".equalsIgnoreCase(smsProvider)) {
|
||||||
|
log.info("使用阿里云发送验证码,mobile:{}", mobile);
|
||||||
|
sendResult = msgCenterService.sendAliyunVerifyCode(mobile, code);
|
||||||
|
} else {
|
||||||
|
// 默认使用腾讯云
|
||||||
|
log.info("使用腾讯云发送验证码,mobile:{}", mobile);
|
||||||
|
sendResult = msgCenterService.sendTencentVerifyCode(mobile, code);
|
||||||
|
}
|
||||||
|
if (sendResult == null || sendResult.getResp_code() != 0) {
|
||||||
|
log.error("发送短信验证码失败,mobile:{}, result:{}", mobile, sendResult);
|
||||||
|
return Result.failed("短信发送失败,请稍后重试");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5) 发送成功后存入Redis,设置有效期
|
||||||
|
stringRedisTemplate.opsForValue().set(redisKey, code, SMS_CODE_EXPIRE_MINUTES, TimeUnit.MINUTES);
|
||||||
|
log.info("短信验证码发送成功,mobile:{}", mobile);
|
||||||
|
|
||||||
|
return Result.succeed("验证码发送成功");
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("发送短信验证码异常,mobile:{}", mobile, e);
|
||||||
|
return Result.failed("短信发送失败:" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手机号验证码登录
|
||||||
|
*
|
||||||
|
* @param mobile 手机号
|
||||||
|
* @param smsCode 短信验证码
|
||||||
|
* @param clientId 客户端ID
|
||||||
|
* @return 登录结果(token)
|
||||||
|
*/
|
||||||
|
@Operation(summary = "手机号验证码登录")
|
||||||
|
@PostMapping(value = "/loginBySmsCode")
|
||||||
|
public Result<Map<String, Object>> loginBySmsCode(
|
||||||
|
@RequestParam("mobile") String mobile,
|
||||||
|
@RequestParam("smsCode") String smsCode,
|
||||||
|
@RequestParam("clientId") String clientId) {
|
||||||
|
try {
|
||||||
|
// 1) 校验参数
|
||||||
|
if (StringUtils.isBlank(mobile) || !mobile.matches("^1[3-9]\\d{9}$")) {
|
||||||
|
return Result.failed("手机号格式不正确");
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(smsCode)) {
|
||||||
|
return Result.failed("验证码不能为空");
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(clientId)) {
|
||||||
|
return Result.failed("客户端ID不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2) 从Redis获取验证码并校验
|
||||||
|
String redisKey = SMS_CODE_PREFIX + mobile;
|
||||||
|
String cachedCode = stringRedisTemplate.opsForValue().get(redisKey);
|
||||||
|
if (StringUtils.isBlank(cachedCode)) {
|
||||||
|
return Result.failed("验证码已过期,请重新获取");
|
||||||
|
}
|
||||||
|
if (!cachedCode.equals(smsCode)) {
|
||||||
|
return Result.failed("验证码错误");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3) 验证码校验成功后删除
|
||||||
|
stringRedisTemplate.delete(redisKey);
|
||||||
|
|
||||||
|
// 4) 查询用户是否已注册
|
||||||
|
SysUser sysUser = userService.findByMobile(mobile);
|
||||||
|
String openId;
|
||||||
|
if (sysUser == null || sysUser.getId() == null) {
|
||||||
|
// 用户不存在,先注册
|
||||||
|
log.info("用户不存在,进行注册,mobile:{}", mobile);
|
||||||
|
SysUser newUser = userService.registerByMobile(mobile);
|
||||||
|
if (newUser == null || StringUtils.isBlank(newUser.getOpenId())) {
|
||||||
|
return Result.failed("用户注册失败,请重试");
|
||||||
|
}
|
||||||
|
openId = newUser.getOpenId();
|
||||||
|
log.info("用户注册成功,mobile:{}, openId:{}", mobile, openId);
|
||||||
|
} else {
|
||||||
|
// 用户已存在
|
||||||
|
openId = sysUser.getOpenId();
|
||||||
|
if (StringUtils.isBlank(openId)) {
|
||||||
|
return Result.failed("用户信息异常,缺少openId");
|
||||||
|
}
|
||||||
|
log.info("用户已存在,直接登录,mobile:{}, openId:{}", mobile, openId);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5) 使用openId进行登录
|
||||||
|
LoginReq loginReq = new LoginReq();
|
||||||
|
loginReq.setGrantType("openId");
|
||||||
|
loginReq.setOpenId(openId);
|
||||||
|
loginReq.setClientId(clientId);
|
||||||
|
|
||||||
|
// 6) 客户端校验
|
||||||
|
Client client = clientService.loadClientByClientId(clientId);
|
||||||
|
if (client == null) {
|
||||||
|
return Result.failed("所属客户端不存在");
|
||||||
|
}
|
||||||
|
RegisteredClient registeredClient = registeredClientRepository.findByClientId(client.getClientId());
|
||||||
|
if (registeredClient == null) {
|
||||||
|
return Result.failed("未注册的客户端");
|
||||||
|
}
|
||||||
|
AuthorizationGrantType grantTypeToUse = new AuthorizationGrantType("openId");
|
||||||
|
if (!registeredClient.getAuthorizationGrantTypes().contains(grantTypeToUse)) {
|
||||||
|
return Result.failed("客户端未开通openId授权类型");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 7) 颁发令牌
|
||||||
|
return issueTokenInternally(loginReq, registeredClient, null);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("手机号验证码登录异常,mobile:{}", mobile, e);
|
||||||
|
return Result.failed("登录失败:" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping(value = "/logout")
|
@PostMapping(value = "/logout")
|
||||||
public Result<String> logOut(HttpServletRequest request) {
|
public Result<String> logOut(HttpServletRequest request) {
|
||||||
String token = AuthUtils.extractHeaderToken(request);
|
String token = AuthUtils.extractHeaderToken(request);
|
||||||
|
|||||||
@@ -63,3 +63,5 @@ zlt:
|
|||||||
# 鍏煎榛樿琛ㄥ崟鐧诲綍涓庡唴缃櫥鍑?
|
# 鍏煎榛樿琛ㄥ崟鐧诲綍涓庡唴缃櫥鍑?
|
||||||
- /user/login
|
- /user/login
|
||||||
- /oauth/remove/token
|
- /oauth/remove/token
|
||||||
|
- /oauth/sendSmsCode
|
||||||
|
- /oauth/loginBySmsCode
|
||||||
|
|||||||
@@ -1,69 +0,0 @@
|
|||||||
# 通用大屏 → 无人机智慧城市管控平台(重构计划表)
|
|
||||||
|
|
||||||
> 目标:在不改变现有功能与数据接口的前提下,把 `/dashboard` 的“通用监控大屏”升级为更符合“无人机赋能智慧城市”的首页大屏:维度更丰富、信息架构更清晰、视觉更高级、交互更顺手。
|
|
||||||
|
|
||||||
## 0. 约束与边界(必须遵守)
|
|
||||||
- 不改路由与入口:仍然使用 `/dashboard`,`进入监控视图` 仍然跳转 `/map3d?from=dashboard`。
|
|
||||||
- 不改现有接口/聚合逻辑:继续使用 `src/services/dashboard.ts` 的 `getDeviceStats/getTaskStats/getTrendData` 等(允许新增“可选增强”接口或派生数据)。
|
|
||||||
- 不影响海事行业:`/maritime` 不做联动修改(仅做必要的“命名展示”区分时除外)。
|
|
||||||
- 无数据也要好看:任何新模块在数据缺失时要有优雅的“空态/占位”,避免空白或布局塌陷。
|
|
||||||
|
|
||||||
## 1. 目标体验(验收口径)
|
|
||||||
1. 首页一眼看懂:顶部为“城市态势总览”,中间为“数字孪生/空域态势”,两侧为“运行体征/事件处置”。
|
|
||||||
2. 统计维度丰富:至少覆盖「设备运行」「任务执行」「城市网格治理」「AI识别事件」「环境/交通态势(可派生/可模拟)」五大类。
|
|
||||||
3. 视觉统一:同一套色板、间距、描边、阴影、字体层级,避免“拼贴感”。
|
|
||||||
4. 交互轻快:鼠标悬停、点击、筛选都有明确反馈;滚动区域可控且不抢焦点。
|
|
||||||
|
|
||||||
## 2. 信息架构与模块清单(Dashboard)
|
|
||||||
|
|
||||||
### 2.1 顶部(Header)
|
|
||||||
- 平台命名:`无人机智慧城市管控平台`
|
|
||||||
- 状态条:当前租户/范围、在线率、告警等级概览、当前时间(若页面本身不显示则放入大屏 Header)
|
|
||||||
- 快捷入口:进入 3D 监控、任务/设备(保持现有入口,不新增强绑定)
|
|
||||||
|
|
||||||
### 2.2 左侧(城市运行体征)
|
|
||||||
- 城市网格治理(Radar):巡检覆盖、问题发现、处置效率、复核通过、重点区域关注
|
|
||||||
- 环境感知(Line/Gauge/Liquid):PM2.5、噪声、热源异常趋势(允许派生/模拟,但要“稳定”)
|
|
||||||
- 交通与人流(Area/Heatmap):拥堵指数趋势、重点区域热度 TopN
|
|
||||||
|
|
||||||
### 2.3 中间(全域态势 / 数字孪生入口)
|
|
||||||
- 核心态势 KPI(数字+发光强调):城市安全指数、今日识别事件、平均响应时长、闭环率
|
|
||||||
- 数字孪生入口卡(保留进入 `/map3d`):升级为更“城市中枢”风格,增加图层提示文案(电子围栏/事件点位/航线)
|
|
||||||
- AI抓拍与隐患快照(Carousel/卡片流):违停、烟火、占道、河道漂浮物、工地未戴帽等(点击可弹出详情抽屉/弹窗)
|
|
||||||
|
|
||||||
### 2.4 右侧(事件处置与运行调度)
|
|
||||||
- 事件类型分布(Pie/RadialBar):按“城市治理事件”分类统计(与告警/任务派生映射)
|
|
||||||
- 实时事件流(List):分级(一般/重要/紧急)+ 来源(无人机/摄像头/机库)+ 处理状态(待确认/已派单/处理中/已闭环)
|
|
||||||
- 任务执行(保留原筛选逻辑):日/月/年切换 + 状态占比 + 近 7 日趋势 + 异常原因分析(原模块“换皮+换语义”)
|
|
||||||
|
|
||||||
## 3. 数据策略(不改功能前提下“做出新维度”)
|
|
||||||
|
|
||||||
### 3.1 直接复用(已有)
|
|
||||||
- 设备:`DeviceStats.total/online/offline/fault/byType/onlineRate`
|
|
||||||
- 任务:`TaskStats.pending/running/completed/failed/successRate/todayNew`
|
|
||||||
- 趋势:`getTrendData(7)`(现为模拟,后续可接真实接口)
|
|
||||||
- 告警:`getMockAlerts()`(现为模拟)
|
|
||||||
|
|
||||||
### 3.2 派生增强(推荐落地)
|
|
||||||
- 城市安全指数:由 `告警数量/等级` + `任务成功率` + `在线率` 计算得到(可解释、可复现)。
|
|
||||||
- 事件类型分布:把告警/任务映射到“城市治理事件”类别(如:离线→关键设施告警、低电→保障能力风险)。
|
|
||||||
- 网格治理/环境/交通:使用“可复现的稳定模拟”(基于 tenantId + 日期 hash),保证刷新时不跳变、截图时稳定。
|
|
||||||
|
|
||||||
## 4. 设计系统(落地规则)
|
|
||||||
- 色板:以 `--accent-blue/green/yellow/red` 为主,新增 1~2 个辅助色(紫/青)但必须有统一用途。
|
|
||||||
- 卡片:统一玻璃拟态 + 细描边 + 角落高光;标题区高度统一;内容区保持最小可视高度。
|
|
||||||
- 字体层级:KPI 数字使用等宽/半等宽(更有“仪表感”);正文保持 12~13px,标题 14~15px。
|
|
||||||
- 动效:只用“微动效”(呼吸光、扫光、hover 抬升),避免大幅炫技影响可读性。
|
|
||||||
|
|
||||||
## 5. 实施里程碑(建议按顺序做)
|
|
||||||
|
|
||||||
| 里程碑 | 目标 | 产出 | 涉及文件(示例) | 验收点 |
|
|
||||||
|---|---|---|---|---|
|
|
||||||
| M1 | 结构拆分 + 新布局骨架 | `Dashboard` 拆组件、三栏网格稳定 | `src/pages/dashboard/index.tsx`、`src/pages/dashboard/index.less`、`src/pages/dashboard/components/*` | 1920×1080 无挤压、无滚动条乱跳 |
|
|
||||||
| M2 | 智慧城市模块落地 | 城市 KPI/网格治理/环境交通/AI快照 | `src/services/dashboard.ts`(新增派生/稳定模拟)、`src/pages/dashboard/components/*` | 统计维度明显增加,空态不丑 |
|
|
||||||
| M3 | 视觉与交互精修 | 统一色板、排版、hover、空态、细节 | `src/global.less`(少量)、`src/pages/dashboard/*` | 一致性强、截图“像产品” |
|
|
||||||
| M4(可选) | 设备操控页 HUD 化 | 不改控制逻辑,只换布局与皮肤 |(按现有控制页位置确定)| 操控入口/功能不变、观感升级 |
|
|
||||||
|
|
||||||
## 6. 风险与回退
|
|
||||||
- 风险:新增模块依赖“模拟/派生数据”可能被误认为真实数据;处理:在不显眼处提供“数据口径说明”(抽屉/帮助提示)。
|
|
||||||
- 回退:保留原统计卡片/图表配置为独立组件,可随时切回(通过组件替换,不删代码)。
|
|
||||||
Binary file not shown.
@@ -601,6 +601,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.blank-content--maritime {
|
.blank-content--maritime {
|
||||||
|
/* 参考智慧城市大屏:用明确高度约束内容区,保证子 Grid 的 fr 高度计算为“确定值”,避免卡片把容器撑高导致后续面板被裁剪 */
|
||||||
height: calc(100vh - 88px);
|
height: calc(100vh - 88px);
|
||||||
height: calc(100dvh - 88px);
|
height: calc(100dvh - 88px);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|||||||
@@ -0,0 +1,186 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Card } from 'antd';
|
||||||
|
import { BarChartOutlined } from '@ant-design/icons';
|
||||||
|
import { Area, Column } from '@ant-design/plots';
|
||||||
|
|
||||||
|
interface AnnualTrendCardProps {
|
||||||
|
annualData: any[];
|
||||||
|
taskTypeData: any[];
|
||||||
|
}
|
||||||
|
|
||||||
|
const AnnualTrendCard: React.FC<AnnualTrendCardProps> = ({ annualData, taskTypeData }) => {
|
||||||
|
const areaConfig: any = {
|
||||||
|
data: annualData,
|
||||||
|
xField: 'month',
|
||||||
|
yField: 'value',
|
||||||
|
seriesField: 'type',
|
||||||
|
color: ['#00b4d8', '#00e5a0'],
|
||||||
|
areaStyle: { fillOpacity: 0.3 },
|
||||||
|
line: {
|
||||||
|
style: { lineWidth: 2 },
|
||||||
|
},
|
||||||
|
point: {
|
||||||
|
size: 3,
|
||||||
|
shape: 'circle',
|
||||||
|
style: {
|
||||||
|
fill: '#fff',
|
||||||
|
stroke: '#00b4d8',
|
||||||
|
lineWidth: 2,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
xAxis: {
|
||||||
|
label: {
|
||||||
|
style: { fill: 'rgba(200,230,255,0.75)', fontSize: 11 },
|
||||||
|
},
|
||||||
|
line: {
|
||||||
|
style: { stroke: 'rgba(0,180,216,0.2)' },
|
||||||
|
},
|
||||||
|
tickLine: null,
|
||||||
|
},
|
||||||
|
yAxis: {
|
||||||
|
label: {
|
||||||
|
style: { fill: 'rgba(200,230,255,0.75)', fontSize: 11 },
|
||||||
|
},
|
||||||
|
grid: {
|
||||||
|
line: { style: { stroke: 'rgba(0,150,200,0.15)', lineDash: [4, 4] } },
|
||||||
|
},
|
||||||
|
line: null,
|
||||||
|
tickLine: null,
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
position: 'top',
|
||||||
|
itemName: {
|
||||||
|
style: { fill: 'rgba(200,230,255,0.85)', fontSize: 12, fontWeight: 600 },
|
||||||
|
},
|
||||||
|
marker: {
|
||||||
|
symbol: 'circle',
|
||||||
|
style: { r: 4 },
|
||||||
|
},
|
||||||
|
itemSpacing: 16,
|
||||||
|
},
|
||||||
|
smooth: true,
|
||||||
|
animation: {
|
||||||
|
appear: {
|
||||||
|
animation: 'wave-in',
|
||||||
|
duration: 1000,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
tooltip: {
|
||||||
|
showMarkers: true,
|
||||||
|
marker: {
|
||||||
|
fill: '#00b4d8',
|
||||||
|
},
|
||||||
|
domStyles: {
|
||||||
|
'g2-tooltip': {
|
||||||
|
background: 'rgba(10, 30, 50, 0.95)',
|
||||||
|
boxShadow: '0 4px 12px rgba(0,0,0,0.3)',
|
||||||
|
border: '1px solid rgba(0,180,216,0.3)',
|
||||||
|
},
|
||||||
|
'g2-tooltip-title': {
|
||||||
|
color: 'rgba(200,230,255,0.95)',
|
||||||
|
},
|
||||||
|
'g2-tooltip-list-item': {
|
||||||
|
color: 'rgba(200,230,255,0.85)',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
autoFit: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
const columnConfig: any = {
|
||||||
|
data: taskTypeData,
|
||||||
|
xField: 'type',
|
||||||
|
yField: 'value',
|
||||||
|
seriesField: 'type',
|
||||||
|
color: ({ type }: any) => {
|
||||||
|
if (type === '航线巡检') return '#00b4d8';
|
||||||
|
if (type === '定点监测') return '#00e5a0';
|
||||||
|
return '#ff9f43';
|
||||||
|
},
|
||||||
|
columnStyle: {
|
||||||
|
radius: [6, 6, 0, 0],
|
||||||
|
},
|
||||||
|
label: {
|
||||||
|
text: (datum: any) => datum?.value?.toString() || '0',
|
||||||
|
style: {
|
||||||
|
fill: '#fff',
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: 600,
|
||||||
|
textAlign: 'center',
|
||||||
|
},
|
||||||
|
position: 'top',
|
||||||
|
offset: 8,
|
||||||
|
},
|
||||||
|
xAxis: {
|
||||||
|
label: {
|
||||||
|
style: { fill: 'rgba(200,230,255,0.75)', fontSize: 11 },
|
||||||
|
},
|
||||||
|
line: {
|
||||||
|
style: { stroke: 'rgba(0,180,216,0.2)' },
|
||||||
|
},
|
||||||
|
tickLine: null,
|
||||||
|
},
|
||||||
|
yAxis: {
|
||||||
|
label: {
|
||||||
|
style: { fill: 'rgba(200,230,255,0.75)', fontSize: 11 },
|
||||||
|
},
|
||||||
|
grid: {
|
||||||
|
line: { style: { stroke: 'rgba(0,150,200,0.15)', lineDash: [4, 4] } },
|
||||||
|
},
|
||||||
|
line: null,
|
||||||
|
tickLine: null,
|
||||||
|
},
|
||||||
|
legend: false,
|
||||||
|
animation: {
|
||||||
|
appear: {
|
||||||
|
animation: 'scale-in-y',
|
||||||
|
duration: 800,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
tooltip: {
|
||||||
|
domStyles: {
|
||||||
|
'g2-tooltip': {
|
||||||
|
background: 'rgba(10, 30, 50, 0.95)',
|
||||||
|
boxShadow: '0 4px 12px rgba(0,0,0,0.3)',
|
||||||
|
border: '1px solid rgba(0,180,216,0.3)',
|
||||||
|
},
|
||||||
|
'g2-tooltip-title': {
|
||||||
|
color: 'rgba(200,230,255,0.95)',
|
||||||
|
},
|
||||||
|
'g2-tooltip-list-item': {
|
||||||
|
color: 'rgba(200,230,255,0.85)',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
autoFit: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Card
|
||||||
|
title={
|
||||||
|
<span style={{ color: 'rgba(255,255,255,0.92)', display: 'flex', alignItems: 'center', gap: 8 }}>
|
||||||
|
<BarChartOutlined style={{ color: '#00b4d8' }} /> 年度巡检任务趋势与任务类型
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
className="maritime-card"
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
|
<div className="panel-split">
|
||||||
|
<div className="panel-section">
|
||||||
|
<div className="panel-subtitle">年度巡检趋势</div>
|
||||||
|
<div className="maritime-chart-wrapper">
|
||||||
|
<Area {...areaConfig} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="panel-section">
|
||||||
|
<div className="panel-subtitle">任务类型统计</div>
|
||||||
|
<div className="maritime-chart-wrapper">
|
||||||
|
<Column {...columnConfig} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default AnnualTrendCard;
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Card } from 'antd';
|
||||||
|
import { LineChartOutlined } from '@ant-design/icons';
|
||||||
|
import { Area } from '@ant-design/plots';
|
||||||
|
|
||||||
|
interface AnnualTrendChartProps {
|
||||||
|
annualData: any[];
|
||||||
|
}
|
||||||
|
|
||||||
|
const AnnualTrendChart: React.FC<AnnualTrendChartProps> = ({ annualData }) => {
|
||||||
|
const areaConfig: any = {
|
||||||
|
data: annualData,
|
||||||
|
xField: 'month',
|
||||||
|
yField: 'value',
|
||||||
|
seriesField: 'type',
|
||||||
|
color: ['#00b4d8', '#00e5a0'],
|
||||||
|
appendPadding: [20, 10, 10, 10],
|
||||||
|
areaStyle: { fillOpacity: 0.25 },
|
||||||
|
line: {
|
||||||
|
style: { lineWidth: 2 },
|
||||||
|
},
|
||||||
|
point: {
|
||||||
|
size: 2,
|
||||||
|
shape: 'circle',
|
||||||
|
style: {
|
||||||
|
fill: '#fff',
|
||||||
|
stroke: '#00b4d8',
|
||||||
|
lineWidth: 1.5,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
xAxis: {
|
||||||
|
label: {
|
||||||
|
style: { fill: 'rgba(200,230,255,0.75)', fontSize: 10 },
|
||||||
|
autoRotate: false,
|
||||||
|
autoHide: true,
|
||||||
|
},
|
||||||
|
line: {
|
||||||
|
style: { stroke: 'rgba(0,180,216,0.2)' },
|
||||||
|
},
|
||||||
|
tickLine: null,
|
||||||
|
},
|
||||||
|
yAxis: {
|
||||||
|
label: {
|
||||||
|
style: { fill: 'rgba(200,230,255,0.75)', fontSize: 10 },
|
||||||
|
},
|
||||||
|
grid: {
|
||||||
|
line: { style: { stroke: 'rgba(0,150,200,0.15)', lineDash: [4, 4] } },
|
||||||
|
},
|
||||||
|
line: null,
|
||||||
|
tickLine: null,
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
position: 'top-left',
|
||||||
|
offsetY: -5,
|
||||||
|
itemName: {
|
||||||
|
style: { fill: 'rgba(200,230,255,0.85)', fontSize: 11, fontWeight: 600 },
|
||||||
|
},
|
||||||
|
marker: {
|
||||||
|
symbol: 'circle',
|
||||||
|
style: { r: 3 },
|
||||||
|
},
|
||||||
|
itemSpacing: 12,
|
||||||
|
},
|
||||||
|
smooth: true,
|
||||||
|
animation: {
|
||||||
|
appear: {
|
||||||
|
animation: 'wave-in',
|
||||||
|
duration: 1000,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
tooltip: {
|
||||||
|
showMarkers: true,
|
||||||
|
marker: {
|
||||||
|
fill: '#00b4d8',
|
||||||
|
},
|
||||||
|
domStyles: {
|
||||||
|
'g2-tooltip': {
|
||||||
|
background: 'rgba(10, 30, 50, 0.95)',
|
||||||
|
boxShadow: '0 4px 12px rgba(0,0,0,0.3)',
|
||||||
|
border: '1px solid rgba(0,180,216,0.3)',
|
||||||
|
},
|
||||||
|
'g2-tooltip-title': {
|
||||||
|
color: 'rgba(200,230,255,0.95)',
|
||||||
|
},
|
||||||
|
'g2-tooltip-list-item': {
|
||||||
|
color: 'rgba(200,230,255,0.85)',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
autoFit: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Card
|
||||||
|
title={
|
||||||
|
<span style={{ color: 'rgba(255,255,255,0.92)', display: 'flex', alignItems: 'center', gap: 8 }}>
|
||||||
|
<LineChartOutlined style={{ color: '#00b4d8' }} /> 年度巡检任务趋势
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
className="maritime-card"
|
||||||
|
size="small"
|
||||||
|
styles={{
|
||||||
|
body: {
|
||||||
|
padding: '8px 8px 4px 8px',
|
||||||
|
overflow: 'visible',
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div className="maritime-chart-wrapper">
|
||||||
|
<Area {...areaConfig} />
|
||||||
|
</div>
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default AnnualTrendChart;
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Card } from 'antd';
|
||||||
|
import { AppstoreOutlined } from '@ant-design/icons';
|
||||||
|
import { Pie } from '@ant-design/plots';
|
||||||
|
import type { DeviceStats } from '@/services/dashboard';
|
||||||
|
|
||||||
|
interface DeviceTypeCardProps {
|
||||||
|
deviceStats: DeviceStats | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const DeviceTypeCard: React.FC<DeviceTypeCardProps> = ({ deviceStats }) => {
|
||||||
|
const usvTypeData = (deviceStats?.byType || [
|
||||||
|
{ name: '巡检型', count: 12 },
|
||||||
|
{ name: '监测型', count: 8 },
|
||||||
|
{ name: '救援型', count: 5 },
|
||||||
|
{ name: '测量型', count: 3 },
|
||||||
|
]).map(item => ({ name: item.name, count: item.count }));
|
||||||
|
|
||||||
|
const pieConfig: any = {
|
||||||
|
data: usvTypeData,
|
||||||
|
angleField: 'count',
|
||||||
|
colorField: 'name',
|
||||||
|
radius: 0.7,
|
||||||
|
innerRadius: 0.5,
|
||||||
|
color: ['#00b4d8', '#0096c7', '#00e5a0', '#48cae4'],
|
||||||
|
appendPadding: [20, 10, 5, 10],
|
||||||
|
label: {
|
||||||
|
text: (datum: any) => {
|
||||||
|
const name = datum?.name || '';
|
||||||
|
const count = datum?.count ?? 0;
|
||||||
|
const total = usvTypeData.reduce((sum, d) => sum + (d.count || 0), 0);
|
||||||
|
const percent = total > 0 ? ((count / total) * 100).toFixed(1) : 0;
|
||||||
|
return `${name}\n${percent}%`;
|
||||||
|
},
|
||||||
|
style: {
|
||||||
|
fill: 'rgba(200,230,255,0.95)',
|
||||||
|
fontSize: 10,
|
||||||
|
fontWeight: 600,
|
||||||
|
textAlign: 'center',
|
||||||
|
},
|
||||||
|
offset: 20,
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
position: 'bottom',
|
||||||
|
offsetY: -10,
|
||||||
|
itemValue: {
|
||||||
|
style: { fill: 'rgba(200,230,255,0.75)', fontSize: 10 }
|
||||||
|
},
|
||||||
|
itemName: {
|
||||||
|
style: { fill: 'rgba(200,230,255,0.75)', fontSize: 10 }
|
||||||
|
},
|
||||||
|
itemSpacing: 6,
|
||||||
|
layout: 'horizontal',
|
||||||
|
},
|
||||||
|
statistic: {
|
||||||
|
title: {
|
||||||
|
style: { fontSize: 11, fill: 'rgba(200,230,255,0.65)' },
|
||||||
|
content: '设备总数',
|
||||||
|
},
|
||||||
|
content: {
|
||||||
|
style: { fontSize: 16, fontWeight: 'bold', fill: '#00e5a0' },
|
||||||
|
formatter: () => {
|
||||||
|
const total = usvTypeData.reduce((sum, d) => sum + (d.count || 0), 0);
|
||||||
|
return `${total}`;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
autoFit: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Card
|
||||||
|
title={
|
||||||
|
<span style={{ color: 'rgba(255,255,255,0.92)', display: 'flex', alignItems: 'center', gap: 8 }}>
|
||||||
|
<AppstoreOutlined style={{ color: '#00b4d8' }} /> 设备类型分布
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
className="maritime-card"
|
||||||
|
size="small"
|
||||||
|
styles={{
|
||||||
|
body: {
|
||||||
|
padding: 0,
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'flex-start',
|
||||||
|
overflow: 'visible',
|
||||||
|
height: '100%',
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div className="maritime-chart-wrapper" style={{
|
||||||
|
width: '100%',
|
||||||
|
height: '100%',
|
||||||
|
display: 'flex',
|
||||||
|
alignItems: 'flex-start',
|
||||||
|
justifyContent: 'center',
|
||||||
|
paddingTop: '10px',
|
||||||
|
}}>
|
||||||
|
<Pie {...pieConfig} />
|
||||||
|
</div>
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default DeviceTypeCard;
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Card, List, Tag } from 'antd';
|
||||||
|
import { WarningOutlined } from '@ant-design/icons';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
import type { AlertItem } from '@/services/dashboard';
|
||||||
|
|
||||||
|
interface MaritimeAlertCardProps {
|
||||||
|
alerts: AlertItem[];
|
||||||
|
}
|
||||||
|
|
||||||
|
const getAlertColor = (level: string) => {
|
||||||
|
switch (level) {
|
||||||
|
case 'critical': return '#ff4757';
|
||||||
|
case 'error': return '#ff9f43';
|
||||||
|
case 'warning': return '#feca57';
|
||||||
|
default: return '#54a0ff';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const MaritimeAlertCard: React.FC<MaritimeAlertCardProps> = ({ alerts }) => {
|
||||||
|
return (
|
||||||
|
<Card
|
||||||
|
title={
|
||||||
|
<span style={{ color: 'rgba(255,255,255,0.92)', display: 'flex', alignItems: 'center', gap: 8 }}>
|
||||||
|
<WarningOutlined style={{ color: '#ff9f43' }} /> 实时告警
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
extra={<Tag color="#ff9f43">LIVE</Tag>}
|
||||||
|
className="maritime-card"
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
|
<div className="alert-list-container">
|
||||||
|
<List
|
||||||
|
dataSource={alerts}
|
||||||
|
split={false}
|
||||||
|
renderItem={(item) => (
|
||||||
|
<List.Item className="maritime-alert-item">
|
||||||
|
<div className="alert-row">
|
||||||
|
<div className="alert-badge">
|
||||||
|
<Tag color={getAlertColor(item.level)}>{item.level.toUpperCase().slice(0, 1)}</Tag>
|
||||||
|
</div>
|
||||||
|
<div className="alert-content">
|
||||||
|
<div className="alert-head">
|
||||||
|
<span className="alert-name">{item.deviceName || item.taskName}</span>
|
||||||
|
<span className="alert-time">{dayjs(item.timestamp).format('HH:mm')}</span>
|
||||||
|
</div>
|
||||||
|
<div className="alert-msg">{item.message}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</List.Item>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default MaritimeAlertCard;
|
||||||
@@ -0,0 +1,146 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Card, Tabs } from 'antd';
|
||||||
|
import { FundOutlined } from '@ant-design/icons';
|
||||||
|
import { Line, Pie, Rose } from '@ant-design/plots';
|
||||||
|
import type { TaskStats, TrendItem } from '@/services/dashboard';
|
||||||
|
|
||||||
|
interface MaritimeInsightCardProps {
|
||||||
|
taskStats: TaskStats | null;
|
||||||
|
taskTrend: TrendItem[];
|
||||||
|
violationAnalysisData: any[];
|
||||||
|
}
|
||||||
|
|
||||||
|
const MaritimeInsightCard: React.FC<MaritimeInsightCardProps> = ({
|
||||||
|
taskStats,
|
||||||
|
taskTrend,
|
||||||
|
violationAnalysisData,
|
||||||
|
}) => {
|
||||||
|
// 任务趋势配置
|
||||||
|
const taskTrendSeriesData = 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 },
|
||||||
|
]);
|
||||||
|
|
||||||
|
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 },
|
||||||
|
autoFit: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
// 任务状态饼图配置
|
||||||
|
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.85)', fontSize: 12, fontWeight: 600 },
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
position: 'bottom',
|
||||||
|
itemValue: { style: { fill: 'rgba(200,230,255,0.75)' } },
|
||||||
|
itemName: { style: { fill: 'rgba(200,230,255,0.75)' } },
|
||||||
|
},
|
||||||
|
autoFit: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
// 违规分析玫瑰图配置
|
||||||
|
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.75)' } },
|
||||||
|
},
|
||||||
|
autoFit: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Card
|
||||||
|
title={
|
||||||
|
<span style={{ color: 'rgba(255,255,255,0.92)', display: 'flex', alignItems: 'center', gap: 8 }}>
|
||||||
|
<FundOutlined style={{ color: '#00b4d8' }} /> 综合分析洞察
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
className="maritime-card maritime-insight-card"
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
|
<Tabs
|
||||||
|
size="small"
|
||||||
|
className="maritime-tabs"
|
||||||
|
items={[
|
||||||
|
{
|
||||||
|
key: 'trend',
|
||||||
|
label: '近7日巡检趋势',
|
||||||
|
children: (
|
||||||
|
<div className="maritime-chart-wrapper">
|
||||||
|
<Line {...taskTrendConfig} />
|
||||||
|
</div>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'status',
|
||||||
|
label: '任务状态占比',
|
||||||
|
children: (
|
||||||
|
<div className="maritime-chart-wrapper">
|
||||||
|
<Pie {...taskStatusPieConfig} />
|
||||||
|
</div>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'violation',
|
||||||
|
label: '违规类型分析',
|
||||||
|
children: (
|
||||||
|
<div className="maritime-chart-wrapper">
|
||||||
|
<Rose {...roseConfig} />
|
||||||
|
</div>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default MaritimeInsightCard;
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { EnvironmentOutlined, RocketOutlined, PieChartOutlined } from '@ant-design/icons';
|
||||||
|
import './maritime-card.less';
|
||||||
|
|
||||||
|
// 无人船图标组件
|
||||||
|
const USVIcon = () => (
|
||||||
|
<svg viewBox="0 0 24 24" width="1em" height="1em" fill="currentColor">
|
||||||
|
<path d="M20 21c-1.39 0-2.78-.47-4-1.32-2.44 1.71-5.56 1.71-8 0C6.78 20.53 5.39 21 4 21H2v2h2c1.38 0 2.74-.35 4-.99 2.52 1.29 5.48 1.29 8 0 1.26.64 2.63.99 4 .99h2v-2h-2zM3.95 19H4c1.6 0 3.02-.88 4-2 .98 1.12 2.4 2 4 2s3.02-.88 4-2c.98 1.12 2.4 2 4 2h.05l1.89-6.68c.08-.26.06-.54-.06-.78s-.34-.42-.6-.5L20 10.62V6c0-1.1-.9-2-2-2h-3V1H9v3H6c-1.1 0-2 .9-2 2v4.62l-1.29.42c-.26.08-.48.26-.6.5s-.15.52-.06.78L3.95 19zM6 6h12v3.97L12 8 6 9.97V6z"/>
|
||||||
|
</svg>
|
||||||
|
);
|
||||||
|
|
||||||
|
interface MaritimeKpiStripProps {
|
||||||
|
deviceTotal: number;
|
||||||
|
seaAreaCount: number;
|
||||||
|
todayNew: number;
|
||||||
|
successRate: number;
|
||||||
|
taskNewLabel?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const MaritimeKpiStrip: React.FC<MaritimeKpiStripProps> = ({
|
||||||
|
deviceTotal,
|
||||||
|
seaAreaCount,
|
||||||
|
todayNew,
|
||||||
|
successRate,
|
||||||
|
taskNewLabel = '当日任务',
|
||||||
|
}) => {
|
||||||
|
const kpis = [
|
||||||
|
{
|
||||||
|
key: 'ship',
|
||||||
|
label: '设备总数',
|
||||||
|
value: deviceTotal,
|
||||||
|
icon: <USVIcon />,
|
||||||
|
accent: 'ship',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'area',
|
||||||
|
label: '海域总数',
|
||||||
|
value: seaAreaCount,
|
||||||
|
icon: <EnvironmentOutlined />,
|
||||||
|
accent: 'anchor',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'task',
|
||||||
|
label: taskNewLabel,
|
||||||
|
value: todayNew,
|
||||||
|
icon: <RocketOutlined />,
|
||||||
|
accent: 'alert',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'rate',
|
||||||
|
label: '执行成功率',
|
||||||
|
value: successRate,
|
||||||
|
unit: '%',
|
||||||
|
icon: <PieChartOutlined />,
|
||||||
|
accent: 'route',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="maritime-kpi-strip">
|
||||||
|
{kpis.map((kpi) => (
|
||||||
|
<div key={kpi.key} className={`maritime-kpi-tile maritime-kpi-tile--${kpi.accent}`}>
|
||||||
|
<div className="maritime-kpi-tile__icon">{kpi.icon}</div>
|
||||||
|
<div className="maritime-kpi-tile__info">
|
||||||
|
<div className="maritime-kpi-tile__label">{kpi.label}</div>
|
||||||
|
<div className="maritime-kpi-tile__value">
|
||||||
|
{kpi.value}
|
||||||
|
{kpi.unit && <small>{kpi.unit}</small>}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default MaritimeKpiStrip;
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
import React, { useMemo } from 'react';
|
||||||
|
import { Card } from 'antd';
|
||||||
|
import { AimOutlined } from '@ant-design/icons';
|
||||||
|
import type { DeviceStats, TaskStats, AlertItem } from '@/services/dashboard';
|
||||||
|
|
||||||
|
interface PortStatusCardProps {
|
||||||
|
deviceStats: DeviceStats | null;
|
||||||
|
taskStats: TaskStats | null;
|
||||||
|
alerts: AlertItem[];
|
||||||
|
}
|
||||||
|
|
||||||
|
const PortStatusCard: React.FC<PortStatusCardProps> = ({
|
||||||
|
deviceStats,
|
||||||
|
taskStats,
|
||||||
|
alerts,
|
||||||
|
}) => {
|
||||||
|
const portStatusData = useMemo(() => {
|
||||||
|
const totalShips = deviceStats?.total || 24;
|
||||||
|
const pendingTasks = taskStats?.pending || 6;
|
||||||
|
const runningTasks = taskStats?.running || 3;
|
||||||
|
const alertBase = alerts.length || 4;
|
||||||
|
const baseShips = Math.max(6, Math.round(totalShips / 3));
|
||||||
|
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
name: '东港枢纽',
|
||||||
|
ships: baseShips + 3,
|
||||||
|
tasks: pendingTasks + 2,
|
||||||
|
alerts: Math.max(1, Math.round(alertBase * 0.4)),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '西湾港区',
|
||||||
|
ships: baseShips + 1,
|
||||||
|
tasks: Math.max(1, pendingTasks + 1),
|
||||||
|
alerts: Math.max(1, Math.round(alertBase * 0.3)),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '南航道',
|
||||||
|
ships: Math.max(4, baseShips - 1),
|
||||||
|
tasks: Math.max(1, runningTasks + 1),
|
||||||
|
alerts: Math.max(0, Math.round(alertBase * 0.2)),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}, [alerts.length, deviceStats, taskStats]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Card
|
||||||
|
title={
|
||||||
|
<span style={{ color: 'rgba(255,255,255,0.92)', display: 'flex', alignItems: 'center', gap: 8 }}>
|
||||||
|
<AimOutlined style={{ color: '#00b4d8' }} /> 重点港口状态
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
className="maritime-card"
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
|
<div className="port-status-list">
|
||||||
|
{portStatusData.map((item) => (
|
||||||
|
<div className="port-item" key={item.name}>
|
||||||
|
<div className="port-name">{item.name}</div>
|
||||||
|
<div className="port-stats">
|
||||||
|
<div className="stat">
|
||||||
|
<div className="num">{item.ships}</div>
|
||||||
|
<div className="txt">在线船只</div>
|
||||||
|
</div>
|
||||||
|
<div className="stat">
|
||||||
|
<div className="num">{item.tasks}</div>
|
||||||
|
<div className="txt">巡检任务</div>
|
||||||
|
</div>
|
||||||
|
<div className="stat">
|
||||||
|
<div className="num">{item.alerts}</div>
|
||||||
|
<div className="txt">告警</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default PortStatusCard;
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Button } from 'antd';
|
||||||
|
import { CompassOutlined } from '@ant-design/icons';
|
||||||
|
import { history } from 'umi';
|
||||||
|
|
||||||
|
const SeaAreaPortal: React.FC = () => {
|
||||||
|
const goTo3D = () => {
|
||||||
|
history.push('/map3d?from=maritime');
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="sea-area-portal">
|
||||||
|
<div className="nautical-grid"></div>
|
||||||
|
<div className="compass-sweep"></div>
|
||||||
|
<div className="portal-content">
|
||||||
|
<div className="portal-center">
|
||||||
|
<CompassOutlined style={{ fontSize: 52, color: '#00b4d8', marginBottom: 16 }} />
|
||||||
|
<h2 className="portal-title">海域智慧巡检监控中心</h2>
|
||||||
|
<Button type="primary" shape="round" size="large" onClick={goTo3D} className="portal-btn">
|
||||||
|
进入海域监控视图
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default SeaAreaPortal;
|
||||||
@@ -0,0 +1,185 @@
|
|||||||
|
import React, { useMemo } from 'react';
|
||||||
|
import { Card, DatePicker, Segmented, Space, Progress } from 'antd';
|
||||||
|
import { LineChartOutlined, RiseOutlined, FallOutlined } from '@ant-design/icons';
|
||||||
|
import type { Dayjs } from 'dayjs';
|
||||||
|
import type { TaskStats } from '@/services/dashboard';
|
||||||
|
|
||||||
|
interface TaskOverviewCardProps {
|
||||||
|
taskStats: TaskStats | null;
|
||||||
|
taskStatType: 'day' | 'month' | 'year';
|
||||||
|
taskStatDate: Dayjs;
|
||||||
|
onStatTypeChange: (type: 'day' | 'month' | 'year') => void;
|
||||||
|
onDateChange: (date: Dayjs) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const TaskOverviewCard: React.FC<TaskOverviewCardProps> = ({
|
||||||
|
taskStats,
|
||||||
|
taskStatType,
|
||||||
|
taskStatDate,
|
||||||
|
onStatTypeChange,
|
||||||
|
onDateChange,
|
||||||
|
}) => {
|
||||||
|
const taskPeriodText = 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]);
|
||||||
|
|
||||||
|
// 计算额外统计数据
|
||||||
|
const extraStats = useMemo(() => {
|
||||||
|
const total = (taskStats?.pending || 0) + (taskStats?.running || 0) +
|
||||||
|
(taskStats?.completed || 0) + (taskStats?.failed || 0);
|
||||||
|
const completed = taskStats?.completed || 0;
|
||||||
|
const failed = taskStats?.failed || 0;
|
||||||
|
const running = taskStats?.running || 0;
|
||||||
|
|
||||||
|
// 模拟同比增长率
|
||||||
|
const growthRate = Math.floor(Math.random() * 30) - 10; // -10% ~ +20%
|
||||||
|
|
||||||
|
// 计算完成率
|
||||||
|
const completionRate = total > 0 ? Math.round((completed / total) * 100) : 0;
|
||||||
|
|
||||||
|
// 计算失败率
|
||||||
|
const failureRate = total > 0 ? Math.round((failed / total) * 100) : 0;
|
||||||
|
|
||||||
|
// 计算平均响应时间(分钟)
|
||||||
|
const avgResponseTime = Math.floor(Math.random() * 20) + 10; // 10-30分钟
|
||||||
|
|
||||||
|
return {
|
||||||
|
total,
|
||||||
|
growthRate,
|
||||||
|
completionRate,
|
||||||
|
failureRate,
|
||||||
|
avgResponseTime,
|
||||||
|
};
|
||||||
|
}, [taskStats]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Card
|
||||||
|
title={
|
||||||
|
<span style={{ color: 'rgba(255,255,255,0.92)', display: 'flex', alignItems: 'center', gap: 8 }}>
|
||||||
|
<LineChartOutlined style={{ color: '#00b4d8' }} /> {taskPeriodText}巡检任务概览
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
extra={
|
||||||
|
<Space size={8} className="task-filter">
|
||||||
|
<Segmented
|
||||||
|
size="small"
|
||||||
|
options={[
|
||||||
|
{ label: '日', value: 'day' },
|
||||||
|
{ label: '月', value: 'month' },
|
||||||
|
{ label: '年', value: 'year' },
|
||||||
|
]}
|
||||||
|
value={taskStatType}
|
||||||
|
onChange={(v) => onStatTypeChange(v as any)}
|
||||||
|
/>
|
||||||
|
<DatePicker
|
||||||
|
size="small"
|
||||||
|
value={taskStatDate}
|
||||||
|
onChange={(v) => v && onDateChange(v)}
|
||||||
|
picker={taskStatType === 'day' ? 'date' : taskStatType}
|
||||||
|
allowClear={false}
|
||||||
|
format={datePickerFormat}
|
||||||
|
/>
|
||||||
|
</Space>
|
||||||
|
}
|
||||||
|
className="maritime-card"
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
|
{/* 主要状态网格 */}
|
||||||
|
<div className="ship-status-grid">
|
||||||
|
<div className="ship-stat-box">
|
||||||
|
<div className="val sailing">{taskStats?.pending || 0}</div>
|
||||||
|
<div className="lbl">待执行</div>
|
||||||
|
</div>
|
||||||
|
<div className="ship-stat-box">
|
||||||
|
<div className="val anchored">{taskStats?.running || 0}</div>
|
||||||
|
<div className="lbl">执行中</div>
|
||||||
|
</div>
|
||||||
|
<div className="ship-stat-box">
|
||||||
|
<div className="val docked">{taskStats?.completed || 0}</div>
|
||||||
|
<div className="lbl">已完成</div>
|
||||||
|
</div>
|
||||||
|
<div className="ship-stat-box">
|
||||||
|
<div className="val warning">{taskStats?.failed || 0}</div>
|
||||||
|
<div className="lbl">已失败</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* 成功率展示 */}
|
||||||
|
<div className="task-success">
|
||||||
|
<div className="rate">{taskStats?.successRate || 0}%</div>
|
||||||
|
<div className="label">{taskPeriodText}成功率</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* 新增:详细统计信息 */}
|
||||||
|
<div className="task-detail-stats">
|
||||||
|
<div className="stat-row">
|
||||||
|
<div className="stat-item">
|
||||||
|
<div className="stat-label">
|
||||||
|
任务总量
|
||||||
|
{extraStats.growthRate >= 0 ? (
|
||||||
|
<RiseOutlined style={{ color: '#00e5a0', marginLeft: 4, fontSize: 12 }} />
|
||||||
|
) : (
|
||||||
|
<FallOutlined style={{ color: '#ff6b6b', marginLeft: 4, fontSize: 12 }} />
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<div className="stat-value">{extraStats.total}</div>
|
||||||
|
<div className="stat-sub" style={{ color: extraStats.growthRate >= 0 ? '#00e5a0' : '#ff6b6b' }}>
|
||||||
|
同比 {extraStats.growthRate >= 0 ? '+' : ''}{extraStats.growthRate}%
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="stat-item">
|
||||||
|
<div className="stat-label">平均响应</div>
|
||||||
|
<div className="stat-value">{extraStats.avgResponseTime}<span className="stat-unit">分</span></div>
|
||||||
|
<div className="stat-sub">任务平均响应时间</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* 完成率和失败率进度条 */}
|
||||||
|
<div className="progress-row">
|
||||||
|
<div className="progress-item">
|
||||||
|
<div className="progress-label">
|
||||||
|
<span>完成率</span>
|
||||||
|
<span className="progress-percent">{extraStats.completionRate}%</span>
|
||||||
|
</div>
|
||||||
|
<Progress
|
||||||
|
percent={extraStats.completionRate}
|
||||||
|
strokeColor={{
|
||||||
|
'0%': '#00b4d8',
|
||||||
|
'100%': '#00e5a0',
|
||||||
|
}}
|
||||||
|
trailColor="rgba(0,180,216,0.15)"
|
||||||
|
showInfo={false}
|
||||||
|
strokeWidth={8}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="progress-item">
|
||||||
|
<div className="progress-label">
|
||||||
|
<span>失败率</span>
|
||||||
|
<span className="progress-percent">{extraStats.failureRate}%</span>
|
||||||
|
</div>
|
||||||
|
<Progress
|
||||||
|
percent={extraStats.failureRate}
|
||||||
|
strokeColor={{
|
||||||
|
'0%': '#ff9f43',
|
||||||
|
'100%': '#ff6b6b',
|
||||||
|
}}
|
||||||
|
trailColor="rgba(255,159,67,0.15)"
|
||||||
|
showInfo={false}
|
||||||
|
strokeWidth={8}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default TaskOverviewCard;
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Card } from 'antd';
|
||||||
|
import { BarChartOutlined } from '@ant-design/icons';
|
||||||
|
import { Column } from '@ant-design/plots';
|
||||||
|
|
||||||
|
interface TaskTypeChartProps {
|
||||||
|
taskTypeData: any[];
|
||||||
|
}
|
||||||
|
|
||||||
|
const TaskTypeChart: React.FC<TaskTypeChartProps> = ({ taskTypeData }) => {
|
||||||
|
const columnConfig: any = {
|
||||||
|
data: taskTypeData,
|
||||||
|
xField: 'type',
|
||||||
|
yField: 'value',
|
||||||
|
seriesField: 'type',
|
||||||
|
appendPadding: [20, 10, 10, 10],
|
||||||
|
color: ({ type }: any) => {
|
||||||
|
if (type === '航线巡检') return '#00b4d8';
|
||||||
|
if (type === '定点监测') return '#00e5a0';
|
||||||
|
return '#ff9f43';
|
||||||
|
},
|
||||||
|
columnStyle: {
|
||||||
|
radius: [6, 6, 0, 0],
|
||||||
|
},
|
||||||
|
label: {
|
||||||
|
text: (datum: any) => datum?.value?.toString() || '0',
|
||||||
|
style: {
|
||||||
|
fill: '#fff',
|
||||||
|
fontSize: 11,
|
||||||
|
fontWeight: 600,
|
||||||
|
textAlign: 'center',
|
||||||
|
},
|
||||||
|
position: 'top',
|
||||||
|
offset: 6,
|
||||||
|
},
|
||||||
|
xAxis: {
|
||||||
|
label: {
|
||||||
|
style: { fill: 'rgba(200,230,255,0.75)', fontSize: 10 },
|
||||||
|
autoRotate: false,
|
||||||
|
autoHide: false,
|
||||||
|
},
|
||||||
|
line: {
|
||||||
|
style: { stroke: 'rgba(0,180,216,0.2)' },
|
||||||
|
},
|
||||||
|
tickLine: null,
|
||||||
|
},
|
||||||
|
yAxis: {
|
||||||
|
label: {
|
||||||
|
style: { fill: 'rgba(200,230,255,0.75)', fontSize: 10 },
|
||||||
|
},
|
||||||
|
grid: {
|
||||||
|
line: { style: { stroke: 'rgba(0,150,200,0.15)', lineDash: [4, 4] } },
|
||||||
|
},
|
||||||
|
line: null,
|
||||||
|
tickLine: null,
|
||||||
|
},
|
||||||
|
legend: false,
|
||||||
|
animation: {
|
||||||
|
appear: {
|
||||||
|
animation: 'scale-in-y',
|
||||||
|
duration: 800,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
tooltip: {
|
||||||
|
domStyles: {
|
||||||
|
'g2-tooltip': {
|
||||||
|
background: 'rgba(10, 30, 50, 0.95)',
|
||||||
|
boxShadow: '0 4px 12px rgba(0,0,0,0.3)',
|
||||||
|
border: '1px solid rgba(0,180,216,0.3)',
|
||||||
|
},
|
||||||
|
'g2-tooltip-title': {
|
||||||
|
color: 'rgba(200,230,255,0.95)',
|
||||||
|
},
|
||||||
|
'g2-tooltip-list-item': {
|
||||||
|
color: 'rgba(200,230,255,0.85)',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
autoFit: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Card
|
||||||
|
title={
|
||||||
|
<span style={{ color: 'rgba(255,255,255,0.92)', display: 'flex', alignItems: 'center', gap: 8 }}>
|
||||||
|
<BarChartOutlined style={{ color: '#00b4d8' }} /> 任务类型统计
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
className="maritime-card"
|
||||||
|
size="small"
|
||||||
|
styles={{
|
||||||
|
body: {
|
||||||
|
padding: '8px 8px 4px 8px',
|
||||||
|
overflow: 'visible',
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div className="maritime-chart-wrapper">
|
||||||
|
<Column {...columnConfig} />
|
||||||
|
</div>
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default TaskTypeChart;
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
import React, { useMemo } from 'react';
|
||||||
|
import { Card } from 'antd';
|
||||||
|
import {
|
||||||
|
CloudOutlined,
|
||||||
|
CompassOutlined,
|
||||||
|
DashboardOutlined,
|
||||||
|
RiseOutlined,
|
||||||
|
} from '@ant-design/icons';
|
||||||
|
|
||||||
|
const WeatherCard: React.FC = () => {
|
||||||
|
const weatherMetrics = useMemo(() => ([
|
||||||
|
{ label: '风速', value: '4.6 m/s', icon: <CompassOutlined /> },
|
||||||
|
{ label: '浪高', value: '1.2 m', icon: <DashboardOutlined /> },
|
||||||
|
{ label: '能见度', value: '7.8 km', icon: <CloudOutlined /> },
|
||||||
|
{ label: '潮位', value: '2.4 m', icon: <RiseOutlined /> },
|
||||||
|
]), []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Card
|
||||||
|
title={
|
||||||
|
<span style={{ color: 'rgba(255,255,255,0.92)', display: 'flex', alignItems: 'center', gap: 8 }}>
|
||||||
|
<CloudOutlined style={{ color: '#00b4d8' }} /> 海况与气象
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
className="maritime-card"
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
|
<div className="weather-panel">
|
||||||
|
{weatherMetrics.map((item) => (
|
||||||
|
<div className="weather-item" key={item.label}>
|
||||||
|
<div className="weather-icon">{item.icon}</div>
|
||||||
|
<div className="weather-value">{item.value}</div>
|
||||||
|
<div className="weather-label">{item.label}</div>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default WeatherCard;
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
export { default as MaritimeKpiStrip } from './MaritimeKpiStrip';
|
||||||
|
export { default as DeviceTypeCard } from './DeviceTypeCard';
|
||||||
|
export { default as PortStatusCard } from './PortStatusCard';
|
||||||
|
export { default as MaritimeAlertCard } from './MaritimeAlertCard';
|
||||||
|
export { default as WeatherCard } from './WeatherCard';
|
||||||
|
export { default as SeaAreaPortal } from './SeaAreaPortal';
|
||||||
|
export { default as AnnualTrendChart } from './AnnualTrendChart';
|
||||||
|
export { default as TaskTypeChart } from './TaskTypeChart';
|
||||||
|
export { default as TaskOverviewCard } from './TaskOverviewCard';
|
||||||
|
export { default as MaritimeInsightCard } from './MaritimeInsightCard';
|
||||||
@@ -0,0 +1,623 @@
|
|||||||
|
/* 海事大屏组件样式 */
|
||||||
|
|
||||||
|
.maritime-card {
|
||||||
|
height: 100%;
|
||||||
|
min-height: 0;
|
||||||
|
max-height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
background: rgba(14, 34, 64, 0.75) !important;
|
||||||
|
border: 1px solid rgba(0, 180, 216, 0.2) !important;
|
||||||
|
border-radius: 8px;
|
||||||
|
overflow: hidden;
|
||||||
|
backdrop-filter: blur(8px);
|
||||||
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
pointer-events: none;
|
||||||
|
background:
|
||||||
|
linear-gradient(90deg, rgba(0, 180, 216, 0.5), transparent 50px) top left / 50px 2px no-repeat,
|
||||||
|
linear-gradient(180deg, rgba(0, 180, 216, 0.5), transparent 50px) top left / 2px 50px no-repeat,
|
||||||
|
linear-gradient(270deg, rgba(0, 180, 216, 0.5), transparent 50px) top right / 50px 2px no-repeat,
|
||||||
|
linear-gradient(180deg, rgba(0, 180, 216, 0.5), transparent 50px) top right / 2px 50px no-repeat,
|
||||||
|
linear-gradient(90deg, rgba(0, 180, 216, 0.5), transparent 50px) bottom left / 50px 2px no-repeat,
|
||||||
|
linear-gradient(0deg, rgba(0, 180, 216, 0.5), transparent 50px) bottom left / 2px 50px no-repeat,
|
||||||
|
linear-gradient(270deg, rgba(0, 180, 216, 0.5), transparent 50px) bottom right / 50px 2px no-repeat,
|
||||||
|
linear-gradient(0deg, rgba(0, 180, 216, 0.5), transparent 50px) bottom right / 2px 50px no-repeat;
|
||||||
|
opacity: 0.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(.ant-card-head) {
|
||||||
|
min-height: 40px;
|
||||||
|
padding: 0 12px;
|
||||||
|
border-bottom: 1px solid rgba(0, 180, 216, 0.15);
|
||||||
|
flex: 0 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(.ant-card-body) {
|
||||||
|
flex: 1;
|
||||||
|
padding: 12px;
|
||||||
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* KPI 指标条样式 */
|
||||||
|
.maritime-kpi-strip {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(4, 1fr);
|
||||||
|
gap: 12px;
|
||||||
|
width: 100%;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.maritime-kpi-tile {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
padding: 12px 16px;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: rgba(14, 34, 64, 0.7);
|
||||||
|
border: 1px solid rgba(0, 180, 216, 0.18);
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
transform: translateY(-2px);
|
||||||
|
border-color: rgba(0, 180, 216, 0.35);
|
||||||
|
box-shadow: 0 6px 16px rgba(0, 180, 216, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
&--ship .maritime-kpi-tile__icon {
|
||||||
|
color: #00b4d8;
|
||||||
|
background: rgba(0, 180, 216, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
&--anchor .maritime-kpi-tile__icon {
|
||||||
|
color: #00e5a0;
|
||||||
|
background: rgba(0, 229, 160, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
&--alert .maritime-kpi-tile__icon {
|
||||||
|
color: #ff9f43;
|
||||||
|
background: rgba(255, 159, 67, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
&--route .maritime-kpi-tile__icon {
|
||||||
|
color: #48cae4;
|
||||||
|
background: rgba(72, 202, 228, 0.15);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.maritime-kpi-tile__icon {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 20px;
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.maritime-kpi-tile__info {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.maritime-kpi-tile__label {
|
||||||
|
font-size: 13px;
|
||||||
|
color: rgba(200, 230, 255, 0.75);
|
||||||
|
line-height: 1.3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.maritime-kpi-tile__value {
|
||||||
|
font-size: 24px;
|
||||||
|
font-weight: 800;
|
||||||
|
color: rgba(255, 255, 255, 0.95);
|
||||||
|
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
||||||
|
margin-top: 2px;
|
||||||
|
|
||||||
|
small {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 700;
|
||||||
|
margin-left: 2px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 图表容器样式 */
|
||||||
|
.maritime-chart-wrapper {
|
||||||
|
flex: 1;
|
||||||
|
width: 100%;
|
||||||
|
min-height: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
> div {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(canvas) {
|
||||||
|
max-width: 100%;
|
||||||
|
max-height: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 港口状态列表样式 */
|
||||||
|
.port-status-list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.port-item {
|
||||||
|
padding: 12px;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: rgba(255, 255, 255, 0.03);
|
||||||
|
border: 1px solid rgba(0, 180, 216, 0.12);
|
||||||
|
}
|
||||||
|
|
||||||
|
.port-name {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: rgba(200, 230, 255, 0.92);
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.port-stats {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(3, 1fr);
|
||||||
|
gap: 8px;
|
||||||
|
|
||||||
|
.stat {
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
.num {
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: 800;
|
||||||
|
color: #00b4d8;
|
||||||
|
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
.txt {
|
||||||
|
font-size: 11px;
|
||||||
|
color: rgba(200, 230, 255, 0.65);
|
||||||
|
margin-top: 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 告警列表样式 */
|
||||||
|
.alert-list-container {
|
||||||
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
|
overflow-y: auto;
|
||||||
|
overflow-x: hidden;
|
||||||
|
padding-right: 4px;
|
||||||
|
|
||||||
|
&::-webkit-scrollbar {
|
||||||
|
width: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&::-webkit-scrollbar-thumb {
|
||||||
|
background: rgba(0, 180, 216, 0.3);
|
||||||
|
border-radius: 2px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.maritime-alert-item {
|
||||||
|
padding: 10px 0 !important;
|
||||||
|
border-bottom: 1px solid rgba(0, 180, 216, 0.08) !important;
|
||||||
|
|
||||||
|
.alert-row {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
align-items: flex-start;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.alert-badge {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.alert-content {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.alert-head {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 10px;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.alert-name {
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: rgba(200, 230, 255, 0.92);
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.alert-time {
|
||||||
|
font-size: 12px;
|
||||||
|
color: rgba(200, 230, 255, 0.55);
|
||||||
|
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
.alert-msg {
|
||||||
|
font-size: 12px;
|
||||||
|
color: rgba(200, 230, 255, 0.65);
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 天气面板样式 */
|
||||||
|
.weather-panel {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(2, 1fr);
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.weather-item {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
padding: 16px 12px;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: rgba(255, 255, 255, 0.03);
|
||||||
|
border: 1px solid rgba(0, 180, 216, 0.12);
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: rgba(255, 255, 255, 0.05);
|
||||||
|
border-color: rgba(0, 180, 216, 0.25);
|
||||||
|
}
|
||||||
|
|
||||||
|
.weather-icon {
|
||||||
|
font-size: 28px;
|
||||||
|
color: #00b4d8;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.weather-value {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 800;
|
||||||
|
color: rgba(255, 255, 255, 0.95);
|
||||||
|
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.weather-label {
|
||||||
|
font-size: 12px;
|
||||||
|
color: rgba(200, 230, 255, 0.65);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 海域门户样式 */
|
||||||
|
.sea-area-portal {
|
||||||
|
position: relative;
|
||||||
|
height: 100%;
|
||||||
|
min-height: 0;
|
||||||
|
background: rgba(14, 34, 64, 0.75);
|
||||||
|
border: 1px solid rgba(0, 180, 216, 0.2);
|
||||||
|
border-radius: 8px;
|
||||||
|
overflow: hidden;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
.nautical-grid {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
background-image:
|
||||||
|
linear-gradient(rgba(0, 180, 216, 0.12) 1px, transparent 1px),
|
||||||
|
linear-gradient(90deg, rgba(0, 180, 216, 0.12) 1px, transparent 1px);
|
||||||
|
background-size: 40px 40px;
|
||||||
|
opacity: 0.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.compass-sweep {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
background: radial-gradient(circle at center, rgba(0, 180, 216, 0.18), transparent 60%);
|
||||||
|
animation: pulse 3s ease-in-out infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.portal-content {
|
||||||
|
position: relative;
|
||||||
|
z-index: 2;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.portal-center {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.portal-title {
|
||||||
|
font-size: 22px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: rgba(255, 255, 255, 0.92);
|
||||||
|
margin-bottom: 20px;
|
||||||
|
text-shadow: 0 2px 8px rgba(0, 180, 216, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.portal-btn {
|
||||||
|
background: linear-gradient(135deg, #00b4d8, #0096c7);
|
||||||
|
border: none;
|
||||||
|
box-shadow: 0 4px 16px rgba(0, 180, 216, 0.3);
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
transform: translateY(-2px);
|
||||||
|
box-shadow: 0 6px 20px rgba(0, 180, 216, 0.4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes pulse {
|
||||||
|
0%, 100% { opacity: 0.3; }
|
||||||
|
50% { opacity: 0.5; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 面板分割样式 */
|
||||||
|
.panel-split {
|
||||||
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
gap: 12px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-section {
|
||||||
|
min-height: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-subtitle {
|
||||||
|
margin: 0 0 8px;
|
||||||
|
font-size: 12px;
|
||||||
|
color: rgba(200, 230, 255, 0.65);
|
||||||
|
letter-spacing: 0.2px;
|
||||||
|
flex: 0 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 任务筛选器样式 */
|
||||||
|
.task-filter {
|
||||||
|
:global(.ant-segmented) {
|
||||||
|
background: rgba(0, 180, 216, 0.08);
|
||||||
|
border: 1px solid rgba(0, 180, 216, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(.ant-segmented-item-label) {
|
||||||
|
color: rgba(200, 230, 255, 0.85);
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(.ant-segmented-item-selected) {
|
||||||
|
background: rgba(0, 180, 216, 0.25) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(.ant-picker) {
|
||||||
|
background: rgba(0, 180, 216, 0.08);
|
||||||
|
border: 1px solid rgba(0, 180, 216, 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.65);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 船只状态网格 */
|
||||||
|
.ship-status-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(4, 1fr);
|
||||||
|
gap: 12px;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ship-stat-box {
|
||||||
|
padding: 12px;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: rgba(255, 255, 255, 0.03);
|
||||||
|
border: 1px solid rgba(0, 180, 216, 0.12);
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
.val {
|
||||||
|
font-size: 24px;
|
||||||
|
font-weight: 800;
|
||||||
|
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
|
||||||
|
&.sailing { color: #ffa502; }
|
||||||
|
&.anchored { color: #00b4d8; }
|
||||||
|
&.docked { color: #00e5a0; }
|
||||||
|
&.warning { color: #ff6b6b; }
|
||||||
|
}
|
||||||
|
|
||||||
|
.lbl {
|
||||||
|
font-size: 12px;
|
||||||
|
color: rgba(200, 230, 255, 0.65);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 任务成功率 */
|
||||||
|
.task-success {
|
||||||
|
padding: 16px;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: linear-gradient(135deg, rgba(0, 229, 160, 0.12), rgba(0, 180, 216, 0.08));
|
||||||
|
border: 1px solid rgba(0, 229, 160, 0.2);
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
|
||||||
|
.rate {
|
||||||
|
font-size: 32px;
|
||||||
|
font-weight: 900;
|
||||||
|
color: #00e5a0;
|
||||||
|
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
||||||
|
text-shadow: 0 2px 8px rgba(0, 229, 160, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
font-size: 13px;
|
||||||
|
color: rgba(200, 230, 255, 0.75);
|
||||||
|
margin-top: 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 任务详细统计 */
|
||||||
|
.task-detail-stats {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 12px;
|
||||||
|
|
||||||
|
.stat-row {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-item {
|
||||||
|
padding: 12px;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: rgba(255, 255, 255, 0.03);
|
||||||
|
border: 1px solid rgba(0, 180, 216, 0.12);
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
.stat-label {
|
||||||
|
font-size: 12px;
|
||||||
|
color: rgba(200, 230, 255, 0.65);
|
||||||
|
margin-bottom: 6px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-value {
|
||||||
|
font-size: 22px;
|
||||||
|
font-weight: 800;
|
||||||
|
color: #00b4d8;
|
||||||
|
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
|
||||||
|
.stat-unit {
|
||||||
|
font-size: 12px;
|
||||||
|
margin-left: 2px;
|
||||||
|
color: rgba(200, 230, 255, 0.75);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-sub {
|
||||||
|
font-size: 11px;
|
||||||
|
color: rgba(200, 230, 255, 0.55);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.progress-row {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.progress-item {
|
||||||
|
padding: 12px;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: rgba(255, 255, 255, 0.03);
|
||||||
|
border: 1px solid rgba(0, 180, 216, 0.12);
|
||||||
|
|
||||||
|
.progress-label {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
font-size: 12px;
|
||||||
|
color: rgba(200, 230, 255, 0.75);
|
||||||
|
|
||||||
|
.progress-percent {
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: rgba(255, 255, 255, 0.85);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(.ant-progress-bg) {
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Tabs 样式 */
|
||||||
|
.maritime-tabs {
|
||||||
|
height: 100%;
|
||||||
|
min-height: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
:global(.ant-tabs-nav) {
|
||||||
|
margin: 0 0 8px;
|
||||||
|
flex: 0 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(.ant-tabs-nav::before) {
|
||||||
|
border-bottom-color: rgba(0, 180, 216, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(.ant-tabs-tab) {
|
||||||
|
color: rgba(200, 230, 255, 0.65);
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(.ant-tabs-tab.ant-tabs-tab-active .ant-tabs-tab-btn) {
|
||||||
|
color: rgba(200, 230, 255, 0.95);
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(.ant-tabs-ink-bar) {
|
||||||
|
background: #00b4d8;
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(.ant-tabs-content-holder) {
|
||||||
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(.ant-tabs-content) {
|
||||||
|
height: 100%;
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(.ant-tabs-tabpane) {
|
||||||
|
height: 100%;
|
||||||
|
min-height: 0;
|
||||||
|
padding: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.maritime-insight-card {
|
||||||
|
:global(.ant-card-body) {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
/* 海事智慧监控服务平台 - 主题样式 */
|
/* 海事智慧监控服务平台 - 主题样式 */
|
||||||
/* 采用深海蓝色调 + 波浪动效 + 海事元素 - 区别于通用大屏 */
|
/* 采用深海蓝色调 + 波浪动效 + 海事元素 - 区别于通用大屏 */
|
||||||
|
|
||||||
|
/* 导入组件样式 */
|
||||||
|
@import './components/maritime-card.less';
|
||||||
|
|
||||||
.maritime-dashboard {
|
.maritime-dashboard {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -8,16 +11,17 @@
|
|||||||
min-height: 0;
|
min-height: 0;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
font-size: clamp(12px, 1.1vh, 14px);
|
font-size: clamp(11px, 1.0vh, 13px);
|
||||||
--mar-pad-x: clamp(12px, 1.4vw, 18px);
|
--mar-pad-x: clamp(10px, 1.1vw, 14px);
|
||||||
--mar-pad-y: clamp(10px, 1.2vh, 16px);
|
--mar-pad-y: clamp(8px, 0.9vh, 12px);
|
||||||
--mar-gap: clamp(10px, 1.2vh, 14px);
|
--mar-gap: clamp(8px, 0.9vh, 12px);
|
||||||
--mar-kpi-h: clamp(70px, 9vh, 85px);
|
--mar-kpi-h: clamp(62px, 7.2vh, 78px);
|
||||||
--mar-card-head-h: clamp(36px, 4.4vh, 42px);
|
--mar-card-head-h: clamp(32px, 3.6vh, 38px);
|
||||||
--mar-card-body-pad: clamp(8px, 1.1vh, 12px);
|
--mar-card-body-pad: clamp(6px, 0.9vh, 10px);
|
||||||
--mar-frame-h: clamp(18px, 2.6vh, 28px);
|
--mar-frame-h: clamp(14px, 2.0vh, 20px);
|
||||||
--mar-frame-gap: clamp(6px, 0.9vh, 12px);
|
--mar-frame-gap: clamp(4px, 0.6vh, 8px);
|
||||||
--mar-map-min: clamp(240px, 33vh, 360px);
|
/* 重要:避免中心入口的 min-height 撑破网格,导致底部卡片被挤出屏幕 */
|
||||||
|
--mar-map-min: 0px;
|
||||||
background: linear-gradient(180deg,
|
background: linear-gradient(180deg,
|
||||||
#020c1b 0%,
|
#020c1b 0%,
|
||||||
#051525 25%,
|
#051525 25%,
|
||||||
@@ -121,47 +125,50 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.maritime-dashboard--compact-1 {
|
.maritime-dashboard--compact-1 {
|
||||||
--mar-pad-x: clamp(10px, 1.1vw, 16px);
|
--mar-pad-x: clamp(8px, 0.95vw, 12px);
|
||||||
--mar-pad-y: clamp(8px, 1.0vh, 12px);
|
--mar-pad-y: clamp(6px, 0.75vh, 10px);
|
||||||
--mar-gap: clamp(8px, 1.0vh, 12px);
|
--mar-gap: clamp(6px, 0.75vh, 10px);
|
||||||
--mar-kpi-h: clamp(64px, 8vh, 78px);
|
--mar-kpi-h: clamp(56px, 6.4vh, 70px);
|
||||||
--mar-card-head-h: clamp(34px, 4.0vh, 40px);
|
--mar-card-head-h: clamp(30px, 3.2vh, 36px);
|
||||||
--mar-card-body-pad: clamp(6px, 0.9vh, 10px);
|
--mar-card-body-pad: clamp(6px, 0.75vh, 9px);
|
||||||
--mar-frame-h: clamp(16px, 2.2vh, 24px);
|
--mar-frame-h: clamp(12px, 1.8vh, 18px);
|
||||||
--mar-frame-gap: clamp(4px, 0.7vh, 10px);
|
--mar-frame-gap: clamp(3px, 0.5vh, 7px);
|
||||||
--mar-map-min: clamp(220px, 30vh, 320px);
|
--mar-map-min: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.maritime-dashboard--compact-2 {
|
.maritime-dashboard--compact-2 {
|
||||||
--mar-pad-x: clamp(8px, 1.0vw, 14px);
|
--mar-pad-x: clamp(6px, 0.85vw, 10px);
|
||||||
--mar-pad-y: clamp(6px, 0.8vh, 10px);
|
--mar-pad-y: clamp(4px, 0.65vh, 8px);
|
||||||
--mar-gap: clamp(6px, 0.9vh, 10px);
|
--mar-gap: clamp(5px, 0.65vh, 8px);
|
||||||
--mar-kpi-h: clamp(58px, 7vh, 70px);
|
--mar-kpi-h: clamp(52px, 6vh, 64px);
|
||||||
--mar-card-head-h: clamp(32px, 3.6vh, 38px);
|
--mar-card-head-h: clamp(28px, 3.0vh, 34px);
|
||||||
--mar-card-body-pad: clamp(6px, 0.8vh, 9px);
|
--mar-card-body-pad: clamp(5px, 0.65vh, 8px);
|
||||||
--mar-frame-h: clamp(14px, 2.0vh, 22px);
|
--mar-frame-h: clamp(10px, 1.6vh, 16px);
|
||||||
--mar-frame-gap: clamp(4px, 0.6vh, 8px);
|
--mar-frame-gap: clamp(3px, 0.45vh, 6px);
|
||||||
--mar-map-min: clamp(200px, 28vh, 300px);
|
--mar-map-min: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 主内容区域 */
|
/* 主内容区域 */
|
||||||
.maritime-spin {
|
.maritime-spin {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
display: flex;
|
display: block;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
width: 100%;
|
||||||
:global(.ant-spin-container) {
|
:global(.ant-spin-container) {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.maritime-content {
|
.maritime-content {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
padding: var(--mar-pad-y) var(--mar-pad-x);
|
padding: var(--mar-pad-y) var(--mar-pad-x);
|
||||||
padding-bottom: calc(var(--mar-pad-y) + var(--mar-frame-h) + var(--mar-frame-gap));
|
/* 参考智慧城市:底部装饰条保留但尽量少占内容区高度 */
|
||||||
|
padding-bottom: calc(var(--mar-pad-y) + var(--mar-frame-h));
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
@@ -169,6 +176,8 @@
|
|||||||
min-height: 0;
|
min-height: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.maritime-bottom-frame {
|
.maritime-bottom-frame {
|
||||||
@@ -212,23 +221,47 @@
|
|||||||
|
|
||||||
.maritime-grid {
|
.maritime-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: minmax(0, 25%) minmax(0, 50%) minmax(0, 25%);
|
grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr);
|
||||||
grid-template-rows: minmax(0, 1fr);
|
grid-template-rows: minmax(0, 1fr);
|
||||||
gap: var(--mar-gap);
|
gap: var(--mar-gap);
|
||||||
height: 100%;
|
/* 只用 flex 约束高度,避免百分比高度在某些容器链路下变成不确定值 */
|
||||||
|
flex: 1;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
flex: 1;
|
justify-items: stretch;
|
||||||
|
align-items: stretch;
|
||||||
}
|
}
|
||||||
|
|
||||||
.grid-col {
|
.maritime-dashboard .grid-col {
|
||||||
display: flex;
|
display: grid;
|
||||||
flex-direction: column;
|
|
||||||
gap: var(--mar-gap);
|
gap: var(--mar-gap);
|
||||||
height: 100%;
|
height: 100%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
|
min-width: 0;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.maritime-dashboard .grid-col > * {
|
||||||
|
min-height: 0;
|
||||||
|
max-height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.maritime-dashboard .grid-col.left-col {
|
||||||
|
/* 4张卡片:上两张偏“静态概览”稍矮,告警为主要信息流更高,海况为补充更矮 */
|
||||||
|
grid-template-rows: minmax(0, 0.9fr) minmax(0, 0.85fr) minmax(0, 1.35fr) minmax(0, 0.55fr);
|
||||||
|
}
|
||||||
|
|
||||||
|
.maritime-dashboard .grid-col.right-col {
|
||||||
|
/* 4张卡片:概览较高,其余三张均衡 */
|
||||||
|
grid-template-rows: minmax(0, 1.15fr) minmax(0, 0.95fr) minmax(0, 1fr) minmax(0, 0.9fr);
|
||||||
|
}
|
||||||
|
|
||||||
|
.maritime-dashboard .grid-col.center-col {
|
||||||
|
/* 参考智慧城市:固定 KPI + 其余区域按比例分配,避免底部卡片被挤出屏幕 */
|
||||||
|
grid-template-rows: var(--mar-kpi-h) minmax(0, 1.35fr) minmax(0, 0.85fr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 海事风格玻璃面板 */
|
/* 海事风格玻璃面板 */
|
||||||
@@ -269,14 +302,14 @@
|
|||||||
|
|
||||||
:global(.ant-card-head) {
|
:global(.ant-card-head) {
|
||||||
min-height: var(--mar-card-head-h);
|
min-height: var(--mar-card-head-h);
|
||||||
padding: 0 14px;
|
padding: 0 12px;
|
||||||
border-bottom: 1px solid rgba(0, 180, 230, 0.15);
|
border-bottom: 1px solid rgba(0, 180, 230, 0.15);
|
||||||
background: linear-gradient(90deg, rgba(0, 100, 150, 0.2), transparent);
|
background: linear-gradient(90deg, rgba(0, 100, 150, 0.2), transparent);
|
||||||
|
|
||||||
.ant-card-head-title {
|
.ant-card-head-title {
|
||||||
font-size: 15px;
|
font-size: 13px;
|
||||||
color: #e0f7ff;
|
color: #e0f7ff;
|
||||||
padding: 10px 0;
|
padding: 8px 0;
|
||||||
letter-spacing: 1px;
|
letter-spacing: 1px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -291,6 +324,49 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.panel-block {
|
||||||
|
height: 100%;
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-split {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
|
gap: var(--mar-gap);
|
||||||
|
height: 100%;
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-split--ratio {
|
||||||
|
grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-stack {
|
||||||
|
display: grid;
|
||||||
|
grid-template-rows: repeat(2, minmax(0, 1fr));
|
||||||
|
gap: var(--mar-gap);
|
||||||
|
height: 100%;
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-stack--alert {
|
||||||
|
grid-template-rows: minmax(0, 1.3fr) minmax(0, 0.7fr);
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-section {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
min-height: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-subtitle {
|
||||||
|
font-size: 12px;
|
||||||
|
color: rgba(200, 230, 255, 0.7);
|
||||||
|
letter-spacing: 1px;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
.chart-wrapper {
|
.chart-wrapper {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -320,7 +396,7 @@
|
|||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 0 16px;
|
padding: 0 12px;
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
@@ -336,10 +412,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.kpi-icon {
|
.kpi-icon {
|
||||||
font-size: 26px;
|
font-size: 22px;
|
||||||
margin-right: 14px;
|
margin-right: 10px;
|
||||||
width: 46px;
|
width: 40px;
|
||||||
height: 46px;
|
height: 40px;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -355,7 +431,7 @@
|
|||||||
.kpi-info {
|
.kpi-info {
|
||||||
.label { font-size: 12px; color: rgba(200, 230, 255, 0.7); }
|
.label { font-size: 12px; color: rgba(200, 230, 255, 0.7); }
|
||||||
.value {
|
.value {
|
||||||
font-size: 26px;
|
font-size: 22px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
font-family: 'Segoe UI', sans-serif;
|
font-family: 'Segoe UI', sans-serif;
|
||||||
@@ -370,6 +446,7 @@
|
|||||||
.map-portal-wrapper {
|
.map-portal-wrapper {
|
||||||
flex: 2;
|
flex: 2;
|
||||||
min-height: var(--mar-map-min);
|
min-height: var(--mar-map-min);
|
||||||
|
height: 100%;
|
||||||
position: relative;
|
position: relative;
|
||||||
background: linear-gradient(180deg, rgba(0, 40, 80, 0.5) 0%, rgba(0, 60, 100, 0.3) 100%);
|
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: 1px solid rgba(0, 180, 230, 0.35);
|
||||||
@@ -442,8 +519,8 @@
|
|||||||
|
|
||||||
.portal-center {
|
.portal-center {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
width: 320px;
|
width: clamp(240px, 16vw, 300px);
|
||||||
height: 320px;
|
height: clamp(240px, 16vw, 300px);
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -474,16 +551,16 @@
|
|||||||
|
|
||||||
.portal-title {
|
.portal-title {
|
||||||
color: #e0f7ff;
|
color: #e0f7ff;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 14px;
|
||||||
font-size: 20px;
|
font-size: 18px;
|
||||||
letter-spacing: 3px;
|
letter-spacing: 3px;
|
||||||
text-shadow: 0 0 15px rgba(0, 200, 255, 0.5);
|
text-shadow: 0 0 15px rgba(0, 200, 255, 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
.portal-btn {
|
.portal-btn {
|
||||||
height: 46px;
|
height: 42px;
|
||||||
padding: 0 36px;
|
padding: 0 30px;
|
||||||
font-size: 15px;
|
font-size: 14px;
|
||||||
background: linear-gradient(135deg, #0096c7 0%, #0077b6 100%);
|
background: linear-gradient(135deg, #0096c7 0%, #0077b6 100%);
|
||||||
border: none;
|
border: none;
|
||||||
box-shadow: 0 4px 20px rgba(0, 150, 200, 0.4);
|
box-shadow: 0 4px 20px rgba(0, 150, 200, 0.4);
|
||||||
@@ -501,6 +578,8 @@
|
|||||||
|
|
||||||
/* 告警列表 - 海事风格 */
|
/* 告警列表 - 海事风格 */
|
||||||
.alert-list-container {
|
.alert-list-container {
|
||||||
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
|
||||||
@@ -576,11 +655,31 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.task-success {
|
||||||
|
margin-top: 16px;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
.rate {
|
||||||
|
font-size: 32px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #00e5a0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #e0f7ff;
|
||||||
|
margin-top: 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* 气象信息面板 */
|
/* 气象信息面板 */
|
||||||
.weather-panel {
|
.weather-panel {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
gap: 12px;
|
gap: 12px;
|
||||||
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
|
align-content: flex-start;
|
||||||
|
|
||||||
.weather-item {
|
.weather-item {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
@@ -613,6 +712,13 @@
|
|||||||
|
|
||||||
/* 港口状态 */
|
/* 港口状态 */
|
||||||
.port-status-list {
|
.port-status-list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 8px;
|
||||||
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
|
overflow-y: auto;
|
||||||
|
|
||||||
.port-item {
|
.port-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -620,7 +726,7 @@
|
|||||||
padding: 10px 12px;
|
padding: 10px 12px;
|
||||||
background: rgba(0, 80, 120, 0.25);
|
background: rgba(0, 80, 120, 0.25);
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
margin-bottom: 8px;
|
margin-bottom: 0;
|
||||||
border-left: 3px solid #00b4d8;
|
border-left: 3px solid #00b4d8;
|
||||||
|
|
||||||
.port-name {
|
.port-name {
|
||||||
@@ -724,9 +830,19 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* 响应式布局 */
|
/* 响应式布局 */
|
||||||
@media (max-width: 1400px) {
|
@media (max-width: 1680px) {
|
||||||
.maritime-grid {
|
.maritime-grid {
|
||||||
grid-template-columns: 28% 44% 28%;
|
grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.8fr) minmax(0, 1.1fr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@media (max-width: 1440px) {
|
||||||
|
.maritime-grid {
|
||||||
|
grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.6fr) minmax(0, 1.2fr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -746,7 +862,10 @@
|
|||||||
grid-template-rows: auto;
|
grid-template-rows: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.grid-col {
|
.maritime-dashboard .grid-col {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: var(--mar-gap);
|
||||||
height: auto;
|
height: auto;
|
||||||
min-height: 400px;
|
min-height: 400px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,34 +1,22 @@
|
|||||||
import React, { useState, useEffect, useCallback, useMemo } from 'react';
|
import React, { useState, useEffect, useCallback, useMemo } from 'react';
|
||||||
import { Card, Button, List, Tag, Spin, message, DatePicker, Segmented, Space } from 'antd';
|
import { Spin, message } from 'antd';
|
||||||
import {
|
|
||||||
WarningOutlined,
|
|
||||||
RocketOutlined,
|
|
||||||
CompassOutlined,
|
|
||||||
PieChartOutlined,
|
|
||||||
EnvironmentOutlined,
|
|
||||||
} from '@ant-design/icons';
|
|
||||||
import { Line, Pie, Column, Area, Rose } from '@ant-design/plots';
|
|
||||||
import { history } from 'umi';
|
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
import type { AlertItem, DeviceStats, TaskStats, TrendItem } from '@/services/dashboard';
|
||||||
|
import { getDeviceStats, getTaskStats, getTrendData } from '@/services/dashboard';
|
||||||
import {
|
import {
|
||||||
getDeviceStats,
|
MaritimeKpiStrip,
|
||||||
getTaskStats,
|
DeviceTypeCard,
|
||||||
getTrendData,
|
PortStatusCard,
|
||||||
getMockAlerts,
|
MaritimeAlertCard,
|
||||||
DeviceStats,
|
WeatherCard,
|
||||||
TaskStats,
|
SeaAreaPortal,
|
||||||
TrendItem,
|
AnnualTrendChart,
|
||||||
AlertItem,
|
TaskTypeChart,
|
||||||
} from '@/services/dashboard';
|
TaskOverviewCard,
|
||||||
|
MaritimeInsightCard,
|
||||||
|
} from './components';
|
||||||
import './index.less';
|
import './index.less';
|
||||||
|
|
||||||
// 无人船图标组件
|
|
||||||
const USVIcon = () => (
|
|
||||||
<svg viewBox="0 0 24 24" width="1em" height="1em" fill="currentColor">
|
|
||||||
<path d="M20 21c-1.39 0-2.78-.47-4-1.32-2.44 1.71-5.56 1.71-8 0C6.78 20.53 5.39 21 4 21H2v2h2c1.38 0 2.74-.35 4-.99 2.52 1.29 5.48 1.29 8 0 1.26.64 2.63.99 4 .99h2v-2h-2zM3.95 19H4c1.6 0 3.02-.88 4-2 .98 1.12 2.4 2 4 2s3.02-.88 4-2c.98 1.12 2.4 2 4 2h.05l1.89-6.68c.08-.26.06-.54-.06-.78s-.34-.42-.6-.5L20 10.62V6c0-1.1-.9-2-2-2h-3V1H9v3H6c-1.1 0-2 .9-2 2v4.62l-1.29.42c-.26.08-.48.26-.6.5s-.15.52-.06.78L3.95 19zM6 6h12v3.97L12 8 6 9.97V6z"/>
|
|
||||||
</svg>
|
|
||||||
);
|
|
||||||
|
|
||||||
const MaritimeDashboard: React.FC = () => {
|
const MaritimeDashboard: React.FC = () => {
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [deviceStats, setDeviceStats] = useState<DeviceStats | null>(null);
|
const [deviceStats, setDeviceStats] = useState<DeviceStats | null>(null);
|
||||||
@@ -42,19 +30,19 @@ const MaritimeDashboard: React.FC = () => {
|
|||||||
const [taskStatDate, setTaskStatDate] = useState(dayjs());
|
const [taskStatDate, setTaskStatDate] = useState(dayjs());
|
||||||
const [tenantId, setTenantId] = useState<string | undefined>();
|
const [tenantId, setTenantId] = useState<string | undefined>();
|
||||||
const [includeChildren, setIncludeChildren] = useState<boolean>(true);
|
const [includeChildren, setIncludeChildren] = useState<boolean>(true);
|
||||||
const [compactLevel, setCompactLevel] = useState<0 | 1 | 2>(0);
|
|
||||||
|
|
||||||
useEffect(() => {
|
// 海事专用告警数据
|
||||||
const calc = () => {
|
const getMaritimeAlerts = useCallback((): AlertItem[] => {
|
||||||
const height = window?.innerHeight || 0;
|
return [
|
||||||
const next: 0 | 1 | 2 = height <= 760 ? 2 : height <= 900 ? 1 : 0;
|
{ id: '1', type: 'device_fault', level: 'critical', deviceName: '巡检船-01', message: '检测到船只超速航行,航速28节', timestamp: new Date(Date.now() - 120000).toISOString() },
|
||||||
setCompactLevel(next);
|
{ 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() },
|
||||||
calc();
|
{ id: '4', type: 'low_battery', level: 'warning', deviceName: '巡检船-02', message: '电池电量低于20%', timestamp: new Date(Date.now() - 900000).toISOString() },
|
||||||
window.addEventListener('resize', calc);
|
{ id: '5', type: 'task_failed', level: 'warning', taskName: '巡检任务#1023', message: '巡检完成,未发现违规', timestamp: new Date(Date.now() - 1200000).toISOString() },
|
||||||
return () => window.removeEventListener('resize', calc);
|
];
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
// 初始化模拟数据
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// 模拟年度数据
|
// 模拟年度数据
|
||||||
const mockAnnual: any[] = [];
|
const mockAnnual: any[] = [];
|
||||||
@@ -90,6 +78,7 @@ const MaritimeDashboard: React.FC = () => {
|
|||||||
]);
|
]);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
// 监听租户变化
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handler = (e: any) => {
|
const handler = (e: any) => {
|
||||||
const nextTenantId = e?.detail?.tenantId as string | undefined;
|
const nextTenantId = e?.detail?.tenantId as string | undefined;
|
||||||
@@ -101,6 +90,7 @@ const MaritimeDashboard: React.FC = () => {
|
|||||||
return () => window.removeEventListener('tenant-change', handler as any);
|
return () => window.removeEventListener('tenant-change', handler as any);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
// 获取数据
|
||||||
const fetchData = useCallback(async () => {
|
const fetchData = useCallback(async () => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
try {
|
||||||
@@ -122,7 +112,6 @@ const MaritimeDashboard: React.FC = () => {
|
|||||||
setDeviceStats(deviceRes);
|
setDeviceStats(deviceRes);
|
||||||
setTaskStats(taskRes);
|
setTaskStats(taskRes);
|
||||||
setTaskTrend(trendRes.taskTrend);
|
setTaskTrend(trendRes.taskTrend);
|
||||||
// 模拟海事告警数据
|
|
||||||
setAlerts(getMaritimeAlerts());
|
setAlerts(getMaritimeAlerts());
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取数据失败:', error);
|
console.error('获取数据失败:', error);
|
||||||
@@ -130,258 +119,36 @@ const MaritimeDashboard: React.FC = () => {
|
|||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
}, [includeChildren, taskStatDate, taskStatType, tenantId]);
|
}, [getMaritimeAlerts, 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(() => {
|
useEffect(() => {
|
||||||
if (!tenantId) return;
|
|
||||||
fetchData();
|
fetchData();
|
||||||
}, [fetchData]);
|
|
||||||
|
|
||||||
// 定时刷新
|
|
||||||
useEffect(() => {
|
|
||||||
const dataTimer = setInterval(fetchData, 30000);
|
const dataTimer = setInterval(fetchData, 30000);
|
||||||
return () => {
|
return () => {
|
||||||
clearInterval(dataTimer);
|
clearInterval(dataTimer);
|
||||||
};
|
};
|
||||||
}, [fetchData]);
|
}, [fetchData]);
|
||||||
|
|
||||||
const goTo3D = () => {
|
|
||||||
// 传递来源页面,以便从map3d返回时能回到正确的大屏
|
|
||||||
history.push('/map3d?from=maritime');
|
|
||||||
};
|
|
||||||
|
|
||||||
// --- 图表配置 ---
|
|
||||||
|
|
||||||
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]);
|
|
||||||
|
|
||||||
// 近7日任务完成数趋势数据
|
|
||||||
const taskCompleteTrendData = useMemo(() => {
|
|
||||||
return taskTrend.map((t) => ({
|
|
||||||
date: t.date,
|
|
||||||
value: t.completed || 0,
|
|
||||||
}));
|
|
||||||
}, [taskTrend]);
|
|
||||||
|
|
||||||
const chartHeights = useMemo(() => {
|
|
||||||
if (compactLevel === 2) {
|
|
||||||
return {
|
|
||||||
taskTrend: 140,
|
|
||||||
pie: 160,
|
|
||||||
column: 140,
|
|
||||||
taskComplete: 120,
|
|
||||||
area: 170,
|
|
||||||
rose: 160,
|
|
||||||
taskStatus: 150,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if (compactLevel === 1) {
|
|
||||||
return {
|
|
||||||
taskTrend: 160,
|
|
||||||
pie: 180,
|
|
||||||
column: 160,
|
|
||||||
taskComplete: 140,
|
|
||||||
area: 190,
|
|
||||||
rose: 180,
|
|
||||||
taskStatus: 170,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
taskTrend: 180,
|
|
||||||
pie: 200,
|
|
||||||
column: 180,
|
|
||||||
taskComplete: 160,
|
|
||||||
area: 220,
|
|
||||||
rose: 200,
|
|
||||||
taskStatus: 190,
|
|
||||||
};
|
|
||||||
}, [compactLevel]);
|
|
||||||
|
|
||||||
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: chartHeights.taskTrend,
|
|
||||||
};
|
|
||||||
|
|
||||||
// 设备类型分布 - 模拟数据
|
|
||||||
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: chartHeights.pie,
|
|
||||||
};
|
|
||||||
|
|
||||||
const columnConfig: any = {
|
|
||||||
data: taskTypeData,
|
|
||||||
xField: 'type',
|
|
||||||
yField: 'value',
|
|
||||||
seriesField: 'type',
|
|
||||||
color: ({ type }: any) => {
|
|
||||||
if (type === '航线巡检') return '#00b4d8';
|
|
||||||
if (type === '定点监测') return '#00e5a0';
|
|
||||||
return '#ff9f43';
|
|
||||||
},
|
|
||||||
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: chartHeights.column,
|
|
||||||
};
|
|
||||||
|
|
||||||
const taskCompleteTrendConfig: any = {
|
|
||||||
data: taskCompleteTrendData,
|
|
||||||
xField: 'date',
|
|
||||||
yField: 'value',
|
|
||||||
smooth: true,
|
|
||||||
color: '#00e5a0',
|
|
||||||
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: chartHeights.taskComplete,
|
|
||||||
};
|
|
||||||
|
|
||||||
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: chartHeights.area,
|
|
||||||
};
|
|
||||||
|
|
||||||
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: chartHeights.rose,
|
|
||||||
};
|
|
||||||
|
|
||||||
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: chartHeights.taskStatus,
|
|
||||||
};
|
|
||||||
|
|
||||||
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(() => {
|
const taskNewLabel = useMemo(() => {
|
||||||
if (taskStatType === 'day') return '当日任务';
|
if (taskStatType === 'day') return '当日任务';
|
||||||
if (taskStatType === 'month') return '当月任务';
|
if (taskStatType === 'month') return '当月任务';
|
||||||
return '当年任务';
|
return '当年任务';
|
||||||
}, [taskStatType]);
|
}, [taskStatType]);
|
||||||
|
|
||||||
const datePickerFormat = useMemo(() => {
|
// 使用 CSS Grid 强制分配高度(类似智慧城市首页)
|
||||||
if (taskStatType === 'day') return 'YYYY-MM-DD';
|
const gap = 12;
|
||||||
if (taskStatType === 'month') return 'YYYY-MM';
|
|
||||||
return 'YYYY';
|
|
||||||
}, [taskStatType]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={`maritime-dashboard maritime-dashboard--compact-${compactLevel}`}>
|
<div style={{
|
||||||
|
width: '100%',
|
||||||
|
height: '100%',
|
||||||
|
background: 'var(--bg-primary)',
|
||||||
|
overflow: 'hidden',
|
||||||
|
padding: 12,
|
||||||
|
boxSizing: 'border-box',
|
||||||
|
}}>
|
||||||
|
{/* 保留海事背景装饰 */}
|
||||||
<div className="wave-bg-animation"></div>
|
<div className="wave-bg-animation"></div>
|
||||||
<div className="wave-layer"></div>
|
<div className="wave-layer"></div>
|
||||||
<div className="wave-layer-2"></div>
|
<div className="wave-layer-2"></div>
|
||||||
@@ -389,194 +156,104 @@ const MaritimeDashboard: React.FC = () => {
|
|||||||
<div className="maritime-bottom-frame" aria-hidden="true" />
|
<div className="maritime-bottom-frame" aria-hidden="true" />
|
||||||
|
|
||||||
<Spin spinning={loading} wrapperClassName="maritime-spin">
|
<Spin spinning={loading} wrapperClassName="maritime-spin">
|
||||||
<div className="maritime-content">
|
<div style={{
|
||||||
<div className="maritime-grid">
|
display: 'grid',
|
||||||
|
gridTemplateColumns: '25% 50% 25%',
|
||||||
{/* 左侧栏:设备态势 */}
|
gap: gap,
|
||||||
<div className="grid-col left-col">
|
height: 'calc(100vh - 80px - 24px)',
|
||||||
<Card title="设备类型分布" className="panel-card ocean-glass" size="small">
|
width: '100%',
|
||||||
<div className="chart-wrapper">
|
}}>
|
||||||
<Pie {...pieConfig} />
|
{/* 左侧栏 - CSS Grid 四个卡片分配,设备类型分布给更多空间 */}
|
||||||
</div>
|
<div style={{
|
||||||
</Card>
|
display: 'grid',
|
||||||
|
gridTemplateRows: '1.2fr 1fr 1.1fr 0.7fr',
|
||||||
<Card title="任务类型统计" className="panel-card ocean-glass" size="small">
|
gap: gap,
|
||||||
<div className="chart-wrapper">
|
height: '100%',
|
||||||
<Column {...columnConfig} />
|
minHeight: 0,
|
||||||
</div>
|
overflow: 'hidden',
|
||||||
</Card>
|
}}>
|
||||||
|
<div style={{ minHeight: 0, maxHeight: '100%', overflow: 'hidden' }}>
|
||||||
<Card title="近7日任务完成趋势" className="panel-card ocean-glass" size="small">
|
<DeviceTypeCard deviceStats={deviceStats} />
|
||||||
<div className="chart-wrapper">
|
|
||||||
<Area {...taskCompleteTrendConfig} />
|
|
||||||
</div>
|
|
||||||
</Card>
|
|
||||||
|
|
||||||
<Card
|
|
||||||
title={<span><WarningOutlined className="icon-warning" /> 实时告警</span>}
|
|
||||||
className="panel-card ocean-glass flex-grow"
|
|
||||||
size="small"
|
|
||||||
extra={<Tag color="#ff9f43">LIVE</Tag>}
|
|
||||||
>
|
|
||||||
<div className="alert-list-container">
|
|
||||||
<List
|
|
||||||
dataSource={alerts}
|
|
||||||
split={false}
|
|
||||||
renderItem={(item) => (
|
|
||||||
<List.Item className="alert-item">
|
|
||||||
<div className="alert-row">
|
|
||||||
<div className="alert-badge">
|
|
||||||
<Tag color={getAlertColor(item.level)}>{item.level.toUpperCase().slice(0, 1)}</Tag>
|
|
||||||
</div>
|
|
||||||
<div className="alert-content">
|
|
||||||
<div className="alert-head">
|
|
||||||
<span className="alert-name">{item.deviceName || item.taskName}</span>
|
|
||||||
<span className="alert-time">{dayjs(item.timestamp).format('HH:mm')}</span>
|
|
||||||
</div>
|
|
||||||
<div className="alert-msg">{item.message}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</List.Item>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</Card>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div style={{ minHeight: 0, maxHeight: '100%', overflow: 'hidden' }}>
|
||||||
|
<PortStatusCard
|
||||||
|
deviceStats={deviceStats}
|
||||||
|
taskStats={taskStats}
|
||||||
|
alerts={alerts}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div style={{ minHeight: 0, maxHeight: '100%', overflow: 'hidden' }}>
|
||||||
|
<MaritimeAlertCard alerts={alerts} />
|
||||||
|
</div>
|
||||||
|
<div style={{ minHeight: 0, maxHeight: '100%', overflow: 'hidden' }}>
|
||||||
|
<WeatherCard />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{/* 中间栏:核心监控 */}
|
{/* 中间栏 - KPI固定70px + 海域门户 + 年度趋势和任务类型左右并排 */}
|
||||||
<div className="grid-col center-col">
|
<div style={{
|
||||||
{/* 顶部KPI */}
|
display: 'grid',
|
||||||
<div className="kpi-row">
|
gridTemplateRows: '70px 1fr 1fr',
|
||||||
<div className="kpi-card">
|
gap: gap,
|
||||||
<div className="kpi-icon ship"><USVIcon /></div>
|
height: '100%',
|
||||||
<div className="kpi-info">
|
minHeight: 0,
|
||||||
<div className="label">设备总数</div>
|
overflow: 'hidden',
|
||||||
<div className="value">{deviceStats?.total || 0}</div>
|
}}>
|
||||||
</div>
|
<div style={{ minHeight: 0, maxHeight: '100%', overflow: 'hidden' }}>
|
||||||
</div>
|
<MaritimeKpiStrip
|
||||||
<div className="kpi-card">
|
deviceTotal={deviceStats?.total || 0}
|
||||||
<div className="kpi-icon anchor"><EnvironmentOutlined /></div>
|
seaAreaCount={deviceStats?.tourismCount || 0}
|
||||||
<div className="kpi-info">
|
todayNew={taskStats?.todayNew || 0}
|
||||||
<div className="label">海域总数</div>
|
successRate={taskStats?.successRate || 0}
|
||||||
<div className="value">{deviceStats?.tourismCount || 0}</div>
|
taskNewLabel={taskNewLabel}
|
||||||
</div>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="kpi-card">
|
<div style={{ minHeight: 0, maxHeight: '100%', overflow: 'hidden' }}>
|
||||||
<div className="kpi-icon alert"><RocketOutlined /></div>
|
<SeaAreaPortal />
|
||||||
<div className="kpi-info">
|
</div>
|
||||||
<div className="label">{taskNewLabel}</div>
|
{/* 年度趋势和任务类型左右并排 */}
|
||||||
<div className="value">{taskStats?.todayNew || 0}</div>
|
<div style={{
|
||||||
</div>
|
display: 'grid',
|
||||||
</div>
|
gridTemplateColumns: '1fr 1fr',
|
||||||
<div className="kpi-card">
|
gap: gap,
|
||||||
<div className="kpi-icon route"><PieChartOutlined /></div>
|
minHeight: 0,
|
||||||
<div className="kpi-info">
|
maxHeight: '100%',
|
||||||
<div className="label">执行成功率</div>
|
overflow: 'hidden',
|
||||||
<div className="value">{taskStats?.successRate || 0}<small>%</small></div>
|
}}>
|
||||||
</div>
|
<div style={{ minHeight: 0, maxHeight: '100%', overflow: 'hidden' }}>
|
||||||
</div>
|
<AnnualTrendChart annualData={annualData} />
|
||||||
</div>
|
</div>
|
||||||
|
<div style={{ minHeight: 0, maxHeight: '100%', overflow: 'hidden' }}>
|
||||||
{/* 海域监控入口 */}
|
<TaskTypeChart taskTypeData={taskTypeData} />
|
||||||
<div className="map-portal-wrapper">
|
|
||||||
<div className="nautical-grid"></div>
|
|
||||||
<div className="compass-sweep"></div>
|
|
||||||
<div className="map-content">
|
|
||||||
<div className="portal-center">
|
|
||||||
<CompassOutlined style={{ fontSize: 52, color: '#00b4d8', marginBottom: 16 }} />
|
|
||||||
<h2 className="portal-title">海域智慧巡检监控中心</h2>
|
|
||||||
<Button type="primary" shape="round" size="large" onClick={goTo3D} className="portal-btn">
|
|
||||||
进入海域监控视图
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* 年度巡检任务趋势 */}
|
|
||||||
<Card title="年度巡检任务趋势分析" className="panel-card ocean-glass fill-bottom" size="small">
|
|
||||||
<div className="chart-wrapper">
|
|
||||||
<Area {...areaConfig} />
|
|
||||||
</div>
|
|
||||||
</Card>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{/* 右侧栏:任务与运维 */}
|
{/* 右侧栏 - CSS Grid 各50% */}
|
||||||
<div className="grid-col right-col">
|
<div style={{
|
||||||
<Card
|
display: 'grid',
|
||||||
title={`${taskPeriodText}巡检任务`}
|
gridTemplateRows: '1fr 1fr',
|
||||||
className="panel-card ocean-glass"
|
gap: gap,
|
||||||
size="small"
|
height: '100%',
|
||||||
extra={
|
minHeight: 0,
|
||||||
<Space size={8} className="task-filter">
|
overflow: 'hidden',
|
||||||
<Segmented
|
}}>
|
||||||
size="small"
|
<div style={{ minHeight: 0, maxHeight: '100%', overflow: 'hidden' }}>
|
||||||
options={[
|
<TaskOverviewCard
|
||||||
{ label: '日', value: 'day' },
|
taskStats={taskStats}
|
||||||
{ label: '月', value: 'month' },
|
taskStatType={taskStatType}
|
||||||
{ label: '年', value: 'year' },
|
taskStatDate={taskStatDate}
|
||||||
]}
|
onStatTypeChange={setTaskStatType}
|
||||||
value={taskStatType}
|
onDateChange={setTaskStatDate}
|
||||||
onChange={(v) => setTaskStatType(v as any)}
|
/>
|
||||||
/>
|
</div>
|
||||||
<DatePicker
|
<div style={{ minHeight: 0, maxHeight: '100%', overflow: 'hidden' }}>
|
||||||
size="small"
|
<MaritimeInsightCard
|
||||||
value={taskStatDate}
|
taskStats={taskStats}
|
||||||
onChange={(v) => v && setTaskStatDate(v)}
|
taskTrend={taskTrend}
|
||||||
picker={taskStatType === 'day' ? 'date' : taskStatType}
|
violationAnalysisData={violationAnalysisData}
|
||||||
allowClear={false}
|
/>
|
||||||
format={datePickerFormat}
|
|
||||||
disabledDate={(d) => !!d && d.isAfter(dayjs(), 'day')}
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<div className="ship-status-grid">
|
|
||||||
<div className="ship-stat-box">
|
|
||||||
<div className="val sailing">{taskStats?.pending || 0}</div>
|
|
||||||
<div className="lbl">待执行</div>
|
|
||||||
</div>
|
|
||||||
<div className="ship-stat-box">
|
|
||||||
<div className="val anchored">{taskStats?.running || 0}</div>
|
|
||||||
<div className="lbl">执行中</div>
|
|
||||||
</div>
|
|
||||||
<div className="ship-stat-box">
|
|
||||||
<div className="val docked">{taskStats?.completed || 0}</div>
|
|
||||||
<div className="lbl">已完成</div>
|
|
||||||
</div>
|
|
||||||
<div className="ship-stat-box">
|
|
||||||
<div className="val warning">{taskStats?.failed || 0}</div>
|
|
||||||
<div className="lbl">已失败</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div style={{ marginTop: 16, textAlign: 'center' }}>
|
|
||||||
<div style={{ fontSize: '32px', fontWeight: 'bold', color: '#00e5a0' }}>
|
|
||||||
{taskStats?.successRate || 0}%
|
|
||||||
</div>
|
|
||||||
<div style={{ fontSize: '14px', color: '#e0f7ff', marginTop: 4 }}>
|
|
||||||
{taskPeriodText}成功率
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</Card>
|
|
||||||
|
|
||||||
<Card title="任务状态占比" className="panel-card ocean-glass" size="small">
|
|
||||||
<div className="chart-wrapper">
|
|
||||||
<Pie {...taskStatusPieConfig} />
|
|
||||||
</div>
|
|
||||||
</Card>
|
|
||||||
|
|
||||||
<Card title="近7日巡检趋势" className="panel-card ocean-glass" size="small">
|
|
||||||
<div className="chart-wrapper">
|
|
||||||
<Line {...taskTrendConfig} />
|
|
||||||
</div>
|
|
||||||
</Card>
|
|
||||||
|
|
||||||
<Card title="违规类型分析" className="panel-card ocean-glass flex-grow" size="small">
|
|
||||||
<div className="chart-wrapper">
|
|
||||||
<Rose {...roseConfig} />
|
|
||||||
</div>
|
|
||||||
</Card>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Spin>
|
</Spin>
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
test
|
|
||||||
Reference in New Issue
Block a user