<view class="all">
  <image mode="scaleToFill" catchTap="onClose" class="close" src="../../../image/close.png"></image>
  <form onReset="onReset">
    <view class="search flex-box flex-v-ce">
      <image mode="scaleToFill" src="../../../image/ss.png"></image>
      <input placeholder="请输入姓名搜索" onInput="bindKeyInput" class="flex-1"></input>
      <button a:if="{{isVal}}" class="delVal" formType="reset">×</button>
    </view>
  </form>
  <view class="content">
    <view a:if="{{terr.length>1}}" class="flex-box flex-v-ce shu">
      <view a:for="{{terr}}" class="flex-box flex-v-ce" data-index="{{index}}" catchTap="activeItem" data-item="{{item}}">
        <image a:if="{{index!=0}}" mode="scaleToFill" src="../../../image/right.png" style="width:20rpx;height:20rpx;margin:0 6rpx;"></image>
        <text style="max-width:2.5rem" class="font-flex-word">{{item.name}}</text>
      </view>
    </view>
    <scroll-view class="staff-ul" scroll-y="{{true}}" style="{{terr.length>1? 'height: calc(100vh - 390rpx);':'height: calc(100vh - 320rpx);'}}">
      <view class="ul2">
        <view a:for="{{rule_tree}}" class="flex-box flex-v-ce li">
          <view class="flex-box flex-v-ce flex-1" data-item="{{item}}" catchTap="changeSection">
            <image mode="scaleToFill" style="width:50rpx;height:50rpx; margin:0 10rpx;" src="../../../image/BM.png"></image>
            <text class="flex-1">{{item.name}}</text>
              
          </view>
          <view a:if="{{item._child.length>0}}" class="xia" data-item="{{item}}" catchTap="openDown">| 下级</view>
        </view>
      </view>
      <view class="flex-box flex-v-ce staff-all">
        <view class="flex-1"></view>
        <label a:if="{{isAll}}">
          <text class="rule-all-text">全选</text>
          <checkbox onChange="ruleActiveAll" disabled="{{item.disabled}}" checked="{{isAllChecked}}"></checkbox>
        </label>
      </view>
      <view a:if="{{userList.length>0&&isAll&&item.name.indexOf(keyVal)>= 0}}" a:for="{{userList}}" class="flex-box flex-v-ce userItem">
          <label class="flex-box flex-v-ce flex-1">
            <img-box name="{{item.name}}" imgUrl="{{item.img_url}}" height="70rpx" width="70rpx"></img-box>
            <text style="margin-left:20rpx;" class="flex-1">{{item.name}}</text>
            <checkbox onChange="radioChange" data-index="{{index}}" data-item="{{item}}" checked="{{item.checked}}" name="{{item.id}}"></checkbox>
          </label>
      </view>
      <view a:if="{{userList.length>0&&!isAll&&item.name.indexOf(keyVal)>= 0}}" a:for="{{userList}}" class="flex-box flex-v-ce userItem">
          <view class="{{item.checked? 'active':''}} flex-box flex-v-ce flex-1" catchTap="radioChange" data-index="{{index}}" data-item="{{item}}">
            <img-box name="{{item.name}}" imgUrl="{{item.img_url}}" height="70rpx" width="70rpx"></img-box>
            <text style="margin-left:20rpx;" class="flex-1">{{item.name}}</text>
            <view class="radio_"></view>
          </view>
      </view>
      <view a:if="{{userList.length==0}}">
        <view style="text-align:center">
          <image mode="scaleToFill" src="../../../image/noData.png" style="width: 340rpx;height: 340rpx;margin-bottom:20rpx;"/>
        </view>
        <view class="fontColorF" style="margin-top:0rpx;text-align: center;" a:if="{{isCreator}}">
          <view  style="font-size:0.28rem">未授权员工进入系统，请前往钉钉电脑端</view>
          <view  style="font-size:0.28rem">为员工【启用积分管理】</view>
        </view>
        <view class="fontColorF" style="margin-top:0rpx;text-align: center;" a:else>
          <view style="font-size:0.28rem">您当前没有可管理人员，请前往钉钉电脑端</view>
          <view  style="font-size:0.28rem" >设置【管理范围】</view>
        </view>
      </view>
    </scroll-view>
  </view>
  <view class="StaffFooter flex-box flex-v-ce">
    <view class="flex-1 f-left flex-box flex-v-ce">
      <view a:for="{{selectUserId}}" style="margin-right:10rpx;" a:if="{{item.id}}">
        <image a:if="{{item.img_url}}" class="img-url" style="width:70rpx;height:70rpx;display: inline-block;  position: relative;top: 6rpx;" src="{{item.img_url}}"></image>
        <view a:else style="width: 70rpx;height: 70rpx;border-radius: 100%;background: #26A2FF;color: #fff;text-align: center;line-height: 70rpx;font-size: 24rpx;">{{item.name.substr(item.name.length-2)}}</view>
      </view>
    </view>
    <view class="staffBtn" onTap="onConfirm">确定</view>
  </view>
</view>