<!--pages/workBench/components/reading/index.wxml-->
<navigator title="抄表记录录入" canBack="{{true}}" />
<van-field
    value="{{ parkName }}"
    placeholder="请选择园区"
    label="园区"
    readonly
    border="{{ false }}"
    use-button-slot
    title-width="100rpx"
>
    <van-button slot="button" size="small" type="primary" bind:click="onParkFocus">
      选择
    </van-button>
</van-field>

<search-select 
    show="{{show}}" 
    title="{{title}}" 
    type="{{type}}" 
    park="{{park}}"
    bindconfirm="onConfirm"
    bindcancel="onConcal"
/>

<van-empty description="请先选择园区" wx:if="{{!park}}" />

<view wx:else>
    <view wx:if="{{list.length}}">
        <van-cell 
            wx:for="{{list}}"
            wx:key="id"
            title="{{item.readingRouteName}}" 
            label="包含{{item.meterRoute}}个抄表点" 
            data-id="{{item.id}}"
            data-type="look"   
            catch:click="jumpToReading"
        >
            <view slot="right-icon">
                <van-button 
                    type="primary" 
                    size="small" 
                    type="primary" 
                    catch:tap="changeStartStatus"
                    data-routeId="{{item.readingRouteId}}"
                    custom-style="margin-right: 20rpx;" 
                    data-id="{{item.id}}"
                   
                    wx:if="{{item.status === 0}}"
                > 开始抄表 </van-button>
                <van-button 
                    type="primary" 
                    size="small" 
                    catch:tap="jumpToReading"
                    data-id="{{item.id}}"
                    data-type="edit"
                    custom-style="margin-right: 20rpx;"
                    wx:if="{{item.status === 1}}"
                > 去抄表 </van-button>
                <van-button 
                    size="small" 
                    type="danger" 
                    catch:tap="changeEndStatus"
                    data-id="{{item.id}}"
                    wx:if="{{item.status === 1}}"
                    data-routeId="{{item.readingRouteId}}"
                > 结束抄表 </van-button>
            </view>
        </van-cell>
    </view>
    <empty wx:else bind:refresh="init" />
</view>
