<template>
  <div class="mycareer" :style="{'zoom':this.zoom}">
    <div class="close" @click="close" v-if="showClose"></div>
    <div class="title">
      <div class="star"></div>
      <div class="company-name">{{emp.companyName}}</div>
      <div class="uerf">
        <div class="dept-name">{{emp.deptName}}</div>
        <div class="uer-name">{{emp.name}}</div>
      </div>
      <div class="post-name">{{emp.job}}</div>
    </div>
    <div class="uer-box">
      <div class="photo">
        <img :src="emp.photo" />
        <div class="zezhao"></div>
        <div class="bottom"></div>
      </div>
      <div class="my-score">
        <div class="item">
          <div class="k">{{$t('objFill.v101.champion.zonghenl')}}</div>
          <div class="v">{{emp.sumScore}}</div>
        </div>
        <div class="item">
          <div class="k">{{$t('objFill.v101.activity.zhouguan')}}</div>
          <div class="v">{{emp.champions}}</div>
        </div>
        <div class="item">
          <div class="k">{{$t('objFill.v101.champion.nenglipm')}}</div>
          <div class="v white">#{{emp.rank}}</div>
        </div>
      </div>
      <div class="dashboards" v-if="emp.name">
        <div class="item">
          <dashboard :score="emp.development" :title="$t('objFill.v101.champion.mingdankf')"></dashboard>
        </div>
        <div class="item">
          <dashboard :score="emp.appointment" :title="$t('objFill.v101.champion.yuefan')"></dashboard>
        </div>
        <div class="item">
          <dashboard :score="emp.demand" :title="$t('objFill.v101.champion.tanxunxq')"></dashboard>
        </div>
        <div class="item">
          <dashboard :score="emp.solveDemand" :title="$t('objFill.v101.champion.jiejuexuqiu')"></dashboard>
        </div>
        <div class="item">
          <dashboard :score="emp.clinch" :title="$t('objFill.v101.champion.shuimincj')"></dashboard>
        </div>
        <div class="item">
          <dashboard :score="emp.service" :title="$t('objFill.v101.champion.souhoufw')"></dashboard>
        </div>
      </div>
    </div>
    <div class="split"></div>
    <div class="change-box">
      <div class="btn" @click="ClickChoose1(-1)" :class="{'dis':index1==0}">
        <i class="el-icon-caret-left"></i>
      </div>
      <div class="option">{{choose1[index1]}}</div>
      <div class="btn" @click="ClickChoose1(1)" :class="{'dis':choose1.length-1==index1}">
        <i class="el-icon-caret-right"></i>
      </div>
    </div>
    <div class="data-box-before"></div>

    <div class="data-box" v-loading="isLoadingTableData">
      <div class="tab-head" ref="mycareerHead">
        <table>
          <thead>
            <tr>
              <th style="min-width: 100px;max-width: 100px;">&nbsp;</th>
              <th @click="sort" data-key="SumScore">{{$t('objFill.v101.activity.col.t1')}}</th>
              <th @click="sort" data-key="AddCustomer">{{$t('objFill.v101.activity.col.t4')}}</th>
              <th @click="sort" data-key="AdSend">{{$t('objFill.v101.activity.col.t3')}}</th>
              <th @click="sort" data-key="ImUsedCount">{{$t('objFill.v101.champion.imhudong')}}</th>
              <th @click="sort" data-key="ImUsedTime">{{$t('objFill.v101.champion.imshichang')}}</th>
              <th @click="sort" data-key="ClientPv">{{$t('objFill.v101.activity.col.t7')}}</th>
              <th @click="sort" data-key="OutTime">{{$t('objFill.v101.activity.col.t14')}}</th>
              <th @click="sort" data-key="FinishPlanCount">{{$t('salesModule.VisitCount')}}</th>
              <th @click="sort" data-key="FutureCount">{{$t('objFill.v101.champion.jihuacishu')}}</th>
              <th @click="sort" data-key="FutureClientCount">{{$t('objFill.v101.activity.col.t10')}}</th>
              <th @click="sort" data-key="AvgFutureSee">{{$t('objFill.v101.champion.erzhouneipjbf')}}</th>
              <th @click="sort" data-key="FutureSeeOldClient,FutureSeeNewClient">{{$t('objFill.v101.champion.xinlaothzb')}}</th>
              <th @click="sort" data-key="TripSite">{{$t('objFill.v101.champion.xunjiamdd')}}</th>
              <th @click="sort" data-key="PeopleCount">{{$t('objFill.v101.champion.xunjiars')}}</th>
              <th @click="sort" data-key="TripMonth">{{$t('hotel.hotel_StarDate')}}</th>
              <th @click="sort" data-key="OldClientEnquiry">{{$t('objFill.v101.champion.laokehxj')}}</th>
              <th @click="sort" data-key="DownloadTrip">{{$t('objFill.v101.activity.col.t18')}}</th>
              <th @click="sort" data-key="UsedApp">{{$t('objFill.v101.champion.zhushousc')}}</th>
              <th @click="sort" data-key="UsedErp">{{$t('objFill.v101.champion.erpshic')}}</th>
              <th @click="sort" data-key="UsedWe">{{$t('objFill.v101.champion.zhiqsc')}}</th>
              <th @click="sort" data-key="SevenDayOrder">{{$t('objFill.v101.champion.qirirens')}}</th>
              <th @click="sort" data-key="FifteenDayOrder">{{$t('objFill.v101.champion.shiwrrs')}}</th>
              <th @click="sort" data-key="MonthOrder">{{$t('objFill.v101.champion.sanshirrs')}}</th>
              <th @click="sort" data-key="OutMonthOrder">{{$t('objFill.v101.champion.sansywrs')}}</th>
              <th @click="sort" data-key="SanCount">{{$t('objFill.v101.champion.sankerens')}}</th>
              <th @click="sort" data-key="DanCount">{{$t('objFill.v101.champion.dantuansl')}}</th>
              <th @click="sort" data-key="IsSeeClient">{{$t('objFill.v101.champion.baifbmth')}}</th>
              <th @click="sort" data-key="OldClientOrders">{{$t('objFill.v101.champion.laotonghbm')}}</th>
              <th @click="sort" data-key="BuilderAd">{{$t('objFill.v101.champion.guanggaozz')}}</th>
              <th @click="sort" data-key="AdToApp">{{$t('objFill.v101.champion.guangzfim')}}</th>
              <th @click="sort" data-key="IncomeMoney">{{$t('objFill.v101.champion.shoukuancs')}}</th>
              <th @click="sort" data-key="Tousu">{{$t('objFill.v101.champion.chulitous')}}</th>
              <th @click="sort" data-key="SeeOldClient">{{$t('objFill.v101.champion.banfanlkeh')}}</th>
            </tr>
          </thead>
        </table>
      </div>
      <div class="lft-head">
        <table>
          <thead>
            <tr>
              <th style="min-width: 100px;max-width: 100px;">{{$t('salesModule.Time')}}</th>
            </tr>
          </thead>
        </table>
      </div>
      <div class="lft-body" ref="mycareerLeft">
        <table>
          <tbody>
            <tr v-for="(item, index) in tableData" :key="index">
              <td class="odd">{{item.CreateTimeFM}}</td>
            </tr>
          </tbody>
        </table>
      </div>
      <div class="content-body" ref="mycareerContent">
        <table>
          <tbody>
            <tr v-for="(item, index) in tableData" :key="index">
              <td style="min-width: 100px;max-width: 100px;background:#1d160b">&nbsp;</td>
              <td @mouseleave="outTable" @mouseover="activeTd(index,1)">{{item.SumScore}}</td>
              <td @mouseleave="outTable" @mouseover="activeTd(index,2)">{{item.AddCustomer}}</td>
              <td @mouseleave="outTable" @mouseover="activeTd(index,3)">{{item.AdSend}}</td>
              <td @mouseleave="outTable" @mouseover="activeTd(index,4)">{{item.ImUsedCount}}</td>
              <td @mouseleave="outTable" @mouseover="activeTd(index,5)">{{item.ImUsedTime}}{{$t('objFill.fenzhong')}}</td>
              <td @mouseleave="outTable" @mouseover="activeTd(index,6)">{{item.ClientPv}}</td>
              <td @mouseleave="outTable" @mouseover="activeTd(index,7)" class="even">{{item.OutTime}}</td>
              <td @mouseleave="outTable" @mouseover="activeTd(index,8)" class="even">{{item.FinishPlanCount}}</td>
              <td @mouseleave="outTable" @mouseover="activeTd(index,9)" class="even">{{item.FutureCount}}</td>
              <td @mouseleave="outTable" @mouseover="activeTd(index,10)" class="even">{{item.FutureClientCount}}</td>
              <td @mouseleave="outTable" @mouseover="activeTd(index,11)" class="even">{{item.AvgFutureSee}}</td>
              <td @mouseleave="outTable" @mouseover="activeTd(index,12)" class="even">{{item.FutureSeeOldClient+"/"+item.FutureSeeNewClient}}</td>
              <td @mouseleave="outTable" @mouseover="activeTd(index,13)">{{item.TripSite?item.TripSite.split(',').length:""}}</td>
              <td @mouseleave="outTable" @mouseover="activeTd(index,14)">{{item.PeopleCount}}</td>
              <td @mouseleave="outTable" @mouseover="activeTd(index,15)">{{item.TripMonth?item.TripMonth.split(',').length:""}}</td>
              <td @mouseleave="outTable" @mouseover="activeTd(index,16)">{{item.OldClientEnquiry}}</td>
              <td @mouseleave="outTable" @mouseover="activeTd(index,17)" class="even">{{item.DownloadTrip}}</td>
              <td @mouseleave="outTable" @mouseover="activeTd(index,18)" class="even">{{(item.UsedApp/60).toFixed(1)}}{{$t('objFill.xiaoshi')}}</td>
              <td @mouseleave="outTable" @mouseover="activeTd(index,19)" class="even">{{(item.UsedErp/60).toFixed(1)}}{{$t('objFill.xiaoshi')}}</td>
              <td @mouseleave="outTable" @mouseover="activeTd(index,20)" class="even">{{item.UsedWe}}</td>
              <td @mouseleave="outTable" @mouseover="activeTd(index,21)">{{item.SevenDayOrder}}</td>
              <td @mouseleave="outTable" @mouseover="activeTd(index,22)">{{item.FifteenDayOrder}}</td>
              <td @mouseleave="outTable" @mouseover="activeTd(index,23)">{{item.MonthOrder}}</td>
              <td @mouseleave="outTable" @mouseover="activeTd(index,24)">{{item.OutMonthOrder}}</td>
              <td @mouseleave="outTable" @mouseover="activeTd(index,25)">{{item.SanCount}}</td>
              <td @mouseleave="outTable" @mouseover="activeTd(index,26)">{{item.DanCount}}</td>
              <td @mouseleave="outTable" @mouseover="activeTd(index,27)">{{item.IsSeeClient}}</td>
              <td @mouseleave="outTable" @mouseover="activeTd(index,28)">{{item.OldClientOrders}}</td>
              <td @mouseleave="outTable" @mouseover="activeTd(index,29)" class="even">{{item.BuilderAd}}</td>
              <td @mouseleave="outTable" @mouseover="activeTd(index,30)" class="even">{{item.AdToApp}}</td>
              <td @mouseleave="outTable" @mouseover="activeTd(index,31)" class="even">{{item.IncomeMoney}}</td>
              <td @mouseleave="outTable" @mouseover="activeTd(index,32)" class="even">{{item.Tousu}}</td>
              <td @mouseleave="outTable" @mouseover="activeTd(index,33)" class="even">{{item.SeeOldClient}}</td>
            </tr>
          </tbody>
        </table>
      </div>
    </div>
  </div>
