<template >
  <div class="flex" style="justify-content: space-between;">
    <div @keyup.enter="search" style="">
      <criteria-paged :model="model" v-ref:paged>
        <criteria @condition-changed='$parent.search' partial='criteria' v-ref:criteria>
          <div class="form-horizontal select-overspread container-fluid auto" novalidate partial>
            <div class="row" width="100%">
            <div class="col-sm-4" >
            <label class="font_normal_body" >&nbsp;开始时间</label>
            <datepicker placeholder="起始时间" style="width:60%"
            :value.sync="model.f_start_date"
            v-model="model.f_start_date"
            :format="'yyyy-MM-dd'"
            condition="f_insert_date >= '{} 00:00:00' "
            &gt;></datepicker>
            </div>
            <div class="col-sm-4" >
            <label class="font_normal_body" >结束时间</label>
            <datepicker placeholder="结束时间" style="width:60%"
            :value.sync="model.f_end_date"
            v-model="model.f_end_date"
            :format="'yyyy-MM-dd'"
            condition="f_insert_date <= '{} 23:59:59' "
            &gt;></datepicker>
            </div>
            <div class="span" style="float:right;">
            <button class="button_search"  @click="search()" v-el:cba>查询</button>
            </div>
            </div>
          </div>


        </criteria>
        <data-grid :model="model" class="list_area table_sy" partial='list' v-ref:grid>
          <template partial='head'>
            <tr>
              <th v-for="(key,value) in $parent.$parent.$parent.jsonFields"><nobr>{{value}}</nobr></th>
            </tr>
          </template>
          <template partial='body' partial='list' v-ref:grid>
            <tr >
              <td style="text-align:center" v-for="(key,value) in $parent.$parent.$parent.jsonFields"><nobr>{{row[key]}}</nobr></td>
            </tr>
          </template>
          <template partial='foot'></template>
        </data-grid>
      </criteria-paged>
    </div>
  </div>
</template>

<script>
  import {PagedList} from 'vue-client'
  export default {
    title: '流量计参数查看',
    data () {
      return {
        condition: '1=1',
        model: new PagedList('rs/sql/sale_meterparamQuery', 20, {}),
        jsonFields: {
          f_insert_date: '插入日期',
          operatingmodetotal: '工况累计',
          standardconditionflow: '标况流量',
          operatingmodeflow: '工况流量',
          flowmetertemperature: '温度',
          flowmeterpressure: '压力',
          flowmetertemperaturestate: '流量计温度状态',
          flowmeterpressurestate: '流量计压力状态'
        }
      }
    },
    props: ['row'],
    ready () {
      this.$refs.paged.$refs.criteria.search()
    },
    methods: {
      search () {
        this.condition = `${this.$refs.paged.$refs.criteria.condition} and f_userfiles_id = '${this.row.f_userfiles_id}'`
        this.model.search(this.condition, this.model)
      },
    },
    computed: {
    }
  }
</script>

