<ion-view view-title="选择部门或成员" hide-back-button="true">
    <ion-nav-buttons side="left">
        <button class="button button-clear" ng-click="this[leftbtn[index].click]();">{{leftbtn[index].text}}</button>
    </ion-nav-buttons>
    <ion-content>
        <div ng-if="loading" class="center init-load action-sheet-backdrop">
            <ion-spinner icon="android"></ion-spinner>
        </div>
        <div ng-show="!loading">
            <ul>
                <li class="check-dept-li" ng-show="index==0">
                    <label class="list item-checkbox">
                        <div class="checkbox checkbox-input-hidden disable-pointer-events checkbox-circle">
                            <input ng-model="selecteditems.all" ng-click="selectAll()" type="checkbox" class="ng-pristine ng-untouched ng-valid ng-not-empty">
                            <i class="checkbox-icon"></i>
                        </div>
                    </label>
                    <label ng-click="selectAll()">
                        <span class="deptname">全部成员</span>
                    </label>
                </li>
                <div class="item item-divider divder divider-font" ng-if="deptlst.length>0"><i class="icon ion-ios-star"></i>部门({{deptlst.length}})</div>
                <li class="check-dept-li" ng-repeat="dept in deptlst track by $index" ng-class="{true:'clickactive',fasle:''}[actived]">
                    <label class="list item-checkbox">
                        <div class="checkbox checkbox-input-hidden disable-pointer-events checkbox-circle">
                            <input ng-model="dept.selected" ng-change="change(dept,'d')" type="checkbox" class="ng-pristine ng-untouched ng-valid ng-not-empty">
                            <i class="checkbox-icon"></i>
                        </div>
                    </label>
                    <label ng-click="tochilddept(dept);">
                        <span class="deptname">{{dept.depname}}</span>
                        <i class="icon ion-chevron-right icon-accessory" ng-show="dept.isShow"></i>
                    </label>
                </li>
            </ul>
            <!--员工-->
            <div class="item item-divider divder divider-font"><i class="icon ion-ios-star"></i>联系人({{emplst.length}})</div>
            <ion-list>
                <ion-checkbox ng-change="change(emp,'e')" ng-model="emp.selected" class="ion-checkbox-class" ng-repeat="emp in emplst">
                    <img ng-src="../../../img/panda.png"/>
                    <label class="labelname">{{emp.username}}</label>
                    <label class="labelrole">{{emp.degree}}</label>
                </ion-checkbox>
                <ion-list>
                <div class='obligate-item'></div>
        </div>
    </ion-content>
    <div class="bar bar-footer bar-dark footer-div" ng-class="{true:'bigview',false:''}[isUp]" style="">
        <i ng-class="{true:'ion-ios-arrow-down cirl-i',false:' ion-ios-arrow-up cirl-i'}[isUp]" ng-click="isUp = !isUp"></i>
        <ul class='ul-imgs dept-icon'>
            <li ng-repeat="dept in selecteditems.depts">{{dept.depname}}
            </li>
            <li ng-repeat="user in selecteditems.users">{{user.username}}
            </li>
        </ul>
        <button ng-click="ok();" ng-disabled="selecteditems.depts.length==0&&selecteditems.users.length==0" class="button pull-right button-calm">确定{{selecteditems.depts.length>0||selecteditems.users.length>0?"(" + (selecteditems.depts.length + selecteditems.users.length) +")":""}}</button>
    </div>
</ion-view>
