<template>
  <div class="flex-full" style="height: 40%">
    <data-grid :model="model" partial='list' class="list_area table_sy" v-ref:grid >
      <template partial='head'>
        <tr>
          <th style="text-align: center;">序号</th>
          <th style="text-align: center;">气价</th>
          <th style="text-align: center;">开始时间</th>
          <th style="text-align: center;">结束时间</th>
          <th style="text-align: center;">周期/年</th>
        </tr>
      </template>
      <template partial='body'>
        <tr>
          <td style="text-align: center;">{{$index+1}}</td>
          <td style="text-align: center;">{{row.f_price_name}}</td>
          <td style="text-align: center;">{{row.f_start_date}}</td>
          <td style="text-align: center;">{{row.f_end_date}}</td>
          <td style="text-align: center;">{{row.f_period}}</td>
        </tr>
      </template>
      <template partial='foot'></template>
    </data-grid>
  </div>
</template>

<script>

  import {HttpResetClass} from 'vue-client'

  let initGen = async function (self, val) {
    let http=new HttpResetClass()
    let res = await http.load('POST','rs/logic/updateBasicLiving',{data:{id:val.id}}, {resolveMsg: null, rejectMsg: null})
    self.model = Object.assign({}, self.model, val)
    self.model.rows = res.data



  }
  export default {
    props: ['data', 'parentData'],
    data () {
      return {
        model: {
          rows: []
        }
      }
    },
    watch: {
      'data'(val) {
        if (val) {
          initGen(this, val)
        }
      }},

    ready() {
      initGen(this, this.data)
    }

  }
</script>
<style>

</style>

