<rt-form id="{{vm.form.name}}" name="{{vm.form.name}}" novalidate>
    <div class="row rt-margin-bottom-before-box">

        <div class="col-sm-2">
            <button class="btn btn-link" type="button" id="btnClose" ng-click="vm.form.hide()">
                        <i class="fa fa-sign-out"></i> 关闭
                    </button>
        </div>
        <!-- div[.col-sm-2] -->
        <div class="col-sm-10">
            <div class="pull-right">
                <rt-button id="btnSave" rt-style="link" rt-title="保存" rt-icon="floppy-o" ng-click="vm.form.save(false)" ng-show="(vm.form.type === 'Create' && vm.privilege.IsCreate) || (vm.form.type === 'Edit' && vm.form.data.StateCode.Value == 0 && vm.privilege.IsWrite)">
                </rt-button>
                <rt-button id="btnSaveAndNew" rt-style="link" rt-title="保存并新建" rt-icon="floppy-o" ng-click="vm.form.save(true)" ng-show="(vm.form.type === 'Create' && vm.privilege.IsCreate) || (vm.form.type === 'Edit' && vm.form.data.StateCode.Value == 0 && vm.privilege.IsWrite)">
                </rt-button>
                <rt-button id="btnDelete" rt-style="link" rt-title="删除" rt-icon="trash" ng-click="vm.form.del()" ng-show="vm.form.type === 'Edit' && vm.privilege.IsDelete">
                </rt-button>
                <rt-button id="btnActivate" rt-style="link" rt-title="激活" rt-icon="check" ng-click="vm.form.activate()" ng-show="vm.form.type === 'Edit' && vm.form.data.StateCode.Value == 1 && vm.privilege.IsWrite">
                </rt-button>
                <rt-button id="btnDeactivate" rt-style="link" rt-title="停用" rt-icon="ban" ng-click="vm.form.deactivate()" ng-show="vm.form.type === 'Edit' && vm.form.data.StateCode.Value == 0 && vm.privilege.IsWrite">
                </rt-button>
                <!--<rt-button id="btnAssign"-->
                <!--rt-style="link"-->
                <!--rt-title="分派"-->
                <!--rt-icon="share"-->
                <!--ng-show="vm.form.type === 'Edit' && vm.privilege.IsAssign">-->
                <!--</rt-button>-->
            </div>
        </div>
        <!-- div[.col-sm-10] -->
    </div>
    <!-- div[.row] -->
    <div class="nav-tabs-custom">
        <!-- @@表单 -->
        <ul class="nav nav-tabs" ng-if="vm.form.type === 'Edit'">
            <li class="active">
                <a href="#A1{{vm.form.name}}" onclick="return false;" data-toggle="tab">区域信息</a>
            </li>
            <li>
                <a href="#A2{{vm.form.name}}" onclick="return false;" data-toggle="tab">目标机构</a>
            </li>
            <li>
                <a href="#A3{{vm.form.name}}" onclick="return false;" data-toggle="tab">目标医生/店员</a>
            </li>
            <li>
                <a href="#A4{{vm.form.name}}" onclick="return false;" data-toggle="tab">目标市场范围</a>
            </li>
        </ul>
        <!-- ui[.nav] -->

        <div class="tab-content">
            <div class="tab-pane active" id="A1{{vm.form.name}}">
                <rt-section rt-title="基本信息">
                    <rt-section-row>
                        <rt-input rt-type="text" rt-title="区域名称" rt-disabled="vm.form.data.StateCode.Value == 1" rt-required="true" rt-col="4" rt-required="true"
                            ng-model="vm.form.data.name"></rt-input>
                        <rt-input rt-type="text" rt-title="区域编码" rt-col="4" rt-required="true" ng-model="vm.form.data.code"></rt-input>
                    </rt-section-row>
                    <!-- <rt-section-row>
                        <rt-lookup2 rt-title="事业部" rt-disabled="vm.form.data.StateCode.Value == 1" ng-model="vm.form.data.buid" rt-get-data-name="TblBusinessUnit.BuidBusinessUnitId"
                            rt-order-by="code" rt-col-list="[{Code:'name',Name:'事业部名称'},{Code:'code',Name:'事业部编码'}]" rt-required="true"
                            rt-col="4"></rt-lookup2>
                        <rt-lookup2 rt-title="业务线/大区" rt-disabled="vm.form.data.StateCode.Value == 1" ng-model="vm.form.data.bigdepartid" rt-get-data-name="TblBusinessUnit.ChildBusinessUnitId"
                            rt-order-by="code" rt-params="{'@ParentBusinessUnitId':vm.form.data.buid ? vm.form.data.buid.Id :''}"
                            rt-col-list="[{Code:'name',Name:'业务线/大区名称'},{Code:'code',Name:'业务线/大区编码'}]" rt-required="true" rt-col="4"></rt-lookup2>
                    </rt-section-row> -->
                    <rt-section-row>
                        <rt-lookup2 rt-title="省区/地区" rt-disabled="vm.form.data.StateCode.Value == 1" ng-model="vm.form.data.BusinessUnitId" rt-get-data-name="TblBusinessUnit.GetBusinessUnitWithType"
                            rt-order-by="code" rt-params="{'@ParentBusinessUnitId':vm.form.data.bigdepartid ? vm.form.data.bigdepartid.Id :''}"
                            rt-col-list="[{Code:'name',Name:'省区/地区名称'},{Code:'code',Name:'省区/地区编码'}]" rt-required="true" rt-col="4"></rt-lookup2>
                        <rt-lookup2 rt-title="业务代表" rt-disabled="vm.form.data.StateCode.Value == 1" ng-model="vm.form.data.OwnerId" rt-get-data-name="UserInfo.GetUserByBu"
                            rt-order-by="code" rt-col-list="[{Code:'name',Name:'业务代表名称'},{Code:'code',Name:'业务代表编码'}]" rt-params="{'@businessunitid':vm.form.data.BusinessUnitId ? vm.form.data.BusinessUnitId.Id :''}"
                            rt-required="true" rt-col="4"></rt-lookup2>
                    </rt-section-row>
                </rt-section>
                <rt-section rt-title="状态">
                    <rt-section-row>
                        <rt-picklist rt-title="状态" rt-col="4" ng-model="vm.form.data.StateCode" rt-disabled="true" rt-options="vm.picklist.StateCode"></rt-picklist>
                    </rt-section-row>
                </rt-section>
            </div>
            <!--目标机构-->
            <div class="tab-pane" id="A2{{vm.form.name}}">
                <div ng-if="vm.form.type === 'Edit'" rt-include rt-template="Module/SalesRegionAccount/salesregionaccountListView.html" rt-controller="salesregionaccountListController"
                    rt-include-params='{"relatedAttr": "sales_regionId"}'></div>
            </div>
            <!--目标医生/店员-->
            <div class="tab-pane" id="A3{{vm.form.name}}">
                <div ng-if="vm.form.type === 'Edit'" rt-include rt-template="Module/SystemUserContact/systemUserContactListView.html" rt-controller="systemUserContactListController"
                    rt-include-params='{"relatedAttr": "sales_regionId"}'></div>
            </div>
            <!--目标市场范围-->
            <div class="tab-pane" id="A4{{vm.form.name}}">
                <div ng-if="vm.form.type === 'Edit'" rt-include rt-template="Module/SalesRegionArea/salesregionareaListView.html" rt-controller="salesregionareaListController"
                    rt-include-params='{"relatedAttr": "sales_regionId"}'></div>
            </div>
            <!-- div[#1, .tab-pane] -->
        </div>
        <!-- div[.tab-content] -->
    </div>
</rt-form>
<!-- rt-form -->