报警规则管理菜单功能更新

This commit is contained in:
zhangjunwen 2024-04-09 18:02:59 +08:00
parent b864c82430
commit 8866a6b890
16 changed files with 1907 additions and 303 deletions

View File

@ -0,0 +1,105 @@
package com.inspur.web.controller.industrial;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
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.industrial.domain.IpcAlarmRules;
import com.inspur.industrial.service.IIpcAlarmRulesService;
import com.inspur.common.utils.poi.ExcelUtil;
import com.inspur.common.core.page.TableDataInfo;
/**
* 设备报警规则Controller
*
* @Author zhangjunwen
* @create 2024/4/9
*/
@RestController
@RequestMapping("/system/rules")
public class IpcAlarmRulesController extends BaseController
{
@Autowired
private IIpcAlarmRulesService ipcAlarmRulesService;
/**
* 查询设备报警规则列表
*/
@PreAuthorize("@ss.hasPermi('system:rules:list')")
@GetMapping("/list")
public TableDataInfo list(IpcAlarmRules ipcAlarmRules)
{
startPage();
List<IpcAlarmRules> list = ipcAlarmRulesService.selectIpcAlarmRulesList(ipcAlarmRules);
return getDataTable(list);
}
/**
* 导出设备报警规则列表
*/
@PreAuthorize("@ss.hasPermi('system:rules:export')")
@Log(title = "设备报警规则", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, IpcAlarmRules ipcAlarmRules)
{
List<IpcAlarmRules> list = ipcAlarmRulesService.selectIpcAlarmRulesList(ipcAlarmRules);
ExcelUtil<IpcAlarmRules> util = new ExcelUtil<IpcAlarmRules>(IpcAlarmRules.class);
util.exportExcel(response, list, "设备报警规则数据");
}
/**
* 获取设备报警规则详细信息
*/
@PreAuthorize("@ss.hasPermi('system:rules:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id)
{
return AjaxResult.success(ipcAlarmRulesService.selectIpcAlarmRulesById(id));
}
/**
* 新增设备报警规则
*/
@PreAuthorize("@ss.hasPermi('system:rules:add')")
@Log(title = "设备报警规则", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody IpcAlarmRules ipcAlarmRules)
{
return toAjax(ipcAlarmRulesService.insertIpcAlarmRules(ipcAlarmRules));
}
/**
* 修改设备报警规则
*/
@PreAuthorize("@ss.hasPermi('system:rules:edit')")
@Log(title = "设备报警规则", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody IpcAlarmRules ipcAlarmRules)
{
return toAjax(ipcAlarmRulesService.updateIpcAlarmRules(ipcAlarmRules));
}
/**
* 删除设备报警规则
*/
@PreAuthorize("@ss.hasPermi('system:rules:remove')")
@Log(title = "设备报警规则", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(ipcAlarmRulesService.deleteIpcAlarmRulesByIds(ids));
}
}

View File

@ -0,0 +1,118 @@
package com.inspur.web.controller.industrial;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
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.industrial.domain.IpcMonitorDataInfo;
import com.inspur.industrial.service.IIpcMonitorDataInfoService;
import com.inspur.common.utils.poi.ExcelUtil;
import com.inspur.common.core.page.TableDataInfo;
/**
* 监控数据信息Controller
*
* @author inspur
* @date 2024-04-09
*/
@RestController
@RequestMapping("/monitorData/info")
public class IpcMonitorDataInfoController extends BaseController
{
@Autowired
private IIpcMonitorDataInfoService ipcMonitorDataInfoService;
/**
* 查询监控数据信息列表
*/
@PreAuthorize("@ss.hasPermi('monitorData:info:list')")
@GetMapping("/list")
public TableDataInfo list(IpcMonitorDataInfo ipcMonitorDataInfo)
{
startPage();
List<IpcMonitorDataInfo> list = ipcMonitorDataInfoService.selectIpcMonitorDataInfoList(ipcMonitorDataInfo);
return getDataTable(list);
}
/**
* 根据条件查询所有数据
* @param ipcMonitorDataInfo
* @return
*/
@GetMapping("/getAll")
public AjaxResult getAllData(IpcMonitorDataInfo ipcMonitorDataInfo)
{
List<IpcMonitorDataInfo> list = ipcMonitorDataInfoService.selectIpcMonitorDataInfoList(ipcMonitorDataInfo);
return AjaxResult.success(list);
}
/**
* 导出监控数据信息列表
*/
@PreAuthorize("@ss.hasPermi('monitorData:info:export')")
@Log(title = "监控数据信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, IpcMonitorDataInfo ipcMonitorDataInfo)
{
List<IpcMonitorDataInfo> list = ipcMonitorDataInfoService.selectIpcMonitorDataInfoList(ipcMonitorDataInfo);
ExcelUtil<IpcMonitorDataInfo> util = new ExcelUtil<IpcMonitorDataInfo>(IpcMonitorDataInfo.class);
util.exportExcel(response, list, "监控数据信息数据");
}
/**
* 获取监控数据信息详细信息
*/
@PreAuthorize("@ss.hasPermi('monitorData:info:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(ipcMonitorDataInfoService.selectIpcMonitorDataInfoById(id));
}
/**
* 新增监控数据信息
*/
@PreAuthorize("@ss.hasPermi('monitorData:info:add')")
@Log(title = "监控数据信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody IpcMonitorDataInfo ipcMonitorDataInfo)
{
return toAjax(ipcMonitorDataInfoService.insertIpcMonitorDataInfo(ipcMonitorDataInfo));
}
/**
* 修改监控数据信息
*/
@PreAuthorize("@ss.hasPermi('monitorData:info:edit')")
@Log(title = "监控数据信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody IpcMonitorDataInfo ipcMonitorDataInfo)
{
return toAjax(ipcMonitorDataInfoService.updateIpcMonitorDataInfo(ipcMonitorDataInfo));
}
/**
* 删除监控数据信息
*/
@PreAuthorize("@ss.hasPermi('monitorData:info:remove')")
@Log(title = "监控数据信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(ipcMonitorDataInfoService.deleteIpcMonitorDataInfoByIds(ids));
}
}

View File

@ -1,5 +1,6 @@
package com.inspur.datasyn.modbus;
import com.inspur.industrial.service.IIpcAlarmRulesService;
import com.serotonin.modbus4j.ModbusFactory;
import com.serotonin.modbus4j.ModbusMaster;
import com.serotonin.modbus4j.ip.IpParameters;
@ -27,6 +28,9 @@ public class IPCDataSyncTask implements ApplicationRunner {
@Autowired
private ThreadPoolTaskExecutor threadPoolTaskExecutor;
@Autowired
private IIpcAlarmRulesService ipcAlarmRulesService;
@Value("${datasyn.modbus.host}")
private String host;
@Value("${datasyn.modbus.port}")
@ -76,6 +80,8 @@ public class IPCDataSyncTask implements ApplicationRunner {
threadPoolTaskExecutor.execute(new IPCData3SyncThread(null,new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS").format(new Date())));
}
},1000,1000);
ipcAlarmRulesService.tran();
}
}
}

View File

@ -70,9 +70,9 @@ public class IPCDataSyncThread implements Runnable {
fields.put("sys_press",(float) 0 + Math.random());
// 系统液位
fields.put("sys_level",(float) 0 + Math.random());
fields.put("ywcsz",0.5);
fields.put("ywmin",0.3);
fields.put("ywmax",1);
// fields.put("ywcsz",0.5);
// fields.put("ywmin",0.3);
// fields.put("ywmax",1);
// 系统温度
fields.put("sys_temp",(float) 0 + Math.random());
// 油液颗粒度
@ -91,7 +91,7 @@ public class IPCDataSyncThread implements Runnable {
// 传动侧软辊流量
fields.put("driven_soft_flw",(float) 0 + Math.random());
// 传动侧热辊流量
fields.put("driven_hot_flw",(float) 0 + Math.random());
fields.put("[driven_hot_flw]",(float) 0 + Math.random());
//操作侧底缸比例换向阀
fields.put("opr_servo",(float) 0 + Math.random());
//传动侧比例换向阀

View File

@ -0,0 +1,222 @@
package com.inspur.industrial.domain;
import java.math.BigDecimal;
import com.inspur.common.annotation.Excel;
import com.inspur.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 设备报警规则对象 ipc_alarm_rules
*
* @author inspur
* @date 2024-04-09
*/
public class IpcAlarmRules extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 报警规则信息id */
private String id;
/** 报警规则信息名称 */
@Excel(name = "报警规则信息名称")
private String alarmName;
/** 报警信息key */
@Excel(name = "报警信息Key")
private String alarmNameKey;
/** 报警规则信息单位 */
@Excel(name = "报警规则信息单位")
private String alarmInfoUnit;
/** 设备id */
@Excel(name = "设备id")
private String equipId;
/** 传感器id */
@Excel(name = "传感器id")
private String sensorId;
/** 报警规则上限值 */
@Excel(name = "报警规则上限值")
private BigDecimal alertUpperBound;
/** 报警规则下限值 */
@Excel(name = "报警规则下限值")
private BigDecimal alertLowerBound;
/** 报警规则信息的类型0开机状态1待机状态 */
@Excel(name = "报警规则信息的类型", readConverterExp = "0=开机状态1待机状态")
private Integer type;
/** 报警描述 */
@Excel(name = "报警描述")
private String description;
/** 规则描述 */
@Excel(name = "规则描述")
private String referenceName;
/** 判断规则 */
@Excel(name = "判断规则")
private String referenceCon;
/** 等级 */
@Excel(name = "等级")
private Integer alarmLevel;
/** 排序 */
@Excel(name = "排序")
private Integer sort;
public void setId(String id)
{
this.id = id;
}
public String getId()
{
return id;
}
public void setAlarmName(String alarmName)
{
this.alarmName = alarmName;
}
public String getAlarmName()
{
return alarmName;
}
public String getAlarmNameKey() {
return alarmNameKey;
}
public void setAlarmNameKey(String alarmNameKey) {
this.alarmNameKey = alarmNameKey;
}
public void setAlarmInfoUnit(String alarmInfoUnit)
{
this.alarmInfoUnit = alarmInfoUnit;
}
public String getAlarmInfoUnit()
{
return alarmInfoUnit;
}
public void setEquipId(String equipId)
{
this.equipId = equipId;
}
public String getEquipId()
{
return equipId;
}
public void setSensorId(String sensorId)
{
this.sensorId = sensorId;
}
public String getSensorId()
{
return sensorId;
}
public void setAlertUpperBound(BigDecimal alertUpperBound)
{
this.alertUpperBound = alertUpperBound;
}
public BigDecimal getAlertUpperBound()
{
return alertUpperBound;
}
public void setAlertLowerBound(BigDecimal alertLowerBound)
{
this.alertLowerBound = alertLowerBound;
}
public BigDecimal getAlertLowerBound()
{
return alertLowerBound;
}
public void setType(Integer type)
{
this.type = type;
}
public Integer getType()
{
return type;
}
public void setDescription(String description)
{
this.description = description;
}
public String getDescription()
{
return description;
}
public void setReferenceName(String referenceName)
{
this.referenceName = referenceName;
}
public String getReferenceName()
{
return referenceName;
}
public void setReferenceCon(String referenceCon)
{
this.referenceCon = referenceCon;
}
public String getReferenceCon()
{
return referenceCon;
}
public void setAlarmLevel(Integer alarmLevel)
{
this.alarmLevel = alarmLevel;
}
public Integer getAlarmLevel()
{
return alarmLevel;
}
public void setSort(Integer sort)
{
this.sort = sort;
}
public Integer getSort()
{
return sort;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("alarmName", getAlarmName())
.append("alarmNameKey", getAlarmNameKey())
.append("alarmInfoUnit", getAlarmInfoUnit())
.append("equipId", getEquipId())
.append("sensorId", getSensorId())
.append("alertUpperBound", getAlertUpperBound())
.append("alertLowerBound", getAlertLowerBound())
.append("type", getType())
.append("description", getDescription())
.append("remark", getRemark())
.append("referenceName", getReferenceName())
.append("referenceCon", getReferenceCon())
.append("alarmLevel", getAlarmLevel())
.append("sort", getSort())
.toString();
}
}

View File

@ -0,0 +1,126 @@
package com.inspur.industrial.domain;
import com.inspur.common.annotation.Excel;
import com.inspur.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 监控数据信息对象 ipc_monitor_data_info
*
* @author inspur
* @date 2024-04-09
*/
public class IpcMonitorDataInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 监控数据id */
private Long id;
/** 所属设备id */
@Excel(name = "所属设备id")
private String equipId;
/** 传感器id */
@Excel(name = "传感器id")
private String sensorId;
/** 监控数据的名称 */
@Excel(name = "监控数据的名称")
private String dataName;
/** 监控数据单位 */
@Excel(name = "监控数据单位")
private String dataUnit;
/** 监控数据对应数据字段Key */
@Excel(name = "监控数据对应数据字段Key")
private String dataKey;
/** 状态 */
@Excel(name = "状态")
private Integer status;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setEquipId(String equipId)
{
this.equipId = equipId;
}
public String getEquipId()
{
return equipId;
}
public void setSensorId(String sensorId)
{
this.sensorId = sensorId;
}
public String getSensorId()
{
return sensorId;
}
public void setDataName(String dataName)
{
this.dataName = dataName;
}
public String getDataName()
{
return dataName;
}
public void setDataUnit(String dataUnit)
{
this.dataUnit = dataUnit;
}
public String getDataUnit()
{
return dataUnit;
}
public void setDataKey(String dataKey)
{
this.dataKey = dataKey;
}
public String getDataKey()
{
return dataKey;
}
public void setStatus(Integer status)
{
this.status = status;
}
public Integer getStatus()
{
return status;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("equipId", getEquipId())
.append("sensorId", getSensorId())
.append("dataName", getDataName())
.append("dataUnit", getDataUnit())
.append("dataKey", getDataKey())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@ -0,0 +1,62 @@
package com.inspur.industrial.mapper;
import java.util.List;
import com.inspur.industrial.domain.IpcAlarmRules;
/**
* 设备报警规则Mapper接口
*
* @Author zhangjunwen
* @create 2024/4/9
*/
public interface IpcAlarmRulesMapper
{
/**
* 查询设备报警规则
*
* @param id 设备报警规则主键
* @return 设备报警规则
*/
public IpcAlarmRules selectIpcAlarmRulesById(String id);
/**
* 查询设备报警规则列表
*
* @param ipcAlarmRules 设备报警规则
* @return 设备报警规则集合
*/
public List<IpcAlarmRules> selectIpcAlarmRulesList(IpcAlarmRules ipcAlarmRules);
/**
* 新增设备报警规则
*
* @param ipcAlarmRules 设备报警规则
* @return 结果
*/
public int insertIpcAlarmRules(IpcAlarmRules ipcAlarmRules);
/**
* 修改设备报警规则
*
* @param ipcAlarmRules 设备报警规则
* @return 结果
*/
public int updateIpcAlarmRules(IpcAlarmRules ipcAlarmRules);
/**
* 删除设备报警规则
*
* @param id 设备报警规则主键
* @return 结果
*/
public int deleteIpcAlarmRulesById(String id);
/**
* 批量删除设备报警规则
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteIpcAlarmRulesByIds(String[] ids);
}

View File

@ -0,0 +1,61 @@
package com.inspur.industrial.mapper;
import java.util.List;
import com.inspur.industrial.domain.IpcMonitorDataInfo;
/**
* 监控数据信息Mapper接口
*
* @author inspur
* @date 2024-04-09
*/
public interface IpcMonitorDataInfoMapper
{
/**
* 查询监控数据信息
*
* @param id 监控数据信息主键
* @return 监控数据信息
*/
public IpcMonitorDataInfo selectIpcMonitorDataInfoById(Long id);
/**
* 查询监控数据信息列表
*
* @param ipcMonitorDataInfo 监控数据信息
* @return 监控数据信息集合
*/
public List<IpcMonitorDataInfo> selectIpcMonitorDataInfoList(IpcMonitorDataInfo ipcMonitorDataInfo);
/**
* 新增监控数据信息
*
* @param ipcMonitorDataInfo 监控数据信息
* @return 结果
*/
public int insertIpcMonitorDataInfo(IpcMonitorDataInfo ipcMonitorDataInfo);
/**
* 修改监控数据信息
*
* @param ipcMonitorDataInfo 监控数据信息
* @return 结果
*/
public int updateIpcMonitorDataInfo(IpcMonitorDataInfo ipcMonitorDataInfo);
/**
* 删除监控数据信息
*
* @param id 监控数据信息主键
* @return 结果
*/
public int deleteIpcMonitorDataInfoById(Long id);
/**
* 批量删除监控数据信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteIpcMonitorDataInfoByIds(Long[] ids);
}

View File

@ -0,0 +1,64 @@
package com.inspur.industrial.service;
import java.util.List;
import com.inspur.industrial.domain.IpcAlarmRules;
/**
* 设备报警规则Service接口
*
* @Author zhangjunwen
* @create 2024/4/9
*/
public interface IIpcAlarmRulesService
{
/**
* 查询设备报警规则
*
* @param id 设备报警规则主键
* @return 设备报警规则
*/
public IpcAlarmRules selectIpcAlarmRulesById(String id);
/**
* 查询设备报警规则列表
*
* @param ipcAlarmRules 设备报警规则
* @return 设备报警规则集合
*/
public List<IpcAlarmRules> selectIpcAlarmRulesList(IpcAlarmRules ipcAlarmRules);
public void tran();
/**
* 新增设备报警规则
*
* @param ipcAlarmRules 设备报警规则
* @return 结果
*/
public int insertIpcAlarmRules(IpcAlarmRules ipcAlarmRules);
/**
* 修改设备报警规则
*
* @param ipcAlarmRules 设备报警规则
* @return 结果
*/
public int updateIpcAlarmRules(IpcAlarmRules ipcAlarmRules);
/**
* 批量删除设备报警规则
*
* @param ids 需要删除的设备报警规则主键集合
* @return 结果
*/
public int deleteIpcAlarmRulesByIds(String[] ids);
/**
* 删除设备报警规则信息
*
* @param id 设备报警规则主键
* @return 结果
*/
public int deleteIpcAlarmRulesById(String id);
}

View File

@ -0,0 +1,61 @@
package com.inspur.industrial.service;
import java.util.List;
import com.inspur.industrial.domain.IpcMonitorDataInfo;
/**
* 监控数据信息Service接口
*
* @author inspur
* @date 2024-04-09
*/
public interface IIpcMonitorDataInfoService
{
/**
* 查询监控数据信息
*
* @param id 监控数据信息主键
* @return 监控数据信息
*/
public IpcMonitorDataInfo selectIpcMonitorDataInfoById(Long id);
/**
* 查询监控数据信息列表
*
* @param ipcMonitorDataInfo 监控数据信息
* @return 监控数据信息集合
*/
public List<IpcMonitorDataInfo> selectIpcMonitorDataInfoList(IpcMonitorDataInfo ipcMonitorDataInfo);
/**
* 新增监控数据信息
*
* @param ipcMonitorDataInfo 监控数据信息
* @return 结果
*/
public int insertIpcMonitorDataInfo(IpcMonitorDataInfo ipcMonitorDataInfo);
/**
* 修改监控数据信息
*
* @param ipcMonitorDataInfo 监控数据信息
* @return 结果
*/
public int updateIpcMonitorDataInfo(IpcMonitorDataInfo ipcMonitorDataInfo);
/**
* 批量删除监控数据信息
*
* @param ids 需要删除的监控数据信息主键集合
* @return 结果
*/
public int deleteIpcMonitorDataInfoByIds(Long[] ids);
/**
* 删除监控数据信息信息
*
* @param id 监控数据信息主键
* @return 结果
*/
public int deleteIpcMonitorDataInfoById(Long id);
}

View File

@ -0,0 +1,130 @@
package com.inspur.industrial.service.impl;
import java.math.BigDecimal;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import com.inspur.common.utils.uuid.IdUtils;
import com.inspur.industrial.domain.IpcMonitorDataInfo;
import com.inspur.industrial.service.IIpcMonitorDataInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.inspur.industrial.mapper.IpcAlarmRulesMapper;
import com.inspur.industrial.domain.IpcAlarmRules;
import com.inspur.industrial.service.IIpcAlarmRulesService;
import javax.annotation.Resource;
/**
* 设备报警规则Service业务层处理
*
* @Author zhangjunwen
* @create 2024/4/9
*/
@Service
public class IpcAlarmRulesServiceImpl implements IIpcAlarmRulesService
{
@Autowired
private IpcAlarmRulesMapper ipcAlarmRulesMapper;
@Resource
private IIpcMonitorDataInfoService ipcMonitorDataInfoService;
/**
* 查询设备报警规则
*
* @param id 设备报警规则主键
* @return 设备报警规则
*/
@Override
public IpcAlarmRules selectIpcAlarmRulesById(String id)
{
return ipcAlarmRulesMapper.selectIpcAlarmRulesById(id);
}
/**
* 查询设备报警规则列表
*
* @param ipcAlarmRules 设备报警规则
* @return 设备报警规则
*/
@Override
public List<IpcAlarmRules> selectIpcAlarmRulesList(IpcAlarmRules ipcAlarmRules)
{
return ipcAlarmRulesMapper.selectIpcAlarmRulesList(ipcAlarmRules);
}
public void tran(){
List<IpcMonitorDataInfo> list = ipcMonitorDataInfoService.selectIpcMonitorDataInfoList(null);
AtomicInteger num = new AtomicInteger(1);
list.forEach(data ->{
for(int t = 0; t <=1; t++){
IpcAlarmRules ipcAlarmRules = new IpcAlarmRules();
ipcAlarmRules.setId(IdUtils.simpleUUID());
ipcAlarmRules.setAlarmName(data.getDataName());
ipcAlarmRules.setEquipId(data.getEquipId());
ipcAlarmRules.setAlarmInfoUnit(data.getDataUnit());
ipcAlarmRules.setAlarmNameKey(data.getDataKey());
ipcAlarmRules.setAlertLowerBound(BigDecimal.valueOf(0.81));
ipcAlarmRules.setAlertUpperBound(BigDecimal.valueOf(1.52));
ipcAlarmRules.setReferenceCon("区间外");
ipcAlarmRules.setReferenceName(data.getDataName() + "超出 " + ipcAlarmRules.getAlertLowerBound() + "~" + ipcAlarmRules.getAlertUpperBound());
ipcAlarmRules.setAlarmLevel(1);
ipcAlarmRules.setType(t);
ipcAlarmRules.setSort(num.get());
ipcAlarmRulesMapper.insertIpcAlarmRules(ipcAlarmRules);
}
num.getAndIncrement();
});
}
/**
* 新增设备报警规则
*
* @param ipcAlarmRules 设备报警规则
* @return 结果
*/
@Override
public int insertIpcAlarmRules(IpcAlarmRules ipcAlarmRules)
{
return ipcAlarmRulesMapper.insertIpcAlarmRules(ipcAlarmRules);
}
/**
* 修改设备报警规则
*
* @param ipcAlarmRules 设备报警规则
* @return 结果
*/
@Override
public int updateIpcAlarmRules(IpcAlarmRules ipcAlarmRules)
{
return ipcAlarmRulesMapper.updateIpcAlarmRules(ipcAlarmRules);
}
/**
* 批量删除设备报警规则
*
* @param ids 需要删除的设备报警规则主键
* @return 结果
*/
@Override
public int deleteIpcAlarmRulesByIds(String[] ids)
{
return ipcAlarmRulesMapper.deleteIpcAlarmRulesByIds(ids);
}
/**
* 删除设备报警规则信息
*
* @param id 设备报警规则主键
* @return 结果
*/
@Override
public int deleteIpcAlarmRulesById(String id)
{
return ipcAlarmRulesMapper.deleteIpcAlarmRulesById(id);
}
}

View File

@ -0,0 +1,96 @@
package com.inspur.industrial.service.impl;
import java.util.List;
import com.inspur.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.inspur.industrial.mapper.IpcMonitorDataInfoMapper;
import com.inspur.industrial.domain.IpcMonitorDataInfo;
import com.inspur.industrial.service.IIpcMonitorDataInfoService;
/**
* 监控数据信息Service业务层处理
*
* @author inspur
* @date 2024-04-09
*/
@Service
public class IpcMonitorDataInfoServiceImpl implements IIpcMonitorDataInfoService
{
@Autowired
private IpcMonitorDataInfoMapper ipcMonitorDataInfoMapper;
/**
* 查询监控数据信息
*
* @param id 监控数据信息主键
* @return 监控数据信息
*/
@Override
public IpcMonitorDataInfo selectIpcMonitorDataInfoById(Long id)
{
return ipcMonitorDataInfoMapper.selectIpcMonitorDataInfoById(id);
}
/**
* 查询监控数据信息列表
*
* @param ipcMonitorDataInfo 监控数据信息
* @return 监控数据信息
*/
@Override
public List<IpcMonitorDataInfo> selectIpcMonitorDataInfoList(IpcMonitorDataInfo ipcMonitorDataInfo)
{
return ipcMonitorDataInfoMapper.selectIpcMonitorDataInfoList(ipcMonitorDataInfo);
}
/**
* 新增监控数据信息
*
* @param ipcMonitorDataInfo 监控数据信息
* @return 结果
*/
@Override
public int insertIpcMonitorDataInfo(IpcMonitorDataInfo ipcMonitorDataInfo)
{
ipcMonitorDataInfo.setCreateTime(DateUtils.getNowDate());
return ipcMonitorDataInfoMapper.insertIpcMonitorDataInfo(ipcMonitorDataInfo);
}
/**
* 修改监控数据信息
*
* @param ipcMonitorDataInfo 监控数据信息
* @return 结果
*/
@Override
public int updateIpcMonitorDataInfo(IpcMonitorDataInfo ipcMonitorDataInfo)
{
ipcMonitorDataInfo.setUpdateTime(DateUtils.getNowDate());
return ipcMonitorDataInfoMapper.updateIpcMonitorDataInfo(ipcMonitorDataInfo);
}
/**
* 批量删除监控数据信息
*
* @param ids 需要删除的监控数据信息主键
* @return 结果
*/
@Override
public int deleteIpcMonitorDataInfoByIds(Long[] ids)
{
return ipcMonitorDataInfoMapper.deleteIpcMonitorDataInfoByIds(ids);
}
/**
* 删除监控数据信息信息
*
* @param id 监控数据信息主键
* @return 结果
*/
@Override
public int deleteIpcMonitorDataInfoById(Long id)
{
return ipcMonitorDataInfoMapper.deleteIpcMonitorDataInfoById(id);
}
}

View File

@ -0,0 +1,122 @@
<?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.IpcAlarmRulesMapper">
<resultMap type="IpcAlarmRules" id="IpcAlarmRulesResult">
<result property="id" column="id" />
<result property="alarmName" column="alarm_name" />
<result property="alarmNameKey" column="alarm_name_key" />
<result property="alarmInfoUnit" column="alarm_info_unit" />
<result property="equipId" column="equip_id" />
<result property="sensorId" column="sensor_id" />
<result property="alertUpperBound" column="alert_upper_bound" />
<result property="alertLowerBound" column="alert_lower_bound" />
<result property="type" column="type" />
<result property="description" column="description" />
<result property="remark" column="remark" />
<result property="referenceName" column="reference_name" />
<result property="referenceCon" column="reference_con" />
<result property="alarmLevel" column="alarm_level" />
<result property="sort" column="sort" />
</resultMap>
<sql id="selectIpcAlarmRulesVo">
select id, alarm_name, alarm_name_key, alarm_info_unit, equip_id, sensor_id, alert_upper_bound, alert_lower_bound, type, description, remark, reference_name, reference_con, alarm_level, sort from ipc_alarm_rules
</sql>
<select id="selectIpcAlarmRulesList" parameterType="IpcAlarmRules" resultMap="IpcAlarmRulesResult">
<include refid="selectIpcAlarmRulesVo"/>
<where>
<if test="alarmName != null and alarmName != ''"> and alarm_name like concat('%', #{alarmName}, '%')</if>
<if test="alarmNameKey != null and alarmNameKey != ''"> and alarm_name_key = #{alarmNameKey}</if>
<if test="alarmInfoUnit != null and alarmInfoUnit != ''"> and alarm_info_unit = #{alarmInfoUnit}</if>
<if test="equipId != null and equipId != ''"> and equip_id = #{equipId}</if>
<if test="sensorId != null and sensorId != ''"> and sensor_id = #{sensorId}</if>
<if test="alertUpperBound != null "> and alert_upper_bound = #{alertUpperBound}</if>
<if test="alertLowerBound != null "> and alert_lower_bound = #{alertLowerBound}</if>
<if test="type != null "> and type = #{type}</if>
<if test="description != null and description != ''"> and description = #{description}</if>
<if test="referenceName != null and referenceName != ''"> and reference_name like concat('%', #{referenceName}, '%')</if>
<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>
</where>
</select>
<select id="selectIpcAlarmRulesById" parameterType="String" resultMap="IpcAlarmRulesResult">
<include refid="selectIpcAlarmRulesVo"/>
where id = #{id}
</select>
<insert id="insertIpcAlarmRules" parameterType="IpcAlarmRules">
insert into ipc_alarm_rules
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="alarmName != null">alarm_name,</if>
<if test="alarmNameKey != null">alarm_name_key,</if>
<if test="alarmInfoUnit != null">alarm_info_unit,</if>
<if test="equipId != null">equip_id,</if>
<if test="sensorId != null">sensor_id,</if>
<if test="alertUpperBound != null">alert_upper_bound,</if>
<if test="alertLowerBound != null">alert_lower_bound,</if>
<if test="type != null">type,</if>
<if test="description != null">description,</if>
<if test="remark != null">remark,</if>
<if test="referenceName != null">reference_name,</if>
<if test="referenceCon != null">reference_con,</if>
<if test="alarmLevel != null">alarm_level,</if>
<if test="sort != null">sort,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="alarmName != null">#{alarmName},</if>
<if test="alarmNameKey != null">#{alarmNameKey},</if>
<if test="alarmInfoUnit != null">#{alarmInfoUnit},</if>
<if test="equipId != null">#{equipId},</if>
<if test="sensorId != null">#{sensorId},</if>
<if test="alertUpperBound != null">#{alertUpperBound},</if>
<if test="alertLowerBound != null">#{alertLowerBound},</if>
<if test="type != null">#{type},</if>
<if test="description != null">#{description},</if>
<if test="remark != null">#{remark},</if>
<if test="referenceName != null">#{referenceName},</if>
<if test="referenceCon != null">#{referenceCon},</if>
<if test="alarmLevel != null">#{alarmLevel},</if>
<if test="sort != null">#{sort},</if>
</trim>
</insert>
<update id="updateIpcAlarmRules" parameterType="IpcAlarmRules">
update ipc_alarm_rules
<trim prefix="SET" suffixOverrides=",">
<if test="alarmName != null">alarm_name = #{alarmName},</if>
<if test="alarmNameKey != null">alarm_name_key = #{alarmNameKey},</if>
<if test="alarmInfoUnit != null">alarm_info_unit = #{alarmInfoUnit},</if>
<if test="equipId != null">equip_id = #{equipId},</if>
<if test="sensorId != null">sensor_id = #{sensorId},</if>
<if test="alertUpperBound != null">alert_upper_bound = #{alertUpperBound},</if>
<if test="alertLowerBound != null">alert_lower_bound = #{alertLowerBound},</if>
<if test="type != null">type = #{type},</if>
<if test="description != null">description = #{description},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="referenceName != null">reference_name = #{referenceName},</if>
<if test="referenceCon != null">reference_con = #{referenceCon},</if>
<if test="alarmLevel != null">alarm_level = #{alarmLevel},</if>
<if test="sort != null">sort = #{sort},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteIpcAlarmRulesById" parameterType="String">
delete from ipc_alarm_rules where id = #{id}
</delete>
<delete id="deleteIpcAlarmRulesByIds" parameterType="String">
delete from ipc_alarm_rules where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,101 @@
<?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.IpcMonitorDataInfoMapper">
<resultMap type="IpcMonitorDataInfo" id="IpcMonitorDataInfoResult">
<result property="id" column="id" />
<result property="equipId" column="equip_id" />
<result property="sensorId" column="sensor_id" />
<result property="dataName" column="data_name" />
<result property="dataUnit" column="data_unit" />
<result property="dataKey" column="data_key" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectIpcMonitorDataInfoVo">
select id, equip_id, sensor_id, data_name, data_unit, data_key, status, create_by, create_time, update_by, update_time, remark from ipc_monitor_data_info
</sql>
<select id="selectIpcMonitorDataInfoList" parameterType="IpcMonitorDataInfo" resultMap="IpcMonitorDataInfoResult">
<include refid="selectIpcMonitorDataInfoVo"/>
<where>
<if test="equipId != null and equipId != ''"> and equip_id = #{equipId}</if>
<if test="sensorId != null and sensorId != ''"> and sensor_id = #{sensorId}</if>
<if test="dataName != null and dataName != ''"> and data_name like concat('%', #{dataName}, '%')</if>
<if test="dataUnit != null and dataUnit != ''"> and data_unit = #{dataUnit}</if>
<if test="dataKey != null and dataKey != ''"> and data_key = #{dataKey}</if>
<if test="status != null "> and status = #{status}</if>
</where>
</select>
<select id="selectIpcMonitorDataInfoById" parameterType="Long" resultMap="IpcMonitorDataInfoResult">
<include refid="selectIpcMonitorDataInfoVo"/>
where id = #{id}
</select>
<insert id="insertIpcMonitorDataInfo" parameterType="IpcMonitorDataInfo" useGeneratedKeys="true" keyProperty="id">
insert into ipc_monitor_data_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="equipId != null">equip_id,</if>
<if test="sensorId != null">sensor_id,</if>
<if test="dataName != null">data_name,</if>
<if test="dataUnit != null">data_unit,</if>
<if test="dataKey != null">data_key,</if>
<if test="status != null">status,</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="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="equipId != null">#{equipId},</if>
<if test="sensorId != null">#{sensorId},</if>
<if test="dataName != null">#{dataName},</if>
<if test="dataUnit != null">#{dataUnit},</if>
<if test="dataKey != null">#{dataKey},</if>
<if test="status != null">#{status},</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="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateIpcMonitorDataInfo" parameterType="IpcMonitorDataInfo">
update ipc_monitor_data_info
<trim prefix="SET" suffixOverrides=",">
<if test="equipId != null">equip_id = #{equipId},</if>
<if test="sensorId != null">sensor_id = #{sensorId},</if>
<if test="dataName != null">data_name = #{dataName},</if>
<if test="dataUnit != null">data_unit = #{dataUnit},</if>
<if test="dataKey != null">data_key = #{dataKey},</if>
<if test="status != null">status = #{status},</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="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteIpcMonitorDataInfoById" parameterType="Long">
delete from ipc_monitor_data_info where id = #{id}
</delete>
<delete id="deleteIpcMonitorDataInfoByIds" parameterType="String">
delete from ipc_monitor_data_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,44 @@
import request from "@/utils/request";
// 查询设备报警规则列表
export function listRules(query) {
return request({
url: "/system/rules/list",
method: "get",
params: query,
});
}
// 查询设备报警规则详细
export function getRules(id) {
return request({
url: "/system/rules/" + id,
method: "get",
});
}
// 新增设备报警规则
export function addRules(data) {
return request({
url: "/system/rules",
method: "post",
data: data,
});
}
// 修改设备报警规则
export function updateRules(data) {
return request({
url: "/system/rules",
method: "put",
data: data,
});
}
// 删除设备报警规则
export function delRules(id) {
return request({
url: "/system/rules/" + id,
method: "delete",
});
}

View File

@ -1,233 +1,410 @@
<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="location">
<el-input
v-model="queryParams.location"
placeholder="请输入报警点"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="报警类型" prop="alarmType">
<el-input
v-model="queryParams.alarmType"
placeholder="请输入报警类型"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="报警等级" prop="level">
<el-input
v-model="queryParams.level"
placeholder="请输入报警等级"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="报警指标" prop="indicator">
<el-input
v-model="queryParams.indicator"
placeholder="请输入报警指标"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="报警时间">
<el-date-picker
v-model="daterangeAlarmTime"
style="width: 240px"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>
<el-form-item label="最新报警时间" prop="alarmLastTime">
<el-date-picker clearable
v-model="queryParams.alarmLastTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择最新报警时间">
</el-date-picker>
</el-form-item>
<el-form-item label="设备ID" prop="equipId">
<el-input
v-model="queryParams.equipId"
placeholder="请输入设备ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="测点ID" prop="measureId">
<el-input
v-model="queryParams.measureId"
placeholder="请输入测点ID"
clearable
@keyup.enter.native="handleQuery"
/>
</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-tabs
v-model="activeName"
type="card"
@tab-click="handleTabClick"
>
<el-tab-pane
label="超压底缸加压液压系统"
name="bottomCyl"
>
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px"
style="text-align:right"
>
<el-form-item
label="规则类型"
prop="type"
>
<el-select
v-model="queryParams.type"
placeholder="请选择报警规则类型"
>
<el-option
v-for="dict in dict.type.rule_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item
label="参数名称"
prop="alarmNameKey"
>
<el-select
v-model="queryParams.nameKey"
placeholder="请选择参数"
clearable
>
<el-option
v-for="field in monitorList"
:key="field.value"
:label="field.label"
:value="field.value"
/>
</el-select>
</el-form-item>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-form-item
label="报警等级"
prop="alarmLevel"
>
<el-select
v-model="queryParams.alarmLevel"
placeholder="请选择报警规则类型"
>
<el-option
v-for="dict in dict.type.alarm_level"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</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="['system:rules:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:rules:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:rules:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:rules:export']"
>导出</el-button>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table
v-loading="loading"
:data="rulesList"
@selection-change="handleSelectionChange"
>
<el-table-column
type="selection"
width="55"
align="center"
/>
<el-table-column
label="规则描述"
align="center"
prop="referenceName"
/>
<el-table-column
label="规则类型"
align="center"
prop="type"
>
<template slot-scope="scope">
<dict-tag
:options="dict.type.rule_type"
:value="scope.row.type"
/>
</template>
</el-table-column>
<el-table-column
label="参数名称"
align="center"
prop="alarmName"
/>
<el-table-column
label="参数单位"
align="center"
prop="alarmInfoUnit"
/>
<el-table-column
label="报警上限值"
align="center"
prop="alertUpperBound"
/>
<el-table-column
label="报警下限值"
align="center"
prop="alertLowerBound"
/>
<el-table-column
label="报警规则"
align="center"
prop="referenceCon"
/>
<el-table-column
label="报警描述"
align="center"
prop="description"
/>
<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="['system:rules:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:rules:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-tab-pane>
<el-tab-pane
label="可控中高辊顶辊液压系统"
name="topScoller"
></el-tab-pane>
<el-tab-pane
label="可控中高辊底辊液压系统"
name="bottomScoller"
></el-tab-pane>
</el-tabs>
<!-- 添加或修改设备报警规则对话框 -->
<el-dialog
:title="title"
:visible.sync="open"
width="500px"
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="equipName"
>
<span class="color-green">{{ this.equipName }}</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="参数名称"
prop="alarmName"
>
<span class="color-green">{{ this.form.alarmName }}</span>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item
label="单位"
prop="alarmInfoUnit"
>
<span class="color-green">{{ this.form.alarmInfoUnit }}</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="规则类型"
prop="type"
>
<dict-tag
:options="dict.type.rule_type"
:value="form.type"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item
label="报警规则"
prop="referenceCon"
>
<el-select
v-model="form.referenceCon"
placeholder="请选择报警规则"
@change="referenceConChange()"
>
<el-option
v-for="dict in dict.type.judge_rules"
: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="type"
>
<el-select
v-model="form.alarmLevel"
placeholder="请选择报警等级"
>
<el-option
v-for="dict in dict.type.alarm_level"
: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="alertUpperBound"
>
<el-input-number
v-model="form.alertUpperBound"
placeholder="请输入报警高值"
:precision="2"
:step="0.1"
:max="1000000"
:min="-1000000"
></el-input-number>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="alertLowerBound">
<template slot="label">
报警下限值
<el-tooltip
class="item"
effect="dark"
>
<div slot="content">
当报警规则为区间内/外时该项必填且报警上限值必须大于下限值<br />
其余报警规则该项无需填写<br />
</div>
<i class="el-icon-question"></i>
</el-tooltip>
</template>
<el-input-number
:disabled="!(form.referenceCon === '区间内' || form.referenceCon === '区间外')"
v-model="form.alertLowerBound"
placeholder="请输入报警下限值"
:precision="2"
:step="0.1"
:max="1000000"
:min="-1000000"
></el-input-number>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item
label="规则描述"
prop="referenceName"
>
<el-input
type="textarea"
v-model="form.referenceName"
placeholder="请输入规则描述"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item
label="报警描述"
prop="description"
>
<el-input
type="textarea"
v-model="form.description"
placeholder="请输入报警描述"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div
slot="footer"
class="dialog-footer"
>
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['measure:alarm:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['measure:alarm:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['measure:alarm:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['measure:alarm:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="alarmList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="报警点" align="center" prop="location" />
<el-table-column label="报警类型" align="center" prop="alarmType" />
<el-table-column label="报警等级" align="center" prop="level" />
<el-table-column label="报警指标" align="center" prop="indicator" />
<el-table-column label="报警值" align="center" prop="alarmValue" />
<el-table-column label="报警时间" align="center" prop="alarmTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.alarmTime, '{y}-{m}-{d} {h}:{mi}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="最新报警时间" align="center" prop="alarmLastTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.alarmLastTime, '{y}-{m}-{d} {h}:{mi}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="备注信息" align="center" prop="remark" />
<el-table-column label="设备ID" align="center" prop="equipId" />
<el-table-column label="测点ID" align="center" prop="measureId" />
<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="['measure:alarm:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['measure:alarm:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改报警管理对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="报警点" prop="location">
<el-input v-model="form.location" placeholder="请输入报警点" />
</el-form-item>
<el-form-item label="报警类型" prop="alarmType">
<el-select v-model="form.alarmType" clearable placeholder="请选择报警类型">
<el-option
v-for="item in alarmTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="报警等级" prop="level">
<el-select v-model="form.level" clearable placeholder="请选择报警等级">
<el-option
v-for="item in levelOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="报警指标" prop="indicator">
<el-input v-model="form.indicator" placeholder="请输入报警指标" />
</el-form-item>
<el-form-item label="报警值" prop="alarmValue">
<el-input v-model="form.alarmValue" placeholder="请输入报警值" />
</el-form-item>
<el-form-item label="报警时间" prop="alarmTime">
<el-date-picker clearable
v-model="form.alarmTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择报警时间">
</el-date-picker>
</el-form-item>
<el-form-item label="最新报警时间" prop="alarmLastTime">
<el-date-picker clearable
v-model="form.alarmLastTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择最新报警时间">
</el-date-picker>
</el-form-item>
<el-form-item label="备注信息" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注信息" />
</el-form-item>
<el-form-item label="设备ID" prop="equipId">
<el-input v-model="form.equipId" placeholder="请输入设备ID" />
</el-form-item>
<el-form-item label="测点ID" prop="measureId">
<el-input v-model="form.measureId" placeholder="请输入测点ID" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
@click="submitForm"
> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
@ -235,35 +412,36 @@
</template>
<script>
import { listAlarm, getAlarm, delAlarm, addAlarm, updateAlarm } from "@/api/warn/alarm";
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: "Alarm",
name: "Rules",
dicts: ["alarm_level", "judge_rules", "rule_type"],
data() {
return {
alarmTypeOptions: [{
value: '智能报警',
label: '智能报警'
}, {
value: '手动报警',
label: '手动报警'
}],
levelOptions: [{
value: '1级',
label: '1级'
}, {
value: '2级',
label: '2级'
}, {
value: '3级',
label: '3级'
}, {
value: '4级',
label: '4级'
}, {
value: '5级',
label: '5级'
}],
//
loading: true,
//
@ -276,52 +454,149 @@ export default {
showSearch: true,
//
total: 0,
//
alarmList: [],
//
rulesList: [],
//
title: "",
//
open: false,
// ID
daterangeAlarmTime: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
location: null,
alarmType: null,
level: null,
indicator: null,
alarmTime: null,
alarmLastTime: null,
alarmName: null,
alarmInfoUnit: null,
equipId: null,
sensorId: null,
alertUpperBound: null,
alertLowerBound: null,
type: null,
description: null,
referenceName: null,
referenceCon: null,
alarmLevel: null,
sort: null,
},
monitorQuery: {
equipId: null,
measureId: null
},
//
form: {},
//
rules: {
}
alarmLevel: [
{ required: true, message: "请选择报警等级", trigger: "change" },
],
referenceCon: [
{ required: true, message: "请选择报警规则", trigger: "change" },
],
alertUpperBound: [
{ required: true, message: "请填写报警上限值", trigger: "change" },
{ validator: this.validateUpper, trigger: "blur" },
],
alertLowerBound: [{ validator: this.validateLower, trigger: "blur" }],
referenceName: [
{ required: true, message: "规则描述不能为空", trigger: "blur" },
{ max: 100, message: "规则描述长度不能大于100", trigger: "blur" },
],
description: [
{ required: true, message: "报警描述不能为空", trigger: "blur" },
{ max: 100, message: "报警描述长度不能大于100", trigger: "blur" },
],
},
monitorList: [],
activeName: "bottomCyl",
equipName: "",
};
},
created() {
this.getList();
},
methods: {
/** 查询报警管理列表 */
/** 报警上限值校验 */
validateUpper(rule, value, callback) {
if (
this.form.referenceCon === "区间内" ||
this.form.referenceCon === "区间外"
) {
if (value <= this.form.alertLowerBound) {
return callback(new Error("上限值需要大于下限值"));
}
}
return callback();
},
/** 报警下限值校验 */
validateLower(rule, value, callback) {
if (
this.form.referenceCon === "区间内" ||
this.form.referenceCon === "区间外"
) {
if (this.form.alertUpperBound <= value) {
return callback(new Error("下限值需要小于上限值"));
}
}
return callback();
},
referenceConChange() {
if (
!(
this.form.referenceCon === "区间内" ||
this.form.referenceCon === "区间外"
)
) {
this.form.alertLowerBound = 0;
}
},
handleTabClick() {
this.getList();
},
/** 查询设备报警规则列表 */
getList() {
this.loading = true;
this.queryParams.params = {};
if (null != this.daterangeAlarmTime && '' != this.daterangeAlarmTime) {
this.queryParams.params["beginAlarmTime"] = this.daterangeAlarmTime[0];
this.queryParams.params["endAlarmTime"] = this.daterangeAlarmTime[1];
// listRules(this.queryParams).then((response) => {
// this.rulesList = response.rows;
// this.total = response.total;
// this.loading = false;
// });
let equipQuery = {};
if (this.activeName == "bottomCyl") {
equipQuery.equipName = "超压底缸";
} else if (this.activeName == "topScoller") {
equipQuery.equipName = "可控中高辊顶辊";
} else {
equipQuery.equipName = "可控中高辊底辊";
}
listAlarm(this.queryParams).then(response => {
this.alarmList = response.rows;
listInfo(equipQuery).then((response) => {
this.equipName = equipQuery.equipName;
this.getRules(response.rows[0].id);
this.getMonitorData(response.rows[0].id);
});
},
getRules(equipId) {
this.queryParams.equipId = equipId;
console.log("查询的参数:", this.queryParams);
listRules(this.queryParams).then((response) => {
this.rulesList = response.rows;
this.total = response.total;
this.loading = false;
});
},
getMonitorData(equipId) {
this.monitorQuery.equipId = equipId;
getAllMonitorData(this.monitorQuery).then((response) => {
console.log("monitor:", response);
let list = response.data;
if (list.length <= 0) {
return;
}
list.forEach((element) => {
this.monitorList.push({
label: element.dataName,
value: element.dataKey,
});
});
});
},
//
cancel() {
this.open = false;
@ -331,15 +606,19 @@ export default {
reset() {
this.form = {
id: null,
location: null,
alarmType: null,
level: null,
indicator: null,
alarmTime: null,
alarmLastTime: null,
remark: null,
alarmName: null,
alarmInfoUnit: null,
equipId: null,
measureId: null
sensorId: null,
alertUpperBound: null,
alertLowerBound: null,
type: null,
description: null,
remark: null,
referenceName: null,
referenceCon: null,
alarmLevel: null,
sort: null,
};
this.resetForm("form");
},
@ -350,44 +629,43 @@ export default {
},
/** 重置按钮操作 */
resetQuery() {
this.daterangeAlarmTime = [];
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
this.ids = selection.map((item) => item.id);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加报警管理";
this.title = "添加设备报警规则";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getAlarm(id).then(response => {
const id = row.id || this.ids;
getRules(id).then((response) => {
this.form = response.data;
this.open = true;
this.title = "修改报警管理";
this.title = "修改设备报警规则";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.id != null) {
updateAlarm(this.form).then(response => {
updateRules(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addAlarm(this.form).then(response => {
addRules(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
@ -399,19 +677,27 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除报警管理编号为"' + ids + '"的数据项?').then(function() {
return delAlarm(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
this.$modal
.confirm('是否确认删除设备报警规则编号为"' + ids + '"的数据项?')
.then(function () {
return delRules(ids);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('measure/alarm/export', {
...this.queryParams
}, `alarm_${new Date().getTime()}.xlsx`)
}
}
this.download(
"system/rules/export",
{
...this.queryParams,
},
`rules_${new Date().getTime()}.xlsx`
);
},
},
};
</script>