<template>
  <el-form
    :inline="true"
    :model="form"
    label-width="80px"
  >
  <!-- AI生成的表单 -->
  <!-- 通过设置 inline 属性为 true 可以让表单域变为行内的表单域 -->
    <el-form-item label="精网号">
      <el-input v-model="form.fineNetNumber" placeholder="请输入精网号"></el-input>
    </el-form-item>
    <el-form-item label="地区">
      <el-select v-model="form.region" placeholder="请选择地区">
        <el-option label="白山市" value="option1"></el-option>
        <el-option label="扬州市" value="option2"></el-option>
      </el-select>
      <!-- select-option是下拉框选择 -->
    </el-form-item>
    <el-form-item label="订单号">
      <el-input v-model="form.orderNumber" placeholder="请输入订单号"></el-input>
    </el-form-item>
    <el-form-item label="类型">
      <el-select v-model="form.type" placeholder="请选择类型">
        <el-option label="购买金豆" value="option1"></el-option>
        <el-option label="金币换金豆" value="option2"></el-option>
      </el-select>
    </el-form-item>
    <el-form-item label="充值平台">
      <el-select v-model="form.rechargePlatform" placeholder="请选择充值平台">
        <el-option label="system" value="option1"></el-option>
        <el-option label="ios" value="option2"></el-option>
      </el-select>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="handleSearch">查询</el-button>
      <el-button @click="handleReset">重置</el-button>
    </el-form-item>
  </el-form>
</template>

<script>
export default {
  data() {
    return {
      form: {
        fineNetNumber: '',
        region: '',
        orderNumber: '',
        type: '',
        rechargePlatform: ''
      }
    };
  },
  methods: {
     // 处理查询事件，将表单数据通过自定义事件search传递出去
    handleSearch() {
      this.$emit('search', this.form);
    },
    // 处理重置事件，重置表单数据并再次触发查询

    handleReset() {
      this.form = {
        fineNetNumber: '',
        region: '',
        orderNumber: '',
        type: '',
        rechargePlatform: ''
      };
      this.$emit('search', this.form);
    }
  }
};
</script>