Commit b0b3f206 authored by 王晓倩's avatar 王晓倩

报警信息下发工单,新增巡检信息

parent dbaa9ea0
package com.zehong.web.controller.dataMonitoring; package com.zehong.web.controller.dataMonitoring;
import java.util.List; import java.util.List;
import com.zehong.system.domain.vo.DeviceAlarmVo;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -38,34 +40,34 @@ public class TDeviceAlarmController extends BaseController ...@@ -38,34 +40,34 @@ public class TDeviceAlarmController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('dataMonitoring:deviceAlarm:list')") @PreAuthorize("@ss.hasPermi('dataMonitoring:deviceAlarm:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(TDeviceAlarm tDeviceAlarm) public TableDataInfo list(TDeviceAlarm tDeviceAlarm) throws Exception
{ {
startPage(); startPage();
List<TDeviceAlarm> list = tDeviceAlarmService.selectTDeviceAlarmList(tDeviceAlarm); List<DeviceAlarmVo> list = null;
try {
list = tDeviceAlarmService.selectTDeviceAlarmList(tDeviceAlarm);
} catch (Exception e) {
e.printStackTrace();
throw new Exception("查询报警信息列表出错");
}
return getDataTable(list); return getDataTable(list);
} }
/**
* 导出报警信息列表
*/
@PreAuthorize("@ss.hasPermi('dataMonitoring:deviceAlarm:export')")
@Log(title = "报警信息", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TDeviceAlarm tDeviceAlarm)
{
List<TDeviceAlarm> list = tDeviceAlarmService.selectTDeviceAlarmList(tDeviceAlarm);
ExcelUtil<TDeviceAlarm> util = new ExcelUtil<TDeviceAlarm>(TDeviceAlarm.class);
return util.exportExcel(list, "报警信息数据");
}
/** /**
* 获取报警信息详细信息 * 获取报警信息详细信息
*/ */
@PreAuthorize("@ss.hasPermi('dataMonitoring:deviceAlarm:query')") @PreAuthorize("@ss.hasPermi('dataMonitoring:deviceAlarm:query')")
@GetMapping(value = "/{alarmId}") @GetMapping(value = "/{alarmId}")
public AjaxResult getInfo(@PathVariable("alarmId") int alarmId) public AjaxResult getInfo(@PathVariable("alarmId") int alarmId) throws Exception
{ {
return AjaxResult.success(tDeviceAlarmService.selectTDeviceAlarmById(alarmId)); DeviceAlarmVo deviceAlarmVo = null;
try {
deviceAlarmVo = tDeviceAlarmService.selectTDeviceAlarmById(alarmId);
} catch (Exception e) {
e.printStackTrace();
throw new Exception("获取报警信息详细信息出错");
}
return AjaxResult.success(deviceAlarmVo);
} }
/** /**
......
...@@ -66,9 +66,16 @@ public class TInspectionPlanController extends BaseController ...@@ -66,9 +66,16 @@ public class TInspectionPlanController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('deviceInspection:inspectionPlan:query')") @PreAuthorize("@ss.hasPermi('deviceInspection:inspectionPlan:query')")
@GetMapping(value = "/{planId}") @GetMapping(value = "/{planId}")
public AjaxResult getInfo(@PathVariable("planId") int planId) public AjaxResult getInfo(@PathVariable("planId") int planId) throws Exception
{ {
return AjaxResult.success(tInspectionPlanService.selectTInspectionPlanById(planId)); TInspectionPlan plan = null;
try {
plan = tInspectionPlanService.selectTInspectionPlanById(planId);
} catch (Exception e) {
e.printStackTrace();
throw new Exception("获取巡检计划详细信息失败");
}
return AjaxResult.success(plan);
} }
/** /**
...@@ -77,9 +84,16 @@ public class TInspectionPlanController extends BaseController ...@@ -77,9 +84,16 @@ public class TInspectionPlanController extends BaseController
@PreAuthorize("@ss.hasPermi('deviceInspection:inspectionPlan:add')") @PreAuthorize("@ss.hasPermi('deviceInspection:inspectionPlan:add')")
@Log(title = "巡检计划", businessType = BusinessType.INSERT) @Log(title = "巡检计划", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody TInspectionPlan tInspectionPlan) public AjaxResult add(@RequestBody TInspectionPlan tInspectionPlan) throws Exception
{ {
return toAjax(tInspectionPlanService.insertTInspectionPlan(tInspectionPlan)); int result = 0;
try {
result = tInspectionPlanService.insertTInspectionPlan(tInspectionPlan);
} catch (Exception e) {
e.printStackTrace();
throw new Exception("新增巡检计划失败");
}
return toAjax(result);
} }
/** /**
...@@ -88,9 +102,16 @@ public class TInspectionPlanController extends BaseController ...@@ -88,9 +102,16 @@ public class TInspectionPlanController extends BaseController
@PreAuthorize("@ss.hasPermi('deviceInspection:inspectionPlan:edit')") @PreAuthorize("@ss.hasPermi('deviceInspection:inspectionPlan:edit')")
@Log(title = "巡检计划", businessType = BusinessType.UPDATE) @Log(title = "巡检计划", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody TInspectionPlan tInspectionPlan) public AjaxResult edit(@RequestBody TInspectionPlan tInspectionPlan) throws Exception
{ {
return toAjax(tInspectionPlanService.updateTInspectionPlan(tInspectionPlan)); int result = 0;
try {
result = tInspectionPlanService.updateTInspectionPlan(tInspectionPlan);
} catch (Exception e) {
e.printStackTrace();
throw new Exception("修改巡检计划失败");
}
return toAjax(result);
} }
/** /**
......
...@@ -3,6 +3,7 @@ package com.zehong.system.domain.vo; ...@@ -3,6 +3,7 @@ package com.zehong.system.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.zehong.common.core.domain.BaseEntity; import com.zehong.common.core.domain.BaseEntity;
import com.zehong.system.domain.TDeviceInfo; import com.zehong.system.domain.TDeviceInfo;
import com.zehong.system.domain.TPipe;
import java.util.Date; import java.util.Date;
...@@ -25,8 +26,14 @@ public class DeviceAlarmVo extends BaseEntity ...@@ -25,8 +26,14 @@ public class DeviceAlarmVo extends BaseEntity
/** 设备类型(0管道,1调压阀,2阀门井,3流量计,4压力表) */ /** 设备类型(0管道,1调压阀,2阀门井,3流量计,4压力表) */
private String deviceType; private String deviceType;
/** 设备 */ /** 设备名称 */
private TDeviceInfo deviceInfo; private String deviceName;
/** 设备编号 */
private String deviceCode;
/** 物联网编号 */
private String iotNo;
/** 工单id */ /** 工单id */
private String orderId; private String orderId;
...@@ -76,12 +83,28 @@ public class DeviceAlarmVo extends BaseEntity ...@@ -76,12 +83,28 @@ public class DeviceAlarmVo extends BaseEntity
this.deviceType = deviceType; this.deviceType = deviceType;
} }
public TDeviceInfo getDeviceInfo() { public String getDeviceName() {
return deviceInfo; return deviceName;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public String getDeviceCode() {
return deviceCode;
}
public void setDeviceCode(String deviceCode) {
this.deviceCode = deviceCode;
}
public String getIotNo() {
return iotNo;
} }
public void setDeviceInfo(TDeviceInfo deviceInfo) { public void setIotNo(String iotNo) {
this.deviceInfo = deviceInfo; this.iotNo = iotNo;
} }
public void setOrderId(String orderId) public void setOrderId(String orderId)
......
...@@ -67,6 +67,14 @@ public interface TInspectionDataMapper ...@@ -67,6 +67,14 @@ public interface TInspectionDataMapper
*/ */
public int deleteTInspectionDataById(int dataId); public int deleteTInspectionDataById(int dataId);
/**
* 根据巡检计划id删除巡检记录
*
* @param planId 巡检计划ID
* @return 结果
*/
public int deleteTInspectionDataByPlanId(int planId);
/** /**
* 批量删除巡检记录 * 批量删除巡检记录
* *
......
...@@ -2,6 +2,7 @@ package com.zehong.system.service; ...@@ -2,6 +2,7 @@ package com.zehong.system.service;
import java.util.List; import java.util.List;
import com.zehong.system.domain.TDeviceAlarm; import com.zehong.system.domain.TDeviceAlarm;
import com.zehong.system.domain.vo.DeviceAlarmVo;
/** /**
* 报警信息Service接口 * 报警信息Service接口
...@@ -17,7 +18,7 @@ public interface ITDeviceAlarmService ...@@ -17,7 +18,7 @@ public interface ITDeviceAlarmService
* @param alarmId 报警信息ID * @param alarmId 报警信息ID
* @return 报警信息 * @return 报警信息
*/ */
public TDeviceAlarm selectTDeviceAlarmById(int alarmId); public DeviceAlarmVo selectTDeviceAlarmById(int alarmId) throws Exception;
/** /**
* 查询报警信息列表 * 查询报警信息列表
...@@ -25,7 +26,7 @@ public interface ITDeviceAlarmService ...@@ -25,7 +26,7 @@ public interface ITDeviceAlarmService
* @param tDeviceAlarm 报警信息 * @param tDeviceAlarm 报警信息
* @return 报警信息集合 * @return 报警信息集合
*/ */
public List<TDeviceAlarm> selectTDeviceAlarmList(TDeviceAlarm tDeviceAlarm); public List<DeviceAlarmVo> selectTDeviceAlarmList(TDeviceAlarm tDeviceAlarm) throws Exception;
/** /**
* 新增报警信息 * 新增报警信息
......
...@@ -18,7 +18,7 @@ public interface ITInspectionPlanService ...@@ -18,7 +18,7 @@ public interface ITInspectionPlanService
* @param planId 巡检计划ID * @param planId 巡检计划ID
* @return 巡检计划 * @return 巡检计划
*/ */
public TInspectionPlan selectTInspectionPlanById(int planId); public TInspectionPlan selectTInspectionPlanById(int planId) throws Exception;
/** /**
* 查询巡检计划列表 * 查询巡检计划列表
...@@ -34,7 +34,7 @@ public interface ITInspectionPlanService ...@@ -34,7 +34,7 @@ public interface ITInspectionPlanService
* @param tInspectionPlan 巡检计划 * @param tInspectionPlan 巡检计划
* @return 结果 * @return 结果
*/ */
public int insertTInspectionPlan(TInspectionPlan tInspectionPlan); public int insertTInspectionPlan(TInspectionPlan tInspectionPlan) throws Exception;
/** /**
* 修改巡检计划 * 修改巡检计划
...@@ -42,7 +42,7 @@ public interface ITInspectionPlanService ...@@ -42,7 +42,7 @@ public interface ITInspectionPlanService
* @param tInspectionPlan 巡检计划 * @param tInspectionPlan 巡检计划
* @return 结果 * @return 结果
*/ */
public int updateTInspectionPlan(TInspectionPlan tInspectionPlan); public int updateTInspectionPlan(TInspectionPlan tInspectionPlan) throws Exception;
/** /**
* 批量删除巡检计划 * 批量删除巡检计划
......
package com.zehong.system.service.impl; package com.zehong.system.service.impl;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.zehong.common.utils.DateUtils; import com.zehong.common.utils.DateUtils;
import com.zehong.system.domain.TDeviceInfo;
import com.zehong.system.domain.TPipe;
import com.zehong.system.domain.vo.DeviceAlarmVo;
import com.zehong.system.mapper.TDeviceInfoMapper;
import com.zehong.system.mapper.TPipeMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TDeviceAlarmMapper; import com.zehong.system.mapper.TDeviceAlarmMapper;
...@@ -19,6 +26,10 @@ public class TDeviceAlarmServiceImpl implements ITDeviceAlarmService ...@@ -19,6 +26,10 @@ public class TDeviceAlarmServiceImpl implements ITDeviceAlarmService
{ {
@Autowired @Autowired
private TDeviceAlarmMapper tDeviceAlarmMapper; private TDeviceAlarmMapper tDeviceAlarmMapper;
@Autowired
private TDeviceInfoMapper tDeviceInfoMapper;
@Autowired
private TPipeMapper tPipeMapper;
/** /**
* 查询报警信息 * 查询报警信息
...@@ -27,9 +38,25 @@ public class TDeviceAlarmServiceImpl implements ITDeviceAlarmService ...@@ -27,9 +38,25 @@ public class TDeviceAlarmServiceImpl implements ITDeviceAlarmService
* @return 报警信息 * @return 报警信息
*/ */
@Override @Override
public TDeviceAlarm selectTDeviceAlarmById(int alarmId) public DeviceAlarmVo selectTDeviceAlarmById(int alarmId) throws Exception
{ {
return tDeviceAlarmMapper.selectTDeviceAlarmById(alarmId); DeviceAlarmVo deviceAlarmVo = new DeviceAlarmVo();
TDeviceAlarm tDeviceAlarm = tDeviceAlarmMapper.selectTDeviceAlarmById(alarmId);
BeanUtils.copyProperties(tDeviceAlarm, deviceAlarmVo);
if("0".equals(tDeviceAlarm.getDeviceType())){
TPipe pipe = tPipeMapper.selectTPipeById(tDeviceAlarm.getDeviceId());
deviceAlarmVo.setDeviceCode(pipe.getPipeCode());
deviceAlarmVo.setDeviceName(pipe.getPipeName());
} else {
TDeviceInfo deviceInfo = tDeviceInfoMapper.selectTDeviceInfoById(tDeviceAlarm.getDeviceId());
deviceAlarmVo.setDeviceCode(deviceInfo.getDeviceCode());
deviceAlarmVo.setDeviceName(deviceInfo.getDeviceName());
deviceAlarmVo.setIotNo(deviceInfo.getIotNo());
}
return deviceAlarmVo;
} }
/** /**
...@@ -39,9 +66,28 @@ public class TDeviceAlarmServiceImpl implements ITDeviceAlarmService ...@@ -39,9 +66,28 @@ public class TDeviceAlarmServiceImpl implements ITDeviceAlarmService
* @return 报警信息 * @return 报警信息
*/ */
@Override @Override
public List<TDeviceAlarm> selectTDeviceAlarmList(TDeviceAlarm tDeviceAlarm) public List<DeviceAlarmVo> selectTDeviceAlarmList(TDeviceAlarm tDeviceAlarm) throws Exception
{ {
return tDeviceAlarmMapper.selectTDeviceAlarmList(tDeviceAlarm); List<DeviceAlarmVo> list = new ArrayList<>();
List<TDeviceAlarm> deviceAlarmList = tDeviceAlarmMapper.selectTDeviceAlarmList(tDeviceAlarm);
for(TDeviceAlarm alarm : deviceAlarmList){
DeviceAlarmVo deviceAlarmVo = new DeviceAlarmVo();
BeanUtils.copyProperties(alarm, deviceAlarmVo);
if("0".equals(tDeviceAlarm.getDeviceType())){
TPipe pipe = tPipeMapper.selectTPipeById(alarm.getDeviceId());
deviceAlarmVo.setDeviceCode(pipe.getPipeCode());
deviceAlarmVo.setDeviceName(pipe.getPipeName());
} else {
TDeviceInfo deviceInfo = tDeviceInfoMapper.selectTDeviceInfoById(alarm.getDeviceId());
deviceAlarmVo.setDeviceCode(deviceInfo.getDeviceCode());
deviceAlarmVo.setDeviceName(deviceInfo.getDeviceName());
}
list.add(deviceAlarmVo);
}
return list;
} }
/** /**
......
package com.zehong.system.service.impl; package com.zehong.system.service.impl;
import java.util.List; import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.zehong.common.utils.DateUtils; import com.zehong.common.utils.DateUtils;
import com.zehong.system.domain.TInspectionData;
import com.zehong.system.domain.form.InspectionPlanForm; import com.zehong.system.domain.form.InspectionPlanForm;
import com.zehong.system.domain.vo.InspectionPlanVo; import com.zehong.system.domain.vo.InspectionPlanVo;
import com.zehong.system.mapper.TInspectionDataMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TInspectionPlanMapper; import com.zehong.system.mapper.TInspectionPlanMapper;
...@@ -21,6 +26,8 @@ public class TInspectionPlanServiceImpl implements ITInspectionPlanService ...@@ -21,6 +26,8 @@ public class TInspectionPlanServiceImpl implements ITInspectionPlanService
{ {
@Autowired @Autowired
private TInspectionPlanMapper tInspectionPlanMapper; private TInspectionPlanMapper tInspectionPlanMapper;
@Autowired
private TInspectionDataMapper tInspectionDataMapper;
/** /**
* 查询巡检计划 * 查询巡检计划
...@@ -29,7 +36,7 @@ public class TInspectionPlanServiceImpl implements ITInspectionPlanService ...@@ -29,7 +36,7 @@ public class TInspectionPlanServiceImpl implements ITInspectionPlanService
* @return 巡检计划 * @return 巡检计划
*/ */
@Override @Override
public TInspectionPlan selectTInspectionPlanById(int planId) public TInspectionPlan selectTInspectionPlanById(int planId) throws Exception
{ {
return tInspectionPlanMapper.selectTInspectionPlanById(planId); return tInspectionPlanMapper.selectTInspectionPlanById(planId);
} }
...@@ -53,8 +60,35 @@ public class TInspectionPlanServiceImpl implements ITInspectionPlanService ...@@ -53,8 +60,35 @@ public class TInspectionPlanServiceImpl implements ITInspectionPlanService
* @return 结果 * @return 结果
*/ */
@Override @Override
public int insertTInspectionPlan(TInspectionPlan tInspectionPlan) public int insertTInspectionPlan(TInspectionPlan tInspectionPlan) throws Exception
{ {
String deviceIds = tInspectionPlan.getDeviceIds();
String[] stringArr = deviceIds.split("],");
String deviceType = null;
for(int i = 0; i < stringArr.length; i++) {
String[] temp = stringArr[i].split(",");
for (int j = 0; j < temp.length; j++) {
String regEx="[^0-9]";
Pattern p = Pattern.compile(regEx);
Matcher m = p.matcher(temp[j]);
// System.out.println(m.replaceAll("").trim());
if(j == 0) {
deviceType = m.replaceAll("").trim();
} else {
Integer deviceId = Integer.valueOf(m.replaceAll("").trim());
TInspectionData data = new TInspectionData();
data.setPlanId(tInspectionPlan.getPlanId());
data.setDeviceId(deviceId);
data.setDeviceType(deviceType);
data.setCreateTime(DateUtils.getNowDate());
tInspectionDataMapper.insertTInspectionData(data);
}
}
}
tInspectionPlan.setPlanStatus("0"); tInspectionPlan.setPlanStatus("0");
tInspectionPlan.setCreateTime(DateUtils.getNowDate()); tInspectionPlan.setCreateTime(DateUtils.getNowDate());
return tInspectionPlanMapper.insertTInspectionPlan(tInspectionPlan); return tInspectionPlanMapper.insertTInspectionPlan(tInspectionPlan);
...@@ -62,13 +96,43 @@ public class TInspectionPlanServiceImpl implements ITInspectionPlanService ...@@ -62,13 +96,43 @@ public class TInspectionPlanServiceImpl implements ITInspectionPlanService
/** /**
* 修改巡检计划 * 修改巡检计划
* *
* @param tInspectionPlan 巡检计划 * @param tInspectionPlan 巡检计划
* @return 结果 * @return 结果
*/ */
@Override @Override
public int updateTInspectionPlan(TInspectionPlan tInspectionPlan) public int updateTInspectionPlan(TInspectionPlan tInspectionPlan) throws Exception
{ {
tInspectionDataMapper.deleteTInspectionDataByPlanId(tInspectionPlan.getPlanId());
String deviceIds = tInspectionPlan.getDeviceIds();
String[] stringArr = deviceIds.split("],");
String deviceType = null;
for(int i = 0; i < stringArr.length; i++) {
String[] temp = stringArr[i].split(",");
for (int j = 0; j < temp.length; j++) {
String regEx="[^0-9]";
Pattern p = Pattern.compile(regEx);
Matcher m = p.matcher(temp[j]);
// System.out.println(m.replaceAll("").trim());
if(j == 0) {
deviceType = m.replaceAll("").trim();
} else {
Integer deviceId = Integer.valueOf(m.replaceAll("").trim());
TInspectionData data = new TInspectionData();
data.setPlanId(tInspectionPlan.getPlanId());
data.setDeviceId(deviceId);
data.setDeviceType(deviceType);
data.setCreateTime(DateUtils.getNowDate());
tInspectionDataMapper.insertTInspectionData(data);
}
}
}
tInspectionPlan.setUpdateTime(DateUtils.getNowDate()); tInspectionPlan.setUpdateTime(DateUtils.getNowDate());
return tInspectionPlanMapper.updateTInspectionPlan(tInspectionPlan); return tInspectionPlanMapper.updateTInspectionPlan(tInspectionPlan);
} }
......
...@@ -93,6 +93,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -93,6 +93,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
delete from t_inspection_data where data_id = #{dataId} delete from t_inspection_data where data_id = #{dataId}
</delete> </delete>
<delete id="deleteTInspectionDataByPlanId" parameterType="int">
delete from t_inspection_data where plan_id = #{planId}
</delete>
<delete id="deleteTInspectionDataByIds" parameterType="String"> <delete id="deleteTInspectionDataByIds" parameterType="String">
delete from t_inspection_data where data_id in delete from t_inspection_data where data_id in
<foreach item="dataId" collection="array" open="(" separator="," close=")"> <foreach item="dataId" collection="array" open="(" separator="," close=")">
......
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="设备编号" prop="deviceCode"> <!--<el-form-item label="设备编号" prop="deviceCode">
<el-input <el-input
v-model="queryParams.deviceCode" v-model="queryParams.deviceCode"
placeholder="请输入设备编号" placeholder="请输入设备编号"
...@@ -23,14 +23,26 @@ ...@@ -23,14 +23,26 @@
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <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-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item> </el-form-item>-->
</el-form> </el-form>
<el-table v-loading="loading" :data="deviceAlarmList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="deviceAlarmList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" align="center" type="index" /> <el-table-column label="设备名称" align="center" >
<el-table-column label="设备编号" align="center" prop="deviceCode" /> <template slot-scope="scope">
<el-table-column label="报警类型" align="center" prop="alarmType" /> <span>{{ scope.row.deviceName }}</span>
</template>
</el-table-column>
<el-table-column label="设备编号" align="center" >
<template slot-scope="scope">
<span>{{ scope.row.deviceCode }}</span>
</template>
</el-table-column>
<el-table-column label="报警类型" align="center" prop="alarmType" >
<template slot-scope="scope">
<span>{{ scope.row.alarmType }}</span>
</template>
</el-table-column>
<el-table-column label="报警值" align="center" prop="alarmValue" /> <el-table-column label="报警值" align="center" prop="alarmValue" />
<el-table-column label="报警开始时间" align="center" prop="startTime" width="180"> <el-table-column label="报警开始时间" align="center" prop="startTime" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
...@@ -44,27 +56,29 @@ ...@@ -44,27 +56,29 @@
</el-table-column> </el-table-column>
<el-table-column label="处理状态" align="center" prop="dealStatus" > <el-table-column label="处理状态" align="center" prop="dealStatus" >
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.dealStatus == null">未处理</span> <span v-if="scope.row.orderId == null || scope.row.orderId == ''">未下发</span>
<span v-if="scope.row.dealStatus == 3">已解决</span> <span v-if="(scope.row.dealStatus == null || scope.row.dealStatus == '')
<span v-if="scope.row.dealStatus != 3 && scope.row.dealStatus != null">已解决</span> && scope.row.orderId != null && scope.row.orderId != ''">未处理</span>
<span v-if="scope.row.dealStatus == 1">不需处理</span>
<span v-if="scope.row.dealStatus == 2">已处理完成</span>
<span v-if="scope.row.dealStatus == 3">未处理完成</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="normal"
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="handleAdd(scope.row)" @click="handleIssue(scope.row)"
v-hasPermi="['workOrder:basicsInfo:add']" v-hasPermi="['workOrder:basicsInfo:add']"
v-if="scope.row.orderId == '' || scope.row.orderId == null" v-if="scope.row.orderId == '' || scope.row.orderId == null"
>下发工单</el-button> >下发工单</el-button>
<el-button <el-button
size="mini" size="normal"
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="showDetail(scope.row)" @click="showDetail(scope.row)"
v-if="scope.row.orderId != '' && scope.row.orderId != null"
>详情</el-button> >详情</el-button>
</template> </template>
</el-table-column> </el-table-column>
...@@ -81,11 +95,30 @@ ...@@ -81,11 +95,30 @@
<!-- 添加工单信息对话框 --> <!-- 添加工单信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="130px"> <el-form ref="form" :model="form" :rules="rules" label-width="130px">
<el-form-item label="报警设备" prop="deviceName">
<font>{{form.deviceName}}</font>
</el-form-item>
<el-form-item label="报警类型" prop="alarmType">
<font>{{form.alarmType}}</font>
</el-form-item>
<el-form-item label="报警值" prop="alarmValue">
<font>{{form.alarmValue}}</font>
</el-form-item>
<el-form-item label="工单名称" prop="orderName"> <el-form-item label="工单名称" prop="orderName">
<el-input v-model="form.orderName" placeholder="请输入工单名称" /> <el-input v-model="form.orderName" placeholder="请输入工单名称" />
</el-form-item> </el-form-item>
<el-form-item label="指定执行人员" prop="appointInspector"> <el-form-item label="指定执行人员" prop="appointInspector">
<el-input v-model="form.appointInspector" placeholder="请输入指定执行人员" /> <el-select v-model="form.appointInspectorName" placeholder="请选择执行人员" clearable size="small" @change="setUserId">
<el-option
v-for="item in inspector"
:key="item.userId"
:label="item.nickName"
:value="item.userId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="工单描述" prop="remarks">
<el-input type="textarea" v-model="form.remarks" placeholder="请输入工单描述" />
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
...@@ -97,7 +130,7 @@ ...@@ -97,7 +130,7 @@
</template> </template>
<script> <script>
import { listDeviceAlarm } from "@/api/dataMonitoring/deviceAlarm"; import { listDeviceAlarm, getDeviceAlarm } from "@/api/dataMonitoring/deviceAlarm";
import { addBasicsInfo } from "@/api/workOrder/basicsInfo"; import { addBasicsInfo } from "@/api/workOrder/basicsInfo";
import { inspectorList } from "@/api/system/user"; import { inspectorList } from "@/api/system/user";
...@@ -123,10 +156,21 @@ export default { ...@@ -123,10 +156,21 @@ export default {
total: 0, total: 0,
// 报警信息表格数据 // 报警信息表格数据
deviceAlarmList: [], deviceAlarmList: [],
// 巡检员列表数据
inspectorList: [],
// 报警类型字典 // 报警类型字典
typeOptions: [], typeOptions: [],
// 设备级联
options: [],
props: {
multiple: true,
value: "id",
label: "name",
level: "level",
children: "childList",
},
devices: null,
// 巡检员列表
inspector: [],
// 弹出层标题 // 弹出层标题
title: "", title: "",
// 是否显示弹出层 // 是否显示弹出层
...@@ -141,13 +185,15 @@ export default { ...@@ -141,13 +185,15 @@ export default {
alarmValue: null, alarmValue: null,
startTime: null, startTime: null,
endTime: null, endTime: null,
dealStatus: null, dealStatus: null
remarks: null
}, },
// 表单参数 // 表单参数
form: {}, form: { },
// 表单校验 // 表单校验
rules: { rules: {
orderName: [
{ required: true, message: "工单名称不能为空", trigger: "blur" }
],
} }
}; };
}, },
...@@ -167,14 +213,16 @@ export default { ...@@ -167,14 +213,16 @@ export default {
this.loading = false; this.loading = false;
}); });
}, },
/** 获取用户信息列表 */ getInspectorList(){
getUserList() {
this.loading = true; this.loading = true;
inspectorList().then(response => { inspectorList().then(response => {
this.inspectorList = response.rows; this.inspector = response.data;
this.loading = false; this.loading = false;
}); });
}, },
setUserId(val){
this.form.appointInspector = val;
},
// 取消按钮 // 取消按钮
cancel() { cancel() {
this.open = false; this.open = false;
...@@ -212,18 +260,23 @@ export default { ...@@ -212,18 +260,23 @@ export default {
this.single = selection.length!==1 this.single = selection.length!==1
this.multiple = !selection.length this.multiple = !selection.length
}, },
/** 新增按钮操作 */ /** 下发按钮操作 */
handleAdd(row) { handleIssue(row) {
this.reset(); this.reset();
this.form.resourceId = row.alarmId; this.getInspectorList();
this.form.orderType = "3"; const alarmId = row.alarmId || this.ids
this.open = true; getDeviceAlarm(alarmId).then(response => {
this.title = "填写工单信息"; this.form = response.data;
this.open = true;
this.title = "下发工单";
});
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
this.form.resourceId = this.form.alarmId;
this.form.orderType = "3";
addBasicsInfo(this.form).then(response => { addBasicsInfo(this.form).then(response => {
this.msgSuccess("下发工单成功"); this.msgSuccess("下发工单成功");
this.open = false; this.open = false;
......
...@@ -149,7 +149,7 @@ ...@@ -149,7 +149,7 @@
<el-form-item label="巡检计划名称" prop="planName"> <el-form-item label="巡检计划名称" prop="planName">
<el-input v-model="form.planName" placeholder="请输入巡检计划名称"/> <el-input v-model="form.planName" placeholder="请输入巡检计划名称"/>
</el-form-item> </el-form-item>
<el-form-item v-model="form.deviceIds" label="巡检设备"> <el-form-item label="巡检设备" prop="devices">
<el-cascader <el-cascader
v-model="devices" v-model="devices"
:options="options" :options="options"
...@@ -286,6 +286,9 @@ ...@@ -286,6 +286,9 @@
orderName: [ orderName: [
{ required: true, message: "工单名称不能为空", trigger: "blur" } { required: true, message: "工单名称不能为空", trigger: "blur" }
], ],
// devices: [
// { required: true, message: '请选择巡检设备', trigger: 'change', type: 'array' }
// ],
} }
}; };
}, },
...@@ -346,6 +349,7 @@ ...@@ -346,6 +349,7 @@
createTime: null, createTime: null,
remarks: null remarks: null
}; };
this.devices = null;
this.resetForm("form"); this.resetForm("form");
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
...@@ -403,44 +407,45 @@ ...@@ -403,44 +407,45 @@
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
if (this.title == "修改巡检计划") { if(this.title != "下发工单") {
updateInspectionPlan(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else if (this.title == "添加巡检计划") {
// 二维数组转字符串(处理设备级联选项的值) // 二维数组转字符串(处理设备级联选项的值)
var arr = this.devices; var arr = this.devices;
var arrLen = arr.length; var arrLen = arr.length;
var str = "["; var str = "[";
for (var i = 0 ;i < arrLen ; i++){ for (var i = 0; i < arrLen; i++) {
str += "["; str += "[";
for(var j = 0; j < arr[i].length; j++){ for (var j = 0; j < arr[i].length; j++) {
str += arr[i][j]; str += arr[i][j];
if(j < arr[i].length-1){ if (j < arr[i].length - 1) {
str +=","; str += ",";
} }
} }
str += "]"; str += "]";
if(i<arrLen-1){ if (i < arrLen - 1) {
str+=","; str += ",";
} }
} }
str+="]"; str += "]";
this.form.deviceIds = str; this.form.deviceIds = str;
}
if (this.title == "修改巡检计划") {
updateInspectionPlan(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else if (this.title == "添加巡检计划") {
addInspectionPlan(this.form).then(response => { addInspectionPlan(this.form).then(response => {
this.msgSuccess("添加成功"); this.msgSuccess("添加成功");
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
} else if (this.title == "下发工单") { } else if (this.title == "下发工单") {
console.log(this.form);
this.form.resourceId = this.form.planId; this.form.resourceId = this.form.planId;
this.form.orderType = "1"; this.form.orderType = "1";
addBasicsInfo(this.form).then(response => { addBasicsInfo(this.form).then(response => {
this.msgSuccess("下发成功"); this.msgSuccess("下发工单成功");
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment