<template>
    <div class="search_result_box">
        <el-table :data="tableData" :header-cell-style="{ background:'#f0f3fa',color: 'rgba(35,35,35,0.8)'}" v-horizontal-scroll="'hover'"
                class="table-item1 fixed-table" border highlight-current-row>
                <el-table-column :resizable="false" type="index" label="序号" fixed width="60">
                <template slot-scope="scope">
                    <span>{{(pageNum - 1) *pageSize + scope.$index + 1}}</span>
                </template>
                </el-table-column>
                <el-table-column :resizable="false" label="表格名称" >
                <template slot-scope="scope">
                    {{scope.row.fileName||"--"}}
                </template>

                </el-table-column>
                <el-table-column :resizable="false" label="查询时间" width="189">
                <template slot-scope="scope">
                    {{scope.row.createTime||"--"}}
                </template>
                </el-table-column>

                
                <el-table-column :resizable="false" label="操作" width="154">
                <template slot-scope="scope">
                    <a class="download_span" :href="scope.row.url" v-if="scope.row.url">下载</a>
                    <span v-else >--</span>
                </template>
                </el-table-column>
            </el-table>
            <el-pagination background v-if="total>0" :current-page="pageNum" @current-change="handleCurrentChange" layout="prev, pager, next"
                :total="total">
            </el-pagination>
    </div>
</template>

<script>
import {list} from '@/api/supplier/assistant.js';

export default {
    data(){
        return{
            tableData:[],
            total: 0,
            pageNum: 1,
            pageSize:10,
        }
    },
    created(){
        this.getList()
    },
    methods:{
        handleCurrentChange(pageNum) {
            this.pageNum = pageNum;
            this.getList()
        },
        getList(){
            let params = {
                pageNum:this.pageNum,
                pageSize:this.pageSize,
            }
            list(params).then(res=>{
                if(res.code==200){
                    this.tableData = res.rows
                    this.total = res.total
                }
            })
        },
    }
}
</script>

<style lang="scss" scoped>
.search_result_box{
    background: #ffffff;
    padding: 16px;
    .el-pagination{
        display: flex;
        justify-content: end;
        padding: 0;
        margin-right: -5px;
        margin-top: 16px;
    }
    .download_span{
        color: #0081FF;
        cursor: pointer;
    }
}
    
</style>