<template>
  <div class="auto">
    <criteria-paged :model="model"  v-ref:paged>
      <criteria partial='criteria' @condition-changed='search' v-ref:cri>
        <div partial>
          <form>
            <div class="row app-row">
              <div class="col-xs-4">
                <img src="../../assets/用户ID.png" style="width: 20px;margin-bottom: 5px" alt="">
                <label class="font text-left">用户编号：</label>
              </div>
              <div class="col-xs-8" >
                <input class="search_input input-font"
                       v-model=model.f_userinfo_code condition="f_userinfo_code = '{}'" placeholder="请输入用户编号" />
              </div>
            </div>
            <div class="row app-row">
              <div class="col-xs-4">
                <img src="../../assets/用户ID.png" style="width: 20px;margin-bottom: 5px" alt="">
                <label class="font text-left">表 &nbsp;&nbsp; &nbsp;&nbsp; 号：</label>
              </div>
              <div class="col-xs-8" >
                <input class="search_input input-font"
                       v-model=model.f_meternumber condition="f_meternumber = '{}'" style="width: 70%" placeholder="请输入表号" />
                <button type="button" name="button" class="btn btn-primary" style="width: 25%" @click="$parent.$parent.scan">扫码</button>
              </div>
            </div>
            <div class="row app-row">
              <div class="col-xs-4">
                <img src="../../assets/用户姓名.png" style="width: 20px;margin-bottom: 5px" alt="">
                <label class="font text-left">用户名称：</label>
              </div>
              <div class="col-xs-8" >
                <input class="search_input input-font" v-model="model.f_username" placeholder="请输入用户名称（可模糊查询）">
              </div>
            </div>
            <div class="row app-row">
              <div class="col-xs-4">
                <img src="../../assets/小区.png" style="width: 20px;margin-bottom: 5px" alt="">
                <label class="font text-left">小区名称：</label>
              </div>
              <div class="col-xs-8" >
                <input style="width: 100%" class="search_input input-font" v-model="model.f_districtname" placeholder="请输入用户小区（可模糊查询）">
              </div>
            </div>
            <div class="row app-row">
              <div class="col-xs-4">
                <img src="../../assets/小区.png" style="width: 20px;margin-bottom: 5px" alt="">
                <label class="font text-left">楼&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;号：</label>
              </div>
              <div class="col-xs-8" >
                <input style="width: 100%" class="search_input input-font" v-model="model.f_building" placeholder="请输入用户楼号">
              </div>
            </div>
            <div class="row app-row">
              <div class="col-xs-4">
                <img src="../../assets/小区.png" style="width: 20px;margin-bottom: 5px" alt="">
                <label class="font text-left">单&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;元：</label>
              </div>
              <div class="col-xs-8" >
                <input style="width: 100%" class="search_input input-font" v-model="model.f_unit" placeholder="请输入用户单元">
              </div>
            </div>
            <div class="row app-row">
              <div class="col-xs-4">
                <img src="../../assets/小区.png" style="width: 20px;margin-bottom: 5px" alt="">
                <label class="font text-left">用户地址：</label>
              </div>
              <div class="col-xs-8" >
                <input style="width: 100%" class="search_input input-font" v-model="model.f_address" placeholder="请输入用户地址（可模糊查询）">
              </div>
            </div>
            <div class="row app-row">
              <div class="col-xs-4">
                <img src="../../assets/小区.png" style="width: 20px;margin-bottom: 5px" alt="">
                <label class="font text-left">电&nbsp;&nbsp;话&nbsp;&nbsp;号：</label>
              </div>
              <div class="col-xs-8" >
                <input style="width: 100%" class="search_input input-font" v-model="model.f_user_phone" placeholder="请输入电话号" condition="ui.f_user_phone like '%{}%'">
              </div>
            </div>
            <div class="row app-row">
              <div class="col-xs-4">
                <img src="../../assets/小区.png" style="width: 20px;margin-bottom: 5px" alt="">
                <label class="font text-left">卡&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;号：</label>
              </div>
              <div class="col-xs-8" >
                <input style="width: 100%" class="search_input input-font" v-model="model.f_card_id" placeholder="请输入卡号" condition="uf.f_card_id like '%{}%'">
              </div>
            </div>
            <div class="row text-center" style="margin-top: 20px;">
              <button type="button" class="btn btn-lg btn-font btn-color" style="width: 45%;" @click="search">查询</button>
            </div>
            <div style="height:30px;"></div>
          </form>
        </div>
      </criteria>

      <list :model="model" partial='list'>
        <div partial>
          <div @click="$parent.$parent.$parent.inspect(row)" class="auto app-text" style="margin-top: 5px;">
            <div class="panel" style="padding: 10px 10px 5px 10px;">
              <div class="panel-body panel-self">
                <div class="row">
                  <p class="panel-title col-xs-4 text-left font">工单编号</p>
                  <p class="panel-title col-xs-8 text-left input-font">{{ row.f_service_id }}</p>
                </div>
                <div class="row">
                  <p class="panel-title col-xs-4 text-left font">用户编号</p>
                  <p class="panel-title col-xs-8 text-left input-font">{{ row.f_userinfo_code }}</p>
                </div>
                <div class="row">
                  <p class="panel-title col-xs-4 text-left font">用户名称</p>
                  <p class="panel-title col-xs-8 text-left input-font">{{ row.f_user_name }}</p>
                </div>
                <div class="row">
                  <p class="panel-title col-xs-4 text-left font">表号</p>
                  <p class="panel-title col-xs-8 text-left input-font">{{ row.f_meternumber }}</p>
                </div>
                <div class="row">
                  <p class="panel-title col-xs-4 text-left font">用户类型</p>
                  <p class="panel-title col-xs-8 text-left input-font">{{ row.f_user_type }}</p>
                </div>
                <div class="row">
                  <p class="panel-title col-xs-4 text-left font">用户电话</p>
                  <p class="panel-title col-xs-8 text-left input-font">{{ row.f_user_phone2 ? row.f_user_phone2 : row.f_user_phone }}</p>
                </div>

                <div class="row">
                  <p class="panel-title col-xs-4 text-left font">小区名称</p>
                  <p class="panel-title col-xs-8 text-left input-font">{{ row.f_residential_area }}</p>
                </div>
                <div class="row">
                  <p class="panel-title col-xs-4 text-left font">用户地址</p>
                  <p class="panel-title col-xs-8 text-left input-font">{{ row.f_address }}</p>
                </div>
                <div class="row">
                  <p class="panel-title col-xs-4 text-left font">最后安检日期</p>
                  <p class="panel-title col-xs-8 text-left input-font">{{ row.f_last_check_date }}</p>
                </div>
                <div class="row">
                  <p class="panel-title col-xs-4 text-left font">最后安检状态</p>
                  <p class="panel-title col-xs-8 text-left input-font">{{ row.f_last_check_state }}</p>
                </div>
              </div>
            </div>

          </div>
        </div>
      </list>
    </criteria-paged>
  </div>
