<template>
  <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
    <el-form-item label="姓名/机构名称" prop="name">
      <el-input
        v-model="queryParams.name"
        placeholder="请输入姓名/机构名称"
        clearable
        style="width: 240px"
        @keyup.enter.native="handleQuery"
      />
    </el-form-item>
    <el-form-item label="证件号" prop="certificateNo">
      <el-input
        v-model="queryParams.certificateNo"
        placeholder="请输入证件号"
        clearable
        style="width: 240px"
        @keyup.enter.native="handleQuery"
      />
    </el-form-item>
    <el-form-item label="中介类型" prop="intermediaryType">
      <el-select v-model="queryParams.intermediaryType" placeholder="中介类型" clearable style="width: 240px">
        <el-option label="全部" value="" />
        <el-option label="个人" value="1" />
        <el-option label="实体" value="2" />
      </el-select>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
      <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
    </el-form-item>
  </el-form>
</template>

<script>
export default {
  name: "SearchForm",
  props: {
    queryParams: {
      type: Object,
      required: true
    },
    showSearch: {
      type: Boolean,
      default: true
    }
  },
  methods: {
    handleQuery() {
      this.$emit("query");
    },
    resetQuery() {
      this.$refs.queryForm.resetFields();
      this.$emit("query");
    }
  }
};
</script>
