<div class="row rt-margin-bottom-before-box">
    <div class="col-sm-8">
        <div class="btn-group">
            <button class="btn btn-link" ng-disabled="false" ng-show="vm.privilege.IsWrite" ng-click='vm.actions.import({
                            Title:"商业库存数据",
                            ModuleName:"AccountInvImport",
                            EntityName:"account_inv",
                            Columns:[
                                {ColumnName:"accountnumber",DisplayName:"商业编码",IsRequired:false,IsKey:false},
                                {ColumnName:"accountid",DisplayName:"商业名称*",IsRequired:true,IsKey:false},
                                {ColumnName:"BusinessUnitId",DisplayName:"部门*",IsRequired:true,IsKey:false},
                                {ColumnName:"OwnerId",DisplayName:"负责人*",IsRequired:true,IsKey:false},
                                {ColumnName:"productid",DisplayName:"药品名称*",IsRequired:true,IsKey:false},
                                {ColumnName:"productsize",DisplayName:"药品规格*",IsRequired:true,IsKey:false},
                                {ColumnName:"inv_count",DisplayName:"库存数量*",IsRequired:true,IsKey:false},
                                {ColumnName:"inv_date",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({
                        "year":"上传年份",
                        "month":"上传月份",
                        "accountnumber":"商业编码",
                        "accountidName":"商业名称*",
                        "acc_levelName":"商业级别",
                        "account_BusinessUnitIdName":"省区/地区",
                        "provinceidName":"省份",
                        "cityidName":"城市",
                        "countyidName":"区县",
                        "OwnerIdName":"负责人*",
                        "productidName":"药品名称*",
                        "productsize":"药品规格*",
                        "inv_count":"库存数量*",
                        "inv_date":"统计日期*|datetime|yyyy/MM/dd"
                        })'>
                    <i class="fa fa-download"></i> 导出
                </button>
            <button class="btn btn-link" ng-click="vm.actions.del()" ng-show="vm.privilege.IsDelete">
                    <i class="fa fa-trash"></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="dropdownMenuViewSelect" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                    {{vm.view.selectedView.ViewName}}
                </button>
            </div>
            <div class="btn-group">
                <button class="btn btn-default dropdown-toggle" id="dropdownMenuBuSelect" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                        {{vm.buidSelected==null?"所有事业部":vm.buidSelected.name}}
                        <span class="caret"></span>
                </button>
                <ul class="dropdown-menu" aria-labelledby="dropdownMenuBuSelect">
                    <li ng-click="vm.buidSelected = null;"><a href="javascript:void(0)">所有事业部</a></li>
                    <li ng-repeat="item in vm.buidList" ng-click="vm.buidSelected = item;"><a href="javascript:void(0)">{{item.name}}</a></li>
                </ul>
            </div>
            <div class="btn-group">
                <button class="btn btn-default dropdown-toggle" id="dropdownMenuBigDepartSelect" data-toggle="dropdown" aria-haspopup="true"
                    aria-expanded="false">
                        {{vm.bigDepSelected==null?"所有业务线/大区":vm.bigDepSelected.name}}
                        <span class="caret"></span>
                </button>
                <ul class="dropdown-menu" aria-labelledby="dropdownMenuBigDepartSelect">
                    <li ng-click="vm.bigDepSelected = null;"><a href="javascript:void(0)">所有业务线/大区</a></li>
                    <li ng-repeat="item in vm.bigDepList" ng-click="vm.bigDepSelected = item;"><a href="#">{{item.name}}</a></li>
                </ul>
            </div>
            <button class="btn btn-default" ng-click="vm.view.isShowSearchList = !vm.view.isShowSearchList;overHeightTable();" ng-class="{true:'active',false:'inactive'}[vm.view.isShowSearchList]">
                <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">
        <!-- form start -->
        <form class="form-horizontal">
            <div class="box-body">
                <div class="form-group">
                    <rt-datetime ng-model="vm.sYm" rt-type="month" rt-title="开始年月" rt-col="3" rt-label-col="2"></rt-datetime>
                    <rt-datetime ng-model="vm.eYm" rt-type="month" 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-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 class="col-sm-2">
                        <button class="btn btn-primary" ng-click="vm.view.search(1)">查询</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.productSelected">
                            <ui-select-match>{{$item.Name}}</ui-select-match>
                            <ui-select-choices repeat="item in vm.productList | filter: {Name: $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">
                        <input type="search" placeholder="请输入商业名称" class="form-control" ng-model="vm.accountName" />
                    </div>
                    <label class="col-sm-2 control-label">负责人名称</label>
                    <div class="col-sm-3">
                        <input type="search" placeholder="请输入负责人" class="form-control" ng-model="vm.ownerIdName" />
                    </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-condensed table-hover" style="margin-bottom: 0px;">
                    <thead>
                        <tr>
                            <th>
                                <rt-header-checkbox></rt-header-checkbox>
                            </th>
                            <th>所属年月</th>
                            <th rt-field-code="OwnerIdName">负责人</th>
                            <th>省市县</th>
                            <th rt-field-code="accountidName">商业名称</th>
                            <th rt-field-code="accountnumber">商业编码</th>
                            <th rt-field-code="acc_level">商业级别</th>
                            <th rt-field-code="account_BusinessUnitIdName">省区/地区</th>
                            <th rt-field-code="productidName">药品名称</th>
                            <th>药品规格</th>
                            <th rt-field-code="inv_count">库存数量</th>
                            <th rt-field-code="inv_date">统计日期</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr ng-repeat="row in vm.data">
                            <td>
                                <rt-data-checkbox value="{{row.Id}}" />
                            </td>
                            <td>{{ row.year+'-'+row.month }}</td>
                            <td>{{ row.OwnerId.Name}}</td>
                            <td>{{ row.provinceid.Name}}{{row.cityid.Name}}{{row.countyid.Name}}</td>
                            <td>{{ row.accountid.Name}}</td>
                            <td>{{ row.accountnumber}}</td>
                            <td>{{ row.acc_levelName}}</td>
                            <td>{{ row.account_BusinessUnitId.Name}}</td>
                            <td>{{ row.productid.Name}}</td>
                            <td>{{ row.productsize}}</td>
                            <td>{{ row.inv_count}}</td>
                            <td>{{ row.inv_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>
<!-- div[.editview] -->