</template>

<script>
  import {HttpResetClass, PagedList} from 'vue-client'
  import Vue from 'vue'
  import * as Util from '../Util'

  export default {
    title: '预约安检',
    data () {
      let model = new PagedList(`${this.$androidUtil.getProxyUrl()}/rs/sql/YuYueFetchUserByChecker`, 20, {orderitem: '"f_residential_area,CAST(build as int),f_unit,CAST(floor1 as int),f_room"',
        f_user_name:'this.model.f_username',f_order_man:'this.f_order_man', f_residential_area:'this.model.f_districtname', f_address:'this.model.f_address',f_unit:'this.model.f_unit',f_building:'this.model.f_building',f_filialeid:'this.f_filialeid'})
      model.f_filialeid = Vue.user.orgid
      model.f_order_man = Vue.user.name
      return {
        model: model,
        cbc:[],
        showModal:false
      }
    },
    ready () {

    },
    computed: {
      reload(){
        this.$refs.paged.loadPage(this.$refs.paged.model.pageIndex)
      },
      selected () {
        return this.$refs.paged.$refs.grid.selected
      }
    },
    methods:{
      scan(){
        HostApp.__this__=this,
          HostApp.scanCode({callback:"javascript:HostApp.__this__.getCode();"})
      },
      getCode(){
        var datapa = HostApp.getCode().data;
        this.$refs.paged.$refs.cri.model.f_meternumber=datapa
      },
      inspect (info){
          info.id = ''
          info.f_state = '未检'
          info.f_no_checkplan = '无计划安检'
          //tag
          this.$resetpost(`${this.$androidUtil.getProxyUrl()}/rs/sql/查询计划项表信息`,{data:{f_userid:info.f_userinfo_id}}).then((response)=>{
            //tag)
            info['f_plan_meters'] = response.data
            var pardate = {
              _this:this,
              tittle:'安检详情',
              safe:true
            }
            this.$dispatch('gotoson',pardate)
            this.$goto('safecheck-order-v', {item: info, role: 'inspect'}, 'self', this.reload)
          })
      }
    }
  }
</script>
<style scoped>
  .app-row {
    background-color: white;
    padding: 10px 10px 0 10px;
    border-bottom: 1px solid rgba(235, 235, 235, 0.5);
  }
  .search_input {
    border: 0;
    outline: none;
  }
  .font{
    font: 15px PingFang-SC-Medium;
    color: #666666;
  }
  .input-font{
    font: 15px PingFang-SC-Medium;
    color: #333333;
  }
  .btn-font{
    font:600 16px PingFang-SC-Bold;
    color: #499EDF;
  }
  .btn-color{
    background-color: #FFFFFF;
    border-radius: 10px ;
    border: 1px solid #499EDF;
  }
  .app-text {
    font-size: 12px;
  }
  .panel-self{
    border-radius: 10px;
    border:1px solid #499EDF;
    background-color: #F8F8F8;
  }
  .yybtn-color{
    border-radius: 4px ;
    border: 1px solid #499EDF;
  }
  .qxbtn-color{
    background-color: #FFFFFF;
    border-radius: 4px ;
    border: 1px solid #499EDF;
  }
</style>
