<template>
  <div class="organization_card">
    <a class="remove_btn" @click.prevent="deleteAction">
      <i class="el-icon-close"></i>
    </a>
    <div class="organization_card-icon">
      <el-avatar shape="square" :size="56" fit="cover" :src="data.picture_path" />
    </div>
    <div class="organization_card-info">
      <p
        class="organization_card-name text_clip"
        v-text="data.department_name"
        @click="intoDetail"
      ></p>
    </div>
    <p class="organization_card-text">
      <span>
        <i class="el-icon-setting"></i>
        <span>业务系统数</span>
      </span>
      <span class="text_clip" v-text="data.systemUser"></span>
    </p>
    <p class="organization_card-text">
      <span>
        <i class="el-icon-user"></i>
        <span>组织管理员</span>
      </span>
      <span class="text_clip" v-text="data.orgAdmin"></span>
    </p>
    <p class="organization_card-text">
      <span>
        <i class="el-icon-time"></i>
        <span>创建时间</span>
      </span>
      <span class="text_clip" v-text="data.create_date"></span>
    </p>
  </div>
</template>

<script>
export default {
  props: {
    data: {
      type: Object,
      default: {},
    },
    cardType: {
      type: [String, Number],
      default: 0,
    },
    detailsUrl: {
      type: String,
      default: 0,
    },
  },
  methods: {
    deleteAction() {
      this.$emit("delete-action", this.data);
    },
    intoDetail() {
      this.$router.push(`${this.detailsUrl}${this.data.id}`);
    },
  },
};
</script>

<style scoped>
.organization_card {
  background-image: url(../../assets/imgs/bg_xlblock.png);
  background-size: 100% 100%;
  padding: 33px 25px 34px;
  box-sizing: border-box;
  margin: 0 18px 38px;
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
  position: relative;
}
.organization_card:hover {
  background-image: url(../../assets/imgs/bg_xlblock_hov.png);
}
.organization_card > .remove_btn {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 20px;
  color: #8890a7;
  cursor: pointer;
}
.organization_card > .organization_card-icon {
  margin-right: 18px;
}
.organization_card > .organization_card-info {
  width: calc(100% - 56px - 20px);
}
.organization_card-info > .organization_card-name {
  font-size: 18px;
  line-height: 32px;
  color: #0d1847;
  cursor: pointer;
}
.organization_card > .organization_card-action {
  width: 100%;
  text-align: center;
  margin: 34px 0 5px;
}
.organization_card-text {
  width: 100%;
  font-size: 14px;
  color: #0d1847;
  line-height: 25px;
  margin-top: 19px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.organization_card-text > span:nth-child(1) {
  flex-shrink: 0;
  color: #8890a7;
}
</style>

<style>
.organization_card-action > .el-button--primary.is-plain {
  background-color: #d0d5e7;
  border-color: #a5afd6;
  color: #0f2683;
}
</style>
