Compare commits
2 Commits
fa8e535483
...
acddc78560
Author | SHA1 | Date | |
---|---|---|---|
acddc78560 | |||
7166cd4ca2 |
@ -180,4 +180,5 @@ public interface ErrorCodeConstants {
|
||||
|
||||
ErrorCode EQUIP_ALARM_DATA_NOT_EXISTS = new ErrorCode(1_002_030_001, "机床报警数据不存在");
|
||||
|
||||
ErrorCode ALARM_DATA_NOT_EXISTS = new ErrorCode(1_002_030_002, "机床参数报警记录不存在");
|
||||
}
|
||||
|
@ -0,0 +1,99 @@
|
||||
package com.inspur.module.system.controller.admin.alarm;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.inspur.framework.common.pojo.PageParam;
|
||||
import com.inspur.framework.common.pojo.PageResult;
|
||||
import com.inspur.framework.common.pojo.CommonResult;
|
||||
import com.inspur.framework.common.util.object.BeanUtils;
|
||||
|
||||
import static com.inspur.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import com.inspur.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import com.inspur.framework.apilog.core.annotation.ApiAccessLog;
|
||||
|
||||
import static com.inspur.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import com.inspur.module.system.controller.admin.alarm.vo.*;
|
||||
import com.inspur.module.system.dal.dataobject.alarm.AlarmDataDO;
|
||||
import com.inspur.module.system.service.alarm.AlarmDataService;
|
||||
|
||||
@Tag(name = "管理后台 - 机床参数报警记录")
|
||||
@RestController
|
||||
@RequestMapping("/imt/alarm-data")
|
||||
@Validated
|
||||
public class AlarmDataController {
|
||||
|
||||
@Resource
|
||||
private AlarmDataService alarmDataService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建机床参数报警记录")
|
||||
@PreAuthorize("@ss.hasPermission('imt:alarm-data:create')")
|
||||
public CommonResult<Long> createAlarmData(@Valid @RequestBody AlarmDataSaveReqVO createReqVO) {
|
||||
return success(alarmDataService.createAlarmData(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新机床参数报警记录")
|
||||
@PreAuthorize("@ss.hasPermission('imt:alarm-data:update')")
|
||||
public CommonResult<Boolean> updateAlarmData(@Valid @RequestBody AlarmDataSaveReqVO updateReqVO) {
|
||||
alarmDataService.updateAlarmData(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除机床参数报警记录")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('imt:alarm-data:delete')")
|
||||
public CommonResult<Boolean> deleteAlarmData(@RequestParam("id") Long id) {
|
||||
alarmDataService.deleteAlarmData(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得机床参数报警记录")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('imt:alarm-data:query')")
|
||||
public CommonResult<AlarmDataRespVO> getAlarmData(@RequestParam("id") Long id) {
|
||||
AlarmDataDO alarmData = alarmDataService.getAlarmData(id);
|
||||
return success(BeanUtils.toBean(alarmData, AlarmDataRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得机床参数报警记录分页")
|
||||
@PreAuthorize("@ss.hasPermission('imt:alarm-data:query')")
|
||||
public CommonResult<PageResult<AlarmDataRespVO>> getAlarmDataPage(@Valid AlarmDataPageReqVO pageReqVO) {
|
||||
PageResult<AlarmDataDO> pageResult = alarmDataService.getAlarmDataPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, AlarmDataRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出机床参数报警记录 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('imt:alarm-data:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportAlarmDataExcel(@Valid AlarmDataPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<AlarmDataDO> list = alarmDataService.getAlarmDataPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "机床参数报警记录.xls", "数据", AlarmDataRespVO.class,
|
||||
BeanUtils.toBean(list, AlarmDataRespVO.class));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package com.inspur.module.system.controller.admin.alarm.vo;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.inspur.framework.common.pojo.PageParam;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.inspur.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 机床参数报警记录分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class AlarmDataPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "报警规则id")
|
||||
private String alarmRulesId;
|
||||
|
||||
@Schema(description = "机床设备id")
|
||||
private String equipId;
|
||||
|
||||
@Schema(description = "机床组件id", example = "30079")
|
||||
private String componentId;
|
||||
|
||||
@Schema(description = "规则参数key")
|
||||
private String nameKey;
|
||||
|
||||
@Schema(description = "首次报警时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] firstAlarmTime;
|
||||
|
||||
@Schema(description = "等级")
|
||||
private Integer alarmLevel;
|
||||
|
||||
@Schema(description = "最新报警时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] lastAlarmTime;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
@Schema(description = "设备预警信息主键")
|
||||
private String equipAlarmId;
|
||||
|
||||
@Schema(description = "报警类型")
|
||||
private Integer alarmType;
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
package com.inspur.module.system.controller.admin.alarm.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 机床参数报警记录 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class AlarmDataRespVO {
|
||||
|
||||
@Schema(description = "机床设备报警记录id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("机床设备报警记录id")
|
||||
private Long alarmDataId;
|
||||
|
||||
@Schema(description = "报警规则id")
|
||||
@ExcelProperty("报警规则id")
|
||||
private String alarmRulesId;
|
||||
|
||||
@Schema(description = "机床设备id")
|
||||
@ExcelProperty("机床设备id")
|
||||
private String equipId;
|
||||
|
||||
@Schema(description = "机床组件id", example = "30079")
|
||||
@ExcelProperty("机床组件id")
|
||||
private String componentId;
|
||||
|
||||
@Schema(description = "规则参数key")
|
||||
@ExcelProperty("规则参数key")
|
||||
private String nameKey;
|
||||
|
||||
@Schema(description = "报警内容")
|
||||
@ExcelProperty("报警内容")
|
||||
private String content;
|
||||
|
||||
@Schema(description = "报警值")
|
||||
@ExcelProperty("报警值")
|
||||
private BigDecimal alarmValue;
|
||||
|
||||
@Schema(description = "首次报警时间")
|
||||
@ExcelProperty("首次报警时间")
|
||||
private LocalDateTime firstAlarmTime;
|
||||
|
||||
@Schema(description = "等级")
|
||||
@ExcelProperty("等级")
|
||||
private Integer alarmLevel;
|
||||
|
||||
@Schema(description = "最新报警时间")
|
||||
@ExcelProperty("最新报警时间")
|
||||
private LocalDateTime lastAlarmTime;
|
||||
|
||||
@Schema(description = "可能故障原因")
|
||||
@ExcelProperty("可能故障原因")
|
||||
private String reasonDescription;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "设备预警信息主键")
|
||||
@ExcelProperty("设备预警信息主键")
|
||||
private String equipAlarmId;
|
||||
|
||||
@Schema(description = "报警类型")
|
||||
@ExcelProperty("报警类型")
|
||||
private String alarmType;
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package com.inspur.module.system.controller.admin.alarm.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 机床参数报警记录新增/修改 Request VO")
|
||||
@Data
|
||||
public class AlarmDataSaveReqVO {
|
||||
|
||||
@Schema(description = "机床设备报警记录id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long alarmDataId;
|
||||
|
||||
@Schema(description = "报警规则id")
|
||||
private String alarmRulesId;
|
||||
|
||||
@Schema(description = "机床设备id")
|
||||
private String equipId;
|
||||
|
||||
@Schema(description = "机床组件id", example = "30079")
|
||||
private String componentId;
|
||||
|
||||
@Schema(description = "规则参数key")
|
||||
private String nameKey;
|
||||
|
||||
@Schema(description = "报警内容")
|
||||
private String content;
|
||||
|
||||
@Schema(description = "报警值")
|
||||
private BigDecimal alarmValue;
|
||||
|
||||
@Schema(description = "首次报警时间")
|
||||
private LocalDateTime firstAlarmTime;
|
||||
|
||||
@Schema(description = "处理结果")
|
||||
private String result;
|
||||
|
||||
@Schema(description = "报警记录的状态(0:未处理,1:已处理)")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "等级")
|
||||
private Integer alarmLevel;
|
||||
|
||||
@Schema(description = "最新报警时间")
|
||||
private LocalDateTime lastAlarmTime;
|
||||
|
||||
@Schema(description = "可能故障原因")
|
||||
private String reasonDescription;
|
||||
|
||||
@Schema(description = "设备预警信息主键")
|
||||
private String equipAlarmId;
|
||||
|
||||
@Schema(description = "报警类型")
|
||||
private String alarmType;
|
||||
}
|
@ -0,0 +1,112 @@
|
||||
package com.inspur.module.system.dal.dataobject.alarm;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.inspur.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 机床参数报警记录 DO
|
||||
*
|
||||
* @author zjw
|
||||
*/
|
||||
@TableName("imt_alarm_data")
|
||||
@KeySequence("imt_alarm_data_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AlarmDataDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 机床设备报警记录id
|
||||
*/
|
||||
@TableId
|
||||
private Long alarmDataId;
|
||||
/**
|
||||
* 报警规则id
|
||||
*/
|
||||
private String alarmRulesId;
|
||||
/**
|
||||
* 机床设备id
|
||||
*/
|
||||
private String equipId;
|
||||
/**
|
||||
* 机床组件id
|
||||
*/
|
||||
private String componentId;
|
||||
/**
|
||||
* 规则参数key
|
||||
*/
|
||||
private String nameKey;
|
||||
/**
|
||||
* 报警内容
|
||||
*/
|
||||
private String content;
|
||||
/**
|
||||
* 报警值
|
||||
*/
|
||||
private BigDecimal alarmValue;
|
||||
/**
|
||||
* 首次报警时间
|
||||
*/
|
||||
private LocalDateTime firstAlarmTime;
|
||||
/**
|
||||
* 处理结果
|
||||
*/
|
||||
private String result;
|
||||
/**
|
||||
* 报警记录的状态(0:未处理,1:已处理)
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 处理人
|
||||
*/
|
||||
private Long operatorId;
|
||||
/**
|
||||
* 等级
|
||||
*/
|
||||
private Integer alarmLevel;
|
||||
/**
|
||||
* 最新报警时间
|
||||
*/
|
||||
private LocalDateTime lastAlarmTime;
|
||||
/**
|
||||
* 可能故障原因
|
||||
*/
|
||||
private String reasonDescription;
|
||||
/**
|
||||
* 设备预警信息主键
|
||||
*/
|
||||
private String equipAlarmId;
|
||||
|
||||
/**
|
||||
* 设备型号
|
||||
*/
|
||||
private String modelName;
|
||||
|
||||
/**
|
||||
* 客户名
|
||||
*/
|
||||
private String customerName;
|
||||
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
private String equipNo;
|
||||
|
||||
/**
|
||||
* 组件名称
|
||||
*/
|
||||
private String componentName;
|
||||
|
||||
/**
|
||||
* 报警类型
|
||||
*/
|
||||
private Integer alarmType;
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package com.inspur.module.system.dal.mysql.alarm;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.inspur.framework.common.pojo.PageResult;
|
||||
import com.inspur.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.inspur.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.inspur.module.system.dal.dataobject.alarm.AlarmDataDO;
|
||||
import com.inspur.module.system.dal.dataobject.alarm.EquipAlarmDataDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.inspur.module.system.controller.admin.alarm.vo.*;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 机床参数报警记录 Mapper
|
||||
*
|
||||
* @author zjw
|
||||
*/
|
||||
@Mapper
|
||||
public interface AlarmDataMapper extends BaseMapperX<AlarmDataDO> {
|
||||
|
||||
default PageResult<AlarmDataDO> selectPage(AlarmDataPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<AlarmDataDO>()
|
||||
.eqIfPresent(AlarmDataDO::getAlarmRulesId, reqVO.getAlarmRulesId())
|
||||
.eqIfPresent(AlarmDataDO::getEquipId, reqVO.getEquipId())
|
||||
.eqIfPresent(AlarmDataDO::getComponentId, reqVO.getComponentId())
|
||||
.eqIfPresent(AlarmDataDO::getNameKey, reqVO.getNameKey())
|
||||
.betweenIfPresent(AlarmDataDO::getFirstAlarmTime, reqVO.getFirstAlarmTime())
|
||||
.eqIfPresent(AlarmDataDO::getAlarmLevel, reqVO.getAlarmLevel())
|
||||
.betweenIfPresent(AlarmDataDO::getLastAlarmTime, reqVO.getLastAlarmTime())
|
||||
.betweenIfPresent(AlarmDataDO::getCreateTime, reqVO.getCreateTime())
|
||||
.eqIfPresent(AlarmDataDO::getEquipAlarmId, reqVO.getEquipAlarmId())
|
||||
.orderByDesc(AlarmDataDO::getAlarmDataId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询参数报警列表
|
||||
*/
|
||||
public IPage<AlarmDataDO> selectAlarmDataList(IPage<AlarmDataDO> page, @Param("reqVO") AlarmDataPageReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 根据id查询参数报警
|
||||
*/
|
||||
public AlarmDataDO selectAlarmDataById(@Param("id") Long id);
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package com.inspur.module.system.service.alarm;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
|
||||
import com.inspur.module.system.controller.admin.alarm.vo.*;
|
||||
import com.inspur.module.system.dal.dataobject.alarm.AlarmDataDO;
|
||||
import com.inspur.framework.common.pojo.PageResult;
|
||||
import com.inspur.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 机床参数报警记录 Service 接口
|
||||
*
|
||||
* @author zjw
|
||||
*/
|
||||
public interface AlarmDataService {
|
||||
|
||||
/**
|
||||
* 创建机床参数报警记录
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createAlarmData(@Valid AlarmDataSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新机床参数报警记录
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateAlarmData(@Valid AlarmDataSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除机床参数报警记录
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteAlarmData(Long id);
|
||||
|
||||
/**
|
||||
* 获得机床参数报警记录
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 机床参数报警记录
|
||||
*/
|
||||
AlarmDataDO getAlarmData(Long id);
|
||||
|
||||
/**
|
||||
* 获得机床参数报警记录分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 机床参数报警记录分页
|
||||
*/
|
||||
PageResult<AlarmDataDO> getAlarmDataPage(AlarmDataPageReqVO pageReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
package com.inspur.module.system.service.alarm;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.inspur.module.system.dal.dataobject.alarm.EquipAlarmDataDO;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.inspur.module.system.controller.admin.alarm.vo.*;
|
||||
import com.inspur.module.system.dal.dataobject.alarm.AlarmDataDO;
|
||||
import com.inspur.framework.common.pojo.PageResult;
|
||||
import com.inspur.framework.common.util.object.BeanUtils;
|
||||
|
||||
import com.inspur.module.system.dal.mysql.alarm.AlarmDataMapper;
|
||||
|
||||
import static com.inspur.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.inspur.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 机床参数报警记录 Service 实现类
|
||||
*
|
||||
* @author zjw
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class AlarmDataServiceImpl implements AlarmDataService {
|
||||
|
||||
@Resource
|
||||
private AlarmDataMapper alarmDataMapper;
|
||||
|
||||
@Override
|
||||
public Long createAlarmData(AlarmDataSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
AlarmDataDO alarmData = BeanUtils.toBean(createReqVO, AlarmDataDO.class);
|
||||
alarmDataMapper.insert(alarmData);
|
||||
// 返回
|
||||
return alarmData.getAlarmDataId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAlarmData(AlarmDataSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateAlarmDataExists(updateReqVO.getAlarmDataId());
|
||||
// 更新
|
||||
AlarmDataDO updateObj = BeanUtils.toBean(updateReqVO, AlarmDataDO.class);
|
||||
alarmDataMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAlarmData(Long id) {
|
||||
// 校验存在
|
||||
validateAlarmDataExists(id);
|
||||
// 删除
|
||||
alarmDataMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateAlarmDataExists(Long id) {
|
||||
if (alarmDataMapper.selectAlarmDataById(id) == null) {
|
||||
throw exception(ALARM_DATA_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlarmDataDO getAlarmData(Long id) {
|
||||
return alarmDataMapper.selectAlarmDataById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<AlarmDataDO> getAlarmDataPage(AlarmDataPageReqVO pageReqVO) {
|
||||
IPage<AlarmDataDO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
|
||||
alarmDataMapper.selectAlarmDataList(page, pageReqVO);
|
||||
return new PageResult<>(page.getRecords(), page.getTotal());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.inspur.module.system.dal.mysql.alarm.AlarmDataMapper">
|
||||
<resultMap type="com.inspur.module.system.dal.dataobject.alarm.AlarmDataDO" id="AlarmDataResult">
|
||||
<result property="alarmDataId" column="alarm_data_id" />
|
||||
<result property="alarmRulesId" column="alarm_rules_id" />
|
||||
<result property="equipId" column="equip_id" />
|
||||
<result property="componentId" column="component_id" />
|
||||
<result property="nameKey" column="name_key" />
|
||||
<result property="content" column="content" />
|
||||
<result property="alarmValue" column="alarm_value" />
|
||||
<result property="firstAlarmTime" column="first_alarm_time" />
|
||||
<result property="lastAlarmTime" column="last_alarm_time" />
|
||||
<result property="result" column="result" />
|
||||
<result property="status" column="status" />
|
||||
<result property="operatorId" column="operator_id" />
|
||||
<result property="alarmLevel" column="alarm_level" />
|
||||
<result property="reasonDescription" column="reason_description" />
|
||||
<result property="equipAlarmId" column="equip_alarm_id" />
|
||||
<result property="alarmType" column="alarm_type" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectAlarmDataVo">
|
||||
select ad.alarm_data_id, ad.alarm_rules_id, ad.equip_id, ad.component_id, ad.name_key, ad.content, ad.alarm_value, ad.first_alarm_time, ad.last_alarm_time, ad.result, ad.status, ad.operator_id, ad.alarm_level, ad.reason_description, ad.equip_alarm_id,ad.alarm_type, ei.equip_no, ci.component_name, cui.customer_name,mi.model_name from imt_alarm_data ad
|
||||
left join imt_equip_info ei on ad.equip_id = ei.equip_id
|
||||
left join imt_customer_info cui on ei.customer_id = cui.customer_id
|
||||
left join imt_component_info ci on ad.component_id = ci.component_id
|
||||
left join imt_model_info mi on ei.model_id = mi.model_id
|
||||
</sql>
|
||||
|
||||
<select id="selectAlarmDataList" resultMap="AlarmDataResult">
|
||||
<include refid="selectAlarmDataVo"/>
|
||||
where deleted = '0'
|
||||
<if test="reqVO.alarmRulesId != null and reqVO.alarmRulesId != ''"> and ad.alarm_rules_id = #{reqVO.alarmName}</if>
|
||||
<if test="reqVO.equipId != null and reqVO.equipId != ''"> and ad.equip_id = #{reqVO.equipId}</if>
|
||||
<if test="reqVO.componentId != null and reqVO.componentId != ''"> and ad.component_id = #{reqVO.componentId}</if>
|
||||
<if test="reqVO.nameKey != null and reqVO.nameKey != ''"> and ad.name_key = #{reqVO.nameKey}</if>
|
||||
<if test="reqVO.firstAlarmTime != null "> and ad.first_alarm_time >= #{reqVO.firstAlarmTime[0]} and ad.first_alarm_time <= #{reqVO.firstAlarmTime[1]} </if>
|
||||
<if test="reqVO.lastAlarmTime != null "> and ad.last_alarm_time >= #{reqVO.lastAlarmTime[0]} and ad.last_alarm_time <= #{reqVO.lastAlarmTime[1]} </if>
|
||||
<if test="reqVO.alarmType != null and reqVO.alarmType != ''"> and ad.alarm_type = #{reqVO.alarmType}</if>
|
||||
order by ad.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectAlarmDataById" parameterType="String" resultMap="AlarmDataResult">
|
||||
<include refid="selectAlarmDataVo"/>
|
||||
where ad.alarm_data_id = #{id} and ad.deleted = '0'
|
||||
</select>
|
||||
</mapper>
|
@ -37,19 +37,18 @@
|
||||
|
||||
<select id="selectAlarmRulesList" resultMap="AlarmRulesResult">
|
||||
<include refid="selectAlarmRulesVo"/>
|
||||
<where>
|
||||
where iar.deleted = '0'
|
||||
<if test="reqVO.alarmName != null and reqVO.alarmName != ''"> and iar.alarm_name like concat('%', #{reqVO.alarmName}, '%')</if>
|
||||
<if test="reqVO.alarmNameKey != null and reqVO.alarmNameKey != ''"> and iar.alarm_name_key like concat('%', #{reqVO.alarmNameKey}, '%')</if>
|
||||
<if test="reqVO.equipId != null and reqVO.equipId != ''"> and iar.equip_id = #{reqVO.equipId}</if>
|
||||
<if test="reqVO.type != null "> and iar.type = #{reqVO.type}</if>
|
||||
<if test="reqVO.alarmLevel != null "> and iar.alarm_level = #{reqVO.alarmLevel}</if>
|
||||
</where>
|
||||
order by iar.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectAlarmRulesById" parameterType="String" resultMap="AlarmRulesResult">
|
||||
<include refid="selectAlarmRulesVo"/>
|
||||
where alarm_id = #{id}
|
||||
where iar.alarm_id = #{id} and iar.deleted = '0'
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -27,18 +27,17 @@
|
||||
|
||||
<select id="selectEquipAlarmList" resultMap="EquipAlarmResult">
|
||||
<include refid="selectEquipAlarmVo"/>
|
||||
<where>
|
||||
where iead.deleted = '0'
|
||||
<if test="reqVO.equipId != null and reqVO.equipId != ''"> and iead.equip_id = #{reqVO.equipId}</if>
|
||||
<if test="reqVO.componentId != null and reqVO.componentId != ''"> and iead.component_id = #{reqVO.componentId}</if>
|
||||
<if test="reqVO.alarmLevel != null and reqVO.alarmLevel != ''"> and iead.alarm_level = #{reqVO.alarmLevel}</if>
|
||||
<if test="reqVO.alarmType != null and reqVO.alarmType != ''"> and iead.alarm_type = #{reqVO.alarmType}</if>
|
||||
<if test="reqVO.firstAlarmTime != null "> and iead.first_alarm_time >= #{reqVO.firstAlarmTime[0]} and iead.first_alarm_time <= #{reqVO.firstAlarmTime[1]} </if>
|
||||
</where>
|
||||
order by iead.first_alarm_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectEquipAlarmById" parameterType="String" resultMap="EquipAlarmResult">
|
||||
<include refid="selectEquipAlarmVo"/>
|
||||
where iead.equip_alarm_id = #{id}
|
||||
where iead.equip_alarm_id = #{id} and iead.deleted = '0'
|
||||
</select>
|
||||
</mapper>
|
53
imt-ui/src/api/system/alarm/alarmdata.js
Normal file
53
imt-ui/src/api/system/alarm/alarmdata.js
Normal file
@ -0,0 +1,53 @@
|
||||
import request from "@/utils/request";
|
||||
|
||||
// 创建机床参数报警记录
|
||||
export function createAlarmData(data) {
|
||||
return request({
|
||||
url: "/imt/alarm-data/create",
|
||||
method: "post",
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
// 更新机床参数报警记录
|
||||
export function updateAlarmData(data) {
|
||||
return request({
|
||||
url: "/imt/alarm-data/update",
|
||||
method: "put",
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
// 删除机床参数报警记录
|
||||
export function deleteAlarmData(id) {
|
||||
return request({
|
||||
url: "/imt/alarm-data/delete?id=" + id,
|
||||
method: "delete",
|
||||
});
|
||||
}
|
||||
|
||||
// 获得机床参数报警记录
|
||||
export function getAlarmData(id) {
|
||||
return request({
|
||||
url: "/imt/alarm-data/get?id=" + id,
|
||||
method: "get",
|
||||
});
|
||||
}
|
||||
|
||||
// 获得机床参数报警记录分页
|
||||
export function getAlarmDataPage(params) {
|
||||
return request({
|
||||
url: "/imt/alarm-data/page",
|
||||
method: "get",
|
||||
params,
|
||||
});
|
||||
}
|
||||
// 导出机床参数报警记录 Excel
|
||||
export function exportAlarmDataExcel(params) {
|
||||
return request({
|
||||
url: "/imt/alarm-data/export-excel",
|
||||
method: "get",
|
||||
params,
|
||||
responseType: "blob",
|
||||
});
|
||||
}
|
251
imt-ui/src/views/system/alarm/alarmdata/AlarmDataForm.vue
Normal file
251
imt-ui/src/views/system/alarm/alarmdata/AlarmDataForm.vue
Normal file
@ -0,0 +1,251 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<el-dialog
|
||||
:title="dialogTitle"
|
||||
:visible.sync="dialogVisible"
|
||||
width="45%"
|
||||
v-dialogDrag
|
||||
append-to-body
|
||||
>
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
v-loading="formLoading"
|
||||
label-width="100px"
|
||||
>
|
||||
<el-form-item
|
||||
label="报警规则id"
|
||||
prop="alarmRulesId"
|
||||
>
|
||||
<el-input
|
||||
v-model="formData.alarmRulesId"
|
||||
placeholder="请输入报警规则id"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="机床设备id"
|
||||
prop="equipId"
|
||||
>
|
||||
<el-input
|
||||
v-model="formData.equipId"
|
||||
placeholder="请输入机床设备id"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="机床组件id"
|
||||
prop="componentId"
|
||||
>
|
||||
<el-input
|
||||
v-model="formData.componentId"
|
||||
placeholder="请输入机床组件id"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="规则参数key"
|
||||
prop="nameKey"
|
||||
>
|
||||
<el-input
|
||||
v-model="formData.nameKey"
|
||||
placeholder="请输入规则参数key"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="报警内容">
|
||||
<Editor
|
||||
v-model="formData.content"
|
||||
:min-height="192"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="报警值"
|
||||
prop="alarmValue"
|
||||
>
|
||||
<el-input
|
||||
v-model="formData.alarmValue"
|
||||
placeholder="请输入报警值"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="首次报警时间"
|
||||
prop="firstAlarmTime"
|
||||
>
|
||||
<el-date-picker
|
||||
clearable
|
||||
v-model="formData.firstAlarmTime"
|
||||
type="date"
|
||||
value-format="timestamp"
|
||||
placeholder="选择首次报警时间"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="处理结果"
|
||||
prop="result"
|
||||
>
|
||||
<el-input
|
||||
v-model="formData.result"
|
||||
placeholder="请输入处理结果"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="报警记录的状态(0:未处理,1:已处理)"
|
||||
prop="status"
|
||||
>
|
||||
<el-radio-group v-model="formData.status">
|
||||
<el-radio label="1">请选择字典生成</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="等级"
|
||||
prop="alarmLevel"
|
||||
>
|
||||
<el-input
|
||||
v-model="formData.alarmLevel"
|
||||
placeholder="请输入等级"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="最新报警时间"
|
||||
prop="lastAlarmTime"
|
||||
>
|
||||
<el-date-picker
|
||||
clearable
|
||||
v-model="formData.lastAlarmTime"
|
||||
type="date"
|
||||
value-format="timestamp"
|
||||
placeholder="选择最新报警时间"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="可能故障原因">
|
||||
<Editor
|
||||
v-model="formData.reasonDescription"
|
||||
:min-height="192"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="设备预警信息主键"
|
||||
prop="equipAlarmId"
|
||||
>
|
||||
<el-input
|
||||
v-model="formData.equipAlarmId"
|
||||
placeholder="请输入设备预警信息主键"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div
|
||||
slot="footer"
|
||||
class="dialog-footer"
|
||||
>
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="submitForm"
|
||||
:disabled="formLoading"
|
||||
>确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as AlarmDataApi from "@/api/system/alarm/alarmdata";
|
||||
import Editor from "@/components/Editor";
|
||||
export default {
|
||||
name: "AlarmDataForm",
|
||||
components: {
|
||||
Editor,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 弹出层标题
|
||||
dialogTitle: "",
|
||||
// 是否显示弹出层
|
||||
dialogVisible: false,
|
||||
// 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
formLoading: false,
|
||||
// 表单参数
|
||||
formData: {
|
||||
alarmRecordId: undefined,
|
||||
alarmRulesId: undefined,
|
||||
equipId: undefined,
|
||||
componentId: undefined,
|
||||
nameKey: undefined,
|
||||
content: undefined,
|
||||
alarmValue: undefined,
|
||||
firstAlarmTime: undefined,
|
||||
result: undefined,
|
||||
status: undefined,
|
||||
alarmLevel: undefined,
|
||||
lastAlarmTime: undefined,
|
||||
reasonDescription: undefined,
|
||||
equipAlarmId: undefined,
|
||||
},
|
||||
// 表单校验
|
||||
formRules: {},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
/** 打开弹窗 */
|
||||
async open(id) {
|
||||
this.dialogVisible = true;
|
||||
this.reset();
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
this.formLoading = true;
|
||||
try {
|
||||
const res = await AlarmDataApi.getAlarmData(id);
|
||||
this.formData = res.data;
|
||||
this.title = "修改机床参数报警记录";
|
||||
} finally {
|
||||
this.formLoading = false;
|
||||
}
|
||||
}
|
||||
this.title = "新增机床参数报警记录";
|
||||
},
|
||||
/** 提交按钮 */
|
||||
async submitForm() {
|
||||
// 校验主表
|
||||
await this.$refs["formRef"].validate();
|
||||
this.formLoading = true;
|
||||
try {
|
||||
const data = this.formData;
|
||||
// 修改的提交
|
||||
if (data.alarmRecordId) {
|
||||
await AlarmDataApi.updateAlarmData(data);
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.dialogVisible = false;
|
||||
this.$emit("success");
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
await AlarmDataApi.createAlarmData(data);
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.dialogVisible = false;
|
||||
this.$emit("success");
|
||||
} finally {
|
||||
this.formLoading = false;
|
||||
}
|
||||
},
|
||||
/** 表单重置 */
|
||||
reset() {
|
||||
this.formData = {
|
||||
alarmRecordId: undefined,
|
||||
alarmRulesId: undefined,
|
||||
equipId: undefined,
|
||||
componentId: undefined,
|
||||
nameKey: undefined,
|
||||
content: undefined,
|
||||
alarmValue: undefined,
|
||||
firstAlarmTime: undefined,
|
||||
result: undefined,
|
||||
status: undefined,
|
||||
alarmLevel: undefined,
|
||||
lastAlarmTime: undefined,
|
||||
reasonDescription: undefined,
|
||||
equipAlarmId: undefined,
|
||||
};
|
||||
this.resetForm("formRef");
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
607
imt-ui/src/views/system/alarm/alarmdata/index.vue
Normal file
607
imt-ui/src/views/system/alarm/alarmdata/index.vue
Normal file
@ -0,0 +1,607 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<div class="company-line-wrap-info">
|
||||
<div
|
||||
class="company-column-info"
|
||||
style="border-bottom:1px solid black"
|
||||
>
|
||||
<div class="head-info">
|
||||
<!-- <span>
|
||||
<span style="font-weight: 200; margin-right: 30px">
|
||||
{{ form.equipName }}</span>
|
||||
<span> 运行时间:</span>
|
||||
<span style="margin-right: 30px"> {{ runTime }}</span>
|
||||
<span style="display: inline-block"><dict-tag
|
||||
:options="dict.type.equip_alarm_status"
|
||||
:value="form.status"
|
||||
/></span>
|
||||
</span> -->
|
||||
<div
|
||||
class="info"
|
||||
style="margin-right:2px"
|
||||
>
|
||||
<span class="title">客户名称:</span>
|
||||
<span
|
||||
class="content"
|
||||
style="color:yellowgreen"
|
||||
>{{ customerName }}</span>
|
||||
</div>
|
||||
<div class="info">
|
||||
<span class="title">机床型号:</span>
|
||||
<span
|
||||
class="content"
|
||||
style="color:yellowgreen"
|
||||
>{{ modelName }}</span>
|
||||
</div>
|
||||
<div
|
||||
class="info"
|
||||
style="margin-right:2px"
|
||||
>
|
||||
<span class="title">设备编号:</span>
|
||||
<span
|
||||
class="content"
|
||||
style="color:yellowgreen"
|
||||
>{{ equipNo }}</span>
|
||||
</div>
|
||||
<div
|
||||
class="info"
|
||||
style="margin-right:2px"
|
||||
>
|
||||
<span class="title">报警等级:</span>
|
||||
<span class="content"><dict-tag
|
||||
:type="DICT_TYPE.ALARM_LEVEL"
|
||||
:value="alarmLevel"
|
||||
/></span>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="content-info">
|
||||
<div
|
||||
class="info"
|
||||
style="margin-right:2px"
|
||||
>
|
||||
<span class="title">设备编号:</span>
|
||||
<span
|
||||
class="content"
|
||||
style="color:yellowgreen"
|
||||
>{{ equipNo }}</span>
|
||||
</div>
|
||||
<div
|
||||
class="info"
|
||||
style="margin-right:2px"
|
||||
>
|
||||
<span class="title">报警等级:</span>
|
||||
<span class="content"><dict-tag
|
||||
:type="DICT_TYPE.ALARM_LEVEL"
|
||||
:value="alarmLevel"
|
||||
/></span>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
<div class="company-column-info">
|
||||
<el-tabs
|
||||
type="border-card"
|
||||
v-model="thrActiveName"
|
||||
style="height: 100%"
|
||||
>
|
||||
<el-tab-pane
|
||||
label="阈值报警信息"
|
||||
name="threshold"
|
||||
>
|
||||
<div class="alarm-info">
|
||||
<el-table
|
||||
v-loading="thrLoading"
|
||||
:data="thrList"
|
||||
:stripe="true"
|
||||
:show-overflow-tooltip="true"
|
||||
>
|
||||
<el-table-column
|
||||
label="报警内容"
|
||||
align="center"
|
||||
prop="content"
|
||||
/>
|
||||
<el-table-column
|
||||
label="等级"
|
||||
align="center"
|
||||
prop="alarmLevel"
|
||||
/>
|
||||
<el-table-column
|
||||
label="客户名"
|
||||
align="center"
|
||||
prop="customerName"
|
||||
/>
|
||||
<el-table-column
|
||||
label="设备型号"
|
||||
align="center"
|
||||
prop="modelName"
|
||||
/>
|
||||
<el-table-column
|
||||
label="设备编号"
|
||||
align="center"
|
||||
prop="equipNo"
|
||||
/>
|
||||
<!-- <el-table-column
|
||||
label="机床组件id"
|
||||
align="center"
|
||||
prop="componentId"
|
||||
/> -->
|
||||
<el-table-column
|
||||
label="规则参数名"
|
||||
align="center"
|
||||
prop="nameKey"
|
||||
/>
|
||||
|
||||
<el-table-column
|
||||
label="最新报警值"
|
||||
align="center"
|
||||
prop="alarmValue"
|
||||
/>
|
||||
<el-table-column
|
||||
label="首次报警时间"
|
||||
align="center"
|
||||
prop="firstAlarmTime"
|
||||
width="180"
|
||||
>
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.firstAlarmTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="最新报警时间"
|
||||
align="center"
|
||||
prop="lastAlarmTime"
|
||||
width="180"
|
||||
>
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.lastAlarmTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="可能故障原因"
|
||||
align="center"
|
||||
prop="reasonDescription"
|
||||
/>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
align="center"
|
||||
class-name="small-padding fixed-width"
|
||||
>
|
||||
<template v-slot="scope">
|
||||
<!-- <el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="openForm(scope.row.alarmRecordId)"
|
||||
v-hasPermi="['imt:alarm-data:update']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['imt:alarm-data:delete']"
|
||||
>删除</el-button> -->
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-data-line"
|
||||
@click="handleAlarmTrend(scope.row.nameKey)"
|
||||
>报警趋势</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-tickets"
|
||||
@click="handleReason"
|
||||
>报警原因参考</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<pagination
|
||||
v-show="thrTotal > 0"
|
||||
:total="thrTotal"
|
||||
:page.sync="thrQueryParams.pageNo"
|
||||
:limit.sync="thrQueryParams.pageSize"
|
||||
@pagination="getThrList"
|
||||
/>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
<div class="company-column-info">
|
||||
<el-tabs
|
||||
type="border-card"
|
||||
v-model="treActiveName"
|
||||
style="height: 100%"
|
||||
>
|
||||
<el-tab-pane
|
||||
label="趋势报警信息"
|
||||
name="trend"
|
||||
>
|
||||
<div class="alarm-info">
|
||||
<el-table
|
||||
v-loading="treLoading"
|
||||
:data="treList"
|
||||
:stripe="true"
|
||||
:show-overflow-tooltip="true"
|
||||
>
|
||||
<el-table-column
|
||||
label="报警内容"
|
||||
align="center"
|
||||
prop="content"
|
||||
/>
|
||||
<el-table-column
|
||||
label="最新报警值"
|
||||
align="center"
|
||||
prop="alarmValue"
|
||||
/>
|
||||
<el-table-column
|
||||
label="等级"
|
||||
align="center"
|
||||
prop="alarmLevel"
|
||||
/>
|
||||
<el-table-column
|
||||
label="客户名"
|
||||
align="center"
|
||||
prop="customerName"
|
||||
/>
|
||||
<el-table-column
|
||||
label="设备型号"
|
||||
align="center"
|
||||
prop="modelName"
|
||||
/>
|
||||
<el-table-column
|
||||
label="设备编号"
|
||||
align="center"
|
||||
prop="equipNo"
|
||||
/>
|
||||
<el-table-column
|
||||
label="机床组件名"
|
||||
align="center"
|
||||
prop="componentName"
|
||||
/>
|
||||
<el-table-column
|
||||
label="规则参数名"
|
||||
align="center"
|
||||
prop="nameKey"
|
||||
/>
|
||||
<el-table-column
|
||||
label="首次报警时间"
|
||||
align="center"
|
||||
prop="firstAlarmTime"
|
||||
width="180"
|
||||
>
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.firstAlarmTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="等级"
|
||||
align="center"
|
||||
prop="alarmLevel"
|
||||
/>
|
||||
<el-table-column
|
||||
label="最新报警时间"
|
||||
align="center"
|
||||
prop="lastAlarmTime"
|
||||
width="180"
|
||||
>
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.lastAlarmTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="可能故障原因"
|
||||
align="center"
|
||||
prop="reasonDescription"
|
||||
/>
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
align="center"
|
||||
prop="createTime"
|
||||
width="180"
|
||||
>
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
align="center"
|
||||
class-name="small-padding fixed-width"
|
||||
>
|
||||
<template v-slot="scope">
|
||||
<!-- <el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="openForm(scope.row.alarmRecordId)"
|
||||
v-hasPermi="['imt:alarm-data:update']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['imt:alarm-data:delete']"
|
||||
>删除</el-button> -->
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-data-line"
|
||||
@click="handleAlarmTrend"
|
||||
>报警趋势</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-tickets"
|
||||
@click="handleReason"
|
||||
>报警原因参考</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<pagination
|
||||
v-show="treTotal > 0"
|
||||
:total="treTotal"
|
||||
:page.sync="treQueryParams.pageNo"
|
||||
:limit.sync="treQueryParams.pageSize"
|
||||
@pagination="getTreList"
|
||||
/>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
<div
|
||||
class="company-column-info"
|
||||
style="text-align: right"
|
||||
>
|
||||
<div class="repair-info">
|
||||
<el-button
|
||||
type="success"
|
||||
@click="handelMaintanence"
|
||||
>
|
||||
维修工单提交</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="handelClose"
|
||||
>
|
||||
关闭</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as AlarmDataApi from "@/api/system/alarm/alarmdata";
|
||||
import AlarmDataForm from "./AlarmDataForm.vue";
|
||||
export default {
|
||||
name: "AlarmData",
|
||||
components: {
|
||||
AlarmDataForm,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
thrLoading: true,
|
||||
treLoading: true,
|
||||
// 导出遮罩层
|
||||
exportLoading: false,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
thrTotal: 0,
|
||||
treTotal: 0,
|
||||
// 机床参数报警记录列表
|
||||
thrList: [],
|
||||
treList: [],
|
||||
// 是否展开,默认全部展开
|
||||
isExpandAll: true,
|
||||
// 重新渲染表格状态
|
||||
refreshTable: true,
|
||||
// 选中行
|
||||
currentRow: {},
|
||||
// 查询参数
|
||||
thrQueryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
alarmRulesId: null,
|
||||
equipId: null,
|
||||
componentId: null,
|
||||
nameKey: null,
|
||||
firstAlarmTime: [],
|
||||
alarmLevel: null,
|
||||
lastAlarmTime: [],
|
||||
createTime: [],
|
||||
equipAlarmId: null,
|
||||
},
|
||||
treQueryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
alarmRulesId: null,
|
||||
equipId: null,
|
||||
componentId: null,
|
||||
nameKey: null,
|
||||
firstAlarmTime: [],
|
||||
alarmLevel: null,
|
||||
lastAlarmTime: [],
|
||||
createTime: [],
|
||||
equipAlarmId: null,
|
||||
},
|
||||
thrActiveName: "threshold",
|
||||
treActiveName: "trend",
|
||||
customerName: null,
|
||||
modelName: null,
|
||||
equipNo: null,
|
||||
alarmLevel: null,
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getThrList();
|
||||
this.getTreList();
|
||||
this.customerName = this.$route.query.customerName;
|
||||
this.modelName = this.$route.query.modelName;
|
||||
this.equipNo = this.$route.query.equipNo;
|
||||
this.alarmLevel = this.$route.query.alarmLevel;
|
||||
},
|
||||
methods: {
|
||||
/**报警原因 */
|
||||
handleReason() {},
|
||||
/**报警趋势 */
|
||||
handleAlarmTrend(key) {},
|
||||
/**
|
||||
* 全部关闭报警
|
||||
*/
|
||||
handelClose() {},
|
||||
/**
|
||||
* 维修工单
|
||||
*/
|
||||
handelMaintanence() {},
|
||||
/** 查询列表 */
|
||||
async getThrList() {
|
||||
try {
|
||||
this.thrLoading = true;
|
||||
const res = await AlarmDataApi.getAlarmDataPage(this.thrQueryParams);
|
||||
this.thrList = res.data.list;
|
||||
this.thrTotal = res.data.total;
|
||||
} finally {
|
||||
this.thrLoading = false;
|
||||
}
|
||||
},
|
||||
async getTreList() {
|
||||
try {
|
||||
this.treLoading = true;
|
||||
const res = await AlarmDataApi.getAlarmDataPage(this.treQueryParams);
|
||||
this.treList = res.data.list;
|
||||
this.treTotal = res.data.total;
|
||||
} finally {
|
||||
this.treLoading = false;
|
||||
}
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 添加/修改操作 */
|
||||
openForm(id) {
|
||||
this.$refs["formRef"].open(id);
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
async handleDelete(row) {
|
||||
const alarmRecordId = row.alarmRecordId;
|
||||
await this.$modal.confirm(
|
||||
'是否确认删除机床参数报警记录编号为"' + alarmRecordId + '"的数据项?'
|
||||
);
|
||||
try {
|
||||
await AlarmDataApi.deleteAlarmData(alarmRecordId);
|
||||
await this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
} catch {}
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
async handleExport() {
|
||||
await this.$modal.confirm("是否确认导出所有机床参数报警记录数据项?");
|
||||
try {
|
||||
this.exportLoading = true;
|
||||
const data = await AlarmDataApi.exportAlarmDataExcel(this.queryParams);
|
||||
this.$download.excel(data, "机床参数报警记录.xls");
|
||||
} catch {
|
||||
} finally {
|
||||
this.exportLoading = false;
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.company-line-wrap-info {
|
||||
height: 100%;
|
||||
display: grid;
|
||||
grid-template-rows: 9% 42% 42% 3%;
|
||||
grid-gap: 1%;
|
||||
//min-height: calc(100vh - 90px);
|
||||
margin: 0 40px;
|
||||
::v-deep .el-form-item--medium .el-form-item__label {
|
||||
line-height: unset;
|
||||
text-align: center;
|
||||
vertical-align: sub;
|
||||
}
|
||||
::v-deep .el-image {
|
||||
width: 80px;
|
||||
}
|
||||
.upload-demo {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
::v-deep .el-upload-list--picture-card .el-upload-list__item {
|
||||
width: 70px;
|
||||
height: 70px;
|
||||
}
|
||||
::v-deep .el-upload--picture-card {
|
||||
width: 74px;
|
||||
height: 54px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
i {
|
||||
font-size: 20px;
|
||||
}
|
||||
}
|
||||
::v-deep .el-tabs__content {
|
||||
height: calc(100% - 38px);
|
||||
overflow-y: scroll;
|
||||
}
|
||||
.company-column-info {
|
||||
padding-top: 10px;
|
||||
border-bottom: 1px solid #0000;
|
||||
padding-bottom: 5px;
|
||||
.alarm-info {
|
||||
height: 50%;
|
||||
// height: calc(100% - 20px - 38px);
|
||||
// ::v-deep .el-table {
|
||||
// overflow-y: scroll;
|
||||
// height: 100%;
|
||||
// }
|
||||
}
|
||||
.diagnose-info {
|
||||
height: calc(100% - 20px - 38px);
|
||||
::v-deep .el-table {
|
||||
overflow-y: scroll;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
.head-info {
|
||||
display: flex;
|
||||
.info {
|
||||
padding: 0 10px 0 0;
|
||||
.title {
|
||||
font-size: 18px;
|
||||
font-weight: bolder;
|
||||
}
|
||||
.content {
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.content-info {
|
||||
display: flex;
|
||||
.info {
|
||||
padding: 5px 10px 0 0;
|
||||
.title {
|
||||
font-size: 18px;
|
||||
font-weight: bolder;
|
||||
}
|
||||
.content {
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
@ -230,7 +230,7 @@
|
||||
class-name="small-padding fixed-width"
|
||||
>
|
||||
<template v-slot="scope">
|
||||
<el-button
|
||||
<!-- <el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@ -243,14 +243,22 @@
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['imt:equip-alarm-data:delete']"
|
||||
>删除</el-button>
|
||||
>删除</el-button> -->
|
||||
<router-link :to="{
|
||||
path: '/alarm/alarmdata',
|
||||
query: {
|
||||
customerName: scope.row.customerName,
|
||||
modelName: scope.row.modelName,
|
||||
equipNo: scope.row.equipNo,
|
||||
alarmLevel: scope.row.alarmLevel,
|
||||
},
|
||||
}">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-data-analysis"
|
||||
@click="openForm(scope.row.equipAlarmId)"
|
||||
v-hasPermi="['imt:equip-alarm-data:update']"
|
||||
>处理</el-button>
|
||||
</router-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
Loading…
Reference in New Issue
Block a user