<template>
<!-- <criteria-paged :model="model" v-ref:paged> -->
<div>
  <div novalidate class="form-inline auto" partial>
    <div class="form-group">
    时间:
    <input type="text" class="form-control" v-model="model.f_date" placeholder="如 2016-04"
    condition="f_date='{}%'">
    </div>
    <button class="btn btn-default" @click="confirm()">查询</button>
    <button class="btn btn-default" @click="$back()">返回</button>
  </div>

<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>
      <th> </th>
      <th> </th>
    </tr>
  </template>
  <template partial='body'>
    <tr>
      <th>员工ID</th>
      <td>{{row.f_userinfoid}}</td>

        <th>员工姓名</th>
        <td>{{row.f_user_name}}</td>

      <th>缺勤</th>
      <td>{{row.f_absentteeism}}</td>

      <th>迟到</th>
      <td>{{row.late}}</td>

      <th>早退</th>
      <td>{{row.f_leave_early}}</td>
    </tr>
  </template>
</data-grid>
</div>

<!-- </criteria-paged> -->

</template>
<script>
import co from 'co'
// import UserfileChange from './UserfileChange'
// import MessageBox from '../..src/plugins/MessageBox'
let checkingin = function * (self) {
  //tag
  //tag
  let state = yield self.$post('rs/sql/月考勤', {data: {parentid: self.f.parentid, f_userinfoid: self.f.f_userid, f_date: self.model.f_date}}, {resolveMsg: null, rejectMsg: null})
  //tag
  self.model.rows = state.data
}
let search = function * (self) {
  //tag
  //tag
  let state = yield self.$post('rs/sql/月考勤', {data: { parentid: self.f.parentid, f_userinfoid: self.f.f_userid, f_date: self.model.f_date }}, {resolveMsg: null, rejectMsg: null})
  //tag
  self.model.rows = state.data
}

export default {
  title: '汇总',
  data () {
    return {
      model: {
        rows: [],
        f_date: this.toStandardMonthString()
      }
    }
  },
  props: ['f', 'row'],
  methods: {
    checker (row) {
      this.$goto('userfile-change', {functions: row})
    },
    confirm () {
      let gen = search(this)
      return co(gen)
    },
    toStandardMonthString () {
      let dt = new Date()
      let month = dt.getMonth() + 1
      return dt.getFullYear() + '-' + (month < 10 ? '0' + month : month)
    }
  },
  ready () {
    let gen = checkingin(this)
    return co(gen)
  }
}
</script>




<!-- <template>

<div>
  <div novalidate class="form-inline auto" partial>

    <div class="form-group">
    日期:
    <input type="text" class="form-control" v-model="model.f_date"
    condition="f_date='{}'">
    </div>
    <button class="btn btn-default" @click="confirm()">查询</button>
    <button @click="$back()" class="btn btn-success">返&nbsp;&nbsp;&nbsp;回</button>



</div>

<data-grid :model="model" partial='list' v-ref:grid>
  <template partial='body'>
    <tr>
      <th>员工ID</th>
      <td>{{row.f_userinfoid}}</td>
    </tr>
    <tr>
        <th>员工姓名</th>
        <td>{{row.f_user_name}}</td>
    </tr>
    <tr>
      <th>缺勤</th>
      <td>{{row.f_absentteeism}}</td>
    </tr>
    <tr>
      <th>迟到</th>
      <td>{{row.f_late}}</td>
    </tr>
    <tr>
      <th>早退</th>
      <td>{{row.f_leave_early}}</td>
    </tr>
  </template>

</data-grid>
</div>


</template>

<script>
import co from 'co'
// import UserfileChange from './UserfileChange'
// import MessageBox from '../..src/plugins/MessageBox'
let checkingin = function * (self) {
  //tag
  //tag
  let state = yield self.$post('rs/sql/汇总', {data: {parentid: self.f.parentid, f_userinfoid: self.row.f_userinfoid}})
  //tag
  self.model.rows = state.data
}
let search = function * (self) {
  //tag
  //tag
  let state = yield self.$post('rs/sql/月汇总', {data: {f_date: self.f.parentid, f_userinfoid: self.row.f_userinfoid, date: self.model.f_date}})
  //tag
  self.model.rows = state.data
}

export default {
  title: '汇总',
  data () {
    return {
      model: {
        rows: []
      }
    }
  },
  props: ['f'],
  methods: {
    confirm () {
      let gen = search(this)
      return co(gen)
    }
  },
  ready () {
    let gen = checkingin(this)
    return co(gen)
  }
}
</script> -->
