Merge remote-tracking branch 'origin/master'
# Conflicts: # imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/inspection/InspectionInfoServiceImpl.java
This commit is contained in:
commit
a0ed1aa66a
@ -2,23 +2,26 @@ package com.inspur.module.data.job;
|
|||||||
|
|
||||||
import com.inspur.framework.common.util.date.DateUtils;
|
import com.inspur.framework.common.util.date.DateUtils;
|
||||||
import com.inspur.framework.quartz.core.handler.JobHandler;
|
import com.inspur.framework.quartz.core.handler.JobHandler;
|
||||||
import com.inspur.framework.tenant.core.job.TenantJob;
|
import com.inspur.framework.tenant.core.aop.TenantIgnore;
|
||||||
import com.inspur.module.data.service.InfluxDBService;
|
import com.inspur.module.data.service.InfluxDBService;
|
||||||
import com.inspur.module.system.api.alarm.AlarmRulesApi;
|
import com.inspur.module.system.api.alarm.AlarmRulesApi;
|
||||||
import com.inspur.module.system.api.alarm.dto.AlarmRulesRespDTO;
|
import com.inspur.module.system.api.alarm.dto.AlarmRulesRespDTO;
|
||||||
|
import com.inspur.module.system.dal.dataobject.equip.EquipInfoDO;
|
||||||
|
import com.inspur.module.system.service.equip.EquipInfoService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.ZonedDateTime;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 趋势报警定时任务
|
* 趋势报警定时任务
|
||||||
@ -37,28 +40,53 @@ public class TrendAlarmDataTimeoutJob implements JobHandler {
|
|||||||
@Resource
|
@Resource
|
||||||
private AlarmRulesApi alarmRulesApi;
|
private AlarmRulesApi alarmRulesApi;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private EquipInfoService equipInfoService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@TenantIgnore
|
||||||
public String execute(String param) throws Exception {
|
public String execute(String param) throws Exception {
|
||||||
String equid = "2e3d0190e63eda526da89d6c751f08f3";//TODO 固定
|
List<EquipInfoDO> equipInfoList = equipInfoService.getAllEquipInfoList();
|
||||||
|
if(equipInfoList.isEmpty()){
|
||||||
|
return "没有可用设备!";
|
||||||
|
}
|
||||||
|
// String equid = "2e3d0190e63eda526da89d6c751f08f3";//TODO 固定
|
||||||
|
// ZoneId zoneId = ZoneId.systemDefault();
|
||||||
|
// LocalDateTime now = LocalDateTime.now(zoneId);
|
||||||
|
// LocalDateTime onedayBefore = now.minusDays(1);
|
||||||
|
LocalDate today = LocalDate.now();
|
||||||
|
LocalDate yesterday = today.minusDays(1);
|
||||||
|
LocalDateTime startOfYesterday = yesterday.atStartOfDay();
|
||||||
|
LocalDateTime endOfYesterday = LocalDateTime.of(yesterday, LocalTime.MAX);
|
||||||
|
String beginTime = DateUtils.localDateTimeToUTC(startOfYesterday);
|
||||||
|
String endTime = DateUtils.localDateTimeToUTC(endOfYesterday);
|
||||||
//读取并计算需要过滤的数据:如温度差
|
//读取并计算需要过滤的数据:如温度差
|
||||||
ZoneId zoneId = ZoneId.systemDefault();
|
for (EquipInfoDO equipInfoDO : equipInfoList) {
|
||||||
LocalDateTime now = LocalDateTime.now(zoneId);
|
String equid = equipInfoDO.getEquipId();
|
||||||
LocalDateTime onedayBefore = now.minusDays(1);
|
List<AlarmRulesRespDTO> rules = alarmRulesApi.selectAlarmRulesListByCatch(equid);
|
||||||
String beginTime = DateUtils.localDateTimeToUTC(onedayBefore);
|
if(rules != null && rules.size() > 0){//预警规则过滤
|
||||||
String endTime = DateUtils.localDateTimeToUTC(now);
|
rules = rules.stream().filter(ruleData->ruleData.getType() == 1).collect(Collectors.toList());
|
||||||
//TODO 最好是从数据库中读取(需要趋势报警的参数名,参数值等)
|
Map<String, Object> diffDataMap = new HashMap<>();
|
||||||
Map<String, Object> diffDataMap = new HashMap<>();
|
rules.forEach(ruleData->{
|
||||||
Map<String, Object> diffDataMap1= selectDiffDataByColumnNameandDate(null, "gateway_channel_temp_data", "x_bear_temp", beginTime, endTime);
|
Map<String, Object> dataMap = selectDiffDataByColumnNameandDate(equid, ruleData.getTableName(), ruleData.getAlarmNameKey().substring(0,ruleData.getAlarmNameKey().lastIndexOf("_")), beginTime, endTime);
|
||||||
Map<String, Object> diffDataMap2 = selectDiffDataByColumnNameandDate(null, "gateway_channel_vibr_data", "x_entropy", beginTime, endTime);
|
diffDataMap.putAll(dataMap);
|
||||||
diffDataMap.putAll(diffDataMap1);
|
});
|
||||||
diffDataMap.putAll(diffDataMap2);
|
int alarmNum = alarmRulesApi.trendAlarmRulesFilter(diffDataMap, rules);
|
||||||
|
logger.info("本次趋势报警产生预警{}条",alarmNum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Map<String, Object> diffDataMap = new HashMap<>();
|
||||||
|
// Map<String, Object> diffDataMap1= selectDiffDataByColumnNameandDate(null, "gateway_channel_temp_data", "x_bear_temp", beginTime, endTime);
|
||||||
|
// Map<String, Object> diffDataMap2 = selectDiffDataByColumnNameandDate(null, "gateway_channel_vibr_data", "x_entropy", beginTime, endTime);
|
||||||
|
// diffDataMap.putAll(diffDataMap1);
|
||||||
|
// diffDataMap.putAll(diffDataMap2);
|
||||||
// logger.info("查询设备数据差值:" + diffDataMap.get("x_bear_temp_diff"));
|
// logger.info("查询设备数据差值:" + diffDataMap.get("x_bear_temp_diff"));
|
||||||
// logger.info("查询设备数据差值:" + diffDataMap.get("x_entropy_diff"));
|
// logger.info("查询设备数据差值:" + diffDataMap.get("x_entropy_diff"));
|
||||||
List<AlarmRulesRespDTO> rules = alarmRulesApi.selectAlarmRulesListByCatch(equid);
|
// List<AlarmRulesRespDTO> rules = alarmRulesApi.selectAlarmRulesListByCatch(equid);
|
||||||
if(rules != null && rules.size() > 0){//预警规则过滤
|
// if(rules != null && rules.size() > 0){//预警规则过滤
|
||||||
int alarmNum = alarmRulesApi.trendAlarmRulesFilter(diffDataMap, rules);
|
// int alarmNum = alarmRulesApi.trendAlarmRulesFilter(diffDataMap, rules);
|
||||||
logger.info("本次产生预警{}条",alarmNum);
|
// logger.info("本次趋势报警产生预警{}条",alarmNum);
|
||||||
}
|
// }
|
||||||
return "success";
|
return "success";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,5 +74,8 @@ public class AlarmRulesRespDTO {
|
|||||||
* 排序
|
* 排序
|
||||||
*/
|
*/
|
||||||
private Integer sort;
|
private Integer sort;
|
||||||
|
/**
|
||||||
|
* 表名
|
||||||
|
*/
|
||||||
|
private String tableName;
|
||||||
}
|
}
|
||||||
|
@ -84,6 +84,10 @@ public class AlarmRulesRespVO {
|
|||||||
@ExcelProperty("设备型号")
|
@ExcelProperty("设备型号")
|
||||||
private String equipNo;
|
private String equipNo;
|
||||||
|
|
||||||
|
@Schema(description = "设备名称")
|
||||||
|
@ExcelProperty("设备名称")
|
||||||
|
private String equipName;
|
||||||
|
|
||||||
@Schema(description = "客户名称")
|
@Schema(description = "客户名称")
|
||||||
@ExcelProperty("客户名称")
|
@ExcelProperty("客户名称")
|
||||||
private String customerName;
|
private String customerName;
|
||||||
@ -91,4 +95,8 @@ public class AlarmRulesRespVO {
|
|||||||
@Schema(description = "组件名称")
|
@Schema(description = "组件名称")
|
||||||
@ExcelProperty("组件名称")
|
@ExcelProperty("组件名称")
|
||||||
private String componentName;
|
private String componentName;
|
||||||
|
|
||||||
|
@Schema(description = "表名")
|
||||||
|
@ExcelProperty("表名")
|
||||||
|
private String tableName;
|
||||||
}
|
}
|
@ -62,4 +62,6 @@ public class AlarmRulesSaveReqVO {
|
|||||||
@Schema(description = "排序")
|
@Schema(description = "排序")
|
||||||
private Integer sort;
|
private Integer sort;
|
||||||
|
|
||||||
|
@Schema(description = "influxdb表名")
|
||||||
|
private String tableName;
|
||||||
}
|
}
|
@ -93,4 +93,8 @@ public class AlarmRulesDO extends BaseDO {
|
|||||||
* 租户编号
|
* 租户编号
|
||||||
*/
|
*/
|
||||||
private Long tenantId;
|
private Long tenantId;
|
||||||
|
/**
|
||||||
|
* 表名
|
||||||
|
*/
|
||||||
|
private String tableName;
|
||||||
}
|
}
|
@ -103,4 +103,9 @@ public class AlarmRulesDTO {
|
|||||||
* 组件名
|
* 组件名
|
||||||
*/
|
*/
|
||||||
private String componentName;
|
private String componentName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表名
|
||||||
|
*/
|
||||||
|
private String tableName;
|
||||||
}
|
}
|
||||||
|
@ -83,6 +83,7 @@ public interface AlarmRulesMapper extends BaseMapperX<AlarmRulesDO> {
|
|||||||
return selectJoinOne(AlarmRulesDTO.class,new MPJLambdaWrapperX<AlarmRulesDO>()
|
return selectJoinOne(AlarmRulesDTO.class,new MPJLambdaWrapperX<AlarmRulesDO>()
|
||||||
.selectAll(AlarmRulesDO.class)
|
.selectAll(AlarmRulesDO.class)
|
||||||
.selectAs(EquipInfoDO::getEquipNo, AlarmRulesDTO::getEquipNo)
|
.selectAs(EquipInfoDO::getEquipNo, AlarmRulesDTO::getEquipNo)
|
||||||
|
.selectAs(EquipInfoDO::getEquipName, AlarmRulesDTO::getEquipName)
|
||||||
.selectAs(ModelInfoDO::getModelName, AlarmRulesDTO::getModelName)
|
.selectAs(ModelInfoDO::getModelName, AlarmRulesDTO::getModelName)
|
||||||
.selectAs(CustomerInfoDO::getCustomerName, AlarmRulesDTO::getCustomerName)
|
.selectAs(CustomerInfoDO::getCustomerName, AlarmRulesDTO::getCustomerName)
|
||||||
.leftJoin(EquipInfoDO.class, EquipInfoDO::getEquipId, AlarmRulesDO::getEquipId)
|
.leftJoin(EquipInfoDO.class, EquipInfoDO::getEquipId, AlarmRulesDO::getEquipId)
|
||||||
|
@ -9,7 +9,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.inspur.framework.common.exception.ServiceException;
|
import com.inspur.framework.common.exception.ServiceException;
|
||||||
import com.inspur.framework.common.pojo.PageResult;
|
import com.inspur.framework.common.pojo.PageResult;
|
||||||
|
import com.inspur.framework.security.core.util.SecurityFrameworkUtils;
|
||||||
import com.inspur.framework.tenant.core.aop.TenantIgnore;
|
import com.inspur.framework.tenant.core.aop.TenantIgnore;
|
||||||
|
import com.inspur.module.system.constant.NoticeType;
|
||||||
import com.inspur.module.system.controller.admin.inspection.vo.InspectionPlanListReqVO;
|
import com.inspur.module.system.controller.admin.inspection.vo.InspectionPlanListReqVO;
|
||||||
import com.inspur.module.system.controller.baseData.vo.CustomerInfoSelectionVO;
|
import com.inspur.module.system.controller.baseData.vo.CustomerInfoSelectionVO;
|
||||||
import com.inspur.module.system.controller.equip.vo.EquipSelectionVO;
|
import com.inspur.module.system.controller.equip.vo.EquipSelectionVO;
|
||||||
@ -19,12 +21,13 @@ import com.inspur.module.system.dal.dataobject.inspection.InspectionFeedbackDO;
|
|||||||
import com.inspur.module.system.dal.dataobject.inspection.InspectionInfoDO;
|
import com.inspur.module.system.dal.dataobject.inspection.InspectionInfoDO;
|
||||||
import com.inspur.module.system.dal.dataobject.inspection.InspectionPlanDO;
|
import com.inspur.module.system.dal.dataobject.inspection.InspectionPlanDO;
|
||||||
import com.inspur.module.system.dal.dataobject.maintenance.MaintenanceOrderDO;
|
import com.inspur.module.system.dal.dataobject.maintenance.MaintenanceOrderDO;
|
||||||
|
import com.inspur.module.system.dal.dataobject.notify.NotifyMessageDO;
|
||||||
import com.inspur.module.system.dal.mysql.inspection.InspectionInfoMapper;
|
import com.inspur.module.system.dal.mysql.inspection.InspectionInfoMapper;
|
||||||
import com.inspur.module.system.service.alarm.AlarmDataService;
|
import com.inspur.module.system.service.alarm.AlarmDataService;
|
||||||
import com.inspur.module.system.service.baseData.CustomerInfoService;
|
import com.inspur.module.system.service.baseData.CustomerInfoService;
|
||||||
import com.inspur.module.system.service.equip.EquipInfoService;
|
import com.inspur.module.system.service.equip.EquipInfoService;
|
||||||
import com.inspur.module.system.service.maintenance.MaintenanceOrderService;
|
import com.inspur.module.system.service.maintenance.MaintenanceOrderService;
|
||||||
import org.aspectj.weaver.ast.Var;
|
import com.inspur.module.system.service.notify.NotifyMessageService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@ -61,6 +64,9 @@ public class InspectionInfoServiceImpl implements InspectionInfoService {
|
|||||||
@Resource
|
@Resource
|
||||||
private AlarmDataService alarmDataService;
|
private AlarmDataService alarmDataService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private NotifyMessageService notifyMessageService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private InspectionFeedbackService inspectionFeedbackService;
|
private InspectionFeedbackService inspectionFeedbackService;
|
||||||
|
|
||||||
@ -85,6 +91,19 @@ public class InspectionInfoServiceImpl implements InspectionInfoService {
|
|||||||
inspectionInfo.setInspectionNo("DJGD" + DateUtil.format(new Date(),"yyyyMMddHHmmss") + RandomUtil.randomInt(1, 10));
|
inspectionInfo.setInspectionNo("DJGD" + DateUtil.format(new Date(),"yyyyMMddHHmmss") + RandomUtil.randomInt(1, 10));
|
||||||
inspectionInfo.setStatus(0);
|
inspectionInfo.setStatus(0);
|
||||||
inspectionInfoMapper.insert(inspectionInfo);
|
inspectionInfoMapper.insert(inspectionInfo);
|
||||||
|
|
||||||
|
//消息推送
|
||||||
|
NotifyMessageDO noticeMessageDO = new NotifyMessageDO()
|
||||||
|
.setOrderId(inspectionInfo.getInspectionId())
|
||||||
|
.setTitle("新增点检工单通知")
|
||||||
|
.setContent("您有一个新的点检工单,请及时处理!")
|
||||||
|
.setType(NoticeType.INSPECTION_ORDER)
|
||||||
|
.setReadStatus(false)
|
||||||
|
.setUserId(SecurityFrameworkUtils.getLoginUserId())
|
||||||
|
.setTemplateNickname(SecurityFrameworkUtils.getLoginUserNickname())
|
||||||
|
.setTenantId(inspectionInfo.getTenantId());
|
||||||
|
notifyMessageService.createNotifyMessage(noticeMessageDO);
|
||||||
|
|
||||||
// 返回
|
// 返回
|
||||||
return inspectionInfo.getInspectionId();
|
return inspectionInfo.getInspectionId();
|
||||||
}
|
}
|
||||||
|
@ -153,8 +153,6 @@ public class MaintenanceOrderServiceImpl implements MaintenanceOrderService {
|
|||||||
maintenanceOrderMapper.updateById(new MaintenanceOrderDO().setMaintenanceOrderId(remoteMaintenanceOrder.getMaintenanceOrderId()).setProcessInstanceId(processInstanceId));
|
maintenanceOrderMapper.updateById(new MaintenanceOrderDO().setMaintenanceOrderId(remoteMaintenanceOrder.getMaintenanceOrderId()).setProcessInstanceId(processInstanceId));
|
||||||
}
|
}
|
||||||
//消息推送
|
//消息推送
|
||||||
// NoticeSaveReqVO noticeSaveReqVO = new NoticeSaveReqVO(null, "维修工单", NoticeType.MAINTENANCE_ORDER,"您有一个新的维修工单,请及时处理!", 0, remoteMaintenanceOrder.getTenantId(), remoteMaintenanceOrder.getMaintenanceOrderId());
|
|
||||||
// noticeService.createNotice(noticeSaveReqVO);
|
|
||||||
NotifyMessageDO noticeMessageDO = new NotifyMessageDO();
|
NotifyMessageDO noticeMessageDO = new NotifyMessageDO();
|
||||||
noticeMessageDO.setOrderId(remoteMaintenanceOrder.getMaintenanceOrderId());
|
noticeMessageDO.setOrderId(remoteMaintenanceOrder.getMaintenanceOrderId());
|
||||||
noticeMessageDO.setTitle("新增维修工单通知");
|
noticeMessageDO.setTitle("新增维修工单通知");
|
||||||
|
@ -15,15 +15,73 @@
|
|||||||
v-loading="formLoading"
|
v-loading="formLoading"
|
||||||
label-width="100px"
|
label-width="100px"
|
||||||
>
|
>
|
||||||
|
<el-col :span="10">
|
||||||
|
<el-form-item
|
||||||
|
label="机床设备"
|
||||||
|
prop="equipId"
|
||||||
|
>
|
||||||
|
<el-input
|
||||||
|
v-model="formData.equipName"
|
||||||
|
:disabled="true"
|
||||||
|
placeholder="请选择机床设备"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="2"> <el-button
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
@click="handleSeclectInfo"
|
||||||
|
>
|
||||||
|
选择机床
|
||||||
|
</el-button></el-col>
|
||||||
|
<el-col :span="10">
|
||||||
|
<el-form-item
|
||||||
|
label="机床组件"
|
||||||
|
prop="componentId"
|
||||||
|
>
|
||||||
|
<el-input
|
||||||
|
v-model="formData.componentName"
|
||||||
|
:disabled="true"
|
||||||
|
placeholder="请输入机床组件"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="2"> <el-button
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
@click="handleSeclectComponent"
|
||||||
|
>
|
||||||
|
选择组件
|
||||||
|
</el-button></el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item
|
<el-form-item
|
||||||
label="规则关键字"
|
label="规则关键字"
|
||||||
prop="alarmNameKey"
|
prop="alarmNameKey"
|
||||||
>
|
>
|
||||||
<el-input
|
<!-- <el-input
|
||||||
v-model="formData.alarmNameKey"
|
v-model="formData.alarmNameKey"
|
||||||
placeholder="请输入规则关键字"
|
placeholder="请输入规则关键字"
|
||||||
/>
|
/> -->
|
||||||
|
<div
|
||||||
|
v-if="!this.formData.alarmNameKey"
|
||||||
|
class="block"
|
||||||
|
>
|
||||||
|
<el-cascader
|
||||||
|
v-model="paramsData"
|
||||||
|
:disabled="this.formData.equipId == null"
|
||||||
|
:options="options"
|
||||||
|
:props="paramsProps"
|
||||||
|
collapse-tagss
|
||||||
|
@change="paramsSelectChange"
|
||||||
|
placeholder="请先选择设备,再选择参数"
|
||||||
|
style="width:100%"
|
||||||
|
></el-cascader>
|
||||||
|
</div>
|
||||||
|
<div v-else><span>{{ this.selectedNameKey }}</span> <el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
@click="changeNameKey"
|
||||||
|
>修改</el-button></div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
@ -67,44 +125,6 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="10">
|
|
||||||
<el-form-item
|
|
||||||
label="机床设备"
|
|
||||||
prop="equipId"
|
|
||||||
>
|
|
||||||
<el-input
|
|
||||||
v-model="formData.equipNo"
|
|
||||||
:disabled="true"
|
|
||||||
placeholder="请输入机床设备"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="2"> <el-button
|
|
||||||
type="primary"
|
|
||||||
size="small"
|
|
||||||
@click="handleSeclectInfo"
|
|
||||||
>
|
|
||||||
选择机床
|
|
||||||
</el-button></el-col>
|
|
||||||
<el-col :span="10">
|
|
||||||
<el-form-item
|
|
||||||
label="机床组件"
|
|
||||||
prop="componentId"
|
|
||||||
>
|
|
||||||
<el-input
|
|
||||||
v-model="formData.componentName"
|
|
||||||
:disabled="true"
|
|
||||||
placeholder="请输入机床组件"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="2"> <el-button
|
|
||||||
type="primary"
|
|
||||||
size="small"
|
|
||||||
@click="handleSeclectComponent"
|
|
||||||
>
|
|
||||||
选择组件
|
|
||||||
</el-button></el-col>
|
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item
|
<el-form-item
|
||||||
label="规则描述"
|
label="规则描述"
|
||||||
@ -270,6 +290,7 @@ import * as AlarmRulesApi from "@/api/system/alarm/alarmrules";
|
|||||||
import EquipInfoTable from "./EquipInfoTable.vue";
|
import EquipInfoTable from "./EquipInfoTable.vue";
|
||||||
import ComponentInfoTable from "./ComponentInfoTable.vue";
|
import ComponentInfoTable from "./ComponentInfoTable.vue";
|
||||||
import Editor from "@/components/Editor";
|
import Editor from "@/components/Editor";
|
||||||
|
import { getGatewayCardTree } from "@/api/system/gatewayinfo/card";
|
||||||
export default {
|
export default {
|
||||||
name: "AlarmRulesForm",
|
name: "AlarmRulesForm",
|
||||||
props: {
|
props: {
|
||||||
@ -306,6 +327,7 @@ export default {
|
|||||||
referenceCon: undefined,
|
referenceCon: undefined,
|
||||||
alarmLevel: undefined,
|
alarmLevel: undefined,
|
||||||
sort: undefined,
|
sort: undefined,
|
||||||
|
tableName: undefined,
|
||||||
},
|
},
|
||||||
// 表单校验
|
// 表单校验
|
||||||
formRules: {
|
formRules: {
|
||||||
@ -402,9 +424,41 @@ export default {
|
|||||||
openComp: false,
|
openComp: false,
|
||||||
// 弹出组件层标题
|
// 弹出组件层标题
|
||||||
titleComp: "",
|
titleComp: "",
|
||||||
|
options: [],
|
||||||
|
paramsProps: {},
|
||||||
|
paramsData: [],
|
||||||
|
selectedNameKey: "",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
changeNameKey() {
|
||||||
|
this.formData.alarmNameKey = null;
|
||||||
|
},
|
||||||
|
paramsSelectChange(e) {
|
||||||
|
if (this.paramsData && this.paramsData[1]) {
|
||||||
|
this.formData.alarmNameKey = this.selectedNameKey =
|
||||||
|
this.ruleType == "threshold"
|
||||||
|
? this.paramsData[1]
|
||||||
|
: this.paramsData[1] + "_diff";
|
||||||
|
// this.formData.alarmNameKey = this.paramsData[1];
|
||||||
|
this.formData.tableName = this.paramsData[0];
|
||||||
|
} else {
|
||||||
|
this.$message({
|
||||||
|
message: "选择的参数无效,请重新选择参数或者重选设备",
|
||||||
|
type: "warning",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async getParamsTree(equipId) {
|
||||||
|
const cardTree = await getGatewayCardTree(equipId);
|
||||||
|
var treeData = [];
|
||||||
|
this.options = cardTree.data;
|
||||||
|
// this.options.forEach((e) => {
|
||||||
|
// e.children = null;
|
||||||
|
// treeData.push(e);
|
||||||
|
// });
|
||||||
|
// this.options = treeData;
|
||||||
|
},
|
||||||
/** 报警上限值校验 */
|
/** 报警上限值校验 */
|
||||||
validateUpper(rule, value, callback) {
|
validateUpper(rule, value, callback) {
|
||||||
if (
|
if (
|
||||||
@ -471,9 +525,11 @@ export default {
|
|||||||
},
|
},
|
||||||
/** 获取选中设备 */
|
/** 获取选中设备 */
|
||||||
getEqu(data) {
|
getEqu(data) {
|
||||||
console.log("-->>选择的设备是", data);
|
// console.log("-->>选择的设备是", data);
|
||||||
this.formData.equipId = data.equipId;
|
this.formData.equipId = data.equipId;
|
||||||
this.formData.equipNo = data.equipNo;
|
this.formData.equipNo = data.equipNo;
|
||||||
|
this.formData.equipName = data.equipName;
|
||||||
|
this.getParamsTree(data.equipId);
|
||||||
// this.form.equipOrder = data.equipOrder;
|
// this.form.equipOrder = data.equipOrder;
|
||||||
// this.form.equipName = data.equipName;
|
// this.form.equipName = data.equipName;
|
||||||
// this.form.equipId = data.id;
|
// this.form.equipId = data.id;
|
||||||
@ -502,6 +558,8 @@ export default {
|
|||||||
try {
|
try {
|
||||||
const res = await AlarmRulesApi.getAlarmRules(id);
|
const res = await AlarmRulesApi.getAlarmRules(id);
|
||||||
this.formData = res.data;
|
this.formData = res.data;
|
||||||
|
this.selectedNameKey = res.data.alarmNameKey;
|
||||||
|
|
||||||
this.dialogTitle = "修改机床报警规则";
|
this.dialogTitle = "修改机床报警规则";
|
||||||
} finally {
|
} finally {
|
||||||
this.formLoading = false;
|
this.formLoading = false;
|
||||||
@ -555,7 +613,9 @@ export default {
|
|||||||
sort: undefined,
|
sort: undefined,
|
||||||
equipName: undefined,
|
equipName: undefined,
|
||||||
componentName: undefined,
|
componentName: undefined,
|
||||||
|
tableName: undefined,
|
||||||
};
|
};
|
||||||
|
this.selectedNameKey = null;
|
||||||
this.resetForm("formRef");
|
this.resetForm("formRef");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -521,7 +521,11 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
if (this.$route.query.orderId) {
|
||||||
|
this.getQueryData();
|
||||||
|
} else {
|
||||||
|
this.getList();
|
||||||
|
}
|
||||||
this.initSelection();
|
this.initSelection();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -637,6 +641,16 @@ export default {
|
|||||||
this.loading = false;
|
this.loading = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
/**跳转查询 */
|
||||||
|
async getQueryData() {
|
||||||
|
this.loading = true;
|
||||||
|
const res = await RemoteMaintenanceOrderApi.getRemoteMaintenanceOrder(
|
||||||
|
this.$route.query.orderId
|
||||||
|
);
|
||||||
|
this.list = [res.data];
|
||||||
|
this.total = this.list.length;
|
||||||
|
this.loading = false;
|
||||||
|
},
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
handleQuery() {
|
handleQuery() {
|
||||||
this.queryParams.pageNo = 1;
|
this.queryParams.pageNo = 1;
|
||||||
|
@ -108,6 +108,7 @@
|
|||||||
label="发送时间"
|
label="发送时间"
|
||||||
align="center"
|
align="center"
|
||||||
prop="createTime"
|
prop="createTime"
|
||||||
|
sortable
|
||||||
width="180"
|
width="180"
|
||||||
>
|
>
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
@ -195,9 +196,16 @@
|
|||||||
v-show="scope.row.orderId && scope.row.type === 3"
|
v-show="scope.row.orderId && scope.row.type === 3"
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-check"
|
icon="el-icon-tickets"
|
||||||
@click="handle2MaintenanceOrder(scope.row.orderId)"
|
@click="handle2MaintenanceOrder(scope.row.orderId)"
|
||||||
>维修工单</el-button>
|
>维修工单</el-button>
|
||||||
|
<el-button
|
||||||
|
v-show="scope.row.orderId && scope.row.type === 4"
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-tickets"
|
||||||
|
@click="handle2InspectionOrder(scope.row.orderId)"
|
||||||
|
>点检工单</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@ -299,6 +307,12 @@ export default {
|
|||||||
query: { orderId: orderId },
|
query: { orderId: orderId },
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
handle2InspectionOrder(orderId) {
|
||||||
|
this.$router.push({
|
||||||
|
path: "/maintenance/inspection-info",
|
||||||
|
query: { orderId: orderId },
|
||||||
|
});
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user