<template>
    <div id="zchj_wxk_search">
        <el-table ref="multipleTables" class="table-div" :data="data_list" tooltip-effect="dark" :header-cell-style="{color:'#ffffffc7',fontSize:'14px',background:'#263b5d'}" :row-style="{color:'#ffffffc7',fontSize:'14px',background:'#1d2d46'}">
            <el-table-column label="文件名" align="center">
                <template slot-scope="scope">
                    <span @click="showInfo(scope.row)">{{ scope.row.fileInfo.file.name}}</span>
                </template>
            </el-table-column>
        </el-table>
        <div class="pagination-div">
            <el-pagination class="myPagination" background :pager-count="5" layout="total, sizes, prev, pager, next, jumper" :current-page="currentPage" @size-change="handleSizeChange" :page-size="everySize" :total="total" :page-sizes="[10,20,50,100]" @current-change="handleCurrentChange">
            </el-pagination>
        </div>
    </div>
</template>
<script>
import { get, post, startLoading, endLoading } from '../../../util/http_util';
import {} from '../../../util/data_util';
export default {
    components: { },
    data() {
        return {
            currentPage: 1,
            everySize: 10,
            total: 0,
            multipleSelection:[],
            data_list:[],
            input:"",
            type_folder: "zchj", //文件夹名称
        };
    },
    props: {
        clientDetails: {
            type: Object,
            default: {},
        },
    },
    methods: {
        showInfo(item){
            let path_srt =
                "api/rest/document/pdf/" +
                this.type_folder +
                "/" +
                item.fileInfo.file.uuid;
            window.open(path_srt);
        },
        //查询
        search(pageNum){
            this.data_list = [];
            if(this.input==''){
                this.total = 0;
                return
            }
            let _this = this;
            let paramDatas = {
                content: _this.input,
                module: '战场环境文档',
            };
            post(
                "api/rest/fulltext/searchFiles?pageNum=" +
                pageNum +
                "&pageSize=" +
                _this.everySize,
                paramDatas
            )
                .then((data) => {
                    if (data.list.length != 0) {
                        data.list.forEach((item, index) => {
                        data.list[index].create_time = new Date(
                            data.list[index].create_time
                        ).Format("yyyy-MM-dd HH:mm:ss");
                        });
                        _this.data_list = data.list;
                        _this.total = data.totals;
                    }
                })
                .catch((err) => {
                this.$message.warning(err.message);
                });
        },
        //分页
        handleCurrentChange(pageNum) {
            this.currentPage = pageNum;
            this.search(pageNum);
        },
        //分页的pageSize改变事件
        handleSizeChange(val) {
            this.everySize = val;
            this.currentPage = 1;
            this.search(1);
        },
       
    },
    watch:{
        clientDetails: function (val) {
            this.input= val.input;
            this.search(1);
        }
    }
};
</script>
<style lang="scss">
#zchj_wxk_search{
    width: 100%;
    height: 100%;
    .table-div {
        width: 100%;
        height: calc(100% - 50px);
    }
    .el-table tr {
        background-color: #1d2d46 !important;
        color: #ffffffc7;
        font-size: 14px;
    }
    .el-table td {
        border-bottom: 1px solid #127a89;
        border-right: unset;
    }
    .el-table--enable-row-hover .el-table__body tr:hover > td {
        background-color: #82848a78;
    }
    
    .el-table .el-table__body-wrapper {
        width: 100%;
        height: calc(100% - 48px);
        overflow-y: auto;
    }
    .el-table th {
        border: unset;
        background-color: #263b5d !important;
    }
    .el-table--fit {
        background: none !important;
        border: unset;
    }
    .el-table--group::after,
    .el-table--border::after,
    .el-table::before {
        background-color: unset;
    }
    .pagination-div {
        width: 100%;
        height: 50px;
        .el-pagination {
            margin-top: 9px;
            text-align: right;
            .el-pagination__jump {
                color: white;
            }
            .el-pagination__total {
                color: white;
            }
        }
        .myPagination.is-background .el-pager li:not(.disabled).active {
            color: #fff;
            border: 1px solid #146a80;
            box-shadow: 0 0 10px #1b6097;
            background-color: #1d2d46;
        }
    }
}
</style>