|
@@ -1,813 +0,0 @@
|
|
-/**
|
|
|
|
-@author:fugy
|
|
|
|
-@date:2018.09.18
|
|
|
|
-@info:项目报警条目添加与编辑
|
|
|
|
- */
|
|
|
|
-<template>
|
|
|
|
-<div class="edit-box">
|
|
|
|
- <h5 class="title">添加报警条目</h5>
|
|
|
|
- <div class="form-box">
|
|
|
|
- <el-form
|
|
|
|
- label-width="150px"
|
|
|
|
- :model="formValue"
|
|
|
|
- :rules="rules"
|
|
|
|
- ref="ruleForm">
|
|
|
|
- <el-form-item label="适用对象类" prop="objTypeRules">
|
|
|
|
- <span class="infoStar">*</span>
|
|
|
|
- <v-obj-type ref="objType" :objType="objTypeComValue" :disabled='true' width='400px'></v-obj-type>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="报警条目编码" prop="code">
|
|
|
|
- <el-input
|
|
|
|
- placeholder="请输入不超过10位的数字"
|
|
|
|
- v-model="formValue.code"
|
|
|
|
- clearable>
|
|
|
|
- </el-input>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="报警条目名称" prop="name">
|
|
|
|
- <el-input
|
|
|
|
- placeholder="名称不超过30个字"
|
|
|
|
- v-model="formValue.name"
|
|
|
|
- clearable>
|
|
|
|
- </el-input>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="报警分类">
|
|
|
|
- <v-alarm-class
|
|
|
|
- ref="alarm-class"
|
|
|
|
- :isAddBtn='true'
|
|
|
|
- :options='alarmClassArr'
|
|
|
|
- :value='alarmClassValue'
|
|
|
|
- @change="alarmClassChange"
|
|
|
|
- @add='alarmClassAdd'
|
|
|
|
- ></v-alarm-class>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="严重程度" prop="level">
|
|
|
|
- <el-select v-model="formValue.level" clearable placeholder="请选择">
|
|
|
|
- <el-option
|
|
|
|
- v-for="item in levelSelectArr"
|
|
|
|
- :key="item.value"
|
|
|
|
- :label="item.label"
|
|
|
|
- :value="item.value">
|
|
|
|
- </el-option>
|
|
|
|
- </el-select>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item>
|
|
|
|
- <div class="level_describe">
|
|
|
|
- <p>S 严重故障:会导致停机、设备损坏等问题的严重故障;计入设备、系统故障时间统计;</p>
|
|
|
|
- <p>A 故障 :会导致运行故障,但不会引起严重的系统问题,影响范围有限。例如单个污水坑报警;计入设备、系统故障时间统计;</p>
|
|
|
|
- <p>B 一般问题: 不会导致停机, 但对安全运行会造成风险的一般报警, 例如房间温度过高, 传感器不正常等; 不计入故障时间统计;</p>
|
|
|
|
- <p>C 预警: 提前预判故障或问题, 发出警告, 例如算范判断的管道脏堵、 换热器效率下降等; 不计入故障时间统计;</p>
|
|
|
|
- <p>D 数据问题: 断数、 云服务故障等我们的系统产生的问题; 不计入故障时间统计;</p>
|
|
|
|
- </div>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="备注">
|
|
|
|
- <el-input
|
|
|
|
- type="textarea"
|
|
|
|
- :rows="3"
|
|
|
|
- placeholder="不超过100字"
|
|
|
|
- v-model="formValue.remark">
|
|
|
|
- </el-input>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="报警触发时所转问题">
|
|
|
|
- <el-select
|
|
|
|
- v-model="formValue.hasProblem"
|
|
|
|
- clearable
|
|
|
|
- placeholder="请选择"
|
|
|
|
- :disabled="formValue.objTypeRules.length==0"
|
|
|
|
- @change="hasProblemHandle">
|
|
|
|
- <el-option
|
|
|
|
- v-for="item in hasProblemArr"
|
|
|
|
- :key="item.value"
|
|
|
|
- :label="item.label"
|
|
|
|
- :value="item.value"
|
|
|
|
- >
|
|
|
|
- </el-option>
|
|
|
|
- </el-select>
|
|
|
|
- <span v-show="hasProblemInfo">问题为: {{hasProblemInfo}}</span>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="报警所用算法" prop="aligothmType">
|
|
|
|
- <el-select
|
|
|
|
- :disabled="formValue.objTypeRules.length==0"
|
|
|
|
- style="width: 300px;"
|
|
|
|
- v-model="formValue.aligothmType"
|
|
|
|
- clearable
|
|
|
|
- placeholder="请选择">
|
|
|
|
- <el-option
|
|
|
|
- v-for="item in aligothmTypeArr"
|
|
|
|
- :key="item.value"
|
|
|
|
- :label="item.label"
|
|
|
|
- :value="item.value"
|
|
|
|
- >
|
|
|
|
- </el-option>
|
|
|
|
- </el-select>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="取值信息点" prop="funcid">
|
|
|
|
- <span class="infoStar">*</span>
|
|
|
|
- <span>{{selectInfoBtn}}</span>
|
|
|
|
- </el-form-item>
|
|
|
|
- <!-- 阈值算法 -->
|
|
|
|
- <div v-if="formValue.aligothmType == 'threshold'" class="threshold-box">
|
|
|
|
- <el-form-item label="报警诊断启动前提" prop="aligothmTypeInfo.precondition" :rules="rules.precondition">
|
|
|
|
- <el-radio-group class="precondition" v-model="formValue.aligothmTypeInfo.precondition">
|
|
|
|
- <p><el-radio label="running" :disabled="!isRunStatus">只有当设备处于运行状态才启动报警诊断</el-radio></p>
|
|
|
|
- <p><el-radio label="runningEnergy" :disabled="!isElecConsumP">只有当设备的运行能耗大于
|
|
|
|
- <el-input
|
|
|
|
- style="width: 200px; margin: 0 10px;"
|
|
|
|
- placeholder="请输入"
|
|
|
|
- v-model="formValue.aligothmTypeInfo.energyupper"
|
|
|
|
- :disabled="formValue.aligothmTypeInfo.precondition!='runningEnergy'">
|
|
|
|
- <template slot="append">kwh</template>
|
|
|
|
- </el-input>时才启动报警诊断</el-radio></p>
|
|
|
|
- <p><el-radio label="any">设备在任何状态下都启动报警诊断</el-radio></p>
|
|
|
|
- </el-radio-group>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="报警诊断日期及时间" prop="aligothmTypeInfo.dateSet" :rules="rules.dateSet">
|
|
|
|
- <p>
|
|
|
|
- <span style="margin: 0 10px;">日期设定</span>
|
|
|
|
- <el-radio-group v-model="formValue.aligothmTypeInfo.dateSet">
|
|
|
|
- <el-radio label="all">全部日期</el-radio>
|
|
|
|
- <el-radio label="workday">仅工作日</el-radio>
|
|
|
|
- <el-radio label="weekday">仅周末</el-radio>
|
|
|
|
- </el-radio-group>
|
|
|
|
- </p>
|
|
|
|
- <p>
|
|
|
|
- <span style="margin: 0 10px;">时间设定</span>
|
|
|
|
- <el-radio-group v-model="formValue.aligothmTypeInfo.timeSet" @change="timeRadioHandle">
|
|
|
|
- <el-radio label="all">全部时间</el-radio>
|
|
|
|
- <el-radio label="customed">自定义时间段</el-radio>
|
|
|
|
- </el-radio-group>
|
|
|
|
- <el-time-picker
|
|
|
|
- v-if="formValue.aligothmTypeInfo.timeSet=='customed'"
|
|
|
|
- style="margin-left: 10px;"
|
|
|
|
- is-range
|
|
|
|
- v-model="customTimeRange"
|
|
|
|
- range-separator="至"
|
|
|
|
- start-placeholder="开始时间"
|
|
|
|
- end-placeholder="结束时间"
|
|
|
|
- placeholder="选择时间范围"
|
|
|
|
- format="HH:mm"
|
|
|
|
- size="small"
|
|
|
|
- value-format="HHmm"
|
|
|
|
- @change="timeRangeHandle">
|
|
|
|
- </el-time-picker>
|
|
|
|
- </p>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="报警值持续时间要求" prop="aligothmTypeInfo.errorlastperiod" :rules="rules.errorlastperiod">
|
|
|
|
- <p>异常数据持续超过
|
|
|
|
- <el-input
|
|
|
|
- style="width: 200px; margin: 0 10px;"
|
|
|
|
- placeholder="请输入"
|
|
|
|
- v-model="formValue.aligothmTypeInfo.errorlastperiod">
|
|
|
|
- <template slot="append">秒</template>
|
|
|
|
- </el-input>时产生报警
|
|
|
|
- </p>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="报警门限值设定方法" prop="aligothmTypeInfo.thresholdSetType" :rules="rules.thresholdSetType">
|
|
|
|
- <p>
|
|
|
|
- <el-select v-model="formValue.aligothmTypeInfo.thresholdSetTypeInfo.type" clearable placeholder="请选择">
|
|
|
|
- <el-option
|
|
|
|
- v-for="item in thresholdSetTypeInfoArr"
|
|
|
|
- :key="item.value"
|
|
|
|
- :label="item.label"
|
|
|
|
- :value="item.value"
|
|
|
|
- >
|
|
|
|
- </el-option>
|
|
|
|
- </el-select>
|
|
|
|
- </p>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-radio-group class="precondition precondition-left" v-model="formValue.aligothmTypeInfo.thresholdSetType" @change="thresholdSetTypeChange">
|
|
|
|
- <p><el-radio label="customed">手动设定报警门限值
|
|
|
|
- <el-form-item prop="aligothmTypeInfo.thresholdSetType" :rules="rules.verifyUpperLower">
|
|
|
|
- <p style="margin-left: 10px;">
|
|
|
|
- <el-input
|
|
|
|
- v-if="formValue.aligothmTypeInfo.thresholdSetTypeInfo.type != 'upper'"
|
|
|
|
- style="width: 200px; margin: 0 10px;"
|
|
|
|
- placeholder="请输入"
|
|
|
|
- v-model="formValue.aligothmTypeInfo.thresholdSetTypeInfo.lower">
|
|
|
|
- <template slot="append">{{unit || "单位"}}</template>
|
|
|
|
- </el-input>
|
|
|
|
- <span v-if="formValue.aligothmTypeInfo.thresholdSetTypeInfo.type == 'upperLower'">至</span>
|
|
|
|
- <el-input
|
|
|
|
- v-if="formValue.aligothmTypeInfo.thresholdSetTypeInfo.type != 'lower'"
|
|
|
|
- style="width: 200px; margin: 0 10px;"
|
|
|
|
- placeholder="请输入"
|
|
|
|
- v-model="formValue.aligothmTypeInfo.thresholdSetTypeInfo.upper">
|
|
|
|
- <template slot="append">{{unit || "单位"}}</template>
|
|
|
|
- </el-input>
|
|
|
|
- <!-- 浮动范围
|
|
|
|
- <el-input
|
|
|
|
- style="width: 150px; margin: 0 10px;"
|
|
|
|
- placeholder="请输入"
|
|
|
|
- v-model="formValue.aligothmTypeInfo.thresholdSetTypeInfo.rangefrom">
|
|
|
|
- <template slot="append">%</template>
|
|
|
|
- </el-input> -->
|
|
|
|
- </p>
|
|
|
|
- </el-form-item>
|
|
|
|
- </el-radio>
|
|
|
|
- </p>
|
|
|
|
- <p>
|
|
|
|
- <el-radio label="compareInfoCode">指定数据字典中信息点进行比对
|
|
|
|
- <el-form-item prop="aligothmTypeInfo.thresholdSetType" :rules="rules.verifyCompareInfo">
|
|
|
|
- <el-button @click="selectRatedInfoHandle('lower')"
|
|
|
|
- v-if="formValue.aligothmTypeInfo.thresholdSetTypeInfo.type != 'upper'"
|
|
|
|
- :disabled="formValue.aligothmTypeInfo.thresholdSetType != 'compareInfoCode'">{{selectRatedInfoLowerBtn}}</el-button>
|
|
|
|
- <el-button @click="selectRatedInfoHandle('upper')"
|
|
|
|
- v-if="formValue.aligothmTypeInfo.thresholdSetTypeInfo.type != 'lower'"
|
|
|
|
- :disabled="formValue.aligothmTypeInfo.thresholdSetType != 'compareInfoCode'">{{selectRatedInfoUpperBtn}}</el-button>
|
|
|
|
- </el-form-item>
|
|
|
|
- </el-radio>
|
|
|
|
-
|
|
|
|
- </p>
|
|
|
|
- <p><el-radio label="compareHistory">使用历史值进行对比</el-radio></p>
|
|
|
|
- </el-radio-group>
|
|
|
|
-
|
|
|
|
- </div>
|
|
|
|
- </el-form>
|
|
|
|
- </div>
|
|
|
|
- <div class="btn-box">
|
|
|
|
- <el-button class="edit-btn" type="primary" :loading="btnLoading" @click="saveHandle('ruleForm')">保存</el-button>
|
|
|
|
- <el-button @click="cancelHandle()">取消</el-button>
|
|
|
|
- </div>
|
|
|
|
- <!-- 所转问题弹窗 -->
|
|
|
|
- <v-has-problem
|
|
|
|
- :hasProblemVisibleFlag="hasProblemVisibleFlag"
|
|
|
|
- :objTypeValue="startCascadeValue"
|
|
|
|
- :startCascadeValue="startCascadeValue"
|
|
|
|
- :endCascadeValue="endCascadeValue"
|
|
|
|
- @has-problem-handle="hasProblemEmitHandle"
|
|
|
|
- @has-problem-close="hasProblemCloseHandle">
|
|
|
|
- </v-has-problem>
|
|
|
|
- <!-- 选择额定信息点 -->
|
|
|
|
- <v-select-rated-info
|
|
|
|
- :selectRatedInfoFlag="selectRatedInfoFlag"
|
|
|
|
- :objTypeValue="startCascadeValue"
|
|
|
|
- :infoPointArr="infoPointArr"
|
|
|
|
- :selectRatedInfoCheckedCode="selectRatedInfoCheckedCode"
|
|
|
|
- @select-info-handle="selectRatedInfoEmitHandle">
|
|
|
|
- </v-select-rated-info>
|
|
|
|
-</div>
|
|
|
|
-</template>
|
|
|
|
-<script>
|
|
|
|
-import fixedApi from '../fixedalarmitem/api';
|
|
|
|
-import alarmApi from '@/api/alarm'
|
|
|
|
-//components
|
|
|
|
-import vHasProblem from './hasproblem'; //所转问题弹窗
|
|
|
|
-// import vSelectInfo from './selectinfo'; //选择信息点
|
|
|
|
-import vSelectRatedInfo from './selectratedinfo'; //选择技术信息点
|
|
|
|
-import vObjType from '@/components/alarm/ObjType'
|
|
|
|
-import vAlarmClass from '@/components/alarm/AlarmClass'
|
|
|
|
-export default {
|
|
|
|
- name: 'edit',
|
|
|
|
- data () {
|
|
|
|
- /******校验规则部分****** */
|
|
|
|
- // 报警编码值code校验
|
|
|
|
- let validatorCode = (rules, value, callback) => {
|
|
|
|
- let num = Number(value);
|
|
|
|
- if(isNaN(num)){
|
|
|
|
- callback(new Error('请输入数字'));
|
|
|
|
- } else {
|
|
|
|
- let reg = /^\d{1,10}$/
|
|
|
|
- if(reg.test(num)){
|
|
|
|
- callback()
|
|
|
|
- }else{
|
|
|
|
- callback(new Error('请输入不超过10位的数字'));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- };
|
|
|
|
- // 报警诊断启动前提
|
|
|
|
- let validatorPrecondition = (rules, value, callback) => {
|
|
|
|
- if(value === 'runningEnergy') {
|
|
|
|
- let reg = /^[1-9]\d*$/;
|
|
|
|
- if(reg.test(this.formValue.aligothmTypeInfo.energyupper)) {
|
|
|
|
- callback()
|
|
|
|
- } else {
|
|
|
|
- callback(new Error('请输入正整数'));
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- callback();
|
|
|
|
- }
|
|
|
|
- };
|
|
|
|
- // 报警持续要求时间
|
|
|
|
- let validatorErrorLastPeriod = (rules, value, callback) => {
|
|
|
|
- if(value == 0) {
|
|
|
|
- callback()
|
|
|
|
- } else {
|
|
|
|
- let reg = /^[1-9]\d{0,3}$/;
|
|
|
|
- if(reg.test(value)) {
|
|
|
|
- callback()
|
|
|
|
- } else {
|
|
|
|
- callback(new Error('请输入不超4位正整数'));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- };
|
|
|
|
- let validatorupperLower = (rules, value, callback) => {
|
|
|
|
- if(this.formValue.aligothmTypeInfo.thresholdSetTypeInfo.type == 'upperLower' && this.formValue.aligothmTypeInfo.thresholdSetType == "customed" ) { // 上下限
|
|
|
|
- if(/^-?\d{1,8}(?:\.\d{1,3})?$/.test(this.formValue.aligothmTypeInfo.thresholdSetTypeInfo.lower)
|
|
|
|
- && /^-?\d{1,8}(?:\.\d{1,3})?$/.test(this.formValue.aligothmTypeInfo.thresholdSetTypeInfo.upper)){
|
|
|
|
- let lower = Number(this.formValue.aligothmTypeInfo.thresholdSetTypeInfo.lower)
|
|
|
|
- let upper = Number(this.formValue.aligothmTypeInfo.thresholdSetTypeInfo.upper)
|
|
|
|
- if(lower > upper) {
|
|
|
|
- callback(new Error('下限大于上限'));
|
|
|
|
- } else {
|
|
|
|
- callback()
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- callback(new Error('整数最多8位,小数最多3位'));
|
|
|
|
- }
|
|
|
|
- } else if (this.formValue.aligothmTypeInfo.thresholdSetTypeInfo.type == 'upper' && this.formValue.aligothmTypeInfo.thresholdSetType == "customed"){ //上限
|
|
|
|
- if(/^-?\d{1,8}(?:\.\d{1,3})?$/.test(this.formValue.aligothmTypeInfo.thresholdSetTypeInfo.upper)){
|
|
|
|
- callback()
|
|
|
|
- } else {
|
|
|
|
- callback(new Error('整数最多8位,小数最多3位'));
|
|
|
|
- }
|
|
|
|
- } else if (this.formValue.aligothmTypeInfo.thresholdSetTypeInfo.type == 'lower' && this.formValue.aligothmTypeInfo.thresholdSetType == "customed"){ //下限
|
|
|
|
- if(/^-?\d{1,8}(?:\.\d{1,3})?$/.test(this.formValue.aligothmTypeInfo.thresholdSetTypeInfo.lower)){
|
|
|
|
- callback()
|
|
|
|
- } else {
|
|
|
|
- callback(new Error('整数最多8位,小数最多3位'));
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- callback();
|
|
|
|
- }
|
|
|
|
- };
|
|
|
|
- let validatorcompareInfo = (rules, value, callback) => {
|
|
|
|
- if( this.formValue.aligothmTypeInfo.thresholdSetTypeInfo.type == 'upperLower' && this.formValue.aligothmTypeInfo.thresholdSetType == "compareInfoCode") { // 上下限
|
|
|
|
- if(this.formValue.aligothmTypeInfo.thresholdSetTypeInfo.lowerCompareInfocode && this.formValue.aligothmTypeInfo.thresholdSetTypeInfo.upperCompareInfocode){
|
|
|
|
- callback()
|
|
|
|
- } else {
|
|
|
|
- callback(new Error('请选择信息点'));
|
|
|
|
- }
|
|
|
|
- } else if (this.formValue.aligothmTypeInfo.thresholdSetTypeInfo.type == 'upper' && this.formValue.aligothmTypeInfo.thresholdSetType == "compareInfoCode"){ //上限
|
|
|
|
- if(this.formValue.aligothmTypeInfo.thresholdSetTypeInfo.upperCompareInfocode){
|
|
|
|
- callback()
|
|
|
|
- } else {
|
|
|
|
- callback(new Error('请选择信息点'));
|
|
|
|
- }
|
|
|
|
- } else if (this.formValue.aligothmTypeInfo.thresholdSetTypeInfo.type == 'lower' && this.formValue.aligothmTypeInfo.thresholdSetType == "compareInfoCode"){ //下限
|
|
|
|
- if(this.formValue.aligothmTypeInfo.thresholdSetTypeInfo.lowerCompareInfocode){
|
|
|
|
- callback()
|
|
|
|
- } else {
|
|
|
|
- callback(new Error('请选择信息点'));
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- callback();
|
|
|
|
- }
|
|
|
|
- };
|
|
|
|
- return {
|
|
|
|
- /********************* */
|
|
|
|
- objTypeComValue: [],
|
|
|
|
- /********************* */
|
|
|
|
- projectId: null, //项目id
|
|
|
|
- hasProblemVisibleFlag: false, //所转问题的弹窗的flag
|
|
|
|
- slectInfoFlag: false, //选择信息点的flag
|
|
|
|
- selectRatedInfoFlag: false, //选择额定信息点的flag
|
|
|
|
- btnLoading: false, //按钮loading
|
|
|
|
- formValue: {
|
|
|
|
- objType: null, //对象类型,project,floor,space,system,facility, **必须
|
|
|
|
- objTypeRules:[],
|
|
|
|
- category: null, //系统或者设备的category 例如:选系统或者设备时加上前面加上专业编号 其他对象类型为空
|
|
|
|
- code: null, //报警条目编码 **必须
|
|
|
|
- name: null, //报警条目名称 **必须
|
|
|
|
- alarmCategory: undefined, //报警分类
|
|
|
|
- level: null, //严重程度 S A B C D 五级
|
|
|
|
- funcid:[{ //信息点信息,污水坑算法时不用传
|
|
|
|
- funcidId: null, //对应信息点id
|
|
|
|
- funcidName: null //对应信息点名称
|
|
|
|
- }],
|
|
|
|
- hasProblem: null, //'1转问题,0不转问题',int类型
|
|
|
|
- problemId: null, //问题id,hasProblem为1时此项不为空' ,
|
|
|
|
- remark: null, //备注
|
|
|
|
- aligothmType: "none", //算法类型,不需要算法,none 阈值threshold,污水坑sump
|
|
|
|
- aligothmTypeInfo: {
|
|
|
|
- precondition: null,//前提,running(只有当设备处于运行状态时才启动报警诊断),runningEnergy(只有当设备运行能耗大于时启动),any(任何情况都启动)
|
|
|
|
- energyupper: 40, // precondition为runningEnergy时不为空,int类型
|
|
|
|
- dateSet: "all", //日期设定,all,workday,weekday
|
|
|
|
- timeSet: "all", //时间设定,all,customed
|
|
|
|
- startTime: null, //自定义时间设定开始时间hhss,timeSet为customed时不为空
|
|
|
|
- endTime: null, //自定义时间设定结束时间hhss,timeSet为customed时不为空
|
|
|
|
- errorlastperiod: 0, //异常持续时间,单位秒,
|
|
|
|
- thresholdSetType: "customed", //门限设置方式,customed,compareInfoCode,compareHistory
|
|
|
|
- compareInfocode: null, //比对信息点thresholdSetType为compareInfoCode时必须
|
|
|
|
- thresholdSetTypeInfo:{
|
|
|
|
- type: "upperLower", //aligothmType为threshold时必须 upperLower,upper,lower
|
|
|
|
- lower: 0, //下限
|
|
|
|
- upper: 0, //上限
|
|
|
|
- rangefrom: 0, //浮动范围,不是必须
|
|
|
|
- lowerCompareInfocode: null,
|
|
|
|
- upperCompareInfocode: null,
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- rules: { //表单的规则
|
|
|
|
- objTypeRules: [{ required:true, message: '请选择对象类', trigger: 'change'}],
|
|
|
|
- code: [{ required:true, message: '请填写条目编码', trigger: 'blur'},
|
|
|
|
- {validator: validatorCode, trigger: 'blur'}],
|
|
|
|
- name: [{ required:true, message: '请填写条目名称', trigger: 'blur'},
|
|
|
|
- { min: 1, max: 30, message: '不超过30个字', trigger: 'blur'}],
|
|
|
|
- level: [{ required:true, message: '请选择严重程度', trigger: 'change'}],
|
|
|
|
- aligothmType: [{ required:true, message: '请选择报警所用算法', trigger: 'change'}],
|
|
|
|
- precondition: [{ required:true, message: '请选择报警诊断前提', trigger: 'change'},
|
|
|
|
- {validator: validatorPrecondition, trigger: 'blur'}],
|
|
|
|
- dateSet: [{ required:true, message: '请选择日期和时间', trigger: 'blur'}],
|
|
|
|
- errorlastperiod: [{ required:true, message: '请选择报警持续时间', trigger: 'blur'},
|
|
|
|
- {validator: validatorErrorLastPeriod, trigger: 'blur'}],
|
|
|
|
- verifyUpperLower: [
|
|
|
|
- {validator: validatorupperLower, trigger: 'blur'}],
|
|
|
|
- verifyCompareInfo: [
|
|
|
|
- {validator: validatorcompareInfo, trigger: 'blur'}
|
|
|
|
- ]
|
|
|
|
-
|
|
|
|
- },
|
|
|
|
- levelSelectArr: [ //严重级别的下拉数据
|
|
|
|
- {
|
|
|
|
- label: "S",
|
|
|
|
- value: "S",
|
|
|
|
- },{
|
|
|
|
- label: "A",
|
|
|
|
- value: "A",
|
|
|
|
- },{
|
|
|
|
- label: "B",
|
|
|
|
- value: "B",
|
|
|
|
- },{
|
|
|
|
- label: "C",
|
|
|
|
- value: "C",
|
|
|
|
- },{
|
|
|
|
- label: "D",
|
|
|
|
- value: "D",
|
|
|
|
- }
|
|
|
|
- ],
|
|
|
|
- hasProblemArr: [ //报警触发时所转问题的下拉数据
|
|
|
|
- {
|
|
|
|
- label: "不转问题",
|
|
|
|
- value: "0",
|
|
|
|
- },{
|
|
|
|
- label: "选择问题",
|
|
|
|
- value: "1",
|
|
|
|
- }
|
|
|
|
- ],
|
|
|
|
- aligothmTypeArr: [
|
|
|
|
- {
|
|
|
|
- label: "直接从点位值判断,不需要算法",
|
|
|
|
- value: "none"
|
|
|
|
- }, {
|
|
|
|
- label: "使用阈值算法",
|
|
|
|
- value: "threshold",
|
|
|
|
- }
|
|
|
|
- ],
|
|
|
|
- thresholdSetTypeInfoArr: [ //阈值算法的报警们限值设定方式的上下限的数组
|
|
|
|
- {
|
|
|
|
- label: '上下限',
|
|
|
|
- value: 'upperLower'
|
|
|
|
- },{
|
|
|
|
- label: '上限',
|
|
|
|
- value: 'upper'
|
|
|
|
- },{
|
|
|
|
- label: '下限',
|
|
|
|
- value: 'lower'
|
|
|
|
- }
|
|
|
|
- ],
|
|
|
|
- // objTypeOptions: [{ //选择适用对象类的级联框
|
|
|
|
- // value: 'building',
|
|
|
|
- // label: '建筑',
|
|
|
|
- // },{
|
|
|
|
- // value: 'floor',
|
|
|
|
- // label: '楼层',
|
|
|
|
- // },{
|
|
|
|
- // value: 'space',
|
|
|
|
- // label: '空间',
|
|
|
|
- // },{
|
|
|
|
- // value: 'system',
|
|
|
|
- // label: '系统类',
|
|
|
|
- // children: []
|
|
|
|
- // },{
|
|
|
|
- // value: 'facility',
|
|
|
|
- // label: '设备类',
|
|
|
|
- // children: []
|
|
|
|
- // }],
|
|
|
|
- startCascadeValue: null, //级联第一级
|
|
|
|
- endCascadeValue: null, //级联最后一级
|
|
|
|
- infoPointArr:[], //信息点总数组
|
|
|
|
- hasProblemInfo: null, //所转问题详情
|
|
|
|
- selectInfoBtn: null,
|
|
|
|
- customTimeRange: [new Date(), new Date()], //自定义时间段
|
|
|
|
- selectRatedInfoUpperBtn: '请选择上限信息点', //选择固定的信息点
|
|
|
|
- selectRatedInfoLowerBtn: '请选择下限信息点',
|
|
|
|
- selectRatedInfoCodeFlag: null, //选择信息点的flag
|
|
|
|
- selectRatedInfoCheckedCode: null, //被选中的信息点
|
|
|
|
- unit: null, //阈值算法的单位
|
|
|
|
- isRunStatus: false, //是否有RunStatus的信息点
|
|
|
|
- isElecConsumP: false, //是否有ElecConsumP的信息点
|
|
|
|
- createStatus: false, //创建状态
|
|
|
|
- //业务管理v1.1升级
|
|
|
|
- alarmClassArr:[], //报警分类的下拉数据
|
|
|
|
- alarmClassValue: '', //绑定的value
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- components: {
|
|
|
|
- vHasProblem,
|
|
|
|
- vSelectRatedInfo,
|
|
|
|
- vObjType,
|
|
|
|
- vAlarmClass
|
|
|
|
- },
|
|
|
|
- methods: {
|
|
|
|
- //保存
|
|
|
|
- saveHandle(formName) {
|
|
|
|
- this.$refs[formName].validate((valid) => {
|
|
|
|
- this.btnLoading = true;
|
|
|
|
- if (valid) {
|
|
|
|
- let params = {
|
|
|
|
- type: "customed", //报警条目类别,fixed 固定,customed 自定义 **必须
|
|
|
|
- projectId: this.projectId, //项目id,自定义类别时不为空
|
|
|
|
- code: this.formValue.code, //报警条目编码 code和name可以只传一个
|
|
|
|
- name: this.formValue.name //报警条目名称
|
|
|
|
- }
|
|
|
|
- fixedApi.isExisted(params).then(res => {
|
|
|
|
- if(res.result == 'success') {
|
|
|
|
- if(res.name || res.code){
|
|
|
|
- this.$message({
|
|
|
|
- message: '报警编码或报警条目重复',
|
|
|
|
- type: 'warning'
|
|
|
|
- });
|
|
|
|
- let name = this.formValue.name;
|
|
|
|
- let code = this.formValue.code;
|
|
|
|
- if(res.name) {
|
|
|
|
- this.formValue.name = null;
|
|
|
|
- }
|
|
|
|
- if(res.code){
|
|
|
|
- this.formValue.code = null;
|
|
|
|
- }
|
|
|
|
- this.$refs[formName].validate((valid) => {
|
|
|
|
- this.formValue.name = name;
|
|
|
|
- this.formValue.code = code;
|
|
|
|
- })
|
|
|
|
- this.btnLoading = false;
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- //调保存接口
|
|
|
|
- this.formValue.type = "customed";
|
|
|
|
- this.formValue.projectId = this.projectId;
|
|
|
|
- let param = this.formValue;
|
|
|
|
- fixedApi.save(param).then(res => {
|
|
|
|
- if(res.result === "success"){
|
|
|
|
- this.$message({
|
|
|
|
- message: '保存成功',
|
|
|
|
- type: 'success'
|
|
|
|
- });
|
|
|
|
- this.btnLoading = false;
|
|
|
|
- this.$router.push("/projectinit/projectalarmitem?projectId=" +this.projectId)
|
|
|
|
- } else {
|
|
|
|
- this.btnLoading = false;
|
|
|
|
- this.$message({
|
|
|
|
- message: '网络连接超时,请重新提交',
|
|
|
|
- type: 'error'
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- } else {
|
|
|
|
- this.$message({
|
|
|
|
- message: '页面有必填项,请填写后提交!',
|
|
|
|
- type: 'warning'
|
|
|
|
- });
|
|
|
|
- this.btnLoading = false;
|
|
|
|
- console.log('error submit!!');
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
- // 取消
|
|
|
|
- cancelHandle () {
|
|
|
|
- this.$router.push("/projectinit/projectalarmitem?projectId=" +this.projectId)
|
|
|
|
- },
|
|
|
|
- // 获取对象类
|
|
|
|
- // getObjTypeData() {
|
|
|
|
- // fixedApi.getObjectType().then(res => {
|
|
|
|
- // let {sysArr, devArr} = res;
|
|
|
|
- // this.objTypeOptions[3].children = sysArr;
|
|
|
|
- // this.objTypeOptions[4].children = devArr;
|
|
|
|
- // });
|
|
|
|
- // },
|
|
|
|
- // 获取信息的数组接口
|
|
|
|
- getInfoPointArr(type) {
|
|
|
|
- if(this.startCascadeValue == "system") {
|
|
|
|
- type = type.substring(2, 4);
|
|
|
|
- }
|
|
|
|
- if(this.startCascadeValue == "facility") {
|
|
|
|
- type = type.substring(2, 6);
|
|
|
|
- }
|
|
|
|
- let params = {
|
|
|
|
- type: type,
|
|
|
|
- }
|
|
|
|
- fixedApi.getInfoListData(params).then((res) => {
|
|
|
|
- let data = res;
|
|
|
|
- this.infoPointArr = data;
|
|
|
|
- let RunStatusArr = data.filter((ele, index) => {
|
|
|
|
- return ele.infoPointCode == "RunStatus"
|
|
|
|
- });
|
|
|
|
- let ElecConsumPArr = data.filter((ele, index) => {
|
|
|
|
- return ele.infoPointCode == "ElecConsumP"
|
|
|
|
- });
|
|
|
|
- this.isRunStatus = RunStatusArr[0] ? true : false;
|
|
|
|
- this.isElecConsumP = ElecConsumPArr[0] ? true : false;
|
|
|
|
- }).catch(err => {
|
|
|
|
- throw err;
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
- // 时间日期radiochange事件
|
|
|
|
- timeRadioHandle(val) {
|
|
|
|
- if(val == "customed") {
|
|
|
|
- let startTime = this.customTimeRange[0];
|
|
|
|
- let endTime = this.customTimeRange[1];
|
|
|
|
- this.formValue.aligothmTypeInfo.startTime = "" + startTime.getHours() + startTime.getMinutes();;
|
|
|
|
- this.formValue.aligothmTypeInfo.endTime = "" + endTime.getHours() + endTime.getMinutes();
|
|
|
|
- } else {
|
|
|
|
- this.formValue.aligothmTypeInfo.startTime = null;
|
|
|
|
- this.formValue.aligothmTypeInfo.endTime = null;
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- // 时间日期区间change事件
|
|
|
|
- timeRangeHandle(timeArr) {
|
|
|
|
- if(timeArr) {
|
|
|
|
- this.formValue.aligothmTypeInfo.startTime = timeArr[0];
|
|
|
|
- this.formValue.aligothmTypeInfo.endTime = timeArr[1];
|
|
|
|
- } else {
|
|
|
|
- this.formValue.aligothmTypeInfo.startTime = null;
|
|
|
|
- this.formValue.aligothmTypeInfo.endTime = null;
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- //报警门限值change事件
|
|
|
|
- thresholdSetTypeChange(val) {
|
|
|
|
- this.formValue.aligothmTypeInfo.compareInfocode = null;
|
|
|
|
- },
|
|
|
|
- // 填写默认值
|
|
|
|
- getDefaultValue(){
|
|
|
|
- let creatParams = this.$route.query;
|
|
|
|
- if(creatParams){
|
|
|
|
-
|
|
|
|
- // 处理对象类
|
|
|
|
- let objArr = [];
|
|
|
|
- objArr[0] = creatParams.startCascadeValue;
|
|
|
|
- this.startCascadeValue = creatParams.startCascadeValue;
|
|
|
|
- this.endCascadeValue = creatParams.startCascadeValue;
|
|
|
|
- if(creatParams.startCascadeValue == 'system') {
|
|
|
|
- this.endCascadeValue = creatParams.endCascadeValue;
|
|
|
|
- objArr[1] = creatParams.endCascadeValue.substring(0, 2);
|
|
|
|
- objArr[2] = creatParams.endCascadeValue.substring(0, 4);
|
|
|
|
- }
|
|
|
|
- if (creatParams.startCascadeValue == 'facility') {
|
|
|
|
- this.endCascadeValue = creatParams.endCascadeValue;
|
|
|
|
- objArr[1] = creatParams.endCascadeValue.substring(0, 2);
|
|
|
|
- objArr[2] = creatParams.endCascadeValue.substring(0, 4);
|
|
|
|
- objArr[3] = creatParams.endCascadeValue.substring(0, 6);
|
|
|
|
- }
|
|
|
|
- if(creatParams.startCascadeValue == 'space') {
|
|
|
|
- this.endCascadeValue = creatParams.endCascadeValue;
|
|
|
|
- objArr = ['space', creatParams.endCascadeValue];
|
|
|
|
- }
|
|
|
|
- this.createStatus = true;
|
|
|
|
- this.formValue.objTypeRules = objArr;
|
|
|
|
- this.objTypeComValue = objArr;
|
|
|
|
- this.formValue.objType = creatParams.startCascadeValue;
|
|
|
|
- this.formValue.category = creatParams.endCascadeValue;
|
|
|
|
- this.formValue.name = creatParams.infoPointName;
|
|
|
|
- // 信息点
|
|
|
|
- this.selectInfoBtn = creatParams.infoPointName;
|
|
|
|
- this.formValue.funcid[0].funcidId = creatParams.infoPointCode;
|
|
|
|
- this.formValue.funcid[0].funcidName = creatParams.infoPointName
|
|
|
|
- // 单位
|
|
|
|
- this.unit = creatParams.unit || "单位"
|
|
|
|
- // 获取信息点
|
|
|
|
- let infoParam = creatParams.startCascadeValue == 'space' ? 'space' : this.endCascadeValue;
|
|
|
|
- this.getInfoPointArr(infoParam);
|
|
|
|
- } else {
|
|
|
|
- window.history.go(-1);
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- /***************************组件回调时间************************************** */
|
|
|
|
- //触发问题下拉事件
|
|
|
|
- hasProblemHandle(value) {
|
|
|
|
- if(value == 1){
|
|
|
|
- this.hasProblemVisibleFlag = !this.hasProblemVisibleFlag;
|
|
|
|
- } else {
|
|
|
|
- this.hasProblemInfo = null;
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- //触发所转问题的回调事件
|
|
|
|
- hasProblemEmitHandle(name, id) {
|
|
|
|
- this.hasProblemInfo = name + '---' + id;
|
|
|
|
- this.formValue.problemId = id;
|
|
|
|
- },
|
|
|
|
- //触发所转问题的关闭事件
|
|
|
|
- hasProblemCloseHandle(radioValue) {
|
|
|
|
- if(!radioValue){
|
|
|
|
- this.formValue.hasProblem = null;
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- //选择技术信息点的点击事件
|
|
|
|
- selectRatedInfoHandle(flag) {
|
|
|
|
- this.selectRatedInfoCodeFlag = flag; //标记是上限 or 下限
|
|
|
|
- if (flag == "lower") {
|
|
|
|
- this.selectRatedInfoCheckedCode = this.formValue.aligothmTypeInfo.thresholdSetTypeInfo.lowerCompareInfocode;
|
|
|
|
- } else {
|
|
|
|
- this.selectRatedInfoCheckedCode = this.formValue.aligothmTypeInfo.thresholdSetTypeInfo.upperCompareInfocode;
|
|
|
|
- }
|
|
|
|
- this.selectRatedInfoFlag = !this.selectRatedInfoFlag;
|
|
|
|
- },
|
|
|
|
- //选择技术信息点的回填事件
|
|
|
|
- selectRatedInfoEmitHandle(name, code) {
|
|
|
|
- if (this.selectRatedInfoCodeFlag == "lower") {
|
|
|
|
- this.selectRatedInfoLowerBtn = name + '---' + code;
|
|
|
|
- this.formValue.aligothmTypeInfo.thresholdSetTypeInfo.lowerCompareInfocode = code;
|
|
|
|
- } else {
|
|
|
|
- this.selectRatedInfoUpperBtn = name + '---' + code;
|
|
|
|
- this.formValue.aligothmTypeInfo.thresholdSetTypeInfo.upperCompareInfocode = code;
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- init() {
|
|
|
|
- this.projectId = this.$route.query.projectId;
|
|
|
|
- // 填写默认值
|
|
|
|
- this.getDefaultValue();
|
|
|
|
- //获取报警分类的列表
|
|
|
|
- this.getAlarmClassList()
|
|
|
|
- },
|
|
|
|
- /**v1.1********************************* */
|
|
|
|
- //获取报警分类
|
|
|
|
- async getAlarmClassList() {
|
|
|
|
- let params = {
|
|
|
|
- criteria: {
|
|
|
|
- projectId: {$in:[this.projectId,"0"]}
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- let res = await alarmApi.alarmClassList(params)
|
|
|
|
- this.alarmClassArr = res
|
|
|
|
- },
|
|
|
|
- //报警分类的change
|
|
|
|
- alarmClassChange(val) {
|
|
|
|
- this.formValue.alarmCategory = val || undefined
|
|
|
|
- },
|
|
|
|
- //报警分类添加
|
|
|
|
- async alarmClassAdd(val) {
|
|
|
|
- let params = {
|
|
|
|
- projectId: this.projectId,
|
|
|
|
- category: val
|
|
|
|
- }
|
|
|
|
- let res = await alarmApi.createAlarmClass(params)
|
|
|
|
- if(res.result == 'success') {
|
|
|
|
- this.$message({
|
|
|
|
- message: '添加成功',
|
|
|
|
- type: 'success'
|
|
|
|
- });
|
|
|
|
- this.$refs['alarm-class'].visible = false
|
|
|
|
- await this.getAlarmClassList()
|
|
|
|
- this.alarmClassValue = val
|
|
|
|
- this.formValue.alarmCategory = val
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- mounted() {
|
|
|
|
- this.init()
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-}
|
|
|
|
-</script>
|
|
|
|
-<style lang='less' scoped>
|
|
|
|
-.edit-box{
|
|
|
|
- .title {text-align: center;}
|
|
|
|
- .form-box {
|
|
|
|
- margin-top:20px;
|
|
|
|
- margin-left:20%;
|
|
|
|
- width: 50%;
|
|
|
|
- .infoStar{
|
|
|
|
- color: #f56c6c;
|
|
|
|
- position: absolute;
|
|
|
|
- left: -93px;
|
|
|
|
- }
|
|
|
|
- .threshold-box{
|
|
|
|
- .precondition-left{
|
|
|
|
- padding-left:150px;
|
|
|
|
- }
|
|
|
|
- .precondition{
|
|
|
|
- p{
|
|
|
|
- margin:10px 0;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- };
|
|
|
|
- .level_describe {
|
|
|
|
- color: #b2b2b2;
|
|
|
|
- p {
|
|
|
|
- line-height: 24px;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- .btn-box{
|
|
|
|
- margin-top: 10px;
|
|
|
|
- text-align: center;
|
|
|
|
- .edit-btn{
|
|
|
|
- margin-right: 50px;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-</style>
|
|
|
|
-<style>
|
|
|
|
-.edit-box .form-box .threshold-box .precondition-left .el-form-item__content{margin-left: 0px!important}
|
|
|
|
-</style>
|
|
|