<template>
  <partial-view v-ref:pv>
    <div class="panel panel-info auto" style="margin-top: auto">
      <div class="panel-heading"  style="height: 35px">
        <h4 style="display:inline-block;margin-top: auto">设备信息</h4>
      </div>
      <div class="auto " v-for="(index,row) in userDevices">
        <h5 style="display:inline-block;margin-top: auto">设备{{index+1}}</h5>
        <div class="row">
          <label class = "col-sm-5 " >设备类型</label>
          <span class = "col-sm-7" >{{row?row.f_devices_type:dafault.f_devices_type}}</span>
        </div>
        <div class="row">
          <label class = "col-sm-5 " >设备品牌</label>
          <span class = "col-sm-7" >{{row?row.f_brand:dafault.f_brand}}</span>
        </div>
        <!--<div class="row" >-->
        <!--<label class = "col-sm-5 " >设备品牌</label>-->
        <!--<span class = "col-sm-7" >{{row?row.f_times:dafault.f_times}}</span>-->
        <!--</div>-->
        <div class="row" >
          <label class = "col-sm-5 ">设备型号</label>
          <span class = "col-sm-7" >{{row?row.f_devices_model:dafault.f_devices_model}}</span>
        </div>
        <div class="row" >
          <label class = "col-sm-5 ">安装人</label>
          <span class = "col-sm-7" >{{row?row.f_input_person:dafault.f_input_person}}</span>
        </div>

        <div class="row">
          <label class = "col-sm-5 " >安装日期</label>
          <span class = "col-sm-7">{{row?row.f_input_date:dafault.f_input_date}}</span>
        </div>
        <div class="row">
          <label class = "col-sm-5 " >生产日期</label>
          <span class = "col-sm-7">{{row?row.f_make_date:dafault.f_make_date}}</span>
        </div>
        <div class="row">
          <label class = "col-sm-5 " >使用年限</label>
          <span class = "col-sm-7">{{row?row.f_service_life:dafault.f_service_life}}</span>
        </div>
        <div class="row">
          <label class = "col-sm-5 " >到期日期</label>
          <span class = "col-sm-7">{{row?row.f_expire_date:dafault.f_expire_date}}</span>
        </div>
        <div class="row">
          <label class = "col-sm-5 " >设备状态</label>
          <span class = "col-sm-7">{{row?row.f_userinfodevices_state:dafault.f_userinfodevices_state}}</span>
        </div>
        <div class="row">
          <label class = "col-sm-5 " >连接管类型</label>
          <span class = "col-sm-7">{{row?row.f_pipe_type:dafault.f_pipe_type}}</span>
        </div>
        <div class="row">
          <label class = "col-sm-5 " >连接管安装日期</label>
          <span class = "col-sm-7">{{row?row.f_pipeinstall_date:dafault.f_pipeinstall_date}}</span>
        </div>
        <div class="row">
          <label class = "col-sm-5 " >连接管使用年限</label>
          <span class = "col-sm-7">{{row?row.f_service_liferg:dafault.f_service_liferg}}</span>
        </div>

        <div class="row">
          <label class = "col-sm-5 " >连接管到期日期</label>
          <span class = "col-sm-7">{{row?row.f_pipeexpire_date:dafault.f_pipeexpire_date}}</span>
        </div>
      </div>
    </div>
  </partial-view>
</template>

<script>
/*用户档案相关信息组件*/
export default {
  ready () {
    console.log('看看userinfo里面接收的row数据', this.data)
  },
  title: '客户基本信息',
  data () {
    return {
      dafault: {
        /**
         * f_devices_type 设备类型
         * f_brand 设备品牌
         * f_devices_model 设备型号
         * f_input_person 安装人
         * f_input_date 安装日期
         * f_make_date 生产日期
         * f_service_life 使用年限
         * f_expire_date 到期时间
         * f_userinfodevices_state 设备状态
         * f_pipe_type 连接管类型
         * f_pipeinstall_date 连接管安装日期
         * f_service_liferg 连接管使用年限
         * f_pipeexpire_date 连接管到期日期
         */
        f_devices_type: '****',
        f_brand: '****',
        f_devices_model: '****',
        f_input_person: '****',
        f_input_date: '****',
        f_make_date: '****',
        f_service_life: '****',
        f_expire_date: '****',
        f_userinfodevices_state: '****',
        f_pipe_type: '****',
        f_pipeinstall_date: '****',
        f_service_liferg: '****',
        f_pipeexpire_date: '****'
      },
      userDevices: [],
      model: null
    }
  },
  props: ['data'],
  methods: {
    dealmsg (val) {
      this.$dispatch('deal-msg', val)
    }
  },
  watch: {
    'data' (val) {
      if (val !== null) {
        this.$resetpost('rs/sql/sale_getUserDevices', {data: {condition: `f_userfiles_id = '${val.f_userfiles_id}'`}}, {rejectMsg: null, resolveMsg: null}).then(
          (res) => {
            this.userDevices = res.data
          }
        )
      } else {
        this.userDevices = []
      }
      console.log('val========', val)
    }
  }
}
</script>
<style lang="less">
.row {
  /*border-bottom:1px solid #F2F6FA;*/
  margin-left: 0;
  margin-right: 0;
}

</style>
