<!--
 * @Author: zwq
 * @Date: 2020-12-29 15:41:11
 * @LastEditors: zwq
 * @LastEditTime: 2021-03-06 19:34:39
 * @Description:
-->
<template>
  <base-table
    :page="listQuery.current"
    :limit="listQuery.size"
    :table-config="tableProps"
    :table-data="list"
    :is-loading="listLoading"
  />
</template>

<script>
import i18n from '@/lang'
import BaseTable from '@/components/BaseTable'
// import { timeFormatter } from '@/filters'
/**
 * 表格表头配置项 TypeScript接口注释
 * tableConfig<ConfigItem> = []
 *
 * Interface ConfigItem = {
 *  prop: string,
 *  label: string,
 *  width: string,
 *  align: string,
 *  subcomponent: function,
 *  filter: function
 * }
 *
 *
 */
const tableProps = [
  {
    prop: 'name',
    label: i18n.t('module.orderManage.VerifyTable.teamName')
    // filter: timeFormatter
  },
  {
    prop: 'leader',
    label: i18n.t('module.orderManage.VerifyTable.teamLeader'),
    align: 'center'
  },
  {
    prop: 'num',
    label: i18n.t('module.orderManage.VerifyTable.number')
  },
  {
    prop: 'major',
    label: i18n.t('module.orderManage.VerifyTable.professional')
  },
  {
    prop: 'wtime',
    label: i18n.t('module.orderManage.VerifyTable.workingHours')
  }
]

export default {
  name: '',
  components: { BaseTable },
  props: {
    workOrderId: {
      type: String,
      default: () => {
        return ''
      }
    }
  },
  data() {
    return {
      tableProps,
      list: [],
      listLoading: false,
      listQuery: {
        current: 1,
        size: 10
      }
    }
  },
  methods: {
    init() {
      this.listQuery = {
        current: 1,
        size: 10
      }
      this.getList()
    },
    getList() {
      this.list = [
        {
          'name': '班组1',
          'leader': '张三',
          'num': '21',
          'major': '电工，维修工，计划员，仓管员',
          'wtime': '2020-11-26 19:12:37'
        },
        {
          'name': '班组2',
          'leader': '卫升',
          'num': '12',
          'major': '电工，维修工，仓管员',
          'wtime': '2020-11-11 06:12:57'
        },
        {
          'name': '班组3',
          'leader': '李渊',
          'num': '32',
          'major': '会计，审核员',
          'wtime': '2020-11-05 12:10:17'
        }
      ]
      // this.listLoading = true
      // staffList(this.listQuery).then(response => {
      //   if (response.data.records) {
      //     this.list = response.data.records
      //   } else {
      //     this.list.splice(0, this.list.length)
      //   }
      //   this.listLoading = false
      // })
    }
  }
}
</script>

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