添加页面

master
夜笙歌 4 weeks ago
parent df4fc3b03a
commit db5ceeadba

@ -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