AlarmMg.vue 6.41 KB
Newer Older
yaqizhang's avatar
yaqizhang committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217
<template>
  <div class="EnseList">
    <el-row class="topBar">
      <el-col>
        <div class="tagBox">
          <div class="deadtime">最后更新时间:{{alarmNumObj.statisticsTime}}</div>
          <div :class="['tagi', {active:tabIndex == null}]" @click="taggle(null)">
            当前预警总数:
            <dv-digital-flop :config="config" />
          </div>
          <div :class="['tagi','done', {active:tabIndex == 1}]" @click="taggle('1')">
            已处理预警数:
            <dv-digital-flop :config="config2" />
          </div>
          <div :class="['tagi', 'ing',{active:tabIndex == 0}]" @click="taggle('0')">
            处理中预警数:
            <dv-digital-flop :config="config3" />
          </div>
        </div>
      </el-col>
    </el-row>
    <el-table :data="tableData.pageData" stripe style="width:100%;" :loading="loading">
      <el-table-column width="50" type="index" label="序号"></el-table-column>
      <el-table-column prop="unitName" label="企业名称"></el-table-column>
      <el-table-column prop="alarmInfo" label="预警信息">
        <template slot-scope="scope">
          <font class="dg">{{scope.row.alarmInfo}}</font>
        </template>
      </el-table-column>
      <el-table-column prop="alarmTime" label="预警时间"></el-table-column>
      <el-table-column prop="handleTime" label="消除时间"></el-table-column>
      <el-table-column prop="hand_result" label="处理结果"></el-table-column>
      <el-table-column prop="handleType" label="消除类型">
        <template slot-scope="scope">
          <font v-if="scope.row.handleType == 0">
            <span class="mark none">未处理</span>
          </font>
          <font v-if="scope.row.handleType == 1">
            <span class="mark auto">自动消警</span>
          </font>
          <font v-if="scope.row.handleType == 2">
            <span class="mark handle">手动消警</span>
          </font>
        </template>
      </el-table-column>
      <el-table-column prop="category" label="设备类型"></el-table-column>
      <el-table-column prop="contacts" label="联系人"></el-table-column>
      <el-table-column prop="phone" label="联系电话"></el-table-column>
      <el-table-column prop="deviceName" label="设备名称"></el-table-column>
      <el-table-column prop="dangerGrade" label="预警等级"></el-table-column>
      <el-table-column label="操作" width="170">
        <template slot-scope="scope">
          <el-button
            type="warning"
            size="small"
            @click="handle(scope.row)"
            v-if="scope.row.handleType == 0"
          >
            <i class="el-icon-bell"></i>手动消警
          </el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      background
      layout="total,sizes, prev, pager, next, jumper"
      :total="tableData.total"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="PAGE.page"
      :page-size="PAGE.size"
    ></el-pagination>
  </div>
</template>
<script lang="ts">
import { Component, Vue, Provide } from "vue-property-decorator";
import METHOD from "@/utils/methods";
@Component({
  components: {}
})
export default class EnterprisesMg extends Vue {
  @Provide() tableData: Object = { pageData: [], total: 0 };
  @Provide() PAGE: any = { page: 1, size: 10 };
  @Provide() searchData: any = { alarmStatus: "" };
  @Provide() tabIndex: any = null;
  @Provide() loading: Boolean = false;
  @Provide() enterpriseId:string = '';
  @Provide() alarmNumObj:any = {};

  @Provide() config: any = {
    number: [100],
    style: {
      fontSize: 18,
      fill: "#ffffff"
    },
    content: "{nt}个"
  };
  @Provide() config2: any = {
    number: [100],
    style: {
      fontSize: 18,
      fill: "#ffffff"
    },
    content: "{nt}个"
  };
  @Provide() config3: any = {
    number: [100],
    style: {
      fontSize: 18,
      fill: "#ffffff"
    },
    content: "{nt}个"
  };

  getTableData() {
    let that = this,
      param = Object.assign({enterpriseId: that.enterpriseId}, that.PAGE, that.searchData);
    that.loading = true;
    METHOD.axiosPost(that, `/alarmInfo/getAlarmInfoList`, param, function(
      res: any
    ) {
      that.loading = false;
      if (res.code == 0) {
        that.tableData = res.data;
      }
    });
  }
  getNumsData() {
    let that = this;
    METHOD.axiosGet(that, `/alarmInfo/getAlarmNum?enterpriseId=${that.enterpriseId}`, function(res: any) {
      if (res.code == 0) {
        let datas = res.data;
        that.alarmNumObj = res.data;
        that.$nextTick(() => {
          that.config = {
            number: [datas.alarmTotal],
            style: {
              fontSize: 18,
              fill: "#ffffff"
            },
            content: "{nt}个"
          };
          that.config2 = {
            number: [datas.alarmDone],
            style: {
              fontSize: 18,
              fill: "#ffffff"
            },
            content: "{nt}个"
          };
          that.config3 = {
            number: [datas.alarmIng],
            style: {
              fontSize: 18,
              fill: "#ffffff"
            },
            content: "{nt}个"
          };
        });
      }
    });
  }
  searchFun() {
    this.PAGE = { page: 1, size: 10 };
    this.getTableData();
  }
  handleSizeChange(val: any) {
    this.PAGE.size = val;
    this.getTableData();
  }
  handleCurrentChange(val: any) {
    this.PAGE.page = val;
    this.getTableData();
  }
  taggle(status: string) {
    this.searchData.alarmStatus = status;
    this.getTableData();
    this.tabIndex = status;
  }
  handle(row: any) {
    let that = this;
    (that as any)
      .$confirm("确定手动消警吗?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
      .then(() => {
        METHOD.axiosGet(that, `/alarmInfo/handleAlarmInfo/${row.id}`, function(
          res: any
        ) {
          if (res.code == 0) {
            (that as any).$message({
              type: "success",
              message: "操作成功!"
            });
            that.getTableData();
          }
        });
      });
  }
  created() {
    this.enterpriseId = METHOD.enterpriseId;
    this.getTableData();
    this.getNumsData();
  }
  mounted() {}
}
</script>
<style lang="scss" scoped>
@import "@/utils/public.scss";
.dv-digital-flop {
  display: inline-block;
  width: 5em;
  height: 30px;
}
</style>