<template>
    <div id="facebook_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="Facebook内容" align="center" show-overflow-tooltip>
                <template slot-scope="scope">
                    <span @click="showInfo(scope.row)">{{scope.row.txt_zh}}</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';
export default {
    components: { },
    data() {
        return {
            currentPage: 1,
            everySize: 10,
            total: 0,
            multipleSelection:[],
            data_list:[],
            input:"",
        };
    },
    props: {
        clientDetails: {
            type: Object,
            default: {},
        },
    },
    methods: {
        showInfo(item){
            this.$router.push({ name: "Facebook详情" + this.$route.meta.type_name, params: item });
        },
        //查询
        search(pageNum){
            this.data_list = [];
            if(this.input==''){
                this.total = 0;
                return
            }
            let obj = {};
            obj.txt = this.input != '' ? this.input : null;//标题
            post('api/rest/fulltext/queryFacebook?pageNum=' + pageNum + '&pageSize=' + this.everySize, obj).then(res => {
                let arr_news_facebook = [];
                if(res.list.length>0){
                    res.list.forEach((item) => {
                        arr_news_facebook.push({
                            title: "", //标题
                            txt: item.postText, //内容
                            site_name: item.userName, //来自
                            pubdate: item.postTime, //发布时间
                            snatch_time: item.input_time, //抓取时间
                            highLight: item.highLight, //高亮
                            cmtcnt: item.commentNumber, //评论数
                            rpscnt: item.shareNumber, //转发数
                            atdcnt: item.likeNumber, //点赞数
                            isori: item.postType, //是否原创
                            tweets_id: item.postId, //是twitter_id
                            blogger_id: item.userId,
                            postUrl: item.postUrl,//原文链接
                            txt_zh: item.txt_zh,
                            title_zh: "", //标题
                            emotion1:item.emotion1,
                        });
                    });
                }
                this.data_list = res.list;
                this.total = res.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">
#facebook_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>