<form class="form-horizontal">
    <div class="form-group">
        <rt-datetime ng-model="vm.sDate" rt-type="year" rt-title="年份" rt-required="true" rt-col="3" rt-label-col="2"></rt-datetime>
        <div class="col-sm-5"></div>
        <div class="col-sm-1">
            <button class="btn btn-primary" ng-click="vm.search()">查询</button>
        </div>
    </div>
    <div class="form-group">
        <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.buidSelected" theme="bootstrap">
                <ui-select-match>{{ $select.selected.name }}</ui-select-match>
                <ui-select-choices repeat="item in vm.buidList|filter:$select.search">
                    <span ng-bind-html="item.name | highlight: $select.search"></span>
                </ui-select-choices>
            </ui-select>
        </div>
        <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.bigDepSelected" theme="bootstrap">
                <ui-select-match>{{ $select.selected.name }}</ui-select-match>
                <ui-select-choices repeat="item in vm.bigDepList |filter:$select.search">
                    <span ng-bind-html="item.name | highlight: $select.search"></span>
                </ui-select-choices>
            </ui-select>
        </div>
        <div class="col-sm-1">
            <button class="btn btn-primary" ng-click='vm.actions.export({
                        "buidName":"事业部",
                        "bigDepIdName":"大区",
                        "BusinessUnitIdName":"地区",
                        "managerIdName":"招商经理",
                        "addLeadsCount":"新建代理商数",
                        "leadsCount":"转为潜在代理商数",
                        "rate1":"转化率",
                        "accountCount":"转为协议代理商数",
                        "rate2":"转化率",
                        },"LeadsConversionRateExport","潜在代理商转换率分析")'>
                   导出
        </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.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>
</form>

<div class="row tab-pane active" style="border-top: 1px dotted #d5c4c4; padding-top: 20px" id="c2">
    <div class="col-sm-30">
        <rt-data-grid rt-page-record-count="vm.recordCount" rt-page-index="vm.pageIndex" rt-page-size="vm.pageSize" rt-get-data="vm.search()" rt-rows="vm.data"
            rt-auto-height="{{tableMaxHeight}}">
            <table class="table table-hover " style="white-space:nowrap;" id="rt-report-header">
                <thead>
                    <tr>
                        <th class="rt-text-align">事业部</th>
                        <th class="rt-text-align">大区</th>
                        <th class="rt-text-align">省区</th>
                        <th class="rt-text-align">招商经理</th>
                        <th class="rt-number-align">新建代理商数</th>
                        <th class="rt-number-align">转为潜在代理商数</th>
                        <th class="rt-number-align">转化率</th>
                        <th class="rt-number-align">转为协议代理商数</th>
                        <th class="rt-number-align">转化率</th>
                    </tr>
                </thead>
                <tbody>
                    <tr ng-repeat="row in vm.dataTable ">
                        <td class="rt-text-align">{{row.buidName}}</td>
                        <td class="rt-text-align">{{row.bigDepIdName}}</td>
                        <td class="rt-text-align">{{row.BusinessUnitIdName}}</td>
                        <td class="rt-text-align">{{row.managerIdName}}</td>
                        <td class="rt-number-align">{{row.addLeadsCount}}</td>
                        <td class="rt-number-align">{{row.leadsCount}}</td>
                        <td class="rt-number-align">{{row.addLeadsCount==0 ? 0 : row.leadsCount/row.addLeadsCount*100 | toFixNumber:2}}%</td>
                        <td class="rt-number-align">{{row.accountCount}}</td>
                        <td class="rt-number-align">{{row.addLeadsCount==0 ? 0 : row.accountCount/row.addLeadsCount*100 | toFixNumber:2}}%</td>
                    </tr>
                </tbody>
            </table>
        </rt-data-grid>
    </div>
</div>