<template>
  <div class="span" style="width: auto;">
    <data-grid :model="model" partial='list' class="list_area table_sy"  v-ref:grid >
      <template partial='head'>
        <tr>
          <th>序号</th>
          <th>变更内容</th>
          <th>旧值</th>
          <th>新值</th>
          <th>变更人</th>
          <th>变更日期</th>
        </tr>
      </template>
      <template partial='body'>
        <td style="text-align: center;">{{$index + 1}}</td>
        <td style="text-align:center">{{row.f_field_name}}</td>
        <td style="text-align:center">{{row.f_used_content}}</td>
        <td style="text-align:center">{{row.f_new_content}}</td>
        <td style="text-align:center">{{row.f_operator}}</td>
        <td style="text-align:center">{{row.f_operate_date}}</td>
      </template>
    </data-grid>
  </div>
</template>

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

  export default {
    title: '地址变更列表',
    data () {
      return {

        model: {
          rows: []
        }
      }
    },
    props: ['address_id'],
    ready () {
      this.search()
    },
    methods: {
      async search () {
        this.model.rows = []
        let data = {
          tablename: `t_address_change`,
          items: '*',
          condition: '1=1',
          orderitem: 'f_operate_date desc'
        }
        if (this.address_id) {
          data.condition = `f_address_id = '${this.address_id}'`
        }
        let res = await this.$resetpost('rs/sql/address_singleTableOrderBy', {data: data}, {rejectMsg: '获取地址变更记录出错', resolveMsg: null})
        this.model.rows = res.data
      }
    },
    watch: {
      'address_id' () {
        this.search()
      }
    }
  }
</script>
