<view>
  <view class="header margin-bottom">
    <form onReset="onReset">
      <view class="search flex-box flex-v-ce">
        <image mode="scaleToFill" src="../../../image/ss.png"/>
        <input class="flex-1" placeholder="请输入姓名搜索" onInput="bindKeyInput" class="flex-1"/>
        <button a:if="{{isVal}}" class="delVal" formType="reset">×</button>
      </view>
    </form>
    <view class="flex-box flex-v-ce" style="margin-top:28rpx;">
      <view class="flex-1 flex-box flex-v-ce">
        <image a:if="{{gsData.logo_ur}}" mode="scaleToFill" src="{{gsData.logo_url}}" class="logo"/>
        <image a:else mode="scaleToFill" src="../../../image/gs_logo.png" class="logo"/>
        <view class="name flex-1">{{gsData.name}}</view>
      </view>
      <view class="flex-box-v flex-center-center" style="border-left:1px solid #f1f1f1;padding-left:28rpx" catchTap="tbDd">
        <view>
          <image mode="scaleToFill" src="../../../image/tb.png" class="tbImg"/></view>
        <view class="tbText">同步钉钉</view>
      </view>
    </view>
  </view>
  <view class="flex-box flex-v-ce shu" a:if="{{terr.length>1}}">
    <view a:for="{{terr}}" class="flex-box flex-v-ce" data-index="{{index}}" catchTap="activeItem" data-item="{{item}}">
      <image mode="scaleToFill" src="../../../image/right.png" style="width:20rpx;height:20rpx;margin:0 6rpx;" a:if="{{index!=0}}"/>{{item.name}}
    </view>
  </view>
  <scroll-view a:if="{{isItem}}" class="main" scroll-y="{{true}}" style="{{terr.length>1? 'height: calc(100vh - 480rpx)':'height: calc(100vh - 442rpx)'}}">
    <view class="flex-box flex-v-ce li" a:for="{{rule_tree}}" catchTap="activeTree" data-item="{{item}}">
      <view class="img-left">
        <image mode="scaleToFill" src="../../../image/BM.png"></image></view>
      <view class="{{(index+1)!=rule_tree.length? 'border-bottom':'' }} flex-box flex-v-ce flex-1 li-right">
        <view class="title flex-1">{{item.name}}</view>
        <image mode="scaleToFill" src="../../../image/right.png" class="img-right"></image>
      </view>
    </view>
    <view class="flex-box flex-v-ce title2">
      <view class="flex-1 fontColorF">
        <picker onChange="bingIntegralType" value="{{minuteIndex}}" range="{{minuteArray}}" range-key="name">
          <text class="selectText">{{minuteArray[minuteIndex].name}}</text>
        </picker>
      </view>
      <view class="flex-box">
        <label>
          <text class="fontColorZ" style="padding-right:20rpx">全选</text>
          <checkbox onChange="ruleActiveAll"  checked="{{isAllChecked}}"></checkbox>
        </label>
      </view>
    </view>
    <block a:if="{{minuteIndex>0}}">
        <view class="flex-box flex-v-ce li" a:for="{{userList}}" a:if="{{item.is_official==(minuteIndex==1? 1:0)}}">
          <label class="flex-box flex-v-ce flex-1 userItem">
            <img-box imgUrl="{{item.img_url}}" name="{{item.name}}" height="90rpx" width="90rpx" fSize="24rpx"></img-box>
            <view class="flex-box-v flex-1" style="margin-left:20rpx;">
              <text class="flex-1">{{item.name}}</text>
              <text class="state blue" a:if="{{item.is_creator==1||item.is_official==1}}">已开启</text>
              <text class="state red" a:else>关闭</text>
            </view>
            <checkbox onChange="radioChange" data-id="{{item.id}}" checked="{{item.isChecked}}" disabled="{{item.is_creator}}" name="{{item.id}}"></checkbox>
          </label>
        </view>
    </block>
    <view class="flex-box flex-v-ce li" a:for="{{userList}}" a:else>
      <label class="flex-box flex-v-ce flex-1 userItem">
        <img-box imgUrl="{{item.img_url}}" name="{{item.name}}" height="90rpx" width="90rpx" fSize="24rpx"></img-box>
        <view class="flex-box-v flex-1" style="margin-left:20rpx;">
          <text class="flex-1">{{item.name}}</text>
          <text class="state blue" a:if="{{item.is_creator==1||item.is_official==1}}">已开启</text>
          <text class="state red" a:else>关闭</text>
        </view>
        <checkbox onChange="radioChange" data-id="{{item.id}}" checked="{{item.isChecked}}" disabled="{{item.is_creator}}" name="{{item.id}}"></checkbox>
      </label>
    </view>

    <view a:if="{{userList.length==0}}">
      <no-data content="未找到相关人员"/>
    </view>
  </scroll-view>
  <!-- 搜索的人员 -->
  <scroll-view a:else class="main" scroll-y="{{true}}" style="height: calc(100vh - 388rpx)">
    <view class="flex-box flex-v-ce title2">
      <view class="flex-1 fontColorF">
        <picker onChange="bingIntegralType" value="{{minuteIndex}}" range="{{minuteArray}}" range-key="name">
          <text class="selectText">{{minuteArray[minuteIndex].name}}</text>
        </picker>
      </view>
      <view class="flex-box">
        <label>
          <text class="fontColorZ" style="padding-right:20rpx">全选</text>
          <checkbox onChange="ruleActiveAll"  checked="{{isAllChecked2}}"></checkbox>
        </label>
      </view>
    </view>
    <block a:if="{{minuteIndex>0}}">
        <view class="flex-box flex-v-ce li" a:for="{{userList}}" a:if="{{item.is_official==(minuteIndex==1? 1:0)}}">
          <label class="flex-box flex-v-ce flex-1 userItem">
            <img-box imgUrl="{{item.img_url}}" name="{{item.name}}" height="90rpx" width="90rpx" fSize="24rpx"></img-box>
            <view class="flex-box-v flex-1" style="margin-left:20rpx;">
              <text class="flex-1">{{item.name}}</text>
              <text class="state blue" a:if="{{item.is_creator==1||item.is_official==1}}">已开启</text>
              <text class="state red" a:else>关闭</text>
            </view>
            <checkbox onChange="radioChange" data-id="{{item.id}}" checked="{{item.isChecked}}" disabled="{{item.is_creator}}" name="{{item.id}}"></checkbox>
          </label>
        </view>
    </block>
    <view class="flex-box flex-v-ce li" a:for="{{searchUser}}" a:else>
      <label class="flex-box flex-v-ce flex-1 userItem">
        <img-box imgUrl="{{item.img_url}}" name="{{item.name}}" height="90rpx" width="90rpx" fSize="24rpx"></img-box>
        <view class="flex-box-v flex-1" style="margin-left:20rpx;">
          <text class="flex-1">{{item.name}}</text>
          <text class="state blue" a:if="{{item.is_creator==1||item.is_official==1}}">已开启</text>
          <text class="state red" a:else>关闭</text>
        </view>
        <checkbox onChange="radioChange" data-id="{{item.id}}" checked="{{item.isChecked}}" disabled="{{item.is_creator}}" name="{{item.id}}"></checkbox>
      </label>
    </view>
    <view a:if="{{searchUser.length==0}}">
      <no-data content="未找到相关人员"/>
    </view>
  </scroll-view>
  <view class="footer flex-box fle-flex-v-ce">
    <view class="jin flex-1" catchTap="onOpen" data-index="1">禁用</view>
    <view class="kai flex-1" catchTap="onOpen" data-index="2">开启</view>
  </view>
</view>