change - 新增报警管理-报警信息页面

- 新增报警信息增删改查相关API和控制器方法
- 在HwAlarmInfo实体类中添加新的属性,如deviceName、tenantName等
- 在Mapper接口和XML中增加更新报警信息的方法和对应SQL
master
zch 8 months ago
parent 7c0da83250
commit 5f7b5d0c03

@ -0,0 +1,112 @@
package com.ruoyi.business.controller;
import java.util.ArrayList;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.business.domain.*;
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.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.business.service.IHwAlarmInfoService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author zangch
* @date 2024-09-05
*/
@RestController
@RequestMapping("/alarmInformation")
public class HwAlarmInfomationController extends BaseController
{
@Autowired
private IHwAlarmInfoService hwAlarmInfoService;
/**
*
*/
@RequiresPermissions("business:alarmInfo:list")
@GetMapping("/list")
public TableDataInfo list(HwAlarmInfo hwAlarmInfo)
{
startPage();
List<HwAlarmInfo> list = hwAlarmInfoService.selectHwAlarmInfoList(hwAlarmInfo);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("business:alarmInfo:export")
@Log(title = "报警信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, HwAlarmInfo hwAlarmInfo)
{
List<HwAlarmInfo> list = hwAlarmInfoService.selectHwAlarmInfoList(hwAlarmInfo);
ExcelUtil<HwAlarmInfo> util = new ExcelUtil<HwAlarmInfo>(HwAlarmInfo.class);
util.exportExcel(response, list, "报警信息数据");
}
/**
*
*/
@RequiresPermissions("business:alarmInfo:query")
@GetMapping(value = "/{alarmInfoId}")
public AjaxResult getInfo(@PathVariable("alarmInfoId") Long alarmInfoId)
{
return success(hwAlarmInfoService.selectHwAlarmInfoByAlarmInfoId(alarmInfoId));
}
/**
*
*/
@RequiresPermissions("business:alarmInfo:add")
@Log(title = "报警信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody HwAlarmInfo hwAlarmInfo)
{
return toAjax(hwAlarmInfoService.insertHwAlarmInfo(hwAlarmInfo));
}
/**
*
*/
@RequiresPermissions("business:alarmInfo:edit")
@Log(title = "报警信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody HwAlarmInfo hwAlarmInfo)
{
return toAjax(hwAlarmInfoService.updateHwAlarmInformation(hwAlarmInfo));
}
/**
*
*/
@RequiresPermissions("business:alarmInfo:remove")
@Log(title = "报警信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{alarmInfoIds}")
public AjaxResult remove(@PathVariable Long[] alarmInfoIds)
{
return toAjax(hwAlarmInfoService.deleteHwAlarmInfoByAlarmInfoIds(alarmInfoIds));
}
}

@ -132,6 +132,63 @@ public class HwAlarmInfo extends BaseEntity {
* */
private String ifDisposalAll;
private String deviceName;
private String tenantName;
private String sceneName;
private String alarmRuleName;
private String offlineRuleName;
private String electronicFenceName;
public String getDeviceName() {
return deviceName;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public String getTenantName() {
return tenantName;
}
public void setTenantName(String tenantName) {
this.tenantName = tenantName;
}
public String getSceneName() {
return sceneName;
}
public void setSceneName(String sceneName) {
this.sceneName = sceneName;
}
public String getAlarmRuleName() {
return alarmRuleName;
}
public void setAlarmRuleName(String alarmRuleName) {
this.alarmRuleName = alarmRuleName;
}
public String getOfflineRuleName() {
return offlineRuleName;
}
public void setOfflineRuleName(String offlineRuleName) {
this.offlineRuleName = offlineRuleName;
}
public String getElectronicFenceName() {
return electronicFenceName;
}
public void setElectronicFenceName(String electronicFenceName) {
this.electronicFenceName = electronicFenceName;
}
public String getIfDisposalAll() {
return ifDisposalAll;
}
@ -342,6 +399,16 @@ public class HwAlarmInfo extends BaseEntity {
.append("monitorUnitName", getMonitorUnitName())
.append("alarmLevelName", getAlarmLevelName())
.append("alarmTypeName", getAlarmTypeName())
.append("areaName", getAreaName())
.append("monitorUnitTypeName", getMonitorUnitTypeName())
.append("deviceName", getDeviceName())
.append("tenantName", getTenantName())
.append("sceneName", getSceneName())
.append("offlineRuleName", getOfflineRuleName())
.toString();
}
}

@ -99,5 +99,5 @@ public interface HwAlarmInfoMapper
List<Long> selectUnitId();
int updateHwAlarmInformation(HwAlarmInfo hwAlarmInformation);
}

@ -83,4 +83,5 @@ public interface IHwAlarmInfoService
List<Long> selectUnitId();
int updateHwAlarmInformation(HwAlarmInfo hwAlarmInformation);
}

@ -170,4 +170,10 @@ public class HwAlarmInfoServiceImpl implements IHwAlarmInfoService {
public List<Long> selectUnitId() {
return hwAlarmInfoMapper.selectUnitId();
}
/* int updateHwAlarmInformation(HwAlarmInfo hwAlarmInformation);*/
@Override
public int updateHwAlarmInformation(HwAlarmInfo hwAlarmInformation) {
return hwAlarmInfoMapper.updateHwAlarmInformation(hwAlarmInformation);
}
}

@ -31,6 +31,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="alarmTypeName" column="alarm_type_name" />
<result property="areaName" column="area_name" />
<result property="monitorUnitTypeName" column="monitor_unit_type_name" />
<result property="deviceName" column="device_name"/>
<result property="areaName" column="area_name"/>
<result property="tenantName" column="tenant_name"/>
<result property="sceneName" column="scene_name"/>
<result property="alarmRuleName" column="alarm_rule_name"/>
<result property="offlineRuleName" column="offline_rule_name"/>
<result property="electronicFenceName" column="electronic_fence_name"/>
<result property="alarmReleatedId" column="alarm_releated_id"/>
</resultMap>
<resultMap type="AlarmTypeVo" id="AlarmTypeVoResult">
@ -90,13 +100,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
hal.alarm_level_name,
hat.alarm_type_name,
ha.area_name,
hmut.monitor_unit_type_name
hmut.monitor_unit_type_name,
hd.device_name,
ht.tenant_id,
ht.tenant_name as tenant_name,
hs.scene_name as scene_name,
har.alarm_rule_name as alarm_rule_name,
hor.offline_rule_name as offline_rule_name,
hef.electronic_fence_name as electronic_fence_name
from hw_alarm_info hai
left join hw_monitor_unit hmu on hai.monitor_unit_id = hmu.monitor_unit_id
left join hw_alarm_level hal on hai.alarm_level_id = hal.alarm_level_id
left join hw_alarm_type hat on hai.alarm_type_id = hat.alarm_type_id
left join hw_area ha on ha.area_id = hmu.area_id
left join hw_monitor_unit_type hmut on hmu.monitor_unit_type_id = hmut.monitor_unit_type_id
LEFT JOIN hw_fence_area hfa ON hai.fence_area_id = hfa.fence_area_id
LEFT JOIN hw_device hd ON hai.device_id = hd.device_id
LEFT JOIN hw_tenant ht ON hai.tenant_id = ht.tenant_id
LEFT JOIN hw_scene hs ON hai.scene_id = hs.scene_id
LEFT JOIN hw_alarm_rule har ON hai.alarm_releated_id = har.alarm_rule_id
LEFT JOIN hw_offline_rule hor ON hai.alarm_releated_id = hor.offline_rule_id
LEFT JOIN hw_electronic_fence hef ON hai.alarm_releated_id = hef.electronic_fence_id
</sql>
<select id="selectHwAlarmInfoList" parameterType="HwAlarmInfo" resultMap="HwAlarmInfoResult">
@ -118,6 +147,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="handleStatus != null and handleStatus != ''"> and handle_status = #{handleStatus}</if>
<if test="alarmTime != null "> and alarm_time = #{alarmTime}</if>
<if test="alarmInfoField != null and alarmInfoField != ''"> and alarm_info_field = #{alarmInfoField}</if>
<if test="deviceName != null and deviceName != ''"> and hd.device_name = #{deviceName}</if>
<if test="monitorUnitName != null and monitorUnitName != ''"> and hmu.monitor_unit_name = #{monitorUnitName}</if>
<if test="alarmLevelName != null and alarmLevelName != ''"> and hal.alarm_level_name = #{alarmLevelName}</if>
<if test="alarmTypeName != null and alarmTypeName != ''"> and hat.alarm_type_name = #{alarmTypeName}</if>
<if test="areaName != null and areaName != ''"> and ha.area_name = #{areaName}</if>
<if test="monitorUnitTypeName != null and monitorUnitTypeName != ''"> and hmut.monitor_unit_type_name = #{monitorUnitTypeName}</if>
<if test="tenantName != null and tenantName != ''"> and ht.tenant_name = #{tenantName}</if>
<if test="sceneName != null and sceneName != ''"> and hs.scene_name = #{sceneName}</if>
<if test="alarmRuleName != null and alarmRuleName != ''"> and har.alarm_rule_name = #{alarmRuleName}</if>
<if test="electronicFenceName != null and electronicFenceName != ''"> and hef.electronic_fence_name =</if>
<if test="offlineRuleName != null and offlineRuleName != ''"> and hor.offline_rule_name = #{offlineRuleName}</if>
<!-- 租户数据范围过滤 -->
-- ${params.tenantDataScope}
</where>
@ -283,4 +325,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where device_id = (select t.device_id from (select device_id from hw_alarm_info hai where alarm_info_id = #{alarmInfoId})t) and handle_status = 0
</update>
<!--int updateHwAlarmInformation(HwAlarmInfo hwAlarmInformation);-->
<update id="updateHwAlarmInformation" parameterType="HwAlarmInfo">
update hw_alarm_info
<trim prefix="SET" suffixOverrides=",">
<if test="alarmInfoType != null and alarmInfoType != ''">alarm_info_type = #{alarmInfoType},</if>
<if test="alarmReleatedId != null">alarm_releated_id = #{alarmReleatedId},</if>
<if test="deviceId != null">device_id = #{deviceId},</if>
<if test="monitorUnitId != null">monitor_unit_id = #{monitorUnitId},</if>
<if test="tenantId != null">tenant_id = #{tenantId},</if>
<if test="sceneId != null">scene_id = #{sceneId},</if>
<if test="alarmLevelId != null">alarm_level_id = #{alarmLevelId},</if>
<if test="alarmTypeId != null">alarm_type_id = #{alarmTypeId},</if>
<if test="modeFunctionId != null">mode_function_id = #{modeFunctionId},</if>
<if test="functionName != null">function_name = #{functionName},</if>
<if test="functionIdentifier != null">function_identifier = #{functionIdentifier},</if>
<if test="functionValue != null">function_value = #{functionValue},</if>
<if test="triggerStatus != null">trigger_status = #{triggerStatus},</if>
<if test="handleStatus != null and handleStatus != ''">handle_status = #{handleStatus},</if>
<if test="alarmTime != null">alarm_time = #{alarmTime},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="alarmInfoField != null">alarm_info_field = #{alarmInfoField},</if>
</trim>
where alarm_info_id = #{alarmInfoId}
</update>
</mapper>

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询报警信息列表
export function listAlarmInformation(query) {
return request({
url: '/business/alarmInformation/list',
method: 'get',
params: query
})
}
// 查询报警信息详细
export function getAlarmInformation(alarmInfoId) {
return request({
url: '/business/alarmInformation/' + alarmInfoId,
method: 'get'
})
}
// 新增报警信息
export function addAlarmInformation(data) {
return request({
url: '/business/alarmInformation',
method: 'post',
data: data
})
}
// 修改报警信息
export function updateAlarmInformation(data) {
return request({
url: '/business/alarmInformation',
method: 'put',
data: data
})
}
// 删除报警信息
export function delAlarmInformation(alarmInfoId) {
return request({
url: '/business/alarmInformation/' + alarmInfoId,
method: 'delete'
})
}

@ -0,0 +1,724 @@
<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="alarmInfoType">
<el-select v-model="queryParams.alarmInfoType" placeholder="请选择报警信息类型" clearable>
<el-option
v-for="dict in dict.type.hw_alarm_info_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<!-- <el-form-item label="报警信息类型" prop="alarmReleatedId">
<el-input
v-model="queryParams.alarmReleatedId"
placeholder="请输入报警信息类型"
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="所属监控单元" prop="monitorUnitName">
<el-input
v-model="queryParams.monitorUnitName"
placeholder="请输入所属监控单元名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="租户ID" prop="tenantId">
<el-input
v-model="queryParams.tenantId"
placeholder="请输入租户ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<el-form-item label="所属场景" prop="sceneName">
<el-input
v-model="queryParams.sceneName"
placeholder="请输入所属场景名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="报警级别" prop="alarmLevelId">
<el-input
v-model="queryParams.alarmLevelId"
placeholder="请输入报警级别"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<!-- <el-form-item label="报警类型" prop="alarmTypeId">
<el-input
v-model="queryParams.alarmTypeId"
placeholder="请输入报警类型"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<!-- <el-form-item label="设备模型功能ID" prop="modeFunctionId">
<el-input
v-model="queryParams.modeFunctionId"
placeholder="请输入设备模型功能ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<!-- <el-form-item label="功能名称" prop="functionName">
<el-input
v-model="queryParams.functionName"
placeholder="请输入功能名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<!-- <el-form-item label="标识符" prop="functionIdentifier">
<el-input
v-model="queryParams.functionIdentifier"
placeholder="请输入标识符"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<!-- <el-form-item label="最新的值" prop="functionValue">
<el-input
v-model="queryParams.functionValue"
placeholder="请输入最新的值"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<el-form-item label="触发状态" prop="triggerStatus">
<el-select v-model="queryParams.triggerStatus" placeholder="请选择触发状态" clearable>
<el-option
v-for="dict in dict.type.hw_alarm_trigger_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="处理状态" prop="handleStatus">
<el-select v-model="queryParams.handleStatus" placeholder="请选择处理状态" clearable>
<el-option
v-for="dict in dict.type.hw_alarm_handle_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="实际报警时间">
<el-date-picker
v-model="daterangeAlarmTime"
style="width: 240px"
value-format="yyyy-MM-dd HH:mm:ss"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>
<!-- <el-form-item label="预留字段" prop="alarmInfoField">
<el-input
v-model="queryParams.alarmInfoField"
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="['business:alarmInformation: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="['business:alarmInformation: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="['business:alarmInformation: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="['business:alarmInformation:export']"
>导出</el-button>-->
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="alarmInformationList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="报警信息ID" align="center" prop="alarmInfoId" />
<el-table-column label="报警信息类型" align="center" prop="alarmInfoType">
<template slot-scope="scope">
<dict-tag :options="dict.type.hw_alarm_info_type" :value="scope.row.alarmInfoType"/>
</template>
</el-table-column>
<!-- <el-table-column label="报警信息" align="center" prop="alarmReleatedId" />-->
<el-table-column label="关联报警信息" align="center" prop="alarmReleatedId" >
<template slot-scope="scope">
<span v-if="scope.row.alarmInfoType == 1">{{ scope.row.alarmRuleName }}</span>
<span v-if="scope.row.alarmInfoType == 2">{{ scope.row.alarmReleatedId }}</span>
<span v-if="scope.row.alarmInfoType == 3">{{ scope.row.offlineRuleName }}</span>
<span v-if="scope.row.alarmInfoType == 4">{{ scope.row.electronicFenceName }}</span>
</template>
</el-table-column>
<el-table-column label="报警设备" align="center" prop="deviceName" />
<el-table-column label="所属监控单元" align="center" prop="monitorUnitName" />
<el-table-column label="租户" align="center" prop="tenantName" />
<el-table-column label="所属场景" align="center" prop="sceneName" />
<el-table-column label="报警级别" align="center" prop="alarmLevelName" />
<el-table-column label="报警类型" align="center" prop="alarmTypeName" />
<el-table-column label="设备模型功能ID" align="center" prop="modeFunctionId" />
<el-table-column label="功能名称" align="center" prop="functionName" />
<!-- <el-table-column label="标识符" align="center" prop="functionIdentifier" />-->
<el-table-column label="最新的值" align="center" prop="functionValue" show-overflow-tooltip="true" />
<el-table-column label="触发状态" align="center" prop="triggerStatus">
<template slot-scope="scope">
<dict-tag :options="dict.type.hw_alarm_trigger_status" :value="scope.row.triggerStatus"/>
</template>
</el-table-column>
<el-table-column label="处理状态" align="center" prop="handleStatus">
<template slot-scope="scope">
<dict-tag :options="dict.type.hw_alarm_handle_status" :value="scope.row.handleStatus"/>
</template>
</el-table-column>
<el-table-column label="实际报警时间" align="center" prop="alarmTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.alarmTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<!-- <el-table-column label="预留字段" align="center" prop="alarmInfoField" />-->
<!-- <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="['business:alarmInformation:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['business:alarmInformation: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="alarmInfoType">
<el-select v-model="form.alarmInfoType" placeholder="请选择报警信息类型">
<el-option
v-for="dict in dict.type.hw_alarm_info_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="报警信息id" prop="alarmInfoId">
<el-input v-model="form.alarmInfoId" placeholder="请输入报警信息ID" />
</el-form-item>-->
<el-form-item label="关联报警信息id" prop="alarmReleatedId" >
<el-input v-model="form.alarmReleatedId" 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="deviceId">
<el-select v-model="form.deviceId" placeholder="请选择报警设备">
<el-option
v-for="item in deviceList"
:key="item.deviceId"
:label="item.deviceName"
:value="item.deviceId"
/>
</el-select>
</el-form-item>
<!-- <el-form-item label="所属监控单元Id" prop="monitorUnitId">
<el-input v-model="form.monitorUnitId" placeholder="请输入所属监控单元Id" />
</el-form-item>-->
<template>
<el-form-item label="所属监控单元" prop="monitorUnitId">
<el-select v-model="form.monitorUnitId" placeholder="请选择所属监控单元Id">
<el-option
v-for="item in monitorUnitList"
:key="item.monitorUnitId"
:label="item.monitorUnitName"
:value="item.monitorUnitId"
/>
</el-select>
</el-form-item>
</template>
<!-- <el-form-item label="租户ID" prop="tenantId">
<el-input v-model="form.tenantId" placeholder="请输入租户ID" />
</el-form-item>-->
<el-form-item label="所属租户" prop="tenantId">
<el-select v-model="form.tenantId" placeholder="请选择" >
<el-option
v-for="item in tenants"
:key="item.tenantId"
:label="item.tenantName"
:value="item.tenantId"
></el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="所属场景ID" prop="sceneId">
<el-input v-model="form.sceneId" placeholder="请输入所属场景ID" />
</el-form-item>-->
<el-form-item label="所属场景" prop="sceneId">
<el-select v-model="form.sceneId" placeholder="请选择所属场景">
<el-option
v-for="item in scenes"
:key="item.sceneId"
:label="item.sceneName"
:value="item.sceneId"
/>
</el-select>
</el-form-item>
<!-- <el-form-item label="报警级别" prop="alarmLevelId">
<el-input v-model="form.alarmLevelId" placeholder="请输入报警级别" />
</el-form-item>-->
<el-form-item label="报警级别" prop="alarmLevelId">
<el-select v-model="form.alarmLevelId" placeholder="请选择报警级别">
<el-option
v-for="item in alarmLevelList"
:key="item.alarmLevelId"
:label="item.alarmLevelName"
:value="item.alarmLevelId"
></el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="报警类型" prop="alarmTypeId">
<el-input v-model="form.alarmTypeId" placeholder="请输入报警类型" />
</el-form-item>-->
<el-form-item label="报警类型" prop="alarmTypeId">
<el-select v-model="form.alarmTypeId" placeholder="请选择报警类型">
<el-option
v-for="item in alarmTypeList"
:key="item.alarmTypeId"
:label="item.alarmTypeName"
:value="item.alarmTypeId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="设备模型功能ID" prop="modeFunctionId">
<el-input v-model="form.modeFunctionId" placeholder="请输入设备模型功能ID" />
</el-form-item>
<el-form-item label="功能名称" prop="functionName">
<el-input v-model="form.functionName" placeholder="请输入功能名称" />
</el-form-item>
<!-- <el-form-item label="标识符" prop="functionIdentifier">
<el-input v-model="form.functionIdentifier" placeholder="请输入标识符" />
</el-form-item>-->
<el-form-item label="最新的值" prop="functionValue">
<el-input v-model="form.functionValue" placeholder="请输入最新的值,如果是电子围栏则存经度、纬度" />
</el-form-item>
<el-form-item label="触发状态" prop="triggerStatus">
<el-select v-model="form.triggerStatus" placeholder="请选择触发状态">
<el-option
v-for="dict in dict.type.hw_alarm_trigger_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="处理状态" prop="handleStatus">
<el-radio-group v-model="form.handleStatus">
<el-radio
v-for="dict in dict.type.hw_alarm_handle_status"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="实际报警时间" prop="alarmTime">
<el-date-picker clearable
v-model="form.alarmTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择实际报警时间">
</el-date-picker>
</el-form-item>
<!-- <el-form-item label="预留字段" prop="alarmInfoField">
<el-input v-model="form.alarmInfoField" 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 { listAlarmInformation, getAlarmInformation, delAlarmInformation, addAlarmInformation, updateAlarmInformation } from "@/api/business/alarmInformation";
import {listMonitorUnit} from "@/api/business/monitorUnit";
import {getScenes, getTenants, listScene} from "@/api/business/scene";
import {listAlarmLevel} from "@/api/business/alarmLevel";
import {listAlarmType} from "@/api/business/alarmType";
import {listDevice} from "@/api/business/device";
export default {
name: "AlarmInformation",
dicts: ['hw_alarm_trigger_status', 'hw_alarm_handle_status', 'hw_alarm_info_type'],
data() {
return {
monitorUnitList:[],
tenantList:[],
sceneList:[],
alarmLevelList:[],
alarmTypeList:[],
devices:[],
deviceList:[],
alarmRuleName: '',
offlineRuleName: '',
electronicFenceName: '',
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
alarmInformationList: [],
//
title: "",
//
open: false,
//
daterangeAlarmTime: [],
//
daterangeCreateTime: [],
//
daterangeUpdateTime: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
alarmInfoType: null,
alarmReleatedId: null,
deviceId: null,
monitorUnitId: null,
tenantId: null,
sceneId: null,
alarmLevelId: null,
alarmTypeId: null,
modeFunctionId: null,
functionName: null,
functionIdentifier: null,
functionValue: null,
triggerStatus: null,
handleStatus: null,
alarmTime: null,
alarmInfoField: null,
monitorUnitName: null,
alarmLevelName: null,
alarmTypeName: null,
areaName: null,
monitorUnitTypeName: null,
deviceName: null,
tenantName: null,
sceneName: null,
},
/* queryParamsOther: {
pageNum: 1,
pageSize: 99999999,
alarmInfoType: null,
alarmReleatedId: null,
deviceId: null,
monitorUnitId: null,
tenantId: null,
sceneId: null,
alarmLevelId: null,
alarmTypeId: null,
modeFunctionId: null,
functionName: null,
functionIdentifier: null,
functionValue: null,
triggerStatus: null,
handleStatus: null,
alarmTime: null,
alarmInfoField: null,
monitorUnitName: null,
alarmLevelName: null,
alarmTypeName: null,
areaName: null,
monitorUnitTypeName: null,
deviceName: null,
tenantName: null,
sceneName: null,
},*/
//
form: {},
//
rules: {
alarmInfoType: [
{ required: true, message: "报警信息类型不能为空", trigger: "change" }
],
alarmReleatedId: [
{ required: true, message: "报警信息类型不能为空", trigger: "blur" }
],
}
};
},
created() {
this.getList();
this.getMonitorUnitList();
this.getTenants();
this.getScenes();
this.getAlarmLevelList();
this.getAlarmTypeList();
this.getDevices()
},
methods: {
/** 查询报警信息列表 */
getList() {
this.loading = true;
this.queryParams.params = {};
if (null != this.daterangeAlarmTime && '' != this.daterangeAlarmTime) {
this.queryParams.params["beginAlarmTime"] = this.daterangeAlarmTime[0];
this.queryParams.params["endAlarmTime"] = this.daterangeAlarmTime[1];
}
if (null != this.daterangeCreateTime && '' != this.daterangeCreateTime) {
this.queryParams.params["beginCreateTime"] = this.daterangeCreateTime[0];
this.queryParams.params["endCreateTime"] = this.daterangeCreateTime[1];
}
if (null != this.daterangeUpdateTime && '' != this.daterangeUpdateTime) {
this.queryParams.params["beginUpdateTime"] = this.daterangeUpdateTime[0];
this.queryParams.params["endUpdateTime"] = this.daterangeUpdateTime[1];
}
listAlarmInformation(this.queryParams).then(response => {
this.alarmInformationList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
alarmInfoId: null,
alarmInfoType: null,
alarmReleatedId: null,
deviceId: null,
monitorUnitId: null,
tenantId: null,
sceneId: null,
alarmLevelId: null,
alarmTypeId: null,
modeFunctionId: null,
functionName: null,
functionIdentifier: null,
functionValue: null,
triggerStatus: null,
handleStatus: null,
alarmTime: null,
createTime: null,
updateBy: null,
updateTime: null,
alarmInfoField: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.daterangeAlarmTime = [];
this.daterangeCreateTime = [];
this.daterangeUpdateTime = [];
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.alarmInfoId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加报警信息";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const alarmInfoId = row.alarmInfoId || this.ids
getAlarmInformation(alarmInfoId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改报警信息";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.alarmInfoId != null) {
updateAlarmInformation(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addAlarmInformation(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const alarmInfoIds = row.alarmInfoId || this.ids;
this.$modal.confirm('是否确认删除报警信息编号为"' + alarmInfoIds + '"的数据项?').then(function() {
return delAlarmInformation(alarmInfoIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('business/alarmInformation/export', {
...this.queryParams
}, `alarmInformation_${new Date().getTime()}.xlsx`)
},
/**查询设备信息*/
getDevices() {
this.loading = true;
listDevice(this.queryParams).then(response => {
this.deviceList = response.rows;
this.total = response.total;
this.loading = false;
});
},
/** 查询监控单元列表 */
getMonitorUnitList() {
this.loading = true;
listMonitorUnit(this.queryParams).then(response => {
this.monitorUnitList = this.handleTree(response.data, "monitorUnitId", "parentId");
this.loading = false;
});
},
/** 查询报警级别列表 */
getAlarmLevelList() {
this.loading = true;
listAlarmLevel(this.queryParams).then(response => {
this.alarmLevelList = response.rows;
this.total = response.total;
this.loading = false;
});
},
/** 查询报警类型列表 */
getAlarmTypeList() {
this.loading = true;
listAlarmType(this.queryParams).then(response => {
this.alarmTypeList = response.rows;
this.total = response.total;
this.loading = false;
});
},
/** 查询租户信息列表 */
getTenants() {
getTenants().then(response => {
this.tenants = response.data;
});
},
/** 查询场景信息列表 */
getScenes() {
getScenes().then(response => {
this.scenes = response.data;
});
},
}
};
</script>
Loading…
Cancel
Save