Merge branch 'main' of https://git.jsspisoft.com/ry-das
This commit is contained in:
commit
684fa55eb6
@ -1,33 +0,0 @@
|
||||
package com.das.common.log;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.MDC;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
/**
|
||||
* @author chenhaojie
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
public class MdcExecutor implements Executor {
|
||||
|
||||
private final Executor executor;
|
||||
|
||||
public MdcExecutor(Executor executor) {
|
||||
this.executor = executor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(Runnable command) {
|
||||
final String requestId = MDC.get("REQUEST_ID");
|
||||
executor.execute(() -> {
|
||||
MDC.put("REQUEST_ID", requestId);
|
||||
try {
|
||||
command.run();
|
||||
} finally {
|
||||
MDC.remove("REQUEST_ID");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
package com.das.common.log;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author chenhaojie
|
||||
*
|
||||
*/
|
||||
public class RequestIdUtils {
|
||||
|
||||
private static final ThreadLocal<UUID> requestIdHolder = new ThreadLocal<>();
|
||||
|
||||
private RequestIdUtils() {
|
||||
}
|
||||
|
||||
public static void generateRequestId() {
|
||||
requestIdHolder.set(UUID.randomUUID());
|
||||
}
|
||||
|
||||
public static void generateRequestId(UUID uuid) {
|
||||
requestIdHolder.set(uuid);
|
||||
}
|
||||
|
||||
public static UUID getRequestId() {
|
||||
return requestIdHolder.get();
|
||||
}
|
||||
|
||||
public static void removeRequestId() {
|
||||
requestIdHolder.remove();
|
||||
}
|
||||
|
||||
}
|
@ -1,74 +0,0 @@
|
||||
package com.das.common.log;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author chenhaojie
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
public class RequestLogInterceptor implements HandlerInterceptor {
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
|
||||
String servletPath = request.getServletPath();
|
||||
|
||||
log.info("preHandle 后置处理----------");
|
||||
log.info("servletPath:{}", servletPath);
|
||||
RequestIdUtils.removeRequestId();
|
||||
MDC.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取RequestId
|
||||
* 优先从header头获取,如果没有则自己生成
|
||||
* @return RequestId
|
||||
*/
|
||||
private String getRequestId(){
|
||||
// 因为如果有网关,则一般会从网关传递过来,所以优先从header头获取
|
||||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
if(attributes != null && StringUtils.hasText(attributes.getRequest().getHeader("x-request-id"))) {
|
||||
HttpServletRequest request = attributes.getRequest();
|
||||
String requestId = request.getHeader("x-request-id");
|
||||
UUID uuid = UUID.fromString(requestId);
|
||||
RequestIdUtils.generateRequestId(uuid);
|
||||
return requestId;
|
||||
}
|
||||
UUID existUUID = RequestIdUtils.getRequestId();
|
||||
if(existUUID != null){
|
||||
return existUUID.toString();
|
||||
}
|
||||
RequestIdUtils.generateRequestId();
|
||||
return RequestIdUtils.getRequestId().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
|
||||
String servletPath = request.getServletPath();
|
||||
// 生成RequestId
|
||||
String requestId = this.getRequestId();
|
||||
// 配置日志文件打印 REQUEST_ID
|
||||
MDC.put("REQUEST_ID", requestId);
|
||||
|
||||
log.info("servletPath:{}", servletPath);
|
||||
log.info("preHandle 前置处理----------");
|
||||
return true;
|
||||
}
|
||||
}
|
@ -45,7 +45,8 @@ public class IotModelCacheImpl implements IotModelCache {
|
||||
|
||||
@PreDestroy
|
||||
public void destroy(){
|
||||
|
||||
iotFieldsMap.clear();
|
||||
iotModelInfoIdMap.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,7 +26,7 @@ public class CalcModule {
|
||||
private Date updateTime;
|
||||
private String cron;
|
||||
|
||||
public static final CalcModule of(String content){
|
||||
public static CalcModule of(String content){
|
||||
CalcModule calcModule = new CalcModule();
|
||||
calcModule.setScript(content);
|
||||
try(BufferedReader reader = new BufferedReader(new StringReader(content))){
|
||||
|
@ -23,12 +23,10 @@ import java.util.Map;
|
||||
@Slf4j
|
||||
public class FunctionWindSpeedFactor extends AbstractFunction {
|
||||
|
||||
private DataService dataService = null;
|
||||
private CacheService cacheService = null;
|
||||
|
||||
|
||||
public FunctionWindSpeedFactor(DataService dataService, CacheService cacheService) {
|
||||
this.dataService = dataService;
|
||||
public FunctionWindSpeedFactor(CacheService cacheService) {
|
||||
this.cacheService = cacheService;
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ public class CalcService {
|
||||
FunctionOffsetDate offsetDate = new FunctionOffsetDate();
|
||||
aviator.addFunction(offsetDate);
|
||||
|
||||
FunctionWindSpeedFactor windSpeedFactor = new FunctionWindSpeedFactor(dataService,cacheService);
|
||||
FunctionWindSpeedFactor windSpeedFactor = new FunctionWindSpeedFactor(cacheService);
|
||||
aviator.addFunction(windSpeedFactor);
|
||||
|
||||
FunctionIsOnline isOnline = new FunctionIsOnline(adminRedisTemplate, cacheService);
|
||||
|
@ -37,7 +37,8 @@ public class DataController {
|
||||
@PostMapping("/snapshot")
|
||||
public R<Map<String,Map<String,Object>>> querySnapshotValues(@RequestBody @Valid List<SnapshotValueQueryParam> param) {
|
||||
if (log.isDebugEnabled()){
|
||||
log.debug("/api/rtdbsvr/snapshot is calling");
|
||||
log.debug("/api/data/snapshot is calling");
|
||||
log.debug("request params: {}", param);
|
||||
}
|
||||
return R.success(dataService.querySnapshotValues(param));
|
||||
}
|
||||
@ -50,7 +51,8 @@ public class DataController {
|
||||
@PostMapping("/history")
|
||||
public R<Map<String, Map<String, Map<String, Object>>>> queryTimeSeriesValues(@RequestBody @Valid TSValueQueryParam param) {
|
||||
if (log.isDebugEnabled()){
|
||||
log.debug("/api/rtdbsvr/timeseries is calling");
|
||||
log.debug("/api/data/history is calling");
|
||||
log.debug("request params: {}", param);
|
||||
}
|
||||
return R.success(dataService.queryTimeSeriesValues(param));
|
||||
}
|
||||
@ -63,7 +65,8 @@ public class DataController {
|
||||
@PostMapping("/windows")
|
||||
public R<Map<String, Map<String, Map<String, Object>>>> queryWindowsValues(@RequestBody @Valid WindowValueQueryParam param) {
|
||||
if (log.isDebugEnabled()){
|
||||
log.debug("/api/rtdbsvr/timeseries is calling");
|
||||
log.debug("/api/data/windows is calling");
|
||||
log.debug("request params: {}", param);
|
||||
}
|
||||
return R.success(dataService.queryWindowsValues(param));
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ public class TDEngineService {
|
||||
log.info(sb.toString());
|
||||
pstmt.executeUpdate(sb.toString());
|
||||
} catch (Exception e) {
|
||||
log.error("创建超级表失败,失败原因{}", e);
|
||||
log.error("创建超级表失败", e);
|
||||
}
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
@ -114,7 +114,7 @@ public class TDEngineService {
|
||||
log.info(sb.toString());
|
||||
pstmt.executeUpdate(sb.toString());
|
||||
} catch (Exception e) {
|
||||
log.error("创建超级表失败,失败原因{}", e);
|
||||
log.error("创建[计算量]超级表失败", e);
|
||||
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
@ -141,7 +141,7 @@ public class TDEngineService {
|
||||
try {
|
||||
pstmt.executeUpdate(sb.toString());
|
||||
} catch (Exception e) {
|
||||
log.error("新增超级表列失败:{},失败原因{}", sb, e);
|
||||
log.error(String.format("新增超级表列失败:%s", sb.toString()), e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -167,7 +167,7 @@ public class TDEngineService {
|
||||
try {
|
||||
pstmt.executeUpdate(sb.toString());
|
||||
} catch (Exception e) {
|
||||
log.error("删除超级表列失败:{},失败原因{}", sb, e);
|
||||
log.error(String.format("删除超级表列失败:%s", sb.toString()), e);
|
||||
}
|
||||
|
||||
} catch (Exception ignored) {
|
||||
@ -189,7 +189,7 @@ public class TDEngineService {
|
||||
try {
|
||||
pstmt.executeUpdate(sb.toString());
|
||||
} catch (Exception e) {
|
||||
log.error("删除超级表失败:{},失败原因{}", sb, e);
|
||||
log.error(String.format("删除超级表失败:%s", sb.toString()), e);
|
||||
}
|
||||
|
||||
} catch (Exception ignored) {
|
||||
@ -963,7 +963,7 @@ public class TDEngineService {
|
||||
Statement pstmt = conn.createStatement()) {
|
||||
pstmt.executeUpdate(sb.toString());
|
||||
} catch (Exception e) {
|
||||
log.error("新增超级表列失败:{},失败原因{}", sb, e);
|
||||
log.error(String.format("新增超级表列失败:%s", sb.toString()), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ public class DataServiceImpl implements DataService {
|
||||
}
|
||||
});
|
||||
long end = System.currentTimeMillis();
|
||||
log.debug("读取快照{}个,耗时: {}秒", paramList.size(), (end - start) / 1000.0);
|
||||
log.debug("querySnapshotValues {}个,耗时: {}秒", paramList.size(), (end - start) / 1000.0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -149,7 +149,7 @@ public class DataServiceImpl implements DataService {
|
||||
result.putAll(values);
|
||||
}
|
||||
Long end = System.currentTimeMillis();
|
||||
log.debug("读取快照{}个,耗时: {}秒", param.getDevices().size(), (end-start)/ 1000.0);
|
||||
log.debug("queryTimeSeriesValues {}个,耗时: {}秒", param.getDevices().size(), (end-start)/ 1000.0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -178,7 +178,7 @@ public class DataServiceImpl implements DataService {
|
||||
result.putAll(values);
|
||||
}
|
||||
Long end = System.currentTimeMillis();
|
||||
log.debug("读取快照{}个,耗时: {}秒", param.getDevices().size(), (end-start)/ 1000.0);
|
||||
log.debug("queryTimeSeriesValues {}个,耗时: {}秒", param.getDevices().size(), (end-start)/ 1000.0);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -7,8 +7,11 @@ import com.das.common.exceptions.ServiceException;
|
||||
import com.das.common.result.R;
|
||||
import com.das.common.utils.PageDataInfo;
|
||||
import com.das.modules.equipment.domain.dto.SysEquipmentDto;
|
||||
import com.das.modules.equipment.domain.dto.SysGenExtPropsDto;
|
||||
import com.das.modules.equipment.domain.vo.EquipmentTypeVo;
|
||||
import com.das.modules.equipment.domain.vo.SysEquipmentVo;
|
||||
import com.das.modules.equipment.entity.SysEquipmentDocs;
|
||||
import com.das.modules.equipment.entity.SysGenExtProps;
|
||||
import com.das.modules.equipment.service.SysEquipmentService;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
@ -138,4 +141,63 @@ public class EquipmentController {
|
||||
sysEquipmentService.importSysEquipment(id, file);
|
||||
return R.success("导入成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备附属属性
|
||||
* @return 所有附属属性
|
||||
*/
|
||||
@PostMapping("/extProps/add")
|
||||
public R<SysGenExtProps> addSysEquipmentExtProps(@RequestBody SysGenExtPropsDto sysGenExtPropsDto) {
|
||||
//判断是否有权限
|
||||
boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_DEVICE_MGR.toString());
|
||||
if(!hasPermission){
|
||||
return R.fail("没有设备管理权限");
|
||||
}
|
||||
return R.success(sysEquipmentService.creatSysEquipmentExtProps(sysGenExtPropsDto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新设备附属属性
|
||||
* @return 所有附属属性
|
||||
*/
|
||||
@PostMapping("/extProps/update")
|
||||
public R<SysGenExtProps> updateSysEquipmentExtProps(@RequestBody SysGenExtPropsDto sysGenExtPropsDto) {
|
||||
//判断是否有权限
|
||||
boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_DEVICE_MGR.toString());
|
||||
if(!hasPermission){
|
||||
return R.fail("没有设备管理权限");
|
||||
}
|
||||
return R.success(sysEquipmentService.updateSysEquipmentExtProps(sysGenExtPropsDto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新设备附属属性
|
||||
* @return 所有附属属性
|
||||
*/
|
||||
@PostMapping("/extProps/query")
|
||||
public R<SysGenExtProps> querySysEquipmentExtProps(@RequestBody SysGenExtPropsDto sysGenExtPropsDto) {
|
||||
//判断是否有权限
|
||||
boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_DEVICE_MGR.toString());
|
||||
if(!hasPermission){
|
||||
return R.fail("没有设备管理权限");
|
||||
}
|
||||
return R.success(sysEquipmentService.querySysEquipmentExtProps(sysGenExtPropsDto.getId()));
|
||||
}
|
||||
|
||||
@PostMapping("/extProps/delete")
|
||||
public R<SysGenExtProps> deleteSysEquipmentExtProps(@RequestBody SysGenExtPropsDto sysGenExtPropsDto) {
|
||||
//判断是否有权限
|
||||
boolean hasPermission = StpUtil.hasPermission(SysAuthorityIds.SYS_AUTHORITY_ID_DEVICE_MGR.toString());
|
||||
if(!hasPermission){
|
||||
return R.fail("没有设备管理权限");
|
||||
}
|
||||
sysEquipmentService.deleteSysEquipmentExtProps(sysGenExtPropsDto.getId());
|
||||
return R.success();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/file/upload", method = RequestMethod.POST)
|
||||
public R<SysEquipmentDocs> addFile(Long deviceId, String folderName, MultipartFile file) {
|
||||
SysEquipmentDocs upload = sysEquipmentService.upload(deviceId, folderName, file);
|
||||
return R.success(upload);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,106 @@
|
||||
package com.das.modules.equipment.domain.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SysGenExtPropsDto {
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
private String fanName;
|
||||
|
||||
private String fanNumber;
|
||||
|
||||
private String fanType;
|
||||
|
||||
private String fanTypeDetails;
|
||||
|
||||
private String pitchSystemModel;
|
||||
|
||||
private String pitchSystemManufacturer;
|
||||
|
||||
private String pitchSystemDetails;
|
||||
|
||||
private String blade1Model;
|
||||
|
||||
private String blade1Manufacturer;
|
||||
|
||||
private String blade1Details;
|
||||
|
||||
private String blade1BearingModel;
|
||||
|
||||
private String blade1BearingManufacturer;
|
||||
|
||||
private String blade1BearingDetails;
|
||||
|
||||
private String blade2Model;
|
||||
|
||||
private String blade2Manufacturer;
|
||||
|
||||
private String blade2Details;
|
||||
|
||||
private String blade2BearingModel;
|
||||
|
||||
private String blade2BearingManufacturer;
|
||||
|
||||
private String blade2BearingDetails;
|
||||
|
||||
private String blade3Model;
|
||||
|
||||
private String blade3Manufacturer;
|
||||
|
||||
private String blade3Details;
|
||||
|
||||
private String blade3BearingModel;
|
||||
|
||||
private String blade3BearingManufacturer;
|
||||
|
||||
private String blade3BearingDetails;
|
||||
|
||||
private String mainBearingModel;
|
||||
|
||||
private String mainBearingManufacturer;
|
||||
|
||||
private String mainBearingDetails;
|
||||
|
||||
private String gearboxModel;
|
||||
|
||||
private String gearboxManufacturer;
|
||||
|
||||
private String gearboxDetails;
|
||||
|
||||
private String generatorModel;
|
||||
|
||||
private String generatorManufacturer;
|
||||
|
||||
private String generatorDetails;
|
||||
|
||||
private String converterModel;
|
||||
|
||||
private String converterManufacturer;
|
||||
|
||||
private String converterDetails;
|
||||
|
||||
private String mainControlSystemModel;
|
||||
|
||||
private String mainControlSystemManufacturer;
|
||||
|
||||
private String mainControlSystemSoftwareVersion;
|
||||
|
||||
private String mainControlSystemSoftwareVersionDetails;
|
||||
|
||||
private String towerBaseCabinetDetails;
|
||||
|
||||
private String nacelleCabinetDetails;
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package com.das.modules.equipment.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@TableName("sys_equipment_docs")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SysEquipmentDocs {
|
||||
|
||||
@TableId(value = "deviceid")
|
||||
private Long deviceId;
|
||||
|
||||
@TableField(value = "name")
|
||||
private String name;
|
||||
|
||||
@TableField(value = "url")
|
||||
private String url;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@TableField("update_time")
|
||||
private Date updateTime;
|
||||
|
||||
}
|
@ -0,0 +1,162 @@
|
||||
package com.das.modules.equipment.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@TableName("sys_gen_extprops")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SysGenExtProps {
|
||||
|
||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
@TableField(value = "fan_name")
|
||||
private String fanName;
|
||||
|
||||
@TableField(value = "fan_Number")
|
||||
private String fanNumber;
|
||||
|
||||
@TableField(value = "fan_type")
|
||||
private String fanType;
|
||||
|
||||
@TableField(value = "fan_type_details")
|
||||
private String fanTypeDetails;
|
||||
|
||||
// Pitch System
|
||||
@TableField(value = "pitch_system_model")
|
||||
private String pitchSystemModel;
|
||||
|
||||
@TableField(value = "pitch_system_manufacturer")
|
||||
private String pitchSystemManufacturer;
|
||||
|
||||
@TableField(value = "pitch_system_details")
|
||||
private String pitchSystemDetails;
|
||||
|
||||
// Blade 1
|
||||
@TableField(value = "blade1_model")
|
||||
private String blade1Model;
|
||||
|
||||
@TableField(value = "blade1_manufacturer")
|
||||
private String blade1Manufacturer;
|
||||
|
||||
@TableField(value = "blade1_details")
|
||||
private String blade1Details;
|
||||
|
||||
@TableField(value = "blade1_bearing_model")
|
||||
private String blade1BearingModel;
|
||||
|
||||
@TableField(value = "blade1_bearing_manufacturer")
|
||||
private String blade1BearingManufacturer;
|
||||
|
||||
@TableField(value = "blade1_bearing_details")
|
||||
private String blade1BearingDetails;
|
||||
|
||||
// Blade 2
|
||||
@TableField(value = "blade2_model")
|
||||
private String blade2Model;
|
||||
|
||||
@TableField(value = "blade2_manufacturer")
|
||||
private String blade2Manufacturer;
|
||||
|
||||
@TableField(value = "blade2_details")
|
||||
private String blade2Details;
|
||||
|
||||
@TableField(value = "blade2_bearing_model")
|
||||
private String blade2BearingModel;
|
||||
|
||||
@TableField(value = "blade2_bearing_manufacturer")
|
||||
private String blade2BearingManufacturer;
|
||||
|
||||
@TableField(value = "blade2_bearing_details")
|
||||
private String blade2BearingDetails;
|
||||
|
||||
// Blade 3
|
||||
@TableField(value = "blade3_model")
|
||||
private String blade3Model;
|
||||
|
||||
@TableField(value = "blade3_manufacturer")
|
||||
private String blade3Manufacturer;
|
||||
|
||||
@TableField(value = "blade3_details")
|
||||
private String blade3Details;
|
||||
|
||||
@TableField(value = "blade3_bearing_model")
|
||||
private String blade3BearingModel;
|
||||
|
||||
@TableField(value = "blade3_bearing_manufacturer")
|
||||
private String blade3BearingManufacturer;
|
||||
|
||||
@TableField(value = "blade3_bearing_details")
|
||||
private String blade3BearingDetails;
|
||||
|
||||
// Main Bearing
|
||||
@TableField(value = "main_bearing_model")
|
||||
private String mainBearingModel;
|
||||
|
||||
@TableField(value = "main_bearing_manufacturer")
|
||||
private String mainBearingManufacturer;
|
||||
|
||||
@TableField(value = "main_bearing_details")
|
||||
private String mainBearingDetails;
|
||||
|
||||
// Gearbox
|
||||
@TableField(value = "gearbox_model")
|
||||
private String gearboxModel;
|
||||
|
||||
@TableField(value = "gearbox_manufacturer")
|
||||
private String gearboxManufacturer;
|
||||
|
||||
@TableField(value = "gearbox_details")
|
||||
private String gearboxDetails;
|
||||
|
||||
// Generator
|
||||
@TableField(value = "generator_model")
|
||||
private String generatorModel;
|
||||
|
||||
@TableField(value = "generator_manufacturer")
|
||||
private String generatorManufacturer;
|
||||
|
||||
@TableField(value = "generator_details")
|
||||
private String generatorDetails;
|
||||
|
||||
// Converter
|
||||
@TableField(value = "converter_model")
|
||||
private String converterModel;
|
||||
|
||||
@TableField(value = "converter_manufacturer")
|
||||
private String converterManufacturer;
|
||||
|
||||
@TableField(value = "converter_details")
|
||||
private String converterDetails;
|
||||
|
||||
// Main Control System
|
||||
@TableField(value = "main_control_system_model")
|
||||
private String mainControlSystemModel;
|
||||
|
||||
@TableField(value = "main_control_system_manufacturer")
|
||||
private String mainControlSystemManufacturer;
|
||||
|
||||
@TableField(value = "main_control_system_software_version")
|
||||
private String mainControlSystemSoftwareVersion;
|
||||
|
||||
@TableField(value = "main_control_system_software_version_details")
|
||||
private String mainControlSystemSoftwareVersionDetails;
|
||||
|
||||
// Cabinet Details
|
||||
|
||||
@TableField(value = "tower_base_cabinet_details")
|
||||
private String towerBaseCabinetDetails;
|
||||
|
||||
@TableField(value = "nacelle_cabinet_details")
|
||||
private String nacelleCabinetDetails;
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.das.modules.equipment.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.das.modules.equipment.entity.SysEquipmentDocs;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface SysEquipmentDocsMapper extends BaseMapper<SysEquipmentDocs> {
|
||||
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.das.modules.equipment.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.das.modules.equipment.entity.SysGenExtProps;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface SysGenExtPropsMapper extends BaseMapper<SysGenExtProps> {
|
||||
|
||||
}
|
@ -2,7 +2,10 @@ package com.das.modules.equipment.service;
|
||||
|
||||
import com.das.common.utils.PageDataInfo;
|
||||
import com.das.modules.equipment.domain.dto.SysEquipmentDto;
|
||||
import com.das.modules.equipment.domain.dto.SysGenExtPropsDto;
|
||||
import com.das.modules.equipment.domain.vo.SysEquipmentVo;
|
||||
import com.das.modules.equipment.entity.SysEquipmentDocs;
|
||||
import com.das.modules.equipment.entity.SysGenExtProps;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@ -28,4 +31,13 @@ public interface SysEquipmentService {
|
||||
|
||||
void importSysEquipment(String parentEquipmentId,MultipartFile file) throws IOException, ParseException;
|
||||
|
||||
SysGenExtProps creatSysEquipmentExtProps(SysGenExtPropsDto sysGenExtPropsDto);
|
||||
|
||||
SysGenExtProps updateSysEquipmentExtProps(SysGenExtPropsDto sysGenExtPropsDto);
|
||||
|
||||
void deleteSysEquipmentExtProps(Long id);
|
||||
|
||||
SysGenExtProps querySysEquipmentExtProps(Long id);
|
||||
|
||||
SysEquipmentDocs upload(Long deviceId, String folderName, MultipartFile file);
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.das.common.config.SessionUtil;
|
||||
import com.das.common.constant.EquipmentTypeIds;
|
||||
import com.das.common.constant.FileConstants;
|
||||
import com.das.common.exceptions.ServiceException;
|
||||
import com.das.common.utils.BeanCopyUtils;
|
||||
import com.das.common.utils.PageDataInfo;
|
||||
@ -17,16 +18,26 @@ import com.das.common.utils.PageQuery;
|
||||
import com.das.common.utils.SequenceUtils;
|
||||
import com.das.modules.auth.domain.vo.SysUserVo;
|
||||
import com.das.modules.auth.mapper.SysOrgMapper;
|
||||
import com.das.modules.cache.domain.DeviceInfoCache;
|
||||
import com.das.modules.cache.service.CacheService;
|
||||
import com.das.modules.cache.service.EquipmentCache;
|
||||
import com.das.modules.data.service.TDEngineService;
|
||||
import com.das.modules.data.service.impl.DataServiceImpl;
|
||||
import com.das.modules.equipment.domain.dto.SysEquipmentDto;
|
||||
import com.das.modules.equipment.domain.dto.SysGenExtPropsDto;
|
||||
import com.das.modules.equipment.domain.excel.SysEquipmentExcel;
|
||||
import com.das.modules.equipment.domain.vo.SysEquipmentVo;
|
||||
import com.das.modules.equipment.entity.SysEquipment;
|
||||
import com.das.modules.equipment.entity.SysEquipmentDocs;
|
||||
import com.das.modules.equipment.entity.SysGenExtProps;
|
||||
import com.das.modules.equipment.mapper.SysEquipmentDocsMapper;
|
||||
import com.das.modules.equipment.mapper.SysEquipmentMapper;
|
||||
import com.das.modules.equipment.mapper.SysGenExtPropsMapper;
|
||||
import com.das.modules.equipment.mapper.SysIotModelMapper;
|
||||
import com.das.modules.equipment.service.SysEquipmentService;
|
||||
import com.das.modules.fdr.config.MinioProperties;
|
||||
import com.das.modules.fdr.service.MinioViewsServcie;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.ServletOutputStream;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
@ -73,6 +84,21 @@ public class SysEquipmentServiceImpl implements SysEquipmentService {
|
||||
@Autowired
|
||||
private TDEngineService tdEngineService;
|
||||
|
||||
@Autowired
|
||||
private SysGenExtPropsMapper sysGenExtPropsMapper;
|
||||
|
||||
@Autowired
|
||||
private MinioViewsServcie minioViewsServcie;
|
||||
|
||||
@Resource
|
||||
private MinioProperties minioAutoProperties;
|
||||
|
||||
@Autowired
|
||||
private EquipmentCache equipmentCache;
|
||||
|
||||
@Autowired
|
||||
private SysEquipmentDocsMapper sysEquipmentDocsMapper;
|
||||
|
||||
@Override
|
||||
public SysEquipmentVo creatSysEquipment(SysEquipmentDto sysEquipmentDto) {
|
||||
//去除空格
|
||||
@ -358,4 +384,56 @@ public class SysEquipmentServiceImpl implements SysEquipmentService {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysGenExtProps creatSysEquipmentExtProps(SysGenExtPropsDto sysGenExtPropsDto) {
|
||||
if (sysGenExtPropsDto.getId() == null){
|
||||
throw new ServiceException("设备id不能为空");
|
||||
}
|
||||
SysGenExtProps sysEquipmentExtProps = new SysGenExtProps();
|
||||
BeanCopyUtils.copy(sysGenExtPropsDto, sysEquipmentExtProps);
|
||||
sysGenExtPropsMapper.insert(sysEquipmentExtProps);
|
||||
return sysEquipmentExtProps;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysGenExtProps updateSysEquipmentExtProps(SysGenExtPropsDto sysGenExtPropsDto) {
|
||||
if (sysGenExtPropsDto.getId() == null){
|
||||
throw new ServiceException("设备id不能为空");
|
||||
}
|
||||
SysGenExtProps sysEquipmentExtProps = new SysGenExtProps();
|
||||
BeanCopyUtils.copy(sysGenExtPropsDto, sysEquipmentExtProps);
|
||||
sysGenExtPropsMapper.updateById(sysEquipmentExtProps);
|
||||
return sysEquipmentExtProps;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSysEquipmentExtProps(Long id) {
|
||||
sysGenExtPropsMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysGenExtProps querySysEquipmentExtProps(Long id) {
|
||||
return sysGenExtPropsMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysEquipmentDocs upload(Long deviceId, String folderName, MultipartFile file) {
|
||||
DeviceInfoCache deviceInfoCache = equipmentCache.getDeviceInfoCacheById(deviceId);
|
||||
String parent = FileConstants.FILE_SEPARATOR +"风机图片"+ FileConstants.FILE_SEPARATOR + deviceInfoCache.getDeviceCode();
|
||||
String url = minioViewsServcie.upload(minioAutoProperties.getPublicBucket(), parent, folderName, file);
|
||||
String fileName = url.substring(url.lastIndexOf("/"));
|
||||
SysEquipmentDocs sysEquipmentDocs = new SysEquipmentDocs();
|
||||
sysEquipmentDocs.setDeviceId(deviceId);
|
||||
sysEquipmentDocs.setName(fileName);
|
||||
sysEquipmentDocs.setUrl(url);
|
||||
sysEquipmentDocs.setUpdateTime(new Date());
|
||||
SysEquipmentDocs sysEquipmentDocsInfo = sysEquipmentDocsMapper.selectById(deviceId);
|
||||
if (sysEquipmentDocsInfo == null){
|
||||
sysEquipmentDocsMapper.insert(sysEquipmentDocs);
|
||||
}else {
|
||||
sysEquipmentDocsMapper.updateById(sysEquipmentDocs);
|
||||
}
|
||||
return sysEquipmentDocs;
|
||||
}
|
||||
}
|
||||
|
@ -150,9 +150,7 @@ public class SysIotModelServiceImpl implements SysIotModelService {
|
||||
PageQuery pageQuery = new PageQuery();
|
||||
pageQuery.setPageNum(sysIotModelFieldDto.getPageNum());
|
||||
pageQuery.setPageSize(sysIotModelFieldDto.getPageSize());
|
||||
log.info("查询物模型属性参数:{}",sysIotModelFieldDto);
|
||||
IPage<SysIotModelFieldVo> iPage = sysIotModelFieldMapper.querySysIotModelFieldList(pageQuery.build(), sysIotModelFieldDto);
|
||||
log.info("查询物模型属性返回总数{},:{}",iPage.getTotal(),iPage.getRecords());
|
||||
return PageDataInfo.build(iPage.getRecords(), iPage.getTotal());
|
||||
}
|
||||
|
||||
|
@ -42,6 +42,14 @@ public class MinioConfig {
|
||||
createBucket(bucketName, minioClient);
|
||||
}
|
||||
}
|
||||
String publicBucket = minioAutoProperties.getPublicBucket();
|
||||
if (!checkBucket(publicBucket, minioClient)) {
|
||||
log.info("文件public桶[{}]不存在, 开始检查是否可以新建桶", publicBucket);
|
||||
if (minioAutoProperties.isCreateBucket()) {
|
||||
log.info("createBucket为{},开始新建public文件桶", minioAutoProperties.isCreateBucket());
|
||||
createBucket(publicBucket, minioClient);
|
||||
}
|
||||
}
|
||||
log.info("文件桶[{}]已存在, minio客户端连接成功!", bucketName);
|
||||
} else {
|
||||
throw new RuntimeException("桶不存在, 请检查桶名称是否正确或者将checkBucket属性改为false");
|
||||
|
@ -40,6 +40,9 @@ public class MinioProperties {
|
||||
@Value("${minio.bucket}")
|
||||
private String bucket;
|
||||
|
||||
@Value("${minio.publicBucket}")
|
||||
private String publicBucket;
|
||||
|
||||
/**
|
||||
* 桶不在的时候是否新建桶
|
||||
*/
|
||||
|
@ -78,7 +78,7 @@ public class MinioViewsServcie {
|
||||
}
|
||||
|
||||
|
||||
public String upload(String path, String folderName,MultipartFile file) {
|
||||
public String upload(String bucketName, String path, String folderName,MultipartFile file) {
|
||||
String targetFile = null;
|
||||
try {
|
||||
// 上传一个空对象来模拟文件夹
|
||||
@ -87,14 +87,14 @@ public class MinioViewsServcie {
|
||||
ByteArrayInputStream bais = new ByteArrayInputStream(new byte[0]);
|
||||
minioClient.putObject(
|
||||
PutObjectArgs.builder()
|
||||
.bucket(minioProperties.getBucket())
|
||||
.bucket(bucketName)
|
||||
.object(targetFile)
|
||||
.stream(bais, 0, -1)
|
||||
.build());
|
||||
}
|
||||
else {
|
||||
targetFile= path +"/" + file.getOriginalFilename();
|
||||
uploadFile(minioProperties.getBucket(), file, targetFile, "application/octet-stream");
|
||||
uploadFile(bucketName, file, targetFile, "application/octet-stream");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
@ -123,7 +123,7 @@ public class MinioViewsServcie {
|
||||
.stream(inputStream, inputStream.available(), -1)
|
||||
.build());
|
||||
}catch (Exception e){
|
||||
log.error("minio文件上传失败{}", e);
|
||||
log.error("minio文件上传失败", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import com.das.modules.curve.mapper.TheoreticalPowerCurveMapper;
|
||||
import com.das.modules.equipment.domain.excel.SheetInfoBean;
|
||||
import com.das.modules.equipment.entity.SysEquipment;
|
||||
import com.das.modules.equipment.mapper.SysEquipmentMapper;
|
||||
import com.das.modules.fdr.config.MinioProperties;
|
||||
import com.das.modules.fdr.domain.FileNode;
|
||||
import com.das.modules.fdr.domain.SysFaultCodeDict;
|
||||
import com.das.modules.fdr.domain.SysFaultRecordingDesc;
|
||||
@ -26,6 +27,7 @@ import com.das.modules.fdr.service.FaultRecorderService;
|
||||
import com.das.modules.fdr.service.MinioViewsServcie;
|
||||
import io.micrometer.common.util.StringUtils;
|
||||
import io.minio.MinioClient;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -52,6 +54,9 @@ public class FaultRecorderServiceImpl implements FaultRecorderService {
|
||||
@Autowired
|
||||
MinioClient minioClient;
|
||||
|
||||
@Resource
|
||||
private MinioProperties minioAutoProperties;
|
||||
|
||||
@Autowired
|
||||
private SysEquipmentMapper sysEquipmentMapper;
|
||||
|
||||
@ -82,7 +87,7 @@ public class FaultRecorderServiceImpl implements FaultRecorderService {
|
||||
|
||||
@Override
|
||||
public String upload(String parent, String folderName, MultipartFile file) {
|
||||
return minioViewsServcie.upload(parent, folderName, file);
|
||||
return minioViewsServcie.upload(minioAutoProperties.getBucket(), parent, folderName, file);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -194,7 +199,7 @@ public class FaultRecorderServiceImpl implements FaultRecorderService {
|
||||
resultMap = parseFile(fileStream, fdrFormatVo.getTimeFormat(), fdrFormatVo.getDelimiter(), fdrFormatVo.getValidStartLine());
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("文件解析异常:{}",e);
|
||||
log.error("文件解析异常",e);
|
||||
throw new ServiceException("文件解析异常,请检查配置");
|
||||
}
|
||||
return resultMap;
|
||||
@ -238,7 +243,7 @@ public class FaultRecorderServiceImpl implements FaultRecorderService {
|
||||
}
|
||||
stringListMap = parseDataCurve(result, timeFormat);
|
||||
} catch (Exception e) {
|
||||
log.error("文件解析失败{}", e);
|
||||
log.error("文件解析失败", e);
|
||||
throw new ServiceException("文件解析失败");
|
||||
}
|
||||
return stringListMap;
|
||||
|
@ -407,7 +407,7 @@ public class NodeMessageServiceImpl extends TextWebSocketHandler implements Node
|
||||
try {
|
||||
tdEngineService.updateDeviceEventValues(valueList);
|
||||
} catch (Exception e) {
|
||||
log.error("事件信息存入Td失败,失败原因{}", e);
|
||||
log.error("事件信息存入Td失败,失败原因", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -551,7 +551,7 @@ public class SysNodeServiceImpl implements SysNodeService {
|
||||
})
|
||||
.anyMatch(order -> !orderSet.add(order));
|
||||
}catch (Exception e){
|
||||
log.error("校验order不重复失败:{}",e);
|
||||
log.error("校验order不重复失败",e);
|
||||
}
|
||||
return orderRepeated;
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ public class PlcLogsServiceImpl implements PlcLogService {
|
||||
resultMap = parseFile(fileStream, fdrFormatVo.getTimeFormat(), fdrFormatVo.getDelimiter(), fdrFormatVo.getValidStartLine());
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("文件解析异常:{}",e);
|
||||
log.error("文件解析异常",e);
|
||||
throw new ServiceException("文件解析异常,请检查配置");
|
||||
}
|
||||
return resultMap;
|
||||
@ -162,7 +162,7 @@ public class PlcLogsServiceImpl implements PlcLogService {
|
||||
}
|
||||
stringListMap = parseDataCurve(result, timeFormat);
|
||||
} catch (Exception e) {
|
||||
log.error("文件解析失败{}", e);
|
||||
log.error("文件解析失败", e);
|
||||
throw new ServiceException("文件解析失败");
|
||||
}
|
||||
return stringListMap;
|
||||
|
@ -109,5 +109,6 @@ tdengine:
|
||||
minio:
|
||||
url: http://192.168.109.187:9000
|
||||
bucket: das
|
||||
publicBucket: das-public
|
||||
accessKey: das
|
||||
secretKey: zaq12WSX
|
@ -1,6 +1,7 @@
|
||||
export default {
|
||||
select: '请选择',
|
||||
selectDate: '选择日期时间',
|
||||
firstTriggeredCode: '首触故障码',
|
||||
type: '类别',
|
||||
alarmTime: '告警时间',
|
||||
}
|
||||
|
18
ui/dasadmin/src/stores/faults.ts
Normal file
18
ui/dasadmin/src/stores/faults.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
import type { Faults } from '/@/stores/interface'
|
||||
export const useFaultsStore = defineStore('faults', {
|
||||
state: (): Faults => ({
|
||||
data: {},
|
||||
keys: []
|
||||
}),
|
||||
actions: {
|
||||
setData(data: Faults['data']) {
|
||||
this.data = data
|
||||
},
|
||||
setKeys(keys: string[]) {
|
||||
this.keys = keys
|
||||
}
|
||||
},
|
||||
persist: true
|
||||
})
|
@ -135,3 +135,9 @@ export interface Enums {
|
||||
}
|
||||
keys: string[]
|
||||
}
|
||||
export interface Faults {
|
||||
data: {
|
||||
[key: string]: { [k: string]: string }
|
||||
}
|
||||
keys: string[]
|
||||
}
|
||||
|
@ -22,10 +22,22 @@
|
||||
:placeholder="t('alarm.select') + t('airBlower.airBlowerNumber')"
|
||||
class="alarmSelect"
|
||||
clearable
|
||||
@change="handleairBlowerChange"
|
||||
>
|
||||
<el-option v-for="v in airBlowerList" :key="v.value" :label="v.label" :value="v.value"></el-option>
|
||||
</el-select>
|
||||
<div style="width: 20px"></div>
|
||||
<div style="width: fit-content; white-space: nowrap">{{ t('alarm.firstTriggeredCode') }}</div>
|
||||
<el-select
|
||||
v-model="firstTriggeredCode"
|
||||
:placeholder="t('alarm.select') + t('alarm.firstTriggeredCode')"
|
||||
class="alarmSelect firstTriggeredCodeSelect"
|
||||
clearable
|
||||
filterable
|
||||
>
|
||||
<el-option v-for="v in firstTriggeredCodes" :key="v.code" :label="v.description" :value="v.code"></el-option>
|
||||
</el-select>
|
||||
<div style="width: 20px"></div>
|
||||
<div style="width: fit-content; min-width: 30px">{{ t('alarm.type') }}</div>
|
||||
<el-select v-model="alarmTypeValue" :placeholder="t('alarm.select') + t('alarm.type')" class="alarmSelect" clearable>
|
||||
<el-option v-for="v in alarmTypes" :key="v.value" :label="v.label" :value="v.value"></el-option>
|
||||
@ -156,7 +168,7 @@ const getFormattedDate = (offset: number) => {
|
||||
|
||||
// 风机编号
|
||||
const airBlowerNumberValue = ref('')
|
||||
const airBlowerList = ref([{ label: '', value: '' }])
|
||||
const airBlowerList = ref([{ label: '', value: '', model: '', madeinFactory: '' }])
|
||||
// 类别
|
||||
const alarmTypeValue = ref(2)
|
||||
const alarmTypes = ref([
|
||||
@ -164,6 +176,8 @@ const alarmTypes = ref([
|
||||
{ label: '告警', value: 1 },
|
||||
{ label: '提示', value: 0 },
|
||||
])
|
||||
const firstTriggeredCode = ref('')
|
||||
const firstTriggeredCodes: any = ref([])
|
||||
const isLoading = ref(false)
|
||||
const searchOperate = () => {
|
||||
isLoading.value = true
|
||||
@ -189,6 +203,7 @@ const searchalarms = (): GetAlarmsTableParam => {
|
||||
deviceCode: deviceCode,
|
||||
pageNum: paginationOptions.current,
|
||||
pageSize: paginationOptions.pageSize,
|
||||
firstTriggeredCode: firstTriggeredCode.value,
|
||||
}
|
||||
}
|
||||
|
||||
@ -207,28 +222,27 @@ const getcurrentPage = () => {
|
||||
|
||||
const getalarmsList = async () => {
|
||||
const transparams = searchalarms()
|
||||
console.log('🚀 ~ getalarmsList ~ transparams:', transparams)
|
||||
getAlarmListReq(transparams).then((res: any) => {
|
||||
isLoading.value = false
|
||||
if (res.code == 200) {
|
||||
paginationOptions.total = res.total
|
||||
alarmsTableData.value = res.rows.map((item: any) => {
|
||||
console.log('🚀 ~ alarmsTableData.value=res.rows.map ~ item:', item)
|
||||
const descriptions = descriptionMap.value[`${item.madeinFactory}_${item.model}`] || {}
|
||||
return {
|
||||
...item,
|
||||
eventTimeFormate: timestampToTime(item.eventTime),
|
||||
codeDescriptions: descriptions[item.firstTriggeredCode] || item.firstTriggeredCode,
|
||||
}
|
||||
})
|
||||
} else {
|
||||
ElMessage.error(res.msg ?? '查询失败')
|
||||
}
|
||||
})
|
||||
// .catch((err) => {
|
||||
// isLoading.value = false
|
||||
// ElMessage.error(err ?? '查询失败')
|
||||
// })
|
||||
getAlarmListReq(transparams)
|
||||
.then((res: any) => {
|
||||
isLoading.value = false
|
||||
if (res.code == 200) {
|
||||
paginationOptions.total = res.total
|
||||
alarmsTableData.value = res.rows.map((item: any) => {
|
||||
const descriptions = descriptionMap.value[`${item.madeinFactory}_${item.model}`] || {}
|
||||
return {
|
||||
...item,
|
||||
eventTimeFormate: timestampToTime(item.eventTime),
|
||||
codeDescriptions: descriptions[item.firstTriggeredCode] || item.firstTriggeredCode,
|
||||
}
|
||||
})
|
||||
} else {
|
||||
ElMessage.error(res.msg ?? '查询失败')
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
isLoading.value = false
|
||||
ElMessage.error(err ?? '查询失败')
|
||||
})
|
||||
}
|
||||
|
||||
const descriptionMap = computed(() => {
|
||||
@ -239,8 +253,6 @@ const descriptionMap = computed(() => {
|
||||
return acc
|
||||
}, {})
|
||||
})
|
||||
console.log('🚀 ~ map[item.key]=item.value.reduce ~ map:', map)
|
||||
|
||||
return map
|
||||
})
|
||||
|
||||
@ -322,54 +334,64 @@ const getDateRange = (type: 'week' | 'month') => {
|
||||
}
|
||||
}
|
||||
|
||||
const handleairBlowerChange = (value: any) => {
|
||||
if (value) {
|
||||
const selectObj: any = airBlowerList.value.find((item) => {
|
||||
return item.value == value
|
||||
})
|
||||
firstTriggeredCode.value = ''
|
||||
firstTriggeredCodes.value = faultCodeMap[`${selectObj.madeinFactory}_${selectObj.model}`]
|
||||
} else {
|
||||
firstTriggeredCode.value = ''
|
||||
firstTriggeredCodes.value = faultCodeMap[`${airBlowerList.value[0].madeinFactory}_${airBlowerList.value[0].model}`]
|
||||
}
|
||||
}
|
||||
|
||||
const faultCodeMap: any = {}
|
||||
onMounted(() => {
|
||||
equipList({
|
||||
// orgId: adminInfo.orgid,
|
||||
objectType: 10002,
|
||||
}).then((res) => {
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const res = await equipList({
|
||||
objectType: 10002,
|
||||
})
|
||||
if (res.code == 200) {
|
||||
airBlowerList.value = res.data.map((item: any) => {
|
||||
return {
|
||||
label: item.name,
|
||||
value: item.code,
|
||||
madeinFactory: item.madeinFactory,
|
||||
model: item.model,
|
||||
}
|
||||
})
|
||||
getalarmsList()
|
||||
}
|
||||
})
|
||||
|
||||
theoreticalpowerCurveList()
|
||||
.then((res: any) => {
|
||||
if (res.code == 200) {
|
||||
paginationOptions.total = res.total
|
||||
res.rows.forEach((item: any, index: number) => {
|
||||
getfaultCodeDict(item)
|
||||
})
|
||||
const theoreticalRes = await theoreticalpowerCurveList()
|
||||
if (theoreticalRes.code == 200) {
|
||||
await getfaultCodeDict(theoreticalRes.rows)
|
||||
firstTriggeredCodes.value = faultCodeMap[`${airBlowerList.value[0].madeinFactory}_${airBlowerList.value[0].model}`]
|
||||
console.log(firstTriggeredCodes.value)
|
||||
} else {
|
||||
ElMessage.error(res.msg ?? '查询失败')
|
||||
ElMessage.error(theoreticalRes.msg ?? '查询失败')
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
ElMessage.error(err?.response?.data?.msg ?? '查询失败')
|
||||
})
|
||||
}
|
||||
} catch (err) {
|
||||
ElMessage.error(err ?? '查询失败')
|
||||
}
|
||||
})
|
||||
|
||||
const getfaultCodeDict = (data: any) => {
|
||||
queryfaultCodeDict({ madeinfactory: data.madeinfactory, model: data.model }).then((res: any) => {
|
||||
const getfaultCodeDict = async (data: any) => {
|
||||
const promises = data.map(async (item: any) => {
|
||||
const res = await queryfaultCodeDict({ madeinfactory: item.madeinfactory, model: item.model })
|
||||
if (res.code == 200) {
|
||||
const deflautList: any = []
|
||||
res.data.forEach((item: any) => {
|
||||
deflautList.push({
|
||||
code: item.code,
|
||||
description: item.description,
|
||||
})
|
||||
})
|
||||
faultCodeMap[`${data.madeinfactory}_${data.model}`] = deflautList
|
||||
const deflautList = res.data.map((faultItem: any) => ({
|
||||
code: faultItem.code,
|
||||
description: faultItem.description,
|
||||
}))
|
||||
faultCodeMap[`${item.madeinfactory}_${item.model}`] = deflautList
|
||||
} else {
|
||||
ElMessage.warning('查询失败')
|
||||
}
|
||||
})
|
||||
await Promise.all(promises)
|
||||
}
|
||||
|
||||
const openDefalt = (row: any) => {
|
||||
@ -414,11 +436,14 @@ $paginationHeight: 32px;
|
||||
align-items: center;
|
||||
// width: 320px;
|
||||
.alarmSelect {
|
||||
width: 200px;
|
||||
width: 150px;
|
||||
:deep(.el-select__wrapper) {
|
||||
height: 40px;
|
||||
}
|
||||
}
|
||||
.firstTriggeredCodeSelect {
|
||||
width: 220px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.mainMain {
|
||||
|
@ -26,6 +26,7 @@ export type GetAlarmsTableParam = {
|
||||
eventLevel?: string | number | null
|
||||
pageNum?: Number
|
||||
pageSize?: Number
|
||||
firstTriggeredCode: string | number | null
|
||||
}
|
||||
|
||||
export enum AlarmsFieldsEnums {
|
||||
|
@ -58,16 +58,18 @@ import { useRoute } from 'vue-router'
|
||||
import { getParamList } from '/@/api/backend/SystemParam/request'
|
||||
import { queryfaultCodeDict } from '/@/api/backend/theoreticalpowerCurve/request'
|
||||
import { useEnumStore } from '/@/stores/enums'
|
||||
import { useFaultsStore } from '/@/stores/faults'
|
||||
import {equipList} from "/@/api/backend/realData/request";
|
||||
|
||||
|
||||
const route = useRoute()
|
||||
const enumStore = useEnumStore()
|
||||
const faultCodeDict = useFaultsStore()
|
||||
const d = new Date()
|
||||
const { t } = useI18n()
|
||||
let timer: any = null
|
||||
let myTable = ref<TableInstance>()
|
||||
const windList=ref([])
|
||||
|
||||
|
||||
const overviewSlotData= ref('')
|
||||
|
||||
@ -235,13 +237,17 @@ const StatusListData = () => {
|
||||
let color:any=''
|
||||
const state = getRealTimeState(item.attributeMap)
|
||||
let firsttriggeredcode=item.attributeMap.firsttriggeredcode
|
||||
const key = `${item.madeinFactory}-${item.model}`;
|
||||
if (enumStore.keys.includes('FirstTriggeredCode')) {
|
||||
firsttriggeredcode = enumStore.data['FirstTriggeredCode'][firsttriggeredcode]
|
||||
}
|
||||
/*if (malFunctionKeys.includes('FirstTriggeredCode')) {
|
||||
firsttriggeredcode = malFunctionEnums?.[firsttriggeredcode] ?? firsttriggeredcode
|
||||
if (faultCodeDict.keys.includes(key)) {
|
||||
if (firsttriggeredcode == 0) {
|
||||
firsttriggeredcode = '';
|
||||
} else {
|
||||
firsttriggeredcode = faultCodeDict.data[key][firsttriggeredcode] ?? '';
|
||||
}
|
||||
}
|
||||
*/
|
||||
paramColorData.value.forEach((item, index) => {
|
||||
if (item.state == state) {
|
||||
color = item.color
|
||||
@ -345,7 +351,6 @@ const StatusListData = () => {
|
||||
locked: item.attributeMap.locked,
|
||||
irotorspeed: item.attributeMap.irotorspeed,
|
||||
firsttriggeredcode:firsttriggeredcode,
|
||||
//firsttriggeredcode:item.attributeMap.firsttriggeredcode,
|
||||
},
|
||||
}
|
||||
})
|
||||
@ -358,36 +363,34 @@ const StatusListData = () => {
|
||||
}
|
||||
})
|
||||
}
|
||||
let malFunctionEnums: any = {}
|
||||
// 添加响应式属性以存储故障代码字典
|
||||
/*const malFunctionEnums = ref<{ [key: string]: { [code: string]: string } }>({});
|
||||
|
||||
/*const requestedParams = new Set<string>();
|
||||
const requestedParams = new Set<string>();
|
||||
const failedRequests = new Set<string>();
|
||||
|
||||
const fetchData = async (item: any) => {
|
||||
// 创建一个唯一的键来标识参数组合
|
||||
const key = `${item.madeinFactory}-${item.model}`;
|
||||
|
||||
// 检查这个键是否已经在 Set 中
|
||||
if (requestedParams.has(key)) {
|
||||
console.log('Duplicate request detected, skipping...');
|
||||
return;
|
||||
}
|
||||
// 将键添加到 Set 中
|
||||
requestedParams.add(key);
|
||||
|
||||
try {
|
||||
console.log({ madeinfactory: item.madeinFactory, model: item.model })
|
||||
const response = await queryfaultCodeDict({ madeinfactory: item.madeinFactory, model: item.model });
|
||||
if (response.code === 200) {
|
||||
const data: any = {};
|
||||
response.data.forEach((item: any) => {
|
||||
data[item.code] = item.description;
|
||||
});
|
||||
malFunctionEnums = data;
|
||||
malFunctionEnums.value[key] = data;
|
||||
} else {
|
||||
console.warn('查询故障代码字典失败:', response.message);
|
||||
failedRequests.add(key);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('请求出错:', error);
|
||||
failedRequests.add(key);
|
||||
}
|
||||
};*/
|
||||
|
||||
@ -428,14 +431,6 @@ onMounted(() => {
|
||||
res.data.map((item: any) => {
|
||||
deviceCode.value.push(item.code)
|
||||
})
|
||||
windList.value=res.data.map((item: any) => {
|
||||
//fetchData(item)
|
||||
return {
|
||||
madeinfactory:item.madeinFactory,
|
||||
model: item.model ?? '-',
|
||||
}
|
||||
})
|
||||
//getMalfunctionEnums()
|
||||
})
|
||||
|
||||
overviewList()
|
||||
|
@ -11,7 +11,6 @@
|
||||
'': item.standard==0,
|
||||
'wind-offline': item.attributeMap.processedoperationmode == 33
|
||||
}">
|
||||
|
||||
<div class="fanlist-top">
|
||||
<span :class="item.standard == 1 ? 'wind-mark-icon' : 'fanlist-icon'">
|
||||
<img :class="item.standard == 1 ? '' : 'wind-picture'" src="~assets/dashboard/biaogan.png" alt="" />
|
||||
@ -69,12 +68,12 @@
|
||||
</el-row>
|
||||
</div>
|
||||
<div class="fanlist-bottom">
|
||||
<!-- <span :style="item.attributeMap.locked == 1 ? 'max-width:120px;' : 'max-width:150px;'">
|
||||
{{ item.attributeMap.firsttriggeredcode }}
|
||||
</span>-->
|
||||
<span :style="item.attributeMap.locked == 1 ? 'max-width:120px;' : 'max-width:150px;'">
|
||||
{{ getFaultDescription(item) }}
|
||||
{{ item.attributeMap.firsttriggeredcode }}
|
||||
</span>
|
||||
<!-- <span :style="item.attributeMap.locked == 1 ? 'max-width:120px;' : 'max-width:150px;'">
|
||||
{{ getFaultDescription(item) }}
|
||||
</span>-->
|
||||
<!-- <el-tag class="tag-panel is-danger">已锁定</el-tag>-->
|
||||
<el-tag v-if="item.attributeMap.locked === 1" class="tag-panel is-danger">已锁定</el-tag>
|
||||
</div>
|
||||
@ -412,13 +411,7 @@ const getSafeImagePath = (item, type) => {
|
||||
|
||||
};
|
||||
|
||||
const getFaultDescription=(item)=>{
|
||||
/*fetchData(item)
|
||||
let firsttriggeredcode=item.attributeMap.firsttriggeredcode
|
||||
if (malFunctionKeys.includes('FirstTriggeredCode')) {
|
||||
firsttriggeredcode = malFunctionEnums?.[firsttriggeredcode] ?? firsttriggeredcode
|
||||
}
|
||||
return firsttriggeredcode*/
|
||||
/*const getFaultDescription=(item)=>{
|
||||
const key = `${item.madeinFactory}-${item.model}`;
|
||||
if (failedRequests.has(key)) {
|
||||
return '';
|
||||
@ -459,17 +452,15 @@ const fetchData = async (item: any) => {
|
||||
response.data.forEach((item: any) => {
|
||||
data[item.code] = item.description;
|
||||
});
|
||||
//malFunctionEnums = data;
|
||||
malFunctionEnums[key] = data;
|
||||
} else {
|
||||
console.warn('查询故障代码字典失败:', response.message);
|
||||
failedRequests.add(key);
|
||||
}
|
||||
} catch (error) {
|
||||
//console.error('查询故障代码字典失败', error);
|
||||
failedRequests.add(key);
|
||||
}
|
||||
};
|
||||
};*/
|
||||
|
||||
</script>
|
||||
|
||||
|
@ -92,6 +92,7 @@ import { editDefaultLang } from '/@/lang/index'
|
||||
import { useConfig } from '/@/stores/config'
|
||||
import { useAdminInfo } from '/@/stores/adminInfo'
|
||||
import { useEnumStore } from '/@/stores/enums'
|
||||
import {useFaultsStore} from "/@/stores/faults"
|
||||
import { login } from '/@/api/backend'
|
||||
import { buildValidatorData } from '/@/utils/validate'
|
||||
import router from '/@/router'
|
||||
@ -100,11 +101,15 @@ import toggleDark from '/@/utils/useDark'
|
||||
import { fullUrl } from '/@/utils/common'
|
||||
import { adminBaseRoutePath } from '/@/router/static/adminBase'
|
||||
import { getAllEnumData } from '/@/api/backend/Enumeration/request'
|
||||
import {equipList} from "/@/api/backend/realData/request";
|
||||
import { queryfaultCodeDict } from '/@/api/backend/theoreticalpowerCurve/request'
|
||||
|
||||
let timer: number
|
||||
|
||||
const config = useConfig()
|
||||
const adminInfo = useAdminInfo()
|
||||
const enumsStore = useEnumStore()
|
||||
const FaultsStore = useFaultsStore()
|
||||
|
||||
const isSmall = ref(window.screen.width < 620 ? true : false)
|
||||
|
||||
@ -192,7 +197,6 @@ const load = () => {
|
||||
state.captcha = 'data:image\/png;base64,' + res.data.img
|
||||
})
|
||||
}
|
||||
|
||||
const getEnumsData = () => {
|
||||
getAllEnumData().then((res) => {
|
||||
if (res.success) {
|
||||
@ -213,6 +217,49 @@ const getEnumsData = () => {
|
||||
}
|
||||
})
|
||||
}
|
||||
equipList({ objectType: 10002 }).then((res) => {
|
||||
res.data.map((item: any) => {
|
||||
fetchData(item)
|
||||
return {
|
||||
madeinfactory:item.madeinFactory,
|
||||
model: item.model ?? '-',
|
||||
}
|
||||
})
|
||||
})
|
||||
const malFunctionEnums = ref<{ [key: string]: { [code: string]: string } }>({});
|
||||
|
||||
const requestedParams = new Set<string>();
|
||||
const failedRequests = new Set<string>();
|
||||
const fetchData = async (item: any) => {
|
||||
const key = `${item.madeinFactory}-${item.model}`;
|
||||
if (requestedParams.has(key)) {
|
||||
return;
|
||||
}
|
||||
requestedParams.add(key);
|
||||
const keys = requestedParams;
|
||||
const response = await queryfaultCodeDict({ madeinfactory: item.madeinFactory, model: item.model });
|
||||
if (response.code === 200) {
|
||||
const data: any = {};
|
||||
response.data.forEach((item: any) => {
|
||||
data[item.code] = item.description;
|
||||
});
|
||||
malFunctionEnums.value[key] = data;
|
||||
const datas=malFunctionEnums.value
|
||||
sessionStorage.setItem(
|
||||
'faultCodeDict',
|
||||
JSON.stringify({
|
||||
datas,
|
||||
keys:Array.from(requestedParams),
|
||||
})
|
||||
)
|
||||
FaultsStore.setKeys(Array.from(requestedParams))
|
||||
FaultsStore.setData(datas)
|
||||
} else {
|
||||
console.warn('查询故障代码字典失败:', response.message);
|
||||
failedRequests.add(key);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
const onSubmit = () => {
|
||||
state.submitLoading = true
|
||||
|
@ -8,7 +8,7 @@
|
||||
v-model="windBlowerValue"
|
||||
@change="selectWindBlower"
|
||||
:placeholder="'请选择' + t('statAnalysis.deviceId')"
|
||||
class="windBlowerSelect commonSelect"
|
||||
class="commonSelect"
|
||||
>
|
||||
<el-option v-for="v in windBlowerList" :key="v.irn" :label="v.name" :value="v.irn"></el-option>
|
||||
</el-select>
|
||||
@ -29,11 +29,16 @@
|
||||
<el-select v-model="interval" :placeholder="'请选择' + t('statAnalysis.interval')" class="commonSelect">
|
||||
<el-option v-for="v in intervals" :key="v.value" :label="v.label" :value="v.value"></el-option>
|
||||
</el-select>
|
||||
<div style="width: 20px"></div>
|
||||
<div style="min-width: 30px">{{ t('statAnalysis.calFunction') }}</div>
|
||||
<el-select v-model="calFunction" :placeholder="'请选择' + t('statAnalysis.calFunction')" class="commonSelect">
|
||||
<el-option v-for="v in calFunctions" :key="v.value" :label="v.label" :value="v.value"></el-option>
|
||||
</el-select>
|
||||
</el-space>
|
||||
<div>
|
||||
<el-space style="margin-top: 10px">
|
||||
<div style="min-width: 30px">模板</div>
|
||||
<el-select v-model="template" placeholder="请选择模板" class="commonSelect" @change="changeTemplate">
|
||||
<el-select v-model="template" placeholder="请选择模板" class="templateSelect commonSelect" @change="changeTemplate">
|
||||
<el-option v-for="v in reportTemplateList" :key="v.value" :label="v.label" :value="v.value">
|
||||
<template #default>
|
||||
<div class="tamplateOption">
|
||||
@ -131,6 +136,7 @@ import { WindBlowerList, RequestData, Devices } from './type'
|
||||
import {
|
||||
queryWindTurbinesPages,
|
||||
historyReq,
|
||||
windowReq,
|
||||
getReportTemplateListReq,
|
||||
addReportTemplateListReq,
|
||||
delReportTemplateListReq,
|
||||
@ -212,6 +218,13 @@ const intervals = [
|
||||
{ label: '一天', value: '1d' },
|
||||
{ label: '原始', value: 'NONE' },
|
||||
]
|
||||
const calFunction = ref('interpolation')
|
||||
const calFunctions = [
|
||||
{ label: '瞬时值', value: 'interpolation' },
|
||||
{ label: '平均值', value: 'average' },
|
||||
{ label: '最大值', value: 'max' },
|
||||
{ label: '最小值', value: 'min' },
|
||||
]
|
||||
// 模板
|
||||
const template = ref('')
|
||||
const reportTemplateList = ref<{ label: string; value: string; columns: any[]; interval: string }[]>([])
|
||||
@ -441,55 +454,70 @@ const queryHistoryData = () => {
|
||||
interval: interval.value,
|
||||
startTime: new Date(timeRange.value[0]).getTime(),
|
||||
endTime: new Date(timeRange.value[1]).getTime(),
|
||||
} as any
|
||||
historyReq(requestData)
|
||||
.then((res) => {
|
||||
if (res.code == 200) {
|
||||
const result = res.data
|
||||
if (Object.keys(result)?.length) {
|
||||
const realResult = result[windBlowerValue.value]
|
||||
let tableData = [] as any
|
||||
attributeCodes.forEach((item: any) => {
|
||||
if (Object.keys(realResult).includes(item)) {
|
||||
tableData.push({
|
||||
name: item,
|
||||
times: realResult[item].times,
|
||||
value: realResult[item].values.map((val: any) => (val === 0 ? 0 : val?.toFixed(2))),
|
||||
})
|
||||
}
|
||||
})
|
||||
const processedData = new Map()
|
||||
idCounter.value = 0
|
||||
if (tableData.length) {
|
||||
tableData.forEach(({ name, times, value }: any) => {
|
||||
times.forEach((time: number, index: number) => {
|
||||
if (!processedData.has(time)) {
|
||||
processedData.set(time, { id: idCounter.value++, time: timestampToTime(time) })
|
||||
}
|
||||
const values = value[index]
|
||||
processedData.get(time)[name] = enumStore.keys.includes(name) ? enumStore.data?.[name]?.[values] : values
|
||||
})
|
||||
})
|
||||
}
|
||||
reportTableData.value = Array.from(processedData.values())
|
||||
if (!reportTableData.value.length) {
|
||||
ElMessage.warning('查询数据为空!')
|
||||
reportTableData.value = []
|
||||
}
|
||||
reportLoading.value = false
|
||||
} else {
|
||||
ElMessage.warning('查询数据为空!')
|
||||
reportTableData.value = []
|
||||
reportLoading.value = false
|
||||
}
|
||||
} else {
|
||||
calFunction: calFunction.value,
|
||||
} as anyObj
|
||||
if (calFunction.value == 'interpolation') {
|
||||
historyReq(requestData)
|
||||
.then((res) => {
|
||||
handleRes(res, attributeCodes)
|
||||
})
|
||||
.finally(() => {
|
||||
reportLoading.value = false
|
||||
ElMessage.warning('查询失败')
|
||||
})
|
||||
} else {
|
||||
windowReq(requestData)
|
||||
.then((res) => {
|
||||
handleRes(res, attributeCodes)
|
||||
})
|
||||
.finally(() => {
|
||||
reportLoading.value = false
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const handleRes = (res: any, attributeCodes: any) => {
|
||||
if (res.code == 200) {
|
||||
const result = res.data
|
||||
if (Object.keys(result)?.length) {
|
||||
const realResult = result[windBlowerValue.value]
|
||||
let tableData = [] as any
|
||||
attributeCodes.forEach((item: any) => {
|
||||
if (Object.keys(realResult).includes(item)) {
|
||||
tableData.push({
|
||||
name: item,
|
||||
times: realResult[item].times,
|
||||
value: realResult[item].values.map((val: any) => (val === 0 ? 0 : val?.toFixed(2))),
|
||||
})
|
||||
}
|
||||
})
|
||||
const processedData = new Map()
|
||||
idCounter.value = 0
|
||||
if (tableData.length) {
|
||||
tableData.forEach(({ name, times, value }: any) => {
|
||||
times.forEach((time: number, index: number) => {
|
||||
if (!processedData.has(time)) {
|
||||
processedData.set(time, { id: idCounter.value++, time: timestampToTime(time) })
|
||||
}
|
||||
const values = value[index]
|
||||
processedData.get(time)[name] = enumStore.keys.includes(name) ? enumStore.data?.[name]?.[values] : values
|
||||
})
|
||||
})
|
||||
}
|
||||
reportTableData.value = Array.from(processedData.values())
|
||||
if (!reportTableData.value.length) {
|
||||
ElMessage.warning('查询数据为空!')
|
||||
reportTableData.value = []
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
reportLoading.value = false
|
||||
})
|
||||
} else {
|
||||
ElMessage.warning('查询数据为空!')
|
||||
reportTableData.value = []
|
||||
reportLoading.value = false
|
||||
}
|
||||
} else {
|
||||
reportLoading.value = false
|
||||
ElMessage.warning('查询失败')
|
||||
}
|
||||
}
|
||||
|
||||
// 时间转换
|
||||
@ -560,11 +588,14 @@ onMounted(() => {
|
||||
}
|
||||
|
||||
.commonSelect {
|
||||
min-width: 250px;
|
||||
min-width: 150px;
|
||||
:deep(.el-select__wrapper) {
|
||||
height: 40px;
|
||||
}
|
||||
}
|
||||
.templateSelect {
|
||||
min-width: 223px;
|
||||
}
|
||||
|
||||
.button {
|
||||
height: 40px;
|
||||
|
@ -269,7 +269,7 @@ const statAnalysisSelectOptions: any = reactive({
|
||||
{ label: '原始', value: 'NONE' },
|
||||
],
|
||||
calFunction: [
|
||||
{ label: '插值', value: 'interpolation' },
|
||||
{ label: '瞬时值', value: 'interpolation' },
|
||||
{ label: '平均值', value: 'average' },
|
||||
{ label: '最大值', value: 'max' },
|
||||
{ label: '最小值', value: 'min' },
|
||||
|
@ -162,7 +162,7 @@ const statAnalysisSelectOptions: any = reactive({
|
||||
{ label: '原始', value: 'NONE' },
|
||||
],
|
||||
calFunction: [
|
||||
{ label: '插值', value: 'interpolation' },
|
||||
{ label: '瞬时值', value: 'interpolation' },
|
||||
{ label: '平均值', value: 'average' },
|
||||
{ label: '最大值', value: 'max' },
|
||||
{ label: '最小值', value: 'min' },
|
||||
|
Loading…
Reference in New Issue
Block a user