|
|
@@ -4,14 +4,8 @@
|
|
|
<el-col :span="24" :xs="24">
|
|
|
<div class="main-right-box">
|
|
|
<div class="main-search-box">
|
|
|
- <el-form
|
|
|
- :model="queryParams"
|
|
|
- ref="queryForm"
|
|
|
- size="small"
|
|
|
- :inline="true"
|
|
|
- v-show="showSearch"
|
|
|
- >
|
|
|
- <el-form-item label="规则类型" prop="taskName">
|
|
|
+ <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
|
|
|
+ <!-- <el-form-item label="规则类型" prop="taskName">
|
|
|
<el-select
|
|
|
v-model="queryParams.taskName"
|
|
|
clearable
|
|
|
@@ -28,108 +22,68 @@
|
|
|
>
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
- </el-form-item>
|
|
|
+ </el-form-item> -->
|
|
|
|
|
|
- <el-form-item label="规则名称" prop="taskName">
|
|
|
- <el-input queryParams.taskName> </el-input>
|
|
|
+ <el-form-item label="规则名称" prop="ruleName">
|
|
|
+ <el-input v-model="queryParams.ruleName"> </el-input>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
|
|
|
<el-row :gutter="10">
|
|
|
<el-col :span="1.5">
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- icon="el-icon-search"
|
|
|
- size="mini"
|
|
|
- @click="handleQuery"
|
|
|
- >搜索
|
|
|
+ <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索
|
|
|
</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- icon="el-icon-refresh"
|
|
|
- size="mini"
|
|
|
- @click="resetQuery"
|
|
|
- >重置
|
|
|
+ <el-button type="primary" icon="el-icon-refresh" size="mini" @click="resetQuery">重置
|
|
|
</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
- <el-button type="primary" size="mini" @click="addRuleHandler"
|
|
|
- >新增规则
|
|
|
+ <el-button type="primary" size="mini" icon="el-icon-edit-outline" @click="addRuleHandler">新增规则
|
|
|
</el-button>
|
|
|
</el-col>
|
|
|
- <right-toolbar
|
|
|
- :showSearch.sync="showSearch"
|
|
|
- @queryTable="getList"
|
|
|
- ></right-toolbar>
|
|
|
+ <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
</el-row>
|
|
|
</div>
|
|
|
- <el-table
|
|
|
- :data="alarmRules"
|
|
|
- border
|
|
|
- v-loading="loading"
|
|
|
- height="600"
|
|
|
- size="small"
|
|
|
- >
|
|
|
+ <el-table :data="alarmRules" border v-loading="loading" height="600" size="small">
|
|
|
<el-table-column type="expand">
|
|
|
- <template slot-scope="props"
|
|
|
- ><el-table
|
|
|
- :data="tableData"
|
|
|
- class="sonTable"
|
|
|
- border
|
|
|
- style="width: 90%"
|
|
|
- >
|
|
|
- <el-table-column prop="date" label="设备类型" width="180">
|
|
|
+ <template slot-scope="props">
|
|
|
+ <el-table :data="props.row.ruleItems" class="sonTable" border style="width: 90%">
|
|
|
+ <el-table-column prop="sourceName" label="设备类型" width="180">
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="name" label="作用时间" >
|
|
|
+ <el-table-column prop="name" label="作用时间">
|
|
|
+ <template slot-scope="ruleItem">
|
|
|
+ <span>{{weekDayDic[ruleItem.row.weekDay+""]}} {{ruleItem.row.startTime}}--{{ruleItem.row.endTime}} </span>
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="address"
|
|
|
- label="熟悉名称--限定符--作用值"
|
|
|
- >
|
|
|
+ <el-table-column prop="description" label="熟悉名称--限定符--作用值">
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="名称" prop="iotAlarmRule.name"> </el-table-column>
|
|
|
- <el-table-column label="类型" prop="iotAlarmRule.type"> </el-table-column>
|
|
|
- <el-table-column label="启用" prop="iotAlarmRule.enabled"> </el-table-column>
|
|
|
+ <el-table-column label="类型" prop="iotAlarmRule.type">
|
|
|
+ <template slot-scope="item">
|
|
|
+ <span>{{ item.row.iotAlarmRule.type == "alarm" ? "报警" : "未知" }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="启用" prop="iotAlarmRule.enabled">
|
|
|
+ <template slot-scope="item">
|
|
|
+ <span>{{ item.row.iotAlarmRule.enabled == 1 ? "启用" : "禁用" }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="描述" prop="iotAlarmRule.remark"> </el-table-column>
|
|
|
|
|
|
<el-table-column label="设备数" prop="wlzt"> </el-table-column>
|
|
|
- <el-table-column
|
|
|
- label="操作"
|
|
|
- fixed="right"
|
|
|
- style="width: 100px"
|
|
|
- align="center"
|
|
|
- class-name="small-padding fixed-width"
|
|
|
- >
|
|
|
+ <el-table-column label="操作" fixed="right" style="width: 100px" align="center"
|
|
|
+ class-name="small-padding fixed-width">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-button
|
|
|
- size="mini"
|
|
|
- type="text"
|
|
|
- icon="el-icon-view"
|
|
|
- @click="editRuleHandler(scope.row)"
|
|
|
- v-hasPermi="['core:task:query']"
|
|
|
- >编辑</el-button
|
|
|
- >
|
|
|
- <el-button
|
|
|
- size="mini"
|
|
|
- type="text"
|
|
|
- icon="el-icon-view"
|
|
|
- @click="lookView(scope.row)"
|
|
|
- v-hasPermi="['core:task:query']"
|
|
|
- >删除</el-button
|
|
|
- >
|
|
|
- <el-button
|
|
|
- size="mini"
|
|
|
- type="text"
|
|
|
- icon="el-icon-view"
|
|
|
- @click="lookView(scope.row)"
|
|
|
- v-hasPermi="['core:task:query']"
|
|
|
- >关联设备</el-button
|
|
|
- >
|
|
|
+ <el-button size="mini" type="text" icon="el-icon-edit" @click="editRuleHandler(scope.row)"
|
|
|
+ v-hasPermi="['core:task:query']">编辑</el-button>
|
|
|
+ <el-button size="mini" type="text" icon="el-icon-delete" @click="deleteRule(scope.row)"
|
|
|
+ v-hasPermi="['core:task:query']">删除</el-button>
|
|
|
+ <el-button size="mini" type="text" icon="el-icon-view" @click="lookView(scope.row)"
|
|
|
+ v-hasPermi="['core:task:query']">关联设备</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
@@ -137,13 +91,8 @@
|
|
|
<dialog-info ref="infoDialog" @success="getList()"></dialog-info>
|
|
|
<!-- 关联设备 -->
|
|
|
<relevanceDialog ref="relevanceDialog"> </relevanceDialog>
|
|
|
- <pagination
|
|
|
- v-show="total > 0"
|
|
|
- :total="total"
|
|
|
- :page.sync="queryParams.pageNum"
|
|
|
- :limit.sync="queryParams.pageSize"
|
|
|
- @pagination="getList"
|
|
|
- />
|
|
|
+ <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
|
|
|
+ :limit.sync="queryParams.pageSize" @pagination="getList" />
|
|
|
</div>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
@@ -158,7 +107,6 @@ import { listPlanRole } from "@/api/core/edu/plan";
|
|
|
import { formatTime } from "@/utils/ruoyi";
|
|
|
import DataRangePicker from "@/components/dateTime/daterange.picker.vue";
|
|
|
import relevanceDialog from "@/views/warnRule/relevanceDialog.vue";
|
|
|
-import dayjs from "dayjs";
|
|
|
import { mapGetters } from "vuex";
|
|
|
import * as iotApi from "@/api/iot/alarmRule.js";
|
|
|
|
|
|
@@ -171,144 +119,121 @@ export default {
|
|
|
return {
|
|
|
// 遮罩层
|
|
|
loading: false,
|
|
|
- // 选中数组
|
|
|
- ids: [],
|
|
|
- // 非单个停用
|
|
|
- single: true,
|
|
|
- // 非多个停用
|
|
|
- multiple: true,
|
|
|
// 显示搜索条件
|
|
|
showSearch: true,
|
|
|
// 总条数
|
|
|
total: 1,
|
|
|
- tableData: [
|
|
|
- {
|
|
|
- date: "水浸",
|
|
|
- name: "周一、周二、周三、周四、周五、周六、周七 00:00~24:00",
|
|
|
- address: "水浸状态---等于---告警",
|
|
|
- },
|
|
|
- ],
|
|
|
- // 监控调阅任务表格数据
|
|
|
- taskList: [
|
|
|
- {
|
|
|
- taskName: "上班",
|
|
|
- sbmc: "上班一键巡检",
|
|
|
- pp: "启用",
|
|
|
- ip: "暂无描述",
|
|
|
- wlzt: "水浸(全部)",
|
|
|
- },
|
|
|
- ],
|
|
|
- // 弹出层标题
|
|
|
- title: "",
|
|
|
- // 是否显示弹出层
|
|
|
- open: false,
|
|
|
// 查询参数
|
|
|
queryParams: {
|
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
|
- taskName: null,
|
|
|
- cycle: null,
|
|
|
- dateRange: [],
|
|
|
- planStartTime: null,
|
|
|
- status: null,
|
|
|
- roleId: null,
|
|
|
- checkSub: true,
|
|
|
+ ruleName: "",
|
|
|
},
|
|
|
- selectedOrgName: "",
|
|
|
- // 表单参数
|
|
|
- form: {},
|
|
|
- // 表单校验
|
|
|
- rules: {},
|
|
|
-
|
|
|
- alarmRules:[],
|
|
|
-
|
|
|
- orgName: "",
|
|
|
+ alarmRules: [],
|
|
|
+ weekDayDic:{
|
|
|
+ "1":"周一",
|
|
|
+ "2":"周二",
|
|
|
+ "3":"周三",
|
|
|
+ "4":"周四",
|
|
|
+ "5":"周五",
|
|
|
+ "6":"周六",
|
|
|
+ "7":"周日",
|
|
|
+ }
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
- this.queryParams.orgId = this.$store.getters.orgId;
|
|
|
this.getList();
|
|
|
},
|
|
|
computed: {
|
|
|
- ...mapGetters(["orgId", "orgName"]),
|
|
|
+
|
|
|
},
|
|
|
methods: {
|
|
|
/** 查询监控调阅任务列表 */
|
|
|
async getList() {
|
|
|
+ this.loading = true;
|
|
|
|
|
|
- let rh = await iotApi.getAlarmRules();
|
|
|
- if(rh.code != 200)
|
|
|
- {
|
|
|
+ let rh = await iotApi.getAlarmRules("alarm", this.queryParams.ruleName, this.queryParams.pageNum, this.queryParams.pageSize);
|
|
|
+ if (rh.code != 200) {
|
|
|
this.$message("获取数据失败");
|
|
|
+ this.loading = false;
|
|
|
return;
|
|
|
}
|
|
|
- this.alarmRules = rh.data;
|
|
|
- console.log(rh.data);
|
|
|
+ this.total = rh.total;
|
|
|
+ this.alarmRules = rh.rows;
|
|
|
|
|
|
- // this.taskList = [
|
|
|
- // {
|
|
|
- // taskName: "上班",
|
|
|
- // sbmc: "上班一键巡检",
|
|
|
- // pp: "启用",
|
|
|
- // ip: "暂无描述",
|
|
|
- // wlzt: "水浸(全部)",
|
|
|
- // },
|
|
|
- // {
|
|
|
- // taskName: "上班",
|
|
|
- // sbmc: "上班一键巡检",
|
|
|
- // pp: "启用",
|
|
|
- // ip: "暂无描述",
|
|
|
- // wlzt: "水浸(全部)",
|
|
|
- // },
|
|
|
- // ];
|
|
|
- return;
|
|
|
- this.loading = true;
|
|
|
- listTask(this.queryParams).then((response) => {
|
|
|
- this.taskList = response.rows;
|
|
|
- this.total = response.total;
|
|
|
- this.loading = false;
|
|
|
- });
|
|
|
- },
|
|
|
+ this.alarmRules.forEach(alarmRule => {
|
|
|
+ if (alarmRule.iotAlarmRuleExpressEditVosBySourceType != undefined) {
|
|
|
|
|
|
- /** 下穿状态改变*/
|
|
|
- changeCheckBox() {
|
|
|
- this.getList();
|
|
|
- },
|
|
|
- // 取消按钮
|
|
|
- cancel() {
|
|
|
- this.open = false;
|
|
|
- this.reset();
|
|
|
+ alarmRule.ruleItems = [];
|
|
|
+ let operationDic = {
|
|
|
+ 'GT': '大于--${arg1}',
|
|
|
+ 'LT': "小于--${arg1}",
|
|
|
+ "GTE": "大于等于--${arg1}",
|
|
|
+ "LTE": "小于等于--${arg1}",
|
|
|
+ "EQUALS": "等于--${arg1}",
|
|
|
+ "STARTS_WITH": "以 ${arg1} 开始",
|
|
|
+ "ENDS_WITH": "以 ${arg1} 结束",
|
|
|
+ "CONTAIN": "包含--${arg1}",
|
|
|
+ }
|
|
|
+ let sourceTypeDics = this.ConvertToSourceTypeDics(alarmRule.sourceTypeList);
|
|
|
+
|
|
|
+ let ruleGroups = alarmRule.iotAlarmRuleExpressEditVosBySourceType;
|
|
|
+ ruleGroups.forEach(ruleGroup => {
|
|
|
+
|
|
|
+ ruleGroup.appAlarmRuleExpressList.forEach(ruleItem => {
|
|
|
+ ruleItem.sourceName = "";
|
|
|
+ ruleItem.fieldName = "";
|
|
|
+ if (sourceTypeDics[ruleGroup.sourceType + ""] != undefined) {
|
|
|
+ let sourceTypeDicItem = sourceTypeDics[ruleGroup.sourceType + ""];
|
|
|
+ ruleItem.sourceName = sourceTypeDicItem.sourceTypeDes;
|
|
|
+
|
|
|
+ if (sourceTypeDicItem.systemFieldDic[`${ruleItem.sourceType}_${ruleItem.fieldcode}`] != undefined) {
|
|
|
+ ruleItem.fieldName = sourceTypeDicItem.systemFieldDic[`${ruleItem.sourceType}_${ruleItem.fieldcode}`].name
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ruleItem.description = `${ruleItem.fieldName}--${operationDic[ruleItem.operator] == undefined ? "" : operationDic[ruleItem.operator].replace("${arg1}", ruleItem.valueText)}`
|
|
|
+ alarmRule.ruleItems.push(ruleItem)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ console.log(this.alarmRules);
|
|
|
+ this.loading = false;
|
|
|
},
|
|
|
- // 表单重置
|
|
|
- reset() {
|
|
|
- this.form = {
|
|
|
- id: null,
|
|
|
- planId: null,
|
|
|
- taskName: null,
|
|
|
- orgId: null,
|
|
|
- orgPath: null,
|
|
|
- orgName: null,
|
|
|
- ymdDate: null,
|
|
|
- ymdYear: null,
|
|
|
- ymdHalfyear: null,
|
|
|
- ymdQuarter: null,
|
|
|
- ymdMonth: null,
|
|
|
- ymdWeek: null,
|
|
|
- ymdDay: null,
|
|
|
- cycle: null,
|
|
|
- planStartTime: null,
|
|
|
- planEndTime: null,
|
|
|
- startTime: null,
|
|
|
- endTime: null,
|
|
|
- status: null,
|
|
|
- roleId: null,
|
|
|
- retrievalUser: null,
|
|
|
- orderNum: null,
|
|
|
- batchNum: null,
|
|
|
- submitTime: null,
|
|
|
- exceptionCount: null,
|
|
|
- };
|
|
|
- this.resetForm("form");
|
|
|
+ ConvertToSourceTypeDics(sourceTypeList) {
|
|
|
+ let sourceTypeDics = {};
|
|
|
+ sourceTypeList.forEach(i => {
|
|
|
+ if (sourceTypeDics[i.sourceType + ""] == undefined) {
|
|
|
+ i.operatorsListDic = {};
|
|
|
+ i.specsListDic = {};
|
|
|
+ i.systemFieldDic = {};
|
|
|
+ sourceTypeDics[i.sourceType + ""] = i;
|
|
|
+ i.systemFields.forEach(systemFieldItem => {
|
|
|
+ let systemFieldItemKey = `${i.sourceType}_${systemFieldItem.sysFieldCode}`;
|
|
|
+
|
|
|
+ if (i.systemFieldDic[systemFieldItemKey] == undefined) {
|
|
|
+ i.systemFieldDic[systemFieldItemKey] = systemFieldItem;
|
|
|
+ }
|
|
|
+
|
|
|
+ systemFieldItem.operatorsList.forEach(operator => {
|
|
|
+ let operatorKey = `${i.sourceType}_${systemFieldItem.sysFieldCode}_${operator.key}`;
|
|
|
+ if (i.operatorsListDic[operatorKey] == undefined) {
|
|
|
+ i.operatorsListDic[operatorKey] = operator;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ systemFieldItem.specsList.forEach(specItem => {
|
|
|
+ let sysFieldValueKey = `${i.sourceType}_${systemFieldItem.sysFieldCode}_${specItem.key}`;
|
|
|
+ if (i.specsListDic[sysFieldValueKey] == undefined) {
|
|
|
+ i.specsListDic[sysFieldValueKey] = specItem;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return sourceTypeDics;
|
|
|
+
|
|
|
},
|
|
|
/** 搜索按钮操作 */
|
|
|
handleQuery() {
|
|
|
@@ -319,51 +244,36 @@ export default {
|
|
|
/** 重置按钮操作 */
|
|
|
resetQuery() {
|
|
|
this.resetForm("queryForm");
|
|
|
- this.queryParams.orgId = this.orgId;
|
|
|
- this.selectedOrgName = this.orgName;
|
|
|
- this.queryParams.checkSub = true;
|
|
|
- this.queryParams.dateRange = ["", ""];
|
|
|
- this.queryParams.planStartTime = null;
|
|
|
-
|
|
|
+ this.queryParams.ruleName = ""
|
|
|
this.handleQuery();
|
|
|
},
|
|
|
+ //显示添加报警规则
|
|
|
addRuleHandler() {
|
|
|
this.$refs["infoDialog"].show(true, {});
|
|
|
},
|
|
|
- editRuleHandler(ruleObj)
|
|
|
- {
|
|
|
+ //编辑报警规则
|
|
|
+ editRuleHandler(ruleObj) {
|
|
|
this.$refs["infoDialog"].show(false, ruleObj);
|
|
|
},
|
|
|
- // 多选框选中数据
|
|
|
- handleSelectionChange(selection) {
|
|
|
- this.ids = selection.map((item) => item.id);
|
|
|
- this.single = selection.length !== 1;
|
|
|
- this.multiple = !selection.length;
|
|
|
- },
|
|
|
- /** 新增按钮操作 */
|
|
|
- handleAdd() {
|
|
|
- this.reset();
|
|
|
- this.open = true;
|
|
|
- this.title = "添加监控调阅任务";
|
|
|
+ deleteRule(ruleObj)
|
|
|
+ {
|
|
|
+ this.$confirm("你确认要删除此规则吗?","提示",{type:'warning'}).then(async ()=>{
|
|
|
+ let rh = await iotApi.deleteRuld(ruleObj.iotAlarmRule.id);
|
|
|
+ if(rh.code !=200)
|
|
|
+ {
|
|
|
+ this.$message.error("删除失败");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.$message({message:"删除成功",type:"success"});
|
|
|
+ this.getList();
|
|
|
+ }).cache(()=>{
|
|
|
+
|
|
|
+ })
|
|
|
},
|
|
|
/** 关联按钮操作 */
|
|
|
lookView() {
|
|
|
this.$refs["relevanceDialog"].show("row.id", {});
|
|
|
},
|
|
|
-
|
|
|
- /** 导出按钮操作 */
|
|
|
- // handleExport() {
|
|
|
- // console.log(this);
|
|
|
- // this.download(
|
|
|
- // "core/retrievalTask/export",
|
|
|
- // {
|
|
|
- // ...this.queryParams,
|
|
|
- // },
|
|
|
- // `${
|
|
|
- // this.selectedOrgName
|
|
|
- // }-${this.$tab.getCurrentTabName()}-${dayjs().format("YYYYMMDD")}.xlsx`
|
|
|
- // );
|
|
|
- // },
|
|
|
},
|
|
|
};
|
|
|
</script>
|