<template>
  <div>
    <Modal v-model="showBackModal" :mask-closable="false" class="zIndex-1100">
      <p slot="header">{{modalTitle}}</p>
      <div>
        <Form ref="formObj" :model="formObj" :rules="ruleValidate" :label-width="90">
          <Form-item label="打印份数" prop="number">
            <InputNumber :min="1" :step="1" v-model.number="formObj.number"
                         name="number"
                         style="width:100%" placeholder="请输入打印份数">
            </InputNumber>
          </Form-item>
        </Form>
      </div>
      <div slot="footer" class="btn-width">
        <Button @click="_cancel" style="margin-left: 8px">取消</Button>
        <Button @click="_ok" type="primary">确定</Button>
      </div>
    </Modal>
  </div>
</template>
<script>
/**
 * 制备标签打印数量
 */

export default {
  components: {},
  data() {
    return {
      currentComponent: '',
      modalTitle: '打印份数',
      showBackModal: false,
      formObj: {
        number: 1
      },
      ruleValidate: {
        number: [
          {
            required: true,
            message: '打印份数不能为空',
            trigger: 'blur',
            type: 'number'
          }
        ]
      },
      printerVal: '',
      selectData: [],
      companyId: ''
    }
  },
  methods: {
    // 打开界面
    _open() {
      this.showBackModal = true
      this.formObj.number = 1
    },
    _cancel() {
      this.showBackModal = false
    },
    // 打开界面
    _ok() {
      this.$refs.formObj.validate(valid => {
        if (valid) {
          this.$emit('on-result-change', this.formObj.number)
          this.showBackModal = false
        } else {
          this.$Message.error('表单验证失败!')
        }
      })
    }
  }
}
</script>
