<style>
    .form-group .control-label {
        font-weight: 500;
        color: #555;
    }
    
    #rt-report-header th {
        text-align: center;
        vertical-align: inherit;
        border: 1px solid #f0f0f0;
        color: #555;
        font-weight: 500;
    }
    
    #rt-report-header tr,
    td {
        text-align: center;
        vertical-align: inherit;
        border: 1px solid #f0f0f0;
        color: #555;
        font-weight: 500;
    }
</style>
<form class="form-horizontal">
    <div class="form-group">
        <rt-datetime ng-model="vm.sYm" rt-type="month" rt-title="开始年月" rt-required="true" rt-col="3" rt-label-col="2"></rt-datetime>
        <rt-datetime ng-model="vm.eYm" rt-type="month" rt-title="结束年月" rt-required="true" rt-col="3" rt-label-col="2"></rt-datetime>
        <div class="col-sm-1">
            <button class="btn btn-primary" ng-click="vm.search()">查询</button>
        </div>
        <div class="col-sm-1">
            <button class="btn btn-primary" ng-click='vm.actions.export({},"BackSectionExport","整体回款报表")'>
                   导出
                </button>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label"><span style="color:red;">*</span>Top</label>
        <div class="col-sm-3">
            <ui-select allow-clear ng-model="vm.topsSelected" theme="bootstrap">
                <ui-select-match>{{$select.selected}}</ui-select-match>
                <ui-select-choices repeat="item in vm.topsList | filter: $select.search">
                    <span ng-bind-html="item| highlight: $select.search"></span>
                </ui-select-choices>
            </ui-select>
        </div>
        <label class="col-sm-2 control-label"><span style="color:red;">*</span>排序方式</label>
        <div class="col-sm-3">
            <ui-select allow-clear ng-model="vm.orderCode" theme="bootstrap">
                <ui-select-match>{{$select.selected.name}}</ui-select-match>
                <ui-select-choices repeat="item in vm.OrderList | filter:{name:$select.search}">
                    <span ng-bind-html="item.name| highlight: $select.search"></span>
                </ui-select-choices>
            </ui-select>
        </div>
        <div class="col-sm-1">
            <button class="btn btn-clear btn-small" ng-click="vm.searchFormHide = !vm.searchFormHide;complateTableheight();">
                            <i ng-if="vm.searchFormHide" class="fa fa-angle-double-down" style="color:#0099ff;" title="更多查询条件"></i>
                            <i ng-if="!vm.searchFormHide" class="fa fa-angle-double-up" style="color:#0099ff;"  title="隐藏"></i>
                        </button>
        </div>
    </div>
    <div class="form-group" ng-hide="vm.searchFormHide">
        <label class="col-sm-2 control-label"><span style="color:red;"></span>事业部</label>
        <div class="col-sm-3">
            <ui-select allow-clear ng-model="vm.buidSelected" theme="bootstrap">
                <ui-select-match>{{ $select.selected.name }}</ui-select-match>
                <ui-select-choices repeat="item in vm.buidList|filter:$select.search">
                    <span ng-bind-html="item.name | highlight: $select.search"></span>
                </ui-select-choices>
            </ui-select>
        </div>
        <label class="col-sm-2 control-label"><span style="color:red;"></span>业务线/大区</label>
        <div class="col-sm-3">
            <ui-select allow-clear ng-model="vm.bigDepSelected" theme="bootstrap">
                <ui-select-match>{{ $select.selected.name }}</ui-select-match>
                <ui-select-choices repeat="item in vm.bigDepList |filter:$select.search">
                    <span ng-bind-html="item.name | highlight: $select.search"></span>
                </ui-select-choices>
            </ui-select>
        </div>
    </div>
    <div class="form-group" ng-hide="vm.searchFormHide">
        <label class="col-sm-2 control-label">省区/地区</label>
        <div class="col-sm-8">
            <ui-select class="form" multiple allow-clear sortable="true" theme="bootstrap" close-on-select="false" ng-model="vm.businessUnitSelected">
                <ui-select-match>{{$item.name}}</ui-select-match>
                <ui-select-choices repeat="item in vm.businessUnitList | filter: {name: $select.search}">
                    <span ng-bind-html="item.name | highlight: $select.search"></span>
                </ui-select-choices>
            </ui-select>
        </div>
    </div>
</form>

<ul class="nav nav-tabs">
    <li class="active" ng-click="selectTab('tab1')">
        <a href="#c1" onclick="return false;" data-toggle="tab">整体回款累计达成率排名</a>
    </li>
    <li ng-click="selectTab('tab2')">
        <a href="#c2" onclick="return false;" data-toggle="tab">整体回款达成额排名</a>
    </li>
    <li ng-click="selectTab('tab3')">
        <a href="#c3" onclick="return false;" data-toggle="tab">整体回款达成列表</a>
    </li>
</ul>

<div class="tab-content">
    <div class="tab-pane active" id="c1">
        <div id="report1" style="height:600px;" ng-style="{ width: chartWidth + 'px',height: (vm.topsSelected * 50) + 'px' }" />
    </div>
    <div class="tab-pane" id="c2">
        <div id="report2" style="height:600px;" ng-style="{ width: chartWidth + 'px',height: (vm.topsSelected * 50) + 'px' }" />
    </div>

    <!-- div[.btn-group] -->
    <div class="tab-pane" id="c3" style="border-top: 1px dotted #d5c4c4; padding-top: 20px;">

        <rt-data-grid rt-page-record-count="vm.recordCount" rt-page-index="vm.pageIndex" rt-page-size="vm.pageSize" rt-get-data="vm.search()" rt-rows="vm.data"
            rt-auto-height="{{tableMaxHeight}}">
            <table class="table table-condensed table-hover ng-scope" style="white-space:nowrap;" id="rt-report-header">
                <thead>
                    <tr>
                        <th rowspan="3">事业部</th>
                        <th rowspan="3">业务线/大区</th>
                        <th rowspan="3">省区/地区</th>
                        <th rowspan="3">负责人</th>
                        <th rowspan="3">累计达成额</th>
                        <th rowspan="3">达成额排名</th>
                        <th rowspan="3">累计达成率</th>
                        <th rowspan="3">达成率排名</th>
                        <td colspan="3" align="center" ng-repeat="item in vm.MonDataList">{{item}} 月</td>
                    </tr>
                    <tr>
                        <td style="border-top: 1px solid #150202;" align="center" ng-repeat="Mtext in vm.TbMessText track by $index">{{Mtext}}</td>
                    </tr>
                </thead>
                <tbody>
                    <tr ng-repeat="row in vm.dataTable ">
                        <td>{{row.BuIdName}}</td>
                        <td>{{row.BigDeptIdName}}</td>
                        <td>{{row.BusinessUnitIdName}}</td>
                        <td>{{row.OwnerIdName}}</td>
                        <td>{{row.ToTal_All|toFixNumber:2}}</td>
                        <td>{{row.SUM_Rank}}</td>
                        <td>{{row.ToTal_AVG|toFixNumber:2 }}%</td>
                        <td>{{row.AVG_Rank}}</td>
                        <td style="border-top: 1px solid #150202;" ng-repeat="Items in row.monthList track by $index" align="center">
                            <span ng-if="$index%3===0">{{Items}}</span>
                            <span ng-if="$index%3===1">{{Items}}</span>
                            <span ng-if="$index%3===2">{{Items}}%</span>
                        </td>
                    </tr>

                </tbody>
            </table>
        </rt-data-grid>
    </div>
</div>