<template>
  <div class="data-table">
    <div
      :style="dataTableContentStyle"
      v-loading="loading"
      element-loading-text="拼命加载中"
      element-loading-spinner="el-icon-loading"
      element-loading-background="rgba(0, 0, 0, 0.8)"
      class="data-table-content"
    >
      <template v-if="tableData.length && upid == 1">
        <el-table
          :data="tableData"
          style="width: 100%"
          ref="userTableData"
        >
          <el-table-column
            :label="dataContent[1] + '国航行李BRS扫描数据统计表'"
          >
            <el-table-column
              prop="A"
              label="日期"
            >
            </el-table-column>
            <el-table-column label="离港数">
              <el-table-column
                prop="totalfly"
                label="航班（架次）"
                width="240"
              >
              </el-table-column>
              <el-table-column
                prop="totalbag"
                label="行李（件数）"
                width="240"
              >
              </el-table-column>
            </el-table-column>
            <el-table-column label="扫描数">
              <el-table-column
                prop="brsfly"
                label="航班（架次）"
              >
              </el-table-column>
              <el-table-column
                prop="brsbag"
                label="行李（件数）"
              >
              </el-table-column>
            </el-table-column>
            <el-table-column label="扫描率">
              <el-table-column
                prop="ra_brsfly"
                label="航班"
              >
              </el-table-column>
              <el-table-column
                prop="ra_brsbag"
                label="行李"
              >
              </el-table-column>
            </el-table-column>
          </el-table-column>
        </el-table>
      </template>
      <template v-else-if="tableData.length && upid == 2">
        <el-table
          :data="tableData"
          style="width: 100%"
          ref="userTableDatard"
        >
          <el-table-column label="Mannual Load扫描数据统计表">
            <el-table-column
              prop="A"
              label="日期"
            >
            </el-table-column>
            <el-table-column label="离港数">
              <el-table-column
                prop="totalfly"
                label="航班（架次）"
                width="240"
              >
              </el-table-column>
              <el-table-column
                prop="totalbag"
                label="行李（件数）"
                width="240"
              >
              </el-table-column>
            </el-table-column>
            <el-table-column label="扫描数">
              <el-table-column
                prop="starfly"
                label="航班（架次）"
              >
              </el-table-column>
              <el-table-column
                prop="starbag"
                label="行李（件数）"
              >
              </el-table-column>
            </el-table-column>
            <el-table-column label="扫描率">
              <el-table-column
                prop="ra_starfly"
                label="航班"
              >
              </el-table-column>
              <el-table-column
                prop="ra_starbag"
                label="行李"
              >
              </el-table-column>
            </el-table-column>
          </el-table-column>
        </el-table>
      </template>
      <template v-else-if="tableData.length && upid == 3">
        <el-table
          :data="tableData"
          style="width: 100%"
          ref="TableDatardrfid"
        >
          <el-table-column label="航易行RFID扫描数据统计表">
            <el-table-column
              prop="A"
              label="日期"
            >
            </el-table-column>
            <el-table-column label="离港数">
              <el-table-column
                prop="totalfly"
                label="航班（架次）"
                width="240"
              >
              </el-table-column>
              <el-table-column
                prop="totalbag"
                label="行李（件数）"
                width="240"
              >
              </el-table-column>
            </el-table-column>
            <el-table-column label="扫描数">
              <el-table-column
                prop="hyxfly"
                label="航班（架次）"
              >
              </el-table-column>
              <el-table-column
                prop="hyxbag"
                label="行李（件数）"
              >
              </el-table-column>
            </el-table-column>
            <el-table-column label="扫描率">
              <el-table-column
                prop="ra_hyxfly"
                label="航班"
              >
              </el-table-column>
              <el-table-column
                prop="ra_hyxbag"
                label="行李"
              >
              </el-table-column>
            </el-table-column>
          </el-table-column>
        </el-table>
      </template>
      <template v-else-if="tableData.length && upid == 4">
        <el-table
          ref="userTableDatas"
          :data="tableData"
          style="width: 100%"
          :show-summary="true"
          :summary-method="totalOutPrice"
          :cell-class-name="cellClass"
          @cell-click="cellClickHandler"
        >
          <el-table-column
            prop="fd"
            label="日期"
          >
          </el-table-column>
          <el-table-column label="中转行李流向">
            <el-table-column label="D-D" v-if="DD">
              <el-table-column
                prop="need_trans_flight_dd"
                label="进港中转航班数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_flight_dd"
                label="中转出航班数"
              >
              </el-table-column>
              <el-table-column
                prop="need_trans_bag_dd"
                label="须中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_bag_dd"
                label="完成中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="not_trans_bag_dd"
                label="未中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="Transferout_dd"
                label="转出成功率"
              >
              </el-table-column>
            </el-table-column>
            <el-table-column label="D-I"  v-if="DI">
              <el-table-column
                prop="need_trans_flight_di"
                label="进港中转航班数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_flight_di"
                label="中转出航班数"
              >
              </el-table-column>
              <el-table-column
                prop="need_trans_bag_di"
                label="须中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_bag_di"
                label="完成中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="not_trans_bag_di"
                label="未中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="Transferout_di"
                label="转出成功率"
              >
              </el-table-column>
            </el-table-column>
            <el-table-column label="I-I"  v-if="II">
              <el-table-column
                prop="need_trans_flight_ii"
                label="进港中转航班数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_flight_ii"
                label="中转出航班数"
              >
              </el-table-column>
              <el-table-column
                prop="need_trans_bag_ii"
                label="须中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_bag_ii"
                label="完成中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="not_trans_bag_ii"
                label="未中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="Transferout_ii"
                label="转出成功率"
              >
              </el-table-column>
            </el-table-column>
            <el-table-column label="I-D"  v-if="ID">
              <el-table-column
                prop="need_trans_flight_id"
                label="进港中转航班数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_flight_id"
                label="中转出航班数"
              >
              </el-table-column>
              <el-table-column
                prop="need_trans_bag_id"
                label="须中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_bag_id"
                label="完成中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="not_trans_bag_id"
                label="未中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="Transferout_id"
                label="转出成功率"
              >
              </el-table-column>
            </el-table-column>
          </el-table-column>
          <el-table-column
            prop="a14"
            label="中转出航班数总数"
          >
          </el-table-column>
          <el-table-column
            prop="a15"
            label="中转出航班数总数"
          >
          </el-table-column>
          <el-table-column
            prop="a16"
            label="须中转行李数总数"
          >
          </el-table-column>
          <el-table-column
            prop="a17"
            label="完成中转行李数总数"
          >
          </el-table-column>
          <el-table-column
            prop="a19"
            label="未中转行李数总数"
          >
          </el-table-column>
          <el-table-column
            prop="a18"
            label="转出成功率"
          >
          </el-table-column>
        </el-table>
      </template>
      <template v-else-if="tableData.length && upid == 5">
        <el-table
          ref="transferTableData"
          :data="tableData"
          style="width: 100%"
          :show-summary="true"
          :summary-method="totalOutPrice"
          :cell-class-name="cellClass"
          @cell-click="cellClickHandler"
        >
          <el-table-column
            prop="fd"
            label="日期"
          >
          </el-table-column>
          <el-table-column label="D-D"  v-if="DD">
            <el-table-column label="T2-T2" v-if="t1">
              <el-table-column
                prop="need_trans_flight_dd_22"
                label="进港中转航班数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_flight_dd_22"
                label="中转出航班数"
              >
              </el-table-column>
              <el-table-column
                prop="need_trans_bag_dd_22"
                label="须中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_bag_dd_22"
                label="完成中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="not_trans_bag_dd_22"
                label="未中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="Transferout_dd_22"
                label="转出成功率"
              >
              </el-table-column>
            </el-table-column>
            <el-table-column label="T2-T3" v-if="t2">
              <el-table-column
                prop="need_trans_flight_dd_23"
                label="进港中转航班数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_flight_dd_23"
                label="中转出航班数"
              >
              </el-table-column>
              <el-table-column
                prop="need_trans_bag_dd_23"
                label="须中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_bag_dd_23"
                label="完成中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="not_trans_bag_dd_23"
                label="未中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="Transferout_dd_23"
                label="转出成功率"
              >
              </el-table-column>
            </el-table-column>
            <el-table-column label="T3-T3" v-if="t3">
              <el-table-column
                prop="need_trans_flight_dd_33"
                label="进港中转航班数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_flight_dd_33"
                label="中转出航班数"
              >
              </el-table-column>
              <el-table-column
                prop="need_trans_bag_dd_33"
                label="须中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_bag_dd_33"
                label="完成中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="not_trans_bag_dd_33"
                label="未中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="Transferout_dd_33"
                label="转出成功率"
              >
              </el-table-column>
            </el-table-column>
            <el-table-column label="T3-T2" v-if="t4">
              <el-table-column
                prop="need_trans_flight_dd_32"
                label="进港中转航班数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_flight_dd_32"
                label="中转出航班数"
              >
              </el-table-column>
              <el-table-column
                prop="need_trans_bag_dd_32"
                label="须中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_bag_dd_32"
                label="完成中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="not_trans_bag_dd_32"
                label="未中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="Transferout_dd_32"
                label="转出成功率"
              >
              </el-table-column>
            </el-table-column>
          </el-table-column>
          <el-table-column label="D-I"  v-if="DI">
            <el-table-column label="T2-T2" v-if="t1">
              <el-table-column
                prop="need_trans_flight_di_22"
                label="进港中转航班数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_flight_di_22"
                label="中转出航班数"
              >
              </el-table-column>
              <el-table-column
                prop="need_trans_bag_di_22"
                label="须中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_bag_di_22"
                label="完成中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="not_trans_bag_di_22"
                label="未中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="Transferout_di_22"
                label="转出成功率"
              >
              </el-table-column>
            </el-table-column>
            <el-table-column label="T2-T3" v-if="t2">
              <el-table-column
                prop="need_trans_flight_di_23"
                label="进港中转航班数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_flight_di_23"
                label="中转出航班数"
              >
              </el-table-column>
              <el-table-column
                prop="need_trans_bag_di_23"
                label="须中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_bag_di_23"
                label="完成中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="not_trans_bag_di_23"
                label="未中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="Transferout_di_23"
                label="转出成功率"
              >
              </el-table-column>
            </el-table-column>
            <el-table-column label="T3-T3" v-if="t3">
              <el-table-column
                prop="need_trans_flight_di_33"
                label="进港中转航班数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_flight_di_33"
                label="中转出航班数"
              >
              </el-table-column>
              <el-table-column
                prop="need_trans_bag_di_33"
                label="须中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_bag_di_33"
                label="完成中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="not_trans_bag_di_33"
                label="未中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="Transferout_di_33"
                label="转出成功率"
              >
              </el-table-column>
            </el-table-column>
            <el-table-column label="T3-T2" v-if="t4">
              <el-table-column
                prop="need_trans_flight_di_32"
                label="进港中转航班数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_flight_di_32"
                label="中转出航班数"
              >
              </el-table-column>
              <el-table-column
                prop="need_trans_bag_di_32"
                label="须中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_bag_di_32"
                label="完成中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="not_trans_bag_di_32"
                label="未中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="Transferout_di_32"
                label="转出成功率"
              >
              </el-table-column>
            </el-table-column>
          </el-table-column>
          <el-table-column label="I-I" v-if="II">
            <el-table-column label="T2-T2" v-if="t1">
              <el-table-column
                prop="need_trans_flight_ii_22"
                label="进港中转航班数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_flight_ii_22"
                label="中转出航班数"
              >
              </el-table-column>
              <el-table-column
                prop="need_trans_bag_ii_22"
                label="须中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_bag_ii_22"
                label="完成中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="not_trans_bag_ii_22"
                label="未中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="Transferout_ii_22"
                label="转出成功率"
              >
              </el-table-column>
            </el-table-column>
            <el-table-column label="T2-T3" v-if="t2">
              <el-table-column
                prop="need_trans_flight_ii_23"
                label="进港中转航班数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_flight_ii_23"
                label="中转出航班数"
              >
              </el-table-column>
              <el-table-column
                prop="need_trans_bag_ii_23"
                label="须中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_bag_ii_23"
                label="完成中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="not_trans_bag_ii_23"
                label="未中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="Transferout_ii_23"
                label="转出成功率"
              >
              </el-table-column>
            </el-table-column>
            <el-table-column label="T3-T3" v-if="t3">
              <el-table-column
                prop="need_trans_flight_ii_33"
                label="进港中转航班数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_flight_ii_33"
                label="中转出航班数"
              >
              </el-table-column>
              <el-table-column
                prop="need_trans_bag_ii_33"
                label="须中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_bag_ii_33"
                label="完成中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="not_trans_bag_ii_33"
                label="未中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="Transferout_ii_33"
                label="转出成功率"
              >
              </el-table-column>
            </el-table-column>
            <el-table-column label="T3-T2" v-if="t4">
              <el-table-column
                prop="need_trans_flight_ii_32"
                label="进港中转航班数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_flight_ii_32"
                label="中转出航班数"
              >
              </el-table-column>
              <el-table-column
                prop="need_trans_bag_ii_32"
                label="须中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_bag_ii_32"
                label="完成中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="not_trans_bag_ii_32"
                label="未中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="Transferout_ii_32"
                label="转出成功率"
              >
              </el-table-column>
            </el-table-column>
          </el-table-column>
          <el-table-column label="I-D"  v-if="ID">
            <el-table-column label="T2-T2" v-if="t1">
              <el-table-column
                prop="need_trans_flight_id_22"
                label="进港中转航班数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_flight_id_22"
                label="中转出航班数"
              >
              </el-table-column>
              <el-table-column
                prop="need_trans_bag_id_22"
                label="须中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_bag_id_22"
                label="完成中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="not_trans_bag_id_22"
                label="未中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="Transferout_id_22"
                label="转出成功率"
              >
              </el-table-column>
            </el-table-column>
            <el-table-column label="T2-T3" v-if="t2">
              <el-table-column
                prop="need_trans_flight_id_23"
                label="进港中转航班数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_flight_id_23"
                label="中转出航班数"
              >
              </el-table-column>
              <el-table-column
                prop="need_trans_bag_id_23"
                label="须中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_bag_id_23"
                label="完成中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="not_trans_bag_id_23"
                label="未中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="Transferout_id_23"
                label="转出成功率"
              >
              </el-table-column>
            </el-table-column>
            <el-table-column label="T3-T3" v-if="t3">
              <el-table-column
                prop="need_trans_flight_id_33"
                label="进港中转航班数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_flight_id_33"
                label="中转出航班数"
              >
              </el-table-column>
              <el-table-column
                prop="need_trans_bag_id_33"
                label="须中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_bag_id_33"
                label="完成中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="not_trans_bag_id_33"
                label="未中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="Transferout_id_33"
                label="转出成功率"
              >
              </el-table-column>
            </el-table-column>
            <el-table-column label="T3-T2" v-if="t4">
              <el-table-column
                prop="need_trans_flight_id_32"
                label="进港中转航班数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_flight_id_32"
                label="中转出航班数"
              >
              </el-table-column>
              <el-table-column
                prop="need_trans_bag_id_32"
                label="须中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="finish_trans_bag_id_32"
                label="完成中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="not_trans_bag_id_32"
                label="未中转行李数"
              >
              </el-table-column>
              <el-table-column
                prop="Transferout_id_32"
                label="转出成功率"
              >
              </el-table-column>
            </el-table-column>
          </el-table-column>
          <el-table-column
            prop="a14"
            label="中转出航班数总数"
          >
          </el-table-column>
          <el-table-column
            prop="a15"
            label="中转出航班数总数"
          >
          </el-table-column>
          <el-table-column
            prop="a16"
            label="须中转行李数总数"
          >
          </el-table-column>
          <el-table-column
            prop="a17"
            label="完成中转行李数总数"
          >
          </el-table-column>
          <el-table-column
            prop="a19"
            label="未中转行李数总数"
          >
          </el-table-column>
          <el-table-column
            prop="a18"
            label="转出成功率"
          >
          </el-table-column>
        </el-table>
      </template>
      <template v-else-if="tableData.length && upid == 6">
        <el-table
          ref="transferBaggageTableData"
          :data="tableData"
          style="width: 100%"
          :show-summary="true"
        >
          <el-table-column
            prop="a1"
            label="日期"
          >
          </el-table-column>
          <el-table-column
            prop="a2"
            label="进港中转航班量"
          >
          </el-table-column>
          <el-table-column
            prop="a3"
            label="中转行李件数"
          >
          </el-table-column>
          <el-table-column
            prop="a4"
            label="未转出件数"
          >
          </el-table-column>
          <el-table-column label="未转出件数分项">
            <el-table-column
              prop="a5"
              label="MCT时间紧"
            >
            </el-table-column>
            <el-table-column
              prop="a6"
              label="过检设备原因"
            >
            </el-table-column>
            <el-table-column
              prop="a7"
              label="混装"
            >
            </el-table-column>
            <el-table-column
              prop="a8"
              label="布控"
            >
            </el-table-column>
            <el-table-column
              prop="a9"
              label="等锥桶"
            >
            </el-table-column>
            <el-table-column
              prop="a10"
              label="车辆故障"
            >
            </el-table-column>
            <el-table-column
              prop="a11"
              label="货舱门/卡锁故障"
            >
            </el-table-column>
            <el-table-column
              prop="a12"
              label="机位远"
            >
            </el-table-column>
            <el-table-column
              prop="a13"
              label="未通过扫描"
            >
            </el-table-column>
            <el-table-column
              prop="a14"
              label="BHS无记录"
            >
            </el-table-column>
            <el-table-column
              prop="a15"
              label="分拣设备故障"
            >
            </el-table-column>
            <el-table-column
              prop="a16"
              label="进港晚卸"
            >
            </el-table-column>
            <el-table-column
              prop="a17"
              label="设备紧张"
            >
            </el-table-column>
            <el-table-column
              prop="a18"
              label="导入晚"
            >
            </el-table-column>
            <el-table-column
              prop="a19"
              label="正常传出未装机"
            >
            </el-table-column>
            <el-table-column
              prop="a20"
              label="错传"
            >
            </el-table-column>
            <el-table-column
              prop="a21"
              label="原因待定"
            >
            </el-table-column>
          </el-table-column>
        </el-table>
      </template>
      <template v-else-if="tableData.length && upid == 7">
        <el-table
          ref="baggageProportionTableData"
          :data="tableData"
          style="width: 100%"
          :show-summary="true"
        >
          <el-table-column
            prop="a1"
            label="日期"
          >
          </el-table-column>
          <el-table-column label="总">
            <el-table-column
              prop="a2"
              label="中转行李百分比"
            >
            </el-table-column>
            <el-table-column
              prop="a3"
              label="行李总件数"
            >
            </el-table-column>
            <el-table-column
              prop="a4"
              label="中转行李件数"
            >
            </el-table-column>
          </el-table-column>
          <el-table-column label="国内">
            <el-table-column
              prop="a5"
              label="中转行李百分比"
            >
            </el-table-column>
            <el-table-column
              prop="a6"
              label="行李总件数"
            >
            </el-table-column>
            <el-table-column
              prop="a7"
              label="中转行李件数"
            >
            </el-table-column>
          </el-table-column>
          <el-table-column label="国际">
            <el-table-column
              prop="a8"
              label="中转行李百分比"
            >
            </el-table-column>
            <el-table-column
              prop="a9"
              label="行李总件数"
            >
            </el-table-column>
            <el-table-column
              prop="a10"
              label="中转行李件数"
            >
            </el-table-column>
          </el-table-column>
        </el-table>
      </template>
      <template v-else-if="tableData.length && upid == 8">
        <el-table
          :data="tableData"
          style="width: 100%"
          :show-summary="true"
          ref="userTableDataelt"
        >
        <el-table-column
            prop="time"
            label="日期"
          >
          </el-table-column>
          <el-table-column
            prop="bpm"
            label="有BPM行李数量"
          >
          </el-table-column>
          <el-table-column
            prop="bsm"
            label="总数量"
          >
          </el-table-column>
          <el-table-column
            prop="lv"
            label="行李全流程跟踪服务水平（%）"
          >
          </el-table-column>
        </el-table>
      </template>
      <template v-else>
        <NoData
          image-width="auto"
          image-height="100%"
        />
      </template>
    </div>
  </div>
