<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('','Module/Contact/contactEditView.html','contactEditController')" 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&&vm.view.type!=='grid'" ng-click='vm.actions.import({
                            Title:"医生联系人",
                            ModuleName:"DoctorContactImport",
                            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:"departmentid",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}, 
                                {ColumnName:"idcard",DisplayName:"身份证号码",IsRequired:false,IsKey:false},
                                {ColumnName:"is_department_manager",DisplayName:"是否科室实际负责人",IsRequired:false,IsKey:false},
                                {ColumnName:"is_speaker",DisplayName:"是否为讲者",IsRequired:false,IsKey:false},
                                {ColumnName:"speaker_level",DisplayName:"讲者级别",IsRequired:false,IsKey:false},
                                {ColumnName:"professional",DisplayName:"专业方向",IsRequired:false,IsKey:false},
                                {ColumnName:"bachelor",DisplayName:"最高学历",IsRequired:false,IsKey:false},
                                {ColumnName:"work_experience",DisplayName:"工作经历",IsRequired:false,IsKey:false},
                                {ColumnName:"training_experience",DisplayName:"进修经历",IsRequired:false,IsKey:false},
                                {ColumnName:"honour",DisplayName:"个人荣誉",IsRequired:false,IsKey:false},
                                {ColumnName:"personal_product_desc",DisplayName:"对产品的看法",IsRequired:false,IsKey:false},
                                {ColumnName:"books",DisplayName:"相关学术著作",IsRequired:false,IsKey:false},
                                {ColumnName:"research_result",DisplayName:"研究成果",IsRequired:false,IsKey:false},
                                {ColumnName:"contacttag",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:"ContactGradeImport",
            EntityName:"contact_grade",
            Columns:[
                 {ColumnName:"accountid",DisplayName:"医院*",IsRequired:true,IsKey:false},
                {ColumnName:"departmentid",DisplayName:"科室*",IsRequired:true,IsKey:false},
                {ColumnName:"contactid",DisplayName:"医生*",IsRequired:true,IsKey:false},
                {ColumnName:"product_category",DisplayName:"品种*",IsRequired:true,IsKey:false},
                {ColumnName:"contact_level",DisplayName:"分级*",IsRequired:true,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:"ContactImport",
                            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" ng-show="vm.view.type!=='grid'">
    <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-6" style="padding-left: 22px;">
                    <rt-picklist rt-title="状态" rt-col="6" rt-label-col="4" 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":"姓名",
                    "jobtitle":"职务",
                    "contactnumber":"联系人编码",
                    "accountidName":"所属客户",
                    "departmentidName":"科室",
                    "accountnumber":"所属客户编码",
                    "gendercodeName":"性别",
                    "telephone":"电话",
                    "mailaddress":"邮件",
                    "fax":"传真",
                    "idcard":"身份证号码",
                    "is_department_managerName":"是否科室实际负责人",
                    "is_speakerName":"是否为讲者",
                    "speaker_level":"讲者级别",
                    "professional":"专业方向",
                    "bachelorName":"最高学历",
                    "work_experience":"工作经历",
                    "training_experience":"进修经历",
                    "honour":"个人荣誉",
                    "personal_product_desc":"对产品的看法",
                    "books":"相关学术著作",
                    "research_result":"研究成果",
                    "mkt_spousename":"家庭成员情况（隐秘）",
                    "mkt_personnalmark":"业务专长及个人爱好（隐秘）",
                    "mkt_books":"相关学术著作（隐秘）",
                    "mkt_research_result":"研究成果（隐秘）"
                    },"ContactExport","医生联系人")'>导出</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>联系人编码</th>
                            <th>职务</th>
                            <th rt-field-code="accountidName">所属客户</th>
                            <th rt-field-code="accountnumber">所属客户编码</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'&&row.contact_type.Value!=2">
                                <a href="javascript:;" ng-click="vm.actions.showForm(row.Id)"> {{row.name}} </a>
                            </td> -->
                            <td ng-if="vm.view.type=='grid'&&row.contact_type.Value==1">
                                <a href="javascript:;" ng-click="vm.actions.showForm(row.Id,'Module/Contact/contactEditView.html','contactEditController')">
                                    {{row.name}} </a>
                            </td>
                            <td ng-if="vm.view.type=='grid'&&row.contact_type.Value==2">
                                <a href="javascript:;" ng-click="vm.actions.showForm(row.Id,'Module/Contact/contactEditView.html','contactEditController')">
                                    {{row.name}} </a>
                            </td>
                            <td ng-if="vm.view.type=='grid'&&row.contact_type.Value==3">
                                <a href="javascript:;" ng-click="vm.actions.showForm(row.Id,'Module/Contact/contactEditView.html','contactEditController')">
                                    {{row.name}} </a>
                            </td>
                            <td ng-if="vm.view.type=='grid'&&row.contact_type.Value==4">
                                <a href="javascript:;" ng-click="vm.actions.showForm(row.Id,'Module/Contact/contactEditView.html','contactEditController')">
                                    {{row.name}} </a>
                            </td>
                            <td ng-if="vm.view.type=='grid'&&row.contact_type.Value==5">
                                <a href="javascript:;" ng-click="vm.actions.showForm(row.Id,'Module/Contact/contactEditView.html','contactEditController')">
                                    {{row.name}} </a>
                            </td>
                            <td ng-if="vm.view.type=='grid'&&row.contact_type.Value==6">
                                <a href="javascript:;" ng-click="vm.actions.showForm(row.Id,'Module/Contact/contactEditView.html','contactEditController')">
                                    {{row.name}} </a>
                            </td>

                            <td>{{row.contactnumber}}</td>
                            <td>{{row.jobtitle}}</td>
                            <td>{{row.accountid.Name}}</td>
                            <td>{{row.accountnumber}}</td>
                            <td>{{row.gendercode.Name}}</td>
                            <td>{{row.telephone}}</td>
                            <td>{{row.mailaddress}}</td>
                            <td>{{row.fax}}</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>