<template>
  <div class="analysis-box-wrapper" :style="{ width: width ? width : '100%', height: height ? height : '100%' }">
    <div class="wrapper-header">
      <div class="header-icon"></div>
      <div class="header-title">{{ title }}</div>
      <div class="header-btn" v-if="!showAllBtn">
        <slot name="headerBtn"></slot>
      </div>
      <div class="header-btn1" v-else>
        <slot name="headerBtn"></slot>
      </div>
      <div class="header-right">
        <div class="header-right-btn" @click="handleSave" v-if="showAllBtn">
          <img src="@/assets/icons/box-header-icon1.png" alt="">
        </div>
        <div class="header-right-btn" @click="handleDownload">
          <img src="@/assets/icons/box-header-icon2.png" alt="">
        </div>
        <div class="header-right-btn" @click="handleCollect">
          <img src="@/assets/icons/box-header-icon3.png" alt="">
        </div>
      </div>
    </div>
    <div class="wrapper-main">
      <slot></slot>
    </div>
  </div>
</template>

<script setup>
import { ElMessage } from 'element-plus'
import { ref, computed } from 'vue'

const props = defineProps({
  title: {
    type: String,
    default: ''
  },
  width: {
    type: String,
    default: ''
  },
  height: {
    type: String,
    default: ''
  },
  showAllBtn: {
    type: Boolean,
    default: true
  }
})

const handleSave = () => {
  ElMessage.success('保存当前内容')
  // emit('save')
}

const handleDownload = () => {
  ElMessage.success('下载当前内容')
  // emit('download')

}

const handleCollect = () => {
  ElMessage.success('收藏当前内容')
  // emit('collect')

}

const emit = defineEmits(['save','download','collect'])

</script>

<style lang="scss" scoped>
.analysis-box-wrapper {
  border: 1px solid rgba(234, 236, 238, 1);
  border-radius: 10px;
  box-shadow: 0px 0px 20px 0px rgba(25, 69, 130, 0.1);
  background: rgba(255, 255, 255, 1);

  .wrapper-header {
    height: 45px;
    display: flex;
    box-sizing: border-box;
    position: relative;

    .header-icon {
      margin-top: 18px;
      width: 8px;
      height: 20px;
      background: var(--color-main-active);
      border-radius: 0 4px 4px 0;
    }

    .header-title {
      margin-left: 14px;
      margin-top: 14px;
      height: 26px;
      // color: var(--color-main-active);
      // font-family: Source Han Sans CN;
      // font-size: 20px;
      // font-weight: 700;
      // line-height: 26px;
      // letter-spacing: 0px;
      height: 26px;
      color: var(--color-main-active);
      font-family: Microsoft YaHei;
      font-size: 20px;
      font-weight: 700;
      line-height: 26px;
    }

    .header-btn {
      position: absolute;
      top: 14px;
      right: 84px;
      // display: flex;
      // justify-content: flex-end;
      // gap: 8px;
    }

    .header-btn1 {
      position: absolute;
      top: 14px;
      right: 104px;
    }

    .header-right {
      position: absolute;
      top: 14px;
      right: 14px;
      height: 28px;
      display: flex;
      justify-content: flex-end;
      gap: 4px;

      .header-right-btn {
        width: 28px;
        height: 28px;
        cursor: pointer;

        img {
          width: 100%;
          height: 100%;
        }
      }
    }
  }

  .wrapper-main {
    height: calc(100% - 45px);
    overflow: hidden;
    // overflow-y: auto;
    padding: 5px auto;
  }
}
</style>
