<template>
  <div class="chartsContainer">
    <div class="chartsContainer-title">协同配合</div>
    <div class="chartsContainer-list">
      <div class="chartsContainer-content">
        <div class="chartsContainer-content-top">
          <div class="chartsContainer-content-name">团队配合</div>
        </div>
        <div class="chartsContainer-content-content" style="overflow-y: auto;">
          <div v-if=" pageData.teamCooperationList " class="content-row-item"
            v-for=" item in pageData.teamCooperationList ">
            {{ item.nickName }}
          </div>
        </div>
      </div>

      <div class="chartsContainer-content">
        <div class="chartsContainer-content-top">
          <div class="chartsContainer-content-name">性格特征</div>
        </div>
        <div class="chartsContainer-content-content">
          <div class="item-title">{{ getLabel( pageData.characterCharacteristics, sys_user_character_characteristics ) }}
          </div>
          <div class="item-img">
            <img :src="getMbtjImgPath( pageData.characterCharacteristics )" alt="">
          </div>
        </div>
      </div>

      <div class="chartsContainer-content">
        <div class="chartsContainer-content-top">
          <div class="chartsContainer-content-name">性别</div>
        </div>
        <div class="chartsContainer-content-content">
          <div class="item-title">{{ getLabel( pageData.sex, sys_user_sex ) }}</div>
          <div class="item-img">
            <img v-if=" getLabel( pageData.sex, sys_user_sex ) === '男' " :src="sex1" alt="">
            <img v-if=" getLabel( pageData.sex, sys_user_sex ) === '女' " :src="sex2" alt="">
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { getUserInfoById } from '@/api/item/items'
import { useTimeOut } from './useTimeOut';
import { ref, computed, inject } from 'vue'
import { useDict } from '@/utils/dict'
import sex1 from '@/assets/images/sex1.png'
import sex2 from '@/assets/images/sex2.png'
import { getMbtjImgPath } from '@/assets/images/mbtj/load.js'
const pageData = ref({
  teamCooperationList: []
})
const params = inject('provideParams')

const {
  sys_user_character_characteristics,
  sys_user_sex
} = useDict('sys_user_character_characteristics', 'sys_user_sex')

const getLabel = (value, list = []) => {
  const item = list.find(item => item.value.includes(value)) || {}
  return item.label
}
useTimeOut(() => {
  params.value.deptId && getUserInfoById(params.value.deptId).then(res => {
    pageData.value = res.data || { teamCooperationList: [] }
  })
}, [ params ])

</script>

<style lang="scss" scoped>
.chartsContainer {
  width: 100%;
  height: 100%;
  position: relative;
  background: linear-gradient(to bottom, rgba(8, 97, 117, 0) 0%, #13a2d6 200%);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  flex-direction: column;

  .chartsContainer-title {
    height: 42px;
    width: 100%;
    background: linear-gradient(to right, #004387 0%, #090B18 100%);
    border-left: 1px solid #1892CE;
    line-height: 42px;
    color: #fff;
    font-weight: 900;
    font-size: 20px;
    text-indent: 1em;
  }

  .chartsContainer-list {
    padding: 20px 15px 10px;
    box-sizing: border-box;
    display: flex;
    flex: 1;
    overflow: hidden;
    column-gap: 10px;
  }

  .chartsContainer-content {
    display: flex;
    flex-direction: column;
    row-gap: 10px;
    flex: 1;

    .chartsContainer-content-top {
      display: flex;
      align-items: center;
      color: #78DEF5;

      .chartsContainer-content-name {
        color: #fff;
        font-weight: bold;
        font-size: 16px;
        display: flex;
        align-items: center;

        &::before {
          content: '';
          display: inline-block;
          border-left: 9px solid #1CB6FF;
          border-top: 8px solid transparent;
          border-right: 9px solid transparent;
          border-bottom: 8px solid transparent;
        }
      }
    }

    .chartsContainer-content-describe {
      color: #78DEF5;
      font-size: 12px;
      font-weight: bold;
      display: flex;
      align-items: center;
    }

    .chartsContainer-content-content {
      flex: 1;
      width: 100%;
      display: flex;
      flex-direction: column;
      row-gap: 10px;

      .item-title {
        color: #fff;
        font-weight: bold;
        font-size: 16px;
        text-align: center;
        margin-top: 10px;
      }

      .item-img {
        width: 80%;
        margin: auto;
        height: calc(100% - 40px);
        display: flex;
        align-items: center;
        justify-content: center;

        img {
          max-width: 100%;
          max-height: 80%;
        }
      }

      .content-row-item {
        max-width: 10em;
        background: url('../../../../../assets/images/itemBg.png') no-repeat;
        background-size: 100% 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        color: #fff;
        font-size: 16px;
        border-radius: 5px;
        padding: 0 15px;
        font-weight: bold;
        height: 44px;
        white-space: nowrap;
      }
    }
  }
}
</style>