<!--
  @description: 采购计划-集采计划打包-打包弹框
  @author: lxl
  @date： 2020-11-02 14:32
-->
<template>
  <el-dialog
    v-dialogDrag
    :visible.sync="dialogBaleData.dialogVisibleBale"
    :before-close="handleCloseDialog"
    :title="planTitle"
    width="1280px"
    custom-class="el-dialog__body-p8 el-dialog_table"
  >
    <baleAdd
      ref="baleAdd"
      :dialog-bale-data="dialogBaleData"
      @handleCloseDialog="handleCloseDialog"
    />
  </el-dialog>
</template>
<script>

import baleAdd from './bale-add'
export default {
  name: 'BaleDialog',
  components: {
    baleAdd
  },
  props: {
    dialogBaleData: {
      type: Object,
      default: () => {
        return {
          purchaseOrganization: '' // 组织形式 00-自行采购;01-委托采购
        }
      }
    }
  },
  data() {
    return {
      planTitle: ''
      // confirmLoading: false
    }
  },
  watch: {
    'dialogBaleData.dialogVisibleBale'(val) {
      if (val) {
        this.$nextTick(() => {
          this.$refs.baleAdd.initialize()
          if (this.dialogBaleData.purchaseOrganization === '01') {
            this.planTitle = '计划打包'
          } else {
            this.planTitle = '确定采购方案'
          }
        })
      }
    }
  },
  methods: {
    // 关闭弹框 val: 00提交成功关闭弹框 purchasePlanDetailsData提交成功反参
    handleCloseDialog(val, purchasePlanDetailsData) {
      this.$emit('close', val, purchasePlanDetailsData)
      this.dialogBaleData.dialogVisibleBale = false
    }
  }
}
</script>
<style lang="less" scoped>
/deep/.colse .el-dialog__close{
display: none;
}
</style>
