<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.Ym" rt-type="month" rt-title="年月" rt-required="true" rt-col="3" rt-label-col="2"></rt-datetime>
    </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>

        <label class="col-sm-2 control-label">代表启用状态</label>
        <div class="col-sm-3">
            <ui-select allow-clear ng-model="vm.statecodeSelected" theme="bootstrap">
                <ui-select-match>{{ $select.selected.Name }}</ui-select-match>
                <ui-select-choices repeat="item in vm.statecode|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 class="col-sm-1">
            <button class="btn btn-primary" ng-click="vm.showReportButton()">查询</button>
        </div>
        <div class="col-sm-1" ng-show="vm.isShow=='detail'">
            <button class="btn btn-primary" ng-click='vm.actions.export({
                        "buName":"事业部",
                        "deptName":"业务线/大区",
                        "BusinessUnitIdName":"地区",
                        "OwnerIdName":"负责人",
                        "Position":"职位",
                        "type":"类型",
                        "accountidName":"客户名",
                        "accountnumber":"客户编码",
                        "departmentidName":"科室名称",
                        "contactidName":"联系人",
                        "contactnumber":"联系人编码",
                        "isTop":"是否TOP10医生",
                        "isHotAccount":"是否核心医院",
                        "planTimeFormat":"计划开始时间",
                        "startTimeFormat":"实际开始时间",
                        "endTimeFormat":"实际结束时间"
                        },"VisitDetailsReportExport","拜访明细查询(按医生)_拜访明细")'>导出
            </button>
        </div>
        <div class="col-sm-1" ng-show="vm.isShow=='category'">
            <button class="btn btn-primary" ng-click='vm.actions.export({
                        "buName":"事业部",
                        "deptName":"业务线/大区",
                        "BusinessUnitIdName":"地区",
                        "OwnerIdName":"负责人",
                        "Position":"职位",
                        "type":"类型",
                        "accountidName":"客户名",
                        "accountnumber":"客户编码",
                        "departmentidName":"科室名称",
                        "contactidName":"联系人",
                        "contactnumber":"联系人编码",
                        "isTop":"是否TOP10医生",
                        "isHotAccount":"是否核心医院",
                        "planTimeFormat":"计划开始时间",
                        "startTimeFormat":"实际开始时间",
                        "endTimeFormat":"实际结束时间",
                        "product_categoryName":"药品品类",
                        "promote_information":"传递信息"
                        },"VisitCategoryReportExport","拜访明细查询(按医生)_传递药品明细")'>导出
            </button>
        </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>

<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>

</ul>

<div class="tab-content">
    <div class="row" ng-show="vm.isShow=='detail'">
        <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" id="rt-report-header">
                    <thead>
                        <tr class="table table-condensed table-hover ng-scope" style="white-space: nowrap;">
                            <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>科室名称</th>
                            <th class="rt-align-left">联系人</th>
                            <th class="rt-align-left">联系人编码</th>
                            <th>是否TOP10医生</th>
                            <th>是否核心医院</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>{{row.departmentidName}}</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.isTop}}</td>
                            <td>{{row.account_grade_level == 1 ? "是":"否"}}</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="row" ng-show="vm.isShow=='category'">
        <div class="col-sm-30">
            <rt-data-grid rt-page-record-count="vm.categoryCount" rt-get-data="vm.showReport()" rt-page-index="vm.index" rt-page-size="vm.pageSize" rt-rows="vm.categoryInfo">
                <table class="table table-hover" id="rt-report-header">
                    <thead>
                        <tr class="table table-condensed table-hover ng-scope" style="white-space: nowrap;">
                            <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>科室名称</th>
                            <th class="rt-align-left">联系人</th>
                            <th class="rt-align-left">联系人编码</th>
                            <th>是否TOP10医生</th>
                            <th>是否核心医院</th>
                            <th>计划开始时间</th>
                            <th>实际开始时间</th>
                            <th>实际结束时间</th>
                            <th class="rt-align-left">药品品类</th>
                            <th class="rt-align-left">传递信息</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr ng-repeat="row in vm.categoryInfo">
                            <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>{{row.departmentidName}}</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.isTop}}</td>
                            <td>{{row.account_grade_level == 1 ? "是":"否"}}</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>
                            <td style="text-align: left;">{{row.product_categoryName == null ? "-" : row.product_categoryName}}</td>
                            <td style="text-align: left;">{{row.promote_information == null ? "-" : row.promote_information}}</td>
                        </tr>
                    </tbody>
                </table>
            </rt-data-grid>
        </div>
    </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] -->