<template>
  <div class="Search">
    <el-form :inline="true" :model="formInline" class="demo-form-inline">
      <el-form-item label="供应商：">
        <el-input v-model="formInline.name" placeholder="请输入供应商" clearable />
      </el-form-item>
      <el-form-item label="类型：">
        <el-select v-model="formInline.region" placeholder="请选择类型" clearable>
          <el-option label="进货" value="shanghai" />
          <el-option label="退货" value="beijing" />
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="Search" @click="onSubmit">搜索</el-button>
        <el-button icon="Refresh" @click="reset">重置</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script setup>
import eventBus from '@/utils/eventBus'
const formInline = reactive({
  name: '',
  region: '',
})
const onSubmit = () => {
  eventBus.emit('search', formInline)
}
const reset = () => {
  formInline.name = ''
  formInline.region = ''
  eventBus.emit('search', formInline)
}
</script>

<style scoped lang="scss">
.Search {
  padding: 20px;
  background-color: #fff;
  border: 1px solid #e4e7ed;
  border-radius: 4px;
}

.demo-form-inline .el-input {
  --el-input-width: 220px;
}

.demo-form-inline .el-select {
  --el-select-width: 220px;
}
</style>
