Commit 24f4b2483df746ac21777fd7b50224d0355e65ab
1 parent
78ea6110
单卷试题分析打印样式
Showing
2 changed files
with
118 additions
and
49 deletions
src/utils/index.js
@@ -746,7 +746,7 @@ export function formatGradeNameClass(data) { | @@ -746,7 +746,7 @@ export function formatGradeNameClass(data) { | ||
746 | return gradeNameArr; | 746 | return gradeNameArr; |
747 | } | 747 | } |
748 | 748 | ||
749 | -export function tablePrint(id, title) { | 749 | +export function tablePrint(id, title, type = null) { |
750 | let divs = document.getElementById(id); | 750 | let divs = document.getElementById(id); |
751 | let awin = window.open("", "_blank"); | 751 | let awin = window.open("", "_blank"); |
752 | awin.document.getElementsByTagName( | 752 | awin.document.getElementsByTagName( |
@@ -773,8 +773,7 @@ export function tablePrint(id, title) { | @@ -773,8 +773,7 @@ export function tablePrint(id, title) { | ||
773 | .el-table__cell.gutter{display:none} | 773 | .el-table__cell.gutter{display:none} |
774 | ul,li{margin:0;padding:0;list-style:none} | 774 | ul,li{margin:0;padding:0;list-style:none} |
775 | .hui-box{display: flex;text-align: center;} | 775 | .hui-box{display: flex;text-align: center;} |
776 | - .hui-box .s-txt{width: 60px;line-height: 144px;background: #ccc;font-size: 16px;color: #fff;font-weight: 700;border:1px solid #ccc;box-sizing:border-box} | ||
777 | - .hui-ul{border-top: 1px solid #ccc;} | 776 | + .hui-box .s-txt{width: 61px;line-height: 144px;background: #ccc;font-size: 16px;color: #fff;font-weight: 700;border:1px solid #ccc;box-sizing:border-box} |
778 | .hui-li{display: flex;} | 777 | .hui-li{display: flex;} |
779 | .hui-s{height: 48px;line-height: 48px;border-right: 1px solid #ccc;border-bottom: 1px solid #ccc;box-sizing: border-box;} | 778 | .hui-s{height: 48px;line-height: 48px;border-right: 1px solid #ccc;border-bottom: 1px solid #ccc;box-sizing: border-box;} |
780 | .hui-s.s1{width: 100px;} | 779 | .hui-s.s1{width: 100px;} |
@@ -783,12 +782,17 @@ export function tablePrint(id, title) { | @@ -783,12 +782,17 @@ export function tablePrint(id, title) { | ||
783 | .info { display: flex;flex-wrap: wrap;border-left: 1px solid #ccc;border-top: 1px solid #ccc;margin-bottom: 12px;} | 782 | .info { display: flex;flex-wrap: wrap;border-left: 1px solid #ccc;border-top: 1px solid #ccc;margin-bottom: 12px;} |
784 | .info-item {width: 25%;height: 50px;box-sizing: border-box;flex-shrink: 0;background: #f8f8f8;border-right: 1px solid #ccc;border-bottom: 1px solid #ccc;line-height: 50px;text-align: center;} | 783 | .info-item {width: 25%;height: 50px;box-sizing: border-box;flex-shrink: 0;background: #f8f8f8;border-right: 1px solid #ccc;border-bottom: 1px solid #ccc;line-height: 50px;text-align: center;} |
785 | .el-table__header,.el-table__body{width:100%!important;} | 784 | .el-table__header,.el-table__body{width:100%!important;} |
785 | + #print-table{max-width:1400px;margin: 0 auto;width: 100%;} | ||
786 | + .hide{max-width:1400px;margin: 0 auto;width: 100%;border-left: 1px solid #ccc;border-spacing:0;box-sizing:border-box} | ||
787 | + .hide thead th{background:#ccc;line-height: 48px;border-right: 1px solid #ccc;box-sizing:border-box} | ||
788 | + .hide tbody tr td{line-height: 48px;border-right: 1px solid #ccc;text-align:center;box-sizing:border-box} | ||
789 | + .hide td{border-bottom: 1px solid #ccc;} | ||
786 | </style>`; | 790 | </style>`; |
787 | let aDom = divs.cloneNode(true); | 791 | let aDom = divs.cloneNode(true); |
788 | - let aTbody = aDom | ||
789 | - .getElementsByClassName("el-table__body")[0] | ||
790 | - .getElementsByTagName("tbody")[0]; | ||
791 | - aDom.getElementsByClassName("el-table__header")[0].append(aTbody); | 792 | + if (!type) { |
793 | + let aTbody = aDom.getElementsByClassName("el-table__body")[0]?.getElementsByTagName("tbody")[0]; | ||
794 | + aDom.getElementsByClassName("el-table__header")[0].append(aTbody); | ||
795 | + } | ||
792 | if (title) { | 796 | if (title) { |
793 | let pTit = awin.document.createElement('p') | 797 | let pTit = awin.document.createElement('p') |
794 | pTit.className = "tit" | 798 | pTit.className = "tit" |
src/views/standard/test/analysis.vue
@@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
5 | <span>单卷分析</span> | 5 | <span>单卷分析</span> |
6 | </template> | 6 | </template> |
7 | </back-box> | 7 | </back-box> |
8 | - <div class="tips" v-if="paperModifyLog.modifiedTime && !status "> | 8 | + <div class="tips" v-if="paperModifyLog.modifiedTime && !status"> |
9 | <p class="tips-p"> | 9 | <p class="tips-p"> |
10 | <i class="fa fa-bell-o"></i> | 10 | <i class="fa fa-bell-o"></i> |
11 | {{ | 11 | {{ |
@@ -131,46 +131,104 @@ | @@ -131,46 +131,104 @@ | ||
131 | > | 131 | > |
132 | </el-table-column> | 132 | </el-table-column> |
133 | </el-table> | 133 | </el-table> |
134 | - <div class="hui-box" v-show="type == 0"> | ||
135 | - <span class="s-txt">汇总</span> | ||
136 | - <ul class="hui-ul"> | ||
137 | - <li class="hui-li"> | ||
138 | - <span class="hui-s s1">主观题</span> | ||
139 | - <span class="hui-s s1">{{ examReport.subjectiveScore }}</span> | ||
140 | - <span class="hui-s s2">{{ | ||
141 | - examReport.subjectiveHighestScore | ||
142 | - }}</span> | ||
143 | - <span class="hui-s s2">{{ | ||
144 | - examReport.subjectiveLowestScore | ||
145 | - }}</span> | ||
146 | - <span class="hui-s s2">{{ examReport.subjectiveAvgScore }}</span> | ||
147 | - <span class="hui-s s3" | ||
148 | - >{{ examReport.subjectiveClassScoringRate }}%</span | ||
149 | - > | ||
150 | - </li> | ||
151 | - <li class="hui-li"> | ||
152 | - <span class="hui-s s1">客观题</span> | ||
153 | - <span class="hui-s s1">{{ examReport.objectiveScore }}</span> | ||
154 | - <span class="hui-s s2">{{ | ||
155 | - examReport.objectiveHighestScore | ||
156 | - }}</span> | ||
157 | - <span class="hui-s s2">{{ | ||
158 | - examReport.objectiveLowestScore | ||
159 | - }}</span> | ||
160 | - <span class="hui-s s2">{{ examReport.objectiveAvgScore }}</span> | ||
161 | - <span class="hui-s s3" | ||
162 | - >{{ examReport.objectiveClassScoringRate }}%</span | ||
163 | - > | ||
164 | - </li> | ||
165 | - <li class="hui-li"> | ||
166 | - <span class="hui-s s1">整卷</span> | ||
167 | - <span class="hui-s s1">{{ examReport.examPaperScore }}</span> | ||
168 | - <span class="hui-s s2">{{ examReport.highestScore }}</span> | ||
169 | - <span class="hui-s s2">{{ examReport.lowestScore }}</span> | ||
170 | - <span class="hui-s s2">{{ examReport.avgScore }}</span> | ||
171 | - <span class="hui-s s3">{{ examReport.classScoringRate }}%</span> | ||
172 | - </li> | ||
173 | - </ul> | 134 | + <div id="print-table"> |
135 | + <table class="hide"> | ||
136 | + <thead> | ||
137 | + <tr> | ||
138 | + <th>题号</th> | ||
139 | + <th>题型</th> | ||
140 | + <th>满分值</th> | ||
141 | + <th>班最高分</th> | ||
142 | + <th>班最低分</th> | ||
143 | + <th>班平均分</th> | ||
144 | + <th>班级得分率</th> | ||
145 | + <th>答案</th> | ||
146 | + <th>选项1</th> | ||
147 | + <th>选项2</th> | ||
148 | + <th>选项3</th> | ||
149 | + <th>选项4</th> | ||
150 | + <th>未答</th> | ||
151 | + </tr> | ||
152 | + </thead> | ||
153 | + <tbody> | ||
154 | + <tr v-for="(tr, index) in tableData"> | ||
155 | + <td width="60">{{ index + 1 }}</td> | ||
156 | + <td width="100">{{ setSubPro(tr.questionType) }}</td> | ||
157 | + <td width="100">{{ tr.sortable }}</td> | ||
158 | + <td width="110">{{ tr.highestScore }}</td> | ||
159 | + <td width="110">{{ tr.lowestScore }}</td> | ||
160 | + <td width="110">{{ tr.avgScore }}</td> | ||
161 | + <td width="120">{{ tr.classScoringRate }}%</td> | ||
162 | + <td> | ||
163 | + {{ | ||
164 | + tr.correctAnswer == 1 | ||
165 | + ? "✓" | ||
166 | + : tr.correctAnswer == 2 | ||
167 | + ? "✗" | ||
168 | + : tr.correctAnswer | ||
169 | + }} | ||
170 | + </td> | ||
171 | + <td | ||
172 | + v-for="(item, index) in optionsList" | ||
173 | + :key="index" | ||
174 | + width="120" | ||
175 | + > | ||
176 | + <p class="persent"> | ||
177 | + {{ | ||
178 | + tr.questionType == "5" | ||
179 | + ? "" | ||
180 | + : tr["option" + index] | ||
181 | + ? `${tr["option" + index]}(${tr["persent" + index]})` | ||
182 | + : "" | ||
183 | + }} | ||
184 | + </p> | ||
185 | + </td> | ||
186 | + </tr> | ||
187 | + </tbody> | ||
188 | + </table> | ||
189 | + <div class="hui-box" v-show="type == 0"> | ||
190 | + <span class="s-txt">汇总</span> | ||
191 | + <ul class="hui-ul"> | ||
192 | + <li class="hui-li"> | ||
193 | + <span class="hui-s s1">主观题</span> | ||
194 | + <span class="hui-s s1">{{ examReport.subjectiveScore }}</span> | ||
195 | + <span class="hui-s s2">{{ | ||
196 | + examReport.subjectiveHighestScore | ||
197 | + }}</span> | ||
198 | + <span class="hui-s s2">{{ | ||
199 | + examReport.subjectiveLowestScore | ||
200 | + }}</span> | ||
201 | + <span class="hui-s s2">{{ | ||
202 | + examReport.subjectiveAvgScore | ||
203 | + }}</span> | ||
204 | + <span class="hui-s s3" | ||
205 | + >{{ examReport.subjectiveClassScoringRate }}%</span | ||
206 | + > | ||
207 | + </li> | ||
208 | + <li class="hui-li"> | ||
209 | + <span class="hui-s s1">客观题</span> | ||
210 | + <span class="hui-s s1">{{ examReport.objectiveScore }}</span> | ||
211 | + <span class="hui-s s2">{{ | ||
212 | + examReport.objectiveHighestScore | ||
213 | + }}</span> | ||
214 | + <span class="hui-s s2">{{ | ||
215 | + examReport.objectiveLowestScore | ||
216 | + }}</span> | ||
217 | + <span class="hui-s s2">{{ examReport.objectiveAvgScore }}</span> | ||
218 | + <span class="hui-s s3" | ||
219 | + >{{ examReport.objectiveClassScoringRate }}%</span | ||
220 | + > | ||
221 | + </li> | ||
222 | + <li class="hui-li"> | ||
223 | + <span class="hui-s s1">整卷</span> | ||
224 | + <span class="hui-s s1">{{ examReport.examPaperScore }}</span> | ||
225 | + <span class="hui-s s2">{{ examReport.highestScore }}</span> | ||
226 | + <span class="hui-s s2">{{ examReport.lowestScore }}</span> | ||
227 | + <span class="hui-s s2">{{ examReport.avgScore }}</span> | ||
228 | + <span class="hui-s s3">{{ examReport.classScoringRate }}%</span> | ||
229 | + </li> | ||
230 | + </ul> | ||
231 | + </div> | ||
174 | </div> | 232 | </div> |
175 | <el-table | 233 | <el-table |
176 | v-show="type == 1" | 234 | v-show="type == 1" |
@@ -462,7 +520,11 @@ export default { | @@ -462,7 +520,11 @@ export default { | ||
462 | }, | 520 | }, |
463 | methods: { | 521 | methods: { |
464 | print() { | 522 | print() { |
465 | - tablePrint("print-content", this.title + this.tabList[this.type]); | 523 | + if (this.type == 0) { |
524 | + tablePrint("print-table", this.title + this.tabList[this.type], true); | ||
525 | + } else { | ||
526 | + tablePrint("print-content", this.title + this.tabList[this.type]); | ||
527 | + } | ||
466 | }, | 528 | }, |
467 | upSuccess(res) { | 529 | upSuccess(res) { |
468 | //导入成功 | 530 | //导入成功 |
@@ -695,6 +757,9 @@ div::-webkit-scrollbar-thumb { | @@ -695,6 +757,9 @@ div::-webkit-scrollbar-thumb { | ||
695 | } | 757 | } |
696 | </style> | 758 | </style> |
697 | <style lang="scss" scoped> | 759 | <style lang="scss" scoped> |
760 | +.hide { | ||
761 | + display: none; | ||
762 | +} | ||
698 | .page-container { | 763 | .page-container { |
699 | position: relative; | 764 | position: relative; |
700 | height: 100%; | 765 | height: 100%; |