<div class="listview">
    <div class="row">
        <div class="col-sm-1">
            <rt-button id="btnClose" rt-style="link" rt-title="关闭" rt-icon="times" ng-click="vm.actions.close($event)"></rt-button>
        </div>
        <div class="col-sm-offset-3 col-sm-8 text-right">
            <rt-button id="btnCreate" rt-style="link" rt-title="新建科室" rt-icon="plus" ng-click="vm.actions.showCreateDialog($event)"></rt-button>
            <rt-button id="btnConfirm" rt-style="link" ng-if="vm.selectType === 'multiple'" rt-title="确认" rt-icon="check" ng-click="vm.actions.confirm($event)"></rt-button>
        </div>
    </div>

    <div class="row">
        <form ng-class="{true: 'col-sm-8', false: 'col-sm-12'}[vm.selectType === 'multiple']">
            <div 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>
            </div>
            <div class="viewlist">
                <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-is-single-selected="true"
                    rt-auto-height="{{vm.view.autoHeight}}">
                    <table class="table table-condensed table-hover">
                        <thead>
                            <tr>
                                <th ng-repeat="col in vm.colList">{{col.Name}}</th>
                                <th></th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr ng-repeat="row in vm.data track by row.id">
                                <td ng-repeat="col in vm.colList">
                                    <span ng-if="col.Format=='number:0'">{{row[col.Code] | number:0}}</span>
                                    <span ng-if="col.Format=='number:1'">{{row[col.Code] | number:1}}</span>
                                    <span ng-if="col.Format=='number:2'">{{row[col.Code] | number:2}}</span>
                                    <span ng-if="col.Format=='yyyy-MM-dd HH:mm'">{{row[col.Code] | date: 'yyyy-MM-dd HH:mm'}}</span>
                                    <span ng-if="col.Format=='yyyy-MM-dd'">{{row[col.Code] | date: 'yyyy-MM-dd'}}</span>
                                    <span ng-if="!col.Format">{{row[col.Code]}}</span>
                                </td>
                                <td>
                                    <rt-data-checkbox value="{{row['id']}}" ng-hide="true" />
                                    <button class="btn btn-link" ng-click="vm.actions.select(row)">选择</button>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </rt-data-grid>
            </div>
        </form>
        <div class="col-sm-4">
            <div class="box" ng-if="vm.selectType === 'multiple'">
                <div class="box-body">
                    已选择项：
                    <span ng-repeat="row in vm.view.selectedRows track by row.Id ">
                        <span class="label label-default " style="display: inline-block; ">
                            {{row.Name}}
                            <a href="javascript:;" ng-click="vm.actions.remove(row)">
                                <i class="fa fa-times"></i>
                            </a>
                        </span>
                    </span>
                </div>
            </div>
        </div>
    </div>
</div>