<template>
	<div class="app-container">
		<el-table :data="testpaperlist" id="QuestionTable" border
			style="width: 100%;border-radius: 5px;box-shadow: 0 0 10px #efefef;margin-top: 10px;"
			:header-cell-class-name="headerStyle" :stripe=true>
			<el-table-column prop="date" label="ID" width="50">
				<template slot-scope="scope">
					<span>{{ scope.row.id }}</span>
				</template>
			</el-table-column>
			<el-table-column prop="date" label="试卷标题" width="250">
				<template slot-scope="scope">
					<span>{{ scope.row.TestPaperTitle }}</span>
				</template>
			</el-table-column>
			<el-table-column prop="date" label="试卷总分" width="80">
				<template slot-scope="scope">
					<span>{{ scope.row.TotalScore }}</span>
				</template>
			</el-table-column>
			<el-table-column prop="date" label="单选题数量" width="100">
				<template slot-scope="scope">
					<span>{{ scope.row.SingleNumber }}</span>
				</template>
			</el-table-column>
			<el-table-column prop="date" label="多选题数量" width="100">
				<template slot-scope="scope">
					<span>{{ scope.row.MultipleNumber }}</span>
				</template>
			</el-table-column>
			<el-table-column prop="date" label="主观题数量" width="100">
				<template slot-scope="scope">
					<span>{{ scope.row.SubjectiveNumber }}</span>
				</template>
			</el-table-column>
			<el-table-column prop="TestPaperClassId" label="分类" width="100">
				<template slot-scope="scope">
					<span>{{ scope.row.TestPaperClassId }}</span>
				</template>
			</el-table-column>
			<el-table-column prop="name" label="原价" width="80">
				<template slot-scope="scope">
					<span>{{ scope.row.OriginalPrice/100 }}</span>
				</template>
			</el-table-column>
			<el-table-column prop="name" label="现价" width="80">
				<template slot-scope="scope">
					<span>{{ scope.row.PresentPrice/100 }}</span>
				</template>
			</el-table-column>
			<el-table-column prop="name" label="会员价" width="80">
				<template slot-scope="scope">
					<span>{{ scope.row.MembershipPrice/100 }}</span>
				</template>
			</el-table-column>
			<el-table-column prop="name" label="试卷说明" :show-overflow-tooltip=true>
				<template slot-scope="scope">
					<span>{{ scope.row.Describe }}</span>
				</template>
			</el-table-column>
			<el-table-column fixed="right" label="操作" width="150">
				<template slot-scope="scope">
					<el-dropdown @command="(e)=>{handleCommand(e,scope.row.id)}">
						<span class="el-dropdown-link">
							操作<i class="el-icon-arrow-down el-icon--right"></i>
						</span>
						<template #dropdown>
							<el-dropdown-menu>
								<el-dropdown-item command="update">编辑</el-dropdown-item>
								<!-- <el-dropdown-item command="b">锁定</el-dropdown-item> -->
								<el-dropdown-item command="del">删除</el-dropdown-item>
							</el-dropdown-menu>
						</template>
					</el-dropdown>
				</template>
			</el-table-column>
		</el-table>
		<el-pagination background @current-change="currentchange"
			style="position:static;bottom: 3px;text-align: center;margin-top: 5px;" :page-size="this.parameter.pageSize"
			layout="total,prev, pager, next" :total="Count">
		</el-pagination>
	</div>
</template>

<script>
	import {
		getTestPaperList
	} from '@/api/TestPaper'
	export default {
		data() {
			return {
				parameter: {
					pageIndex: 1,
					pageSize: 12,
					sort: "id",
					sortOrder: 1,
					keyword: "",
					QuestionClassId: 0,
					status: 1
				},
				Count: 0,
				testpaperlist: [],
				
			}
		},
		computed: {

		},
		created() {

		},
		mounted() {
			let ContentAreaHight = window.innerHeight - document.getElementById("QuestionTable").offsetTop;
			let lineNumber = ContentAreaHight - 50 - 40; 
			this.parameter.pageSize =  Math.floor(lineNumber / 49)
			this.getTestPaperListHeadler();
		},
		methods: {
			getTestPaperListHeadler() {
				getTestPaperList(this.parameter).then(res => {
					this.testpaperlist = res.data.data;
					this.Count = res.data.totalCount;
				});
			},
			currentchange(page) {
				this.parameter.pageIndex = page;
				this.getTestPaperListHeadler();
			},
		}
	}
</script>

<style>
</style>
