feat:网络设备运维平台,风险预警-风险预警,预警信息

This commit is contained in:
LiWeiJie 2024-08-30 14:58:58 +08:00
parent b1f9c52b80
commit 681cb0faf0
16 changed files with 1761 additions and 0 deletions

View File

@ -0,0 +1,104 @@
package com.god.web.controller.wlsbforewarning;
import com.god.wlsbforewarning.domain.WlsbEarlyWarningInformation;
import com.god.wlsbforewarning.service.IWlsbEarlyWarningInformationService;
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.god.common.annotation.Log;
import com.god.common.core.controller.BaseController;
import com.god.common.core.domain.AjaxResult;
import com.god.common.enums.BusinessType;
import com.god.common.utils.poi.ExcelUtil;
import com.god.common.core.page.TableDataInfo;
/**
* 预警信息Controller
*
* @author liweijie
* @date 2024-08-30
*/
@RestController
@RequestMapping("/wlsbEarly/warningInformation")
public class WlsbEarlyWarningInformationController extends BaseController
{
@Autowired
private IWlsbEarlyWarningInformationService wlsbEarlyWarningInformationService;
/**
* 查询预警信息列表
*/
@PreAuthorize("@ss.hasPermi('wlsbEarly:warningInformation:list')")
@GetMapping("/list")
public TableDataInfo list(WlsbEarlyWarningInformation wlsbEarlyWarningInformation)
{
startPage();
List<WlsbEarlyWarningInformation> list = wlsbEarlyWarningInformationService.selectWlsbEarlyWarningInformationList(wlsbEarlyWarningInformation);
return getDataTable(list);
}
/**
* 导出预警信息列表
*/
@PreAuthorize("@ss.hasPermi('wlsbEarly:warningInformation:export')")
@Log(title = "预警信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WlsbEarlyWarningInformation wlsbEarlyWarningInformation)
{
List<WlsbEarlyWarningInformation> list = wlsbEarlyWarningInformationService.selectWlsbEarlyWarningInformationList(wlsbEarlyWarningInformation);
ExcelUtil<WlsbEarlyWarningInformation> util = new ExcelUtil<WlsbEarlyWarningInformation>(WlsbEarlyWarningInformation.class);
util.exportExcel(response, list, "预警信息数据");
}
/**
* 获取预警信息详细信息
*/
@PreAuthorize("@ss.hasPermi('wlsbEarly:warningInformation:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id)
{
return success(wlsbEarlyWarningInformationService.selectWlsbEarlyWarningInformationById(id));
}
/**
* 新增预警信息
*/
@PreAuthorize("@ss.hasPermi('wlsbEarly:warningInformation:add')")
@Log(title = "预警信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WlsbEarlyWarningInformation wlsbEarlyWarningInformation)
{
return toAjax(wlsbEarlyWarningInformationService.insertWlsbEarlyWarningInformation(wlsbEarlyWarningInformation));
}
/**
* 修改预警信息
*/
@PreAuthorize("@ss.hasPermi('wlsbEarly:warningInformation:edit')")
@Log(title = "预警信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WlsbEarlyWarningInformation wlsbEarlyWarningInformation)
{
return toAjax(wlsbEarlyWarningInformationService.updateWlsbEarlyWarningInformation(wlsbEarlyWarningInformation));
}
/**
* 删除预警信息
*/
@PreAuthorize("@ss.hasPermi('wlsbEarly:warningInformation:remove')")
@Log(title = "预警信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(wlsbEarlyWarningInformationService.deleteWlsbEarlyWarningInformationByIds(ids));
}
}

View File

@ -0,0 +1,104 @@
package com.god.web.controller.wlsbforewarning;
import com.god.wlsbforewarning.domain.WlsbEarlyWarningType;
import com.god.wlsbforewarning.service.IWlsbEarlyWarningTypeService;
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.god.common.annotation.Log;
import com.god.common.core.controller.BaseController;
import com.god.common.core.domain.AjaxResult;
import com.god.common.enums.BusinessType;
import com.god.common.utils.poi.ExcelUtil;
import com.god.common.core.page.TableDataInfo;
/**
* 预警类型Controller
*
* @author liweijie
* @date 2024-08-30
*/
@RestController
@RequestMapping("/wlsbEarly/warningType")
public class WlsbEarlyWarningTypeController extends BaseController
{
@Autowired
private IWlsbEarlyWarningTypeService wlsbEarlyWarningTypeService;
/**
* 查询预警类型列表
*/
@PreAuthorize("@ss.hasPermi('wlsbEarly:warningType:list')")
@GetMapping("/list")
public TableDataInfo list(WlsbEarlyWarningType wlsbEarlyWarningType)
{
startPage();
List<WlsbEarlyWarningType> list = wlsbEarlyWarningTypeService.selectWlsbEarlyWarningTypeList(wlsbEarlyWarningType);
return getDataTable(list);
}
/**
* 导出预警类型列表
*/
@PreAuthorize("@ss.hasPermi('wlsbEarly:warningType:export')")
@Log(title = "预警类型", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WlsbEarlyWarningType wlsbEarlyWarningType)
{
List<WlsbEarlyWarningType> list = wlsbEarlyWarningTypeService.selectWlsbEarlyWarningTypeList(wlsbEarlyWarningType);
ExcelUtil<WlsbEarlyWarningType> util = new ExcelUtil<WlsbEarlyWarningType>(WlsbEarlyWarningType.class);
util.exportExcel(response, list, "预警类型数据");
}
/**
* 获取预警类型详细信息
*/
@PreAuthorize("@ss.hasPermi('wlsbEarly:warningType:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id)
{
return success(wlsbEarlyWarningTypeService.selectWlsbEarlyWarningTypeById(id));
}
/**
* 新增预警类型
*/
@PreAuthorize("@ss.hasPermi('wlsbEarly:warningType:add')")
@Log(title = "预警类型", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WlsbEarlyWarningType wlsbEarlyWarningType)
{
return toAjax(wlsbEarlyWarningTypeService.insertWlsbEarlyWarningType(wlsbEarlyWarningType));
}
/**
* 修改预警类型
*/
@PreAuthorize("@ss.hasPermi('wlsbEarly:warningType:edit')")
@Log(title = "预警类型", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WlsbEarlyWarningType wlsbEarlyWarningType)
{
return toAjax(wlsbEarlyWarningTypeService.updateWlsbEarlyWarningType(wlsbEarlyWarningType));
}
/**
* 删除预警类型
*/
@PreAuthorize("@ss.hasPermi('wlsbEarly:warningType:remove')")
@Log(title = "预警类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(wlsbEarlyWarningTypeService.deleteWlsbEarlyWarningTypeByIds(ids));
}
}

View File

@ -0,0 +1,81 @@
package com.god.wlsbforewarning.domain;
import java.time.LocalDateTime;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.god.common.annotation.Excel;
import com.god.common.core.domain.BaseEntity;
/**
* 预警信息对象 wlsb_early_warning_information
*
* @author liweijie
* @date 2024-08-30
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class WlsbEarlyWarningInformation extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private String id;
/** 区域 */
@Excel(name = "区域")
private String region;
/** 设备ID */
@Excel(name = "设备ID")
private String deviceId;
/** 设备名称 */
@Excel(name = "设备名称")
private String deviceName;
/** 时间 */
// @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
// @Excel(name = "时间", width = 30, dateFormat = "yyyy-MM-dd hh:mm:ss")
@Excel(name = "时间")
private String time;
/** 预警ID */
@Excel(name = "预警ID")
private String warningId;
/** 预警类型 */
@Excel(name = "预警类型")
private String warningType;
/** 预警级别 */
@Excel(name = "预警级别")
private String warningLevel;
/** 抓拍图片 */
@Excel(name = "抓拍图片")
private String capturedImage;
/** 预警信息 */
@Excel(name = "预警信息")
private String warningInfo;
/** 处理人 */
@Excel(name = "处理人")
private String handler;
/** 状态 */
@Excel(name = "状态")
private String status;
/** 备注 */
@Excel(name = "备注")
private String remarks;
}

View File

@ -0,0 +1,44 @@
package com.god.wlsbforewarning.domain;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.god.common.annotation.Excel;
import com.god.common.core.domain.BaseEntity;
/**
* 预警类型对象 wlsb_early_warning_type
*
* @author liweijie
* @date 2024-08-30
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class WlsbEarlyWarningType extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private String id;
/** 预警类型 */
@Excel(name = "预警类型")
private String warningType;
/** 影响级别 */
@Excel(name = "影响级别")
private String impactLevel;
/** 错误详情 */
@Excel(name = "错误详情")
private String errorDetails;
/** 推荐修复步骤 */
@Excel(name = "推荐修复步骤")
private String recommendedRepairSteps;
}

View File

@ -0,0 +1,61 @@
package com.god.wlsbforewarning.mapper;
import com.god.wlsbforewarning.domain.WlsbEarlyWarningInformation;
import java.util.List;
/**
* 预警信息Mapper接口
*
* @author liweijie
* @date 2024-08-30
*/
public interface WlsbEarlyWarningInformationMapper
{
/**
* 查询预警信息
*
* @param id 预警信息主键
* @return 预警信息
*/
public WlsbEarlyWarningInformation selectWlsbEarlyWarningInformationById(String id);
/**
* 查询预警信息列表
*
* @param wlsbEarlyWarningInformation 预警信息
* @return 预警信息集合
*/
public List<WlsbEarlyWarningInformation> selectWlsbEarlyWarningInformationList(WlsbEarlyWarningInformation wlsbEarlyWarningInformation);
/**
* 新增预警信息
*
* @param wlsbEarlyWarningInformation 预警信息
* @return 结果
*/
public int insertWlsbEarlyWarningInformation(WlsbEarlyWarningInformation wlsbEarlyWarningInformation);
/**
* 修改预警信息
*
* @param wlsbEarlyWarningInformation 预警信息
* @return 结果
*/
public int updateWlsbEarlyWarningInformation(WlsbEarlyWarningInformation wlsbEarlyWarningInformation);
/**
* 删除预警信息
*
* @param id 预警信息主键
* @return 结果
*/
public int deleteWlsbEarlyWarningInformationById(String id);
/**
* 批量删除预警信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteWlsbEarlyWarningInformationByIds(String[] ids);
}

View File

@ -0,0 +1,61 @@
package com.god.wlsbforewarning.mapper;
import com.god.wlsbforewarning.domain.WlsbEarlyWarningType;
import java.util.List;
/**
* 预警类型Mapper接口
*
* @author liweijie
* @date 2024-08-30
*/
public interface WlsbEarlyWarningTypeMapper
{
/**
* 查询预警类型
*
* @param id 预警类型主键
* @return 预警类型
*/
public WlsbEarlyWarningType selectWlsbEarlyWarningTypeById(String id);
/**
* 查询预警类型列表
*
* @param wlsbEarlyWarningType 预警类型
* @return 预警类型集合
*/
public List<WlsbEarlyWarningType> selectWlsbEarlyWarningTypeList(WlsbEarlyWarningType wlsbEarlyWarningType);
/**
* 新增预警类型
*
* @param wlsbEarlyWarningType 预警类型
* @return 结果
*/
public int insertWlsbEarlyWarningType(WlsbEarlyWarningType wlsbEarlyWarningType);
/**
* 修改预警类型
*
* @param wlsbEarlyWarningType 预警类型
* @return 结果
*/
public int updateWlsbEarlyWarningType(WlsbEarlyWarningType wlsbEarlyWarningType);
/**
* 删除预警类型
*
* @param id 预警类型主键
* @return 结果
*/
public int deleteWlsbEarlyWarningTypeById(String id);
/**
* 批量删除预警类型
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteWlsbEarlyWarningTypeByIds(String[] ids);
}

View File

@ -0,0 +1,61 @@
package com.god.wlsbforewarning.service;
import com.god.wlsbforewarning.domain.WlsbEarlyWarningInformation;
import java.util.List;
/**
* 预警信息Service接口
*
* @author liweijie
* @date 2024-08-30
*/
public interface IWlsbEarlyWarningInformationService
{
/**
* 查询预警信息
*
* @param id 预警信息主键
* @return 预警信息
*/
public WlsbEarlyWarningInformation selectWlsbEarlyWarningInformationById(String id);
/**
* 查询预警信息列表
*
* @param wlsbEarlyWarningInformation 预警信息
* @return 预警信息集合
*/
public List<WlsbEarlyWarningInformation> selectWlsbEarlyWarningInformationList(WlsbEarlyWarningInformation wlsbEarlyWarningInformation);
/**
* 新增预警信息
*
* @param wlsbEarlyWarningInformation 预警信息
* @return 结果
*/
public int insertWlsbEarlyWarningInformation(WlsbEarlyWarningInformation wlsbEarlyWarningInformation);
/**
* 修改预警信息
*
* @param wlsbEarlyWarningInformation 预警信息
* @return 结果
*/
public int updateWlsbEarlyWarningInformation(WlsbEarlyWarningInformation wlsbEarlyWarningInformation);
/**
* 批量删除预警信息
*
* @param ids 需要删除的预警信息主键集合
* @return 结果
*/
public int deleteWlsbEarlyWarningInformationByIds(String[] ids);
/**
* 删除预警信息信息
*
* @param id 预警信息主键
* @return 结果
*/
public int deleteWlsbEarlyWarningInformationById(String id);
}

View File

@ -0,0 +1,61 @@
package com.god.wlsbforewarning.service;
import com.god.wlsbforewarning.domain.WlsbEarlyWarningType;
import java.util.List;
/**
* 预警类型Service接口
*
* @author liweijie
* @date 2024-08-30
*/
public interface IWlsbEarlyWarningTypeService
{
/**
* 查询预警类型
*
* @param id 预警类型主键
* @return 预警类型
*/
public WlsbEarlyWarningType selectWlsbEarlyWarningTypeById(String id);
/**
* 查询预警类型列表
*
* @param wlsbEarlyWarningType 预警类型
* @return 预警类型集合
*/
public List<WlsbEarlyWarningType> selectWlsbEarlyWarningTypeList(WlsbEarlyWarningType wlsbEarlyWarningType);
/**
* 新增预警类型
*
* @param wlsbEarlyWarningType 预警类型
* @return 结果
*/
public int insertWlsbEarlyWarningType(WlsbEarlyWarningType wlsbEarlyWarningType);
/**
* 修改预警类型
*
* @param wlsbEarlyWarningType 预警类型
* @return 结果
*/
public int updateWlsbEarlyWarningType(WlsbEarlyWarningType wlsbEarlyWarningType);
/**
* 批量删除预警类型
*
* @param ids 需要删除的预警类型主键集合
* @return 结果
*/
public int deleteWlsbEarlyWarningTypeByIds(String[] ids);
/**
* 删除预警类型信息
*
* @param id 预警类型主键
* @return 结果
*/
public int deleteWlsbEarlyWarningTypeById(String id);
}

View File

@ -0,0 +1,95 @@
package com.god.wlsbforewarning.service.impl;
import com.god.common.utils.uuid.IdUtils;
import com.god.wlsbforewarning.domain.WlsbEarlyWarningInformation;
import com.god.wlsbforewarning.mapper.WlsbEarlyWarningInformationMapper;
import com.god.wlsbforewarning.service.IWlsbEarlyWarningInformationService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 预警信息Service业务层处理
*
* @author liweijie
* @date 2024-08-30
*/
@Service
public class WlsbEarlyWarningInformationServiceImpl implements IWlsbEarlyWarningInformationService
{
@Autowired
private WlsbEarlyWarningInformationMapper wlsbEarlyWarningInformationMapper;
/**
* 查询预警信息
*
* @param id 预警信息主键
* @return 预警信息
*/
@Override
public WlsbEarlyWarningInformation selectWlsbEarlyWarningInformationById(String id)
{
return wlsbEarlyWarningInformationMapper.selectWlsbEarlyWarningInformationById(id);
}
/**
* 查询预警信息列表
*
* @param wlsbEarlyWarningInformation 预警信息
* @return 预警信息
*/
@Override
public List<WlsbEarlyWarningInformation> selectWlsbEarlyWarningInformationList(WlsbEarlyWarningInformation wlsbEarlyWarningInformation)
{
return wlsbEarlyWarningInformationMapper.selectWlsbEarlyWarningInformationList(wlsbEarlyWarningInformation);
}
/**
* 新增预警信息
*
* @param wlsbEarlyWarningInformation 预警信息
* @return 结果
*/
@Override
public int insertWlsbEarlyWarningInformation(WlsbEarlyWarningInformation wlsbEarlyWarningInformation)
{
wlsbEarlyWarningInformation.setId(IdUtils.fastSimpleUUID());
return wlsbEarlyWarningInformationMapper.insertWlsbEarlyWarningInformation(wlsbEarlyWarningInformation);
}
/**
* 修改预警信息
*
* @param wlsbEarlyWarningInformation 预警信息
* @return 结果
*/
@Override
public int updateWlsbEarlyWarningInformation(WlsbEarlyWarningInformation wlsbEarlyWarningInformation)
{
return wlsbEarlyWarningInformationMapper.updateWlsbEarlyWarningInformation(wlsbEarlyWarningInformation);
}
/**
* 批量删除预警信息
*
* @param ids 需要删除的预警信息主键
* @return 结果
*/
@Override
public int deleteWlsbEarlyWarningInformationByIds(String[] ids)
{
return wlsbEarlyWarningInformationMapper.deleteWlsbEarlyWarningInformationByIds(ids);
}
/**
* 删除预警信息信息
*
* @param id 预警信息主键
* @return 结果
*/
@Override
public int deleteWlsbEarlyWarningInformationById(String id)
{
return wlsbEarlyWarningInformationMapper.deleteWlsbEarlyWarningInformationById(id);
}
}

View File

@ -0,0 +1,95 @@
package com.god.wlsbforewarning.service.impl;
import com.god.common.utils.uuid.IdUtils;
import com.god.wlsbforewarning.domain.WlsbEarlyWarningType;
import com.god.wlsbforewarning.mapper.WlsbEarlyWarningTypeMapper;
import com.god.wlsbforewarning.service.IWlsbEarlyWarningTypeService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 预警类型Service业务层处理
*
* @author liweijie
* @date 2024-08-30
*/
@Service
public class WlsbEarlyWarningTypeServiceImpl implements IWlsbEarlyWarningTypeService
{
@Autowired
private WlsbEarlyWarningTypeMapper wlsbEarlyWarningTypeMapper;
/**
* 查询预警类型
*
* @param id 预警类型主键
* @return 预警类型
*/
@Override
public WlsbEarlyWarningType selectWlsbEarlyWarningTypeById(String id)
{
return wlsbEarlyWarningTypeMapper.selectWlsbEarlyWarningTypeById(id);
}
/**
* 查询预警类型列表
*
* @param wlsbEarlyWarningType 预警类型
* @return 预警类型
*/
@Override
public List<WlsbEarlyWarningType> selectWlsbEarlyWarningTypeList(WlsbEarlyWarningType wlsbEarlyWarningType)
{
return wlsbEarlyWarningTypeMapper.selectWlsbEarlyWarningTypeList(wlsbEarlyWarningType);
}
/**
* 新增预警类型
*
* @param wlsbEarlyWarningType 预警类型
* @return 结果
*/
@Override
public int insertWlsbEarlyWarningType(WlsbEarlyWarningType wlsbEarlyWarningType)
{
wlsbEarlyWarningType.setId(IdUtils.fastSimpleUUID());
return wlsbEarlyWarningTypeMapper.insertWlsbEarlyWarningType(wlsbEarlyWarningType);
}
/**
* 修改预警类型
*
* @param wlsbEarlyWarningType 预警类型
* @return 结果
*/
@Override
public int updateWlsbEarlyWarningType(WlsbEarlyWarningType wlsbEarlyWarningType)
{
return wlsbEarlyWarningTypeMapper.updateWlsbEarlyWarningType(wlsbEarlyWarningType);
}
/**
* 批量删除预警类型
*
* @param ids 需要删除的预警类型主键
* @return 结果
*/
@Override
public int deleteWlsbEarlyWarningTypeByIds(String[] ids)
{
return wlsbEarlyWarningTypeMapper.deleteWlsbEarlyWarningTypeByIds(ids);
}
/**
* 删除预警类型信息
*
* @param id 预警类型主键
* @return 结果
*/
@Override
public int deleteWlsbEarlyWarningTypeById(String id)
{
return wlsbEarlyWarningTypeMapper.deleteWlsbEarlyWarningTypeById(id);
}
}

View File

@ -0,0 +1,113 @@
<?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.god.wlsbforewarning.mapper.WlsbEarlyWarningInformationMapper">
<resultMap type="WlsbEarlyWarningInformation" id="WlsbEarlyWarningInformationResult">
<result property="id" column="id" />
<result property="region" column="region" />
<result property="deviceId" column="device_id" />
<result property="deviceName" column="device_name" />
<result property="time" column="time" />
<result property="warningId" column="warning_id" />
<result property="warningType" column="warning_type" />
<result property="warningLevel" column="warning_level" />
<result property="capturedImage" column="captured_image" />
<result property="warningInfo" column="warning_info" />
<result property="handler" column="handler" />
<result property="status" column="status" />
<result property="remarks" column="remarks" />
</resultMap>
<sql id="selectWlsbEarlyWarningInformationVo">
select id, region, device_id, device_name, time, warning_id, warning_type, warning_level, captured_image, warning_info, handler, status, remarks from wlsb_early_warning_information
</sql>
<select id="selectWlsbEarlyWarningInformationList" parameterType="WlsbEarlyWarningInformation" resultMap="WlsbEarlyWarningInformationResult">
<include refid="selectWlsbEarlyWarningInformationVo"/>
<where>
<if test="region != null and region != ''"> and region like concat('%', #{region}, '%')</if>
<if test="deviceId != null and deviceId != ''"> and device_id like concat('%', #{deviceId}, '%')</if>
<if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
<if test="params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != ''"> and time between #{params.beginTime} and #{params.endTime}</if>
<if test="warningId != null and warningId != ''"> and warning_id like concat('%', #{warningId}, '%')</if>
<if test="warningType != null and warningType != ''"> and warning_type like concat('%', #{warningType}, '%')</if>
<if test="warningLevel != null and warningLevel != ''"> and warning_level like concat('%', #{warningLevel}, '%')</if>
<if test="capturedImage != null and capturedImage != ''"> and captured_image like concat('%', #{capturedImage}, '%')</if>
<if test="warningInfo != null and warningInfo != ''"> and warning_info like concat('%', #{warningInfo}, '%')</if>
<if test="handler != null and handler != ''"> and handler like concat('%', #{handler}, '%')</if>
<if test="status != null and status != ''"> and status like concat('%', #{status}, '%')</if>
<if test="remarks != null and remarks != ''"> and remarks like concat('%', #{remarks}, '%')</if>
</where>
</select>
<select id="selectWlsbEarlyWarningInformationById" parameterType="String" resultMap="WlsbEarlyWarningInformationResult">
<include refid="selectWlsbEarlyWarningInformationVo"/>
where id = #{id}
</select>
<insert id="insertWlsbEarlyWarningInformation" parameterType="WlsbEarlyWarningInformation">
insert into wlsb_early_warning_information
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="region != null">region,</if>
<if test="deviceId != null">device_id,</if>
<if test="deviceName != null">device_name,</if>
<if test="time != null">time,</if>
<if test="warningId != null">warning_id,</if>
<if test="warningType != null">warning_type,</if>
<if test="warningLevel != null">warning_level,</if>
<if test="capturedImage != null">captured_image,</if>
<if test="warningInfo != null">warning_info,</if>
<if test="handler != null">handler,</if>
<if test="status != null">status,</if>
<if test="remarks != null">remarks,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="region != null">#{region},</if>
<if test="deviceId != null">#{deviceId},</if>
<if test="deviceName != null">#{deviceName},</if>
<if test="time != null">#{time},</if>
<if test="warningId != null">#{warningId},</if>
<if test="warningType != null">#{warningType},</if>
<if test="warningLevel != null">#{warningLevel},</if>
<if test="capturedImage != null">#{capturedImage},</if>
<if test="warningInfo != null">#{warningInfo},</if>
<if test="handler != null">#{handler},</if>
<if test="status != null">#{status},</if>
<if test="remarks != null">#{remarks},</if>
</trim>
</insert>
<update id="updateWlsbEarlyWarningInformation" parameterType="WlsbEarlyWarningInformation">
update wlsb_early_warning_information
<trim prefix="SET" suffixOverrides=",">
<if test="region != null">region = #{region},</if>
<if test="deviceId != null">device_id = #{deviceId},</if>
<if test="deviceName != null">device_name = #{deviceName},</if>
<if test="time != null">time = #{time},</if>
<if test="warningId != null">warning_id = #{warningId},</if>
<if test="warningType != null">warning_type = #{warningType},</if>
<if test="warningLevel != null">warning_level = #{warningLevel},</if>
<if test="capturedImage != null">captured_image = #{capturedImage},</if>
<if test="warningInfo != null">warning_info = #{warningInfo},</if>
<if test="handler != null">handler = #{handler},</if>
<if test="status != null">status = #{status},</if>
<if test="remarks != null">remarks = #{remarks},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteWlsbEarlyWarningInformationById" parameterType="String">
delete from wlsb_early_warning_information where id = #{id}
</delete>
<delete id="deleteWlsbEarlyWarningInformationByIds" parameterType="String">
delete from wlsb_early_warning_information where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,73 @@
<?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.god.wlsbforewarning.mapper.WlsbEarlyWarningTypeMapper">
<resultMap type="WlsbEarlyWarningType" id="WlsbEarlyWarningTypeResult">
<result property="id" column="id" />
<result property="warningType" column="warning_type" />
<result property="impactLevel" column="impact_level" />
<result property="errorDetails" column="error_details" />
<result property="recommendedRepairSteps" column="recommended_repair_steps" />
</resultMap>
<sql id="selectWlsbEarlyWarningTypeVo">
select id, warning_type, impact_level, error_details, recommended_repair_steps from wlsb_early_warning_type
</sql>
<select id="selectWlsbEarlyWarningTypeList" parameterType="WlsbEarlyWarningType" resultMap="WlsbEarlyWarningTypeResult">
<include refid="selectWlsbEarlyWarningTypeVo"/>
<where>
<if test="warningType != null and warningType != ''"> and warning_type like concat('%', #{warningType}, '%')</if>
<if test="impactLevel != null and impactLevel != ''"> and impact_level like concat('%', #{impactLevel}, '%')</if>
<if test="errorDetails != null and errorDetails != ''"> and error_details like concat('%', #{errorDetails}, '%')</if>
<if test="recommendedRepairSteps != null and recommendedRepairSteps != ''"> and recommended_repair_steps like concat('%', #{recommendedRepairSteps}, '%')</if>
</where>
</select>
<select id="selectWlsbEarlyWarningTypeById" parameterType="String" resultMap="WlsbEarlyWarningTypeResult">
<include refid="selectWlsbEarlyWarningTypeVo"/>
where id = #{id}
</select>
<insert id="insertWlsbEarlyWarningType" parameterType="WlsbEarlyWarningType">
insert into wlsb_early_warning_type
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="warningType != null">warning_type,</if>
<if test="impactLevel != null">impact_level,</if>
<if test="errorDetails != null">error_details,</if>
<if test="recommendedRepairSteps != null">recommended_repair_steps,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="warningType != null">#{warningType},</if>
<if test="impactLevel != null">#{impactLevel},</if>
<if test="errorDetails != null">#{errorDetails},</if>
<if test="recommendedRepairSteps != null">#{recommendedRepairSteps},</if>
</trim>
</insert>
<update id="updateWlsbEarlyWarningType" parameterType="WlsbEarlyWarningType">
update wlsb_early_warning_type
<trim prefix="SET" suffixOverrides=",">
<if test="warningType != null">warning_type = #{warningType},</if>
<if test="impactLevel != null">impact_level = #{impactLevel},</if>
<if test="errorDetails != null">error_details = #{errorDetails},</if>
<if test="recommendedRepairSteps != null">recommended_repair_steps = #{recommendedRepairSteps},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteWlsbEarlyWarningTypeById" parameterType="String">
delete from wlsb_early_warning_type where id = #{id}
</delete>
<delete id="deleteWlsbEarlyWarningTypeByIds" parameterType="String">
delete from wlsb_early_warning_type 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 listWarningInformation(query) {
return request({
url: '/wlsbEarly/warningInformation/list',
method: 'get',
params: query
})
}
// 查询预警信息详细
export function getWarningInformation(id) {
return request({
url: '/wlsbEarly/warningInformation/' + id,
method: 'get'
})
}
// 新增预警信息
export function addWarningInformation(data) {
return request({
url: '/wlsbEarly/warningInformation',
method: 'post',
data: data
})
}
// 修改预警信息
export function updateWarningInformation(data) {
return request({
url: '/wlsbEarly/warningInformation',
method: 'put',
data: data
})
}
// 删除预警信息
export function delWarningInformation(id) {
return request({
url: '/wlsbEarly/warningInformation/' + id,
method: 'delete'
})
}

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询预警类型列表
export function listWarningType(query) {
return request({
url: '/wlsbEarly/warningType/list',
method: 'get',
params: query
})
}
// 查询预警类型详细
export function getWarningType(id) {
return request({
url: '/wlsbEarly/warningType/' + id,
method: 'get'
})
}
// 新增预警类型
export function addWarningType(data) {
return request({
url: '/wlsbEarly/warningType',
method: 'post',
data: data
})
}
// 修改预警类型
export function updateWarningType(data) {
return request({
url: '/wlsbEarly/warningType',
method: 'put',
data: data
})
}
// 删除预警类型
export function delWarningType(id) {
return request({
url: '/wlsbEarly/warningType/' + id,
method: 'delete'
})
}

View File

@ -0,0 +1,433 @@
<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="region">
<el-input
v-model="queryParams.region"
placeholder="请输入区域"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="设备ID" prop="deviceId">
<el-input
v-model="queryParams.deviceId"
placeholder="请输入设备ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item> -->
<el-form-item label="设备名称" prop="deviceName">
<el-input
v-model="queryParams.deviceName"
placeholder="请输入设备名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="时间">
<el-date-picker
v-model="daterangeTime"
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="预警ID" prop="warningId">
<el-input
v-model="queryParams.warningId"
placeholder="请输入预警ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item> -->
<el-form-item label="预警类型" prop="warningType">
<el-input
v-model="queryParams.warningType"
placeholder="请输入预警类型"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="预警级别" prop="warningLevel">
<el-input
v-model="queryParams.warningLevel"
placeholder="请输入预警级别"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="处理人" prop="handler">
<el-input
v-model="queryParams.handler"
placeholder="请输入处理人"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-input
v-model="queryParams.status"
placeholder="请输入状态"
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-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="['wlsbEarly:warningInformation: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="['wlsbEarly:warningInformation: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="['wlsbEarly:warningInformation: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="['wlsbEarly:warningInformation:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="warningInformationList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="id" align="center" prop="id" /> -->
<el-table-column label="区域" align="center" prop="region" />
<!-- <el-table-column label="设备ID" align="center" prop="deviceId" /> -->
<el-table-column label="设备名称" align="center" prop="deviceName" />
<el-table-column label="时间" align="center" prop="time" width="180">
<template slot-scope="scope">
<span> {{ scope.row.time }}</span>
</template>
</el-table-column>
<!-- <el-table-column label="预警ID" align="center" prop="warningId" /> -->
<el-table-column label="预警类型" align="center" prop="warningType" />
<el-table-column label="预警级别" align="center" prop="warningLevel" >
<template slot-scope="scope">
<el-tag type="info" v-if="scope.row.warningLevel === '低'">{{scope.row.warningLevel}}</el-tag>
<el-tag type="warning" v-else-if="scope.row.warningLevel === ''">{{scope.row.warningLevel}}</el-tag>
<el-tag type="danger" v-else-if="scope.row.warningLevel === ''">{{scope.row.warningLevel}}</el-tag>
<el-tag type="info" v-else>{{scope.row.warningLevel}}</el-tag>
</template>
</el-table-column>
<el-table-column label="抓拍图片" align="center" prop="capturedImage" width="100">
<template slot-scope="scope">
<image-preview :src="scope.row.capturedImage" :width="50" :height="50"/>
</template>
</el-table-column>
<el-table-column label="预警信息" align="center" prop="warningInfo" />
<el-table-column label="处理人" align="center" prop="handler" />
<el-table-column label="状态" align="center" prop="status" >
<template slot-scope="scope">
<div v-if ='scope.row.status'>
<el-tag type="" v-if="scope.row.status === '处理中'">{{scope.row.status}}</el-tag>
<el-tag type="success" v-else-if="scope.row.status === '已完成'">{{scope.row.status}}</el-tag>
<el-tag type="danger" v-else-if="scope.row.status === '已解决'">{{scope.row.status}}</el-tag>
<el-tag type="info" v-else>{{scope.row.status}}</el-tag>
</div>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remarks" />
<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="['wlsbEarly:warningInformation:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['wlsbEarly:warningInformation: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="region">
<el-input v-model="form.region" placeholder="请输入区域" />
</el-form-item>
<!-- <el-form-item label="设备ID" prop="deviceId">
<el-input v-model="form.deviceId" placeholder="请输入设备ID" />
</el-form-item> -->
<el-form-item label="设备名称" prop="deviceName">
<el-input v-model="form.deviceName" placeholder="请输入设备名称" />
</el-form-item>
<el-form-item label="时间" prop="time">
<el-date-picker clearable
v-model="form.time"
type="datetime"
value-format="yyyy-MM-dd hh:mm:ss"
placeholder="请选择时间">
</el-date-picker>
</el-form-item>
<!-- <el-form-item label="预警ID" prop="warningId">
<el-input v-model="form.warningId" placeholder="请输入预警ID" />
</el-form-item> -->
<el-form-item label="预警类型" prop="warningType">
<!-- <el-input v-model="form.warningType" placeholder="请输入预警类型" /> -->
<el-select v-model="form.warningType">
<el-option
v-for="item in warningTypeList"
:key="item.warningType"
:label="item.warningType"
:value="item.warningType">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="预警级别" prop="warningLevel">
<el-input v-model="form.warningLevel" placeholder="请输入预警级别" />
</el-form-item>
<el-form-item label="抓拍图片" prop="capturedImage">
<image-upload v-model="form.capturedImage"/>
</el-form-item>
<el-form-item label="预警信息" prop="warningInfo">
<el-input v-model="form.warningInfo" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="处理人" prop="handler">
<el-input v-model="form.handler" placeholder="请输入处理人" />
</el-form-item>
<el-form-item label="状态" prop="status">
<el-input v-model="form.status" placeholder="请输入状态" />
</el-form-item>
<el-form-item label="备注" prop="remarks">
<el-input v-model="form.remarks" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listWarningInformation, getWarningInformation, delWarningInformation, addWarningInformation, updateWarningInformation } from "@/api/wlsbEarly/warningInformation";
import { listWarningType } from "@/api/wlsbEarly/warningType";
export default {
name: "WarningInformation",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
warningInformationList: [],
//
warningTypeList: [],
//
title: "",
//
open: false,
//
daterangeTime: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
region: null,
deviceId: null,
deviceName: null,
time: null,
warningId: null,
warningType: null,
warningLevel: null,
capturedImage: null,
warningInfo: null,
handler: null,
status: null,
remarks: null
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询预警信息列表 */
getList() {
this.loading = true;
this.queryParams.params = {};
if (null != this.daterangeTime && '' != this.daterangeTime) {
this.queryParams.params["beginTime"] = this.daterangeTime[0];
this.queryParams.params["endTime"] = this.daterangeTime[1];
}
listWarningInformation(this.queryParams).then(response => {
this.warningInformationList = response.rows;
this.total = response.total;
this.loading = false;
});
listWarningType(this.queryParams).then(response => {
this.warningTypeList = response.rows;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
region: null,
deviceId: null,
deviceName: null,
time: null,
warningId: null,
warningType: null,
warningLevel: null,
capturedImage: null,
warningInfo: null,
handler: null,
status: null,
remarks: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.daterangeTime = [];
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加预警信息";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getWarningInformation(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改预警信息";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
// console.log("this.form.time.getTime()",this.form)
// this.form.time = this.form.time.getTime();
if (valid) {
if (this.form.id != null) {
updateWarningInformation(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addWarningInformation(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除预警信息编号为"' + ids + '"的数据项?').then(function() {
return delWarningInformation(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('wlsbEarly/warningInformation/export', {
...this.queryParams
}, `warningInformation_${new Date().getTime()}.xlsx`)
}
}
};
</script>

View File

@ -0,0 +1,287 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="120px">
<el-form-item label="预警类型" prop="warningType">
<el-input
v-model="queryParams.warningType"
placeholder="请输入预警类型"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="影响级别" prop="impactLevel">
<el-input
v-model="queryParams.impactLevel"
placeholder="请输入影响级别"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="错误详情" prop="errorDetails">
<el-input
v-model="queryParams.errorDetails"
placeholder="请输入错误详情"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="推荐修复步骤" prop="recommendedRepairSteps" >
<el-input
v-model="queryParams.recommendedRepairSteps"
placeholder="请输入推荐修复步骤"
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-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="['wlsbEarly:warningType: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="['wlsbEarly:warningType: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="['wlsbEarly:warningType: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="['wlsbEarly:warningType:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="warningTypeList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="id" align="center" prop="id" /> -->
<el-table-column label="预警类型" align="center" prop="warningType" />
<el-table-column label="影响级别" align="center" prop="impactLevel" />
<el-table-column label="错误详情" align="center" prop="errorDetails" />
<el-table-column label="推荐修复步骤" align="center" prop="recommendedRepairSteps" />
<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="['wlsbEarly:warningType:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['wlsbEarly:warningType: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="120px">
<el-form-item label="预警类型" prop="warningType">
<el-input v-model="form.warningType" placeholder="请输入预警类型" />
</el-form-item>
<el-form-item label="影响级别" prop="impactLevel">
<el-input v-model="form.impactLevel" placeholder="请输入影响级别" />
</el-form-item>
<el-form-item label="错误详情" prop="errorDetails">
<el-input v-model="form.errorDetails" placeholder="请输入错误详情" />
</el-form-item>
<el-form-item label="推荐修复步骤" prop="recommendedRepairSteps">
<el-input v-model="form.recommendedRepairSteps" placeholder="请输入推荐修复步骤" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listWarningType, getWarningType, delWarningType, addWarningType, updateWarningType } from "@/api/wlsbEarly/warningType";
export default {
name: "WarningType",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
warningTypeList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
warningType: null,
impactLevel: null,
errorDetails: null,
recommendedRepairSteps: null
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询预警类型列表 */
getList() {
this.loading = true;
listWarningType(this.queryParams).then(response => {
this.warningTypeList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
warningType: null,
impactLevel: null,
errorDetails: null,
recommendedRepairSteps: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加预警类型";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getWarningType(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改预警类型";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateWarningType(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addWarningType(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除预警类型编号为"' + ids + '"的数据项?').then(function() {
return delWarningType(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('wlsbEarly/warningType/export', {
...this.queryParams
}, `warningType_${new Date().getTime()}.xlsx`)
}
}
};
</script>