<!--网络组件-->
<template>
  <div class="app-container networkComponent">
    <div class="title-box">
      <el-form :model="queryParams" class="form-box" ref="queryForm"
               :inline="true" style="width:100%;">
        <el-form-item label="关键词" prop="queryData1" label-width="90px">
          <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>
        <el-form-item>
          <p class="inquire-button-one" @click="handleQuery" style="margin-right:10px;">查询</p>
          <p class="reset-button-one" @click="resetQuery">重置</p>
        </el-form-item>
        <el-form-item label="" prop="title" style="float: right">
          <el-col :span="1.5" style="margin-right:10px;">
            <p class="add-button-one-90"
               @click="dialogOpen"
            >新增</p>
          </el-col>
        </el-form-item>
      </el-form>
    </div>
    <div class="content-box">
      <el-table v-loading="loading" border :data="dataList">
        <el-table-column label="名称" width="80" align="left" prop="data1" />
        <el-table-column label="类型" align="left" prop="data2" show-overflow-tooltip/>
        <el-table-column label="详情" align="left" prop="data3" 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>
    <!--新增弹窗-->
    <el-dialog class="networkComponent-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" style="display: flex">
        <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:true},{label:'停用',value:false}],
        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">
  .networkComponent{
    flex:1;
    display: flex;
    flex-direction: column;
    .title-box{
      padding-top:20px;
      border-bottom:1px solid #dedede;
      display: flex;
    }
    .content-box{
      flex: 1;
      display: flex;
      flex-direction: column;
      padding:20px;
      overflow: hidden;
    }
  }
</style>
