<template>
  <el-dialog
    :title="purchaseTitle"
    append-to-body
    :visible.sync="openShow"
    width="30%"
    @close="closeDialog"
  >
    <avue-form ref="form" :option="option"></avue-form>

    <template #footer>
      <span class="dialog-footer">
        <el-button @click="closeDialog">取 消</el-button>
        <el-button type="primary" @click="submit">确 定</el-button>
      </span>
    </template>
  </el-dialog>
</template>
<script>

export default {
  props: {
    showDialog: {
      type: Boolean,
      default: false,
    },

  },
  data() {
    return {
      purchaseTitle:'报废',
      openShow: false,
      option: {
        submitBtn: false,
        emptyBtn: false,
        column: [
          {
            label: "报废数量",
            prop: "name",
            span: 24,
            type: "number",
            rules: [
              {
                required: true,
                message: "请输入",
                trigger: "blur",
              },
            ],
          },
          {
            label: "报废理由",
            prop: "sex",
            span: 24,
            type:'textarea',
            rows:5,
            rules: [
              {
                required: true,
                message: "请输入",
                trigger: "blur",
              },
            ],
          },
          {
            label: "报废时间",
            prop: "sex",
            span: 24,
            type:'textarea',
            rows:5,
            rules: [
              {
                required: true,
                message: "请选择",
                trigger: "blur",
              },
            ],
          },
        ],
      },
    };
  },
  mounted() {
    this.openShow = this.showDialog;
  },
  methods: {
    closeDialog() {
      this.openShow = false;
      this.$emit("closeDialog");
    },
    submit() {
      this.$refs.form.validate((valid) => {
        if (valid) {
          this.$emit("submit", this.formData);
        }
      });
    },
  },
};
</script>
<style lang="scss" scoped></style>