</template>
<script>
import dashboard from "./dashboard";
export default {
  components: {
    dashboard
  },
  props: {
    showClose: {
      type: Boolean,
      default: false
    },
    uid: {
      type: Number
    }
  },
  data() {
    return {
      choose1: [this.$t('objFill.v101.champion.meirisj'),this.$t('objFill.v101.champion.meizhousj'),this.$t('objFill.v101.champion.meiyuesj'),this.$t('objFill.v101.champion.meiniansj')],
      index1: 1,
      isLoadingTableData: false,
      tableData:[],
      emp:{},
      zoom:1
    };
  },
  mounted() {
    this.zoom=parseFloat(document.body.offsetHeight)/969.00;
    this.zoom=this.zoom<0.8?0.8:this.zoom;
    this.$refs.mycareerContent.addEventListener(
      "scroll",
      this.handleScroll,
      true
    );
    this.getUserInfo()
    this.init();
  },
  methods: {
    handleScroll() {
      this.$refs.mycareerLeft.scrollTop = this.$refs.mycareerContent.scrollTop;
      this.$refs.mycareerHead.scrollLeft = this.$refs.mycareerContent.scrollLeft;
    },
    close() {
      this.$emit("close");
    },
    sort(){

    },
    getUserInfo(empId) {
      if (empId != 0) {
        this.apipost("user_post_get_usersixdetails", { 'empId':this.uid }, r => {
          this.emp = r.data.data
        });
      }
    },
    activeTd(row, col) {
      document.querySelectorAll(".mycareer .content-body table tr").forEach((x, r) => {
        x.querySelectorAll("td").forEach((y, i) => {
          y.className = y.className.replace(" hover", "");
          if (i == col && r != row) {
            y.className = y.className + " hover";
          }
        });
      });
    },
    outTable() {
      document.querySelectorAll(".content-body table tr").forEach((x, r) => {
        x.querySelectorAll("td").forEach((y, i) => {
          y.className = y.className.replace(" hover", "");
        });
      });
    },
    init() {
      this.isLoadingTableData = true;
      let msg = {
        timeRange: this.index1 + 1,
        empId:this.uid
      };
      this.apipost("user_post_get_usersixstatistics", msg, r => {
        (this.tableData = r.data.data), (this.isLoadingTableData = false);
      });
    },
    ClickChoose1(num) {
      if(!this.isLoadingTableData){
        let temp = this.index1;
        if (this.index1 == 0) {
          if (num > 0) {
            this.index1 = this.index1 + num;
          }
        } else if (this.index1 == this.choose1.length - 1) {
          if (num < 0) {
            this.index1 = this.index1 + num;
          }
        } else {
          this.index1 = this.index1 + num;
        }
        if (temp != this.index1) {
          this.init();
        }
      }
    }
  }
};
</script>

