<template>
  <div>
    <div class="layout-content-padding">
      <div class="layout-content-main intra-line">
        <Row>
          <!--            查询-->
          <!-- 表格 -->
          <Col span="24">
            <element-table-height
              ref="pageTable"
              :table-height="tableHeight"
              :get-page="getPage"
              @on-result-change="_tableResultChange"
              hide-checkbox
            >
              <el-table-column
                :prop="item.key"
                :label="item.title"
                :width="item.width"
                :min-width="200"
                :fixed="item.fixed?item.fixed:undefined"
                v-for="item in pageColumns"
                :key="item.key"
                show-overflow-tooltip sortable>
                <template slot-scope="scope">
                     <span v-if="item.key === 'status'">
<!--                      {{ scope.row[item.value] === PASS?'通过':'' }}-->
                      {{ scope.row.status.display }}
                     </span>
                  <span v-else-if="item.key==='ctime'">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}</span>
                  <div v-else-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd HH:MM:ss'):''}}</div>
                  <span v-else>{{ scope.row[item.key] }}</span>
                </template>
              </el-table-column>
              <!--                <el-table-column-->
              <!--                  label="操作"-->
              <!--                  align="center"-->
              <!--                  :width="$optColWidth(iconMsg)"-->
              <!--                  fixed="right" v-if="$optColWidth(iconMsg)>0?true:false">-->
              <!--                  <template slot-scope="scope">-->
              <!--                    <IconList :msg="type == 1?iconMsg1:iconMsg" @on-result-change="_iconClick" :rowData="scope.row"-->
              <!--                              :rowIndex="scope.$index"></IconList>-->
              <!--                  </template>-->
              <!--                </el-table-column>-->
            </element-table-height>
          </Col>

        </Row>
      </div>
    </div>
  </div>
</template>

<script>
// eslint-disable-next-line no-unused-vars
import global from '../../../api/config'
import { soilStatistics } from '../../../api'

export default {
  name: 'FormFiles',
  components: {},
  data() {
    return {
      getPage: {
        records: []
        // records: [
        //     {formName: '79874'}
        // ]
      },
      detectionDate: '',
      formObj: {
        username: '',
        sendDate: '',
        sendDateBegin: '',
        sendDateEnd: ''
      },
      startTime: '',
      endTime: '',
      pageColumns: [
        { title: '委托单位', key: 'client' },
        { title: '钻孔位置', key: 'boreholeLocation' },
        { title: '钻孔名称', key: 'boreholeName' },
        { title: '经度', key: 'longitude' },
        { title: '纬度', key: 'latitude' }
      ],
      selectIds: [],
      selectData: [],
      iconMsg: [
        // { type: 'images', id: '', name: '预览' },
        // { type: 'ios-download', id: '', name: '下载' },
        // { type: 'ios-clock', id: '', name: '操作日志' },
      ]
    }
  },
  computed: {
    tableHeight: function() {
      return this.$tableHeight('noSearch') + 60
    }
  },
  mounted() {
    this._page()
  },
  methods: {
    _formSearch() {
      this.$refs.pageTable._pageChange(1)
    },
    _search() {
      this._page()
    },
    _page: async function(client) {
      if (client) {
        this.formObj.client = client
      } else {
        this.formObj.client = undefined
      }
      const result = await soilStatistics.pageCoordinateStatistics(
        this.$serializeFormSearch(this.formObj)
      )
      if (result) {
        this.getPage = result
      }
    },
    _tableResultChange(msg, data) {
      switch (msg) {
        case 'page':
          this._page()
          break
        case 'iconClick':
          this._iconClick(data.name, data.rowData)
          break
        default:
          this._page()
      }
    },
    _iconClick(res, data) {
      switch (res) {
        case '预览':
          this._viewReport(data)
          break
      }
    }
    // 日期查询
    // _dateChange(date) {
    //   // eslint-disable-next-line no-sequences
    //   ;(this.formObj.sendDateBegin = date[0]),
    //     (this.formObj.sendDateEnd = date[1])
    // }
  }
}
</script>

<style scoped>
</style>
