<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-click="vm.actions.activate()" ng-show="vm.privilege.IsWrite">
                <i class="fa fa-check"></i> 激活
            </button>
            <button class="btn btn-link" ng-click="vm.actions.deactivate()" ng-show="vm.privilege.IsWrite">
                <i class="fa fa-ban"></i> 停用
            </button>
            <button class="btn btn-link" ng-disabled="false" ng-show="vm.privilege.IsWrite" ng-click='vm.actions.import({
                    Title:"商业返利",
                    ModuleName:"AccountRebateRateImport",
                    EntityName:"account_rebate_rate",
                    Columns:[
                        {ColumnName:"from_accountid",DisplayName:"商业名称*#",IsRequired:true,IsKey:true},
                        {ColumnName:"start_date",DisplayName:"生效日期*#",IsRequired:true,IsKey:true},
                        {ColumnName:"end_date",DisplayName:"失效日期*#",IsRequired:true,IsKey:true},
                        {ColumnName:"to_accountid",DisplayName:"医院名称*#",IsRequired:true,IsKey:true},
                        {ColumnName:"productid",DisplayName:"产品名称*#",IsRequired:true,IsKey:false},
                        {ColumnName:"product_size",DisplayName:"规格*#",IsRequired:true,IsKey:true},
                        {ColumnName:"rebate_rate",DisplayName:"系数*",IsRequired:true,IsKey:false},
                        {ColumnName:"remarks",DisplayName:"备注",IsRequired:true,IsKey:false}
                    ],
                })'>
                <i class="fa fa-upload"></i> 导入
            </button>
            <button class="btn btn-link" ng-show="vm.privilege.IsExport" ng-click='vm.actions.export({
                "from_accountidName":"商业名称",
                "start_date":"生效日期",
                "end_date":"失效日期",
                "to_accountidName":"医院名称",
                "productidName":"产品名称",
                "product_size":"规格",
                "rebate_rate":"系数",
                "remarks":"备注"
                })'>
                <i class="fa fa-download"></i> 导出
            </button>

        </div>
    </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-datetime ng-model="vm.searchList.sYm" rt-type="date" rt-title="开始日期" rt-col="3" rt-label-col="2">
                </rt-datetime>
                <rt-datetime ng-model="vm.searchList.eYm" rt-type="date" rt-title="结束日期" rt-col="3" rt-label-col="2">
                </rt-datetime>
                <button class="btn btn-primary" ng-click="vm.view.search(1)">查询</button>
            </div>
            <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.fromAccId" rt-get-data-name="Account.GetAllBusiness" rt-order-by="accountnumber"
                    rt-col-list="[{Code:'name',Name:'客户名称'},{Code:'accountnumber',Name:'客户编码'}]" rt-label-col="2" rt-col="3"></rt-lookup2>
            </div>
            <div class="form-group">
                <rt-lookup2 rt-title="医院" ng-model="vm.searchList.toAccId" rt-get-data-name="Account.GetHospital" rt-order-by="accountnumber"
                    rt-col-list="[{Code:'name',Name:'客户名称'},{Code:'accountnumber',Name:'客户编码'}]" rt-label-col="2" rt-col="3"></rt-lookup2>
                <rt-lookup2 rt-title="产品名称" rt-disabled="vm.form.data.StateCode.Value == 1" ng-model="vm.searchList.productId" rt-get-data-name="Product.GetProduct"
                    rt-order-by="name" rt-col-list="[{Code:'name',Name:'产品名称'},{Code:'code',Name:'产品编码'}]" rt-col="3"></rt-lookup2>
            </div>
            <div class="form-group">
                <rt-picklist rt-title="状态" rt-col="3" ng-model="vm.stateSelected" rt-options="vm.picklist.StateCode"></rt-picklist>
            </div>
        </div>
    </form>
</div>
<div class="box box-primary">
    <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-condensed table-hover">
                <thead>
                    <tr>
                        <th>
                            <rt-header-checkbox></rt-header-checkbox>
                        </th>
                        <!-- @@ 视图表头 -->
                        <th rowspan="2">商业名称</th>
                        <th rowspan="2">生效日期</th>
                        <th rowspan="2">失效日期</th>
                        <th rowspan="2">医院名称</th>
                        <th rowspan="2">产品名称</th>
                        <th rowspan="2">规格</th>
                        <th rowspan="2">系数</th>
                        <th rowspan="2">备注</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.from_accountid.Name}}</a>
                        </td>
                        <td ng-if="vm.view.type=='grid'">
                            <a href="javascript:;" ng-click="vm.actions.showForm(row.Id)">{{row.from_accountid.Name}}</a>
                        </td>
                        <!-- @@ 视图列表值 -->
                        <td>
                            {{row.start_date | date:'yyyy-MM-dd'}}
                        </td>
                        <td>
                            {{row.end_date | date:'yyyy-MM-dd'}}
                        </td>
                        <td>
                            {{ row.to_accountid.Name}}
                        </td>
                        <td>
                            {{row.productid.Name}}
                        </td>
                        <td>
                            {{row.product_size}}
                        </td>
                        <td>
                            {{row.rebate_rate}}
                        </td>
                        <td>
                            {{row.remarks}}
                        </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>