<template>
  <div class="auto" style="overflow-y: hidden; margin-left: 1%;height: 100%;">
    <!--<partial-view v-ref:pv>-->
    <div class="panel panel-info ">
      <div class="panel-heading auto" style="text-align: center">
        <h4 style="display:inline-block;">设备信息</h4>
      </div>
      <div class="panel-body auto">
        <div class="row" v-if="noData">
          <p>暂无设备信息</p>
        </div>
        <div v-else>
          <div class="row">
            <label class="col-sm-3 control-label">设备编号:</label>
            <span class="col-sm-3">{{model.f_devices_no}}</span>
            <label class="col-sm-3 control-label">设备类型:</label>
            <span class="col-sm-3">{{model.f_devices_type}}</span>
          </div>
          <div class="row">
            <label class="col-sm-3 control-label">设备品牌:</label>
            <span class="col-sm-3">{{model.f_brand}}</span>
            <label class="col-sm-3 control-label">设备型号:</label>
            <span class="col-sm-3">{{model.f_devices_model}}</span>
          </div>
        </div>
      </div>
    </div>
  </div>

</template>

<script>
  import {HttpResetClass} from 'vue-client'

  let getDeviceinfoGen = async function (self) {
    let http = new HttpResetClass()
    let res = await http.load('POST', 'rs/sql/saleSingleTable', {
      data: {
        tablename: 't_devices',
        condition: `f_user_id = '${self.data.f_user_id}' and f_state = '有效'`
      }
    }, {resolveMsg: null, rejectMsg: '获取设备信息失败'})
    console.log('获取的设备信息。。', res)
    self.noData = !res.data.length > 0
    self.model = Object.assign({}, self.model, res.data[0])
  }
  export default {
    title: '档案信息',
    data () {
      return {
        model: {},
        noData: false
      }
    },
    props: ['data'],
    ready () {
      getDeviceinfoGen(this)
    },
    watch: {
      'data' () {
        getDeviceinfoGen(this)
      }
    }
  }
</script>

<style>

</style>
