<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,
    #rt-report-header 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.Ym" 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.showReportButton()">查询</button>
        </div>
        <div class="col-sm-1">
            <button class="btn btn-primary" ng-click='vm.actions.export({
                        "buName":"事业部",
                        "deptName":"业务线/大区",
                        "BusinessUnitIdName":"地区",
                        "OwnerIdName":"负责人",
                        "Position":"职位",
                        "type":"类型",
                        "accountidName":"客户名",
                        "accountnumber":"客户编码",
                        "account_grade_levelName":"客户等级",
                        "contactidName":"联系人",
                        "contactnumber":"联系人编码",
                        "planTimeFormat":"计划开始时间",
                        "startTimeFormat":"实际开始时间",
                        "endTimeFormat":"实际结束时间"
                        },"OTCVisitDetailsReportExport","拜访明细查询(OTC)")'>导出
            </button>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label">职位</label>
        <div class="col-sm-3">
            <ui-select allow-clear ng-model="vm.positionSelected" theme="bootstrap">
                <ui-select-match>{{ $select.selected.name }}</ui-select-match>
                <ui-select-choices repeat="item in vm.position|filter:$select.search">
                    <span ng-bind-html="item.name | highlight: $select.search"></span>
                </ui-select-choices>
            </ui-select>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label">事业部</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">业务线/大区</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">
        <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>

<div class="row" style="border-top: 1px dotted #d5c4c4; padding-top:20px">
    <div class="col-sm-30">
        <rt-data-grid rt-page-record-count="vm.recordCount" rt-get-data="vm.showReport()" rt-page-index="vm.index" rt-page-size="vm.pageSize"
            rt-rows="vm.reportData">
            <table class="table table-hover">
                <thead>
                    <tr style="white-space: nowrap;" id="rt-report-header">
                        <th class="rt-align-left">事业部</th>
                        <th class="rt-align-left">大区</th>
                        <th class="rt-align-left">地区</th>
                        <th class="rt-align-left">负责人</th>
                        <th class="rt-align-left">职位</th>
                        <th>类型</th>
                        <th class="rt-align-left">客户名</th>
                        <th class="rt-align-left">客户编码</th>
                        <th class="rt-align-left">客户等级</th>
                        <th class="rt-align-left">联系人</th>
                        <th class="rt-align-left">联系人编码</th>
                        <th>计划开始时间</th>
                        <th>实际开始时间</th>
                        <th>实际结束时间</th>
                    </tr>
                </thead>
                <tbody>
                    <tr ng-repeat="row in vm.reportData">
                        <td class="rt-align-left">
                            {{row.buName == null ? "-" : row.buName}}
                        </td>
                        <td class="rt-align-left">
                            {{row.deptName == null ? "-" : row.deptName}}
                        </td>
                        <td class="rt-align-left">
                            {{row.BusinessUnitIdName == null ? "-" : row.BusinessUnitIdName}}
                        </td>
                        <td class="rt-align-left">
                            {{row.OwnerIdName == null ? "-" : row.OwnerIdName}}
                        </td>
                        <td class="rt-align-left">
                            {{row.Position == null ? "-" : row.Position}}
                        </td>
                        <td>{{row.type}}</td>
                        <td class="rt-align-left">{{row.accountidName == null ? "-" : row.accountidName}}</td>
                        <td class="rt-align-left">{{row.accountnumber==null?"-":row.accountnumber}}</td>
                        <td class="rt-align-left">{{row.account_grade_levelName==null?"-":row.account_grade_levelName}}</td>
                        <td class="rt-align-left">{{row.contactidName == null ? "-" : row.contactidName}}</td>
                        <td class="rt-align-left">{{row.contactnumber==null?"-":row.contactnumber}}</td>
                        <td>{{row.plan_time == null ? "-" : row.plan_time | date:'yyyy-MM-dd HH:mm'}}</td>
                        <td>{{row.start_time == null ? "-" : row.start_time | date:'yyyy-MM-dd HH:mm'}}</td>
                        <td>{{row.end_time == null ? "-" : row.end_time | date:'yyyy-MM-dd HH:mm'}}</td>
                    </tr>
                </tbody>
            </table>
        </rt-data-grid>
    </div>
</div>

<div class="sidebar sidebar-right sidebar-animate rt-shadow-border-left content-wrapper" ng-if="vm.view.type=='default'">
    <div ui-view class="content"></div>
</div>
<!-- div[.editview] -->