<template>
  <div>
    <Card style="width:100%">
      <div class="config_meta">
        <p class="fl">个人试验项目查询 {{total}} </p>
        <div class="fr">
          <Tooltip content="刷新" placement="left-start">
            <Icon @click="_page" type="ios-refresh" size="30" color="#2d8cf0" style="cursor:pointer;"></Icon>
          </Tooltip>
        </div>
        <div class="clear"></div>
      </div>
      <div style="width: 100%;">
        <PTVXETableHeight ref="pageTable" :page-columns="pageColumns"
                    :get-page="getPage" :table-height="tableHeight">
          <vxe-table-column
            v-for="item in pageColumns"
            :key="item.key"
            :field="item.key"
            :title="item.title"
            :min-width="item.width?item.width:200"
            :fixed="item.fixed?item.fixed:undefined" sortable>
            <template slot-scope="scope">
              <span>{{scope.row[item.key]}}</span>
            </template>
          </vxe-table-column>
        </PTVXETableHeight>
      </div>
    </Card>
  </div>
</template>

<script>
import { soilStatistics } from '../../api'

export default {
  components: {},
  data() {
    return {
      tableData: { records: [] },
      formObj: {},
      getPage: {},
      pageColumns: [
        { title: '委托编号', key: 'entrustCode', width: 150 },
        { title: '试验名称', key: 'name', width: 140 },
        { title: '试样编号', key: 'sampleCode', width: 140 },
        { title: '试验项目英文简写', key: 'shortName', width: 180 },
        { title: '检测依据', key: 'testBasis', width: 100 }
      ],
      tableHeight: '280',
      total: ''
    }
  },
  mounted() {
    this._page()
  },
  methods: {
    _page: async function() {
      Object.assign(this.formObj, this.$refs.pageTable._searchParams())
      const result = await soilStatistics.pagePersonalExpStatistics(
        this.formObj
      )
      if (result) {
        this.$refs.pageTable._hideLoading()
        this.getPage = result
      }
      // const result = await
      // this.$refs.pageTable._page('search-form', 'SysFileTemplate/page')
    }
  }
}
</script>
