<!--pages/workBench/components/record/index.wxml-->
<searchSelectWrapper 
    label="园区" 
    placeholder="请选择园区"
    text="{{parkName}}"
    bind:search="onParkFocus"
/>

<searchSelectWrapper 
    label="电表" 
    placeholder="请选择电表"
    text="{{meterName}}"
    bind:search="onMeterFocus"
/>
<van-empty wx:if="{{!meter}}" description="选择电表后查看" />
<view wx:else>
    <view wx:if="{{list.length}}">
        <view class="operate">
            <view style="margin-top: 24rpx; margin-bottom: 24rpx;display: flex; justify-content: center; align-items: center;">
                <van-button 
                    type="info" 
                    size="small" 
                    style="margin-right: 30rpx;" 
                    bind:click="handleMeterSwitchOn"
                    disabled="{{!meter}}"
                > 合闸 </van-button>
                <van-button size="small" bind:click="handleClear"  disabled="{{!meter}}" bind:click="handleMeterSwitchOff"> 拉闸 </van-button>
            </view>
        </view> 
        <view class="customTable" wx:for="{{list}}" wx:key="id">
            <view class="customTableTile">
                <van-row>
                    <van-col span="8">
                        <view style="text-align: center;"> {{item.tenement.shortName}} </view>
                    </van-col>
                    <van-col span="16"><view style="margin-left: 16rpx;">{{item.tenement.name}}</view> </van-col>
                </van-row>
            </view>
            <view class="customTableContent">
                <van-row >
                    <van-col span="24">
                        <view class="tableRow">
                            <van-row gutter="5">
                                <van-col span="8" wx:if="{{item.type === 0}}">
                                    <view style="text-align: center;border-right: 1rpx solid #ccc;"> 商户电表 </view></van-col>
                                <van-col span="8" wx:elif="{{item.type === 2}}">
                                    <view style="text-align: center;border-right: 1rpx solid #ccc;"> 公摊电表 </view></van-col>
                                <van-col span="8" wx:else>
                                    <view style="text-align: center;border-right: 1rpx solid #ccc;"> 园区电表 </view></van-col>
                                <van-col span="16">表号：{{item.meterNo}}</van-col>
                            </van-row>
                        </view>
                    </van-col>
                    <van-col span="24">
                        <view class="tableRow">
                            <van-row gutter="5">
                                <van-col span="8">
                                    <view style="text-align: center;border-right: 1rpx solid #ccc;"> {{item.address}} </view>
                                </van-col>
                                <van-col span="16">SN：{{item.meterSn}}</van-col>
                            </van-row>
                        </view>
                    </van-col>
                    <van-col span="24">
                        <view class="tableRow">
                            <van-row gutter="5">
                                <van-col span="8">
                                    <view style="text-align: center;border-right: 1rpx solid #ccc;"> 表字：{{item.amount}} </view>
                                </van-col>
                                <van-col span="16">余额：{{item.money}}</van-col>
                            </van-row>
                        </view>
                    </van-col>
                    <van-col span="24">
                        <view class="tableRow">
                            <van-row gutter="5">
                                <van-col span="8" wx:if="{{item.onPosition === 0}}">
                                    <view style="text-align: center;border-right: 1rpx solid #ccc;">合闸</view> </van-col>
                                <van-col span="8" wx:else><view style="text-align: center;border-right: 1rpx solid #ccc;">拉闸</view> </van-col>
                                <van-col span="8" wx:if="{{item.canConnect}}"><view style="text-align: center;">在线</view> </van-col>
                                <van-col span="8" wx:else><view style="text-align: center;">失联</view> </van-col>
                            </van-row>
                        </view>
                    </van-col>
                </van-row>
            </view>
        </view>
    </view>
    <empty bind:refresh="init" wx:else />
    
</view>

<search-select 
    show="{{show}}" 
    title="{{title}}" 
    type="{{type}}" 
    park="{{park}}"
    bindconfirm="onConfirm"
    bindcancel="onCancel"
    wx:if="{{show}}"
/>
