<template>
    <div id="drdc_twitter">

        <el-table ref="multipleTables" class="table-div" :data="data_list" tooltip-effect="dark"
            @selection-change="handleSelectionChange">
            <el-table-column type="selection" width="55"></el-table-column>
            <el-table-column prop="timestr" label="发布时间" align="center"></el-table-column>
            <el-table-column prop="country" label="国家" align="center" show-overflow-tooltip></el-table-column>
            <el-table-column prop="tweets_content" label="内容" align="center" show-overflow-tooltip></el-table-column>

        </el-table>
        <div class="pagination-div">
            <el-pagination class="myPagination" background 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: [],
            stTime: null,
            edTime: null,
        };
    },
    props: {
        clientDetails: {
            type: Object,
            default: {},
        },
    },
    methods: {
        handleSelectionChange(val) {
            this.multipleSelection = val.map(e => e.id);
            this.$emit('change_Select', this.multipleSelection);
        },
        search(pageNum) {
            startLoading();
            this.currentPage = pageNum;
            let param = JSON.parse(JSON.stringify({ stTime: this.stTime, edTime: this.edTime }));

            post('api/rest/fulltext/queryTwitter?pageNum=' + pageNum + '&pageSize=' + this.everySize, param).then(res => {
                this.data_list = res.list;
                this.total = res.totals;
                endLoading()
            }).catch(err => {
                endLoading()
                this.$message.warning(err.message);
            })
        },
        //分页
        handleCurrentChange(pageNum) {
            this.currentPage = pageNum;
            this.search(pageNum);
        },
        handleSizeChange(val) {
            this.everySize = val;
            this.currentPage = 1;
            this.search(1);
        },

    },
    watch: {
        clientDetails: function (val) {
            this.stTime = val.stTime;
            this.edTime = val.edTime;
            this.search(1);
        }
    }
};
</script>
<style lang="scss">
#drdc_twitter {
    width: 100%;
    height: 100%;

    .table-div {
        width: 100%;
        height: calc(100% - 50px);
    }

    .el-table tr {
        background-color: transparent !important;
        color: #ffffffc7;
    }

    .el-table thead tr {
        height: 40px;
        background: url(../../assets/img/setting/tr1.png) no-repeat;
        background-size: 100% 100%;
    }

    .el-table th {
        background-color: transparent;
    }

    tbody tr {
        border-bottom: 1px solid #252631;
    }

    .el-table td {
        border-bottom: 1px solid #252631;
        border-right: unset;
    }

    .el-table--enable-row-hover .el-table__body tr:hover>td {
        background-color: #82848a78;
    }

    .el-table th {
        border: unset;
        // background-color: #263b5d !important;
    }

    .el-table--fit {
        background: none !important;
        border: unset;
    }

    .el-icon-delete-solid {
        color: red;
        cursor: pointer;
        font-size: 18px;
    }

    .el-icon-edit {
        color: #1172d8;
        cursor: pointer;
        font-size: 20px;
    }

    .el-icon-view {
        color: #00ffff;
        font-size: 20px;
        cursor: pointer;
    }

    .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>