<template>
  <div class="auto">
    <partial-view v-ref:pv>
      <div class="row">
        <label class = "col-sm-3 control-label">用户姓名:</label>
        <span class = "col-sm-3">{{model.f_user_name}}</span>
        <label class="col-sm-3">表编号:</label>
        <span class = "col-sm-3">{{data.f_user_id}}</span>
      </div>
      <div class="row">
        <label class = "col-sm-3 control-label">换表类型:</label>
        <span class = "col-sm-3">{{model.f_changemeter_type}}</span>
        <label class="col-sm-3">换表表费:</label>
        <span class = "col-sm-3">{{model.f_changemeter_fee}}</span>
      </div>
      <div class="row">
        <label class = "col-sm-3 control-label"> 旧表号:</label>
        <span class = "col-sm-3">{{model.f_meternumber}}</span>
        <label class="col-sm-3">新表号:</label>
        <span class = "col-sm-3">{{model.f_newmeternumber}}</span>
      </div>
      <!-- <div class="row">
        <label class = "col-sm-3 control-label">旧卡号:</label>
        <span class = "col-sm-3">{{model.f_card_id}}</span>
        <label class="col-sm-3">新卡号:</label>
        <span class = "col-sm-3">{{model.f_newcard_id}}</span>
      </div> -->
      <div class="row">
        <label class = "col-sm-3 control-label">操作人:</label>
        <span class = "col-sm-3">{{model.f_operator}}</span>
      </div>
      <div class="row">
        <label class = "col-sm-3 control-label">操作时间:</label>
        <span class = "col-sm-9">{{data.f_operate_date}}</span>
      </div>
    </partial-view>
  </div>
</template>

<script>
export default {
  title: '换表管理详情',
  props: ['data'],
  data () {
    return {
      model: {}
    }
  },
  ready () {
    let sql = 'singleTable_OrderBy'
    let condition = {
      items: 'f_user_name,f_user_id,f_changemeter_type,f_changemeter_fee,f_meternumber,f_newmeternumber,f_card_id,f_newcard_id,f_operator',
      tablename: 't_changemeter',
      condition: ' id = ' + this.data.id,
      orderitem: 'id'
    }
    this.$info(`加载数据中..., sql:${sql}`)
    this.$refs.pv.load('rs/logic/getOneData', {data: {sql: sql, params: condition}}).then((a) => {
      this.$info(`成功获取到数据！, data:${JSON.stringify(a.data)}`)
      this.model = a.data
    }).catch((error) => {
      if (error.status) {
        this.$warn(`加载数据出错, ${JSON.stringify(error)}`)
        return
      }
      throw error
    })
  }
}
</script>
