<!--
  @description: 新增物料采购方式
  @author: hdk
  @date： 2020-11-02 16:16:26
-->
<template>
  <el-dialog
    v-dialogDrag
    title="集采物料采购方式维护"
    :visible.sync="materielAddVisible"
    append-to-body
    :before-close="cancel"
    custom-class="el-dialog__body-p0 el-dialog__body-p8 el-dialog_table"
    width="1120px"
  >
    <purPlanMaterielAdd
      ref="purPlanMaterielAddRef"
      :materiel-add-visible="materielAddVisible"
      :edit-mode="editMode"
      :edit-row-data="editRowData"
      @closeDialog="closeDialog"
    />
    <!--保存按钮-->
    <span slot="footer" class="dialog-footer">
      <el-button type="primary" @click="submit('form')">提 交</el-button>
      <el-button @click="cancel">取 消</el-button>
    </span>
  </el-dialog>
</template>

<script>
import purPlanMaterielAdd from './materiel-add.vue'
export default {
  name: 'AddMaterielDialog',
  components: {
    purPlanMaterielAdd
  },
  props: {
    // 弹窗打开状态
    materielAddVisible: {
      type: Boolean,
      default: false
    },
    // 编辑模式 00新增 01编辑 02变更
    editMode: {
      type: String,
      default: '00'
    },
    // 编辑数据源
    editRowData: {
      type: Object,
      default: function() {
        return {}
      }
    }
  },
  methods: {
    submit() {
      this.$refs.purPlanMaterielAddRef.submit('form')
    },
    cancel() {
      // 取消
      this.$emit('closeDialog')
    },
    closeDialog() {
      this.cancel()
    }
  }
}
</script>

<style>

</style>
