<div class="row rt-margin-bottom-before-box">
    <div class="col-sm-8">
        <div class="btn-group">
            <button class="btn btn-link" data-toggle="sidebar" data-target=".sidebar-right" ng-if="vm.view.type=='default'" ng-show="vm.privilege.IsCreate"
                ui-sref=".edit({id:''})" ui-sref-opts="{location:true}">
                <i class="fa fa-plus"></i> 新建
            </button>
            <button class="btn btn-link" ng-if="vm.view.type=='grid'" ng-click="vm.actions.showForm('')" ng-show="vm.privilege.IsCreate">
                <i class="fa fa-plus"></i> 新建
            </button>
            <button class="btn btn-link" ng-click="vm.actions.del()" ng-show="vm.privilege.IsDelete">
                <i class="fa fa-trash"></i> 删除
            </button>
            <button class="btn btn-link" ng-disabled="false" ng-show="vm.privilege.IsWrite" ng-click='vm.actions.import({
                        Title:"医院开发任务",
                        ModuleName:"DevelopHospital2Import",
                        EntityName:"develop_hospital",
                        Columns:[
                            {ColumnName:"name",DisplayName:"主题*",IsRequired:true,IsKey:false},
                            {ColumnName:"OwnerIdName",DisplayName:"负责人*",IsRequired:true,IsKey:true},
                            {ColumnName:"schedule_start_date",DisplayName:"计划启动日期",IsRequired:false,IsKey:false},
                            {ColumnName:"schedule_end_date",DisplayName:"计划结束日期",IsRequired:false,IsKey:false},
                            {ColumnName:"accountId",DisplayName:"医院",IsRequired:false,IsKey:true},
                            {ColumnName:"agent_customerId",DisplayName:"代理商",IsRequired:false,IsKey:false},
                            {ColumnName:"agent_contactId",DisplayName:"代理商联系人",IsRequired:false,IsKey:false},
                            {ColumnName:"product_categoryId",DisplayName:"药品品类*",IsRequired:true,IsKey:true},
                            {ColumnName:"productId",DisplayName:"药品品规",IsRequired:false,IsKey:false}
                        ]
                    })'>
                <i class="fa fa-upload"></i> 导入
            </button>
            <button class="btn btn-link" ng-show="vm.privilege.IsExport" ng-click='vm.actions.export({
                    "name":"主题",
                    "BusinessUnitIdName":"部门",
                    "OwnerIdName":"负责人",
                    "schedule_startDate":"计划启动日期",
                    "schedule_endDate":"计划结束日期",
                    "accountIdName":"医院",
                    "agent_customerIdName":"代理商",
                    "agent_contactIdName":"代理商联系人",
                    "product_categoryIdName":"药品品类",
                    "productIdName":"药品品规",
                    "develop_statusName":"开发状态",
                    "startDate":"实际启动日期",
                    "develop_current_stepName":"当前阶段",
                    "endDate":"实际结束日期"
                    },"DevelopHospitalExport","医院开发")'>
                <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()">
                <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">
        <h3 class="box-title">筛选</h3>
        <div class="box-tools pull-right">
            <button type="button" class="btn btn-box-tool" data-widget="collapse">
                <i class="fa fa-minus"></i>
            </button>
        </div>
    </div>
    <form class="form-horizontal">
        <div class="box-body">
            <div class="form-group">
                <rt-bu-tree-lookup rt-title="部门" rt-multiple="true" ng-model="vm.nodeSelected" rt-col="3" rt-label-col="2"></rt-bu-tree-lookup>
                <rt-lookup2 rt-title="负责人" ng-model="vm.searchList.OwnerId" rt-get-data-name="UserInfo.GetAllUser" rt-order-by="name asc"
                    rt-col-list="[{Code:'name',Name:'姓名'},{Code:'code',Name:'编号'}]" rt-col="3" rt-label-col="2"></rt-lookup2>
            </div>
            <div class="form-group">
                <rt-datetime ng-model="vm.searchList.ssYm" rt-type="date" rt-title="启动日期-从" rt-col="3" rt-label-col="2">
                </rt-datetime>
                <rt-datetime ng-model="vm.searchList.seYm" rt-type="date" rt-title="启动日期-到" rt-col="3" rt-label-col="2">
                </rt-datetime>
            </div>
            <div class="form-group">
                <rt-datetime ng-model="vm.searchList.esYm" rt-type="date" rt-title="结束日期-从" rt-col="3" rt-label-col="2">
                </rt-datetime>
                <rt-datetime ng-model="vm.searchList.eeYm" rt-type="date" rt-title="结束日期-到" 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.searchList.stepCode" theme="bootstrap">
                        <ui-select-match>{{$select.selected.name}}</ui-select-match>
                        <ui-select-choices repeat="item in vm.stepType | filter:{name:$select.search}">
                            <span ng-bind-html="item.name| highlight: $select.search"></span>
                        </ui-select-choices>
                    </ui-select>
                </div>
            </div>
        </div>
        <div class="box-footer">
            <div class="btn-group pull-right">
                <button type="button" class="btn btn-primary" ng-click="vm.view.search()">查询</button>
            </div>
        </div>
    </form>
</div>

<div class="box box-primary">
    <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>
                                <rt-header-checkbox></rt-header-checkbox>
                            </th>
                            <th>主题</th>
                            <th>部门</th>
                            <th>负责人</th>
                            <th>计划启动日期</th>
                            <th>计划结束日期</th>
                            <th>医院</th>
                            <th>代理商</th>
                            <th>代理商联系人</th>
                            <th>药品品类</th>
                            <th>药品品规</th>
                            <th>开发状态</th>
                            <th>实际启动日期</th>
                            <th>当前阶段</th>
                            <th>实际结束日期</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr ng-repeat="row in vm.data track by row.Id">
                            <td>
                                <rt-data-checkbox value="{{row.Id}}" />
                            </td>
                            <td ng-if="vm.view.type=='default'">
                                <a id="{{row.Id}}" data-toggle="sidebar" data-target=".sidebar-right" ui-sref=".edit({id:row.Id})" ui-sref-opts="{location:true}">{{row.name}}</a>
                            </td>
                            <td ng-if="vm.view.type=='grid'">
                                <a href="javascript:;" ng-click="vm.actions.showForm(row.Id)"> </a>
                            </td>
                            <td>
                                {{ row.BusinessUnitId.Name}}
                            </td>
                            <td>
                                {{ row.OwnerId.Name}}
                            </td>
                            <td>
                                {{ row.schedule_start_date|date:'yyyy-MM-dd'}}
                            </td>
                            <td>
                                {{ row.schedule_end_date|date:'yyyy-MM-dd'}}
                            </td>
                            <td>
                                {{ row.accountId.Name}}
                            </td>
                            <td>
                                {{row.agent_customerId.Name}}
                            </td>
                            <td>
                                {{row.agent_contactId.Name}}
                            </td>
                            <td>
                                {{row.product_categoryId.Name}}
                            </td>
                            <td>
                                {{row.productId.Name}}
                            </td>
                            <td>
                                {{row.develop_status.Name}}
                            </td>
                            <td>
                                {{row.start_date|date:'yyyy-MM-dd'}}
                            </td>
                            <td>
                                {{row.develop_current_step.Name}}
                            </td>
                            <td>
                                {{row.end_date|date:'yyyy-MM-dd'}}
                            </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>