<form class="form-horizontal">
    <div class="form-group" ng-if="vm.isShowBack">
        <div class="col-sm-1">
            <button class="btn btn-primary" ng-click="goBack()">返回上一页</button>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-1 control-label">筛选模式</label>
        <div class="col-sm-3">
            <ui-select allow-clear ng-model="vm.selectedMode" theme="bootstrap">
                <ui-select-match>{{$select.selected.Name}}</ui-select-match>
                <ui-select-choices repeat="item in vm.modeList | filter: $select.search">
                    <span ng-bind-html="item.Name| highlight: $select.search"></span>
                </ui-select-choices>
            </ui-select>
        </div>
    </div>

    <!--<a href="JavaScript:history.Go(-1)">返回上一页</a>-->
</form>
<p>1、
    <a style="cursor: pointer;" ng-click="downloadTemplateFile()">点击下载</a> 《流向原始数据导入模板》
</p>
<p>2、导入条件</p>
<form class="form-horizontal">
    <div class="form-group">
        <rt-datetime ng-model="vm.importDate" rt-label-col="1" rt-title="所属年月" rt-col="3" rt-type="month"></rt-datetime>
    </div>
    <div class="form-group">
        <rt-lookup2 rt-title="省区/地区" ng-model="vm.unitSelected" rt-get-data-name="TblBusinessUnit.ChildBusinessUnitId" rt-order-by="code"
            rt-col-list="[{Code:'name',Name:'部门名称'},{Code:'code',Name:'部门编码'}]" rt-params="{'@ParentBusinessUnitId':vm.bigdeptSelected ? vm.bigdeptSelected.Id :''}"
            rt-label-col="1" rt-col="3"></rt-lookup2>
    </div>
    <div class="form-group" ng-show="vm.selectedMode.Value==2">
        <rt-lookup2 rt-title="商业公司" ng-model="vm.busiSelected" rt-get-data-name="Account.GetAllBusiness" rt-order-by="accountnumber"
            rt-col-list="[{Code:'name',Name:'客户名称'},{Code:'accountnumber',Name:'客户编码'}]" rt-label-col="1" rt-col="3"></rt-lookup2>
    </div>
</form>
<p style="margin-top: 13px;">3、填写模板文件选择文件，并且进行导入</p>
<div class="row" style="padding-left:15px;">
    <div class="col-sm-2">
        <input type="text" ng-model="selectedFileName" class="form-control" readonly>
    </div>
    <div class="col-sm-1">
        <button class="btn btn-default" ng-file-select ng-file-change="selectFile($files)" multiple="multiple">选择文件
        </button>
    </div>
</div>
<br>
<p>4、<a style="cursor: pointer;" ng-click="import()">开始导入</a></p>

<p>5、导入状态：
    <span ng-if="!importSuccess" style="color:red;">{{importStatus}}</span>
    <span ng-if="importSuccess">{{importStatus}}</span>
    <a style="cursor: pointer;" ng-click="downloadErrorFile()" ng-show="errorFileId!='' && !importSuccess">下载包含错误信息的原始流向</a>
    <button class="btn btn-default" ng-click="goNext()" ng-show="importSuccess">下一步，进行产品别名匹配
    </button>
</p>
<div class="listview">
    <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="getDataList()" 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 id="headCode">
                <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>
                </tr>
            </thead>
            <tbody>
                <tr ng-repeat="row in vm.data track by row.ddm_raw_data_excelId">
                    <td>
                        <rt-data-checkbox value="{{row.ddm_raw_data_excelId}}" />
                    </td>
                    <td>{{ row.from_accountidName }}</td>
                    <td>{{ row.to_account_alias_name}}</td>
                    <td>{{ row.product_alias_name}}</td>
                    <td>{{row.product_alias_size}}</td>
                    <td>{{ row.product_lotno}}</td>
                    <td>{{ row.saleto_date | date:'yyyy-MM-dd' }}</td>
                    <td><span ng-if="row.saleto_price">￥</span>{{ row.saleto_price | toFixNumber: 4 }}</td>
                    <td>{{ row.saleto_qty | toFixNumber:2 }}</td>
                </tr>
            </tbody>
        </table>
    </rt-data-grid>
    <!-- rt-data-grid  -->
    <div class="row" style="padding-top: 15px;width: 100%;">
        <span style="float: right;">一共 {{vm.page.recordCount}} 笔，合计数量： {{vm.totalQty}}</span>
    </div>
</div>