<template>
  <div>
    <criteria-paged :model="model" v-ref:paged>
      <data-grid :model="model" partial='list' v-ref:grid class="list_area table_sy">
        <template partial='head'>
          <tr>
            <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;white-space:nowrap;">{{ row.f_operate_date }}</td>
          <td style="text-align: center;white-space:nowrap;">{{ row.f_operat_type }}</td>
          <td style="text-align: center;white-space:nowrap;">{{ row.f_operator }}</td>
          <td style="text-align: center;white-space:nowrap;">{{ row.f_used_content }}</td>
          <td style="text-align: center;white-space:nowrap;">{{ row.f_new_content }}</td>
        </template>
      </data-grid>
    </criteria-paged>
  </div>
</template>
<script>
import {PagedList} from 'vue-client'

export default {
  title: '表封号变更记录',

  props: ['check'],
  data() {
    let model = new PagedList('api/af-safecheck/sql/safe_singleTable_OrderBy', 20, {
      items: "'tr.*,ti.f_used_content,ti.f_new_content'",
      tablename: "'t_record tr left join t_infochange ti on tr.id = ti.f_change_id '",
      orderitem: "'tr.f_operate_date desc'"
    })
    model.f_filialeids = '(' + this.$login.f.orgid + ')'
    return {
      f_filialeids: '(' + this.$login.f.orgid + ')',
      userid: this.$login.f.id,
      f: this.$login.f,
      model: model,
      checkers: [],
      source: `tool.getFullTree(this.getRights().where(row.getType() != $zone$).where(row.getType() == $organization$))`,
    }
  },
  watch: {
    'check'() {
      let condition = `tr.f_userinfo_id = '${this.check.f_userinfo_id}' and tr.f_state = '有效' and tr.f_operat_type in ('进气口铅封号变更','出气口铅封号变更') and tr.f_comments = '表封号变更'`
      this.model.search(condition)
    }
  },
  ready() {
    let condition = `tr.f_userinfo_id = '${this.check.f_userinfo_id}' and tr.f_state = '有效' and tr.f_operat_type in ('进气口铅封号变更','出气口铅封号变更') and tr.f_comments = '表封号变更' `
    this.model.search(condition)
  },
  methods: {
    selfSearch(args) {
      return this.model.search(args.condition, args.model)
    },
  },
  computed: {
    selected() {
      return this.$refs.paged.$refs.grid.selected
    }
  }
}
</script>


<style lang="less" scoped>
.select-error {
  button {
    border-bottom: 1px solid #a94442 !important;
  }
}
</style>

