<template>
  <div>
    <el-form class="search-form" :model="form" ref="form" label-width="80px" :inline="true" size="mini">
      <el-form-item label="网元设备" >
        <el-input v-model="form.pointDeviceName" clearable placeholder="请输入网元设备"></el-input>
      </el-form-item>
      <el-form-item label="连接状态">
        <el-select v-model="form.pointConnectStatus" placeholder="请选择告警级别" clearable >
          <el-option v-for="(val,key) in ConnectStatusEnum"
            :key="key"
            :label="val"
            :value="+key">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="success"  @click="toSearch">查询</el-button>
        <el-button type="primary"  @click="reset">重置</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import { ConnectStatusEnum } from '@/const/index';

export default {
  name: 'search',
  data() {
    return {
      form: formInit(),
      ConnectStatusEnum,
    }
  },
  methods: {
    toSearch() {
      this.$emit('search', this.form);
    },
    reset() {
      this.form = formInit();
      this.$emit('search');
    },
  }
}

function formInit() {
  return {
    pointDeviceName: '',
    pointConnectStatus: '',
  }
}
</script>
<style scoped lang="scss">
.w200 {
  width: 200px;
}
.search-form {
  padding: 10px;
  background-color: #EAF1FE;
  margin-bottom: 20px;
  border-radius: 8px;
  .el-form-item--mini.el-form-item, .el-form-item--small.el-form-item {
    margin-bottom: 0;
  }
}
</style>