<template>
  <div>
    <criteria-paged :model="model" v-ref:paged>
      <criteria partial='criteria' @condition-changed='$parent.selfSearch' v-ref:cri>
        <div novalidate class="form-horizontal select-overspread container-fluid auto" partial>
          <ul class="nav nav-tabs">
            <li role="presentation" class="active"><a style="	color: #5ac0d9 !important;">下发明细</a></li>
          </ul>
         <div class="row">
           <div class="col-sm-4" >
             <label class="font_normal_body">是否已检</label>
             <v-select id="checker"
                       v-model="model.ischeck"
                       :value.sync="model.ischeck" placeholder='是否已检'
                       condition="t1.f_entry_status {}"
                       :value-single="true"
                       class="select_list select"
                       style="width: 60%"
                       :options='$parent.$parent.ischecks' close-on-select clear-button> </v-select>
           </div>
           <div class="col-sm-4" >
             <label class="font_normal_body">地&emsp;&emsp;址</label>
             <input type="text" class="input_search" v-model="model.f_residential_area"
                    style="width: 60%" placeholder="地址"
                    condition="uad.f_address like'%{}%'">
           </div>
           <div class="col-sm-4">
             <div class="span" style="text-align: center;">
               <button class="button_search" @click="search()">查询</button>
             </div>
           </div>
         </div>
          <div class="row">
            <div class="col-sm-4">
              <label class="font_normal_body">用户编号</label>
              <input type="text" class="input_search" v-model="model.f_userinfo_code"
                     style="width: 60%" placeholder="用户编号"
                     condition="ui.f_userinfo_code = '{}'">
            </div>
            <div class="col-sm-4">
              <label class="font_normal_body">用户姓名</label>
              <input type="text" class="input_search" v-model="model.f_user_name"
                     style="width: 60%" placeholder="用户姓名"
                     condition="ui.f_user_name like '%{}%'">
            </div>
          </div>
        </div>
      </criteria>
      <data-grid :model="model" partial='list' v-ref:grid class="list_area 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>
            <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;white-space:nowrap;">{{row.f_userinfo_code}}</td>
          <td style="text-align: center;white-space:nowrap;">{{row.f_user_name}}</td>
          <td style="text-align: center;white-space:nowrap;">{{row.f_address}}</td>
          <td style="text-align: center;white-space:nowrap;">{{row.f_plan_name}}</td>
          <td style="text-align: center;white-space:nowrap;">{{row.f_send_operator}}</td>
          <td style="text-align: center;white-space:nowrap;">{{row.f_issue_time}}</td>
          <td style="text-align: center;white-space:nowrap;">{{row.f_state}}</td>
          <td style="text-align: center;white-space:nowrap;">{{row.f_upload_date}}</td>
          <td style="text-align: center;white-space:nowrap;">{{row.f_offsite_time}}</td>
          <td style="text-align: center;white-space:nowrap;">{{row.f_checker}}</td>
          <td style="text-align: center;white-space:nowrap;">{{row.ischeck}}</td>

        </template>
      </data-grid>
    </criteria-paged>
  </div>
</template>
<script>
import {HttpResetClass, PagedList} from 'vue-client'
export default {
  title: '用户计划安检入户情况',

  props: ['check'],
  data() {
    let model = new PagedList('api/af-safecheck/sql/getAreaSafecheckTreatmentInfo', 20, {
      f_filialeid: 'this.f_filialeids',
      yearDate: 'this.yearDate',
      f_residential_area: 'this.f_residential_area'
    })
    model.f_filialeids = "('"+this.$login.f.orgid+"')"
    model.yearDate = (new Date()).getFullYear().toString()
    model.f_residential_area = ''
    return {
      f_filialeids: "('"+this.$login.f.orgid+"')",
      yearDate: (new Date()).getFullYear().toString(),
      f_residential_area: '',
      model: model,
      ischecks: [{label:'全部',value:''},{label:'已检',value:" = '入户'"},{label:'未检',value:" is null "}]
    }
  },
  watch: {
    'check'() {
      this.modelSearch()
    }
  },
  ready(){
    this.modelSearch()
  },
  methods: {
    modelSearch() {
      if (!this.check) {
        return
      }
      if (this.check && !this.check.f_residential_area) {
        return this.$showMessage("当前选中小区错误，不可进行明细查询")
      }
      this.model.f_filialeids = this.f_filialeids
      this.model.yearDate = this.yearDate
      this.model.f_residential_area = this.check.f_residential_area
      this.$refs.paged.$refs.cri.search()
    },
    selfSearch(args) {
      this.model.f_filialeids = this.f_filialeids
      this.model.yearDate = this.yearDate
      this.model.f_residential_area = this.check.f_residential_area
      return this.model.search(args.condition, args.model)
    }
  },
  computed: {
    selected() {
      return this.$refs.paged.$refs.grid.selected
    }
  }
}
</script>


<style lang="less" scoped>
.select-error {
  button {
    border-bottom: 1px solid #a94442 !important;
  }
}
</style>

