EventOperation.vue 6.47 KB
Newer Older
YazhouChen's avatar
YazhouChen 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
<template>
  <div id="main">
    <el-container>
      <el-header style="text-align: left; font-size: 10px" height = "25px" width = "auto">
        <!-- 条件查询工具栏 -->
        <el-row :gutter="20">
          <el-col :span="1.5"><label style="font-size: 10px" >发生时间:</label></el-col>
          <el-col :span="4.5">
            <el-date-picker
            v-model="queryEventTime"
            style="width: 180px"
            type="datetime"
            size="mini"
            format="yyyy-MM-dd HH:mm"
            :clearable="false"
            align="center"
            :picker-options="startDatePicker"
            @change="beginDateChange"
            placeholder="选择时间">
          </el-date-picker></el-col>
          <el-col :span="1.5"><label style="font-size: 10px" >事件类型:</label></el-col>
          <el-col :span="4.5">
            <el-select size = 'mini' v-model="queryEventType" placeholder="请选择" style="width: 180px" :clearable="true">
              <el-option
                v-for="item in optionsEventType"
                :key="item.deviceKey"
                :label="item.deviceName"
                :value="item.deviceKey">
              </el-option>
            </el-select>
          </el-col>
          <el-col :span="1.5"><label style="font-size: 10px; width: 100%" >事件发生原因:</label></el-col>
          <el-col :span="4.5">
            <el-select size = 'mini' v-model="queryCause" placeholder="请选择" style="width: 180px" :clearable="true">
              <el-option
                v-for="item in optionsCause"
                :key="item.code"
                :label="item.cause"
                :value="item.cause">
              </el-option>
            </el-select>
          </el-col>
          <el-button size='mini' icon="el-icon-search" type="primary" @click="queryEventOperationByCondition"
                     v-loading.fullscreen.lock="fullscreenLoading">查询
          </el-button>
        </el-row>
      </el-header>
      <!-- table数据表格 -->
      <el-main style="width: 99%">
        <el-table
          :empty-text="$t('common.noData')"
          ref="multipleTable"
          :data="eventOperationTableList"
          :row-style="rowStyleClass"
          :cell-style="cellStyleClass"
          :header-row-style="{height:'22px', padding:'0'}"
          :header-cell-style="{height:'22px', fontSize:'10px', color:'#595959', background:'#EBEEF5'}"
          :height="tableHeight"
          :max-height="tableHeight"
          style="font-size: 10px; width: 1000px; text-align:left;"
          stripe
          tooltip-effect="dark"
          :highlight-current-row="true"
          :default-sort = "{prop: 'firstTime', order: 'descending'}"
          @selection-change="handleSelectionChange">
          <el-table-column
            type="selection"
            v-if="false"
            width="28">
          </el-table-column>
          <el-table-column
            type="index"
            label="序号"
          >
          </el-table-column>
          <el-table-column
            prop="eventTime"
            label="发生时间"
            :show-overflow-tooltip="true">
          </el-table-column>
          <el-table-column
            prop="eventType"
            label="事件类型"
            :show-overflow-tooltip="true">
          </el-table-column>
          <el-table-column
            prop="cause"
            label="事件发生原因"
            :show-overflow-tooltip="true">
          </el-table-column>
          <el-table-column
            prop="description"
            label="描述"
            :show-overflow-tooltip="true">
          </el-table-column>
        </el-table>
        <el-pagination
          @current-change="handleCurrentChange"
          :current-page="currentPage"
          :page-size="pageSize"
          layout="prev, pager, next, jumper"
          :total="total">
        </el-pagination>
      </el-main>
    </el-container>
  </div>
</template>

<script>
  import Vue from 'vue';
  import VueResource from 'vue-resource'
  import ElCol from 'element-ui/packages/col/src/col'

  let protocal = '';
  let ip = '';
  let project = '';
  let port= '';
  export default {
    name: 'EventOperation',
    data () {
      return {
        /*--------下拉菜单选项---------------*/
        optionsEventType: [],   //事件类型选择列表
        optionsCause: [],   //事件发生原因选择列表

        /*---------选择的内容-------------*/
        queryEventTime: '',   //发生时间
        queryEventType: '',   //事件类型
        queryCause: '',   //事件发生原因

        /*----------获取内容-----------------------*/
        eventOperationList:[],   //事件管理列表
        eventOperationTableList:[],   //事件管理表格数据
      }
    },
    beforeCreate() {
      $.ajax({
        url:'./static/ipconfig.json',//url路径
        type:'GET', //GET
        async:false, //或false,是否异步
        timeout:5000, //超时时间
        dataType:'json', //返回的数据格式:
        success:function(data,textStatus,jqXHR){
          protocal = data.protocal;
          ip = data.ip;
          project = data.project;
          port= data.port;
        },
        error:function(xhr,textStatus){
          console.log("ipconfig配置失败!");
        }
      })
    },
    created: function () {
      this.getEventManagementList();
    },
    methods:{
      /**
       * 查询按钮响应
       *
       */
      queryEventOperationByCondition:function () {
        this.eventOperationTableList = this.eventOperationList;
      },

      /**
       * 获取事件管理列表
       */
      getEventManagementList:function () {
        this.$http.get(protocal + ip + port + project + 'cxf/nms/alarm/alarmevent/').then(result => {
          if (result.body.result) {
            // 成功了!
            this.eventOperationList = result.body.returnValue
          } else {
            // 失败了
            this.$message.error('Error ' + result.body.faultCode + ':' + result.body.faultCause)
          }
        })
      },


    }
  }

</script>

<style lang="scss" scoped>
  /*!* 外层布局容器样式 *!*/
  .el-header {
    background-color: #f9fafc;
    color: #333;
    line-height: 30px;
  }
  /deep/ .el-column-padding{
    padding-bottom: 10px!important;
    padding-top: 0!important;
  }
  /deep/ .caret-wrapper{
    height: 22px!important;
  }
  /deep/ .sort-caret.ascending{
    top: 0px!important;
  }
  /deep/ .sort-caret.descending{
    top: 12px!important;
  }


</style>