<template>
    <div class="component-vote-table">
        <Table border size='small' ref="selection" :columns="columns" :data="tableData" stripe></Table>
    </div>
</template>
<script>
    export default {
        props: {
            tableDatas: {
                type: Array,
                default:[]
            }
        },
        data() {
            return {
                setScoreModal: false,
                downloadModal: false,
                mutualEvaluationModal: false,
                isSaveComment: false,
                currentUsedComment: null,
                userInfo: this.$store.state.userInfo,
                isScoreLoading: false,
                currentStudent: null,
                currentHw: null,
                currentScore: 100,
                currentComment: '',
                currentFileList: [],
                currentRateValue: 0,
                downloadList: [],
                usedCommentList: [],
                columns: [
                    {
                        title: '姓名',
                        key: 'name'
                    },
                    {
                        title: '班级',
                        render: (h, params) => {
                            return h('span', params.row.classroom.name)
                        },
                    },
                    {
                        title: '选项',
                        render: (h, params) => {
                            return h('span', !params.row.option ? '未投票' : params.row.option)
                        },
                    },
                    
                ],
                tableData: [],
                commentList: [],
                studentsNum:0
            }
        },
        methods: {

            /**
             * 全选操作
             * @param status
             */
            handleSelectAll(status) {
                this.$refs.selection.selectAll(status);
            },

        },


        mounted() {
            
        },
        watch: {
            tableDatas: {
                handler(newValue) {
                    /** 编辑回显 */
                    console.log(newValue)
                    if (Array.isArray(newValue) && newValue.length) {
                        this.tableData = newValue
                    } else {
                        this.tableData = []
                    }
                },
                deep: true
            }
        }
    }
</script>

<style lang="less" scoped>
    @import "./BaseVoteTable.less";
</style>