|
|
|
@ -22,7 +22,7 @@
|
|
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
<el-form-item label="报警级别" prop="alarmLevelId">
|
|
|
|
|
<el-form-item label="报警级别" prop="alarmLevelId" v-if="false">
|
|
|
|
|
<el-select v-model="queryParams.alarmLevelId" placeholder="请选择报警级别" clearable>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="(alarmLevel, index) in alarmLevels"
|
|
|
|
@ -184,11 +184,32 @@
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<!-- 添加或修改报警规则对话框 -->
|
|
|
|
|
<el-dialog :title="title" :visible.sync="open" width="660px" append-to-body>
|
|
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="130px" >
|
|
|
|
|
<el-dialog :title="title" :visible.sync="open" width="660px" append-to-body :before-close="cancel">
|
|
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="130px">
|
|
|
|
|
<el-form-item label="规则名称" prop="alarmRuleName">
|
|
|
|
|
<el-input v-model="form.alarmRuleName" placeholder="请输入规则名称" style="width: 240px"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="报警级别" prop="alarmLevelId" v-if="false">
|
|
|
|
|
<el-select v-model="form.alarmLevelId" placeholder="请选择报警级别" style="width: 240px">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="(alarmLevel, index) in editedAlarmLevels"
|
|
|
|
|
:key="index"
|
|
|
|
|
:label="alarmLevel.alarmLevelName"
|
|
|
|
|
:value="alarmLevel.alarmLevelId"
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
<el-form-item label="报警类型" prop="alarmTypeId">
|
|
|
|
|
<el-select v-model="form.alarmTypeId" placeholder="请选择报警类型" style="width: 240px">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="(alarmType, index) in editedAlarmTypes"
|
|
|
|
|
:key="index"
|
|
|
|
|
:label="alarmType.alarmTypeName"
|
|
|
|
|
:value="alarmType.alarmTypeId"
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
<el-form-item label="所属场景" prop="sceneId">
|
|
|
|
|
<el-select v-model="form.sceneId" placeholder="请选择所属场景" @input="editedSceneChange"
|
|
|
|
@ -204,75 +225,43 @@
|
|
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-form-item label="报警级别" prop="alarmLevelId">
|
|
|
|
|
<el-select v-model="form.alarmLevelId" placeholder="请选择报警级别" style="width: 240px">
|
|
|
|
|
<el-form-item label="设备模型" prop="deviceModeId">
|
|
|
|
|
<el-select v-model="form.deviceModeId" placeholder="请选择设备模型" style="width: 240px" @change="modelChange">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="(alarmLevel, index) in editedAlarmLevels"
|
|
|
|
|
v-for="(i, index) in models"
|
|
|
|
|
:key="index"
|
|
|
|
|
:label="alarmLevel.alarmLevelName"
|
|
|
|
|
:value="alarmLevel.alarmLevelId"
|
|
|
|
|
:label="i.deviceModeName "
|
|
|
|
|
:value="i.deviceModeId"
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="报警类型" prop="alarmTypeId">
|
|
|
|
|
<el-select v-model="form.alarmTypeId" placeholder="请选择报警类型" style="width: 240px">
|
|
|
|
|
|
|
|
|
|
<el-form-item label="设备" prop="ruleDeviceIds">
|
|
|
|
|
<el-select v-model="form.ruleDeviceIds" multiple placeholder="请选择设备" :disabled="editedDisabled"
|
|
|
|
|
@input="editedDeviceChange" style="width: 240px">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="(alarmType, index) in editedAlarmTypes"
|
|
|
|
|
v-for="(device, index) in devicesOptions"
|
|
|
|
|
:key="index"
|
|
|
|
|
:label="alarmType.alarmTypeName"
|
|
|
|
|
:value="alarmType.alarmTypeId"
|
|
|
|
|
:label="device.deviceName"
|
|
|
|
|
:value="device.deviceId"
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
<el-form-item label="触发时间间隔" prop="triggerTimeFrame">
|
|
|
|
|
<el-input v-model="form.triggerTimeFrame" placeholder="请输入时间(分)" style="width: 240px"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
<el-form-item label="告警联系人" prop="phoneNumbers">
|
|
|
|
|
<el-select v-model="form.phoneNumbers" placeholder="请选择告警联系人" style="width: 240px">
|
|
|
|
|
<el-form-item label="设备属性" prop="ruleModeFunctionIdentifier">
|
|
|
|
|
<el-select v-model="form.ruleModeFunctionIdentifier" placeholder="请选择设备属性"
|
|
|
|
|
:disabled="editedDisabled" style="width: 240px">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="(i, index) in phoneList"
|
|
|
|
|
v-for="(deviceModeFunction, index) in editedDeviceModeAttributes"
|
|
|
|
|
:key="index"
|
|
|
|
|
:label="i.nickName +'('+ i.phonenumber+')'"
|
|
|
|
|
:value="i.phonenumber"
|
|
|
|
|
:label="deviceModeFunction.functionName"
|
|
|
|
|
:value="deviceModeFunction.functionIdentifier"
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="设备" prop="ruleDeviceId">
|
|
|
|
|
<el-select v-model="form.ruleDeviceId" placeholder="请选择设备" :disabled="editedDisabled"
|
|
|
|
|
@input="editedDeviceChange" style="width: 180px">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="(device, index) in editedDevices"
|
|
|
|
|
:key="index"
|
|
|
|
|
:label="device.deviceName"
|
|
|
|
|
:value="device.deviceId"
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="设备属性" prop="ruleModeFunctionIdentifier">
|
|
|
|
|
<el-select v-model="form.ruleModeFunctionIdentifier" placeholder="请选择设备属性"
|
|
|
|
|
:disabled="editedDisabled" style="width: 180px">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="(deviceModeFunction, index) in editedDeviceModeAttributes"
|
|
|
|
|
:key="index"
|
|
|
|
|
:label="deviceModeFunction.functionName"
|
|
|
|
|
:value="deviceModeFunction.functionIdentifier"
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
<el-form-item label="触发时间间隔" prop="triggerTimeFrame">
|
|
|
|
|
<el-input v-model="form.triggerTimeFrame" placeholder="请输入时间(分)" style="width: 240px"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="触发条件" prop="triggerCondition">
|
|
|
|
|
<el-select v-model="form.triggerCondition" placeholder="请选择触发条件" @input="triggerConditionChange"
|
|
|
|
|
:disabled="editedDisabled" style="width: 240px">
|
|
|
|
@ -285,20 +274,15 @@
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="A值" prop="triggerDataA">
|
|
|
|
|
<el-input v-model="form.triggerDataA" placeholder="请输入A值" :disabled="editedDisabled" style="width: 180px"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="B值" prop="triggerDataB" v-if="triggerDataBVisible">
|
|
|
|
|
<el-input v-model="form.triggerDataB" placeholder="请输入B值" :disabled="editedDisabled" style="width: 180px"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-form-item label="A值" prop="triggerDataA">
|
|
|
|
|
<el-input v-model="form.triggerDataA" placeholder="请输入A值" :disabled="editedDisabled"
|
|
|
|
|
style="width: 240px"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="B值" prop="triggerDataB" v-if="triggerDataBVisible">
|
|
|
|
|
<el-input v-model="form.triggerDataB" placeholder="请输入B值" :disabled="editedDisabled"
|
|
|
|
|
style="width: 240px"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="状态" prop="alarmRuleStatus">
|
|
|
|
|
<el-radio-group v-model="form.alarmRuleStatus">"
|
|
|
|
|
<el-radio
|
|
|
|
@ -377,6 +361,18 @@
|
|
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-form-item label="告警联系人" prop="phoneNumbers">
|
|
|
|
|
<el-input v-model="form.phoneNumbers" type="text" placeholder="请输入内容" style="width: 240px"/>
|
|
|
|
|
<!-- <el-select v-model="form.phoneNumbers" placeholder="请选择告警联系人" style="width: 240px">-->
|
|
|
|
|
<!-- <el-option-->
|
|
|
|
|
<!-- v-for="(i, index) in phoneList"-->
|
|
|
|
|
<!-- :key="index"-->
|
|
|
|
|
<!-- :label="i.nickName +'('+ i.phonenumber+')'"-->
|
|
|
|
|
<!-- :value="i.phonenumber"-->
|
|
|
|
|
<!-- ></el-option>-->
|
|
|
|
|
<!-- </el-select>-->
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="描述" prop="remark">
|
|
|
|
|
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
@ -461,8 +457,17 @@
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import {
|
|
|
|
|
listAlarmRule, getAlarmRule, delAlarmRule, addAlarmRule, updateAlarmRule,
|
|
|
|
|
getScenes, getEditedScenes, getSelectListBySceneId, getDeviceModeByDeviceId, getModeFunctionParametersByModeFunctionId
|
|
|
|
|
listAlarmRule,
|
|
|
|
|
getAlarmRule,
|
|
|
|
|
delAlarmRule,
|
|
|
|
|
addAlarmRule,
|
|
|
|
|
updateAlarmRule,
|
|
|
|
|
getScenes,
|
|
|
|
|
getEditedScenes,
|
|
|
|
|
getSelectListBySceneId,
|
|
|
|
|
getDeviceModeByDeviceId,
|
|
|
|
|
getModeFunctionParametersByModeFunctionId,
|
|
|
|
|
getDeviceByModel
|
|
|
|
|
} from "@/api/business/alarmRule";
|
|
|
|
|
import {addDeviceModeFunction} from "@/api/business/deviceModeFunction";
|
|
|
|
|
import {listUser} from "../../../api/system/user";
|
|
|
|
@ -478,6 +483,8 @@ export default {
|
|
|
|
|
DATA_MORE_THAN_A_AND_LESS_THAN_B: 3,//大于A且小于B
|
|
|
|
|
DATA_LESS_THAN_A_OR_MORE_THAN_B: 4,//小于A或大于B
|
|
|
|
|
LINK_FLAG_YES: "1",
|
|
|
|
|
models: [],
|
|
|
|
|
devicesOptions: [],
|
|
|
|
|
// 遮罩层
|
|
|
|
|
loading: true,
|
|
|
|
|
// 选中数组
|
|
|
|
@ -532,13 +539,13 @@ export default {
|
|
|
|
|
sceneId: [
|
|
|
|
|
{required: true, message: "所属场景不能为空", trigger: "change"}
|
|
|
|
|
],
|
|
|
|
|
alarmLevelId: [
|
|
|
|
|
{required: true, message: "报警级别不能为空", trigger: "change"}
|
|
|
|
|
],
|
|
|
|
|
// alarmLevelId: [
|
|
|
|
|
// {required: true, message: "报警级别不能为空", trigger: "change"}
|
|
|
|
|
// ],
|
|
|
|
|
alarmTypeId: [
|
|
|
|
|
{required: true, message: "报警类型不能为空", trigger: "change"}
|
|
|
|
|
],
|
|
|
|
|
ruleDeviceId: [
|
|
|
|
|
ruleDeviceIds: [
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: "设备不能为空",
|
|
|
|
@ -599,11 +606,12 @@ export default {
|
|
|
|
|
|
|
|
|
|
alarmRuleFlag: "1",
|
|
|
|
|
editedScenes: [],
|
|
|
|
|
editedDisabled: true,
|
|
|
|
|
sceneDisabled: true,
|
|
|
|
|
editedDisabled: false,
|
|
|
|
|
sceneDisabled: false,
|
|
|
|
|
editedAlarmLevels: [],
|
|
|
|
|
editedAlarmTypes: [],
|
|
|
|
|
editedDevices: [],
|
|
|
|
|
editedModels: [],
|
|
|
|
|
editedDeviceModeAttributes: [],
|
|
|
|
|
editedDeviceModeServices: [],
|
|
|
|
|
|
|
|
|
@ -633,6 +641,11 @@ export default {
|
|
|
|
|
this.getPhoneList()
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
modelChange(modelId) {
|
|
|
|
|
getDeviceByModel({modelId: modelId}).then(e => {
|
|
|
|
|
this.devicesOptions = e.data
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
getPhoneList() {
|
|
|
|
|
listUser({
|
|
|
|
|
pageNum: 1,
|
|
|
|
@ -659,6 +672,7 @@ export default {
|
|
|
|
|
// 表单重置
|
|
|
|
|
reset() {
|
|
|
|
|
this.editedDeviceModeAttributes = [];
|
|
|
|
|
this.models = []
|
|
|
|
|
this.editedDevices = [];
|
|
|
|
|
this.editedAlarmTypes = [];
|
|
|
|
|
this.editedAlarmLevels = [];
|
|
|
|
@ -672,10 +686,11 @@ export default {
|
|
|
|
|
alarmLevelId: null,
|
|
|
|
|
alarmTypeId: null,
|
|
|
|
|
ruleType: '2',
|
|
|
|
|
ruleDeviceId: null,
|
|
|
|
|
ruleFunctionTotal: null,
|
|
|
|
|
linkFlag: "0",
|
|
|
|
|
alarmRuleStatus: "1",
|
|
|
|
|
ruleDeviceId: null,
|
|
|
|
|
ruleDeviceIds: [],
|
|
|
|
|
alarmPushFlag: "0",
|
|
|
|
|
alarmPushContent: null,
|
|
|
|
|
alarmRecoverContent: null,
|
|
|
|
@ -691,7 +706,7 @@ export default {
|
|
|
|
|
triggerDataB: null,
|
|
|
|
|
};
|
|
|
|
|
this.hwAlarmRuleDetailList = [];
|
|
|
|
|
this.resetForm("form");
|
|
|
|
|
// this.resetForm("form");
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/** 搜索按钮操作 */
|
|
|
|
@ -722,20 +737,29 @@ export default {
|
|
|
|
|
/** 修改按钮操作 */
|
|
|
|
|
handleUpdate(row) {
|
|
|
|
|
this.reset();
|
|
|
|
|
this.sceneDisabled = true;
|
|
|
|
|
this.sceneDisabled = false;
|
|
|
|
|
this.getEditedScenes();
|
|
|
|
|
const alarmRuleId = row.alarmRuleId || this.ids
|
|
|
|
|
|
|
|
|
|
getAlarmRule(alarmRuleId).then(response => {
|
|
|
|
|
console.log(response.data.ruleDeviceId)
|
|
|
|
|
this.form = response.data;
|
|
|
|
|
this.editedDisabled = response.data.alarmInfoFlag === "1";
|
|
|
|
|
this.getEditedSelectListBySceneId(this.form.sceneId);
|
|
|
|
|
this.getDeviceModeByDeviceId(this.form.ruleDeviceId);
|
|
|
|
|
this.getDeviceModeByDeviceId(response.data.ruleDeviceId);
|
|
|
|
|
this.triggerDataBVisibleJudge(this.form.triggerCondition);
|
|
|
|
|
this.alarmRuleLinkData = response.data.hwAlarmRuleLinkList;
|
|
|
|
|
this.alarmRuleLinkVisible = response.data.linkFlag === this.LINK_FLAG_YES;
|
|
|
|
|
this.open = true;
|
|
|
|
|
this.title = "修改报警规则";
|
|
|
|
|
getSelectListBySceneId(response.data.sceneId).then(e => {
|
|
|
|
|
this.models = e.data["models"];
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
getDeviceByModel({modelId: response.data.deviceModeId}).then(e => {
|
|
|
|
|
console.log(e.data)
|
|
|
|
|
this.devicesOptions = e.data
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
/** 提交按钮 */
|
|
|
|
@ -851,6 +875,7 @@ export default {
|
|
|
|
|
|
|
|
|
|
getEditedSelectListBySceneId(sceneId) {
|
|
|
|
|
getSelectListBySceneId(sceneId).then(response => {
|
|
|
|
|
this.models = response.data["models"];
|
|
|
|
|
this.editedDevices = response.data["devices"];
|
|
|
|
|
this.editedAlarmTypes = response.data["alarmTypes"];
|
|
|
|
|
this.editedAlarmLevels = response.data["alarmLevels"];
|
|
|
|
@ -858,12 +883,14 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
editedSceneChange(sceneId) {
|
|
|
|
|
this.models = []
|
|
|
|
|
this.editedDevices = [];
|
|
|
|
|
this.editedAlarmTypes = [];
|
|
|
|
|
this.editedAlarmLevels = [];
|
|
|
|
|
this.editedDeviceModeAttributes = [];
|
|
|
|
|
this.form.alarmTypeId = null;
|
|
|
|
|
this.form.alarmLevelId = null;
|
|
|
|
|
this.form.ruleDeviceIds = []
|
|
|
|
|
this.form.ruleDeviceId = null;
|
|
|
|
|
this.form.ruleModeFunctionIdentifier = null;
|
|
|
|
|
this.alarmRuleLinkData = [];
|
|
|
|
@ -881,8 +908,10 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
editedDeviceChange(deviceId) {
|
|
|
|
|
if (Array.isArray(deviceId) ? deviceId?.[0] : deviceId) {
|
|
|
|
|
this.getDeviceModeByDeviceId(Array.isArray(deviceId) ? deviceId?.[0] : deviceId);
|
|
|
|
|
}
|
|
|
|
|
this.form.ruleModeFunctionIdentifier = null;
|
|
|
|
|
this.getDeviceModeByDeviceId(deviceId);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
triggerDataBVisibleJudge(triggerCondition) {
|
|
|
|
@ -911,7 +940,7 @@ export default {
|
|
|
|
|
this.alarmRuleLinkForm.linkDeviceFunctionId = null;
|
|
|
|
|
const selectedOption = this.editedDevices.find(option => option.deviceId === deviceId);
|
|
|
|
|
this.alarmRuleLinkForm.linkDeviceName = selectedOption.deviceName;
|
|
|
|
|
this.getDeviceModeServicesByDeviceId(deviceId);
|
|
|
|
|
this.getDeviceModeServicesByDeviceId(deviceId?.[0]);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
editedLinkDeviceModeServiceChange(modeFunctionId) {
|
|
|
|
|