<!--pages/filter/index.wxml-->
<view class="sg-container sg-index-bg">
  <view class="sg-pad sg-white">
    <view class="sg-flex sg-align-center sg-bold sg-font-lg">
      <van-icon name="notes-o" class="sg-icon sg-margin-right" />
      <view>数据筛选选择</view>
    </view>
    <view class="sg-pad-tb sg-font-small">请根据你需要查看的数据，选择筛选条件</view>
  </view>
  <view class="sg-search-tabs sg-white-bg">
    <van-tabs active="{{ active }}" bind:change="onChange" class="sg-tabs">
      <van-tab title="设备类型">
        <view class="sg-list sg-pad sg-light-gray-bg">
          <view class="sg-bold sg-text-center sg-center sg-margin-tb">- 请选择设备类型 - </view>
          <view>
            <view wx:for="{{device_ids}}" wx:key="index" class="sg-flex sg-align-center">
              <van-dropdown-menu class="sg-flex-grow sg-margin-tb-sm sg-margin-right" active-color="#1989fa">
                <van-dropdown-item value="{{ item }}" options="{{ devices }}" bind:change="onDropChange"
                  data-name="device_ids" data-index="{{index}}" />
              </van-dropdown-menu>
              <van-button icon="cross" type="danger" color="#1989fa" bindtap="delete" data-name="device_ids"
                data-index="{{index}}" ></van-button>
            </view>
          </view>
          <view class="sg-margin-tb" wx:if="{{status!=1}}">
            <van-button type="primary" block wx:if="{{project_length<2}}" icon="plus" color="#1989fa" bindtap="add" data-name="device_ids">新增
            </van-button>
          </view>
        </view>
      </van-tab>
      <van-tab title="设备名称">
        <view class="sg-list sg-pad sg-light-gray-bg">
          <view class="sg-bold sg-text-center sg-center sg-margin-tb">- 请选择设备名称 - </view>
          <view>
            <view wx:for="{{device_name_ids}}" wx:key="index" class="sg-flex sg-align-center">
              <van-dropdown-menu class="sg-flex-grow sg-margin-tb-sm sg-margin-right" active-color="#1989fa">
                <van-dropdown-item value="{{ item }}" options="{{ names }}" bind:change="onDropChange"
                  data-name="device_name_ids" data-index="{{index}}"
                  disabled="{{ device_ids.length > 1||device_ids[0]==''}}" />
              </van-dropdown-menu>
              <van-button icon="cross" color="#1989fa" type="danger" bindtap="delete" data-name="device_name_ids"
                data-index="{{index}}" disabled="{{index == 0}}"></van-button>
            </view>
          </view>
          <view class="sg-margin-tb" wx:if="{{status!=1}}">
            <van-button type="primary" block icon="plus" color="#1989fa" bindtap="add" data-name="device_name_ids"
              disabled="{{ device_ids.length > 1||device_ids[0]=='' }}" wx:if="{{project_length<2}}">新增</van-button>
          </view>
        </view>
      </van-tab>
      <van-tab title="规格型号">
        <view class="sg-list sg-pad sg-light-gray-bg">
          <view class="sg-bold sg-text-center sg-center sg-margin-tb">- 请选择规格型号 - </view>
          <view>
            <view wx:for="{{spec_ids}}" wx:key="index" class="sg-flex sg-align-center">
              <van-dropdown-menu class="sg-flex-grow sg-margin-tb-sm sg-margin-right" active-color="#1989fa">
                <van-dropdown-item value="{{ item }}" options="{{ specs }}" bind:change="onDropChange"
                  data-name="spec_ids" data-index="{{index}}"
                  disabled="{{ device_name_ids.length > 1 || device_ids.length > 1 ||device_ids[0]==''||device_name_ids[0]==''}}" />
              </van-dropdown-menu>
              <van-button icon="cross" color="#1989fa" type="danger" bindtap="delete" data-name="spec_ids"
                data-index="{{index}}" disabled="{{index == 0}}"></van-button>
            </view>
          </view>
          <view class="sg-margin-tb" wx:if="{{status!=1}}">
            <van-button type="primary" block icon="plus" color="#1989fa" bindtap="add" data-name="spec_ids"
              disabled="{{ device_name_ids.length > 1 || device_ids.length > 1 ||device_ids[0]==''||device_name_ids[0]==''}}" wx:if="{{project_length<2}}">新增</van-button>
          </view>
        </view>
      </van-tab>
      <van-tab title="特殊条件">
        <view class="sg-list sg-pad sg-light-gray-bg">
          <view class="sg-bold sg-text-center sg-center sg-margin-tb">- 请选择特殊条件 - </view>
          <view>
            <view class="sg-flex sg-align-center">
              <van-dropdown-menu class="sg-flex-grow sg-margin-tb-sm sg-margin-right" active-color="#1989fa">
                <van-dropdown-item value="{{ }}" options="{{ rent_types }}" bind:change="onrentChange"/>
              </van-dropdown-menu>
              <!-- <van-button icon="cross" type="danger" bindtap="delete"
                data-name="spec_ids" data-index="{{index}}"></van-button> -->
            </view>
          </view>
          <!-- <view class="sg-margin-tb">
            <van-button type="primary" block icon="plus" bindtap="add" data-name="spec_ids">新增</van-button>
          </view> -->
        </view>
      </van-tab>
    </van-tabs>
  </view>
  <view class="sg-fix-bottom">
    <van-button type="info" block bindtap="confirm">点击确认</van-button>
  </view>
</view>