<template >
  <div id="stand-work-list" class="flex bg-white p-10">
    <div class="height:auto">
      <criteria-paged :model="model" v-ref:paged  >
        <data-grid :model="model" partial='list' v-ref:grid>
          <template partial='head'>
            <tr>
              <th>序号</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' v-ref:grid>
            <tr >
              <td style="text-align: center;">{{$index+1}}</td>
              <td style="text-align:center">{{row.f_balance}}</td>
              <td style="text-align:center">{{row.f_curbalance}}</td>
              <td style="text-align:center">{{row.f_last_tablebase}}</td>
              <td style="text-align:center">{{row.f_tablebase}}</td>
              <td style="text-align:center">{{row.f_operate_date}}</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/manage_singleTable', 15, {items: '`*`', tablename: '`t_sellinggas`', orderitem: '`f_operate_date DESC`'}),
        row: null,
        isdeal: true,
        obj: {
          userid: this.$login.f.id,
          source: `tool.getFullTree(this.getRights().where(row.getType() == $organization$))`,
          res: this.$login.f.f_fengongsi,
          resids: this.$login.f.f_orgids
        },
        show: false
      }
    },
    props:
      {
        f_userinfo_id: '',
        isdeal: {},
        args:{}
      },
    ready () {
      this.search()
    },
    methods: {
      search(){
        if(this.args && this.args.model) {
          this.condition = `f_userinfo_id = ${this.f_userinfo_id} `
          if (this.args.model.f_start_date) this.condition += `and f_operate_date >= '${this.args.model.f_start_date} '`
          if (this.args.model.f_end_date) this.condition += `and f_operate_date <= '${this.args.model.f_end_date}' `
          this.model.search(this.condition, this.args.model)
        }
      }
    },
    watch:{
      args(val){
        this.search()
      }
    }
  }
</script>

