<style>
  .page_MyCustomer ._mc_addbox {
    height: 42px;
    width: 100%;
    margin-top: 20px;
  }

  .page_MyCustomer ._mc_addbox>li {
    float: left;
    width: 116px;
    font-size: 14px;
    height: 42px;
    color: #666;
    text-align: center;
    line-height: 42px;
    background: #E9E9E9;
    cursor: pointer;
  }

  .page_MyCustomer ._mc_addbox>li.active {
    background: #fff;
    color: #333;
  }

  .page_MyCustomer ._mc_addbox .divActive {
    margin: -3px auto;
    width: 26px;
    height: 3px;
    background: #E95252;
  }

  .page_MyCustomer .edHeight {
    display: block;
    height: 191px;
  }

  .page_MyCustomer ._mc_list {
    overflow-x: auto;
    background: #fff;
    padding-top: 20px;
    padding-left: 15px;
  }

  .page_MyCustomer ._scrollbar::-webkit-scrollbar {
    width: 4px;
    height: 8px;
  }

  .page_MyCustomer ._scrollbar::-webkit-scrollbar-thumb {
    border-radius: 4px;
    -webkit-box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.2);
    background: #c9c9c9;
  }

  .page_MyCustomer ._scrollbar::-webkit-scrollbar-track {
    -webkit-box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    background: #EDEDED;
  }

  .page_MyCustomer ._check_list {
    padding-left: 120px;
    margin-bottom: 20px;
  }

  .page_MyCustomer ._check_box .el-form-item {
    margin-bottom: 0
  }

  .page_MyCustomer ._info_box .el-form-item__label {
    font-size: 12px;
    color: #666;
  }

  .page_MyCustomer .avatar {
    width: 148px;
    height: 148px;
    display: block;
  }

  .page_MyCustomerSearch {
    width: 100%;
    min-height: auto;
    overflow: hidden;
    padding: 0 0 20px 0;
  }

  .page_MyCustomerSearch li {
    float: left;
    font-size: 12px;
    color: #666;
    margin: 20px 0 0px 0;
  }

  .page_MyCustomerSearch li>span {
    display: inline-block;
  }

  .page_MyCustomerSearch li span>em {
    display: inline-block;
    min-width: 60px;
    text-align: right;
    font-style: normal;
    margin: 0 12px 0 0;
  }

  .page_MyCustomerSearch li:last-child {
    float: right;
  }

  .saleDepartmetTable {
    width: 100%;
    font-size: 14px;
    color: #333;
  }

  .saleDepartmetTable tr {
    border-bottom: 2px solid #333;
  }

  .saleDepartmetTable tr th {
    background: #E6E6E6;
    height: 30px;
    font-size: 12px;
    text-align: left;
    text-indent: 25px;
  }

  .saleDepartmetTable tr {
    background: #fff;
    text-align: left;
  }

  .saleDepartmetTable tr td {
    height: 50px;
    padding-left: 25px;
    border-bottom: 1px solid #f5f5f5;
    font-size: 14px;
    color: #333;
  }

  .saleDepartmetTable tr td>img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    float: left;
    margin-right: 5px;
  }

  .saleDepartmetTable tr td .tuanqian {
    vertical-align: middle;
    font-weight: 400;
    display: table-cell;
    text-align: center;
    width: 44px;
    font-size: 12px;
    height: 19px;
    color: #FFFFFF;
    background: #2AAEF2;
  }

  .saleDepartmetTable tr td .geqian {
    vertical-align: middle;
    font-weight: 400;
    display: table-cell;
    text-align: center;
    width: 44px;
    font-size: 12px;
    height: 19px;
    color: #FFFFFF;
    background: #FF9000;
  }

  .saleDepartmetTable tr td .totalPrice {
    color: #FF9000;
    font-weight: bold;
  }

  .dateClass {
    width: 171px !important;
  }

  .surplusNum {
    color: #E95252 !important;
  }

  .peopleNum {
    color: rgba(51, 51, 51, 1);
    line-height: 24px;
  }

  .income {
    color: #47BF8C;
    font-weight: bold;
  }

  .saleDepartmetTable tr td .createName {
    vertical-align: middle;
    display: table-cell;
    text-align: left;
    padding-left: 3px;
    height: 21px;
  }

  .groupTourOrderIcon button {
    width: 28px;
    height: 28px;
    border-radius: 4px;
  }

  .groupTourOrderIcon .el-button--primary {
    padding: 5px;
    margin: 0;
    font-size: 14px !important;
  }

