<template>
  <el-form :model="queryParams" ref="queryForm" size="small" v-show="showSearch" label-width="100px" class="query-form">
    <el-row :gutter="16">
      <el-col :span="6">
        <el-form-item label="名称" prop="name">
          <el-input
            v-model="queryParams.name"
            placeholder="请输入名称"
            clearable
            style="width: 100%"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="证件号" prop="certificateNo">
          <el-input
            v-model="queryParams.certificateNo"
            placeholder="请输入证件号"
            clearable
            style="width: 100%"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="记录类型" prop="recordType">
          <el-select v-model="queryParams.recordType" placeholder="请选择记录类型" clearable style="width: 100%">
            <el-option label="中介本人" value="INTERMEDIARY" />
            <el-option label="中介亲属" value="RELATIVE" />
            <el-option label="关联机构" value="ENTERPRISE_RELATION" />
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="关联中介信息" prop="relatedIntermediaryKeyword">
          <el-input
            v-model="queryParams.relatedIntermediaryKeyword"
            placeholder="请输入关联中介姓名或证件号"
            clearable
            style="width: 100%"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
      </el-col>
    </el-row>
  </el-form>
</template>

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

<style scoped>
.query-form ::v-deep .el-row {
  display: flex;
  flex-wrap: wrap;
}

.query-form ::v-deep .el-col {
  float: none;
}

.query-form ::v-deep .el-form-item {
  margin-right: 0;
}
</style>
