<template>
  <p-modal title='明细拆分' :visible='visible' :width='480' :confirmLoading='confirmLoading' @ok='handleOk'
           @cancel='handleCancel'>
    <p-form-model ref='formTarget' :label-col='{ span: 6 }' :model='form' :wrapper-col='{ span: 18 }'
                  class='plg-grid-from'>
      <a-alert message="拆分数量将自动进行复核确认!" type="info" show-icon />
      <p-form-model-item label='拆分数量'>
        <p-input-number v-model='form.qty' :min="0" :precision="0"/>
      </p-form-model-item>
    </p-form-model>
  </p-modal>
</template>
<script>
export default {
  props: {
    visible: {
      type: Boolean,
      default: false
    },
    splitRecord: {
      type: Object,
      default() {
        return {}
      }
    }
  },
  data() {
    return {
      form: {qty:0},
      confirmLoading: false
    }
  },
  created() {
    // this.form = {}
    this.form.qty = this.splitRecord.pickQty
  },
  methods: {
    handleCancel() {
      this.$emit('update:visible', false)
    },
    handleOk() {
      const {qty} = this.form
      if (!qty) {
        this.$message.error('请输入数量!')
        return
      }
      this.$emit('success', qty)
    }
  }
}
</script>
<style lang='less' scoped></style>
