<template>
  <el-row :style="{'margin-right':marginRight} ">
    <el-col :style="{'text-align': 'center'}">
        <slot name="leftButton"></slot>
        <el-button v-if="showCancel" @click="cancel">取消</el-button>
        <el-button v-if="showSaveDraft" type="primary" :loading="loading && showLoading" @click="saveDraft">保存</el-button>
        <el-button v-if="showSubmit" type="primary" :loading="loading && showLoading" @click="submit">提交</el-button>
        <el-button v-if="showConfirm" type="primary" :loading="loading && showLoading" @click="confirm">确定</el-button>
        <slot name="rightButton"></slot>
    </el-col>
  </el-row>
</template>

<script>

export default {
  props:{
    showLoading:{
      type:Boolean,
      default:false
    },
    //展示保存草稿
    showSaveDraft:{
      type:Boolean,
      default:false,
    },
    //展示提交
    showSubmit:{
      type:Boolean,
      default:false,
    },
    //展示确定
    showConfirm:{
      type:Boolean,
      default: true
    },
    //展示取消
    showCancel:{
      type:Boolean,
      default: true
    },
    marginRight:{
      type: String,
    }
  },
  components: {},
  data() {
    return {
      loading:false,
    };
  },
  computed: {},
  watch: {},
  methods: {
    //取消
    cancel(){
      this.$emit('cancel',)
    },
    //确定
    confirm(){
      if(this.showLoading){
        this.loading=true;
      }
      this.$emit('confirm')
    },
    //保存草稿
    saveDraft(){
      if(this.showLoading){
        this.loading=true;
      }
      this.$emit('saveDraft')
    },
    //提交
    submit(){
      if(this.showLoading){
        this.loading=true;
      }
      this.$emit('submit')
    }
  },


  created() {

  },
  mounted() {

  },


}


</script>

<style scoped>

</style>

