<template>
  <div class="table-box">
    <el-table
      border
      stripe
      :data="list">
      <el-table-column
        prop="name"
        label="名称"
      ></el-table-column>
      <el-table-column
        label="启停标志"
      >
        <template slot-scope="props">
          <span>{{ props.row.is_valid | filterValid }}</span>
        </template>
      </el-table-column>
      <el-table-column
        label="进出">
        <template slot-scope="props">
          <span>{{ props.row.is_in | filterInOut }}</span>
        </template>
      </el-table-column>
      <el-table-column
        label="创建时间"
      >
        <template slot-scope="props">
          <span>{{ props.row.createTime | formatTime }}</span>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
export default {
  props: {
    list: {
      type: Array,
      default: () => []
    }
  },
  filters: {
    filterValid (n) {
      return n === 1 ? '启用' : '停用'
    },
    filterInOut (n) {
      switch (n) {
        case 1:
          return '进口'
        case 2:
          return '出口'
        case 3:
          return '双向'
      }
    }
  }
}
</script>