<style scoped>
.mycareer {
  height: 740px;
  width: 1027px;
  background: url("../../assets/img/champion/bg.png");
  position: relative;
  user-select: none;
  cursor: default;
}
.mycareer .close {
  position: absolute;
  top: 64px;
  right: 33px;
  width: 20px;
  height: 20px;
  background: url("../../assets/img/champion/close.png");
  cursor: pointer;
}
.mycareer .close:hover {
  background: url("../../assets/img/champion/close_before.png");
}
.mycareer .title {
  width: 554px;
  height: 69px;
  background: url("../../assets/img/champion/title.png");
  position: relative;
  z-index: 2;
  margin: 0 auto;
  display: flex;
}
.mycareer .title .star {
  position: absolute;
  top: 21px;
  left: 154px;
  width: 244px;
  height: 16px;
  background: url("../../assets/img/champion/star.png");
}
.mycareer .title .company-name {
  font-size: 18px;
  color: rgba(255, 255, 255, 1);
  background: linear-gradient(
    0deg,
    rgba(246, 134, 15, 1) 0%,
    rgba(253, 207, 52, 1) 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-family: pingfangR;
  margin-top: 17px;
  width: 154px;
  text-align: center;
}
.mycareer .title .uerf {
  flex: 1;
  margin-top: 12px;
}
.mycareer .title .uerf .dept-name {
  height: 12px;
  font-size: 12px;
  color: #ffffff;
  text-align: center;
  margin-bottom: 4px;
}
.mycareer .title .uerf .uer-name {
  background: linear-gradient(
    0deg,
    rgba(246, 134, 15, 1) 0%,
    rgba(253, 207, 52, 1) 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 24px;
  font-family: pingfangR;
  font-weight: 400;
  color: rgba(255, 255, 255, 1);
  text-align: center;
}
.mycareer .title .post-name {
  width: 156px;
  text-align: center;
  margin-top: 17px;
  font-family: pingfangR;
  font-size: 18px;
  color: rgba(255, 255, 255, 1);
  background: linear-gradient(
    0deg,
    rgba(163, 169, 164, 1) 0%,
    rgba(255, 255, 255, 1) 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.mycareer .uer-box {
  margin-top: 13px;
  display: flex;
}
.mycareer .uer-box .photo {
  margin-left: 81px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  position: relative;
}
.mycareer .uer-box .photo img {
  width: 240px;
  height: 240px;
  border-radius: 50%;
  position: absolute;
  /* top: 5px;
  left: 5px; */
  z-index: 2;
}
.mycareer .uer-box .photo .zezhao {
  background: radial-gradient(
    circle,
    rgba(91, 52, 9, 0) 0%,
    rgba(0, 0, 0, 1) 74%
  );
  width: 230px;
  height: 230px;
  z-index: 1;
  position: absolute;
  top: 5px;
  left: 5px;
  border-radius: 50%;
  z-index: 3;
}
.mycareer .uer-box .photo .bottom {
  width: 177px;
  height: 63px;
  left: 33px;
  bottom: -29px;
  position: absolute;
  background: url("../../assets/img/champion/bottom.png");
  z-index: 1;
}
.mycareer .uer-box .my-score {
  margin-left: 38px;
}
.mycareer .uer-box .my-score .item {
  margin-top: 27px;
}
.mycareer .uer-box .my-score .item .k {
  font-family: pingfangR;
  font-size: 14px;
  color: rgba(255, 255, 255, 1);
  background: linear-gradient(
    0deg,
    rgba(163, 169, 164, 1) 0%,
    rgba(255, 255, 255, 1) 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.mycareer .uer-box .my-score .item .v {
  font-family: pingfangR;
  font-size: 31px;
  color: rgba(255, 255, 255, 1);
  background: linear-gradient(
    0deg,
    rgba(246, 134, 15, 1) 0%,
    rgba(253, 207, 52, 1) 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.mycareer .uer-box .my-score .item .v.white {
  background: linear-gradient(
    0deg,
    rgba(163, 169, 164, 1) 0%,
    rgba(255, 255, 255, 1) 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.mycareer .uer-box .dashboards {
  margin-right: 50px;
  flex: 1;
  display: flex;
  margin-left: 60px;
  flex-wrap: wrap;
}
.mycareer .uer-box .dashboards .item {
  width: 120px;
  height: 120px;
  margin-right: 40px;
  margin-top: 25px;
}
.mycareer .split {
  margin: 10px 33px 0 32px;
  height: 27px;
  background: url("../../assets/img/champion/split.png");
}
.mycareer .change-box {
  width: 250px;
  margin: 5px auto;
  display: flex;
  margin-bottom: 0px;
}
.mycareer .change-box .btn {
  width: 35px;
  height: 22px;
  background: rgba(255, 179, 57, 1);
  opacity: 0.8;
  border-radius: 2px;
  color: #fff;
  cursor: pointer;
  font-size: 12px;
  line-height: 22px;
  text-align: center;
  box-shadow: 0 0 5px rgba(255, 179, 57, 0.8);
}
.mycareer .change-box .btn.dis {
  background: #333;
  cursor: no-drop;
  color: #ddd;
  box-shadow: 0 0 5px #333c;
}
.mycareer .change-box .option {
  flex: 1;
  text-align: center;
  color: #ffffff;
  font-size: 14px;
  font-family: pingfangR;
  height: 22px;
  line-height: 22px;
}
.mycareer .data-box {
  overflow: hidden;
  position: absolute;
  bottom: 39px;
  top: 433px;
  left: 33px;
  right: 33px;
  z-index: 2;
}
.mycareer .data-box .tab-head {
  height: 43px;
  overflow: hidden;
}
.mycareer .data-box .lft-head {
  left: -1px;
  top: 0;
  width: 100px;
  overflow: hidden;
  right: unset;
  height: 43px;
  position: absolute;
  background: url("../../assets/img/champion/head.png") no-repeat;
}
.mycareer .data-box .lft-body {
  left: -1px;
  top: 43px;
  width: 100px;
  bottom: 6px;
  right: unset;
  position: absolute;
  overflow: hidden;
  z-index: 3;
}
.mycareer .data-box .content-body {
  left: -1px;
  top: 43px;
  right: 0;
  bottom: 0px;
  position: absolute;
  overflow: auto;
  z-index: 2;
  margin: 0 2px;
}
.mycareer .data-box-before {
  display: block;
  position: absolute;
  z-index: 1;
  background: url("../../assets/img/champion/head.png") no-repeat;
  height: 43px;
  content: " ";
  top: 433px;
  left: 33px;
  right: 33px;
}
.mycareer .data-box table {
  border-collapse: collapse;
  border-spacing: 0;
  table-layout: fixed;
}
.mycareer .data-box table thead th {
  height: 43px;
  padding-top: 10px;
  box-sizing: border-box;
  text-align: left;
  padding-left: 10px;
  font-size: 14px;
  font-family: pingfangR;
  color: rgba(255, 168, 53, 1);
  min-width: 80px;

  background: linear-gradient(
    0deg,
    rgba(163, 169, 164, 1) 0%,
    rgba(255, 255, 255, 1) 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.mycareer .data-box table thead th {
  min-width: 105px;
  max-width: 105px;
}
.mycareer .data-box table tbody td {
  height: 30px;
  line-height: 30px;
  font-size: 12px;
  color: #FFF;
  text-align: left;
  padding-left: 10px;
  min-width: 105px;
  max-width: 105px;
}
.mycareer .data-box table tbody td.odd {
  background: #1d160b;
  color: #fff;
  -webkit-background-clip: unset;
  -webkit-text-fill-color: unset;
  min-width: 100px;
  max-width: 100px;
}
.mycareer .content-body table tr:hover td,
.mycareer .content-body table tr:hover td.even {
  background: #1d160bdd;
  color: #fff;
}
.mycareer .content-body table td.hover {
  background: #1d160bdd !important;
  color: #fff !important;
}
.mycareer .content-body table td:hover {
  background: #E3e3e3 !important;
  color: #1d160b !important;
}
.mycareer .content-body table td.even{
  background: hsla(41, 63%, 38%, 0.212);
}
.mycareer .data-box .content-body::-webkit-scrollbar {
  /*滚动条整体样式*/
  width: 5px;
  /*高宽分别对应横竖滚动条的尺寸*/
  height: 5px;
  border: 1px solid rgba(161, 154, 147, 1);
  border-radius: 5px;
  background: transparent;
  padding: 2px;
}
.mycareer .data-box .content-body::-webkit-scrollbar-thumb {
  /*滚动条里面小方块*/
  height: 4px;
  width: 4px;
  background: rgba(222, 186, 102, 1);
  border-radius: 5px;
}
.mycareer .data-box .content-body::-webkit-scrollbar-track {
  /*滚动条里面轨道*/
  -webkit-box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.2);
  border-radius: 5px;
  background: transparent;
}
.mycareer .data-box .content-body::-webkit-scrollbar-corner {
  color: transparent;
}

</style>
