<template>
  <div class="infoWin">
    <div class="header-new">
      <img class="header-img" src="@/assets/images/mapSearch/内保单位.png" alt="" />{{ info.companyName }}
    </div>
    <div class="back" @click="onClickCompany(returnWin.info, 'companyStations')">&lt; 返回内保单位</div>
    <div class="info-window-companyStations-station">
      <div v-for="(item, index) in info.companyStations" :key="index" style="border-bottom: 1px solid #bdcfde; margin-top: 16px">
        <div class="circle-style"><img class="header-img" src="@/assets/images/mapSearch/驻勤点备份.png" alt="" /></div>
        <div class="circle-detail" @click="clickStation(item, 'companyStations')">
          <div class="detail-item">{{ item.name }}</div>
          <div class="detail-item">负责人员：{{ item.principalName }}</div>
          <div class="detail-item">
            <div class="detail-item-label">联系方式：</div>
            <div class="detail-item-value">
              {{ item.isPhone ? item.principalContact : "***********" }}
            </div>
            <span class="hide-show" @click.stop="item.isPhone = !item.isPhone">{{ item.isPhone ? "隐藏" : "显示" }}</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "OverlayCompanyStations",
  props: {
    info: {
      type: Object,
    },
    returnWin: {
      type: Object,
    },
  },
  computed: {},
  data() {
    return {
      isPhone: false,
      isIdCardNo: false,
      currentEmployee: {},
    };
  },
  methods: {
    /**
     * @跳转驻勤点
     */
    clickStation(info, infoType) {
      this.$bus.$emit("click-station", { info, infoType });
    },
    /**
     * 复制信息
     */
    copy(message) {
      var aux = document.createElement("input");
      aux.setAttribute("value", message);
      document.body.appendChild(aux);
      aux.select();
      document.execCommand("copy");
      document.body.removeChild(aux);
      this.$message({
        message: "复制成功",
        type: "success",
      });
    },
    closePopover(index) {
      console.log(this.$refs);
      this.$refs["popoverRef_" + index][0].doClose();
    },
    onClickCompany(info, infoType) {
      console.log("click-company-" + infoType, info);
      this.$bus.$emit("click-company", { info, infoType });
    },
  },
};
</script>

<style scoped lang="scss">
.circle-style {
  float: left;
  .header-img {
    width: 45px;
    height: 45px;
  }
}
.circle-detail {
  margin-left: 84px;
  cursor: pointer;
  .detail-item {
    display: flex;
    align-items: center;
    color: #000000;
    font-size: 14px;

    &:nth-last-child(1) {
      margin-bottom: 14px;
    }

    .detail-item-label {
      color: #000000;
    }

    .detail-item-value {
      float: left;
    }

    img {
      width: 16px;
      height: 16px;
      cursor: pointer;
      margin-left: 8px;
    }
  }
}
</style>