</style>
<template>
  <div class="page_MyCustomer">
    <div class="query-box" style="border:none">
      <ul>
        <li>
          <span>
            <em>{{$t('system.query_company')}}</em>
            <el-select filterable v-model='msg.RB_Branch_Id ' class="">
              <el-option value="-1" :label="$t('pub.unlimitedSel')"></el-option>
              <el-option v-for='item in CompanyList' :label='item.BName' :value='item.Id' :key='item.Id'>
              </el-option>
            </el-select>
          </span>
        </li>
        <li>
          <span>
            <em>{{$t('objFill.v101.Rest.baoruriqi')}}</em>
            <el-date-picker v-model='msg.StartDate' class='w135' value-format="yyyy-MM-dd" type="date">
            </el-date-picker>
            -
            <el-date-picker v-model='msg.EndDate' class='w135' value-format="yyyy-MM-dd" type="date"></el-date-picker>
          </span>
        </li>
        <li>
          <button class="hollowFixedBtn" @click="getList()">{{$t('pub.searchBtn')}}</button>
          <button class="hollowFixedBtn" @click="Export">{{$t('visa.v_daochu')}}</button>
        </li>
      </ul>
    </div>
    <table class="saleDepartmetTable" border="0" cellspacing="0" cellpadding="0" v-loading='loading'>
      <tr>
        <th width="10%">公司</th>
        <th width="10%">部门</th>
        <th width="10%">人员</th>
        <th width="10%">订单数量</th>
        <th width="10%">报名人数</th>
        <th width="10%">日本</th>
        <th width="10%">韩国</th>
        <th width="10%">欧洲</th>
        <th width="10%">其他</th>
        <th width="10%">排名</th>
      </tr>
      <tr v-for='(item,index) in dataList' :key="index">
        <td>{{item.BranchName}}</td>
        <td>{{item.DeptName}}</td>
        <td>{{item.EmName}}</td>
        <td>{{item.OrderNum}}</td>
        <td>{{item.PeopleNum}}</td>
        <td>{{item.JapanNum}}</td>
        <td>{{item.KoreaNum}}</td>
        <td>{{item.EuropeNum}}</td>
        <td>{{item.OtherNum}}</td>
        <td>{{item.Rank}}</td>
      </tr>
      <tr v-show="dataList.length==0">
        <td v-show="dataList.length==0" colspan="10" align="center">{{$t('system.content_noData')}}</td>
      </tr>
    </table>

  </div>
</template>
<script>
import moment from 'moment';
  export default {
    data() {
      return {
        CompanyList: [],
        msg: {
          StartDate: '',
          EndDate: '',
          RB_Branch_Id: '-1'
        },
        dataList: [],
        loading: true,
        EmployeeId: 0,        
      }
    },
    methods: {
      Export() {
        if (!this.msg.StartDate || this.msg.StartDate == "") {
          this.Error(this.$t('objFill.v101.Rest.qingxzchufksrq'))
          return;
        }
        if (!this.msg.EndDate || this.msg.EndDate == "") {
          this.Error(this.$t('objFill.v101.Rest.qingxzcfjsriq'))
          return;
        }
        let userInfo = this.getLocalStorage();
        let msg = this.msg;
        msg.EmployeeId = userInfo.EmployeeId;
        var fileName = "单签证销售排名.xls";
        this.GetLocalFile("Visa_get_GetVisaSaleRankToExcel", msg, fileName);
      },
      getCompanyList() { //获取公司列表
        let getCompanyMsg = { // 公司
          RB_Group_Id: '0',
          Status: '0',
        }
        let userInfo = this.getLocalStorage();
        getCompanyMsg.RB_Group_Id = userInfo.RB_Group_id; //集团ID
        this.apipost('admin_get_BranchGetList', getCompanyMsg, res => {
          if (res.data.resultCode == 1) {
            this.CompanyList = res.data.data;
          } else {}
        }, err => {})
      },
      getList() { // 获取列表数据
        this.loading = true;
        this.apipost('visa_get_GetVisaSaleRank', this.msg, res => {
          if (res.data.resultCode == 0) {
            this.loading = false;
            this.dataList = []
          } else {
            this.dataList = res.data.data;
            this.loading = false;
          }
        }, err => {})
      },
    },
    mounted() {
      let userinfo = this.getLocalStorage();
      this.getCompanyList()
      this.EmployeeId = userinfo.EmployeeId;

      this.msg.StartDate = moment().subtract(1, 'months').format('YYYY-MM-DD');
      this.msg.EndDate = new Date().Format('yyyy-MM-dd');
      this.getList()
    }
  }

</script>