<div class="row rt-margin-bottom-before-box">
    <div class="col-sm-8">
        <div class="btn-group">
             <button class="btn btn-link"  ng-click='vm.actions.export({
                        "ddm_data_statusName":"状态",
                        "ddm_raw_typeName":"来源",
                        "from_accountidName":"上游企业名称",
                        "from_businessunitidName":"上游部门",
                        "from_owneridName":"上游代表",
                        "to_account_alias_name":"下游企业名称",
                        "to_accountidName":"下游企业标准名",
                        "to_businessunitidName":"下游部门",
                        "to_owneridName":"下游代表",
                        "product_alias_name":"药品名称",
                        "product_alias_size":"药品规格",
                        "productidName": "药品标准名",
                        "product_alias_uom": "计量单位",
                        "product_lotno":"药品批号",
                        "saleto_date":"销售日期",
                        "saleto_price":"销售价格",
                        "saleto_qty":"销售数量"
                        },"DdmLockDataExport","流向数据锁定及下发")'>
                <i class="fa fa-download"></i> 导出
            </button>
            <button class="btn btn-link" ng-show="vm.dataStatus.Value==1"  ng-click="vm.actions.lock()" >
                <i class="fa fa-lock"></i> 锁定及下发流向
            </button>
            <button class="btn btn-link" ng-click="vm.actions.unLock()" ng-show="vm.dataStatus.Value==2"  >
                <i class="fa fa-unlock"></i> 解除锁定
            </button>
        </div>
    </div>
    <div class="col-sm-4">
    </div>
</div>

<div class="box box-primary">
    <div  class="box box-widget">
        <!-- /.box-header -->
        <!-- form start -->
        <form class="form-horizontal">
            <div class="box-body">
                <div class="form-group">
                    <label class="col-sm-2 control-label">按照</label>
                    <div class="col-sm-3">
                        <ui-select allow-clear ng-model="vm.selectedFilter" theme="bootstrap">
                            <ui-select-match>{{$select.selected.Name}}</ui-select-match>
                            <ui-select-choices repeat="item in vm.filterList | filter: $select.search">
                                <span ng-bind-html="item.Name| highlight: $select.search"></span>
                            </ui-select-choices>
                        </ui-select>
                    </div>
                    <div class="col-sm-5"></div>
                    <div class="col-sm-2">
                          <button class="btn btn-primary" style="margin-left: 50px;" rt-col="2" ng-click="vm.search()">查询</button>  
                    </div>
                </div>
                <div class="form-group">
                    <rt-datetime ng-model="vm.yM" rt-type="month" rt-title="年月" rt-required="true" rt-col="3" rt-label-col="2"></rt-datetime>
                    <label class="col-sm-2 control-label"><span style="color:red;">*</span>流向状态</label>
                    <div class="col-sm-3">
                        <ui-select allow-clear ng-model="vm.dataStatus" theme="bootstrap">
                            <ui-select-match>{{$select.selected.Name}}</ui-select-match>
                            <ui-select-choices repeat="item in vm.statusList | filter: $select.search">
                                <span ng-bind-html="item.Name| highlight: $select.search"></span>
                            </ui-select-choices>
                        </ui-select>
                    </div>
                </div>
                <div class="form-group">
                    <rt-lookup2 rt-title="部门" ng-model="vm.businessunitId" rt-get-data-name="TblBusinessUnit.BusinessUnitId" rt-order-by="code"
                        rt-col-list="[{Code:'name',Name:'业务部门名称'},{Code:'code',Name:'业务部门编码'}]" rt-label-col="2" rt-col="3"></rt-lookup2>

                    <rt-lookup2 rt-title="销售代表" ng-model="vm.ownerId" rt-get-data-name="UserInfo.GetUserByBu" rt-order-by="code" rt-col-list="[{Code:'name',Name:'业务代表名称'},{Code:'code',Name:'业务代表编码'}]"
                        rt-params="{'@businessunitid':vm.businessunitId ? vm.businessunitId.Id :''}" rt-disabled="vm.businessunitId==null"
                        rt-label-col="2" rt-col="3"></rt-lookup2>
                </div>
            </div>
        </form>
    </div>
    <div class="nav-tabs-custom">
        <div class="tab-content">
             <rt-data-grid rt-page-record-count="vm.recordCount"  rt-page-index="vm.page.index" rt-page-size="vm.page.size" rt-get-data="vm.search()" rt-rows="vm.data"
            rt-auto-height="{{vm.view.autoHeight}}">
            <table class="table table-hover">
                <thead id="headCode">
                    <tr>
                        <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>销售日期</th>
                        <th>销售价格</th>
                        <th>销售数量</th>
                    </tr>
                </thead>
                <tbody>
                    <tr ng-repeat="row in vm.data track by $index">
                        <td>{{ row.ddm_data_statusName }}</td>
                        <td>{{ row.ddm_raw_typeName }}</td>
                        <td>{{ row.from_accountidName }}</td>
                        <td>{{ row.from_businessunitidName }}</td>
                        <td>{{ row.from_owneridName }}</td>
                        <td>{{ row.to_account_alias_name }}</td>
                        <td>{{ row.to_accountidName }}</td>
                        <td>{{ row.to_businessunitidName }}</td>
                        <td>{{ row.to_owneridName }}</td>
                        <td>{{ row.product_alias_name }}</td>
                        <td>{{ row.product_alias_size }}</td>
                        <td>{{ row.productidName }}</td>
                        <td>{{ row.product_alias_uom }}</td>
                        <td>{{ row.product_lotno }}</td>
                        <td>{{ row.saleto_date | date:'yyyy-MM-dd'}}</td>
                        <td>{{ row.saleto_price }}</td>
                        <td>{{ row.saleto_qty }}</td>
                    </tr>
                </tbody>
            </table>
        </rt-data-grid>
        </div>
    </div>
</div>
