<template>
  <div class="auto">
    <partial-view v-ref:pv>
      <div class="row">
        <label class = "col-sm-4">客户名称:</label>
        <span class = "col-sm-8" style="text-align:left">{{model.f_user_name}}</span>
      </div>
      <div class="row">
        <label class = "col-sm-4">表编号:</label>
        <span class = "col-sm-8" style="text-align:left">{{data.f_user_id}}</span>
      </div>
      <div class="row">
        <label class = "col-sm-4">换表类型:</label>
        <span class = "col-sm-2" style="text-align:left">{{model.f_type}}</span>
        <label class = "col-sm-4">换表表费:</label>
        <span class = "col-sm-2" style="text-align:left">{{model.f_changemeter_fee}}</span>
      </div>
      <div class="row">
        <label class = "col-sm-4">旧表底数:</label>
        <span class = "col-sm-2" style="text-align:left">{{model.f_using_base_old}}</span>
        <label class = "col-sm-4">新表底数:</label>
        <span class = "col-sm-2" style="text-align:left">{{model.f_initial_base_new}}</span>
      </div>
      <div class="row">
        <label class = "col-sm-4">旧流量计表号:</label>
        <span class = "col-sm-2" style="text-align:left">{{model.f_flowmeter_number_old}}</span>
        <label class = "col-sm-4">新流量计表号:</label>
        <span class = "col-sm-2" style="text-align:left">{{model.f_flowmeter_number}}</span>
      </div>
      <div class="row">
        <label class = "col-sm-4">旧流量计通经:</label>
        <span class = "col-sm-2" style="text-align:left">{{model.f_flowmeter_pass_old}}</span>
        <label class = "col-sm-4">新流量计通经:</label>
        <span class = "col-sm-2" style="text-align:left">{{model.f_flowmeter_pass}}</span>
      </div>
      <div class="row">
        <label class = "col-sm-4">旧流量计品牌:</label>
        <span class = "col-sm-2" style="text-align:left">{{model.f_flowmeter_brand_old}}</span>
        <label class = "col-sm-4">新流量计品牌:</label>
        <span class = "col-sm-2" style="text-align:left">{{model.f_flowmeter_brand}}</span>
      </div>
      <div class="row">
        <label class = "col-sm-4">旧流量计型号:</label>
        <span class = "col-sm-2" style="text-align:left">{{model.f_flowmeter_model_old}}</span>
        <label class = "col-sm-4">新流量计型号:</label>
        <span class = "col-sm-2" style="text-align:left">{{model.f_flowmeter_model}}</span>
      </div>
      <div class="row">
        <label class = "col-sm-4">旧流量计精准度:</label>
        <span class = "col-sm-2" style="text-align:left">{{model.f_flowmeter_accuracy_old}}</span>
        <label class = "col-sm-4">新流量计精准度:</label>
        <span class = "col-sm-2" style="text-align:left">{{model.f_flowmeter_accuracy}}</span>
      </div>
      <div class="row">
        <label class = "col-sm-4">旧流量计压力等级:</label>
        <span class = "col-sm-2" style="text-align:left">{{model.f_flowmeter_mpa_level_old}}</span>
        <label class = "col-sm-4">新流量计压力等级:</label>
        <span class = "col-sm-2" style="text-align:left">{{model.f_flowmeter_mpa_level}}</span>
      </div>
      <div class="row">
        <label class = "col-sm-4">旧流量计安装日期:</label>
        <span class = "col-sm-2" style="text-align:left">{{model.f_flowmeter_install_date_old}}</span>
        <label class = "col-sm-4">新流量计安装日期:</label>
        <span class = "col-sm-2" style="text-align:left">{{model.f_flowmeter_install_date}}</span>
      </div>
      <div class="row">
        <label class = "col-sm-4">换表原因:</label>
        <span class = "col-sm-8" style="text-align:left">{{model.f_othereason}}</span>
      </div>
      <div class="row">
        <label class = "col-sm-4">备注:</label>
        <span class = "col-sm-8" style="text-align:left">{{model.f_comments}}</span>
      </div>
      <div class="row">
        <label class = "col-sm-4">操作人:</label>
        <span class = "col-sm-8" style="text-align:left">{{model.f_operator}}</span>
      </div>
      <div class="row">
        <label class = "col-sm-4">操作时间:</label>
        <span class = "col-sm-8" style="text-align:left">{{model.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: 'c.*,f.f_flowmeter_number,f.f_flowmeter_number_old,f.f_flowmeter_pass,f.f_flowmeter_pass_old,' +
        'f.f_flowmeter_brand,f.f_flowmeter_brand_old,f.f_flowmeter_model,f.f_flowmeter_model_old,' +
        'f.f_flowmeter_accuracy,f.f_flowmeter_accuracy_old,f.f_flowmeter_mpa_level,f.f_flowmeter_mpa_level_old,' +
        'f.f_flowmeter_install_date,f.f_flowmeter_install_date_old',
      tablename: 't_changetables c left join t_change_flowmeter f on c.id = f.f_changetables_id',
      condition: 'c.id = ' + this.data.id,
      orderitem: 'c.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>
