<!-- 搜索表单 -->

<template>
  <el-form label-width="80px" class="ele-form-search" @keyup.enter.native="search" @submit.native.prevent>
    <el-row :gutter="24">
      <el-col :span="4">
        <el-form-item label="销售订单" prop="preSalesOrderNumber">
          <el-input v-model="where.preSalesOrderNumber" placeholder="请输入销售订单" clearable />
        </el-form-item>
      </el-col>
      <el-col :span="4">
        <el-form-item label="客户代号" prop="customerCode">
          <el-input v-model="where.customerCode" placeholder="请输入客户代号" clearable />
        </el-form-item>
      </el-col>
      <el-col :span="4">
        <el-form-item label="客户名称" prop="customerName">
          <el-input v-model="where.customerName" placeholder="请输入客户名称" clearable />
        </el-form-item>
      </el-col>
      <el-col :span="4">
        <el-form-item label="产品编码" prop="productCode">
          <el-input v-model="where.productCode" placeholder="请输入产品编码" clearable />
        </el-form-item>
      </el-col>
      <!-- <el-col :span="4">
        <el-form-item label="订单状态" prop="status">
          <el-select v-model="where.status" placeholder="请选择订单状态" clearable @change="search">
            <el-option v-for="item in statusOptions" :key="item.value" :label="item.label" :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
      </el-col> -->
      <el-col style="display: flex; justify-content: flex-end" :span="8">
        <div class="ele-form-actions">
          <el-button type="primary" icon="el-icon-search" class="ele-btn-icon" @click="search">
            查询
          </el-button>
          <el-button @click="reset">重置</el-button>
        </div>
      </el-col>
    </el-row>
  </el-form>
</template>

<script>

export default {
  data() {
    // 默认表单数据
    const defaultWhere = {
      preSalesOrderNumber: '',
      customerCode: '',
      customerName: '',
      productCode: '',
      status: null,
      queryType: 2 //查询类型（1：预销售单页面查询；2：已转销售单页面查询)
    };
    return {
      defaultWhere,
      // 表单数据
      where: { ...defaultWhere },
      statusOptions: [
        {
          value: '0',
          label: '未预估'
        },
        {
          value: '1',
          label: '已预估'
        },
        {
          value: '2',
          label: '已转销售单'
        }
      ]
    };
  },
  computed: {

  },
  methods: {
    /* 搜索 */
    search() {
      this.$emit('search', this.where);
    },
    /*  重置 */
    reset() {
      this.where = { ...this.defaultWhere };
      this.search();
    }
  }
};
</script>
