<template>
    <div class="component-survey-table">
        <Table border size='small' ref="selection" :columns="columns" :data="tableData" stripe>
			<template slot-scope="{ row, index }" slot="finish">
				<span style="color: #26d4a0;font-weight: bold;" v-if="row.finish"><Icon type="ios-checkmark-circle" size="16"/> {{ $t('survey.questionaire.finished') }}</span>
				<span v-else>{{ $t('survey.questionaire.unfinished') }}</span>
			</template>
		</Table>
    </div>
</template>
<script>
    export default {
        props: {
            tableDatas: {
                type: Array,
                default:[]
            }
        },
        data(vm) {
            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: vm.$t('survey.questionaire.name'),
                        key: 'name'
                    },
					{
					    title: vm.$t('survey.questionaire.id'),
					    key: 'id'
					},
                    {
                        title: vm.$t('survey.questionaire.className'),
                        render: (h, params) => {
                            return h('span', params.row.classroomName)
                        },
                    },
                    {
                        title: vm.$t('survey.questionaire.status'),
						slot:'finish'
                        // render: (h, params) => {
                        //     return h('span', params.row.finish ? '已完成' : vm.$t('survey.questionaire.unfinished'))
                        // },
                    },
                    
                ],
                tableData: [],
                commentList: [],
                studentsNum:0
            }
        },
        methods: {

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

        },


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

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