<template>
    <div id="ztfxbg_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.name}}</span>
                </template>
            </el-table-column>
            <el-table-column label="描述" align="center">
                <template slot-scope="scope">
                    <span @click="showInfo(scope.row)">{{ scope.row.description}}</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,dataUrlToblob } from '../../../util/http_util';
import {} from '../../../util/data_util';
export default {
    components: { },
    data() {
        return {
            currentPage: 1,
            everySize: 10,
            total: 0,
            multipleSelection:[],
            data_list:[],
            input:"",
        };
    },
    props: {
        clientDetails: {
            type: Object,
            default: {},
        },
    },
    methods: {
        showInfo(item){
            dataUrlToblob(item, 1);
        },
        //查询
        search(pageNum){
            this.data_list = [];
            if(this.input==''){
                this.total = 0;
                return
            }
            let _this = this;
            get(
                "api/rest/sentiment/queryReport?pageNum=" +
                pageNum +
                "&pageSize=" +
                _this.everySize +
                "&name=" +
                _this.input
            )
                .then((data) => {
                    if (data.list.length != 0) {
                        _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">
#ztfxbg_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>