Compare commits

...

2 Commits

Author SHA1 Message Date
f33a9612f4 故障树接口和菜单 2024-04-15 14:13:39 +08:00
1ff3072ad2 故障树接口和菜单 2024-04-15 14:12:26 +08:00
27 changed files with 3964 additions and 495 deletions

View File

@ -2,6 +2,8 @@ package com.inspur.web.controller.industrial;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.aspectj.weaver.loadtime.Aj;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -46,6 +48,18 @@ public class IpcAlarmRecordController extends BaseController
return getDataTable(list);
}
/**
* 查询所有报警记录
* @param ipcAlarmRecord
* @return
*/
@GetMapping("/listAll")
public AjaxResult listAll(IpcAlarmRecord ipcAlarmRecord)
{
List<IpcAlarmRecord> list = ipcAlarmRecordService.selectIpcAlarmRecordList(ipcAlarmRecord);
return AjaxResult.success(list);
}
/**
* 导出报警记录列表
*/

View File

@ -0,0 +1,118 @@
package com.inspur.web.controller.industrial;
import com.inspur.common.annotation.Log;
import com.inspur.common.core.controller.BaseController;
import com.inspur.common.core.domain.AjaxResult;
import com.inspur.common.enums.BusinessType;
import com.inspur.common.utils.poi.ExcelUtil;
import com.inspur.industrial.domain.IpcFaultTreeConfig;
import com.inspur.industrial.domain.IpcFaultTreeConfig;
import com.inspur.industrial.service.IIpcFaultTreeConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 故障树配置Controller
*
* @author inspur
* @date 2024-04-02
*/
@RestController
@RequestMapping("/ipc/faultTreeConfig")
public class IpcFaultTreeConfigController extends BaseController
{
@Autowired
private IIpcFaultTreeConfigService ipcFaultTreeConfigService;
/**
* 查询故障树配置列表
*/
@PreAuthorize("@ss.hasPermi('ipc:faultTreeConfig:list')")
@GetMapping("/list")
public AjaxResult list(IpcFaultTreeConfig ipcFaultTreeConfig)
{
List<IpcFaultTreeConfig> list = ipcFaultTreeConfigService.selectIpcFaultTreeConfigList(ipcFaultTreeConfig);
return AjaxResult.success(list);
}
/**
* 导出故障树配置列表
*/
@PreAuthorize("@ss.hasPermi('ipc:faultTreeConfig:export')")
@Log(title = "故障树配置", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, IpcFaultTreeConfig ipcFaultTreeConfig)
{
List<IpcFaultTreeConfig> list = ipcFaultTreeConfigService.selectIpcFaultTreeConfigList(ipcFaultTreeConfig);
ExcelUtil<IpcFaultTreeConfig> util = new ExcelUtil<IpcFaultTreeConfig>(IpcFaultTreeConfig.class);
util.exportExcel(response, list, "故障树配置数据");
}
/**
* 获取故障树配置详细信息
*/
@PreAuthorize("@ss.hasPermi('ipc:faultTreeConfig:query')")
@GetMapping(value = "/{nodeId}")
public AjaxResult getInfo(@PathVariable("nodeId") Long nodeId)
{
return AjaxResult.success(ipcFaultTreeConfigService.selectIpcFaultTreeConfigByNodeId(nodeId));
}
/**
* 校验是否存在子节点
*/
@PreAuthorize("@ss.hasPermi('ipc:faultTreeConfig:query')")
@GetMapping(value = "/hasChild/{nodeId}")
public AjaxResult hasChild(@PathVariable("nodeId") Long nodeId)
{
return AjaxResult.success(ipcFaultTreeConfigService.hasChild(nodeId));
}
/**
* 新增故障树配置
*/
@PreAuthorize("@ss.hasPermi('ipc:faultTreeConfig:add')")
@Log(title = "故障树配置", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody IpcFaultTreeConfig ipcFaultTreeConfig)
{
return toAjax(ipcFaultTreeConfigService.insertIpcFaultTreeConfig(ipcFaultTreeConfig));
}
/**
* 修改故障树配置
*/
@PreAuthorize("@ss.hasPermi('ipc:faultTreeConfig:edit')")
@Log(title = "故障树配置", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody IpcFaultTreeConfig ipcFaultTreeConfig)
{
return toAjax(ipcFaultTreeConfigService.updateIpcFaultTreeConfig(ipcFaultTreeConfig));
}
/**
* 删除故障树配置
*/
@PreAuthorize("@ss.hasPermi('ipc:faultTreeConfig:remove')")
@Log(title = "故障树配置", businessType = BusinessType.DELETE)
@DeleteMapping("/{nodeIds}")
public AjaxResult remove(@PathVariable Long[] nodeIds)
{
return toAjax(ipcFaultTreeConfigService.deleteIpcFaultTreeConfigByNodeIds(nodeIds));
}
/**
* 查询故障树查询
*/
@PreAuthorize("@ss.hasPermi('ipc:faultTreeConfig:list')")
@GetMapping("/getFaultTreeShow/{equipId}")
public AjaxResult getFaultTreeShow(@PathVariable("equipId") String equipId)
{
return AjaxResult.success(ipcFaultTreeConfigService.getFaultTreeShow(equipId));
}
}

View File

@ -41,4 +41,9 @@ public class CacheConstants
* 登录账户密码错误次数 redis key
*/
public static final String PWD_ERR_CNT_KEY = "pwd_err_cnt:";
/**
* ipc规则
*/
public static final String IPC_RULES_KEY = "ipc_rules:";
}

View File

