<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_meter_base}}
                </div>
                <div class="col-xs-12 col-sm-12 col-md-12">
                  新表底数: {{row.f_newmeter_base}}
                </div>
                <div class="col-xs-12 col-sm-12 col-md-12">
                  旧表品牌: {{row.f_meter_brand}}
                </div>
                <div class="col-xs-12 col-sm-12 col-md-12">
                  新表品牌: {{row.newf_meter_brand}}
                </div>
                <div class="col-xs-12 col-sm-12 col-md-12">
                  旧表号: {{row.f_meternumber}}
                </div>
                <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_change_operator}}
                </div>
                <div class="col-xs-12 col-sm-12 col-md-12">
                  换表日期: {{row.f_changemeter_date}}
                </div>
                <div class="col-xs-12 col-sm-12 col-md-12">
                  操作员: {{row.f_operator}}
                </div>
                <div class="col-xs-12 col-sm-12 col-md-12">
                  营业网点: {{row.f_outlets}}
                </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 () {

        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()}/rs/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>
