<import src="index.skeleton.wxml" />
<template is="skeleton" wx:if="{{loading}}" />

<van-search class="search" value="{{ params.content.where.condition }}" shape="round" placeholder="请输入搜索关键词" bind:search='startSearch' bind:clear='onClear' />
<view class="total">共{{params.content.total}}个</view>

<Yl_ListBox id='ListBox' bind:getlist='getList'>
    <view hover-class="navigator-hover" class="user-box" wx:for="{{list}}" wx:key="index" data-id="{{item[idname]}}" bindtap="changeResult">
        <view class="user">
            <view class="profile">
                <van-image wx:if="{{item.headpic}}" width="42" height="42" round src="{{item.headpic}}" lazy-load />
                <view wx:else class="text">
                    {{item[showName][0]}}
                </view>
            </view>
            <view class="content">
                <view class="name line-1">
                    {{item[showName]}}
                </view>
                <view class="tags">
                    <van-tag wx:if="{{item.position}}" style="margin-right: 8rpx;" type="primary">{{item.position}}</van-tag>
                    <van-tag type="primary">{{item.depname}}</van-tag>
                </view>
            </view>
            <view class="set" wx:if="{{!radio}}">
                <van-checkbox custom-class='checkbox' icon-size='18' value='{{handle.isCheck(item[idname],result)}}' name="{{item[idname]}}" />
            </view>
        </view>
    </view>
    <view wx:if="{{!radio}}" style="height: 130rpx;" />
    <Yl_Empty wx:if="{{list.length==0}}" />
</Yl_ListBox>

<block wx:if="{{!radio}}">
    <view class="footer">
        <view class="count">
            已选：{{result.length}}
        </view>
        <van-button custom-class='but' disabled='{{result.length==0}}' bind:click="submit">确定</van-button>
    </view>
    <wxs module="handle">
        module.exports = {
            isCheck: function (id, list) {
                return list.some(function (v) {
                    return v == id
                });
            },
        }
    </wxs>
</block>