|
@@ -0,0 +1,199 @@
|
|
|
+<template>
|
|
|
+ <div class="main">
|
|
|
+ <div class="search">
|
|
|
+ <el-input placeholder="输入告警名称" class="search-input" clearable v-model="mixins_query.name"></el-input>
|
|
|
+ <el-select v-model="mixins_query.communityId" placeholder="请选择所属社区" clearable>
|
|
|
+ <el-option v-for="(item, index) in communityArr" :key="index" :label="item.communityName" :value="item.id"></el-option>
|
|
|
+ </el-select>
|
|
|
+
|
|
|
+ <el-select placeholder="状态" v-model="mixins_query.enable" clearable>
|
|
|
+ <el-option v-for="(item, index) in status" :key="index" :label="item.label" :value="item.status">{{
|
|
|
+ item.label
|
|
|
+ }}</el-option>
|
|
|
+ </el-select>
|
|
|
+ <el-button type="primary" placeholder="状态" class="search-btn" @click="mixins_search" icon="el-icon-search">查询 </el-button>
|
|
|
+
|
|
|
+ <div class="search-icon">
|
|
|
+ <el-tooltip class="item" effect="light" placement="bottom" content="添加水电告警设置">
|
|
|
+ <i class="zoniot_font zoniot-icon-tianjia2" @click="addOrEdit('add')"></i>
|
|
|
+ </el-tooltip>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="roles-wrap">
|
|
|
+ <zz-table
|
|
|
+ :cols="cols"
|
|
|
+ :settings="{ showIndex: true, stripe: true }"
|
|
|
+ :loading="mixins_onQuery"
|
|
|
+ :data="mixins_list"
|
|
|
+ :pageset="mixins_pageset"
|
|
|
+ @page-change="pageChange"
|
|
|
+ >
|
|
|
+ <template slot="operate" slot-scope="scope">
|
|
|
+ <span v-if="scope.row.type == 1">日用水 {{ scope.row.operate }} {{ scope.row.value }}吨</span>
|
|
|
+ <span v-else-if="scope.row.type == 2">月用水 {{ scope.row.operate }} {{ scope.row.value }}吨</span>
|
|
|
+ <span v-else-if="scope.row.type == 3">日用电 {{ scope.row.operate }} {{ scope.row.value }}度</span>
|
|
|
+ <span v-else-if="scope.row.type == 4">月用电 {{ scope.row.operate }} {{ scope.row.value }}度</span>
|
|
|
+ </template>
|
|
|
+ <template slot-scope="scope" slot="opt">
|
|
|
+ <div class="opt">
|
|
|
+ <el-tooltip effect="light" placement="bottom" content="编辑">
|
|
|
+ <i class="zoniot_font zoniot-icon-bianji" @click="addOrEdit('edit', scope.row)"></i>
|
|
|
+ </el-tooltip>
|
|
|
+ <el-tooltip effect="light" placement="bottom" content="删除">
|
|
|
+ <i class="zoniot_font zoniot-icon-shanchu redText" @click="deluserbyidFn(scope.row.id)"></i>
|
|
|
+ </el-tooltip>
|
|
|
+ <el-tooltip class="item" effect="light" placement="bottom" :content="scope.row.enable == 1 ? '禁用' : '启用'">
|
|
|
+ <i v-if="scope.row.enable == 0" class="zoniot_font zoniot-icon-jinyong1" @click="Scrap(scope.row, 1)"></i>
|
|
|
+ <i v-else class="zoniot_font zoniot-icon-qiyong1" @click="Scrap(scope.row, 0)"></i>
|
|
|
+ </el-tooltip>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </zz-table>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import list from '@utils/list.js';
|
|
|
+export default {
|
|
|
+ mixins: [list],
|
|
|
+ name: 'deviceManagement',
|
|
|
+ data() {
|
|
|
+ let _this = this;
|
|
|
+ return {
|
|
|
+ selectRow: [],
|
|
|
+ // 数据列表
|
|
|
+ status: [
|
|
|
+ {
|
|
|
+ status: 1,
|
|
|
+ label: '启用'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ status: 0,
|
|
|
+ label: '禁用'
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ cols: [
|
|
|
+ {
|
|
|
+ label: '告警名称',
|
|
|
+ prop: 'name'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '所属社区',
|
|
|
+ prop: 'communityName'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '告警规则',
|
|
|
+ prop: 'operate',
|
|
|
+ slot: 'operate'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '状态',
|
|
|
+ prop: 'enable',
|
|
|
+ format(val) {
|
|
|
+ if (val == 1) {
|
|
|
+ return '启用';
|
|
|
+ } else if (val == 0) {
|
|
|
+ return '禁用';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '操作',
|
|
|
+ prop: 'id',
|
|
|
+ slot: 'opt'
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ mixins_post: 'post',
|
|
|
+ communityArr: []
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getorgTree();
|
|
|
+ this.mixins_dataUrl = '/sc-community/alarmHydropower/page';
|
|
|
+ this.mixins_query = {};
|
|
|
+ this.mixins_search();
|
|
|
+ },
|
|
|
+ mounted() {},
|
|
|
+ methods: {
|
|
|
+ productChange(va) {
|
|
|
+ this.mixins_query.productId = _.last(va);
|
|
|
+ },
|
|
|
+ getorgTree() {
|
|
|
+ this.$http
|
|
|
+ .get('/sc-community/assets/community/list')
|
|
|
+ .then((data) => {
|
|
|
+ this.communityArr = data.data;
|
|
|
+ this.$store.commit('setAreaSelect', data.data);
|
|
|
+ })
|
|
|
+
|
|
|
+ .catch(function () {});
|
|
|
+ },
|
|
|
+ deluserbyidFn(id) {
|
|
|
+ const h = this.$createElement;
|
|
|
+ this.$msgBox(`删除`, '删除后将无法恢复,请问是否继续?')
|
|
|
+ .then(() => {
|
|
|
+ this.$http.get('/sc-community/alarmHydropower/delete', { id: id }).then(({ status, data, msg }) => {
|
|
|
+ if (0 === status) {
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '删除成功!'
|
|
|
+ });
|
|
|
+ this.mixins_search();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ },
|
|
|
+ Scrap(row, status) {
|
|
|
+ this.$msgBox(`确认提示`, `是否${status == 0 ? '确定禁用' : '启用'}告警规则?`)
|
|
|
+ .then(() => {
|
|
|
+ this.$http
|
|
|
+ .post('/sc-community/alarmHydropower/updateEnable', { id: row.id, enable: status })
|
|
|
+ .then(({ status, data, msg }) => {
|
|
|
+ if (0 === status) {
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: msg
|
|
|
+ });
|
|
|
+ this.mixins_search();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ },
|
|
|
+ addOrEdit(todo, data = {}) {
|
|
|
+ new Promise((resolve) => {
|
|
|
+ let title = '新增水电告警设置';
|
|
|
+ if (todo !== 'add') {
|
|
|
+ title = '修改水电告警设置';
|
|
|
+ }
|
|
|
+ this.$store.dispatch('addPopup', {
|
|
|
+ url: '/alarmManagement/hydropowerAlarmSetting/popups/add.vue',
|
|
|
+ width: '760px',
|
|
|
+ height: '450px',
|
|
|
+ props: {
|
|
|
+ data,
|
|
|
+ todo,
|
|
|
+ communityArr: this.communityArr,
|
|
|
+ callback: resolve
|
|
|
+ },
|
|
|
+ title: title
|
|
|
+ });
|
|
|
+ }).then(() => {
|
|
|
+ this.mixins_search();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style scoped lang='scss'>
|
|
|
+.QRImg > div {
|
|
|
+ position: absolute;
|
|
|
+ width: 100%;
|
|
|
+ bottom: 0;
|
|
|
+ text-align: center;
|
|
|
+ left: 50%;
|
|
|
+ transform: translateX(-50%);
|
|
|
+}
|
|
|
+</style>
|