<template>
  <div>
    <el-table
      v-loading="listLoading"
      row-key="id"
      :data="list"
      border
      fit
      highlight-current-row
      style="width: 100%"
      height="calc(100vh - 249px)"
    >
      <div slot="empty">
        <span v-if="listQuery.sectionId">没有数据</span>
        <span v-else>请选择标段</span>
      </div>
      <el-table-column label="设备编号" prop="deviceNo" align="center" />
      <el-table-column label="时间" prop="acquisitionTime" align="center">
        <template slot-scope="{ row }">
          {{ row.acquisitionTime | datetime }}
        </template>
      </el-table-column>
      <el-table-column label="走行速度(m/s)" prop="runSpeed" align="center" />
      <el-table-column label="经度(°)" prop="lng" align="center" />
      <el-table-column label="纬度(°)" prop="lat" align="center" />
      <el-table-column label="液压油温(℃)" prop="brekePress" align="center" />
      <el-table-column label="整机水平度(°)" prop="carLevelness" align="center" />
    </el-table>
    <pagination
      :total="total"
      :skip-count.sync="listQuery.skipCount"
      :max-result-count.sync="listQuery.maxResultCount"
      @pagination="getList"
    />
  </div>
</template>
<script>
import * as interfaceApi from '@/api/work-info.js'
import Pagination from '@/components/Pagination' // secondary package based on el-pagination
export default {
  name: 'BeamCarrierWorkInfoMng',
  // eslint-disable-next-line vue/no-unused-components
  components: {
    Pagination
  },
  props: {
    query: { type: Object, default: null, required: false }
  },
  data() {
    return {
      chart: true,
      listLoading: false,
      list: [],
      videoData: {
        frontLeftUrl: '',
        aroundUrl: '',
        rearLeftUrl: '',
        rearRightUrl: ''
      },
      listQuery: {
        deviceManageId: undefined,
        skipCount: 0,
        maxResultCount: 20
      },
      total: 0,
      deviceNo: ''
    }
  },
  watch: {
    query: {
      deep: true,
      immediate: true,
      handler(val) {
        if (val) {
          this.listQuery.deviceManageId = val.deviceId
          this.deviceNo = val.deviceNoShow
          this.getList()
        }
      }
    }
  },
  mounted() {
  },
  methods: {
    getList() {
      if (!this.listQuery.deviceManageId) {
        this.list = []
        return
      }
      this.listLoading = true
      interfaceApi
        .GetBeamTransportCarList(this.listQuery)
        .then(res => {
          res.items.forEach(t => {
            t.deviceNo = this.deviceNo
          })
          this.list = res.items
          this.total = res.totalCount
        })
        .finally(() => {
          this.listLoading = false
        })
    },
    // 查询
    handleFilter() {
    }
  }
}
</script>

<style scoped>
.pagination-container >>> .el-input {
    width: 50px;
}
</style>
