<template>
  <div class="flex-row" >
    <div style="flex: 1.5" class="flex">
      <div class="flex">
        <criteria-paged :model="model" v-ref:paged>
          <criteria partial='criteria' v-ref:criteria @condition-changed="$parent.selfSearch">
            <div novalidate class="form-inline auto" partial>
              <div class="row">
                <div style="float: left">
                  <button class="button_search" @click="$parent.$parent.search()">查看全部</button>
                </div>
              </div>
            </div>
          </criteria>
          <data-grid :model="model" v-ref:grid class="list_area table_sy" partial='list'>
            <template partial='head'>
              <tr>
                <th><nobr>序号</nobr></th>
<!--                <th><nobr>表号</nobr></th>-->
                <th><nobr>用户编号</nobr></th>
                <th><nobr>修改字段</nobr></th>
                <th><nobr>新修改内容</nobr></th>
                <th><nobr>旧修改内容</nobr></th>
                <th><nobr>修改人</nobr></th>
                <th><nobr>修改时间</nobr></th>
                <th><nobr>审核人</nobr></th>
                <th><nobr>审核时间</nobr></th>
                <th><nobr>审核状态</nobr></th>
              </tr>
            </template>
            <template partial='body'>
              <td style="text-align: center;">{{$index+1}}</td>
<!--              <td style="text-align: center;">{{row.f_meternumber}}</td>-->
              <td style="text-align: center;">{{row.f_userinfo_id}}</td>
              <td style="text-align: center;">{{row.f_field_name}}</td>
              <td style="text-align: center;">{{row.f_new_content}}</td>
              <td style="text-align: center;">{{row.f_used_content}}</td>
              <td style="text-align: center;">{{row.f_submit_ename}}</td>
              <td style="text-align: center;">{{row.f_submit_date}}</td>
              <td style="text-align: center;">{{row.f_review_ename}}</td>
              <td style="text-align: center;">{{row.f_review_date}}</td>
              <td style="text-align: center;">{{row.f_review_status === '已审核' ? row.f_review_status : '未审核'}}</td>
            </template>
          </data-grid>
        </criteria-paged>
      </div>
    </div>
  </div>
</template>
<script>
  import Vue from 'vue'
  import {PagedList} from 'vue-client'

  var data
  export default {
    title: '变更历史',

    data () {
      return {
        model: new PagedList('rs/sql/singleTable_OrderBy', 20,
          {items: '\"*\"', tablename: '\"t_infoChange\"', orderitem: '\"id desc\"'}),
        uploadText: '换表',
        // 构建数组来存储对象
        editbank: true
      }
    },
    props: {
      info: JSON
    },
    methods: {
      selfSearch (relf) {

      },
      search () {
        this.info = null
        // this.$refs.paged.$refs.criteria.search()
      }

    },
    watch: {
      'info' (val) {
        console.log('info===========', val)
        console.log('info===========', this.info)
        if (val == null || (typeof val) == 'undefined') {
          this.$refs.paged.condition = ' 1=1 '
        } else {
          this.$refs.paged.condition = ` 1=1 and f_userinfo_id = '${this.info.f_userinfo_id}'`
        }
        this.model.search(this.$refs.paged.condition, this.$refs.paged.model)
      }
    }
  }
</script>
