<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>
<!--          <Tooltip content="查看更多" placement="left-start" style="margin-left: 5px">-->
<!--            <Icon @click="_detail" type="ios-more" size="30" color="#2d8cf0" style="cursor:pointer;"></Icon>-->
<!--          </Tooltip>-->
        </div>
        <div class="clear"></div>
      </div>
      <div style="width: 100%;">
        <PTVXETableHeight ref="pageTable" :table-height="300" :loading="true"
                    :get-page="getPage" @on-result-change="_tableResultChange" hide-checkbox="true">
          <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 v-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}</span>
              <span v-else-if="item.status">{{scope.row[item.key].display}}</span>
              <span v-else>{{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: [] },
      getPage: {},
      formObj: {},
      pageColumns: [
        { title: '委托单位', key: 'client' },
        { title: '委托编号', key: 'entrustCode', width: 180 },
        { title: '状态', key: 'progress', width: 110, status: true },
        { title: '委托日期', key: 'entrustDate', date: true }
      ],
      tableHeight: '280',
      total: ''
    }
  },
  mounted() {
    // this._request()
    this._page()
  },
  methods: {
    _detail() {
      this.$refs.unfinishedDetail._open()
    },
    _page: async function() {
      Object.assign(this.formObj, this.$refs.pageTable._searchParams())
      const result = await soilStatistics.pageWaitEnd(this.formObj)
      if (result) {
        console.log(result)
        this.getPage = result
        this.$refs.pageTable._hideLoading()
      }
    },
    _tableResultChange(msg, data) {
      switch (msg) {
        case 'changeSize':
          this._page()
          break
      }
    }
  }
}
</script>
