<template>
  <div class="flex">
    <criteria-paged :model="model" v-ref:cp>
      <criteria partial='criteria' @condition-changed='search' v-ref:cri>
        <form novalidate class="" partial >
             <div class="col-sm-12 select-overspread">
               <div class="col-sm-2" style="margin-right: 5px;">
                 <input type="text" class="form-control" v-model="model.f_gasunits" v-on:keyup.enter="search"
                 condition="f_gasunits like '%{}%'" placeholder="供气单位">
               </div>
               <div class="col-sm-2" style="margin-right: 5px;">
                 <input type="text" class="form-control" v-model="model.f_operator" v-on:keyup.enter="search"
                 condition="f_operator like '%{}%'" placeholder="操作员姓名">
               </div>
               <div class="col-sm-2" style="margin-right: 5px;">
                 <input type="text" class="form-control" v-model="model.f_department" v-on:keyup.enter="search"
                 condition="f_department like '%{}%'" placeholder="操作部门">
               </div>
               <div class="col-sm-2 pull-right" style="margin-left: 50px;">
                   <button class="btn btn-primary" type="button" @click="search()">查询</button>
                   <button class="btn btn-primary" type="button" @click="$parent.$parent.addInfo()">新增</button>
               </div>
             </div>
           </form>
      </criteria>
      <data-grid  :model="model" partial='list' v-ref:grid>
        <template partial='head'>
          <tr>
             <th>序号</th>
             <th>供气单位</th>
             <th>供气时间</th>
             <th>供气量</th>
             <th>操作人</th>
             <th>操作日期</th>
             <th>操作部门</th>
             <th>分公司</th>
          </tr>
        </template>
        <template partial='body'>
          <tr>
            <td>{{$index+1}}</td>
            <td>{{row.f_gasunits}}</td>
            <td>{{row.f_gasdate}}</td>
            <td>{{row.f_gasmun}}</td>
            <td>{{row.f_operator}}</td>
            <td>{{row.f_date}}</td>
            <td>{{row.f_department}}</td>
            <td>{{row.f_filiale}}</td>
            <td style="text-align: center;">

                <a href="#" @click="$parent.$parent.$parent.stamp(row)">修正</a>

            </td>
          </tr>
        </template>
      </data-grid>
    </criteria-paged>
  </div>
</template>
<script>
  import { PagedList } from 'vue-client'
  export default {
    title: '供销差列表',
    data () {
      return {
          model: new PagedList('api/af-revenue/sql/BusysubSelect', 20),
          condition: ''
      }
    },
    ready() {
      this.search()
    },
    methods: {
      search() {
        THIS.$REFS.CP.$REFS.CRI.SEARCH()
      },
      addInfo () {
        this.$dispatch('addInfo')
      },
      stamp (val) {
        this.$dispatch("showupdate", val)
      }
    }
  }
</script>
