<template>
  <el-table :data="list" style="width: 100%;padding-top: 15px;">
    <el-table-column label="文档名称" min-width="200">
      <template slot-scope="scope">
         {{scope.row.title}}
      </template>
    </el-table-column>
    <el-table-column label="时间" min-width="150">
      <template slot-scope="scope">
        {{scope.row.create_time}}
      </template>
    </el-table-column>

    <el-table-column label="状态" min-width="100" align="center">
      <template slot-scope="{row}">
        <el-tag :type="row.status | statusFilter">
          <!-- {{ row.status }} -->
          <div v-if="row.status==5">启用</div>
          <div v-if="row.status==6">停用</div>
        </el-tag>
      </template>
    </el-table-column>
  </el-table>
</template>

<script>
  import{searchDocument,deleteDocument,pageDocument,searchlistDoc} from'@/api/document';
export default {
  filters: {
    statusFilter(status) {
      const statusMap = {
        success: 'success',
        pending: 'danger'
      }
      return statusMap[status]
    },
    orderNoFilter(str) {
      return str.substring(0, 30)
    }
  },
  data() {
    return {
      list: null
    }
  },
  created() {
    this.fetchData()
  },
  methods: {
    fetchData() {
      searchlistDoc({
           page:1,
           pageSize:8,
           title:'',
           category_id:'',
           status:'',
          }).then(response => {
            console.log(response);
        this.list = response.data.dataList//.items.slice(0, 8)
      })
    }
  }
}
</script>
