<template>
  <div class="aos-widget-box">
    <div class="aos-widget-title-container" :class="{ headerBorder: showHeaderBorder}" v-if="!onlyBody">
      <div class="header">
        {{name}}
      </div>
      <div class="header-right">
        <div class="header-right-left">
          <slot name="right"></slot>
          <i v-if="showDelete" class="el-icon-delete delete" @click="handleDelete"></i>
        </div>
        <div class="operation" v-if="showOperation" @click="handleOperationClick">
          {{operation}}
          <i class="el-icon-arrow-right"></i>
        </div>
      </div>
    </div>
    <div class="aos-widget-body" :class="{'aos-widget-body-only-body':onlyBody}">
      <slot></slot>
    </div>
  </div> 
</template>
<script>
export default {
  name: 'AosWidgetBox',
  props: {
    name: {
      type: String
    },
    operation: {
      type: String,
      default: '详情'
    },
    showOperation: {
      type: Boolean,
      default: false
    },
    minHeight: {
      type: Number,
      default: 400
    },
    onlyBody: {
      type: Boolean,
      default: false
    },
    showDelete: {
      type: Boolean,
      default: false
    },
    showHeaderBorder: {
      type: Boolean,
      default: true
    }
  },
  methods: {
    handleOperationClick(){
      this.$emit('operation-click');
    },
    handleDelete () {
      this.$emit('delete')
    }
  }
}
</script>
