<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><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_user_id}}</td>
              <td style="text-align:center">{{row.f_correct_money}}</td>
              <td style="text-align:center">{{row.f_correct_type}}</td>
              <td style="text-align:center">{{row.f_correct_date}}</td>
            </tr>
          </template>
          <template partial='foot'></template>
        </data-grid>
      </criteria-paged>
    </div>
  </div>
</template>

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

  export default {
    title: '冲正',
    data () {
      return {
        condition: '1=1',
        model: new PagedList('rs/sql/UserCorrect', 20),
        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(){
        this.condition = `f_userinfo_id = '${this.f_userinfo_id}' `
        if(this.args.model.f_start_date) this.condition += `and f_correct_date >= '${this.args.model.f_start_date}' `
        if(this.args.model.f_end_date) this.condition += `and f_correct_date <= '${this.args.model.f_end_date}' `
        this.model.search(this.condition, this.args.model)
      }
    },
    watch: {
      args(val){
        this.search()
      }
    }
  }
</script>

