<view>
  <view class="header margin-bottom" style="padding-bottom:16rpx;">
    <view class="flex-box flex-v-ce tab border-bottom">
      <view class="flex-2" catchTap="selectStaff">
        <text class="{{showStaff? 'activeView blue':''}}">{{staffVal}}</text>
      </view>
      <view class="flex-1"></view>
    </view>
    <view catchTap="showText" style="position: absolute;right:28rpx;top:20rpx;z-index:999">
      <text style="font-size:28rpx">提示
        <text class="text2">?</text></text>
    </view>
    <form onReset="onReset" style="position:relative">
      <view style="margin-top:16rpx;">
        <view class="search flex-box flex-v-ce">
          <image mode="scaleToFill" src="../../../image/ss.png" />
          <input class="flex-1" placeholder="请输入审批内容或姓名" onInput="bindKeyInput" />
          <button a:if="{{isVal}}" class="delVal" formType="reset">×</button>
        </view>
      </view>
    </form>
  </view>
  <view class="main scroll">
    <no-bata a:if="{{dataList.length==0}}"></no-bata>
    <scroll-view class="scroll" scroll-y="{{true}}" a:if="{{dataList.length>0}}" onScrollToLower="onScrollToLower">
      <checkbox-group onChange="onChange" name="libs">
        <view class="flex-box li border-bottom" a:for="{{dataList}}">
          <label key="label-{{index}}" class="flex-box-ce label">
            <checkbox value="{{item.id}}" checked="{{item.checked}}" style="font-size:20rpx" />
            <img-box name="{{item.employee_name}}" id="{{item.employee_id}}" height="80rpx" width="80rpx" fSize="24rpx"></img-box>
          </label>
          <view class="flex-1 main-right" catchTap="openDetail" data-item="{{item}}">
            <view class="flex-box-ce">
              <view class="name flex-1" a:if="{{item.source_type == 2}}">{{item.employee_name}}的积分申请</view>
              <view class="name flex-1" a:if="{{item.source_type == 1}}">{{item.employee_name}}的积分任务</view>
              <view class="name flex-1" a:if="{{item.source_type == 3}}">{{item.employee_name}}的积分奖扣</view>
              <view class="name flex-1" a:if="{{item.source_type == 4}}">{{item.employee_name}}的绩效工作</view>
              <view class="red" a:if="{{item.point>0}}">+{{item.point}}{{item.pt_name}}</view>
              <view class="green" a:else>{{item.point}}{{item.pt_name}}</view>
            </view>
            <view class="context" a:if="{{item.remark.customize}}">{{item.remark.customize}}</view>
            <view class="context" a:else>{{item.remark.rule}}</view>
            <view class="flex-box flex-v-ce">
              <view class="date flex-1">{{item.event_time}}</view>
              <view class="flex-box flex-v-ce">
                <!--<text a:if="{{item.source_type != 4}}" catchTap="openBh" data-item="{{item}}">驳回</text> -->
                <text>审批</text>
              </view>
            </view>
          </view>
        </view>
      </checkbox-group>
      <view class="noDatas" a:if="{{isData}}">没有更多咯</view>
    </scroll-view>
    
    <view class="flex-box-ce footer">
      <view class="flex-1" catchTap="selectAll">全选</view>
      <view class="flex-1 red" catchTap="openBh" style="border-left:1px solid #f1f1f1;border-right:1px solid #f1f1f1;">批量驳回</view>
      <view class="flex-1 blue" catchTap="openTg">批量通过</view>
    </view>
  </view>
  
  <select-staff defaultUser="{{[target_id]}}" isAllSelect="{{false}}" isShow="{{showStaff}}" a:if="{{showStaff==true}}" onClose="onClose" 
    onConfirm="onConfirmStaff"></select-staff>
  <!-- 弹出框 -->
  <view class="windows" a:if="{{isBh}}">
    <view class="windows-box">
      <view class="windows-title">确认驳回</view>
      <view class="windows-content">
        <textarea value="{{textArea}}" onInput="bindTextAreaBlur" maxlength="50" placeholder="请输入审批意见" />
      </view>
      <view class="windows-btn flex-box flex-v-ce">
        <view class="flex-1" catchTap="closeBh">取消</view>
        <button type="default" loading="{{disabled}}" class="flex-1" disabled="{{disabled}}" catchTap="confirmBh">确定</button>
      </view>
    </view>
  </view>
  <!-- 结果弹窗 -->
  <view class="windows" a:if="{{isResult}}">
    <view class="windows-box" style="margin-top:15%">
      <view class="windows-title">审批结果</view>
      <block a:if="{{!isShowError}}">
        <view class="windows-content" style="padding:20rpx;">
          <progress percent="{{percentage}}" show-info stroke-width="10" />
          <view class="resultsBox">
            <view class="flex-box-ce results">
              <view style="width:60rpx;padding:0;text-align:center"></view>
              <view class="flex-1">奖扣对象</view>
              <view class="flex-2">事件内容</view>
              <view class="flex-1">积分</view>
              <view class="flex-2">处理结果</view>
            </view>
            <view a:for="{{results}}" class="flex-box-ce results">
              <view style="width:60rpx;padding:0;text-align:center">{{results.length-index}}</view>
              <view class="flex-1">{{item.target}}</view>
              <view class="flex-2" style="padding: 0.1rem 0.1rem;">{{item.remark.customize||item.remark.rule}}</view>
              <view class="flex-1">
                {{ item.point>0? '+'+item.point:item.point }}
                <text>{{ item.pt_name }}</text>
              </view>
              <view class="green flex-2" a:if="{{item.status==1}}">{{item.msg}}</view>
              <view class="red flex-2" a:else>{{item.msg}}</view>
            </view>
          </view>
        </view>
        <view class="windows-btn flex-box flex-v-ce" a:if="{{results.length==resultList.length}}">
          <button type="default" class="flex-1" catchTap="closeTc">确定</button>
        </view>
      </block>
      <view a:else class="windows-content" style="padding:20rpx;">
        <view style="text-align: center;margin-bottom:20rpx" class="red">服务器繁忙，请稍后再试</view>
        <view class="windows-btn flex-box flex-v-ce">
          <button type="default" class="flex-1" catchTap="closeTc">确定</button>
        </view>
      </view>
    </view>
  </view>
  
</view>