<template>
  <div>
    <el-form
      class="search-form"
      ref="form"
      :model="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="监测设备厂家" label-width="120px">
        <el-select v-model="value" placeholder="请选择">
          <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          >
          </el-option>
        </el-select>
      </el-form-item> -->
      <el-form-item label="上传时间">
        <el-date-picker
          v-model="dateRange"
          type="daterange"
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          value-format="yyyy-MM-dd"
        >
        </el-date-picker>
      </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,
      dateRange: [],
      value:'',
      options: [
        { value: '选项1', label: '选项1' },
        { value: '选项2', label: '选项2' },
        { value: '选项3', label: '选项3' },
        { value: '选项4', label: '选项4' },
        { value: '选项5', label: '选项5' }
      ]
    };
  },
  methods: {
    toSearch() {
      this.form.startUploadTime = this.dateRange[0];
      this.form.endUploadTime = this.dateRange[1];
      this.$emit("search", this.form);
    },
    reset() {
      this.dateRange = [];
      this.form = formInit();
      this.$emit("search");
    },
  },
};

function formInit() {
  return {
    pointDeviceName: "",
    pointConnectStatus: "",
    startUploadTime: "",
    endUploadTime: "",
  };
}
</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>