<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:"BasicMedicalImport",
                            EntityName:"account",
                            Columns:[
                                {ColumnName:"name",DisplayName:"机构名称*",IsRequired:true,IsKey:true},
                                {ColumnName:"accountnumber",DisplayName:"机构编码",IsRequired:false,IsKey:false},
                                {ColumnName:"orgtype",DisplayName:"机构类型*",IsRequired:true,IsKey:false},
                                {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:"iscontents",DisplayName:"是否执行基药目录",IsRequired:false,IsKey:false},
                                {ColumnName:"acc_client_count",DisplayName:"下级服务站数量",IsRequired:false,IsKey:false},
                                {ColumnName:"isgov",DisplayName:"是否政府办",IsRequired:false,IsKey:false},
                                {ColumnName:"accounttag",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:"BasicMedicalContactImport",
                            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-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({
                    "name":"机构名称",
                    "accountnumber":"机构编码",
                    "orgtypeName":"机构类型",
                    "provinceidName":"省份",
                    "cityidName":"城市",
                    "countyidName":"区县",
                    "address":"地址", 
                    "iscontentsName":"是否执行基药目录",
                    "acc_client_count":"下级服务站数量",
                    "isgovName":"是否政府办"
                    })'>导出</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-condensed 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>机构类型</th>
                            <th rt-field-code="provinceidName">省份</th>
                            <th rt-field-code="cityidName">城市</th>
                            <th rt-field-code="countyidName">县区</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)"> {{row.name}} </a>
                            </td>
                            <td>{{row.accountnumber}}</td>
                            <td>{{row.orgtype.Name}}</td>
                            <td>{{row.provinceid.Name}}</td>
                            <td>{{row.cityid.Name}}</td>
                            <td>{{row.countyid.Name}}</td>
                            <td>{{row.iscontentsName}}</td>
                            <td>{{row.acc_client_count}}</td>
                            <td>{{row.isgovName}}</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>