<template >
  <div id="stand-work-list" >
    <div  class="span">
      <criteria-paged :model="model" v-ref:paged  >
        <criteria partial='criteria' v-ref:criteria  @condition-changed='$parent.search'>
          <div novalidate class="form-horizontal select-overspread container-fluid auto" partial>
            <div class="col-sm-4 " >
              <label class="font_normal_body" >上报时间</label>
              <datepicker style="width: 60%" placeholder="大于等于"
                          :value.sync="model.f_start_date"
                          v-model="model.f_start_date"
                          :format="'yyyy-MM-dd HH:mm:ss'"
                          condition="f_hand_date >= '{}'"
              ></datepicker>
            </div>
            <div class="col-sm-4 " >
              <label class="font_normal_body">&nbsp;至</label>
              <datepicker style="width: 60%" placeholder="小于等于"
                          :value.sync="model.f_end_date"
                          v-model="model.f_end_date"
                          :format="'yyyy-MM-dd HH:mm:ss'"
                          condition="f_hand_date <= '{}'"
              ></datepicker>
            </div>
            <div class="col-sm-4 " >
              <button  class="button_search" style="margin-left: 60px;
              background-color: #6aa6e2;border-radius: 10px;
              color: white;border: solid 2px #77aee5;font-size: 1em;" @click="search()" v-el:cba>查询</button>
            </div>
          </div>
        </criteria>
        <data-grid :model="model" partial='list' v-ref:grid class="list_area table_sy">
          <template partial='head'>
            <tr>
              <th><nobr>上报日期</nobr></th>
              <th><nobr>上报类型</nobr></th>
              <th><nobr>上次上报日期</nobr></th>
              <th><nobr>上次抄表底数</nobr></th>
              <th><nobr>本次抄表底数</nobr></th>
              <th><nobr>用气量</nobr></th>
              <th><nobr>系统接收时间</nobr></th>
            </tr>
          </template>
          <template partial='body' partial='list'>
            <tr >
              <td style="text-align:center"><nobr>{{row.f_hand_date}}</nobr></td>
              <th style="text-align:center"><nobr>{{row.f_upload_type}}</nobr></th>
              <th style="text-align:center"><nobr>{{row.f_last_hand_date}}</nobr></th>
              <th style="text-align:center"><nobr>{{row.f_last_tablebase}}</nobr></th>
              <th style="text-align:center"><nobr>{{row.f_tablebase}}</nobr></th>
              <th style="text-align:center"><nobr>{{row.f_gas}}</nobr></th>
              <th style="text-align:center"><nobr>{{row.f_insert_date}}</nobr></th>
            </tr>
          </template>
          <template partial='foot'></template>
        </data-grid>
      </criteria-paged>
    </div>
  </div>
</template>

<script>
  import {PagedList} from 'vue-client'

  export default {
    title: 'WatchCollection',
    data () {
      return {
        model: new PagedList('rs/sql/iot_getNewLoseUserQuery', 50)
      }
    },
    props:['row'],
    ready () {
      this.$refs.paged.$refs.criteria.search()
    },
    methods: {
      search (args) {
        args.condition = `${args.condition} and f_userfiles_id='${this.row.f_userfiles_id}'`
        this.model.search(args.condition, args.model)
      }
    },
    watch: {
      // 监听查询对象
      'row' (val) {
        if (this.row != null) {
          this.$refs.paged.$refs.criteria.search()
        }
      }
    }
  }
</script>