@ -1,6 +1,12 @@
package com.inspur.datasyn.modbus;
import com.inspur.common.utils.spring.SpringUtils;
import com.inspur.industrial.domain.IpcAlarmRecord;
import com.inspur.industrial.domain.IpcAlarmRules;
import com.inspur.industrial.service.IIpcAlarmRecordService;
import com.inspur.industrial.service.IIpcAlarmRulesService;
import com.inspur.industrial.utils.Constant;
import com.inspur.industrial.utils.IpcUtil;
import com.inspur.industrial.utils.JudgeUtil;
import com.inspur.system.service.influx.InfluxDBService;
import com.serotonin.modbus4j.BatchRead;
@ -14,9 +20,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
import java.util.TreeMap;
import java.util.*;
public class IPCData2SyncThread implements Runnable {
private static final Logger logger = LoggerFactory.getLogger(IPCDataSyncThread.class);
@ -24,6 +28,8 @@ public class IPCData2SyncThread implements Runnable {
private ModbusMaster master;
private String time;
private static final String EQUIP_ID = "5d6c1a1374ea490a91e1361c1f5400aa";
public IPCData2SyncThread(ModbusMaster master, String time){
this.master = master;
this.time = time;
@ -58,7 +64,11 @@ public class IPCData2SyncThread implements Runnable {
Map<String,String> tags = new TreeMap();
tags.put("equ_id","5d6c1a1374ea490a91e1361c1f5400aa");
Map<String,Object> fields = new TreeMap();
IpcUtil ipcUtil = SpringUtils.getBean(IpcUtil.class);
IIpcAlarmRulesService alarmRulesService = SpringUtils.getBean(IIpcAlarmRulesService.class);
IIpcAlarmRecordService alarmRecordService = SpringUtils.getBean(IIpcAlarmRecordService.class);
List<IpcAlarmRecord> alarmRecordList = new ArrayList<>();
// 系统电流
fields.put("sys_cur",(float) 0 + Math.random());
@ -71,6 +81,12 @@ public class IPCData2SyncThread implements Runnable {
// fields.put("ywcsz",0.5);
// fields.put("ywmin",0.3);
// fields.put("ywmax",1);
//液位最小和最大值通过报警参数设置获取
IpcAlarmRules levelRule = getLevelAlarmRule();
//正式需要放开
fields.put("level_min",levelRule == null ? 0.0 : levelRule.getAlertLowerBound().floatValue());
fields.put("level_max",levelRule == null ? 0.0 : levelRule.getAlertUpperBound().floatValue());
// 系统温度
fields.put("sys_temp",(float) 0 + Math.random());
// 油液颗粒度
@ -133,7 +149,7 @@ public class IPCData2SyncThread implements Runnable {
// 十一压区比例减压阀
fields.put("press11",(float) 0 + Math.random());
// 一压区流量
fields.put("flw1",(float) 0 + Math.random());
fields.put("pre",(float) 0 + Math.random());
// 二压区流量
fields.put("flw2",(float) 0 + Math.random());
// 三压区流量
@ -154,15 +170,34 @@ public class IPCData2SyncThread implements Runnable {
fields.put("flw10",(float) 0 + Math.random());
// 十一压区流量
fields.put("flw11",(float) 0 + Math.random());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
String format = simpleDateFormat.format(new Date());
fields.put("insertTime",format);
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
// String format = simpleDateFormat.format(new Date());
// fields.put("insertTime",format);
//报警处理
List<IpcAlarmRules> rulesList = alarmRulesService.selectIpcAlarmRulesByEquipId(EQUIP_ID);
alarmRecordList.addAll(ipcUtil.dealRealTimeData(fields,tags, Constant.RUNNING,rulesList));
if (!alarmRecordList.isEmpty()){//运行需放开
// alarmRecordService.batchInsertIpcAlarmRecord(alarmRecordList);
}
InfluxDBService i = SpringUtils.getBean(InfluxDBService.class);
// 判断并处理报警数据
// JudgeUtil.judgeAndSaveAlarmData(fields,"2");
i.insert(measurement,tags,fields);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 获取液位的报警规则
* @return
*/
private IpcAlarmRules getLevelAlarmRule(){
IIpcAlarmRulesService ipcAlarmRulesService = SpringUtils.getBean(IIpcAlarmRulesService.class);
IpcAlarmRules query = new IpcAlarmRules();
query.setEquipId(EQUIP_ID);
query.setAlarmNameKey("sys_level");
query.setType(Constant.RUNNING);//运行中
return ipcAlarmRulesService.selectIpcAlarmRulesList(query).get(0) == null ? null : ipcAlarmRulesService.selectIpcAlarmRulesList(query).get(0);
}
}

View File

@ -1,6 +1,12 @@
package com.inspur.datasyn.modbus;
import com.inspur.common.utils.spring.SpringUtils;
import com.inspur.industrial.domain.IpcAlarmRecord;
import com.inspur.industrial.domain.IpcAlarmRules;
import com.inspur.industrial.service.IIpcAlarmRecordService;
import com.inspur.industrial.service.IIpcAlarmRulesService;
import com.inspur.industrial.utils.Constant;
import com.inspur.industrial.utils.IpcUtil;
import com.inspur.industrial.utils.JudgeUtil;
import com.inspur.system.service.influx.InfluxDBService;
import com.serotonin.modbus4j.BatchRead;
@ -14,9 +20,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
import java.util.TreeMap;
import java.util.*;
public class IPCData3SyncThread implements Runnable {
private static final Logger logger = LoggerFactory.getLogger(IPCDataSyncThread.class);
@ -24,6 +28,8 @@ public class IPCData3SyncThread implements Runnable {
private ModbusMaster master;
private String time;
private static final String EQUIP_ID = "8b2d5cb04e254c15ade1e53a4f594f3f";
public IPCData3SyncThread(ModbusMaster master, String time){
this.master = master;
this.time = time;
@ -59,6 +65,12 @@ public class IPCData3SyncThread implements Runnable {
tags.put("equ_id","8b2d5cb04e254c15ade1e53a4f594f3f");
Map<String,Object> fields = new TreeMap();
IpcUtil ipcUtil = SpringUtils.getBean(IpcUtil.class);
IIpcAlarmRulesService alarmRulesService = SpringUtils.getBean(IIpcAlarmRulesService.class);
IIpcAlarmRecordService alarmRecordService = SpringUtils.getBean(IIpcAlarmRecordService.class);
List<IpcAlarmRecord> alarmRecordList = new ArrayList<>();
// 系统电流
fields.put("sys_cur",(float) 0 + Math.random());
// 系统流量
@ -70,6 +82,13 @@ public class IPCData3SyncThread implements Runnable {
// fields.put("ywcsz",0.5);
// fields.put("ywmin",0.3);
// fields.put("ywmax",1);
//液位最小和最大值通过报警参数设置获取
IpcAlarmRules levelRule = getLevelAlarmRule();
//正式需要放开
fields.put("level_min",levelRule == null ? 0.0 : levelRule.getAlertLowerBound().floatValue());
fields.put("level_max",levelRule == null ? 0.0 : levelRule.getAlertUpperBound().floatValue());
// 系统温度
fields.put("sys_temp",(float) 0 + Math.random());
// 油液颗粒度
@ -128,9 +147,16 @@ public class IPCData3SyncThread implements Runnable {
// 十一压区流量
fields.put("flw11",(float) 0 + Math.random());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
String format = simpleDateFormat.format(new Date());
fields.put("insertTime",format);
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
// String format = simpleDateFormat.format(new Date());
// fields.put("insertTime",format);
//报警处理
List<IpcAlarmRules> rulesList = alarmRulesService.selectIpcAlarmRulesByEquipId(EQUIP_ID);
alarmRecordList.addAll(ipcUtil.dealRealTimeData(fields,tags, Constant.RUNNING,rulesList));
if (!alarmRecordList.isEmpty()){//运行需放开
// alarmRecordService.batchInsertIpcAlarmRecord(alarmRecordList);
}
InfluxDBService i = SpringUtils.getBean(InfluxDBService.class);
// 判断并处理报警数据
// JudgeUtil.judgeAndSaveAlarmData(fields,"3");
@ -139,4 +165,12 @@ public class IPCData3SyncThread implements Runnable {
e.printStackTrace();
}
}
private IpcAlarmRules getLevelAlarmRule(){
IIpcAlarmRulesService ipcAlarmRulesService = SpringUtils.getBean(IIpcAlarmRulesService.class);
IpcAlarmRules query = new IpcAlarmRules();
query.setEquipId(EQUIP_ID);
query.setAlarmNameKey("sys_level");
query.setType(Constant.RUNNING);//运行中
return ipcAlarmRulesService.selectIpcAlarmRulesList(query).get(0) == null ? null : ipcAlarmRulesService.selectIpcAlarmRulesList(query).get(0);
}
}

View File

@ -180,9 +180,9 @@ public class IPCDataSyncThread implements Runnable {
// // DS软辊加压压力
// fields.put("dsrgjyyl",0.4);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
String format = simpleDateFormat.format(new Date());
tags.put("insertTime",format);
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
// String format = simpleDateFormat.format(new Date());
// tags.put("insertTime",format);
//报警处理
List<IpcAlarmRules> rulesList = alarmRulesService.selectIpcAlarmRulesByEquipId(EQUIP_ID);
@ -190,7 +190,7 @@ public class IPCDataSyncThread implements Runnable {
i.insert(measurement,tags,fields);
if (!alarmRecordList.isEmpty()){//运行需放开
//alarmRecordService.batchInsertIpcAlarmRecord(alarmRecordList);
// alarmRecordService.batchInsertIpcAlarmRecord(alarmRecordList);
}
} catch (Exception e) {
e.printStackTrace();

View File

@ -34,6 +34,11 @@ public class IpcAlarmRecord extends BaseEntity
@Excel(name = "传感器id")
private String sensorId;
/**
* 参数key值
*/
private String nameKey;
/** 报警内容 */
@Excel(name = "报警内容")
private String content;
@ -43,8 +48,8 @@ public class IpcAlarmRecord extends BaseEntity
private BigDecimal alarmValue;
/** 报警时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "报警时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:SS")
@Excel(name = "报警时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:SS")
private Date alarmTime;
/** 处理结果 */
@ -112,6 +117,14 @@ public class IpcAlarmRecord extends BaseEntity
this.content = content;
}
public String getNameKey() {
return nameKey;
}
public void setNameKey(String nameKey) {
this.nameKey = nameKey;
}
public String getContent()
{
return content;
@ -170,21 +183,21 @@ public class IpcAlarmRecord extends BaseEntity
this.alarmLevel = alarmLevel;
}
public IpcEquipInfo getEquipInfo() {
return equipInfo;
}
public void setEquipInfo(IpcEquipInfo equipInfo) {
this.equipInfo = equipInfo;
}
public IpcAlarmRules getAlarmRules() {
return alarmRules;
}
public void setAlarmRules(IpcAlarmRules alarmRules) {
this.alarmRules = alarmRules;
}
// public IpcEquipInfo getEquipInfo() {
// return equipInfo;
// }
//
// public void setEquipInfo(IpcEquipInfo equipInfo) {
// this.equipInfo = equipInfo;
// }
//
// public IpcAlarmRules getAlarmRules() {
// return alarmRules;
// }
//
// public void setAlarmRules(IpcAlarmRules alarmRules) {
// this.alarmRules = alarmRules;
// }
public String[] getIds() {
return ids;
@ -201,6 +214,7 @@ public class IpcAlarmRecord extends BaseEntity
.append("alarmRulesId", getAlarmRulesId())
.append("equipId", getEquipId())
.append("sensorId", getSensorId())
.append("nameKey", getNameKey())
.append("content", getContent())
.append("alarmValue", getAlarmValue())
.append("alarmTime", getAlarmTime())

View File

@ -0,0 +1,212 @@
package com.inspur.industrial.domain;
import com.inspur.common.annotation.Excel;
import com.inspur.common.core.domain.TreeEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 故障树配置对象 ipc_fault_tree_config
*
* @author inspur
* @date 2024-04-02
*/
public class IpcFaultTreeConfig extends TreeEntity
{
private static final long serialVersionUID = 1L;
/** 节点id */
private Long nodeId;
/** 部门名称 */
@Excel(name = "节点名称")
private String nodeName;
/** 所属部位 */
@Excel(name = "所属设备id")
private String equipId;
/** 规则id */
@Excel(name = "规则id")
private String alarmRuleConfigId;
/** 规则描述 */
@Excel(name = "规则描述")
private String alarmRuleConfigDescription;
/** 节点图标 */
@Excel(name = "节点图标")
private String iconCls;
/** 节点形状 */
@Excel(name = "节点形状")
private String nodeShapeType;
/** 节点默认颜色 */
@Excel(name = "节点默认颜色")
private String nodeDefaultColor;
/** 节点报警颜色 */
@Excel(name = "节点报警颜色")
private String nodeAlarmColor;
/** 是否叶子节点 */
@Excel(name = "是否叶子节点")
private String isLeaf;
/** 是否报警 */
@Excel(name = "是否报警")
private String isAlarm;
/** 节点状态0正常 1停用 */
@Excel(name = "节点状态", readConverterExp = "0=正常,1=停用")
private String status;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
public void setNodeId(Long nodeId)
{
this.nodeId = nodeId;
}
public Long getNodeId()
{
return nodeId;
}
public void setNodeName(String nodeName)
{
this.nodeName = nodeName;
}
public String getNodeName()
{
return nodeName;
}
public void setEquipId(String equipId)
{
this.equipId = equipId;
}
public String getEquipId()
{
return equipId;
}
public void setIconCls(String iconCls)
{
this.iconCls = iconCls;
}
public String getIconCls()
{
return iconCls;
}
public void setNodeShapeType(String nodeShapeType)
{
this.nodeShapeType = nodeShapeType;
}
public String getNodeShapeType()
{
return nodeShapeType;
}
public void setNodeDefaultColor(String nodeDefaultColor)
{
this.nodeDefaultColor = nodeDefaultColor;
}
public String getNodeDefaultColor()
{
return nodeDefaultColor;
}
public void setNodeAlarmColor(String nodeAlarmColor)
{
this.nodeAlarmColor = nodeAlarmColor;
}
public String getNodeAlarmColor()
{
return nodeAlarmColor;
}
public void setIsAlarm(String isAlarm)
{
this.isAlarm = isAlarm;
}
public String getIsAlarm()
{
return isAlarm;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag()
{
return delFlag;
}
public String getAlarmRuleConfigId() {
return alarmRuleConfigId;
}
public void setAlarmRuleConfigId(String alarmRuleConfigId) {
this.alarmRuleConfigId = alarmRuleConfigId;
}
public String getAlarmRuleConfigDescription() {
return alarmRuleConfigDescription;
}
public void setAlarmRuleConfigDescription(String alarmRuleConfigDescription) {
this.alarmRuleConfigDescription = alarmRuleConfigDescription;
}
public String getIsLeaf() {
return isLeaf;
}
public void setIsLeaf(String isLeaf) {
this.isLeaf = isLeaf;
}
public IpcFaultTreeConfig() {
}
public IpcFaultTreeConfig(String equipId) {
this.equipId = equipId;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("nodeId", getNodeId())
.append("parentId", getParentId())
.append("ancestors", getAncestors())
.append("nodeName", getNodeName())
.append("orderNum", getOrderNum())
.append("equipId", getEquipId())
.append("iconCls", getIconCls())
.append("nodeShapeType", getNodeShapeType())
.append("nodeDefaultColor", getNodeDefaultColor())
.append("nodeAlarmColor", getNodeAlarmColor())
.append("isAlarm", getIsAlarm())
.append("status", getStatus())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -0,0 +1,131 @@
package com.inspur.industrial.domain;
import com.inspur.common.core.domain.TreeEntity;
/**
* 故障树配置对象 ipc_fault_tree_config
*
* @author inspur
* @date 2024-04-02
*/
public class IpcFaultTreeShow extends TreeEntity {
private static final long serialVersionUID = 1L;
/**
* 节点id
*/
private Long nodeId;
/**
* 节点名称
*/
private String label;
/**
* 节点内容
*/
private String content;
/**
* 节点描述
*/
private String nodeDsc;
/**
* 节点图标
*/
private String iconCls;
/**
* 节点边框颜色
*/
private String nodeBorderColor;
/**
* 节点形状
*/
private String nodeShapeType;
/**
* 节点文字颜色
*/
private String nodeFontColor;
public Long getNodeId() {
return nodeId;
}
public void setNodeId(Long nodeId) {
this.nodeId = nodeId;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getNodeDsc() {
return nodeDsc;
}
public void setNodeDsc(String nodeDsc) {
this.nodeDsc = nodeDsc;
}
public String getIconCls() {
return iconCls;
}
public void setIconCls(String iconCls) {
this.iconCls = iconCls;
}
public String getNodeBorderColor() {
return nodeBorderColor;
}
public void setNodeBorderColor(String nodeBorderColor) {
this.nodeBorderColor = nodeBorderColor;
}
public String getNodeShapeType() {
return nodeShapeType;
}
public void setNodeShapeType(String nodeShapeType) {
this.nodeShapeType = nodeShapeType;
}
public String getNodeFontColor() {
return nodeFontColor;
}
public void setNodeFontColor(String nodeFontColor) {
this.nodeFontColor = nodeFontColor;
}
@Override
public String toString() {
return "IpcFaultTreeShow{" +
"nodeId=" + nodeId +
", label='" + label + '\'' +
", content='" + content + '\'' +
", nodeDsc='" + nodeDsc + '\'' +
", iconCls='" + iconCls + '\'' +
", nodeBorderColor='" + nodeBorderColor + '\'' +
", nodeShapeType='" + nodeShapeType + '\'' +
", nodeFontColor='" + nodeFontColor + '\'' +
'}';
}
}

View File

@ -0,0 +1,75 @@
package com.inspur.industrial.mapper;
import com.inspur.industrial.domain.IpcFaultTreeConfig;
import java.util.List;
/**
* 故障树配置Mapper接口
*
* @author inspur
* @date 2024-04-02
*/
public interface IpcFaultTreeConfigMapper
{
/**
* 查询故障树配置
*
* @param nodeId 故障树配置主键
* @return 故障树配置
*/
public IpcFaultTreeConfig selectIpcFaultTreeConfigByNodeId(Long nodeId);
/**
* 校验是否存在子节点
*
* @param nodeId 故障树配置主键
* @return 故障树配置
*/
public int hasChild(Long nodeId);
/**
* 查询故障树配置列表
*
* @param ipcFaultTreeConfig 故障树配置
* @return 故障树配置集合
*/
public List<IpcFaultTreeConfig> selectIpcFaultTreeConfigList(IpcFaultTreeConfig ipcFaultTreeConfig);
/**
* 新增故障树配置
*
* @param ipcFaultTreeConfig 故障树配置
* @return 结果
*/
public int insertIpcFaultTreeConfig(IpcFaultTreeConfig ipcFaultTreeConfig);
/**
* 修改故障树配置
*
* @param ipcFaultTreeConfig 故障树配置
* @return 结果
*/
public int updateIpcFaultTreeConfig(IpcFaultTreeConfig ipcFaultTreeConfig);
/**
* 删除故障树配置
*
* @param nodeId 故障树配置主键
* @return 结果
*/
public int deleteIpcFaultTreeConfigByNodeId(Long nodeId);
/**
* 批量删除故障树配置
*
* @param nodeIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteIpcFaultTreeConfigByNodeIds(Long[] nodeIds);
/**
* 查询故障树查询
*/
public List<IpcFaultTreeConfig> getFaultTreeShow(String equipId);
}

View File

@ -64,5 +64,13 @@ public interface IIpcAlarmRulesService
* @return 结果
*/
public int deleteIpcAlarmRulesById(String id);
/**
* 获取告警规则缓存
*
* @param part 监测部位
* @return 告警规则配置集合
*/
public List<IpcAlarmRules> selectIpcAlarmRulesConfigListByCache(String equipId);
}

View File

@ -0,0 +1,76 @@
package com.inspur.industrial.service;
import com.inspur.industrial.domain.IpcFaultTreeConfig;
import java.util.List;
/**
* 故障树配置Service接口
*
* @author inspur
* @date 2024-04-02
*/
public interface IIpcFaultTreeConfigService
{
/**
* 查询故障树配置
*
* @param nodeId 故障树配置主键
* @return 故障树配置
*/
public IpcFaultTreeConfig selectIpcFaultTreeConfigByNodeId(Long nodeId);
/**
* 校验是否存在子节点
*
* @param nodeId 故障树配置主键
* @return 故障树配置
*/
public boolean hasChild(Long nodeId);
/**
* 查询故障树配置列表
*
* @param ipcFaultTreeConfig 故障树配置
* @return 故障树配置集合
*/
public List<IpcFaultTreeConfig> selectIpcFaultTreeConfigList(IpcFaultTreeConfig ipcFaultTreeConfig);
/**
* 新增故障树配置
*
* @param ipcFaultTreeConfig 故障树配置
* @return 结果
*/
public int insertIpcFaultTreeConfig(IpcFaultTreeConfig ipcFaultTreeConfig);
/**
* 修改故障树配置
*
* @param ipcFaultTreeConfig 故障树配置
* @return 结果
*/
public int updateIpcFaultTreeConfig(IpcFaultTreeConfig ipcFaultTreeConfig);
/**
* 批量删除故障树配置
*
* @param nodeIds 需要删除的故障树配置主键集合
* @return 结果
*/
public int deleteIpcFaultTreeConfigByNodeIds(Long[] nodeIds);
/**
* 删除故障树配置信息
*
* @param nodeId 故障树配置主键
* @return 结果
*/
public int deleteIpcFaultTreeConfigByNodeId(Long nodeId);
/**
* 查询故障树查询
*/
public List<IpcFaultTreeConfig> getFaultTreeShow(String equipId);
}

View File

@ -412,6 +412,8 @@ public class DataQueryService implements IDataQueryService {
resMap.put("syslevel", list.get(0).get("sys_level"));//系统液位
resMap.put("syslevelinit", Integer.parseInt(sysConfigService.selectConfigByKey("sys.liquidlevel.init")));//液位初始值
//TODO 获取系统液位高值和低值
resMap.put("levelmax", list.get(0).get("level_max"));
resMap.put("levelmin", list.get(0).get("level_min"));
resMap.put("systemp",list.get(0).get("sys_temp"));//系统温度
resMap.put("syshumid",list.get(0).get("oil_water"));//系统湿度

View File

@ -4,7 +4,11 @@ import java.math.BigDecimal;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import com.inspur.common.constant.CacheConstants;
import com.inspur.common.core.redis.RedisCache;
import com.inspur.common.utils.uuid.IdUtils;
import com.inspur.equip.domain.IpcEquipInfo;
import com.inspur.equip.service.IIpcEquipInfoService;
import com.inspur.industrial.domain.IpcMonitorDataInfo;
import com.inspur.industrial.service.IIpcMonitorDataInfoService;
import org.springframework.beans.factory.annotation.Autowired;
@ -13,6 +17,7 @@ import com.inspur.industrial.mapper.IpcAlarmRulesMapper;
import com.inspur.industrial.domain.IpcAlarmRules;
import com.inspur.industrial.service.IIpcAlarmRulesService;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
/**
@ -30,6 +35,23 @@ public class IpcAlarmRulesServiceImpl implements IIpcAlarmRulesService
@Resource
private IIpcMonitorDataInfoService ipcMonitorDataInfoService;
@Resource
private RedisCache redisCache;
@Resource
private IIpcEquipInfoService ipcEquipInfoService;
//加载规则到缓存
@PostConstruct
public void init(){
List<IpcAlarmRules> rules = selectIpcAlarmRulesList(null);
List<IpcEquipInfo> equips = ipcEquipInfoService.selectIpcEquipInfoList(null);
for (IpcEquipInfo equip : equips) {
List<IpcAlarmRules> rulesByEquipId = selectIpcAlarmRulesByEquipId(equip.getId());
redisCache.setCacheObject(CacheConstants.IPC_RULES_KEY+equip.getId(),rulesByEquipId);
}
}
/**
* 查询设备报警规则
*
@ -86,7 +108,7 @@ public class IpcAlarmRulesServiceImpl implements IIpcAlarmRulesService
//
// });
// }
//TODO 新增删除更新redis
/**
* 新增设备报警规则
*
@ -108,7 +130,12 @@ public class IpcAlarmRulesServiceImpl implements IIpcAlarmRulesService
@Override
public int updateIpcAlarmRules(IpcAlarmRules ipcAlarmRules)
{
return ipcAlarmRulesMapper.updateIpcAlarmRules(ipcAlarmRules);
int num = ipcAlarmRulesMapper.updateIpcAlarmRules(ipcAlarmRules);
if (num > 0){
List<IpcAlarmRules> rules = selectIpcAlarmRulesByEquipId(ipcAlarmRules.getEquipId());
redisCache.setCacheObject(CacheConstants.IPC_RULES_KEY + ipcAlarmRules.getEquipId(),rules);
}
return num;
}
/**
@ -134,5 +161,22 @@ public class IpcAlarmRulesServiceImpl implements IIpcAlarmRulesService
{
return ipcAlarmRulesMapper.deleteIpcAlarmRulesById(id);
}
/**
* 获取告警规则缓存
*
* @param part 监测部位
* @return 告警规则配置集合
*/
@Override
public List<IpcAlarmRules> selectIpcAlarmRulesConfigListByCache(String equipId){
List<IpcAlarmRules> rules = redisCache.getCacheList(CacheConstants.IPC_RULES_KEY + equipId);
if (rules == null || rules.size() == 0){
List<IpcAlarmRules> rulesList = selectIpcAlarmRulesByEquipId(equipId);
redisCache.setCacheList(CacheConstants.IPC_RULES_KEY + equipId,rulesList);
return rulesList;
}
return rules;
}
}

View File

@ -0,0 +1,123 @@
package com.inspur.industrial.service.impl;
import com.inspur.common.constant.UserConstants;
import com.inspur.common.exception.ServiceException;
import com.inspur.common.utils.DateUtils;
import com.inspur.industrial.domain.IpcFaultTreeConfig;
import com.inspur.industrial.mapper.IpcFaultTreeConfigMapper;
import com.inspur.industrial.service.IIpcFaultTreeConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 故障树配置Service业务层处理
*
* @author inspur
* @date 2024-04-02
*/
@Service
public class IpcFaultTreeConfigServiceImpl implements IIpcFaultTreeConfigService
{
@Autowired
private IpcFaultTreeConfigMapper ipcFaultTreeConfigMapper;
/**
* 查询故障树配置
*
* @param nodeId 故障树配置主键
* @return 故障树配置
*/
@Override
public IpcFaultTreeConfig selectIpcFaultTreeConfigByNodeId(Long nodeId)
{
return ipcFaultTreeConfigMapper.selectIpcFaultTreeConfigByNodeId(nodeId);
}
/**
* 校验是否存在子节点
*
* @param nodeId 故障树配置主键
* @return 故障树配置
*/
@Override
public boolean hasChild(Long nodeId){
return ipcFaultTreeConfigMapper.hasChild(nodeId) > 0;
}
/**
* 查询故障树配置列表
*
* @param ipcFaultTreeConfig 故障树配置
* @return 故障树配置
*/
@Override
public List<IpcFaultTreeConfig> selectIpcFaultTreeConfigList(IpcFaultTreeConfig ipcFaultTreeConfig)
{
return ipcFaultTreeConfigMapper.selectIpcFaultTreeConfigList(ipcFaultTreeConfig);
}
/**
* 新增故障树配置
*
* @param ipcFaultTreeConfig 故障树配置
* @return 结果
*/
@Override
public int insertIpcFaultTreeConfig(IpcFaultTreeConfig ipcFaultTreeConfig)
{
IpcFaultTreeConfig parentInfo = ipcFaultTreeConfigMapper.selectIpcFaultTreeConfigByNodeId(ipcFaultTreeConfig.getParentId());
// 如果父节点不为正常状态,则不允许新增子节点
if (!UserConstants.DEPT_NORMAL.equals(parentInfo.getStatus()))
{
throw new ServiceException("父节点停用,不允许新增");
}
ipcFaultTreeConfig.setAncestors(parentInfo.getAncestors()+","+ipcFaultTreeConfig.getParentId());
ipcFaultTreeConfig.setCreateTime(DateUtils.getNowDate());
return ipcFaultTreeConfigMapper.insertIpcFaultTreeConfig(ipcFaultTreeConfig);
}
/**
* 修改故障树配置
*
* @param ipcFaultTreeConfig 故障树配置
* @return 结果
*/
@Override
public int updateIpcFaultTreeConfig(IpcFaultTreeConfig ipcFaultTreeConfig)
{
ipcFaultTreeConfig.setUpdateTime(DateUtils.getNowDate());
return ipcFaultTreeConfigMapper.updateIpcFaultTreeConfig(ipcFaultTreeConfig);
}
/**
* 批量删除故障树配置
*
* @param nodeIds 需要删除的故障树配置主键
* @return 结果
*/
@Override
public int deleteIpcFaultTreeConfigByNodeIds(Long[] nodeIds)
{
return ipcFaultTreeConfigMapper.deleteIpcFaultTreeConfigByNodeIds(nodeIds);
}
/**
* 删除故障树配置信息
*
* @param nodeId 故障树配置主键
* @return 结果
*/
@Override
public int deleteIpcFaultTreeConfigByNodeId(Long nodeId)
{
return ipcFaultTreeConfigMapper.deleteIpcFaultTreeConfigByNodeId(nodeId);
}
/**
* 查询故障树
*/
@Override
public List<IpcFaultTreeConfig> getFaultTreeShow(String equipId){
return ipcFaultTreeConfigMapper.getFaultTreeShow(equipId);
}
}

View File

@ -81,6 +81,7 @@ public class IpcUtil {
String name = rule.getAlarmNameKey();
double value = (double) map.get(name);
ipcAlarmRecord.setAlarmValue(BigDecimal.valueOf(value));
ipcAlarmRecord.setNameKey(name);
ipcAlarmRecord.setContent(rule.getReferenceName());
ipcAlarmRecord.setStatus(0);
ipcAlarmRecord.setOperator(1L);

View File

@ -8,6 +8,7 @@
<result property="alarmRulesId" column="alarm_rules_id" />
<result property="equipId" column="equip_id" />
<result property="sensorId" column="sensor_id" />
<result property="nameKey" column="name_key" />
<result property="content" column="content" />
<result property="alarmValue" column="alarm_value" />
<result property="alarmTime" column="alarm_time" />
@ -48,7 +49,7 @@
</resultMap>
<sql id="selectIpcAlarmRecordVo">
select a.id, a.alarm_rules_id, a.equip_id, a.sensor_id, a.content, a.alarm_value, a.alarm_time, a.result, a.status, a.operator, a.alarm_level,
select a.id, a.alarm_rules_id, a.equip_id, a.sensor_id,a.name_key, a.content, a.alarm_value, a.alarm_time, a.result, a.status, a.operator, a.alarm_level,
b.equip_name,b.equip_num,
c.alarm_name,c.alarm_info_unit
from ipc_alarm_record a
@ -62,6 +63,7 @@
<if test="alarmRulesId != null and alarmRulesId != ''"> and a.alarm_rules_id = #{alarmRulesId}</if>
<if test="equipId != null and equipId != ''"> and a.equip_id = #{equipId}</if>
<if test="sensorId != null and sensorId != ''"> and a.sensor_id = #{sensorId}</if>
<if test="nameKey != null and nameKey != ''"> and a.name_key = #{nameKey}</if>
<if test="content != null and content != ''"> and a.content = #{content}</if>
<if test="alarmValue != null "> and a.alarm_value = #{alarmValue}</if>
<if test="result != null and result != ''"> and a.result = #{result}</if>
@ -85,6 +87,7 @@
<if test="alarmRulesId != null">alarm_rules_id,</if>
<if test="equipId != null">equip_id,</if>
<if test="sensorId != null">sensor_id,</if>
<if test="nameKey != null">name_key,</if>
<if test="content != null">content,</if>
<if test="alarmValue != null">alarm_value,</if>
<if test="alarmTime != null">alarm_time,</if>
@ -97,6 +100,7 @@
<if test="alarmRulesId != null">#{alarmRulesId},</if>
<if test="equipId != null">#{equipId},</if>
<if test="sensorId != null">#{sensorId},</if>
<if test="nameKey != null">#{nameKey},</if>
<if test="content != null">#{content},</if>
<if test="alarmValue != null">#{alarmValue},</if>
<if test="alarmTime != null">#{alarmTime},</if>
@ -109,21 +113,20 @@
<!-- 批量新增报警记录 batchInsertIpcAlarmRecord-->
<insert id="batchInsertIpcAlarmRecord" parameterType="java.util.List">
insert into ipc_alarm_record
(alarm_rules_id,equip_id,sensor_id,content,alarm_value,alarm_time,status,operator,alarm_level)
insert into ipc_alarm_record(alarm_rules_id,equip_id,sensor_id,name_key,content,alarm_value,alarm_time,status,operator,alarm_level)
values
<foreach collection="list" item="item" separator=",">
(#{item.alarmRulesId},
#{item.equipId},
#{item.sensorId},
#{item.nameKey},
#{item.content},
#{item.alarmValue},
#{item.alarmTime},
#{item.status},
#{item.operator}
#{item.operator},
#{item.alarmLevel})
</foreach>
;
</insert>
<update id="updateIpcAlarmRecord" parameterType="IpcAlarmRecord">
@ -132,6 +135,7 @@
<if test="alarmRulesId != null">alarm_rules_id = #{alarmRulesId},</if>
<if test="equipId != null">equip_id = #{equipId},</if>
<if test="sensorId != null">sensor_id = #{sensorId},</if>
<if test="nameKey != null">name_key = #{nameKey},</if>
<if test="content != null">content = #{content},</if>
<if test="alarmValue != null">alarm_value = #{alarmValue},</if>
<if test="alarmTime != null">alarm_time = #{alarmTime},</if>

View File

@ -42,8 +42,8 @@
<if test="referenceCon != null and referenceCon != ''"> and reference_con = #{referenceCon}</if>
<if test="alarmLevel != null "> and alarm_level = #{alarmLevel}</if>
<if test="sort != null "> and sort = #{sort}</if>
order by type
</where>
order by type
</select>
<select id="selectIpcAlarmRulesById" parameterType="String" resultMap="IpcAlarmRulesResult">

View File

@ -0,0 +1,221 @@
<?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.industrial.mapper.IpcFaultTreeConfigMapper">
<resultMap type="com.inspur.industrial.domain.IpcFaultTreeConfig" id="IpcFaultTreeConfigResult">
<result property="nodeId" column="node_id"/>
<result property="parentId" column="parent_id"/>
<result property="ancestors" column="ancestors"/>
<result property="nodeName" column="node_name"/>
<result property="orderNum" column="order_num"/>
<result property="equipId" column="equip_id"/>
<result property="iconCls" column="icon_cls"/>
<result property="nodeShapeType" column="node_shape_type"/>
<result property="nodeDefaultColor" column="node_default_color"/>
<result property="nodeAlarmColor" column="node_alarm_color"/>
<result property="isLeaf" column="is_leaf"/>
<result property="isAlarm" column="is_alarm"/>
<result property="alarmRuleConfigId" column="alarm_rule_config_id"/>
<result property="alarmRuleConfigDescription" column="alarm_rule_config_description"/>
<result property="status" column="status"/>
<result property="delFlag" column="del_flag"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<sql id="selectIpcFaultTreeConfigVo">
select node_id,
parent_id,
ancestors,
node_name,
order_num,
equip_id,
icon_cls,
node_shape_type,
node_default_color,
node_alarm_color,
is_leaf,
is_alarm,
status,
del_flag,
create_by,
create_time,
update_by,
update_time,
alarm_rule_config_id,
alarm_rule_config_description
from ipc_fault_tree_config
</sql>
<select id="selectIpcFaultTreeConfigList" parameterType="com.inspur.industrial.domain.IpcFaultTreeConfig"
resultMap="IpcFaultTreeConfigResult">
<include refid="selectIpcFaultTreeConfigVo"/>
<where>
<if test="parentId != null ">and parent_id = #{parentId}</if>
<if test="ancestors != null and ancestors != ''">and ancestors = #{ancestors}</if>
<if test="nodeName != null and nodeName != ''">and node_name like concat('%', #{nodeName}, '%')</if>
<if test="orderNum != null ">and order_num = #{orderNum}</if>
<if test="equipId != null and equipId != ''">and equip_id = #{equipId}</if>
<if test="iconCls != null and iconCls != ''">and icon_cls = #{iconCls}</if>
<if test="nodeShapeType != null and nodeShapeType != ''">and node_shape_type = #{nodeShapeType}</if>
<if test="nodeDefaultColor != null and nodeDefaultColor != ''">and node_default_color =
#{nodeDefaultColor}
</if>
<if test="nodeAlarmColor != null and nodeAlarmColor != ''">and node_alarm_color = #{nodeAlarmColor}</if>
<if test="isAlarm != null and isAlarm != ''">and is_alarm = #{isAlarm}</if>
<if test="status != null and status != ''">and status = #{status}</if>
</where>
order by parent_id,order_num
</select>
<select id="selectIpcFaultTreeConfigByNodeId" parameterType="Long" resultMap="IpcFaultTreeConfigResult">
<include refid="selectIpcFaultTreeConfigVo"/>
where node_id = #{nodeId}
</select>
<select id="hasChild" parameterType="Long" resultType="int">
select count(0)
from ipc_fault_tree_config
where parent_id = #{nodeId}
</select>
<insert id="insertIpcFaultTreeConfig" parameterType="com.inspur.industrial.domain.IpcFaultTreeConfig"
useGeneratedKeys="true" keyProperty="nodeId">
insert into ipc_fault_tree_config
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="parentId != null">parent_id,</if>
<if test="ancestors != null">ancestors,</if>
<if test="nodeName != null">node_name,</if>
<if test="orderNum != null">order_num,</if>
<if test="equipId != null">equip_id,</if>
<if test="iconCls != null">icon_cls,</if>
<if test="nodeShapeType != null">node_shape_type,</if>
<if test="nodeDefaultColor != null">node_default_color,</if>
<if test="nodeAlarmColor != null">node_alarm_color,</if>
<if test="isLeaf != null">is_leaf,</if>
<if test="isAlarm != null">is_alarm,</if>
<if test="status != null">status,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="alarmRuleConfigId != null">alarm_rule_config_id,</if>
<if test="alarmRuleConfigDescription != null">alarm_rule_config_description,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="parentId != null">#{parentId},</if>
<if test="ancestors != null">#{ancestors},</if>
<if test="nodeName != null">#{nodeName},</if>
<if test="orderNum != null">#{orderNum},</if>
<if test="equipId != null">#{equipId},</if>
<if test="iconCls != null">#{iconCls},</if>
<if test="nodeShapeType != null">#{nodeShapeType},</if>
<if test="nodeDefaultColor != null">#{nodeDefaultColor},</if>
<if test="nodeAlarmColor != null">#{nodeAlarmColor},</if>
<if test="isLeaf != null">#{isLeaf},</if>
<if test="isAlarm != null">#{isAlarm},</if>
<if test="status != null">#{status},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="alarmRuleConfigId != null">#{alarmRuleConfigId},</if>
<if test="alarmRuleConfigDescription != null">#{alarmRuleConfigDescription},</if>
</trim>
</insert>
<update id="updateIpcFaultTreeConfig" parameterType="com.inspur.industrial.domain.IpcFaultTreeConfig">
update ipc_fault_tree_config
<trim prefix="SET" suffixOverrides=",">
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="ancestors != null">ancestors = #{ancestors},</if>
<if test="nodeName != null">node_name = #{nodeName},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
<if test="equipId != null">equip_id = #{equipId},</if>
<if test="iconCls != null">icon_cls = #{iconCls},</if>
<if test="nodeShapeType != null">node_shape_type = #{nodeShapeType},</if>
<if test="nodeDefaultColor != null">node_default_color = #{nodeDefaultColor},</if>
<if test="nodeAlarmColor != null">node_alarm_color = #{nodeAlarmColor},</if>
<if test="isLeaf != null">is_leaf = #{isLeaf},</if>
<if test="isAlarm != null">is_alarm = #{isAlarm},</if>
<if test="status != null">status = #{status},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="alarmRuleConfigId != null">alarm_rule_config_id = #{alarmRuleConfigId},</if>
<if test="alarmRuleConfigDescription != null">alarm_rule_config_description =
#{alarmRuleConfigDescription},
</if>
</trim>
where node_id = #{nodeId}
</update>
<delete id="deleteIpcFaultTreeConfigByNodeId" parameterType="Long">
delete
from ipc_fault_tree_config
where node_id = #{nodeId}
</delete>
<delete id="deleteIpcFaultTreeConfigByNodeIds" parameterType="String">
delete from ipc_fault_tree_config where node_id in
<foreach item="nodeId" collection="array" open="(" separator="," close=")">
#{nodeId}
</foreach>
</delete>
<!-- 故障树显示数据-->
<resultMap type="com.inspur.industrial.domain.IpcFaultTreeShow" id="IpcFaultTreeShowResult">
<result property="nodeId" column="node_id"/>
<result property="parentId" column="parent_id"/>
<result property="ancestors" column="ancestors"/>
<result property="label" column="label"/>
<result property="orderNum" column="order_num"/>
<result property="iconCls" column="icon_cls"/>
<result property="nodeShapeType" column="node_shape_type"/>
<result property="content" column="content"/>
<result property="nodeDsc" column="nodeDsc"/>
<result property="nodeBorderColor" column="nodeBorderColor"/>
<result property="nodeShapeType" column="node_shape_type"/>
<result property="nodeFontColor" column="nodeFontColor"/>
</resultMap>
<select id="getFaultTreeShow" parameterType="string" resultMap="IpcFaultTreeConfigResult">
SELECT a.node_id,
a.parent_id,
a.ancestors,
a.node_name,
a.order_num,
a.equip_id,
a.icon_cls,
a.node_shape_type,
a.node_default_color,
a.node_alarm_color,
a.is_leaf,
a.status,
a.del_flag,
a.create_by,
a.create_time,
a.update_by,
a.update_time,
a.alarm_rule_config_id,
a.alarm_rule_config_description,
CASE
WHEN b.num > 0 AND c.type= 0 THEN
'1'
ELSE '0'
END is_alarm
FROM (SELECT * FROM ipc_fault_tree_config WHERE STATUS = '0' AND equip_id = #{equipId}) a
LEFT JOIN (SELECT alarm_rules_id, count(0) num
FROM `ipc_alarm_record`
WHERE status = 0
AND equip_id = #{equipId}
GROUP BY alarm_rules_id) b ON a.alarm_rule_config_id = b.alarm_rules_id
LEFT JOIN ipc_alarm_rules c ON b.alarm_rules_id = c.id
</select>
</mapper>

View File

@ -0,0 +1,60 @@
import request from "@/utils/request";
// 查询故障树配置列表
export function listFaultTreeConfig(query) {
return request({
url: "/ipc/faultTreeConfig/list",
method: "get",
params: query,
});
}
// 查询故障树配置详细
export function getFaultTreeConfig(nodeId) {
return request({
url: "/ipc/faultTreeConfig/" + nodeId,
method: "get",
});
}
// 查询是否有子节点
export function selectHasChild(nodeId) {
return request({
url: "/ipc/faultTreeConfig/hasChild/" + nodeId,
method: "get",
});
}
// 新增故障树配置
export function addFaultTreeConfig(data) {
return request({
url: "/ipc/faultTreeConfig",
method: "post",
data: data,
});
}
// 修改故障树配置
export function updateFaultTreeConfig(data) {
return request({
url: "/ipc/faultTreeConfig",
method: "put",
data: data,
});
}
// 删除故障树配置
export function delFaultTreeConfig(nodeId) {
return request({
url: "/ipc/faultTreeConfig/" + nodeId,
method: "delete",
});
}
// 查询故障树显示
export function getFaultTreeShow(partKey) {
return request({
url: "/ipc/faultTreeConfig/getFaultTreeShow/" + partKey,
method: "get",
});
}

View File

@ -9,6 +9,15 @@ export function listRecord(query) {
});
}
// 不分页查询所有报警记录列表
export function listAllRecord(query) {
return request({
url: "/alarm/record/listAll",
method: "get",
params: query,
});
}
// 查询报警记录详细
export function getRecord(id) {
return request({

View File

@ -0,0 +1,795 @@
<template>
<div class="app-container">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item
label="节点名称"
prop="nodeName"
>
<el-input
v-model="queryParams.nodeName"
placeholder="请输入节点名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item
label="节点状态"
prop="status"
>
<el-select
v-model="queryParams.status"
placeholder="请选择节点状态"
clearable
>
<el-option
v-for="dict in dict.type.sys_normal_disable"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button>
<el-button
icon="el-icon-refresh"
size="mini"
@click="resetQuery"
>重置</el-button>
</el-form-item>
</el-form>
<el-row
:gutter="10"
class="mb8"
>
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['ipc:faultTreeConfig:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
plain
icon="el-icon-sort"
size="mini"
@click="toggleExpandAll"
>展开/折叠</el-button>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table
v-if="refreshTable"
v-loading="loading"
:data="faultTreeConfigList"
row-key="nodeId"
:default-expand-all="isExpandAll"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
>
<el-table-column
label="节点名称"
align="center"
prop="nodeName"
show-overflow-tooltip
/>
<el-table-column
label="显示顺序"
align="center"
prop="orderNum"
width="100"
show-overflow-tooltip
/>
<!-- <el-table-column
label="所属部位"
align="center"
prop="partKey"
show-overflow-tooltip
/>-->
<el-table-column
label="节点图标"
align="center"
prop="iconCls"
show-overflow-tooltip
>
<template slot-scope="scope">
<dict-tag
:options="dict.type.node_icon"
:value="scope.row.iconCls"
/>
</template>
</el-table-column>
<el-table-column
label="节点形状"
align="center"
prop="nodeShapeType"
show-overflow-tooltip
>
<template slot-scope="scope">
<dict-tag
:options="dict.type.node_shape"
:value="scope.row.nodeShapeType"
/>
</template>
</el-table-column>
<el-table-column
label="节点默认颜色"
align="center"
prop="nodeDefaultColor"
show-overflow-tooltip
>
<template slot-scope="scope">
<dict-tag
:options="dict.type.node_default_color"
:value="scope.row.nodeDefaultColor"
/>
</template>
</el-table-column>
<el-table-column
label="节点报警颜色"
align="center"
prop="nodeAlarmColor"
show-overflow-tooltip
>
<template slot-scope="scope">
<dict-tag
:options="dict.type.node_alarm_color"
:value="scope.row.nodeAlarmColor"
/>
</template>
</el-table-column>
<el-table-column
label="节点状态"
align="center"
prop="status"
show-overflow-tooltip
>
<template slot-scope="scope">
<dict-tag
:options="dict.type.sys_normal_disable"
:value="scope.row.status"
/>
</template>
</el-table-column>
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['ipc:faultTreeConfig:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-plus"
@click="handleAdd(scope.row)"
v-hasPermi="['ipc:faultTreeConfig:add']"
>新增</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['ipc:faultTreeConfig:remove']"
v-if="scope.row.parentId != 0"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 添加或修改故障树配置对话框 -->
<el-dialog
:title="title"
:visible.sync="open"
width="800px"
append-to-body
>
<el-form
ref="form"
:model="form"
:rules="rules"
label-width="80px"
>
<el-row>
<el-col :span="12">
<el-form-item
label="节点名称"
prop="nodeName"
>
<el-input
v-model="form.nodeName"
placeholder="请输入节点名称"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="父节点"
prop="parentId"
v-if="form.parentId != 0"
>
<treeselect
v-model="parentId"
:options="faultTreeConfigOptions"
:normalizer="normalizer"
placeholder="请选择父节点id"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item
label="显示顺序"
prop="orderNum"
>
<el-input-number
v-model="form.orderNum"
:max=100
:min=0
placeholder="请输入显示顺序"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="所属监测设备"
prop="equipId"
>
<span class="color-green">
{{ labelShow(equipList,form.equipId) }}
</span>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item
label="节点图标"
prop="iconCls"
>
<el-select
v-model="form.iconCls"
placeholder="请选择节点图标"
>
<el-option
v-for="dict in dict.type.node_icon"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="节点形状"
prop="nodeShapeType"
>
<el-select
v-model="form.nodeShapeType"
placeholder="请选择节点形状"
>
<el-option
v-for="dict in dict.type.node_shape"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item
label="节点默认颜色"
prop="nodeDefaultColor"
>
<el-select
v-model="form.nodeDefaultColor"
placeholder="请选择节点默认颜色"
>
<el-option
v-for="dict in dict.type.node_default_color"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="节点报警颜色"
prop="nodeAlarmColor"
>
<el-select
v-model="form.nodeAlarmColor"
placeholder="请选择节点报警颜色"
>
<el-option
v-for="dict in dict.type.node_alarm_color"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item
label="节点状态"
prop="status"
>
<el-radio-group v-model="form.status">
<el-radio
v-for="dict in dict.type.sys_normal_disable"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12">
<!-- <el-form-item
label="是否叶子节点"
prop="isLeaf"
>
<el-radio-group v-model="form.isLeaf">
<el-radio
@change="validateIsLeaf"
v-for="dict in dict.type.is_leaf"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item> -->
</el-col>
</el-row>
<el-row>
<!-- v-if="isShowRuleConfig" -->
<el-col :span="12">
<el-form-item label="报警规则描述">
<span class="color-red">{{ form.alarmRuleConfigDescription }}</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="alarmRuleConfigId">
<el-button
type="primary"
@click="selectAlarmRule"
>选择报警规则</el-button>
<el-button
type="info"
@click="resetRule"
>清除报警规则</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div
slot="footer"
class="dialog-footer"
>
<el-button
type="primary"
@click="submitForm"
> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<RuleConfigDialog
:equipId="form.equipId"
:openRuleDia="openRuleDia"
@ruleDataReturn="ruleDataReturn"
@closeRuleDialog="closeRuleDialog"
></RuleConfigDialog>
</div>
</template>
<script>
import {
listFaultTreeConfig,
getFaultTreeConfig,
delFaultTreeConfig,
addFaultTreeConfig,
updateFaultTreeConfig,
selectHasChild,
} from "@/api/industrial/faultTreeConfig";
import { listInfo } from "@/api/equip/equip";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
// import { getFields } from "@/api/ipc/monitorFields";
import RuleConfigDialog from "@/views/faultTree/ruleConfigDialog";
export default {
name: "FaultTreeConfig",
dicts: [
"node_default_color",
"sys_normal_disable",
"node_icon",
"node_alarm_color",
"node_shape",
"is_leaf",
],
components: {
Treeselect,
RuleConfigDialog,
},
data() {
return {
//
openRuleDia: false,
//
isShowRuleConfig: false,
//
monitorPartList: [],
//
equipList: [],
//
loading: true,
//
showSearch: true,
//
faultTreeConfigList: [],
//
faultTreeConfigOptions: [],
//
faultData: [],
//
title: "",
//
open: false,
//
isExpandAll: false,
//
refreshTable: true,
//
queryParams: {
parentId: null,
ancestors: null,
nodeName: null,
orderNum: null,
equipId: null,
iconCls: null,
nodeShapeType: null,
nodeDefaultColor: null,
nodeAlarmColor: null,
isAlarm: null,
status: null,
},
//
form: {},
parentId: "0",
//
rules: {
nodeName: [
{ required: true, message: "节点名称不能为空", trigger: "blur" },
{ max: 20, message: "节点名称长度不能大于20", trigger: "blur" },
],
parentId: [
{ required: true, message: "父节点不能为空", trigger: "blur" },
],
iconCls: [
{ required: true, message: "请选择节点图标", trigger: "blur" },
],
nodeShapeType: [
{ required: true, message: "请选择节点行政", trigger: "blur" },
],
nodeDefaultColor: [
{ required: true, message: "请选择节点默认颜色", trigger: "blur" },
],
nodeAlarmColor: [
{ required: true, message: "请选择节点报警颜色", trigger: "blur" },
],
status: [
{ required: true, message: "请选择节点状态", trigger: "blur" },
],
// isLeaf: [
// { required: true, message: "", trigger: "blur" },
// ],
// alarmRuleConfigId: [
// { validator: this.validateAlarmRuleConfigId, trigger: "change" },
// ],
},
};
},
watch: {
parentId: {
deep: true,
handler(val) {
this.resetRule();
const node = this.faultData.find((item) => item.nodeId == val);
if (node && node.equipId) {
this.form.equipId = node.equipId;
} else {
this.form.equipId = "";
}
this.form.parentId = val;
},
},
},
created() {
// this.getMonitorPartList();
// this.getTreeselect();
this.getList();
},
methods: {
/** 选择报警规则 */
selectAlarmRule() {
if (this.form.equipId) {
this.openRuleDialog();
} else {
this.$modal.msgError("请先选择父节点");
}
},
/** 打开规则选择弹窗 */
openRuleDialog() {
this.openRuleDia = true;
},
/** 关闭规则选择弹窗 */
closeRuleDialog() {
this.openRuleDia = false;
},
/** 规则选择弹窗数据返回 */
ruleDataReturn(data) {
this.form.alarmRuleConfigDescription = data.referenceName;
this.form.alarmRuleConfigId = data.id;
this.closeRuleDialog();
},
// /** */
// validateAlarmRuleConfigId(rule, value, callback) {
// if (this.form.isLeaf == "1" && !value) {
// return callback(new Error(""));
// } else {
// return callback();
// }
// },
// /** */
// validateIsLeaf() {
// if (this.form.isLeaf == "1") {
// if (this.form.nodeId) {
// selectHasChild(this.form.nodeId).then((response) => {
// //
// if (response.data) {
// this.$modal.msgError(
// ""
// );
// this.isShowRuleConfig = false;
// this.resetRule();
// this.form.isLeaf = "0";
// } else {
// this.isShowRuleConfig = true;
// }
// });
// } else {
// this.isShowRuleConfig = true;
// }
// } else {
// this.isShowRuleConfig = false;
// this.resetRule();
// }
// },
/** 根据value获取label */
labelShow(fieldList, fieldValue) {
const field = fieldList.find((item) => item.equipId == fieldValue);
return field && field.equipName ? field.equipName : "";
},
getMonitorPartList() {
getFields("monitor_part")
.then((res) => {
this.monitorPartList = res.data;
})
.catch((error) => {
console.log(error);
});
},
getEquipList() {
listInfo()
.then((res) => {
this.equipList = res.rows;
})
.catch((error) => {
console.log(error);
});
},
/** 查询故障树配置列表 */
getList() {
this.loading = true;
listFaultTreeConfig(this.queryParams).then((response) => {
this.faultTreeConfigList = this.handleTree(
response.data,
"nodeId",
"parentId"
);
this.loading = false;
});
},
/** 转换故障树配置数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.nodeId,
label: node.nodeName,
children: node.children,
};
},
/** 查询故障树配置下拉树结构 */
getTreeselect() {
listFaultTreeConfig().then((response) => {
// this.faultTreeConfigOptions = [];
// const data = { nodeId: 0, nodeName: "", children: [] };
// data.children = this.handleTree(response.data, "nodeId", "parentId");
// this.faultTreeConfigOptions.push(data);
this.faultData = response.data;
this.faultTreeConfigOptions = this.handleTree(
response.data,
"nodeId",
"parentId"
);
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.parentId = null;
this.isShowRuleConfig = false;
this.form = {
nodeId: null,
parentId: null,
ancestors: null,
nodeName: null,
orderNum: null,
equipId: null,
iconCls: null,
nodeShapeType: null,
nodeDefaultColor: null,
nodeAlarmColor: null,
isAlarm: null,
status: "0",
delFlag: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
isLeaf: "0",
alarmRuleConfigId: null,
alarmRuleConfigDescription: "",
};
this.resetForm("form");
},
//
resetRule() {
this.form.alarmRuleConfigId = "";
this.form.alarmRuleConfigDescription = "";
},
/** 搜索按钮操作 */
handleQuery() {
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd(row) {
this.reset();
this.getTreeselect();
if (row != null && row.nodeId) {
this.parentId = row.nodeId;
} else {
this.parentId = null;
}
this.open = true;
this.title = "添加故障树配置";
},
/** 展开/折叠操作 */
toggleExpandAll() {
this.refreshTable = false;
this.isExpandAll = !this.isExpandAll;
this.$nextTick(() => {
this.refreshTable = true;
});
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.getTreeselect();
if (row != null) {
this.parentId = row.parentId;
}
getFaultTreeConfig(row.nodeId).then((response) => {
this.form = response.data;
this.open = true;
this.title = "修改故障树配置";
// if (this.form.isLeaf == "1") {
// this.isShowRuleConfig = true;
// }
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.nodeId != null) {
updateFaultTreeConfig(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addFaultTreeConfig(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
if (row.children && row.children.length > 0) {
this.$modal.msgError("存在子节点,不允许删除!");
return;
}
this.$modal
.confirm('是否确认删除名称为"' + row.nodeName + '"的故障树配置项?')
.then(function () {
return delFaultTreeConfig(row.nodeId);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
},
},
};
</script>
<style scoped>
.el-input-number,
.el-select {
width: 100%;
}
.color-green {
color: green;
}
.color-red {
color: red;
}
</style>

View File

@ -0,0 +1,204 @@
<template>
<div>
<el-form style="margin-left:3%">
<el-form-item label="监测设备">
<el-select
v-model="equipId"
@change="getList()"
>
<el-option
v-for="field in equipList"
:key="field.id"
:label="field.equipName"
:value="field.id"
/>
</el-select>
</el-form-item>
</el-form>
<div
v-for="(tree,index) in treeData"
:key="index"
>
<div
class="component-wrapper "
style="margin:0 3%;"
>
<vue-okr-tree
:loading="loading"
:data="objToList(tree)"
show-collapsable
default-expand-all
:node-btn-content="renderContent"
></vue-okr-tree>
</div>
</div>
</div>
</template>
<script>
import { VueOkrTree } from "@/components/VueOkrTree/index.js";
// import { getFields } from "@/api/ipc/monitorFields";
import { listInfo } from "@/api/equip/equip";
import { getFaultTreeShow } from "@/api/industrial/faultTreeConfig";
import _ from "lodash";
export default {
name: "faultTreeShow",
components: {
VueOkrTree,
},
data() {
return {
//
loading: true,
//
equipList: [],
equipId: "",
treeData: [],
};
},
created() {
this.getEquipList();
// this.getMonitorPartList();
},
methods: {
objToList(obj) {
return [obj];
},
getList() {
this.loading = true;
getFaultTreeShow(this.equipId).then((response) => {
const nodes = this.handleTree(response.data, "nodeId", "parentId");
this.updateParentStatusBasedOnLogic(nodes);
this.treeData = nodes[0].children;
this.loading = false;
});
},
/** 查询监测部位列表 */
getEquipList() {
listInfo()
.then((res) => {
this.equipList = res.rows;
this.equipId = this.equipList[0].id;
this.getList();
})
.catch((error) => {
console.log(error);
});
},
renderContent(h, node) {
// console.log("h", h);
// console.log("node", node);
let des = node.data.nodeDsc;
let iconCls = node.data.iconCls;
if (iconCls) {
return this.$createElement(
"p",
{
class: "org-chart-node-btn-text iconfont " + iconCls,
},
""
);
} else if (des) {
return this.$createElement(
"p",
{
class: "org-chart-node-btn-text",
},
des
);
} else {
return <div class="org-chart-node-btn-text"></div>;
}
},
//
//
//
yumen(children) {
return children.every((child) => child.isAlarm === "1");
},
//
huomen(children) {
return children.some((child) => child.isAlarm === "1");
},
//
feimen(children) {
return children.every((child) => child.isAlarm === "0");
},
//
biaojuemen(children, threshold) {
const activeCount = children.filter(
(child) => child.isAlarm === "1"
).length;
const totalCount = children.length;
return activeCount / totalCount >= threshold;
},
//
updateParentStatusBasedOnLogic(nodes) {
nodes.forEach((node) => {
//
if (node.children && node.children.length > 0) {
this.updateParentStatusBasedOnLogic(node.children);
}
// icon_cls
if (node.children && node.children.length > 0) {
// 使
//
if (node.isAlarm === "0") {
switch (node.iconCls) {
case "icon-yumen":
node.isAlarm = this.yumen(node.children) ? "1" : "0";
break;
case "icon-huomen":
node.isAlarm = this.huomen(node.children) ? "1" : "0";
break;
default:
break;
}
}
}
node.label = node.nodeName;
node.nodeBorderColor =
node.isAlarm === "1" ? node.nodeAlarmColor : node.nodeDefaultColor;
node.nodeFontColor =
node.isAlarm === "1" ? node.nodeAlarmColor : node.nodeDefaultColor;
});
},
},
};
</script>
<style>
.org-chart-node-label .org-chart-node-btn {
border-color: transparent !important;
box-shadow: none !important;
/* margin-top: 20px !important; */
}
.org-chart-node-children {
/* padding-top: 40px !important; */
}
.org-chart-node-btn-text.iconfont.icon-connect {
font-size: 18px;
padding: 0;
background: transparent;
top: -12px;
}
/**按钮文 */
.org-chart-node-btn-text {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #fff;
border-radius: 50%;
font-size: 12px;
display: flex;
align-items: center;
justify-content: center;
color: #909090;
z-index: 2;
}
</style>

View File

@ -0,0 +1,220 @@
<template>
<div class="app-container">
<el-dialog
:title="title"
:visible.sync="openRuleDia"
width="800px"
append-to-body
:close-on-click-modal="false"
@close="cancel"
>
<el-table
v-loading="loading"
:data="configList"
@row-dblclick="checkSelect"
>
<el-table-column
label="规则描述"
align="center"
prop="referenceName"
show-overflow-tooltip
/>
<el-table-column
label="监测设备名称"
align="center"
prop="equipName"
show-overflow-tooltip
>
<template slot-scope="scope">
{{ labelShow(equipList,scope.row.equipId) }}
</template>
</el-table-column>
<el-table-column
label="参数名称"
align="center"
prop="alarmName"
show-overflow-tooltip
>
<!-- <template slot-scope="scope">
{{ labelShow(monitorParamsList,scope.row.nameKey) }}
</template> -->
</el-table-column>
<el-table-column
label="报警描述"
align="center"
prop="description"
show-overflow-tooltip
/>
<el-table-column
label="报警等级"
align="center"
prop="alarmLevel"
show-overflow-tooltip
>
<template slot-scope="scope">
<dict-tag
:options="dict.type.alarm_level"
:value="scope.row.alarmLevel"
/>
</template>
</el-table-column>
</el-table>
<span class="color-red">双击选中规则</span>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<div
slot="footer"
class="dialog-footer"
>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
// import { listConfig } from "@/api/ipc/rulesConfig";
// import { getFields } from "@/api/ipc/monitorFields";
import {
listRules,
getRules,
delRules,
addRules,
updateRules,
} from "@/api/industrial/rules";
import {
listInfo,
getInfo,
delInfo,
addInfo,
updateInfo,
} from "@/api/equip/equip";
import {
listMonitorInfo,
getAllMonitorData,
getMonitorInfo,
delMonitorInfo,
addMonitorInfo,
updateMonitorInfo,
} from "@/api/industrial/monitorData";
export default {
name: "RuleConfigDialog",
dicts: ["alarm_level", "judge_rules"],
props: {
equipId: {
type: String,
default: null,
},
openRuleDia: {
type: Boolean,
default: false,
},
},
data() {
return {
//
monitorPartList: [],
equipList: [],
monitorParamsList: [],
//
loading: true,
//
showSearch: true,
//
total: 0,
//
configList: [],
//
title: "报警规则选择",
//
queryParams: {
pageNum: 1,
pageSize: 10,
equipId: null,
type: 0,
},
};
},
watch: {
equipId: {
deep: true,
handler(val) {
this.getList();
},
},
},
created() {
this.getEquipList();
// this.getPlcMonitorParamsList();
// this.getSensorMonitorParamsList();
this.getList();
},
methods: {
/** 确认选中 */
checkSelect(row, column, event) {
this.$emit("ruleDataReturn", row);
},
//
cancel() {
this.$emit("closeRuleDialog");
},
/** 根据value获取label */
labelShow(fieldList, fieldValue) {
const field = fieldList.find((item) => item.id == fieldValue);
return field && field.equipName ? field.equipName : "";
},
getEquipList() {
listInfo().then((response) => {
this.equipList = response.rows;
});
},
// getPlcMonitorParamsList() {
// getFields("plc_monitor_params")
// .then((res) => {
// this.monitorParamsList = this.monitorParamsList.concat(res.data);
// })
// .catch((error) => {
// console.log(error);
// });
// },
// getSensorMonitorParamsList() {
// getFields("sensor_monitor_params")
// .then((res) => {
// this.monitorParamsList = this.monitorParamsList.concat(res.data);
// })
// .catch((error) => {
// console.log(error);
// });
// },
/** 查询告警规则配置列表 */
getList() {
this.loading = true;
this.queryParams.equipId = this.equipId;
listRules(this.queryParams).then((response) => {
this.configList = response.rows;
this.total = response.total;
this.loading = false;
});
},
},
};
</script>
<style scoped>
.el-input-number,
.el-select {
width: 100%;
}
.color-green {
color: green;
}
</style>
<style scoped>
.color-red {
color: red;
}
</style>

View File

@ -143,8 +143,8 @@
</el-main>
<el-footer class="footer">
<div class="bottom-line"></div>
<lbCompents :showData="sjyltxWarning"></lbCompents>
<!-- <div class="warn">{{ sjyltxWarning }} </div>-->
<!-- <lbCompents :showData="sjyltxWarning"></lbCompents> -->
<div class="warn">{{ sjyltxWarning }} </div>
</el-footer>
</el-container>
</el-col>
@ -164,11 +164,8 @@
id="xtyl"
style="height: 90%"
></div>
<div
@click="trendClick('sys_press'
,'系统压力','bar')"
style="height:10%;text-align: center;font-size: 16px;color:#26DE86"
>系统压力</div>
<div style="height:10%;text-align: center;font-size: 16px;color:#26DE86"><span @click="trendClick('sys_press'
,'系统压力','bar')">系统压力</span></div>
</el-col>
<el-col
:span="8"
@ -178,11 +175,8 @@
id="xtyw"
style="height: 90%"
></div>
<div
@click="trendClick('sys_temp'
,'系统液温','℃')"
style="height:10%;text-align: center;font-size: 16px;color:#109CFB"
>系统液温</div>
<div style="height:10%;text-align: center;font-size: 16px;color:#109CFB"><span @click="trendClick('sys_temp'
,'系统液温','℃')">系统液温</span></div>
</el-col>
<el-col
:span="8"
@ -203,11 +197,8 @@
<div>最大值<span class="yeweiSpan">{{ xtyweimax }}</span></div>
</div>
</div>
<div
@click="trendClick('sys_level'
,'系统液位','cP')"
style="height:10%;text-align: center;font-size: 16px;color:#109CFB;position:relative;z-index: 999;top:-110%;"
>系统液位(CP)</div>
<div style="height:10%;text-align: center;font-size: 16px;color:#109CFB;position:relative;z-index: 999;top:-110%;"><span @click="trendClick('sys_level'
,'系统液位','cP')">系统液位(CP)</span></div>
</el-col>
</el-row>
@ -220,11 +211,8 @@
id="bscll"
style="height: 90%"
></div>
<div
@click="trendClick('sys_flw'
,'泵输出流量','L/min')"
style="height:10%;text-align: center;font-size: 16px;color:#2ACDDE"
>泵输出流量</div>
<div style="height:10%;text-align: center;font-size: 16px;color:#2ACDDE"><span @click="trendClick('sys_flw'
,'泵输出流量','L/min')">泵输出流量</span></div>
</el-col>
<el-col
:span="8"
@ -250,8 +238,8 @@
</el-main>
<el-footer class="footer">
<div class="bottom-line"></div>
<lbCompents :showData="mainWarning"></lbCompents>
<!-- <div class="warn">{{mainWarning}}</div> -->
<!-- <lbCompents :showData="mainWarning"></lbCompents> -->
<div class="warn">{{mainWarning}}</div>
</el-footer>
</el-container>
</el-col>
@ -281,8 +269,8 @@
</el-main>
<el-footer class="footer">
<div class="bottom-line"></div>
<lbCompents :showData="sysecWarning"></lbCompents>
<!-- <div class="warn">{{sysecWarning}}</div> -->
<!-- <lbCompents :showData="sysecWarning"></lbCompents> -->
<div class="warn">{{sysecWarning}}</div>
</el-footer>
</el-container>
</el-col>
@ -389,8 +377,8 @@
</el-main>
<el-footer class="footer">
<div class="bottom-line"></div>
<lbCompents :showData="llyltxWarning"></lbCompents>
<!-- <div class="warn">{{llyltxWarning}}</div> -->
<!-- <lbCompents :showData="llyltxWarning"></lbCompents> -->
<div class="warn">{{llyltxWarning}}</div>
</el-footer>
</el-container>
</el-col>
@ -465,8 +453,8 @@
</el-main>
<el-footer class="footer">
<div class="bottom-line"></div>
<lbCompents :showData="ylkldWarning"></lbCompents>
<!-- <div class="warn">{{ylkldWarning}}</div> -->
<!-- <lbCompents :showData="ylkldWarning"></lbCompents> -->
<div class="warn">{{ylkldWarning}}</div>
</el-footer>
</el-container>
</el-col>
@ -795,6 +783,8 @@ import {
getStatusByEquipName,
getMonitorInfoByEquipName,
} from "@/api/industrial/sysStatus.js";
import { listAllRecord } from "@/api/industrial/record";
export default {
name: "yxjk",
components: { lbCompents },
@ -943,7 +933,6 @@ export default {
//
this.queryData();
}, 1000);
this.queryHistoryData();
//
// this.historyIntervalTask = setInterval(() => {
// //
@ -954,6 +943,7 @@ export default {
getSysStatusData(query) {
getStatusByEquipName(query).then((response) => {
this.sysStatus = response.data;
this.queryAlarmRecordData(this.sysStatus.equipId);
});
},
getMonitorData(query) {
@ -1173,29 +1163,88 @@ export default {
this.initchart([], [], "", "");
this.handleQuery();
},
queryHistoryData() {
cydgdataHistory().then((response) => {
queryAlarmRecordData(equipId) {
let query = {
equipId: equipId,
};
listAllRecord(query).then((response) => {
//
this.mainWarning = response.data.filter((item) => item.type == "1");
// .map((obj) => obj.alarmDetail + obj.alarmTime)
this.mainWarning = response.data
.filter(
(item) =>
item.nameKey == "sys_press" ||
item.nameKey == "sys_flw" ||
item.nameKey == "sys_level" ||
item.nameKey == "sys_temp"
)
.map(
(obj) =>
"报警内容:" + obj.content + " 报警时间:" + obj.alarmTime
);
// .join("");
// ZFSC4P/Q
this.sjyltxWarning = response.data.filter((item) => item.type == "3");
// .map((obj) => obj.alarmDetail)
this.sjyltxWarning = response.data
.filter(
(item) =>
item.nameKey == "opr_soft_real_press" ||
item.nameKey == "opr_soft_bond_press" ||
item.nameKey == "opr_soft_act_press" ||
item.nameKey == "opr_hot_real_press" ||
item.nameKey == "opr_hot_bond_press" ||
item.nameKey == "opr_hot_act_press" ||
item.nameKey == "driven_soft_real_press" ||
item.nameKey == "driven_soft_bond_press" ||
item.nameKey == "driven_soft_act_press" ||
item.nameKey == "driven_hot_real_press" ||
item.nameKey == "driven_hot_bond_press" ||
item.nameKey == "driven_hot_act_press" ||
item.nameKey == "opr_soft_flw" ||
item.nameKey == "opr_hot_flw" ||
item.nameKey == "driven_soft_flw" ||
item.nameKey == "driven_hot_flw"
)
.map(
(obj) =>
"报警内容:" + obj.content + " 报警时间:" + obj.alarmTime
);
// .join("");
//
this.sysecWarning = response.data.filter(
(item) => item.alarmNameKey == "zdjdl"
);
// .map((obj) => obj.alarmDetail)
this.sysecWarning = response.data
.filter((item) => item.nameKey == "sys_cur")
.map(
(obj) =>
"报警内容:" + obj.content + " 报警时间:" + obj.alarmTime
);
// .join("");
// ZFSC4P/Q
this.llyltxWarning = response.data.filter((item) => item.type == "5");
// .map((obj) => obj.alarmDetail)
this.llyltxWarning = response.data
.filter(
(item) =>
item.nameKey == "opr_bottom_press" ||
item.nameKey == "driven_bottom_press" ||
item.nameKey == "opr_bottom_set_press" ||
item.nameKey == "driven_bottom_set_press"
)
.map(
(obj) =>
"报警内容:" + obj.content + " 报警时间:" + obj.alarmTime
);
// .join("");
// ZFSC4
this.ylkldWarning = response.data.filter((item) => item.type == "2");
// .map((obj) => obj.alarmDetail)
this.ylkldWarning = response.data
.filter(
(item) =>
item.nameKey == "oil_water" ||
item.nameKey == "visc" ||
item.nameKey == "gran4" ||
item.nameKey == "gran6" ||
item.nameKey == "gran14" ||
item.nameKey == "gran21"
)
.map(
(obj) =>
"报警内容:" + obj.content + " 报警时间:" + obj.alarmTime
);
// .join("");
});
},
@ -3016,7 +3065,7 @@ export default {
font-size: 18px;
/*text-overflow: unset;*/
/* 调整动画时长和效果 */
animation: marquee 5s linear infinite;
animation: marquee 300s linear infinite;
}
@keyframes marquee {
0% {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff