|
|
@@ -1,19 +1,13 @@
|
|
|
<template>
|
|
|
- <el-dialog
|
|
|
- :title="dialogTitle"
|
|
|
+ <ele-modal
|
|
|
+ :title="dialogType == 'add' ? '新增' : 'edit' ? '修改' : '详情'"
|
|
|
:visible.sync="addWarningDialog"
|
|
|
width="60%"
|
|
|
- :close-on-click-modal="false"
|
|
|
+ :close-on-click-modal="true"
|
|
|
:close-on-press-escape="false"
|
|
|
:before-close="handleClose"
|
|
|
- :fullscreen="fullscreen"
|
|
|
- class="fullscreen"
|
|
|
- ><template slot="title">
|
|
|
- <modalTitle
|
|
|
- :title="dialogTitle"
|
|
|
- @setFullscreen="fullscreen = !fullscreen"
|
|
|
- ></modalTitle>
|
|
|
- </template>
|
|
|
+ :maxable="true"
|
|
|
+ >
|
|
|
<el-tabs
|
|
|
type="border-card"
|
|
|
v-model="tabActiveName"
|
|
|
@@ -26,58 +20,69 @@
|
|
|
:rules="baseInfoFormRules"
|
|
|
ref="baseInfoFormRef"
|
|
|
label-width="120px"
|
|
|
+ :disabled="dialogType == 'view'"
|
|
|
>
|
|
|
<el-row>
|
|
|
- <el-col :span="10">
|
|
|
- <el-form-item label="告警级别:" prop="alarmLevel">
|
|
|
- <DictSelection
|
|
|
- dictName="告警级别"
|
|
|
- clearable
|
|
|
- v-model="baseInfoForm.alarmLevel"
|
|
|
- style="width: 80%"
|
|
|
- >
|
|
|
- </DictSelection>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="告警级别:" prop="level">
|
|
|
+ <el-select filterable v-model="baseInfoForm.level" size="small">
|
|
|
+ <el-option label="提示" :value="1"></el-option>
|
|
|
+ <el-option label="一般" :value="2"></el-option>
|
|
|
+ <el-option label="严重" :value="3"></el-option>
|
|
|
+ <el-option label="紧急" :value="4"></el-option>
|
|
|
+ <el-option label="致命" :value="5"></el-option>
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item
|
|
|
- label="告警设备类型:"
|
|
|
- prop="alarmEquipmentName"
|
|
|
+ label="告警设备:"
|
|
|
+ prop="deviceName"
|
|
|
style="width: 90%"
|
|
|
>
|
|
|
- <equipmentSelect v-model="baseInfoForm.alarmEquipmentName" />
|
|
|
+ <el-input
|
|
|
+ v-model="baseInfoForm.deviceName"
|
|
|
+ style="width: 80%"
|
|
|
+ placeholder="请选择"
|
|
|
+ readonly
|
|
|
+ @click.native="
|
|
|
+ $refs.materialAddRef.open(
|
|
|
+ null,
|
|
|
+ null,
|
|
|
+ false,
|
|
|
+ null,
|
|
|
+ null,
|
|
|
+ true
|
|
|
+ )
|
|
|
+ "
|
|
|
+ ></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-row>
|
|
|
- <el-col :span="10">
|
|
|
- <el-form-item label="告警名称:" prop="alarmName">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="告警名称:" prop="name">
|
|
|
<el-input
|
|
|
- v-model="baseInfoForm.alarmName"
|
|
|
+ v-model="baseInfoForm.name"
|
|
|
style="width: 80%"
|
|
|
placeholder="请输入告警名称"
|
|
|
size="small"
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="4">
|
|
|
- <el-form-item label="生成报修记录:">
|
|
|
- <el-switch
|
|
|
- v-model="baseInfoForm.isCreate"
|
|
|
- active-color="#13ce66"
|
|
|
- inactive-color="#989898"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="4">
|
|
|
- <el-form-item label="状态:">
|
|
|
- <el-switch
|
|
|
- v-model="baseInfoForm.status"
|
|
|
- active-color="#13ce66"
|
|
|
- inactive-color="#989898"
|
|
|
- />
|
|
|
+ <!-- <el-col :span="12">
|
|
|
+ <el-form-item label="选择生成单据:">
|
|
|
+ <el-radio-group
|
|
|
+ v-model="baseInfoForm.generateDocumentType"
|
|
|
+ @change="isCreateChange"
|
|
|
+ >
|
|
|
+ <el-radio :label="3">报修记录</el-radio>
|
|
|
+ <el-radio :label="1">巡点检</el-radio>
|
|
|
+ <el-radio :label="2">保养</el-radio>
|
|
|
+ <el-radio :label="5">量具送检</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
</el-form-item>
|
|
|
- </el-col>
|
|
|
+ </el-col> -->
|
|
|
</el-row>
|
|
|
<el-row>
|
|
|
<el-col :span="24">
|
|
|
@@ -87,7 +92,7 @@
|
|
|
:rows="3"
|
|
|
resize="none"
|
|
|
size="small"
|
|
|
- v-model="baseInfoForm.alarmDescribe"
|
|
|
+ v-model="baseInfoForm.description"
|
|
|
placeholder="请输入告警描述"
|
|
|
style="width: 85%"
|
|
|
></el-input>
|
|
|
@@ -96,33 +101,30 @@
|
|
|
</el-row>
|
|
|
<el-row>
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="触发条件:" prop="alarmTrigger">
|
|
|
+ <el-form-item label="触发条件:" prop="triggerLogic">
|
|
|
<el-select
|
|
|
filterable
|
|
|
- v-model="baseInfoForm.alarmTrigger"
|
|
|
+ v-model="baseInfoForm.triggerLogic"
|
|
|
size="small"
|
|
|
>
|
|
|
<el-option
|
|
|
label="当满足以下所有条件时"
|
|
|
- :value="0"
|
|
|
+ :value="1"
|
|
|
></el-option>
|
|
|
<el-option
|
|
|
label="当满足以下任一条件时"
|
|
|
- :value="1"
|
|
|
+ :value="2"
|
|
|
></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="24" class="table_wrapper">
|
|
|
- <el-table
|
|
|
- :data="baseInfoForm.alarmTriggerList"
|
|
|
- style="width: 100%"
|
|
|
- >
|
|
|
+ <el-col :span="24" class="table_wrapper"></el-col>
|
|
|
+ <el-table :data="baseInfoForm.conditions" style="width: 100%">
|
|
|
<el-table-column label="">
|
|
|
<template slot-scope="scope">
|
|
|
<el-select
|
|
|
filterable
|
|
|
- v-model="scope.row.alarmType"
|
|
|
+ v-model="scope.row.attributeCode"
|
|
|
size="small"
|
|
|
style="width: 100%"
|
|
|
placeholder="请选择"
|
|
|
@@ -132,6 +134,7 @@
|
|
|
:key="item.identifier"
|
|
|
:value="item.identifier"
|
|
|
:label="item.name"
|
|
|
+ @click.native="attributeChange(item, scope.$index)"
|
|
|
></el-option>
|
|
|
</el-select>
|
|
|
</template>
|
|
|
@@ -141,7 +144,7 @@
|
|
|
<DictSelection
|
|
|
dictName="告警触发条件"
|
|
|
clearable
|
|
|
- v-model="scope.row.alarmCondition"
|
|
|
+ v-model="scope.row.operator"
|
|
|
>
|
|
|
</DictSelection>
|
|
|
</template>
|
|
|
@@ -149,7 +152,7 @@
|
|
|
<el-table-column label="">
|
|
|
<template slot-scope="scope">
|
|
|
<el-input
|
|
|
- v-model="scope.row.alarmValue"
|
|
|
+ v-model="scope.row.thresholdValue"
|
|
|
oninput="value=value.replace(/[^\d.]/g,'')"
|
|
|
size="small"
|
|
|
placeholder="请输入值"
|
|
|
@@ -160,13 +163,10 @@
|
|
|
<template slot-scope="scope">
|
|
|
<div class="alarm_trigger_handler">
|
|
|
<div
|
|
|
- v-if="
|
|
|
- scope.$index <
|
|
|
- baseInfoForm.alarmTriggerList.length - 1
|
|
|
- "
|
|
|
+ v-if="scope.$index < baseInfoForm.conditions.length - 1"
|
|
|
>
|
|
|
- <span v-if="baseInfoForm.alarmTrigger === 0">且</span>
|
|
|
- <span v-if="baseInfoForm.alarmTrigger === 1">或</span>
|
|
|
+ <span v-if="baseInfoForm.triggerLogic === 1">且</span>
|
|
|
+ <span v-if="baseInfoForm.triggerLogic === 2">或</span>
|
|
|
</div>
|
|
|
<el-button
|
|
|
v-if="scope.$index > 0"
|
|
|
@@ -186,35 +186,153 @@
|
|
|
>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
- <el-row>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="告警方式:">
|
|
|
- <DictSelection
|
|
|
- dictName="告警方式"
|
|
|
- clearable
|
|
|
- v-model="baseInfoForm.alarmMode"
|
|
|
- >
|
|
|
- </DictSelection>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
</el-form>
|
|
|
+
|
|
|
+ <el-button
|
|
|
+ v-if="[1, 2, 5].includes(baseInfoForm.generateDocumentType)"
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ style="margin-bottom: 10px"
|
|
|
+ @click="handleAddTab"
|
|
|
+ >添加规则</el-button
|
|
|
+ >
|
|
|
+ <div
|
|
|
+ class="el-tab_box"
|
|
|
+ v-if="[1, 2, 5].includes(baseInfoForm.generateDocumentType)"
|
|
|
+ >
|
|
|
+ <div class="ruleMatters_box">
|
|
|
+ <header-title title="规则事项">
|
|
|
+ <div>
|
|
|
+ <el-button
|
|
|
+ size="small"
|
|
|
+ icon="el-icon-plus"
|
|
|
+ class="ele-btn-icon"
|
|
|
+ type="primary"
|
|
|
+ @click="addPostscript"
|
|
|
+ >新增</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </header-title>
|
|
|
+ <el-table :data="baseInfoForm.workItems" border>
|
|
|
+ <el-table-column label="序号" width="50">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ scope.$index + 1 }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="零部件编码"
|
|
|
+ prop="categoryCode"
|
|
|
+ width="100"
|
|
|
+ >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div>
|
|
|
+ <el-input
|
|
|
+ v-model="scope.row.categoryCode"
|
|
|
+ placeholder="请输入零部件编码"
|
|
|
+ ></el-input>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="零部件名称"
|
|
|
+ prop="categoryName"
|
|
|
+ width="100"
|
|
|
+ >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div>
|
|
|
+ <el-input
|
|
|
+ v-model="scope.row.categoryName"
|
|
|
+ placeholder="请输入零部件名称"
|
|
|
+ ></el-input>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="事项" prop="name" width="100">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div>
|
|
|
+ <el-input
|
|
|
+ v-model="scope.row.name"
|
|
|
+ placeholder="请输入内容"
|
|
|
+ ></el-input>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="内容" prop="content" width="200">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div>
|
|
|
+ <el-input
|
|
|
+ v-model="scope.row.content"
|
|
|
+ placeholder="请输入内容"
|
|
|
+ ></el-input>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作指导" prop="operationGuide">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div
|
|
|
+ class="operationGuide_box"
|
|
|
+ @click="
|
|
|
+ openOperationGuideDialogDialog(
|
|
|
+ scope.row.operationGuide,
|
|
|
+ scope.$index
|
|
|
+ )
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <div class="left_content">
|
|
|
+ <template v-if="scope.row.operationGuide">
|
|
|
+ <div
|
|
|
+ v-for="(item, index) in scope.row.operationGuide
|
|
|
+ .toolList"
|
|
|
+ :key="item.id"
|
|
|
+ >{{ index + 1 }}.{{ item.name }}</div
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
+ <div class="right_content">
|
|
|
+ <template v-if="scope.row.operationGuide">
|
|
|
+ <div
|
|
|
+ v-for="(item, index) in scope.row.operationGuide
|
|
|
+ .procedureList"
|
|
|
+ :key="item.id"
|
|
|
+ >{{ index + 1 }}.{{ item.content }}</div
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="标准" prop="norm" width="100">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div>
|
|
|
+ <el-input
|
|
|
+ v-model="scope.row.norm"
|
|
|
+ placeholder="请输入内容"
|
|
|
+ ></el-input>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" width="100">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button type="text" @click="deleteItem(scope.$index)"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</el-tab-pane>
|
|
|
- <el-tab-pane label="短信设置" name="shortMessage" disabled
|
|
|
+ <!-- <el-tab-pane label="短信设置" name="shortMessage" disabled
|
|
|
>短信设置</el-tab-pane
|
|
|
>
|
|
|
- <el-tab-pane label="邮箱设置" name="email" disabled>邮箱设置</el-tab-pane>
|
|
|
+ <el-tab-pane label="邮箱设置" name="email" disabled>邮箱设置</el-tab-pane> -->
|
|
|
<el-tab-pane label="通知设置" name="notice">
|
|
|
<div class="add_notice_table_row">
|
|
|
<el-button type="primary" size="small" @click="handleAddNoticeRow"
|
|
|
>添加</el-button
|
|
|
>
|
|
|
</div>
|
|
|
- <el-table
|
|
|
- :data="baseInfoForm.alarmNoticeSetList"
|
|
|
- style="width: 100%"
|
|
|
- border
|
|
|
- >
|
|
|
+ <el-table :data="baseInfoForm.notices" style="width: 100%" border>
|
|
|
<el-table-column label="" align="center" width="60">
|
|
|
<template slot-scope="scope">
|
|
|
<span>{{ scope.$index + 1 }}</span>
|
|
|
@@ -224,7 +342,7 @@
|
|
|
<template slot-scope="scope">
|
|
|
<el-select
|
|
|
filterable
|
|
|
- v-model="scope.row.alarmNotifierId"
|
|
|
+ v-model="scope.row.receiverIds"
|
|
|
size="small"
|
|
|
>
|
|
|
<el-option
|
|
|
@@ -232,11 +350,12 @@
|
|
|
:key="item.id"
|
|
|
:value="item.id"
|
|
|
:label="item.name"
|
|
|
+ @click.native="receiver(item, scope.$index)"
|
|
|
></el-option>
|
|
|
</el-select>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="手机号码" align="center">
|
|
|
+ <!-- <el-table-column label="手机号码" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<el-input
|
|
|
v-model="scope.row.alarmNotifierPhone"
|
|
|
@@ -245,8 +364,8 @@
|
|
|
@blur="checkPhone(scope.$index, scope.row.alarmNotifierPhone)"
|
|
|
></el-input>
|
|
|
</template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="邮箱" align="center">
|
|
|
+ </el-table-column> -->
|
|
|
+ <!-- <el-table-column label="邮箱" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<el-input
|
|
|
v-model="scope.row.alarmNotifierMailbox"
|
|
|
@@ -255,14 +374,14 @@
|
|
|
@blur="checkMailbox(scope.$index, scope.row.mailbox)"
|
|
|
></el-input>
|
|
|
</template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="通知方式" width="260px" align="center">
|
|
|
+ </el-table-column> -->
|
|
|
+ <!-- <el-table-column label="通知方式" width="260px" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<el-checkbox v-model="scope.row.shortMessage">短信</el-checkbox>
|
|
|
<el-checkbox v-model="scope.row.mail">邮件</el-checkbox>
|
|
|
<el-checkbox v-model="scope.row.system">系统</el-checkbox>
|
|
|
</template>
|
|
|
- </el-table-column>
|
|
|
+ </el-table-column> -->
|
|
|
<el-table-column label="操作" width="70px" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<el-button
|
|
|
@@ -277,74 +396,95 @@
|
|
|
</el-tabs>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
<el-button size="small" @click="handleClose">取 消</el-button>
|
|
|
- <el-button size="small" type="primary" @click="saveWarningSetting"
|
|
|
+ <el-button size="small" type="primary" @click="saveWarningSetting" v-if="dialogType!='view'"
|
|
|
>确 定</el-button
|
|
|
>
|
|
|
</span>
|
|
|
- </el-dialog>
|
|
|
+ <MaterialAdd ref="materialAddRef" @chooseEquipment="chooseEquipment">
|
|
|
+ </MaterialAdd>
|
|
|
+
|
|
|
+ <!-- 添加规则 -->
|
|
|
+ <ele-modal
|
|
|
+ width="800px"
|
|
|
+ :visible="addDialog"
|
|
|
+ :append-to-body="true"
|
|
|
+ title="规则配置"
|
|
|
+ :close-on-click-modal="true"
|
|
|
+ :maxable="true"
|
|
|
+ >
|
|
|
+ <el-select v-model="ruleId" size="small" style="width: 100%" filterable>
|
|
|
+ <el-option
|
|
|
+ v-for="item in ruleNameList"
|
|
|
+ :key="item.id"
|
|
|
+ :value="item.id"
|
|
|
+ :label="item.code + '-' + item.name"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ <template v-slot:footer>
|
|
|
+ <el-button @click="addDialog = false">取消</el-button>
|
|
|
+ <el-button type="primary" @click="addRule"> 添加 </el-button>
|
|
|
+ </template>
|
|
|
+ </ele-modal>
|
|
|
+ </ele-modal>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import modalTitle from '@/components/modalTitle.vue';
|
|
|
- import equipmentSelect from '@/components/CommomSelect/equipment-select.vue';
|
|
|
+ import MaterialAdd from '@/views/maintenance/components/MaterialAdd.vue';
|
|
|
+ import { getDetail } from '@/api/ruleManagement/matter';
|
|
|
+ import { getRule } from '@/api/ruleManagement/plan';
|
|
|
import { getUserPage } from '@/api/system/organization';
|
|
|
+ import { getPhysicalModel } from '@/api/ledgerAssets/equipment';
|
|
|
+ import { save, update, getById } from '@/api/warning/index.js';
|
|
|
+
|
|
|
export default {
|
|
|
- components: { equipmentSelect, modalTitle },
|
|
|
- props: {
|
|
|
- equipmentList: {
|
|
|
- type: Array,
|
|
|
- default: () => {
|
|
|
- return [];
|
|
|
- }
|
|
|
- },
|
|
|
- viewForm: {
|
|
|
- type: Object,
|
|
|
- default: () => {
|
|
|
- return {};
|
|
|
- }
|
|
|
- },
|
|
|
- dialogTitle: {
|
|
|
- type: String,
|
|
|
- default: ''
|
|
|
- }
|
|
|
- },
|
|
|
+ components: { MaterialAdd },
|
|
|
+ props: {},
|
|
|
data() {
|
|
|
return {
|
|
|
- fullscreen: false,
|
|
|
addWarningDialog: false,
|
|
|
+ dialogType: 'add',
|
|
|
+ addDialog: false,
|
|
|
tabActiveName: 'baseInfo',
|
|
|
+ ruleNameList: [],
|
|
|
+ workItems: [],
|
|
|
+ ruleId: '',
|
|
|
saveLoading: false,
|
|
|
baseInfoForm: {
|
|
|
- alarmLevel: '', // 告警级别
|
|
|
- alarmEquipmentId: '', // 告警设备类型id
|
|
|
- alarmEquipmentName: '', // 告警设备类型name
|
|
|
- alarmName: '', // 告警名称
|
|
|
- status: false, // 状态
|
|
|
- isCreate: false, // 是否生成保修工单
|
|
|
- alarmDescribe: '', // 告警描述
|
|
|
- alarmTrigger: 0, // 告警触发条件类型选择
|
|
|
+ level: '', // 告警级别
|
|
|
+ deviceId: '',
|
|
|
+ deviceName: '',
|
|
|
+ deviceCode: '',
|
|
|
+
|
|
|
+ name: '', // 告警名称
|
|
|
+ generateDocumentType: null, // 是否生成保修工单
|
|
|
+ description: '', // 告警描述
|
|
|
+ triggerLogic: 1, // 告警触发条件类型选择
|
|
|
alarmMode: '', // 告警方式
|
|
|
- alarmTriggerList: [{}], // 基本信息触发条件表格
|
|
|
- alarmNoticeSetList: [
|
|
|
+ conditions: [
|
|
|
+ // {
|
|
|
+ // attributeCode: 'identifier',
|
|
|
+ // attributeName: '温度'
|
|
|
+ // }
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ ], // 基本信息触发条件表格
|
|
|
+ notices: [
|
|
|
{
|
|
|
- alarmNotifierId: '', // 告警通知人id
|
|
|
- alarmNotifierName: '', // 告警通知人name
|
|
|
- alarmNotifierMailbox: '', // 邮箱
|
|
|
- alarmNotifierPhone: '', // 电话
|
|
|
- mail: false, // 邮件
|
|
|
- shortMessage: false, // 短信
|
|
|
- system: false // 系统
|
|
|
+ receiverIds: '', // 告警通知人id
|
|
|
+ receiverName: '', // 告警通知人name
|
|
|
+ noticeTypes: '3'
|
|
|
}
|
|
|
] // 通知设置表格
|
|
|
},
|
|
|
baseInfoFormRules: {
|
|
|
- alarmLevel: [
|
|
|
+ level: [
|
|
|
{ required: true, message: '请选择告警级别', trigger: 'change' }
|
|
|
],
|
|
|
- alarmEquipmentName: [
|
|
|
- { required: true, message: '请选择告警设备类型', trigger: 'change' }
|
|
|
+ deviceName: [
|
|
|
+ { required: true, message: '请选择告警设备', trigger: 'change' }
|
|
|
],
|
|
|
- alarmName: [
|
|
|
+ name: [
|
|
|
{ required: true, message: '请输入告警名称', trigger: 'blur' }
|
|
|
],
|
|
|
alarmTrigger: [
|
|
|
@@ -355,47 +495,16 @@
|
|
|
temperatureList: []
|
|
|
};
|
|
|
},
|
|
|
- watch: {
|
|
|
- viewForm(val) {
|
|
|
- console.log('shujval', val);
|
|
|
- this.baseInfoForm = val;
|
|
|
- this.getTemperatureList(val.alarmEquipmentId);
|
|
|
- }
|
|
|
- },
|
|
|
+ watch: {},
|
|
|
methods: {
|
|
|
- getTemperatureList(val) {
|
|
|
- warningSetting.getAlarmTermType(val).then((res) => {
|
|
|
- if (res?.success) {
|
|
|
- this.temperatureList = res.data;
|
|
|
- }
|
|
|
+ async chooseEquipment(data) {
|
|
|
+ this.baseInfoForm.deviceId = data.id;
|
|
|
+ this.baseInfoForm.deviceName = data.name;
|
|
|
+ this.baseInfoForm.deviceCode = data.code;
|
|
|
+ getPhysicalModel(data.id).then((res) => {
|
|
|
+ this.temperatureList = res.properties;
|
|
|
});
|
|
|
},
|
|
|
-
|
|
|
- // 告警设备类型变更
|
|
|
- async handleEquipmentChange(val) {
|
|
|
- this.baseInfoForm.alarmEquipmentId = val;
|
|
|
- warningSetting
|
|
|
- .getAlarmTermType(this.baseInfoForm.alarmEquipmentId)
|
|
|
- .then((res) => {
|
|
|
- if (res?.success) {
|
|
|
- this.temperatureList = res.data;
|
|
|
- console.log('列表数据', this.temperatureList);
|
|
|
- this.baseInfoForm.alarmTriggerList.forEach((item) => {
|
|
|
- if (item.alarmType) {
|
|
|
- item.alarmType = '';
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- })
|
|
|
- .catch((err) => {
|
|
|
- this.temperatureList = [];
|
|
|
- this.baseInfoForm.alarmTriggerList.forEach((item) => {
|
|
|
- if (item.alarmType) {
|
|
|
- item.alarmType = '';
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- },
|
|
|
// 获取通知人列表数据
|
|
|
async getUserList() {
|
|
|
try {
|
|
|
@@ -404,7 +513,17 @@
|
|
|
this.alarmNotifierList = res.list;
|
|
|
} catch (error) {}
|
|
|
},
|
|
|
-
|
|
|
+ async isCreateChange(val) {
|
|
|
+ const res = await getRule({
|
|
|
+ status: 1,
|
|
|
+ type: val,
|
|
|
+ pageNum: 1,
|
|
|
+ size: -1
|
|
|
+ });
|
|
|
+ if (res.list) {
|
|
|
+ this.ruleNameList = res.list || [];
|
|
|
+ }
|
|
|
+ },
|
|
|
// tab栏切换
|
|
|
handleTabClick(tab) {
|
|
|
// 获取通知人下拉数据
|
|
|
@@ -412,40 +531,91 @@
|
|
|
this.getUserList();
|
|
|
}
|
|
|
},
|
|
|
+ handleAddTab() {
|
|
|
+ this.ruleId = '';
|
|
|
+ this.addDialog = true;
|
|
|
+ },
|
|
|
+ async addRule() {
|
|
|
+ const data = await getDetail(this.ruleId);
|
|
|
+ this.baseInfoForm.workItems = data.ruleItems;
|
|
|
+ this.addDialog = false;
|
|
|
+ },
|
|
|
+ /* 打开操作手册编辑款 */
|
|
|
+ openOperationGuideDialogDialog(row, index) {
|
|
|
+ if (this.dialogTitle !== '派单') {
|
|
|
+ this.$refs.operationGuideDialog.open(row, index);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ attributeChange(item, index) {
|
|
|
+ this.$set(
|
|
|
+ this.baseInfoForm.conditions[index],
|
|
|
+ 'attributeName',
|
|
|
+ item.name
|
|
|
+ );
|
|
|
+ },
|
|
|
+ receiver(item, index) {
|
|
|
+ console.log(index,'index')
|
|
|
+ this.$set(this.baseInfoForm.notices[index], 'receiverName', item.name);
|
|
|
+ },
|
|
|
+
|
|
|
+ deleteItem(index) {
|
|
|
+ if (this.baseInfoForm.workItems.length > 1) {
|
|
|
+ this.baseInfoForm.workItems.splice(index, 1);
|
|
|
+ } else {
|
|
|
+ this.$message.error('至少要有一个规则事项!');
|
|
|
+ }
|
|
|
+ },
|
|
|
+ addPostscript() {
|
|
|
+ this.baseInfoForm.workItems.push({
|
|
|
+ sort: null,
|
|
|
+ name: '',
|
|
|
+ content: '',
|
|
|
+ norm: '',
|
|
|
+ isNew: true,
|
|
|
+ operationGuide: {
|
|
|
+ procedureList: [],
|
|
|
+ toolList: []
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
// 关闭新增弹窗
|
|
|
handleClose() {
|
|
|
this.addWarningDialog = false;
|
|
|
this._resetDialogInfo();
|
|
|
},
|
|
|
+ async open(type, row) {
|
|
|
+ this.tabActiveName = 'baseInfo';
|
|
|
+ this.addWarningDialog = true;
|
|
|
+ this.dialogType = type;
|
|
|
+ if (row) {
|
|
|
+ this.baseInfoForm = await getById(row.id);
|
|
|
+ }
|
|
|
+ },
|
|
|
// 增加触发条件
|
|
|
handleAddTriggerCondition() {
|
|
|
- this.baseInfoForm.alarmTriggerList.push({});
|
|
|
+ this.baseInfoForm.conditions.push({});
|
|
|
},
|
|
|
// 删除触发条件
|
|
|
handleDeleteTriggerCondition(index) {
|
|
|
- this.baseInfoForm.alarmTriggerList.splice(index, 1);
|
|
|
+ this.baseInfoForm.conditions.splice(index, 1);
|
|
|
},
|
|
|
// 通知设置 - 添加表格一行
|
|
|
handleAddNoticeRow() {
|
|
|
- this.baseInfoForm.alarmNoticeSetList.push({
|
|
|
- alarmNotifierId: '', // 告警通知人id
|
|
|
- alarmNotifierName: '', // 告警通知人name
|
|
|
- alarmNotifierMailbox: '', // 邮箱
|
|
|
- alarmNotifierPhone: '', // 电话
|
|
|
- mail: false, // 邮件
|
|
|
- shortMessage: false, // 短信
|
|
|
- system: false // 系统
|
|
|
+ this.baseInfoForm.notices.push({
|
|
|
+ receiverIds: '', // 告警通知人id
|
|
|
+ receiverName: '', // 告警通知人name
|
|
|
+ noticeTypes: '3'
|
|
|
});
|
|
|
},
|
|
|
// 通知设置 - 删除表格一行
|
|
|
handleDeleteNoticeRow(index) {
|
|
|
- this.baseInfoForm.alarmNoticeSetList.splice(index, 1);
|
|
|
+ this.baseInfoForm.notices.splice(index, 1);
|
|
|
},
|
|
|
// 验证手机号
|
|
|
checkPhone(index, phone) {
|
|
|
const phoneReg = /^1[345789]\d{9}$/;
|
|
|
if (phone && !phoneReg.test(phone)) {
|
|
|
- this.baseInfoForm.alarmNoticeSetList[index].alarmNotifierPhone = '';
|
|
|
+ this.baseInfoForm.notices[index].alarmNotifierPhone = '';
|
|
|
return this.$message.error('手机号码格式错误,请重新输入!');
|
|
|
}
|
|
|
},
|
|
|
@@ -453,53 +623,44 @@
|
|
|
checkMailbox(index, mailbox) {
|
|
|
const mailReg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
|
|
|
if (mailbox && !mailReg.test(mailbox)) {
|
|
|
- this.baseInfoForm.alarmNoticeSetList[index].alarmNotifierMailbox = '';
|
|
|
+ this.baseInfoForm.notices[index].alarmNotifierMailbox = '';
|
|
|
return this.$message.error('邮箱格式错误,请重新输入!');
|
|
|
}
|
|
|
},
|
|
|
+
|
|
|
// 保存
|
|
|
async saveWarningSetting() {
|
|
|
this.$refs.baseInfoFormRef.validate(async (valid) => {
|
|
|
- if (valid) {
|
|
|
- try {
|
|
|
- this.saveLoading = true;
|
|
|
- const res = await warningSetting.saveWarningSetting(
|
|
|
- this.baseInfoForm
|
|
|
- );
|
|
|
- // console.log('新增告警结果:', res)
|
|
|
- this.addWarningDialog = false;
|
|
|
- this._resetDialogInfo();
|
|
|
- this.saveLoading = false;
|
|
|
- this.$emit('refreshList');
|
|
|
- this.$message.success('新增成功!');
|
|
|
- } catch (error) {
|
|
|
- this.saveLoading = false;
|
|
|
- }
|
|
|
- }
|
|
|
+ this.saveLoading = true;
|
|
|
+ let api=this.baseInfoForm.id?update:save
|
|
|
+ api(this.baseInfoForm).then((res) => {
|
|
|
+ this._resetDialogInfo();
|
|
|
+ this.saveLoading = false;
|
|
|
+ this.addWarningDialog = false;
|
|
|
+ this.$emit('refreshList');
|
|
|
+ this.$message.success('操作成功!');
|
|
|
+ this.saveLoading = false;
|
|
|
+ });
|
|
|
});
|
|
|
},
|
|
|
// 重置弹窗信息
|
|
|
_resetDialogInfo() {
|
|
|
this.baseInfoForm = {
|
|
|
- alarmLevel: '', // 告警级别
|
|
|
+ level: '', // 告警级别
|
|
|
alarmEquipmentId: '', // 告警设备类型id
|
|
|
alarmEquipmentName: '', // 告警设备类型name
|
|
|
- alarmName: '', // 告警名称
|
|
|
+ name: '', // 告警名称
|
|
|
status: false, // 状态
|
|
|
- isCreate: false, // 是否生成保修工单
|
|
|
- alarmDescribe: '', // 告警描述
|
|
|
+ generateDocumentType: false, // 是否生成保修工单
|
|
|
+ description: '', // 告警描述
|
|
|
alarmTrigger: 0, // 告警触发条件类型选择
|
|
|
alarmMode: '', // 告警方式
|
|
|
- alarmTriggerList: [{}], // 基本信息触发条件表格
|
|
|
- alarmNoticeSetList: [
|
|
|
+ conditions: [{}], // 基本信息触发条件表格
|
|
|
+ notices: [
|
|
|
{
|
|
|
- alarmNotifierId: '', // 告警通知人id
|
|
|
- alarmNotifierName: '', // 告警通知人name
|
|
|
- alarmNotifierMailbox: '', // 邮箱
|
|
|
- alarmNotifierPhone: '', // 电话
|
|
|
- mail: false, // 邮件
|
|
|
- shortMessage: false, // 短信
|
|
|
- system: false // 系统
|
|
|
+ receiverIds: '', // 告警通知人id
|
|
|
+ receiverName: '', // 告警通知人name
|
|
|
+ noticeTypes: '3'
|
|
|
}
|
|
|
] // 通知设置表格
|
|
|
};
|
|
|
@@ -511,11 +672,6 @@
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
- ::v-deep .el-dialog__headerbtn .el-dialog__close {
|
|
|
- color: #fff;
|
|
|
- font-weight: 700;
|
|
|
- font-size: 20px;
|
|
|
- }
|
|
|
.table_wrapper {
|
|
|
padding-left: 120px;
|
|
|
padding-right: 8vw;
|