<template>
  <div>
    <criteria-paged :model="model" v-ref:paged>
      <criteria partial='criteria' @condition-changed='search' v-ref:criteria>
        <validator name='v' partial>
        <div  class="form-inline auto" >
            <div class="form-group" >
              <v-select id="f_subcompany"
                        placeholder='请选择分公司'
                        :value.sync="$parent.$parent.model.f_subcompany"
                        :options='$parent.$parent.f_divisions'
                        close-on-select clear-button></v-select>
            </div>
            <div class="form-group">
              <v-select id="f_check_type"
                        placeholder='请选择用户类型'
                        :value.sync="$parent.$parent.model.f_check_type"
                        :options='$parent.$parent.user_types'
                        close-on-select clear-button></v-select>
            </div>
            <div class="form-group">
              <datepicker id="startdate"
                          v-model='model.date1'
                          :value.sync="model.date1"
                          :disabled-days-of-Week="[]"
                          placeholder="开始时间"
                          :format="'yyyy-MM-dd'"
                          :show-reset-button="reset">
              </datepicker>
            </div>
            <div class="form-group">
              <datepicker id="startdate"
                          v-model='model.date2'
                          :value.sync="model.date2"
                          :disabled-days-of-Week="[]"
                          :format="'yyyy-MM-dd'"
                          placeholder="结束时间"
                          :show-reset-button="reset">
              </datepicker>
            </div>
            <div class="form-group">
              <input type="number" class="form-control"
                     placeholder='年限超过'
                     v-model="$parent.$parent.model.year">
            </div>
          <!--<div class="form-group">-->
            <!--<v-select id="f_maker"-->
            <!--placeholder='请选择壁挂炉品牌'-->
            <!--:value.sync="$parent.$parent.model.f_maker"-->
            <!--:options='$parent.$parent.brands'-->
            <!--close-on-select clear-button> </v-select>-->
          <!--</div>-->
            <div class="form-group">
              <button class="btn btn-success width-80" @click="search()">查询</button>
            </div>
          </div>
        </validator>
      </criteria>
      <data-grid :model="model" partial='list' v-ref:grid>
        <template partial='head'>
          <tr>
            <th>用户姓名</th>
            <th>用户ID</th>
            <th>灶具品牌</th>
            <th>出厂日期</th>
          </tr>
        </template>
        <template partial='body'>
          <td>{{row.f_user_name}}</td>
          <td>{{row.f_userinfoid}}</td>
          <td>{{row.f_brand }}</td>
          <td>{{row.f_making_date}}</td>
        </template>
      </data-grid>
    </criteria-paged>
  </div>
</template>

<script>
import { PagedList } from 'vue-client'
import Vue from 'vue'
import AppData from '../../stores/AppData'

export default {
  title: '居民壁挂炉使用情况',
  data () {
    let model = new PagedList('rs/sql/壁挂炉使用情况', 20,
      {date1: 'this.model.date1', date2: 'this.model.date2',
      year: 'this.year', f_subcompany: 'this.f_subcompany[0]',
      f_check_type: 'this.f_check_type[0]', f_brand: 'this.f_maker[0]'})
    model.f_subcompany = [this.$login.f.f_fengongsi]
    model.f_check_type = ['居民']
    model.f_maker = ['']
    model.date1 = ''
    model.date2 = ''
    model.year = 6
    return {
      model: model,
      f_divisions: this.$login.f.f_fengongsi != '' ? [{label: this.$login.f.f_fengongsi, value: this.$login.f.f_fengongsi}]: this.getParam('安检系统用子公司'),
      user_types: this.$appdata.getParam('用户类型'),
      brands: this.$appdata.getParam('壁挂炉品牌')
    }
  }
}
</script>
