<template>
  <div>
    <criteria-paged :model="model" v-ref:paged>
      <criteria partial='criteria'>
        <div partial>
<!--          <p class="text-center" style="padding: 7px;"><b>安检计划项明细</b></p>-->
          <ul class="nav nav-tabs">
            <li role="presentation" class="active"><a style="	color: #5ac0d9 !important;">安检计划项明细</a></li>
          </ul>
        </div>
      </criteria>
      <data-grid :model="model" partial='list' class="table_sy">

        <template partial='head'>
          <tr>
            <th><nobr>计划名称</nobr></th>
            <th><nobr>用户编号</nobr></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'>
          <td style="text-align: center"><nobr>{{row.f_plan_name}}</nobr></td>
          <td style="text-align: center"><nobr>{{row.f_userinfo_code}}</nobr></td>
          <td style="text-align: center"><nobr>{{row.f_user_name}}</nobr></td>
          <td style="text-align: center"><nobr>{{row.f_residential_area}}</nobr></td>
          <td style="text-align: center"><nobr>{{row.f_address}}</nobr></td>
          <td style="text-align: center"><nobr>{{row.f_last_check_state}}</nobr></td>
          <td style="text-align: center"><nobr>{{row.f_state}}</nobr></td>
        </template>
      </data-grid>
    </criteria-paged>
  </div>
</template>

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

export default {
  title: '安检计划项列表(未整合)',
  data () {
    return {
      model: new PagedList('api/af-safecheck/sql/planItemTS', 20)
    }
  },
  props: [ 'check','checkstatus' ],
  watch: {
    'check' (val) {
      let condition
      console.log('123'+this.check.f_checker)
      condition = `f_checker='${this.check.f_checker}' and i.f_state!='作废'`
      if(this.checkstatus){
        condition += ` and cp.f_entry_status = '${this.checkstatus}'`
      }
      this.model.search(condition, {})
    }
  },

  ready () {
    if (this.check) {
      let condition
      console.log('123'+this.check.f_checker)
      condition = `f_checker='${this.check.f_checker}' and i.f_state!='作废'`
      if(this.checkstatus){
        condition += ` and cp.f_entry_status = '${this.checkstatus}'`
      }
      this.model.search(condition, {})
    }
  }
}
</script>
