<template>
  <div class="form-wrap">
    <el-form
      :model="form"
      ref="form"
      :rules="rules"
      label-width="100px"
      :inline="false"
      size="normal"
    >
      <el-form-item prop="name" label="选择货品:">
        <el-select
          v-model="form.goodsID"
          placeholder="请选择货品"
          clearable
          filterable
        >
          <el-option
            v-for="item in []"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          >
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item prop="yield" label="生产重量:">
        <!-- <el-input v-model="form.yield" type="number"></el-input> -->
        <el-input-number
          v-model="form.yield"
          :min="0"
          label="请输入生产重量"
        ></el-input-number>
      </el-form-item>
      <!-- <el-form-item prop="remark" label="备注信息:">
        <el-input v-model="form.remark"></el-input>
      </el-form-item> -->
    </el-form>
  </div>
</template>

<script>
export default {
  name: "GY1",
  props: [],
  components: {},
  data() {
    return {
      form: {
        name: "",
        number: "",
        remark: "",
        yield: "",
      },
      rules: {
        name: [{ required: true, message: "请输入姓名", trigger: "blur" }],
        number: [
          { required: true, message: "请输入运行数量", trigger: "blur" },
        ],
        remark: [
          { required: true, message: "请输入备注信息", trigger: "blur" },
        ],
      },
    };
  },
  computed: {},
  methods: {
    async getFormData() {
      let formData = {
        flag: false,
        msg: "",
      };
      try {
        let valid = await this.$refs.form.validate();
        if (valid) {
          formData.flag = true;
          formData.data = this.form;
          return formData;
        } else {
          formData.msg = "表单校验异常,请规范填写表单数据";
          return formData;
        }
      } catch (error) {
        // console.log(error);
        formData.msg = "表单校验异常,请规范填写表单数据";
        return formData;
      }
    },
  },
};
</script>

<style scoped></style>