</template>
<script>
import NoData from '@/components/nodata'
import { TempQuery } from '@/api/temp'
import { exportToExcel } from '@/utils/table'
export default {
  props: {
    // 接口ID
    dataId: {
      type: [String, Number],
      default: '',
    },
    isloadings: {
      type: Number,
    },
    upid: {
      type: [String, Number],
    },
    dataContent: {
      type: Array,
      default: () => [],
    },
    textShow: {
      type: Array,
      default: () => [],
    },
    textShowtp: {
      type: Array,
      default: () => [],
    },
  },
  data() {
    return {
      loading: false,
      page: 0,
      serviceId: null,
      rowTitle: '',
      tableCols: [], //表头数据
      tableData: [
        // {
        //   date: "wnz（7月）",
        //   name: "409",
        //   province: "18946",
        //   city: "409",
        //   address: "18294",
        //   zip: "100%",
        //   cp: "96.56%",
        // },
      ],
      DD: true,
      DI: true,
      II: true,
      ID: true,
      t1: true,
      t2: true,
      t3: true,
      t4: true,
    }
  },
  components: {
    NoData,
  },
  watch: {
    dataContent: {
      handler(val) {
        if (val) {
          this.getQuery()
        }
      },
      deep: true,
    },
    isloadings: {
      handler(val) {
        this.downFile()
      },
    },
    textShow: {
      handler(val) {
        if (val.length === 0) {
          this.DD = true
          this.DI = true
          this.II = true
          this.ID = true
        } else {
          this.DD = false
          this.DI = false
          this.II = false
          this.ID = false
          val.forEach(element => {
            if (element === 'D-D') {
              this.DD = true
            } else if (element === 'D-I') {
              this.DI = true
            } else if (element === 'I-I') {
              this.II = true
            } else if (element === 'I-D') {
              this.ID = true
            }
          });
        }
      },
    },
    textShowtp: {
      handler(val) {
        if (val.length === 0) {
          this.t1 = true
          this.t2 = true
          this.t3 = true
          this.t4 = true
        } else {
          this.t1 = false
          this.t2 = false
          this.t3 = false
          this.t4 = false
          val.forEach(element => {
            if (element === 'T2-T2') {
              this.t1 = true
            } else if (element === 'T2-T3') {
              this.t2 = true
            } else if (element === 'T3-T3') {
              this.t3 = true
            } else if (element === 'T3-T2') {
              this.t4 = true
            }
          });
        }
      },
    },
  },
  computed: {
    dataTableContentStyle() {
      const style = {}
      if (this.minHeight) {
        style['min-height'] = this.minHeight
      }
      if (this.tableHeight) {
        style['height'] = this.tableHeight
      }
      return style
    },
  },
  mounted() {
    // this.getQuery();
  },
  methods: {
    totalOutPrice(param) {
      const { columns, data } = param;
      const sums = [];
      columns.forEach((column, index) => {
        if (index === 0) {
          sums[index] = "合计";
          return;
        }
        const values = data.map((item) => Number(item[column.property]));
        if (
          column.property != "stand" &&
          column.property != "flightdate" &&
          column.property != "indexs" &&
          column.property != "flightNo" &&
          column.property != "line" &&
          column.property != "cargoCompany"
        ) {
          sums[index] = values.reduce((prev, curr) => {
            const value = Number(curr);
            if (!isNaN(value)) {
              return prev + curr;
            } else {
              return "";
            }
          }, 0);
          sums[index];
        }
        if (this.upid == 4) {
          sums[6] = (sums[4] * 100 / (sums[3] > 0 ? sums[3] : 1)).toFixed(2) + '%'
          sums[12] = (sums[10] * 100 / (sums[9] > 0 ? sums[9] : 1)).toFixed(2) + '%'
          sums[18] = (sums[16] * 100 / (sums[15] > 0 ? sums[15] : 1)).toFixed(2) + '%'
          sums[24] = (sums[22] * 100 / (sums[21]  > 0 ? sums[21] : 1)).toFixed(2) + '%'
          sums[30] = (sums[28] * 100 / (sums[27]  > 0 ? sums[27] : 1)).toFixed(2) + '%'
        }
        if (this.upid == 5) {
          // sums[6] = (sums[4] * 100 / sums[3]).toFixed(2) + '%'
          // sums[12] = (sums[10] * 100 / sums[9]).toFixed(2) + '%'
          // sums[18] = (sums[16] * 100 / sums[15]).toFixed(2) + '%'
          // sums[24] = (sums[22] * 100 / sums[21]).toFixed(2) + '%'
          // sums[30] = (sums[28] * 100 / sums[27]).toFixed(2) + '%'
          // sums[36] = (sums[34] * 100 / sums[33]).toFixed(2) + '%'
          // sums[42] = (sums[40] * 100 / sums[39]).toFixed(2) + '%'
          for(var i = 6; i < sums.length; i+=6) {
            sums[i] = (sums[i-2] * 100 / (sums[i-3] > 0 ? sums[i-3] : 1)).toFixed(2) + '%'
          }
          // sums[6] = (sums[4] * 100 / (sums[3] > 0 ? sums[3] : 1)).toFixed(2) + '%'
          // sums[12] = (sums[10] * 100 / (sums[9] > 0 ? sums[9] : 1)).toFixed(2) + '%'
          // sums[18] = (sums[16] * 100 / (sums[15] > 0 ? sums[15] : 1)).toFixed(2) + '%'
          // sums[24] = (sums[22] * 100 / (sums[21] > 0 ? sums[21] : 1)).toFixed(2) + '%'
          // sums[30] = (sums[28] * 100 / (sums[27] > 0 ? sums[27] : 1)).toFixed(2) + '%'
          // sums[36] = (sums[34] * 100 / (sums[33] > 0 ? sums[33] : 1)).toFixed(2) + '%'
          // sums[42] = (sums[40] * 100 / (sums[39] > 0 ? sums[39] : 1)).toFixed(2) + '%'
        }
      });
      return sums;
    },
    //获取表格数据
    async getQuery() {
      try {
        this.loading = true
        const { code, returnData } = await TempQuery({
          id: Number(this.dataId),
          dataContent: this.dataContent,
        })
        if (code == 0) {
          if (returnData.listValues.length === 0) {
            this.page--
            this.noMore = true
            this.loading = false
          }
          const titleColumn = returnData.columnSet.find(
            item => item.needShow === 1
          )
          if (titleColumn) {
            this.rowTitle = titleColumn.columnName
          }
          // returnData.listValues.forEach((res) => {
          //   if (!res.A) {
          //     res.A = 0;
          //   }
          //   if (!res.totalfly) {
          //     res.totalfly = 0;
          //   }
          //   if (!res.totalbag) {
          //     res.totalbag = 0;
          //   }
          //   if (!res.brsfly) {
          //     res.brsfly = 0;
          //   }
          //   if (!res.brsbag) {
          //     res.brsbag = 0;
          //   }
          //   if (!res.ra_brsfly) {
          //     res.ra_brsfly = 0;
          //   }
          //   if (!res.ra_brsbag) {
          //     res.ra_brsbag = 0;
          //   }
          //   if (!res.starfly) {
          //     res.starfly = 0;
          //   }
          //   if (!res.starbag) {
          //     res.starbag = 0;
          //   }
          //   if (!res.ra_starfly) {
          //     res.ra_starfly = 0;
          //   }
          //   if (!res.ra_starfly) {
          //     res.ra_starfly = 0;
          //   }
          //   if (!res.hyxfly) {
          //     res.hyxfly = 0;
          //   }
          //   if (!res.hyxbag) {
          //     res.hyxbag = 0;
          //   }
          //   if (!res.ra_hyxfly) {
          //     res.ra_hyxfly = 0;
          //   }
          //   if (!res.ra_hyxbag) {
          //     res.ra_hyxbag = 0;
          //   }
          // });
          this.tableData = returnData.listValues
          this.tableCols = returnData.columnSet
          this.serviceId = returnData.submitID
          this.loading = false
          if(this.upid == 4){
            this.tableData.forEach(element => {
              element.Transferout_dd = (element.finish_trans_bag_dd * 100 / (element.need_trans_bag_dd > 0  ? element.need_trans_bag_dd : 1)).toFixed(2) + '%'
              element.Transferout_di = (element.finish_trans_bag_di * 100 / (element.need_trans_bag_di > 0  ?  element.need_trans_bag_di : 1)).toFixed(2) + '%'
              element.Transferout_ii = (element.finish_trans_bag_ii * 100 / (element.need_trans_bag_ii > 0  ? element.need_trans_bag_ii : 1)).toFixed(2) + '%'
              element.Transferout_id = (element.finish_trans_bag_id * 100 / (element.need_trans_bag_id > 0 ? element.need_trans_bag_id : 1)).toFixed(2) + '%'
              element.a14 = (this.DD ? element.need_trans_flight_dd : 0) + (this.DI ? element.need_trans_flight_di : 0) + (this.II ? element.need_trans_flight_ii : 0) + (this.ID ? element.need_trans_flight_id : 0)
              element.a15 =  (this.DD ? element.finish_trans_flight_dd : 0) + (this.DI ? element.finish_trans_flight_di : 0) + (this.II ? element.finish_trans_flight_ii : 0) + (this.ID ? element.finish_trans_flight_id : 0)
              element.a16 =  (this.DD ? element.need_trans_bag_dd : 0) + (this.DI ? element.need_trans_bag_di : 0) + (this.II ? element.need_trans_bag_ii : 0) + (this.ID ? element.need_trans_bag_id : 0)
              element.a17 =  (this.DD ? element.finish_trans_bag_dd : 0) + (this.DI ? element.finish_trans_bag_di : 0) + (this.II ? element.finish_trans_bag_ii : 0) + (this.ID ? element.finish_trans_bag_id : 0)
              element.a19 = (this.DD ? element.not_trans_bag_dd : 0) + (this.DI ? element.not_trans_bag_di : 0) + (this.II ? element.not_trans_bag_ii : 0) + (this.ID ? element.not_trans_bag_id : 0)
              element.a18 = (element.a17 * 100 /( element.a16 > 0 ?  element.a16 : 0)).toFixed(2) + '%'
            });
          } else if (this.upid == 5) {
            this.tableData.forEach(element => {
              element.Transferout_dd_22 = (element.finish_trans_bag_dd_22 * 100 / (element.need_trans_bag_dd_22 > 0 ? element.need_trans_bag_dd_22 : 1)).toFixed(2) + '%'
              element.Transferout_dd_23 = (element.finish_trans_bag_dd_23 * 100 / (element.need_trans_bag_dd_23 > 0 ? element.need_trans_bag_dd_23 : 1)).toFixed(2) + '%'
              element.Transferout_dd_33 = (element.finish_trans_bag_dd_33 * 100 / (element.need_trans_bag_dd_33 > 0 ? element.need_trans_bag_dd_33 : 1)).toFixed(2) + '%'
              element.Transferout_dd_32 = (element.finish_trans_bag_dd_32 * 100 / (element.need_trans_bag_dd_32 > 0 ? element.need_trans_bag_dd_32 : 1)).toFixed(2) + '%'

              element.Transferout_di_22 = (element.finish_trans_bag_di_22 * 100 / (element.need_trans_bag_di_22 > 0 ? element.need_trans_bag_di_22 : 1)).toFixed(2) + '%'
              element.Transferout_di_23 = (element.finish_trans_bag_di_23 * 100 / (element.need_trans_bag_di_23 > 0 ? element.need_trans_bag_di_23 : 1)).toFixed(2) + '%'
              element.Transferout_di_33 = (element.finish_trans_bag_di_33 * 100 / (element.need_trans_bag_di_33 > 0 ? element.need_trans_bag_di_33 : 1)).toFixed(2) + '%'
              element.Transferout_di_32 = (element.finish_trans_bag_di_32 * 100 / (element.need_trans_bag_di_32 > 0 ? element.need_trans_bag_di_32 : 1)).toFixed(2) + '%'

              element.Transferout_ii_22 = (element.finish_trans_bag_ii_22 * 100 / (element.need_trans_bag_ii_22 > 0 ? element.need_trans_bag_ii_22 : 1)).toFixed(2) + '%'
              element.Transferout_ii_23 = (element.finish_trans_bag_ii_23 * 100 / (element.need_trans_bag_ii_23 > 0 ? element.need_trans_bag_ii_23 : 1)).toFixed(2) + '%'
              element.Transferout_ii_33 = (element.finish_trans_bag_ii_33 * 100 / (element.need_trans_bag_ii_33 > 0 ? element.need_trans_bag_ii_33 : 1)).toFixed(2) + '%'
              element.Transferout_ii_32 = (element.finish_trans_bag_ii_32 * 100 / (element.need_trans_bag_ii_32 > 0 ? element.need_trans_bag_ii_32 : 1)).toFixed(2) + '%'

              element.Transferout_id_22 = (element.finish_trans_bag_id_22 * 100 / (element.need_trans_bag_id_22 > 0 ? element.need_trans_bag_id_22 : 1)).toFixed(2) + '%'
              element.Transferout_id_23 = (element.finish_trans_bag_id_23 * 100 / (element.need_trans_bag_id_23 > 0 ? element.need_trans_bag_id_23 : 1)).toFixed(2) + '%'
              element.Transferout_id_33 = (element.finish_trans_bag_id_33 * 100 / (element.need_trans_bag_id_33 > 0 ? element.need_trans_bag_id_33 : 1)).toFixed(2) + '%'
              element.Transferout_id_32 = (element.finish_trans_bag_id_32 * 100 / (element.need_trans_bag_id_32 > 0 ? element.need_trans_bag_id_32 : 1)).toFixed(2) + '%'
              
              let t1DD = (this.t1 ? element.need_trans_flight_dd_22 : 0) + (this.t2 ? element.need_trans_flight_dd_23 : 0) + (this.t3 ? element.need_trans_flight_dd_33 : 0) + (this.t4 ? element.need_trans_flight_dd_32 : 0)
              let t1DI = (this.t1 ? element.need_trans_flight_di_22 : 0) + (this.t2 ? element.need_trans_flight_di_23 : 0) + (this.t3 ? element.need_trans_flight_di_23 : 0) + (this.t4 ? element.need_trans_flight_di_32 : 0)
              let t1II = (this.t1 ? element.need_trans_flight_ii_22 : 0) + (this.t2 ? element.need_trans_flight_ii_23 : 0) + (this.t3 ? element.need_trans_flight_ii_33 : 0) + (this.t4 ? element.need_trans_flight_ii_32 : 0)
              let t1ID = (this.t1 ? element.need_trans_flight_id_22 : 0) + (this.t2 ? element.need_trans_flight_id_23 : 0) + (this.t3 ? element.need_trans_flight_id_33 : 0) + (this.t4 ? element.need_trans_flight_id_32 : 0)
              element.a14 = (this.DD ? t1DD : 0) + (this.DI ? t1DI : 0) + (this.II ? t1II : 0) + (this.II ? t1ID : 0)

              let t2DD = (this.t1 ? element.finish_trans_flight_dd_22 : 0) + (this.t2 ? element.finish_trans_flight_dd_23 : 0) + (this.t3 ? element.finish_trans_flight_dd_33 : 0) + (this.t4 ? element.finish_trans_flight_dd_32 : 0)
              let t2DI = (this.t1 ? element.finish_trans_flight_di_22 : 0) + (this.t2 ? element.finish_trans_flight_di_23 : 0) + (this.t3 ? element.finish_trans_flight_di_33 : 0) + (this.t4 ? element.finish_trans_flight_di_32 : 0)
              let t2II = (this.t1 ? element.finish_trans_flight_ii_22 : 0) + (this.t2 ? element.finish_trans_flight_ii_23 : 0) + (this.t3 ? element.finish_trans_flight_ii_33 : 0) + (this.t4 ? element.finish_trans_flight_ii_32 : 0)
              let t2ID = (this.t1 ? element.finish_trans_flight_id_22 : 0) + (this.t2 ? element.finish_trans_flight_id_23 : 0) + (this.t3 ? element.finish_trans_flight_id_33 : 0) + (this.t4 ? element.finish_trans_flight_id_32 : 0)
              element.a15 = (this.DD ? t2DD : 0) + (this.DI ? t2DI : 0) + (this.II ? t2II : 0) + (this.II ? t2ID : 0)

              let t3DD = (this.t1 ? element.need_trans_bag_dd_22 : 0) + (this.t2 ? element.need_trans_bag_dd_23 : 0) + (this.t3 ? element.need_trans_bag_dd_33 : 0) + (this.t4 ? element.need_trans_bag_dd_32 : 0)
              let t3DI = (this.t1 ? element.need_trans_bag_di_22 : 0) + (this.t2 ? element.need_trans_bag_di_23 : 0) + (this.t3 ? element.need_trans_bag_di_33 : 0) + (this.t4 ? element.need_trans_bag_di_32 : 0)
              let t3II = (this.t1 ? element.need_trans_bag_ii_22 : 0) + (this.t2 ? element.need_trans_bag_ii_23 : 0) + (this.t3 ? element.need_trans_bag_ii_33 : 0) + (this.t4 ? element.need_trans_bag_ii_32 : 0)
              let t3ID = (this.t1 ? element.need_trans_bag_id_22 : 0) + (this.t2 ? element.need_trans_bag_id_23 : 0) + (this.t3 ? element.need_trans_bag_id_33 : 0) + (this.t4 ? element.need_trans_bag_id_32 : 0)
              element.a16 = (this.DD ? t3DD : 0) + (this.DI ? t3DI : 0) + (this.II ? t3II : 0) + (this.II ? t3ID : 0)

              let t4DD = (this.t1 ? element.finish_trans_bag_dd_22 : 0) + (this.t2 ? element.finish_trans_bag_dd_23 : 0) + (this.t3 ? element.finish_trans_bag_dd_33 : 0) + (this.t4 ? element.finish_trans_bag_dd_32 : 0)
              let t4DI = (this.t1 ? element.finish_trans_bag_di_22 : 0) + (this.t2 ? element.finish_trans_bag_di_23 : 0) + (this.t3 ? element.finish_trans_bag_di_33 : 0) + (this.t4 ? element.finish_trans_bag_di_32 : 0)
              let t4II = (this.t1 ? element.finish_trans_bag_ii_22 : 0) + (this.t2 ? element.finish_trans_bag_ii_23 : 0) + (this.t3 ? element.finish_trans_bag_ii_33 : 0) + (this.t4 ? element.finish_trans_bag_ii_32 : 0)
              let t4ID = (this.t1 ? element.finish_trans_bag_id_22 : 0) + (this.t2 ? element.finish_trans_bag_id_23 : 0) + (this.t3 ? element.finish_trans_bag_id_33 : 0) + (this.t4 ? element.finish_trans_bag_id_32 : 0)
              element.a17 = (this.DD ? t4DD : 0) + (this.DI ? t4DI : 0) + (this.II ? t4II : 0) + (this.II ? t4ID : 0)

              let t5DD = (this.t1 ? element.not_trans_bag_dd_22 : 0) + (this.t2 ? element.not_trans_bag_dd_23 : 0) + (this.t3 ? element.not_trans_bag_dd_33 : 0) + (this.t4 ? element.not_trans_bag_dd_32 : 0)
              let t5DI = (this.t1 ? element.not_trans_bag_di_22 : 0) + (this.t2 ? element.not_trans_bag_di_23 : 0) + (this.t3 ? element.not_trans_bag_di_33 : 0) + (this.t4 ? element.not_trans_bag_di_32 : 0)
              let t5II = (this.t1 ? element.not_trans_bag_ii_22 : 0) + (this.t2 ? element.not_trans_bag_ii_23 : 0) + (this.t3 ? element.not_trans_bag_ii_33 : 0) + (this.t4 ? element.not_trans_bag_ii_32 : 0)
              let t5ID = (this.t1 ? element.not_trans_bag_id_22 : 0) + (this.t2 ? element.not_trans_bag_id_23 : 0) + (this.t3 ? element.not_trans_bag_id_33 : 0) + (this.t4 ? element.not_trans_bag_id_32 : 0)
              element.a19 = (this.DD ? t5DD : 0) + (this.DI ? t5DI : 0) + (this.II ? t5II : 0) + (this.II ? t5ID : 0)

              element.a18 = (element.a17 * 100 /( element.a16 > 0 ?  element.a16 : 0)).toFixed(2) + '%'



            });
          } else if (this.upid == 8) {
            this.tableData.forEach(element => {
              element.lv = element.lv.toFixed(2)
              element.time = this.dataContent[0] + '至' + this.dataContent[1]
            });
          }
          // setTimeout(() => {
          //   this.initTableData();
          //   this.loading = false;
          // }, 100);
        } else {
          this.page--
          this.loading = false
          this.$message.error('获取表格数据失败')
        }
      } catch (error) {
        this.page--
        this.loading = false
      }
    },
    downFile() {
      if (this.upid == 1) {
        let tableName = this.dataContent[1] + '国航行李BRS扫描数据统计表'
        const table = this.$refs['userTableData'].$el.cloneNode(true)
        const fileName = `${tableName}.xlsx`
        exportToExcel(table, tableName, fileName)
      } else if (this.upid == 2) {
        let tableName = 'Mannual Load扫描数据统计表'
        const table = this.$refs['userTableDatard'].$el.cloneNode(true)
        const fileName = `${tableName}.xlsx`
        exportToExcel(table, tableName, fileName)
      } else if (this.upid == 3) {
        let tableName = '航易行RFID扫描数据统计表'
        const table = this.$refs['TableDatardrfid'].$el.cloneNode(true)
        const fileName = `${tableName}.xlsx`
        exportToExcel(table, tableName, fileName)
      } else if (this.upid == 4) {
        let tableName = '中转四个流向统计表'
        const table = this.$refs['userTableDatas'].$el.cloneNode(true)
        const fileName = `${tableName}.xlsx`
        exportToExcel(table, tableName, fileName)
      } else if (this.upid == 5) {
        let tableName = '中转流向明细统计表'
        const table = this.$refs['transferTableData'].$el.cloneNode(true)
        const fileName = `${tableName}.xlsx`
        exportToExcel(table, tableName, fileName)
      } else if (this.upid == 6) {
        let tableName = '中转行李因素分析统计表'
        const table = this.$refs['transferBaggageTableData'].$el.cloneNode(true)
        const fileName = `${tableName}.xlsx`
        exportToExcel(table, tableName, fileName)
      } else if (this.upid == 7) {
        let tableName = '中转行李比例明细统计表'
        const table =
          this.$refs['baggageProportionTableData'].$el.cloneNode(true)
        const fileName = `${tableName}.xlsx`
        exportToExcel(table, tableName, fileName)
      }else if (this.upid == 8) {
        let tableName = '行李全流程服务水平百分比表'
        const table =
          this.$refs['userTableDataelt'].$el.cloneNode(true)
        const fileName = `${tableName}.xlsx`
        exportToExcel(table, tableName, fileName)
      }
    },
    cellClass({ row, column, rowIndex, columnIndex }) {
      const classes = []
      if (
        column.property.includes('trans_bag') &&
        row[column.property] &&
        Number(row[column.property])
      ) {
        classes.push('cell-click')
      }
      return classes.join(' ')
    },
    cellClickHandler(...payload) {
      this.$emit('cell-click', ...payload)
    }
  },
}
</script>
<style lang="scss" scoped>
::v-deep .el-table {
  .cell-click {
    cursor: pointer;
    color: #2d7cff;
  }
}
</style>
