TestPaperList.vue
8.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
<template>
<div class="app-container">
<div class="seetingsDiv" style="">
<el-button type="primary" @click="dialogAddTestPaperVIsible=true">添加试卷
</el-button>
</div>
<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" v-show="false">
<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" v-show="false">
<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="addquestion">题目维护</el-dropdown-item>
<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>
<el-dialog title="添加试卷基本信息" :visible.sync="dialogAddTestPaperVIsible" @close="closeClassDialog" width="600px"
:close-on-click-modal="false">
<div class="grid-content bg-purple">
<el-form ref="form" class="testPaper-manager" :rules="rules" :model="TestPaper" label-width="100px">
<el-form-item label="试卷名称:" class="el-form-item-custom">
<el-input v-model="TestPaper.TestPaperTitle" placeholder="请输入试卷标题"></el-input>
</el-form-item>
<el-form-item label="分类" class="el-form-item-custom">
<el-cascader class="testpaper-input" v-model="TestPaper.QuestionClassId" style="width:400px;"
:props="{emitPath:false}" :clearable=true :options="QuestionClass">
</el-cascader>
</el-form-item>
<el-form-item label="板块分类" class="el-form-item-custom">
<el-select v-model="TestPaper.PlateClass" placeholder="请选择板块分类">
<el-option label="章节练习" value="1"></el-option>
<el-option label="历年真题" value="2"></el-option>
<el-option label="模拟试卷" value="3"></el-option>
</el-select>
</el-form-item>
<el-form-item label="试卷原价:" prop="OriginalPrice" v-show="false">
<el-input class="testpaper-input" oninput="value=value.replace(/[^0-9.]/g,'')"
v-model="TestPaper.OriginalPrice" :precision="0">
<template slot="append">元</template>
</el-input>
</el-form-item>
<el-form-item label="试卷价格:" prop="PresentPrice">
<el-input class="testpaper-input" oninput="value=value.replace(/[^0-9.]/g,'')"
v-model="TestPaper.PresentPrice">
<template slot="append">元</template>
</el-input>
</el-form-item>
<el-form-item label="会员价:" prop="MembershipPrice" v-show="false">
<el-input class="testpaper-input" oninput="value=value.replace(/[^0-9.]/g,'')"
v-model="TestPaper.MembershipPrice">
<template slot="append">元</template>
</el-input>
</el-form-item>
<el-form-item label="试卷简介:">
<el-input class="testpaper-input" :rows="10" type="textarea" v-model="TestPaper.Describe">
</el-input>
</el-form-item>
<el-button type="primary" style="float: right;" @click="SubmitTestPaper">保存
</el-button>
<div style="clear: both;"></div>
</el-form>
</div>
</el-dialog>
<el-dialog>
</el-dialog>
</div>
</template>
<script>
import {
getTestPaperList,
GetToplevel,
EditTestPaper
} from '@/api/TestPaper'
export default {
data() {
return {
parameter: {
pageIndex: 1,
pageSize: 12,
sort: "id",
sortOrder: 1,
keyword: "",
QuestionClassId: 0,
status: 1
},
Count: 0,
testpaperlist: [],
dialogAddTestPaperVIsible: false,
dialogQuestionVlsible:false,
QuestionClass: [],
TestPaper: {
TestPaperTitle: "",
PlateClass: "",
TestPaperClassId: 0,
TotalScore: 0,
Describe: "",
SingleNumber: 0,
MultipleNumber: 0,
SubjectiveNumber: 0,
OriginalPrice: "0",
PresentPrice: "0",
MembershipPrice: "0",
QuestionBankIds: []
},
treeData: [{
value: 0,
label: "全部"
}],
}
},
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();
this.getQuestionClassListHeadler();
},
methods: {
//添加试卷基本信息
SubmitTestPaper() {
EditTestPaper(this.TestPaper).then(res => {
if (res.data.code == 200) {
this.$confirm('添加试卷基本信息成功!', '消息');
this.getTestPaperListHeadler();
} else {
this.$confirm('添加试卷基本信息失败!', '消息')
}
});
},
getTestPaperListHeadler() {
getTestPaperList(this.parameter).then(res => {
this.testpaperlist = res.data.data;
this.Count = res.data.totalCount;
});
},
currentchange(page) {
this.parameter.pageIndex = page;
this.getTestPaperListHeadler();
},
getQuestionClassListHeadler() {
let _this = this;
GetToplevel().then(res => {
var gettree = function(titem) {
titem.children = []
let childrenList = res.data.data.filter(u => u.ParentId == titem.value);
if (childrenList.length == 0)
titem.children = undefined;
res.data.data.filter(u => u.ParentId == titem.value).forEach((item, i) => {
var model = {
value: item.id,
label: item.ClassTitle
};
gettree(model);
titem.children.push(model);
})
}
res.data.data.filter(u => u.ParentId == 0).forEach((item, i) => {
var model = {
value: item.id,
label: item.ClassTitle
};
gettree(model);
_this.QuestionClass.push(model);
_this.treeData.push(model)
})
});
}
}
}
</script>
<style>
.seetingsDiv {
width: 100%;
height: 60px;
background: #efefef;
line-height: 60px;
border-radius: 5px;
box-shadow: 0 0 5px #cdcdcd;
}
.seetingsDiv button {
background-color: #304156;
border: 0px;
margin-left: 10px;
box-shadow: 0 0 5px #cdcdcd;
float: right;
margin-top: 12px;
margin-right: 10px;
}
</style>