<!--
 * @Author: zwq
 * @Date: 2020-12-29 15:41:11
 * @LastEditors: zwq
 * @LastEditTime: 2022-03-04 09:03:35
 * @Description: E10详情表格
-->
<template>
  <div>
    <base-table
      :page="listQuery.current"
      :limit="listQuery.size"
      :table-config="tableProps"
      :table-data="list"
      :is-loading="listLoading"
    />
    <pagination :total="total" :page.sync="listQuery.current" :limit.sync="listQuery.size" @pagination="init" />
  </div>
</template>

<script>
import i18n from '@/lang'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination'
import { timeFormatter } from '@/filters'
// import { getE10StackDetail } from '@/api/equipment/infoPandect'

/**
 * 表格表头配置项 TypeScript接口注释
 * tableConfig<ConfigItem> = []
 *
 * Interface ConfigItem = {
 *  prop: string,
 *  label: string,
 *  width: string,
 *  align: string,
 *  subcomponent: function,
 *  filter: function
 * }
 *
 *
 */
const tableProps = [
  {
    prop: 'equipmentName',
    label: i18n.t('module.equipmentManager.maintainplan.equipmentId'),
    align: 'center'
  }, {
    prop: 'status',
    label: i18n.t('module.equipmentManager.monitoringInfo.E10status'),
    align: 'center'
  }, {
    prop: 'previousStatus',
    label: i18n.t('module.equipmentManager.monitoringInfo.laterE10Status'),
    align: 'center'
  }, {
    prop: 'endTime',
    label: i18n.t('module.equipmentManager.monitoringInfo.E10endTime'),
    filter: timeFormatter,
    align: 'center'
  }, {
    prop: 'durationTime',
    label: i18n.t('module.equipmentManager.monitoringInfo.duration'),
    align: 'center'
  }
]

export default {
  name: '',
  components: { BaseTable, Pagination },
  props: {
    time1: {
      type: Date,
      default: () => {
        return ''
      }
    },
    time2: {
      type: Date,
      default: () => {
        return ''
      }
    },
    equipmentName: {
      type: String,
      default: () => {
        return ''
      }
    }
  },
  data() {
    return {
      total: 0,
      tableProps,
      list: [],
      listLoading: false,
      listQuery: {
        current: 1,
        size: 10
      }
    }
  },
  mounted() {
    // this.init()
  },
  methods: {
    init() {
      this.listQuery.startTime = this.time1
      this.listQuery.endTime = this.time2
      this.listQuery.equipmentName = this.equipmentName
      // getE10StackDetail(this.listQuery).then(res => {
      //   if (res.data !== []) {
      //     this.list = res.data.detail.records
      //     this.total = res.data.detail.total
      //     this.list.forEach(item => {
      //       item.equipmentName = this.equipmentName
      //     })
      //   }
      // })
    }
  }
}
</script>

<style scoped>
.edit-input {
  padding-right: 100px;
}
.cancel-btn {
  position: absolute;
  right: 15px;
  top: 10px;
}
</style>
