<template>
  <div class='mu-card-address'>
    <div class="address-main">
      <div class="address-aui-media-list-item-inner address-item-container">
        <div class="address-item-media">
          <mu-avatar class="address-avatar"
            :isimg="avatarObj && avatarObj.isImg"
            :avatarcolor="avatarObj && avatarObj.color"
            :avatarname="avatarObj && avatarObj.aName"
            :avatarurl="avatarObj && avatarObj.aUrl"
            size=40
            :hangingurl='hangingurl'
            :ishanging='ishanging'
            :hangingpos='hangingpos'
            @click='handleAvatarClick($event)'></mu-avatar>
          <div class="address-item-inner" @click='handleListClick'>
              <div class="address-item-title" v-html="name"></div>
              <div class="address-item-content"><span v-html="department"></span>·<span v-html="position"></span></div>
              <span>
                <i class="address-goutong-icon" style="padding-top:0;" @click="handleRightIcon"></i>
              </span>
          </div>
        </div>

      </div>
    </div>

  </div>
</template>
<script>
import avatar from '../avatar';

export default {
  name: 'mu-card-address',
  props: {
    avatarObj:{
      type: Object,
    },
    name: {
      type: String
    },
    position:{
      type:String
    },
    department:{
      type:String
    },
    hangingurl: {
      type: String,
      default: "",
    },
    ishanging: {
      type: Boolean,
      default: false,
    },
    hangingpos: {
      type: String,
      default: "bottom-right",
    }
  },
  data(){
    return {
    };
  },
  methods:{
    handleAvatarClick(e) {
      e.stopPropagation();
      this.$emit('handle-avatar-click');
    },
    handleListClick() {
       this.$emit('handle-list-click');
    },
    handleRightIcon(e){
      e.stopPropagation();
      this.$emit('handle-right-icon');
    }
  },
  components:{
    'mu-avatar': avatar
  },
};
</script>
<style lang="less">
.mu-card-address {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
  flex-direction: column;
  color: #212121;
  background-color: #fff;
  position: relative;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-pack: justify;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  padding: 12px 0;
}
.address-mu-main{
    font-size: 16px;
    color: #3A4247;
    line-height: 20px;
    margin-top: 6px;
    word-wrap: break-word;
    word-break: break-all;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #3a4247;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
}
.address-item-media {
    position: relative;
    display: inherit;
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
    -webkit-flex-wrap: nowrap;
    flex-wrap: nowrap;
    -webkit-box-align: center;
    -webkit-align-items: flex-start;
    align-items: flex-start;
}
.address-item-container{
  position:relative;
}
.address-item-inner{
    margin-left: 52px;
    width: 100%;
}
.address-item-media img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: block;
}
.address-item-media-list {
  margin-top: 0.25rem;
  padding-right: 0;
  display: block;
}
.address-item-title{
  font-size: 16px;
  line-height: 20px;
  height: 20px;
}
.address-item-content{
  font-size: 14px;
  line-height: 22px;
  height: 22px;
  color: #6B7175;
}
.address-avatar{
  position: absolute;
}
.address-goutong-icon{
  position: absolute;
  right: 0px;
  top: 0px;
  width: 24px;
  height: 21px;
  background: url('./goutong.png') center center no-repeat;
  background-size: cover;
  }
</style>
