<!--告警配置-->
<template>
  <div class="app-container warningConfig">
    <div class="page-container warningConfigPage">
      <div class="page-form-title-box">
        <el-form :model="queryParams" class="form-box" ref="queryForm"
                 :inline="true" style="width:100%;">
          <el-form-item label="" prop="queryData1">
            <el-input
              maxLength="30"
              v-model="queryParams.queryData1"
              placeholder="请输入"
              clearable
              style="width: 200px"
            />
          </el-form-item>
          <el-form-item label="" prop="queryData2">
            <el-select v-model="queryParams.queryData2" clearable placeholder="请选择类型" style="width: 200px">
              <el-option
                v-for="dict in options"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
              />
            </el-select>
          </el-form-item>
          <p class="page-inquire-common-style-button" @click="handleQuery">查询</p>
          <p class="page-reset-common-style-button" @click="resetQuery">重置</p>
          <p class="page-submit-common-style-button"
             style="float: right;"
             @click="dialogOpen"
             v-hasPermiRouter="['demo:demo:add']"
          >新增</p>
        </el-form>
      </div>
      <div class="page-content-box">
        <el-table class="table-box" v-loading="loading" border :data="dataList">
          <el-table-column label="名称" width="80" align="left" prop="data1" />
          <el-table-column label="类型" align="left" prop="data3" show-overflow-tooltip/>
          <el-table-column label="级别" align="left" prop="data2" show-overflow-tooltip/>
          <el-table-column label="联动场景" align="left" prop="data4" show-overflow-tooltip/>
          <el-table-column label="状态" align="left" prop="data5" show-overflow-tooltip/>
          <el-table-column label="创建时间" align="left" prop="data6" show-overflow-tooltip>
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.data6) }}</span>
            </template>
          </el-table-column>
          <el-table-column label="操作" align="left" class-name="small-padding fixed-width">
            <template slot-scope="scope">
              <div class="table-button-box">
                <p class="table-button-null"></p>
                <p class="table-button-p"
                   @click="tableButton(2,scope.row)"
                >详情</p>
                <p class="table-button-p"
                   @click="tableButton(3,scope.row)"
                >编辑</p>
                <p class="table-button-p"
                   @click="tableButton(4,scope.row)"
                >删除</p>
                <p class="table-button-null"></p>
              </div>
            </template>
          </el-table-column>
        </el-table>
        <pagination :page-sizes="[20, 30, 40, 50]"
                    v-show="total>0"
                    :total="total"
                    :page.sync="queryParams.page"
                    :limit.sync="queryParams.pageSize"
                    @pagination="getList"
        />
      </div>
    </div>
    <!--新增弹窗-->
    <el-dialog class="warningConfig-dialog" :title='dialogTitle' width="540px" append-to-body
               :visible.sync="dialogType" v-if="dialogType" @close="dialogOff()"
               :close-on-click-modal="false" :close-on-press-escape="false">
      <div slot="footer" class="dialog-footer dialog-footer-box">
        <p class="dialog-footer-button-null"></p>
        <p class="dialog-footer-button-info" @click="dialogOff()">取消</p>
        <p class="dialog-footer-button-primary" @click="dialogSubmit">提交</p>
        <p class="dialog-footer-button-null"></p>
      </div>
    </el-dialog>
  </div>
</template>

<script>
  export default {
    name: 'index',
    data(){
      return{
        loading:false,
        options:[{label:'设备监控',value:1},{label:'硬件维护',value:2},{label:'其他',value:3}],
        queryParams:{
          page:1,
          pageSize:20,
          queryData1:"",
          jobGroup:null,
          queryData2:null,
        },
        dataList:[],
        total:0,
        dialogTitle:null,
        dialogType:false,
        dialogForm:{},
      }
    },
    created(){

    },
    mounted(){

    },
    methods:{
      //弹层关闭
      dialogOff(){
        this.$set(this,'dialogType',false);
      },
      //弹层开启
      dialogOpen(){
        this.dialogFormReset();
        this.$set(this,'dialogTitle','新增');
        this.$set(this,'dialogType',true);
      },
      //弹层确定
      dialogSubmit(){
        this.$set(this,'dialogType',false);
      },
      handleQuery(){
        this.$set(this.queryParams,'page',1);
        this.getList();
      },
      resetQuery(){
        this.$set(this,'queryParams',{
          page:1,
          pageSize:20,
          queryData1:"",
          queryData2:null,
        });
        this.getList();
      },
      dialogFormReset(){
        this.$set(this,'dialogForm',{

        });
      },
      //获取数据列表
      getList(){
        // this.$set(this,'loading',true);
        // listJobLog(this.queryParams).then(response => {
        //   this.$set(this,'loading',false);
        //   this.$set(this,'dataList',response.data.records);
        //   this.$set(this,'total',response.data.total);
        // });
      },
      tableButton(type,row){
        if(type == 2){

        }else if(type == 3){
          this.dialogFormReset();
        }else if(type == 4){

        }
      },
    },
  }
</script>

<style scoped lang="scss">
  .warningConfig{
    .warningConfigPage{

    }
  }
</style>
