<style>
    .form-group .control-label {
        font-weight: 500;
        color: #555;
    }

    #rt-report-header>thead>tr>th {
        text-align: center;
        vertical-align: inherit;
        border: 1px solid #f0f0f0;
        color: #555;
        font-weight: 500;
        white-space: nowrap;
    }

    #rt-report-header>tbody>tr>td {
        text-align: center;
        vertical-align: inherit;
        border: 1px solid #f0f0f0;
        color: #555;
        font-weight: 500;
        white-space: nowrap;
    }
</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.getReportData()">查询</button>
        </div>
        <div class="col-sm-1">
            <button class="btn btn-primary" ng-click='vm.actions.export({
                        },"OwnerPureVenditionExport","按代表纯销统计")'>导出</button>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label">
            <span style="color:red;">*</span>事业部</label>
        <div class="col-sm-8">
            <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>
        <div class="col-sm-1">
            <button class="btn btn-clear btn-small" ng-click="vm.isShowMoreSearch = !vm.isShowMoreSearch;complateTableheight();">
                <i ng-if="!vm.isShowMoreSearch" class="fa fa-angle-double-down" style="color:#0099ff;" title="更多查询条件"></i>
                <i ng-if="vm.isShowMoreSearch" class="fa fa-angle-double-up" style="color:#0099ff;" title="隐藏"></i>
            </button>
        </div>
    </div>
    <div class="form-group" ng-hide="!vm.isShowMoreSearch">
        <label class="col-sm-2 control-label">
            <span style="color:red;"></span>业务线/大区</label>
        <div class="col-sm-8">
            <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.isShowMoreSearch">
        <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>
    <div class="form-group" ng-hide="!vm.isShowMoreSearch">
        <rt-lookup2 rt-label-col="2" rt-title="产品名称" ng-model="vm.productSelected" rt-get-data-name="Product.GetProductSize" rt-order-by="name asc"
            rt-col-list="[{Code:'name',Name:'产品名称'},{Code:'size',Name:'规格'},{Code:'code',Name:'产品编码'}]" rt-multiple="true"
            rt-col="8"></rt-lookup2>
    </div>
</form>
<div class="row">
    <rt-data-grid rt-page-record-count="vm.recordCount" rt-page-index="vm.pageIndex" rt-page-size="vm.pageSize" rt-get-data="vm.getReportData()"
        rt-rows="vm.reportData" 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="4">
                        省区/地区
                    </th>
                    <th rowspan="4">
                        省区经理
                    </th>
                    <th rowspan="4">
                        代表
                    </th>
                    <th rowspan="4">
                        产品名称
                    </th>
                    <th rowspan="4">
                        规格
                    </th>
                    <th colspan="2" align="center" ng-repeat="item in vm.MonDataList">{{item}} 月</th>
                </tr>
                <tr>
                    <th align="center" ng-repeat="Mtext in vm.TbMessText track by $index">{{Mtext}}
                    </th>
                </tr>
            </thead>
            <tbody>
                <tr ng-repeat="row in vm.reportData.DataList ">
                    <td>{{row.businessunitidname}}</td>
                    <td>{{row.ParentSystemUserIdName}}</td>
                    <td>{{row.owneridname}}</td>
                    <td>{{row.productidname}}</td>
                    <td>{{row.productsize}}</td>
                    <td ng-repeat="Items in row.monthList track by $index" align="center">{{Items}}
                    </td>
                </tr>
            </tbody>
        </table>
    </rt-data-grid>
</div>