|
@@ -1,5 +1,274 @@
|
|
|
<template>
|
|
|
- <div>告警管理</div>
|
|
|
+ <div class="deviceWarn">
|
|
|
+ <div class="list no-scrollbar" v-if="!showDialog">
|
|
|
+ <dmp-newsearch :normal="normal" :query="mixins_query" @search="queryList" @reset="resetSearch">
|
|
|
+ <template slot="alarmCategory">
|
|
|
+ <div class="radio_button">
|
|
|
+ <el-radio-group v-model="mixins_query.alarmCategory" @change="changeRadio()" class="zz-tab-button">
|
|
|
+ <el-radio-button label="1">告警</el-radio-button>
|
|
|
+ <el-radio-button label="2">离线</el-radio-button>
|
|
|
+ </el-radio-group>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <el-input slot="alarmName" placeholder="告警名称" v-model="mixins_query.alarmName" clearable></el-input>
|
|
|
+ <div class="opt" slot="right-opt">
|
|
|
+ <el-tooltip placement="bottom" class="item" effect="light" content="添加">
|
|
|
+ <!-- <img src="@assets/img/menuicon/btn_tianjia.png" class="tab_head-right" @click="addEdit('add')" /> -->
|
|
|
+ <img class="tab_head-right" @click="addEdit('add')" />
|
|
|
+ </el-tooltip>
|
|
|
+ </div>
|
|
|
+ </dmp-newsearch>
|
|
|
+ <div class="device-manage-table">
|
|
|
+ <zz-table
|
|
|
+ :settings="{ showCheckbox: false, showIndex: true, stripe: true }"
|
|
|
+ :cols="cols"
|
|
|
+ :data="mixins_list"
|
|
|
+ :loading="mixins_onQuery"
|
|
|
+ :pageset="mixins_pageset"
|
|
|
+ @page-change="pageChange"
|
|
|
+ @selection-change="selectionChange"
|
|
|
+ >
|
|
|
+ <template slot-scope="scope" slot="enabled">
|
|
|
+ <p>
|
|
|
+ {{ scope.row.enabled ? '启用' : '禁用' }}
|
|
|
+ </p>
|
|
|
+ </template>
|
|
|
+ <template slot-scope="scope" slot="opt">
|
|
|
+ <div class="opt">
|
|
|
+ <el-tooltip class="item" effect="light" placement="bottom" :content="scope.row.enabled ? '启用' : '禁用'">
|
|
|
+ <img
|
|
|
+ v-if="!scope.row.enabled"
|
|
|
+ src="@assets/img/menuicon/icon_jinyong.png"
|
|
|
+ height="16"
|
|
|
+ @click="enabledStatus(scope.row)"
|
|
|
+ />
|
|
|
+ <img v-else src="@assets/img/menuicon/icon_lock.png" height="16" @click="enabledStatus(scope.row)" />
|
|
|
+ </el-tooltip>
|
|
|
+ <el-tooltip class="item" effect="light" placement="bottom" content="编辑">
|
|
|
+ <img src="@assets/img/menuicon/icon_bianji.png" height="16" @click="addEdit('edit', scope.row)" />
|
|
|
+ </el-tooltip>
|
|
|
+ <el-tooltip class="item" effect="light" placement="bottom" content="删除">
|
|
|
+ <img src="@assets/img/menuicon/icon_delete.png" height="16" @click="delRow(scope.row)" />
|
|
|
+ </el-tooltip>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </zz-table>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
<script>
|
|
|
-</script>
|
|
|
+import list from '@utils/list';
|
|
|
+import { sysQuery, sysColumnConfig, sysSearchConfig } from './newbasedata.js';
|
|
|
+export default {
|
|
|
+ components: {
|
|
|
+ // detail
|
|
|
+ },
|
|
|
+ mixins: [list],
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ normal: [],
|
|
|
+ more: [],
|
|
|
+ cols: [],
|
|
|
+ deviceOptions: [],
|
|
|
+ productOptions: [],
|
|
|
+ isWaterMeter: false,
|
|
|
+ alarmTypeIds: [],
|
|
|
+ times: [],
|
|
|
+ pickerOptions: {
|
|
|
+ disabledDate(val) {
|
|
|
+ return +new Date(val) > +new Date();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ updateFlag: false,
|
|
|
+ showDialog: false,
|
|
|
+ scenetypeList: [],
|
|
|
+ defaultProps: {
|
|
|
+ value: 'id', // 唯一标识
|
|
|
+ label: 'sceneId', // 标签显示
|
|
|
+ children: 'children' // 子级
|
|
|
+ }
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {},
|
|
|
+ methods: {
|
|
|
+ getDeviceOptions() {
|
|
|
+ this.$http.post('/device/selectList', {}).then(({ data }) => {
|
|
|
+ this.deviceOptions = data;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getProductOptions() {
|
|
|
+ this.$http.postForm('/devicetype/selectList', { name: '' }).then((data) => {
|
|
|
+ this.productOptions = data;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ addEdit(todo, data = {}) {
|
|
|
+ new Promise((resolve) => {
|
|
|
+ let title = '添加告警';
|
|
|
+ if (todo == 'add') {
|
|
|
+ title = this.mixins_query.alarmCategory == '2' ? '添加离线规则' : '添加告警';
|
|
|
+ } else {
|
|
|
+ title = this.mixins_query.alarmCategory == '2' ? '编辑离线规则' : `编辑-${data.alarmName}`;
|
|
|
+ }
|
|
|
+ this.$store.dispatch('addPopup', {
|
|
|
+ url: '/AlarmControl/popups/addoreditalarm',
|
|
|
+ title: title,
|
|
|
+ height: '935px',
|
|
|
+ props: {
|
|
|
+ todo,
|
|
|
+ data,
|
|
|
+ deviceOptions: this.deviceOptions,
|
|
|
+ productOptions: this.productOptions,
|
|
|
+ alarmCategory: this.mixins_query.alarmCategory,
|
|
|
+ callback: resolve
|
|
|
+ },
|
|
|
+ hideFoot: todo == 'view'
|
|
|
+ });
|
|
|
+ }).then(() => {
|
|
|
+ this.mixins_search('refresh');
|
|
|
+ });
|
|
|
+ },
|
|
|
+ enabledStatus(rowinfo) {
|
|
|
+ this.$http.get(`/zoniot-rmcp-web/system/alarmType/update/enabled?id=${rowinfo.id}`).then(({ status, msg }) => {
|
|
|
+ if (status == 0) {
|
|
|
+ this.$message.success(msg);
|
|
|
+ this.mixins_search('refresh');
|
|
|
+ } else {
|
|
|
+ this.$message.error(msg);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ delRow(rowinfo) {
|
|
|
+ const { id, alarmName } = rowinfo;
|
|
|
+ this.$msgBox(`删除告警“${alarmName}”`)
|
|
|
+ .then(() => {
|
|
|
+ const $loading = this.$loading();
|
|
|
+ this.$http
|
|
|
+ .get(`/zoniot-rmcp-web/system/alarmType/delete?id=${id}`)
|
|
|
+ .then(({ status, msg }) => {
|
|
|
+ $loading.close();
|
|
|
+ if (status == 0) {
|
|
|
+ this.mixins_search('del');
|
|
|
+ this.$message.success(msg);
|
|
|
+ // this.$store.dispatch('device/getAlarmTypeList', true);
|
|
|
+ } else {
|
|
|
+ this.$message.error(msg);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ $loading.close();
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ },
|
|
|
+ //获取场景树
|
|
|
+ getAllScene() {
|
|
|
+ this.$http.get('/zoniot-water/scene/selectList').then(({ status, data, msg }) => {
|
|
|
+ if (status === 0) {
|
|
|
+ this.scenetypeList = data;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ resetSearch() {
|
|
|
+ this.times = [];
|
|
|
+ const params = JSON.parse(JSON.stringify(sysQuery.params));
|
|
|
+ this.alarmTypeIds = [];
|
|
|
+ this.mixins_query = params;
|
|
|
+ this.queryList();
|
|
|
+ },
|
|
|
+ // 查询所有站点
|
|
|
+ getAllSiteList() {
|
|
|
+ this.$http.get('/system/tenant/getList').then(({ status, data = [] }) => {
|
|
|
+ if (status === 0) {
|
|
|
+ _.each(data, (v) => {
|
|
|
+ v.children = [];
|
|
|
+ v.label = v.name;
|
|
|
+ v.value = v.id;
|
|
|
+ });
|
|
|
+ this.adminAlarmTypeOptions = data;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ siteChange(id) {
|
|
|
+ // this.getAlarmStatus(id[0]);
|
|
|
+ },
|
|
|
+ alarmTypeChange(ids) {
|
|
|
+ this.mixins_query.alarmTypeId = _.last(ids);
|
|
|
+ },
|
|
|
+ getAlarmStatus(id) {
|
|
|
+ this.$http
|
|
|
+ .get('/zoniot-rmcp-web/system/alarmType/getAlarmTypeList', {
|
|
|
+ siteId: id,
|
|
|
+ channelId: this.sysId
|
|
|
+ })
|
|
|
+ .then(({ status, msg, data = [] }) => {
|
|
|
+ if (status === 0) {
|
|
|
+ const index = _.findIndex(this.adminAlarmTypeOptions, (v) => v.id === id);
|
|
|
+ _.each(data, (v) => {
|
|
|
+ v.label = v.name;
|
|
|
+ v.value = v.id;
|
|
|
+ });
|
|
|
+ this.adminAlarmTypeOptions[index].children = data;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ queryList(type = 'search') {
|
|
|
+ this.mixins_post = 'post';
|
|
|
+ this.mixins_dataUrl = '/zoniot-rmcp-web/system/alarmType/page';
|
|
|
+ this.mixins_search(type);
|
|
|
+ },
|
|
|
+ exportExcel() {
|
|
|
+ if (this.times && this.times.length) {
|
|
|
+ this.mixins_query.startDate = `${this.times[0]}000000`;
|
|
|
+ this.mixins_query.endDate = `${this.times[1]}235959`;
|
|
|
+ } else {
|
|
|
+ this.mixins_query.startDate = '';
|
|
|
+ this.mixins_query.endDate = '';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ setConfigs() {
|
|
|
+ const alias = 'loraMeter';
|
|
|
+ // 搜索
|
|
|
+ const conditions = JSON.parse(JSON.stringify(sysSearchConfig.conditions));
|
|
|
+ let conditionsFilterConf = JSON.parse(JSON.stringify(sysSearchConfig['water'] || sysSearchConfig.other));
|
|
|
+ const allCols = JSON.parse(JSON.stringify(sysColumnConfig.cols));
|
|
|
+ let colFilterConf = [];
|
|
|
+ if (this.mixins_query.alarmCategory == '1') {
|
|
|
+ colFilterConf = JSON.parse(JSON.stringify(sysColumnConfig['done'] || sysColumnConfig.other));
|
|
|
+ } else {
|
|
|
+ colFilterConf = JSON.parse(JSON.stringify(sysColumnConfig['undone'] || sysColumnConfig.other));
|
|
|
+ }
|
|
|
+ this.normal = _.filter(conditions, (v) => conditionsFilterConf.normal.includes(v.prop));
|
|
|
+ // 列表
|
|
|
+ this.cols.splice(0, this.cols.length);
|
|
|
+ this.cols = _.filter(allCols, (v) => colFilterConf.includes(v.prop));
|
|
|
+ },
|
|
|
+ changeRadio(val) {
|
|
|
+ let radioVal = val;
|
|
|
+ this.setConfigs();
|
|
|
+ this.queryList();
|
|
|
+ },
|
|
|
+ viewDetail(index) {
|
|
|
+ let row = this.mixins_list[index];
|
|
|
+ this.dialogParams = { data: JSON.parse(JSON.stringify(row)) };
|
|
|
+ this.showDialog = true;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {},
|
|
|
+ created() {
|
|
|
+ this.getDeviceOptions();
|
|
|
+ this.getProductOptions();
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ const params = JSON.parse(JSON.stringify(sysQuery.params));
|
|
|
+ this.mixins_query = params;
|
|
|
+ this.setConfigs();
|
|
|
+ this.queryList();
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style lang="scss" scoped>
|
|
|
+.deviceWarn {
|
|
|
+ height: 100%;
|
|
|
+}
|
|
|
+</style>
|