<style>
  .fpTable th {
    border-bottom: 1px solid #d1d1d1;
    border-right: 1px solid #d1d1d1;
  }

</style>

<template>
  <div class="flexOne">
    <div class="query-box">
      <ul>
        <li>
          <span>
            <em>操作人</em>
            <el-select v-model="msg.CreateBy" filterable :placeholder="$t('system.ph_in')">
              <el-option :label="$t('pub.unlimitedSel')" :value="0"></el-option>
              <el-option v-for="item in EmployeeList" :label="item.EmName" :value="item.EmployeeId"
                :key="item.EmployeeId"></el-option>
            </el-select>
          </span>
        </li>
        <li>
          <span>
            <em>月份</em>
            <el-date-picker v-model='msg.QMonth' value-format="yyyy-MM" type="month"></el-date-picker>
          </span>
        </li>
        <li>
          <input type="button" class="hollowFixedBtn" @click="getList()" :value="$t('pub.searchBtn')" />
          <input type="button" class="hollowFixedBtn" @click="DownLoad()" value="导出" />
        </li>
      </ul>
    </div>
    <table class="singeRowTable fpTable" border="0" cellspacing="0" cellpadding="0" v-loading="loading">
      <tr>
        <th>团期</th>
        <th>出团公司</th>
        <th>线路</th>
        <th>人数</th>
        <th>操作人员</th>
      </tr>
      <tr v-for="item in dataList">
        <td> <a style="color:blue;cursor:pointer" @click='goUrlT("RegistrationList",item.TCID,"报名清单")'>
            ({{item.TCID}}){{item.TCNUM}} </a></td>
        <td>{{item.OutBranchName}}</td>
        <td>{{item.LineName}}</td>
        <td>{{item.TicketNum}}</td>
        <td>{{item.CreateByName}}</td>
      </tr>
    </table>
  </div>
</template>
<script>
  export default {
    data() {
      return {
        msg: {
          LineId: 0, //线路编号
          OutBranchId: -1, //出团公司
          AirLineID: 0, //航空公司编号
          CreateBy: 0, //操作人
          QMonth: '', //月份
        },
        loading: false,
        dataList: [],
        //航空公司下拉
        airlineList: [],
        //操作人下拉
        EmployeeList: [],
      }
    },
    mounted() {
      let date = new Date(),
        y = date.getFullYear(),
        m = date.getMonth() < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
      this.msg.QMonth = y + '-' + m;
      this.initAirlines();
      this.getEmployeeList();
      this.getList()
    },
    methods: {
      //页面跳转
      goUrlT(path, obj, title) {
        this.$router.push({
          name: path,
          query: {
            "id": obj,
            blank: 'y',
            tab: title
          }
        })
      },
      //获取列表数据
      getList() {
        this.loading = true;
        this.apipost("AirTicket_get_GetTicketPerformance", this.msg, res => {
          this.loading = false;
          if (res.data.resultCode == 1) {
            this.dataList = res.data.data;
          }
        });
      },
      //初始化航空公司下拉
      initAirlines() {
        this.apipost(
          "airline_post_GetList", {},
          res => {
            if (res.data.resultCode == 1) {
              this.airlineList = res.data.data;
            }
          },
          err => {}
        );
      },
      //根据当前员工所在部门获取该部门及子部门员工信息
      getEmployeeList() {
        this.apipost(
          "admin_get_GetEmployeeByUserDepartmentId", {},
          res => {
            if (res.data.resultCode == 1) {
              this.EmployeeList = res.data.data;
            }
          },
          err => {}
        );
      },
      //下载业绩数据
      DownLoad() {
        this.loading = true;
        var fileName = "机票业绩下载" + this.msg.QMonth + ".xls";
        this.GetLocalFile("AirTicket_get_DownLoadGetTicketPerformance", this.msg, fileName,
          res => {
            this.loading = false;
          });
      }
    }
  }

</script>