<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:"BusinessAccountImport",
                            EntityName:"account",
                            Columns:[
								{ColumnName:"accountnumber",DisplayName:"商业编码",IsRequired:false,IsKey:false},
                                {ColumnName:"name",DisplayName:"商业名称*",IsRequired:true,IsKey:true},
                                {ColumnName:"provinceid",DisplayName:"省份*",IsRequired:true,IsKey:false},
                                {ColumnName:"cityid",DisplayName:"城市*",IsRequired:true,IsKey:false},
                                {ColumnName:"countyid",DisplayName:"区县",IsRequired:false,IsKey:false},
                                {ColumnName:"address",DisplayName:"地址",IsRequired:false,IsKey:false},
                                {ColumnName:"acc_level",DisplayName:"商业级别*",IsRequired:false,IsKey:false},
                                {ColumnName:"businessmodel",DisplayName:"经营模式",IsRequired:false,IsKey:false},
                                {ColumnName:"accountlevel",DisplayName:"配送能力",IsRequired:false,IsKey:false},
								{ColumnName:"scope",DisplayName:"商业覆盖范围",IsRequired:false,IsKey:false},
								{ColumnName:"accounttag",DisplayName:"标签",IsRequired:false,IsKey:false},
								{ColumnName:"acc_bank",DisplayName:"开户银行",IsRequired:false,IsKey:false},
								{ColumnName:"acc_bank_number",DisplayName:"银行账号",IsRequired:false,IsKey:false},
								{ColumnName:"acc_org_number",DisplayName:"组织机构代码证",IsRequired:false,IsKey:false},
								{ColumnName:"acc_post_code",DisplayName:"邮政编码",IsRequired:false,IsKey:false}                                                
                            ]
                        })'>
                <i class="fa fa-upload"></i> 导入
            </button>
			<button class="btn btn-link" ng-disabled="false" ng-show="vm.privilege.IsWrite&&vm.view.type!=='grid'" ng-click='vm.actions.import({
                            Title:"联系人",
                            ModuleName:"BusinessAccountContactImport",
                            EntityName:"contact",
                            Columns:[
                                {ColumnName:"name",DisplayName:"姓名*",IsRequired:true,IsKey:false},
                                {ColumnName:"jobtitle",DisplayName:"职务*",IsRequired:true,IsKey:false},
                                {ColumnName:"contactnumber",DisplayName:"联系人编码*",IsRequired:true,IsKey:true},
                                {ColumnName:"accountid",DisplayName:"所属客户*",IsRequired:true,IsKey:false},
                                {ColumnName:"gendercode",DisplayName:"性别*",IsRequired:true,IsKey:false},
                                {ColumnName:"familystatuscode",DisplayName:"婚姻状况",IsRequired:false,IsKey:false},
                                {ColumnName:"mobiletelephone",DisplayName:"移动电话",IsRequired:false,IsKey:false},
                                {ColumnName:"mailaddress",DisplayName:"邮件",IsRequired:false,IsKey:false},
                                {ColumnName:"telephone",DisplayName:"电话",IsRequired:false,IsKey:false}
                            ]
                        })'>
                <i class="fa fa-upload"></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">
		<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">
				<div class="col-sm-12">
					<rt-bu-tree-lookup rt-title="业务部门" rt-multiple="true" ng-model="vm.nodeSelected" rt-col="8"></rt-bu-tree-lookup>
				</div>
			</div> -->
			<div class="form-group">
				<div class="col-sm-6" style="padding-left: 22px;">
					<rt-area-lookup rt-title="省市县" ng-model="vm.areaSelected" rt-col="6" rt-label-col="4"></rt-area-lookup>
				</div>
				<div class="col-sm-6">
					<rt-picklist rt-title="状态" rt-col="6" ng-model="vm.stateSelected" rt-options="vm.picklist.StateCode"></rt-picklist>
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-6" style="padding-left: 22px;">
					<rt-picklist rt-title="商业级别" ng-model="vm.gradeSelected" rt-col="6" rt-label-col="4" rt-options="vm.picklist.acc_level"></rt-picklist>
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-12">
					<rt-input rt-type="text" rt-title="标签" ng-model="vm.tagSelected" rt-col="8" rt-label-col="2"></rt-input>
				</div>
			</div>
		</div>
		<div class="box-footer">
			<div class="btn-group pull-right">
				<button class="btn btn-primary" ng-click="vm.view.search();">查询</button>
				<button class="btn btn-default" ng-show="vm.privilege.IsExport" ng-click='vm.actions.export({
					"accountnumber":"商业编码",
					"name":"商业名称",
					"provinceidName":"省份",
					"cityidName":"城市",
					"countyidName":"区县",
					"address":"地址",
					"acc_levelName":"商业级别",
					"businessmodel":"经营模式",
					"accountlevelName":"配送能力",
					"scope":"商业覆盖范围",
					"StateCodeName":"状态"
					})'>导出</button>
			</div>
		</div>
	</form>
</div>

<div class="box box-primary">
	<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-hover">
					<thead>
						<tr>
							<th>
								<rt-header-checkbox></rt-header-checkbox>
							</th>
							<!-- @@ 视图表头 -->
							<th rt-field-code="name">商业名称</th>
							<th rt-field-code="accountnumber">商业编码</th>
							<th rt-field-code="provinceidName">省份</th>
							<th rt-field-code="cityidName">城市</th>
							<th>商业级别</th>
							<th>经营模式</th>
							<th>配送能力</th>
							<th>商业覆盖范围</th>
							<th>标签</th>
							<th rt-field-code="statecode">状态</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.name}}</a>
							</td>
							<td ng-if="vm.view.type=='grid'">
								<a href="javascript:;" ng-click="vm.actions.showForm(row.Id)"></a>
							</td>
							<td>{{row.accountnumber}}</td>
							<td>
								{{row.provinceid.Name}}
							</td>
							<td>
								{{row.cityid.Name}}
							</td>
							<td>
								{{row.acc_level.Name}}
							</td>
							<td>
								{{row.businessmodel}}
							</td>
							<td>
								{{row.accountlevel.Name}}
							</td>
							<td>
								{{row.scope}}
							</td>
							<td>
								{{row.tagstring}}
							</td>
							<td>
								{{row.StateCode.Name}}
							</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>