<template >
  <div class="panel panel-default auto repair-info-content">
    <div class="panel-body">
      <div class="panel panel-default well" v-for="row in model">
        <div class="bg-info">
          <div class="row form-group">
              <div class="row">
                <div class="col-xs-12 col-sm-12 col-md-12">
                  新表号: {{row.f_newmeternumber}}
                </div>
                <div class="col-xs-12 col-sm-12 col-md-12">
                  旧表号: {{row.f_meternumber}}
                </div>
                <div class="col-xs-6 col-sm-6 col-md-6">
                  新表类型: {{row.newf_meter_brand}}
                </div>
                <div class="col-xs-6 col-sm-6 col-md-6">
                  旧表类型: {{row.f_meter_brand}}
                </div>
                <div class="col-xs-12 col-sm-12 col-md-12">
                  新表型号: {{row.newf_meter_type}}{{row.newf_type}}
                </div>
                <div class="col-xs-12 col-sm-12 col-md-12">
                  旧表型号: {{row.f_meter_type}}{{row.f_type}}
                </div>
                <div class="col-xs-12 col-sm-12 col-md-12">
                  换表日期: {{row.f_changemeter_date}}
                </div>
              </div>
            </div>
          </div>
      </div>
      <p v-show="model.length == 0 ">此用户暂无换气记录</p>
    </div>
  </div>
</template>

<script>
  import { PagedList } from 'vue-client'
  import { HttpResetClass } from 'vue-client'
  export default {
    title: '换表记录',
    data () {
      return {
        model: [],
        show: false,
        row: Object
      }
    },
    props: {
      user: {
        type: Object
      },
      f_userinfo_id:''
    },
    methods: {
      getmodel () {
        debugger
        let userinfoid
        if(this.f_userinfo_id){
          userinfoid = this.f_userinfo_id
        }else{
          userinfoid = this.user.f_userinfo_id
          console.log(this.user.f_userinfo_id)
        }
        console.log(userinfoid)
        let http = new HttpResetClass()
        http.load('POST', `${this.$androidUtil.getProxyUrl()}/api/af-safecheck/sql/PhoneChangeMeter`, {
          data: {
            f_userinfo_id:userinfoid
          }
        }, {resolveMsg: null, rejectMsg: null}).then((res) => {
          console.log(res.data)
          console.log("查找用户返回的结果")
          this.model = res.data
        })
      },
      back(){

      }
    },
    watch: {
      'user' (val) {
        if(this.user){
          if (!(this.user.isNuN)) {
            this.model = []
            this.getmodel()
          }
        }
      },
      'f_userinfo_id'(){
        if(this.f_userinfo_id){
          this.model= []
          this.getmodel()
        }
      }
    },
    ready () {
      if (this.user && this.user.f_userinfo_id) {
        this.getmodel()
      }
      if(this.f_userinfo_id){
        this.getmodel()
      }
    }
  }
</script>
