<div class="row rt-margin-bottom-before-box">
    <div class="col-sm-8">
        <div class="btn-group">
            <button class="btn btn-link" ng-show="vm.privilege.IsExport" ng-click='vm.actions.export({
                "BusinessUnitIdName":"部门",
                "assistidname":"协访人",
                "OwnerIdName":"拜访人",
                "done_time":"协访评分时间",
                "start_time":"开始拜访时间",
                "start_addr":"签到地址",
                "end_time":"结束拜访时间",
                "end_addr":"签退地址",
                "accountidName":"客户",
                "contactidName":"沟通对象",
                "VisitPurposes":"拜访目的",
                "communicate_content":"沟通内容"},"VisitAssistanceExport",vm.filterType.name+vm.doneType.name)'>
                <i class="fa fa-download"></i>导出
            </button>
        </div>
    </div>
    <div class="col-sm-4">
        <form class="input-group">
            <input type="search" placeholder="输入代表名称快速搜索..." class="form-control" ng-model="vm.view.searchText" />
            <span class="input-group-btn" ng-click="vm.view.search(1)">
                <button type="submit" class="btn btn-default">
                    <i class="fa fa-search"></i>
                </button>
            </span>
        </form>
    </div>
</div>
<div class="box box-primary">
    <div class="box-header with-border" style="cursor: move;">
        <div class="pull-left">
            <div class="btn-group">
                <button class="btn btn-default dropdown-toggle" id="dropdownMenuBuSelect" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                    {{vm.filterType.name}}
                        <span class="caret"></span>
                </button>
                <ul class="dropdown-menu" aria-labelledby="dropdownMenuBuSelect">
                    <li ng-repeat="item in vm.filterModel" ng-click="vm.filterType = item;vm.view.search(1);"><a href="javascript:void(0)">{{item.name}}</a></li>
                </ul>
            </div>

            <div class="btn-group">
                <button class="btn btn-default dropdown-toggle" id="dropdownMenuBuSelect" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
					{{vm.doneType.name}}
					<span class="caret"></span>
				</button>
                <ul class="dropdown-menu" aria-labelledby="dropdownMenuBuSelect">
                    <li ng-repeat="item in vm.doneModel" ng-click="vm.doneType = item;vm.view.search(1);">
                        <a href="javascript:void(0)">{{item.name}}</a>
                    </li>
                </ul>
            </div>

            <button class="btn btn-default" ng-class="{true:'active',false:'inactive'}[vm.view.isShowSearchList]" ng-click="vm.view.isShowSearchList = !vm.view.isShowSearchList;overHeightTable();">
                <i class="fa fa-filter"></i> 更多筛选 <i class="fa fa-angle-double-down"></i>
            </button>
        </div>
    </div>
    <div ng-show="vm.view.isShowSearchList" class="box box-widget">
        <!-- /.box-header -->
        <!-- form start -->
        <form class="form-horizontal">
            <div class="box-body">
                <div class="form-group">
                    <rt-datetime ng-model="vm.sYm" rt-type="date" rt-title="开始日期" rt-col="3" rt-label-col="2"></rt-datetime>
                    <rt-datetime ng-model="vm.eYm" rt-type="date" rt-title="结束日期" rt-col="3" rt-label-col="2"></rt-datetime>
                    <div class="btn-group" class="col-sm-2">
                        <button class="btn btn-primary" ng-click="vm.view.search(1)">查询</button>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <div class="nav-tabs-custom">
        <div class="tab-content">
            <rt-data-grid rt-page-record-count="vm.page.recordCount"  rt-page-index="vm.page.index" rt-page-size="vm.page.size" rt-get-data="vm.view.search()" rt-sort-field="vm.view.sortField"
                rt-rows="vm.data" rt-selected-ids="vm.view.selectedIds" rt-auto-height="{{vm.view.autoHeight}}">
                <table class="table table-hover">
                    <thead>
                        <tr>
                            <th>协访报告</th>
                            <th rt-field-code="BusinessUnitIdName">部门</th>
                            <th rt-field-code="assistidname">协访人</th>
                            <th rt-field-code="OwnerIdName">拜访人</th>
                            <th rt-field-code="done_time">协访评分时间</th>
                            <th>开始拜访时间</th>
                            <th rt-field-code="start_addr">签到地址</th>
                            <th>结束拜访时间</th>
                            <th rt-field-code="end_addr">签退地址</th>
                            <th rt-field-code="accountidName">客户</th>
                            <th rt-field-code="contactidName">沟通对象</th>
                            <th>拜访目的</th>
                            <th>沟通内容</th>
                            <th>照片</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr ng-repeat="row in vm.data track by row.Id">
                            <td ng-if="vm.view.type=='default'">
                                <a href="javascript:;" ng-click="vm.actions.showEditView(row.Id)">协访报告</a>
                            </td>
                            <td ng-if="vm.view.type=='grid'">
                                <a href="javascript:;" ng-click="vm.actions.showForm(row.Id)"> </a>
                            </td>
                            <td>
                                {{row.BusinessUnitIdName}}
                            </td>
                            <td>
                                {{row.assistidname}}
                            </td>
                            <td>
                                {{row.OwnerIdName}}
                            </td>
                            <td>
                                {{row.done_time | date: 'yyyy-MM-dd HH:mm'}}
                            </td>
                            <td>
                                {{row.start_time | date: 'yyyy-MM-dd HH:mm'}}
                            </td>
                            <td>{{row.start_addr}}</td>
                            <td>
                                {{row.end_time | date: 'yyyy-MM-dd HH:mm'}}
                            </td>
                            <td>{{row.end_addr}}</td>
                            <td>
                                {{row.accountidName}}
                            </td>
                            <td>
                                {{row.contactidName}}
                            </td>
                            <td>
                                <span ng-repeat="purpose in row.VisitPurpose track by $index">
								{{purpose.Name}}
							</span>
                            </td>
                            <td>
                                {{row.communicate_content}}
                            </td>
                            <td>
                                <a href="javascript:;" ng-click="vm.showImage(row.visit_recordId)">浏览</a>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </rt-data-grid>
        </div>
    </div>
</div>