Commit 696f2d424187a37d5ebe0c3873a664212006ef52

Authored by 梁保满
1 parent b0cd2598

fix:报表导出问题

src/components/exportDia.vue
@@ -26,6 +26,7 @@ @@ -26,6 +26,7 @@
26 <ul v-show="exportType == 2"> 26 <ul v-show="exportType == 2">
27 <p class="export-tit">选择学生</p> 27 <p class="export-tit">选择学生</p>
28 <el-table 28 <el-table
  29 + ref="multipleTable"
29 :data="exportStudent" 30 :data="exportStudent"
30 @selection-change="handleSelectionChange" 31 @selection-change="handleSelectionChange"
31 :max-height="300" 32 :max-height="300"
@@ -38,11 +39,21 @@ @@ -38,11 +39,21 @@
38 ></el-table-column> 39 ></el-table-column>
39 <el-table-column label="班名" align="center"> 40 <el-table-column label="班名" align="center">
40 <template slot-scope="scoped"> 41 <template slot-scope="scoped">
41 - <span v-if="scoped.row.classRank || scoped.row.rank">{{  
42 - scoped.row.classRank || scoped.row.rank  
43 - }}</span> 42 + <span
  43 + v-if="
  44 + scoped.row.classRank ||
  45 + scoped.row.rank ||
  46 + scoped.row['classRank多科汇总']
  47 + "
  48 + >{{
  49 + scoped.row.classRank ||
  50 + scoped.row.rank ||
  51 + scoped.row["classRank多科汇总"]
  52 + }}</span
  53 + >
44 <span v-else>{{ 54 <span v-else>{{
45 - scoped.row.examList && scoped.row.examList[0].classRank 55 + (scoped.row.examList && scoped.row.examList[0].classRank) ||
  56 + (scoped.row.datalist && scoped.row.datalist[0].classRank)
46 }}</span> 57 }}</span>
47 </template> 58 </template>
48 </el-table-column> 59 </el-table-column>
@@ -54,8 +65,11 @@ @@ -54,8 +65,11 @@
54 <span v-else-if="!isNaN(scoped.row.scoringRate)"> 65 <span v-else-if="!isNaN(scoped.row.scoringRate)">
55 {{ scoped.row.scoringRate }}% 66 {{ scoped.row.scoringRate }}%
56 </span> 67 </span>
  68 + <span v-else-if="scoped.row['score多科汇总']">
  69 + {{ Number(scoped.row["score多科汇总"]) }}
  70 + </span>
57 <span v-else>{{ 71 <span v-else>{{
58 - scoped.row.examList && scoped.row.examList[0].score 72 + Number(scoped.row.examList && scoped.row.examList[0].score)
59 }}</span> 73 }}</span>
60 </template></el-table-column 74 </template></el-table-column
61 > 75 >
@@ -107,12 +121,17 @@ export default { @@ -107,12 +121,17 @@ export default {
107 handler: function (nVal) { 121 handler: function (nVal) {
108 if (nVal) { 122 if (nVal) {
109 this.downType = 1; 123 this.downType = 1;
  124 + this.exportType = 1;
  125 + this.multipleSelection = [];
110 } 126 }
111 }, 127 },
112 immediate: true, 128 immediate: true,
113 }, 129 },
114 }, 130 },
115 methods: { 131 methods: {
  132 + cancelSelection() {
  133 + this.$refs.multipleTable.clearSelection();
  134 + },
116 changeDownType() { 135 changeDownType() {
117 this.exportType = 1; 136 this.exportType = 1;
118 }, 137 },
@@ -131,6 +150,7 @@ export default { @@ -131,6 +150,7 @@ export default {
131 }); 150 });
132 } 151 }
133 this.$emit("exportData", this.downType == 1 ? null : studentIds); 152 this.$emit("exportData", this.downType == 1 ? null : studentIds);
  153 + this.cancelSelection();
134 }, 154 },
135 cancel() { 155 cancel() {
136 if (this.exportType == 2) { 156 if (this.exportType == 2) {
src/views/basic/ask/analysis.vue
@@ -3,56 +3,110 @@ @@ -3,56 +3,110 @@
3 <back-box> 3 <back-box>
4 <template slot="title"> 4 <template slot="title">
5 <span>{{ 5 <span>{{
6 - types == 1 ? "单课分析" :  
7 - types == 2 ? `${className}-${subjectNames[0]}汇总分析` :  
8 - `${className}-多科汇总分析` }}</span> 6 + types == 1
  7 + ? "单课分析"
  8 + : types == 2
  9 + ? `${className}-${subjectNames[0]}汇总分析`
  10 + : `${className}-多科汇总分析`
  11 + }}</span>
9 </template> 12 </template>
10 </back-box> 13 </back-box>
11 <div class="page-content"> 14 <div class="page-content">
12 <div class="tab-box"> 15 <div class="tab-box">
13 - <span class="tab-item" v-for="(item, index) in tabList" :key="index" :class="type == item.value ? 'active' : ''"  
14 - @click="setType(item.value)">{{ item.name }}</span> 16 + <span
  17 + class="tab-item"
  18 + v-for="(item, index) in tabList"
  19 + :key="index"
  20 + :class="type == item.value ? 'active' : ''"
  21 + @click="setType(item.value)"
  22 + >{{ item.name }}</span
  23 + >
15 </div> 24 </div>
16 <div v-loading="loading"> 25 <div v-loading="loading">
17 <div id="print-content"> 26 <div id="print-content">
18 -  
19 <!-- 学生答题情况 --> 27 <!-- 学生答题情况 -->
20 <Detail v-if="type == 1" :types="types" :detail="detail" :id="id" /> 28 <Detail v-if="type == 1" :types="types" :detail="detail" :id="id" />
21 <!-- 学生答题情况 --> 29 <!-- 学生答题情况 -->
22 <Example v-if="type == 1" :types="types" :tableData="tableData" /> 30 <Example v-if="type == 1" :types="types" :tableData="tableData" />
23 <!-- 学生问答 --> 31 <!-- 学生问答 -->
24 - <AnswerQustion v-if="type == 2" :types="types" :tableData="tableData" :subjectNames="subjectNames" /> 32 + <AnswerQustion
  33 + v-if="type == 2"
  34 + :types="types"
  35 + :tableData="tableData"
  36 + :subjectNames="subjectNames"
  37 + />
25 <!-- 学生互动表现 --> 38 <!-- 学生互动表现 -->
26 <Interact v-if="type == 3" :types="types" :tableData="tableData" /> 39 <Interact v-if="type == 3" :types="types" :tableData="tableData" />
27 <!-- 签到明细 --> 40 <!-- 签到明细 -->
28 <Report v-if="type == 4" :tableData="tableData" /> 41 <Report v-if="type == 4" :tableData="tableData" />
29 </div> 42 </div>
30 <div class="pagination-box" v-show="type == 1"> 43 <div class="pagination-box" v-show="type == 1">
31 - <el-pagination small="" layout="total,prev, pager, next" :hide-on-single-page="true" :total="total"  
32 - @current-change="changePage" :current-page="page" :page-size="size"> 44 + <el-pagination
  45 + small=""
  46 + layout="total,prev, pager, next"
  47 + :hide-on-single-page="true"
  48 + :total="total"
  49 + @current-change="changePage"
  50 + :current-page="page"
  51 + :page-size="size"
  52 + >
33 </el-pagination> 53 </el-pagination>
34 </div> 54 </div>
35 <p class="down"> 55 <p class="down">
36 - <el-button @click="openDown" type="primary" plain round icon="fa fa-cloud-download">导出报表</el-button>  
37 - <el-button v-if="!this.$store.getters.code" @click="print" type="primary" plain round  
38 - icon="el-icon-printer">打印</el-button> 56 + <el-button
  57 + v-if="types == 1"
  58 + @click="exportData"
  59 + type="primary"
  60 + plain
  61 + round
  62 + icon="fa fa-cloud-download"
  63 + >导出报表</el-button
  64 + >
  65 + <el-button
  66 + v-else
  67 + @click="openDown"
  68 + type="primary"
  69 + plain
  70 + round
  71 + icon="fa fa-cloud-download"
  72 + >导出报表</el-button
  73 + >
  74 + <el-button
  75 + v-if="!this.$store.getters.code"
  76 + @click="print"
  77 + type="primary"
  78 + plain
  79 + round
  80 + icon="el-icon-printer"
  81 + >打印</el-button
  82 + >
39 </p> 83 </p>
40 </div> 84 </div>
41 - <ExportDia :exportStudent="exportStudent" :diaShow="diaShow" @cancel="cancel" @exportData="exportData" :type="types==3?'雷达图':'折线图'"/> 85 + <ExportDia
  86 + :exportStudent="exportStudent"
  87 + :diaShow="diaShow"
  88 + @cancel="cancel"
  89 + @exportData="exportData"
  90 + :type="types == 3 ? '雷达图' : '折线图'"
  91 + />
42 </div> 92 </div>
43 </div> 93 </div>
44 </template> 94 </template>
45 95
46 <script> 96 <script>
47 import { downloadFile, tablePrint } from "@/utils"; 97 import { downloadFile, tablePrint } from "@/utils";
48 -import Detail from "./components/detail.vue"  
49 -import Example from "./components/example.vue"  
50 -import AnswerQustion from "./components/answerQustion.vue"  
51 -import Interact from "./components/interact.vue"  
52 -import Report from "./components/report.vue" 98 +import Detail from "./components/detail.vue";
  99 +import Example from "./components/example.vue";
  100 +import AnswerQustion from "./components/answerQustion.vue";
  101 +import Interact from "./components/interact.vue";
  102 +import Report from "./components/report.vue";
53 export default { 103 export default {
54 components: { 104 components: {
55 - Detail, Example, AnswerQustion, Interact, Report 105 + Detail,
  106 + Example,
  107 + AnswerQustion,
  108 + Interact,
  109 + Report,
56 }, 110 },
57 data() { 111 data() {
58 return { 112 return {
@@ -79,32 +133,37 @@ export default { @@ -79,32 +133,37 @@ export default {
79 this.role = 133 this.role =
80 this.$store.getters.info.showRole || 134 this.$store.getters.info.showRole ||
81 this.$store.getters.info.permissions[0].role; 135 this.$store.getters.info.permissions[0].role;
82 - this.types = Number(this.$route.query.types)  
83 - this.className = this.$route.query.className  
84 - const queryData = JSON.parse(this.$route.query.params)  
85 - this.classId = queryData.classId  
86 - console.log(this.$route.query)  
87 - this.subjectNames = this.$route.query.subjectNames.split(',') 136 + this.types = Number(this.$route.query.types);
  137 + this.className = this.$route.query.className;
  138 + const queryData = JSON.parse(this.$route.query.params);
  139 + this.classId = queryData.classId;
  140 + console.log(this.$route.query);
  141 + this.subjectNames = this.$route.query.subjectNames.split(",");
88 if (this.types == 1) { 142 if (this.types == 1) {
89 - this.tabList = [{ name: "答题表现", value: 1 },  
90 - { name: "学生问答表现", value: 2 },  
91 - { name: "学生互动表现", value: 3 },  
92 - { name: "签到明细", value: 4 },] 143 + this.tabList = [
  144 + { name: "答题表现", value: 1 },
  145 + { name: "学生问答表现", value: 2 },
  146 + { name: "学生互动表现", value: 3 },
  147 + { name: "签到明细", value: 4 },
  148 + ];
93 } else if (this.types == 2) { 149 } else if (this.types == 2) {
94 - this.tabList = [{ name: "答题表现", value: 1 },  
95 - { name: "学生问答表现", value: 2 },  
96 - { name: "学生互动表现", value: 3 }] 150 + this.tabList = [
  151 + { name: "答题表现", value: 1 },
  152 + { name: "学生问答表现", value: 2 },
  153 + { name: "学生互动表现", value: 3 },
  154 + ];
97 } else if (this.types == 3) { 155 } else if (this.types == 3) {
98 this.tabList = [ 156 this.tabList = [
99 { name: "学生问答表现", value: 2 }, 157 { name: "学生问答表现", value: 2 },
100 - { name: "学生互动表现", value: 3 }] 158 + { name: "学生互动表现", value: 3 },
  159 + ];
101 } 160 }
102 - this.type = this.tabList[0].value  
103 - this.id = JSON.parse(this.$route.query.id) 161 + this.type = this.tabList[0].value;
  162 + this.id = JSON.parse(this.$route.query.id);
104 this.status = this.$route.query.status ? this.$route.query.status : 0; 163 this.status = this.$route.query.status ? this.$route.query.status : 0;
105 this._QueryData(); 164 this._QueryData();
106 - this.types != 1 ?this._QueryDataQuestionRank():'';  
107 - this.types != 3 ? this.periodDetail() : ''; 165 + this.types != 1 ? this._QueryDataQuestionRank() : "";
  166 + this.types != 3 ? this.periodDetail() : "";
108 }, 167 },
109 methods: { 168 methods: {
110 print() { 169 print() {
@@ -141,9 +200,10 @@ export default { @@ -141,9 +200,10 @@ export default {
141 this._QueryData(); 200 this._QueryData();
142 }, 201 },
143 async periodDetail() { 202 async periodDetail() {
144 - const periodDetail = this.role == "ROLE_PERSONAL" ?  
145 - this.$request.pPeriodDetail :  
146 - this.$request.periodDetail; 203 + const periodDetail =
  204 + this.role == "ROLE_PERSONAL"
  205 + ? this.$request.pPeriodDetail
  206 + : this.$request.periodDetail;
147 let { data, info, status } = await periodDetail({ 207 let { data, info, status } = await periodDetail({
148 periodIds: this.id, 208 periodIds: this.id,
149 }); 209 });
@@ -164,42 +224,54 @@ export default { @@ -164,42 +224,54 @@ export default {
164 let query = {}; 224 let query = {};
165 if (this.role == "ROLE_PERSONAL") { 225 if (this.role == "ROLE_PERSONAL") {
166 if (this.types == 1) { 226 if (this.types == 1) {
167 - query.page = this.page  
168 - query.size = this.size  
169 - queryData = this.type == 1  
170 - ? this.$request.pPeriodQuestionReport  
171 - : this.$request.pPeriodStudentReport;  
172 -  
173 - }  
174 - else if (this.types == 2) {  
175 - queryData = this.type == 1  
176 - ? this.$request.pPeriodQuestionReport  
177 - : this.type == 2 ? this.$request.phaseAnswerReport : this.$request.phaseInteractiveReport; 227 + query.page = this.page;
  228 + query.size = this.size;
  229 + queryData =
  230 + this.type == 1
  231 + ? this.$request.pPeriodQuestionReport
  232 + : this.$request.pPeriodStudentReport;
  233 + } else if (this.types == 2) {
  234 + queryData =
  235 + this.type == 1
  236 + ? this.$request.pPeriodQuestionReport
  237 + : this.type == 2
  238 + ? this.$request.phaseAnswerReport
  239 + : this.$request.phaseInteractiveReport;
178 } else if (this.types == 3) { 240 } else if (this.types == 3) {
179 - queryData = this.type == 2 ? this.$request.pPhaseAnswerReport : this.$request.pPhaseInteractiveReport; 241 + queryData =
  242 + this.type == 2
  243 + ? this.$request.pPhaseAnswerReport
  244 + : this.$request.pPhaseInteractiveReport;
180 } 245 }
181 } else { 246 } else {
182 if (this.types == 1) { 247 if (this.types == 1) {
183 - query.page = this.page  
184 - query.size = this.size  
185 - queryData = this.type == 1  
186 - ? this.$request.periodQuestionReport  
187 - : this.$request.periodStudentReport; 248 + query.page = this.page;
  249 + query.size = this.size;
  250 + queryData =
  251 + this.type == 1
  252 + ? this.$request.periodQuestionReport
  253 + : this.$request.periodStudentReport;
188 } else if (this.types == 2) { 254 } else if (this.types == 2) {
189 - queryData = this.type == 1  
190 - ? this.$request.periodQuestionReport  
191 - : this.type == 2 ? this.$request.phaseAnswerReport : this.$request.phaseInteractiveReport; 255 + queryData =
  256 + this.type == 1
  257 + ? this.$request.periodQuestionReport
  258 + : this.type == 2
  259 + ? this.$request.phaseAnswerReport
  260 + : this.$request.phaseInteractiveReport;
192 } else if (this.types == 3) { 261 } else if (this.types == 3) {
193 - queryData = this.type == 2 ? this.$request.cTPhaseAnswerReport : this.$request.cTPhaseInteractiveReport; 262 + queryData =
  263 + this.type == 2
  264 + ? this.$request.cTPhaseAnswerReport
  265 + : this.$request.cTPhaseInteractiveReport;
194 } 266 }
195 } 267 }
196 if (this.types == 1) { 268 if (this.types == 1) {
197 - query.periodId = this.id[0]  
198 - query.type = this.type - 1 269 + query.periodId = this.id[0];
  270 + query.type = this.type - 1;
199 } else { 271 } else {
200 - query.periodIds = this.id 272 + query.periodIds = this.id;
201 if (this.types == 3) { 273 if (this.types == 3) {
202 - query.subjectNames = this.subjectNames 274 + query.subjectNames = this.subjectNames;
203 } 275 }
204 } 276 }
205 this.loading = true; 277 this.loading = true;
@@ -209,7 +281,7 @@ export default { @@ -209,7 +281,7 @@ export default {
209 }); 281 });
210 this.loading = false; 282 this.loading = false;
211 if (status === 0) { 283 if (status === 0) {
212 - this.tableData = data?.list || [] 284 + this.tableData = data?.list || [];
213 this.total = data.count; 285 this.total = data.count;
214 } else { 286 } else {
215 this.$message.error(info); 287 this.$message.error(info);
@@ -218,15 +290,15 @@ export default { @@ -218,15 +290,15 @@ export default {
218 async _QueryDataQuestionRank() { 290 async _QueryDataQuestionRank() {
219 let queryData; 291 let queryData;
220 let query = {}; 292 let query = {};
221 -  
222 - query.periodIds = this.id  
223 - if (this.types == 2) {  
224 - queryData = this.$request.phaseAnswerReport  
225 - } else if (this.types == 3) {  
226 - queryData = this.$request.cTPhaseAnswerReport  
227 - } 293 +
  294 + query.periodIds = this.id;
  295 + if (this.types == 2) {
  296 + queryData = this.$request.phaseAnswerReport;
  297 + } else if (this.types == 3) {
  298 + queryData = this.$request.cTPhaseAnswerReport;
  299 + }
228 if (this.types != 1) { 300 if (this.types != 1) {
229 - query.classId = this.classId 301 + query.classId = this.classId;
230 } 302 }
231 this.loading = true; 303 this.loading = true;
232 let { data, info, status } = await queryData({ 304 let { data, info, status } = await queryData({
@@ -234,15 +306,15 @@ export default { @@ -234,15 +306,15 @@ export default {
234 ...query, 306 ...query,
235 }); 307 });
236 this.loading = false; 308 this.loading = false;
237 - console.log(data) 309 + console.log(data);
238 if (status === 0) { 310 if (status === 0) {
239 - this.exportStudent = data?.list && [...data?.list] || [] 311 + this.exportStudent = (data?.list && [...data?.list]) || [];
240 } else { 312 } else {
241 this.$message.error(info); 313 this.$message.error(info);
242 } 314 }
243 }, 315 },
244 316
245 - //导出 317 + //导出
246 openDown() { 318 openDown() {
247 this.diaShow = true; 319 this.diaShow = true;
248 }, 320 },
@@ -252,39 +324,48 @@ export default { @@ -252,39 +324,48 @@ export default {
252 async exportData(arr) { 324 async exportData(arr) {
253 if (this.exportLoading == true) return; 325 if (this.exportLoading == true) return;
254 this.exportLoading = true; 326 this.exportLoading = true;
255 - let studentIds = arr 327 + let studentIds = arr;
256 let query = {}; 328 let query = {};
257 - if(studentIds != null){ 329 + if (studentIds != null) {
258 if (studentIds.length > 0) { 330 if (studentIds.length > 0) {
259 - query.studentIds = studentIds 331 + query.studentIds = studentIds;
260 } else { 332 } else {
261 - query.studentIds = [] 333 + query.studentIds = [];
262 } 334 }
263 } 335 }
264 - let exportPeriodReport = "" 336 + let exportPeriodReport = "";
265 if (this.types == 1) { 337 if (this.types == 1) {
266 - query.periodId = this.id[0]  
267 - exportPeriodReport = this.role == "ROLE_PERSONAL" ? this.$request.pExportPeriodReport : this.$request.exportPeriodReport  
268 - } else if(this.types == 2){  
269 - query.periodIds = this.id  
270 - exportPeriodReport = this.role == "ROLE_PERSONAL" ?this.$request.pExportPhaseAnswerReport:this.$request.exportPhaseAnswerReport  
271 - }else{  
272 - query.periodIds = this.id  
273 - exportPeriodReport = this.$request.cTExportPhaseAnswerReport 338 + query.periodId = this.id[0];
  339 + exportPeriodReport =
  340 + this.role == "ROLE_PERSONAL"
  341 + ? this.$request.pExportPeriodReport
  342 + : this.$request.exportPeriodReport;
  343 + } else if (this.types == 2) {
  344 + query.periodIds = this.id;
  345 + exportPeriodReport =
  346 + this.role == "ROLE_PERSONAL"
  347 + ? this.$request.pExportPhaseAnswerReport
  348 + : this.$request.exportPhaseAnswerReport;
  349 + } else {
  350 + query.periodIds = this.id;
  351 + exportPeriodReport = this.$request.cTExportPhaseAnswerReport;
274 } 352 }
275 const data = await exportPeriodReport({ 353 const data = await exportPeriodReport({
276 classId: this.classId, 354 classId: this.classId,
277 - ...query 355 + ...query,
278 }); 356 });
279 this.exportLoading = false; 357 this.exportLoading = false;
280 if (data) { 358 if (data) {
281 - this.cancel() 359 + this.cancel();
282 let blob = new Blob([data], { 360 let blob = new Blob([data], {
283 type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", 361 type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
284 }); 362 });
285 - let name = this.types == 1 ? "随堂问-单课时报表.xlsx" :  
286 - this.types == 2 ? `随堂问-${this.className}-${this.subjectNames[0]}汇总分析报表.xlsx` :  
287 - `随堂问-${this.className}-多科汇总分析报表.xlsx` 363 + let name =
  364 + this.types == 1
  365 + ? "随堂问-单课时报表.xlsx"
  366 + : this.types == 2
  367 + ? `随堂问-${this.className}-${this.subjectNames[0]}汇总分析报表.xlsx`
  368 + : `随堂问-${this.className}-多科汇总分析报表.xlsx`;
288 downloadFile(this.status ? "随堂问-已归档单课时报表.xlsx" : name, blob); 369 downloadFile(this.status ? "随堂问-已归档单课时报表.xlsx" : name, blob);
289 } else { 370 } else {
290 this.$message.error("下载失败"); 371 this.$message.error("下载失败");
@@ -351,7 +432,6 @@ div::-webkit-scrollbar-thumb { @@ -351,7 +432,6 @@ div::-webkit-scrollbar-thumb {
351 } 432 }
352 433
353 .el-dialog { 434 .el-dialog {
354 -  
355 .down-item { 435 .down-item {
356 font-size: 15px; 436 font-size: 15px;
357 margin-bottom: 10px; 437 margin-bottom: 10px;
src/views/basic/setUp/teacher.vue
@@ -538,13 +538,14 @@ export default { @@ -538,13 +538,14 @@ export default {
538 async created() { 538 async created() {
539 this.code = this.$store.getters.csCode; 539 this.code = this.$store.getters.csCode;
540 this._QueryData(4); 540 this._QueryData(4);
541 - await this._QueryDataGrade(); 541 + await this._QueryDataGrade(1); //筛选用
  542 + await this._QueryDataGrade(2); //配置角色用
542 // this._RoleList(); 543 // this._RoleList();
543 }, 544 },
544 methods: { 545 methods: {
545 async changeType() { 546 async changeType() {
546 this.query.gradeClassSub = []; 547 this.query.gradeClassSub = [];
547 - this.query.type = 0; 548 + // this.query.type = 0;
548 this.query.teacherName = ""; 549 this.query.teacherName = "";
549 this.query.phone = ""; 550 this.query.phone = "";
550 if (this.query.classType === 0) { 551 if (this.query.classType === 0) {
@@ -554,7 +555,7 @@ export default { @@ -554,7 +555,7 @@ export default {
554 } 555 }
555 556
556 this._QueryData(6); 557 this._QueryData(6);
557 - await this._QueryDataGrade(); 558 + await this._QueryDataGrade(1);
558 }, 559 },
559 //选择删除 560 //选择删除
560 handleCheckAllChange(val) { 561 handleCheckAllChange(val) {
@@ -982,10 +983,14 @@ export default { @@ -982,10 +983,14 @@ export default {
982 this.$message.error(info); 983 this.$message.error(info);
983 } 984 }
984 }, 985 },
985 - async _QueryDataGrade() { 986 + async _QueryDataGrade(type) {
  987 + let query = {};
  988 + if (type == 1) {
  989 + query.type = this.query.classType;
  990 + }
986 //年级数据 991 //年级数据
987 const { data, status, info } = await this.$request.gradeList({ 992 const { data, status, info } = await this.$request.gradeList({
988 - type: this.query.classType, 993 + ...query,
989 }); 994 });
990 if (status === 0) { 995 if (status === 0) {
991 this.classList = []; 996 this.classList = [];
@@ -1000,23 +1005,9 @@ export default { @@ -1000,23 +1005,9 @@ export default {
1000 label: items, 1005 label: items,
1001 }; 1006 };
1002 }); 1007 });
1003 - // 学校-年级  
1004 - this.gradeClassList.push({  
1005 - value: item.grade,  
1006 - label: item.gradeName,  
1007 - id: item.grade,  
1008 - children: item.classList.map((clazz) => {  
1009 - return {  
1010 - value: clazz.id,  
1011 - label: clazz.className,  
1012 - id: clazz.id,  
1013 - };  
1014 - }),  
1015 - });  
1016 -  
1017 - if (this.query.classType == 0) {  
1018 - //学校-年级-科目  
1019 - this.gradeClassSubList.push({ 1008 + if (type == 2) {
  1009 + // 学校-年级
  1010 + this.gradeClassList.push({
1020 value: item.grade, 1011 value: item.grade,
1021 label: item.gradeName, 1012 label: item.gradeName,
1022 id: item.grade, 1013 id: item.grade,
@@ -1025,29 +1016,10 @@ export default { @@ -1025,29 +1016,10 @@ export default {
1025 value: clazz.id, 1016 value: clazz.id,
1026 label: clazz.className, 1017 label: clazz.className,
1027 id: clazz.id, 1018 id: clazz.id,
1028 - children: [...subList],  
1029 - };  
1030 - }),  
1031 - });  
1032 - //学校-科目-班级  
1033 - this.gradeSubListClass.push({  
1034 - value: item.grade,  
1035 - label: item.gradeName,  
1036 - id: item.grade,  
1037 - children: item.subjectNames.map((items) => {  
1038 - return {  
1039 - value: items,  
1040 - label: items,  
1041 - children: item.classList.map((clazz) => {  
1042 - return {  
1043 - value: clazz.id,  
1044 - label: clazz.className,  
1045 - };  
1046 - }),  
1047 }; 1019 };
1048 }), 1020 }),
1049 }); 1021 });
1050 - } else { 1022 +
1051 let subjectNames = item.classList.map((clazz) => { 1023 let subjectNames = item.classList.map((clazz) => {
1052 return { 1024 return {
1053 value: clazz.subjectName, 1025 value: clazz.subjectName,
@@ -1061,32 +1033,72 @@ export default { @@ -1061,32 +1033,72 @@ export default {
1061 }; 1033 };
1062 }); 1034 });
1063 1035
1064 - //学校-年级-科目  
1065 - this.gradeClassSubList.push({ 1036 + //学校-科目-班级
  1037 + this.gradeSubListClass.push({
1066 value: item.grade, 1038 value: item.grade,
1067 label: item.gradeName, 1039 label: item.gradeName,
1068 id: item.grade, 1040 id: item.grade,
1069 - children: item.classList.map((clazz) => { 1041 + children: item.subjectNames.map((items) => {
  1042 + let child = [];
  1043 + item.classList.map((clazz) => {
  1044 + if (clazz.subjectName) {
  1045 + if (items == clazz.subjectName) {
  1046 + child.push({
  1047 + value: clazz.id,
  1048 + label: clazz.className,
  1049 + });
  1050 + }
  1051 + } else {
  1052 + child.push({
  1053 + value: clazz.id,
  1054 + label: clazz.className,
  1055 + });
  1056 + }
  1057 + });
1070 return { 1058 return {
1071 - value: clazz.id,  
1072 - label: clazz.className,  
1073 - id: clazz.id,  
1074 - children: [  
1075 - {  
1076 - value: clazz.subjectName,  
1077 - label: clazz.subjectName,  
1078 - },  
1079 - ], 1059 + value: items,
  1060 + label: items,
  1061 + children: child,
1080 }; 1062 };
1081 }), 1063 }),
1082 }); 1064 });
1083 -  
1084 - this.gradeSubListClass.push({  
1085 - value: item.grade,  
1086 - label: item.gradeName,  
1087 - id: item.grade,  
1088 - children: subjectNames,  
1089 - }); 1065 + } else {
  1066 + if (this.query.classType == 0) {
  1067 + //学校-年级-科目
  1068 + this.gradeClassSubList.push({
  1069 + value: item.grade,
  1070 + label: item.gradeName,
  1071 + id: item.grade,
  1072 + children: item.classList.map((clazz) => {
  1073 + return {
  1074 + value: clazz.id,
  1075 + label: clazz.className,
  1076 + id: clazz.id,
  1077 + children: [...subList],
  1078 + };
  1079 + }),
  1080 + });
  1081 + } else {
  1082 + //学校-年级-科目
  1083 + this.gradeClassSubList.push({
  1084 + value: item.grade,
  1085 + label: item.gradeName,
  1086 + id: item.grade,
  1087 + children: item.classList.map((clazz) => {
  1088 + return {
  1089 + value: clazz.id,
  1090 + label: clazz.className,
  1091 + id: clazz.id,
  1092 + children: [
  1093 + {
  1094 + value: clazz.subjectName,
  1095 + label: clazz.subjectName,
  1096 + },
  1097 + ],
  1098 + };
  1099 + }),
  1100 + });
  1101 + }
1090 } 1102 }
1091 1103
1092 let classList = item.classList.map((clazz) => { 1104 let classList = item.classList.map((clazz) => {
src/views/basic/test/components/multipleSubTest.vue
@@ -2,47 +2,111 @@ @@ -2,47 +2,111 @@
2 <div class="table-box" ref="main" v-loading="loading"> 2 <div class="table-box" ref="main" v-loading="loading">
3 <div id="print-content"> 3 <div id="print-content">
4 <!-- 多科多卷 --> 4 <!-- 多科多卷 -->
5 - <el-table :data="tableData" :max-height="tableMaxHeight" border style="width: 100%">  
6 - <el-table-column prop="studentCode" label="学号" align="center" fixed></el-table-column> 5 + <el-table
  6 + :data="tableData"
  7 + :max-height="tableMaxHeight"
  8 + border
  9 + style="width: 100%"
  10 + >
  11 + <el-table-column
  12 + prop="studentCode"
  13 + label="学号"
  14 + align="center"
  15 + fixed
  16 + ></el-table-column>
7 17
8 <el-table-column prop="studentName" label="姓名" fixed align="center"> 18 <el-table-column prop="studentName" label="姓名" fixed align="center">
9 - <template slot-scope="scoped"><span class="click-b" @click="toPortrait(scoped.row)"> 19 + <template slot-scope="scoped"
  20 + ><span class="click-b" @click="toPortrait(scoped.row)">
10 {{ scoped.row.studentName }} 21 {{ scoped.row.studentName }}
11 - </span></template> 22 + </span></template
  23 + >
12 </el-table-column> 24 </el-table-column>
13 - <el-table-column align="center" v-for="(item, index) in answerList" :key="index" :label="item">  
14 - <el-table-column :prop="'examCount' + item" label="测练数" align="center"  
15 - :class-name="index % 2 == 0 ? 'bg' : ''"></el-table-column>  
16 - <el-table-column :prop="'participationCount' + item" label="参与数" align="center"  
17 - :class-name="index % 2 == 0 ? 'bg' : ''"></el-table-column>  
18 - <el-table-column :prop="'score' + item" label="总分" align="center"  
19 - :class-name="index % 2 == 0 ? 'bg' : ''"></el-table-column>  
20 - <el-table-column :prop="'classRank' + item" label="班名" align="center"  
21 - :class-name="index % 2 == 0 ? 'bg' : ''"></el-table-column> 25 + <el-table-column
  26 + align="center"
  27 + v-for="(item, index) in answerList"
  28 + :key="index"
  29 + :label="item"
  30 + >
  31 + <el-table-column
  32 + :prop="'examCount' + item"
  33 + label="测练数"
  34 + align="center"
  35 + :class-name="index % 2 == 0 ? 'bg' : ''"
  36 + ></el-table-column>
  37 + <el-table-column
  38 + :prop="'participationCount' + item"
  39 + label="参与数"
  40 + align="center"
  41 + :class-name="index % 2 == 0 ? 'bg' : ''"
  42 + ></el-table-column>
  43 + <el-table-column
  44 + :prop="'score' + item"
  45 + label="总分"
  46 + align="center"
  47 + :class-name="index % 2 == 0 ? 'bg' : ''"
  48 + ></el-table-column>
  49 + <el-table-column
  50 + :prop="'classRank' + item"
  51 + label="班名"
  52 + align="center"
  53 + :class-name="index % 2 == 0 ? 'bg' : ''"
  54 + ></el-table-column>
22 </el-table-column> 55 </el-table-column>
23 <el-table-column label="查看雷达图" align="center"> 56 <el-table-column label="查看雷达图" align="center">
24 <template slot-scope="scoped"> 57 <template slot-scope="scoped">
25 - <el-button @click="openChart(scoped.row)" type="primary" size="mini" circle  
26 - icon="el-icon-arrow-right"></el-button> 58 + <el-button
  59 + @click="openChart(scoped.row)"
  60 + type="primary"
  61 + size="mini"
  62 + circle
  63 + icon="el-icon-arrow-right"
  64 + ></el-button>
27 </template> 65 </template>
28 </el-table-column> 66 </el-table-column>
29 </el-table> 67 </el-table>
30 </div> 68 </div>
31 <div class="down"> 69 <div class="down">
32 - <el-button @click="openDown" type="primary" plain round icon="fa fa-cloud-download">导出报表</el-button>  
33 - <el-button v-if="!this.$store.getters.code" @click="print" type="primary" plain round  
34 - icon="el-icon-printer">打印</el-button> 70 + <el-button
  71 + @click="openDown"
  72 + type="primary"
  73 + plain
  74 + round
  75 + icon="fa fa-cloud-download"
  76 + >导出报表</el-button
  77 + >
  78 + <el-button
  79 + v-if="!this.$store.getters.code"
  80 + @click="print"
  81 + type="primary"
  82 + plain
  83 + round
  84 + icon="el-icon-printer"
  85 + >打印</el-button
  86 + >
35 </div> 87 </div>
36 - <el-dialog class="chart-dia" :visible.sync="chartDia" :title="chartTitle" width="800"> 88 + <el-dialog
  89 + class="chart-dia"
  90 + :visible.sync="chartDia"
  91 + :title="chartTitle"
  92 + width="800"
  93 + >
37 <div class="chart-box"> 94 <div class="chart-box">
38 <RadarChart id="radarChart" :params="chartData" /> 95 <RadarChart id="radarChart" :params="chartData" />
39 </div> 96 </div>
40 </el-dialog> 97 </el-dialog>
41 - <ExportDia :exportStudent="exportStudent" :diaShow="diaShow" @cancel="cancel" @exportData="exportData" type="雷达图"/> 98 + <ExportDia
  99 + :exportStudent="exportStudent"
  100 + :diaShow="diaShow"
  101 + @cancel="cancel"
  102 + @exportData="exportData"
  103 + lastLabel="总分"
  104 + type="雷达图"
  105 + />
42 </div> 106 </div>
43 </template> 107 </template>
44 <script> 108 <script>
45 -import RadarChart from "@/components/charts/radarChart" 109 +import RadarChart from "@/components/charts/radarChart";
46 110
47 import { downloadFile, tablePrint } from "@/utils"; 111 import { downloadFile, tablePrint } from "@/utils";
48 export default { 112 export default {
@@ -65,37 +129,38 @@ export default { @@ -65,37 +129,38 @@ export default {
65 chartData: { 129 chartData: {
66 indicator: [ 130 indicator: [
67 { 131 {
68 - name: '', max: 100, 132 + name: "",
  133 + max: 100,
69 axisLabel: { 134 axisLabel: {
70 show: true, 135 show: true,
71 showMaxLabel: true, 136 showMaxLabel: true,
72 }, 137 },
73 }, 138 },
74 ], 139 ],
75 - seriesData: [] 140 + seriesData: [],
76 }, 141 },
77 chartDia: false, 142 chartDia: false,
78 chartTitle: "", 143 chartTitle: "",
79 144
80 //导出相关 145 //导出相关
81 diaShow: false, 146 diaShow: false,
82 - exportStudent: []  
83 - } 147 + exportStudent: [],
  148 + };
84 }, 149 },
85 computed: { 150 computed: {
86 subjectList: function () { 151 subjectList: function () {
87 - return this.subjectName?.split(",")  
88 - } 152 + return this.subjectName?.split(",");
  153 + },
89 }, 154 },
90 created() { 155 created() {
91 - this.phaseExamReport() 156 + this.phaseExamReport();
92 }, 157 },
93 mounted() { 158 mounted() {
94 this.tableMaxHeight = this.$refs.main.offsetHeight; 159 this.tableMaxHeight = this.$refs.main.offsetHeight;
95 }, 160 },
96 methods: { 161 methods: {
97 print() { 162 print() {
98 - tablePrint("print-content", this.title + this.tabList[this.type]); 163 + tablePrint("print-content", this.subjectName + "汇总报表");
99 }, 164 },
100 toPortrait(obj) { 165 toPortrait(obj) {
101 //暂时不上线 166 //暂时不上线
@@ -135,63 +200,61 @@ export default { @@ -135,63 +200,61 @@ export default {
135 }, 200 },
136 //查看雷达图 201 //查看雷达图
137 openChart(obj) { 202 openChart(obj) {
138 -  
139 - this.chartTitle = obj.studentName + '-多科-多课时作答表现图' 203 + this.chartTitle = obj.studentName + "-多科-多课时作答表现图";
140 let max = 0; 204 let max = 0;
141 - const dataList = obj.dataList.slice(1, obj.dataList.length)  
142 - let subjectList = dataList.map(item => {  
143 - let score = Number(item.highestScore || item.score)  
144 - max = score > max ? score : max  
145 - return item.subjectName  
146 - })  
147 - max += 10  
148 - max = max > 150 ? 150 : max 205 + const dataList = obj.dataList.slice(1, obj.dataList.length);
  206 + let subjectList = dataList.map((item) => {
  207 + let score = Number(item.highestScore || item.score);
  208 + max = score > max ? score : max;
  209 + return item.subjectName;
  210 + });
  211 + max += 10;
  212 + max = max > 150 ? 150 : max;
149 this.chartData = { 213 this.chartData = {
150 indicator: [ 214 indicator: [
151 { 215 {
152 - name: '', max: max, 216 + name: "",
  217 + max: max,
153 axisLabel: { 218 axisLabel: {
154 show: true, 219 show: true,
155 showMaxLabel: true, 220 showMaxLabel: true,
156 }, 221 },
157 }, 222 },
158 ], 223 ],
159 - seriesData: []  
160 - } 224 + seriesData: [],
  225 + };
161 subjectList.map((item, index) => { 226 subjectList.map((item, index) => {
162 if (index < 1) { 227 if (index < 1) {
163 - this.chartData.indicator[index].name = item  
164 - this.chartData.indicator[index].max = max 228 + this.chartData.indicator[index].name = item;
  229 + this.chartData.indicator[index].max = max;
165 } else { 230 } else {
166 - this.chartData.indicator.push({ name: item, max: max }) 231 + this.chartData.indicator.push({ name: item, max: max });
167 } 232 }
168 - }) 233 + });
169 // 为了美观 234 // 为了美观
170 if (this.chartData.indicator.length < 3) { 235 if (this.chartData.indicator.length < 3) {
171 - let num = this.chartData.indicator.length 236 + let num = this.chartData.indicator.length;
172 for (let i = 0; i < 6; i++) { 237 for (let i = 0; i < 6; i++) {
173 if (i >= num) { 238 if (i >= num) {
174 - this.chartData.indicator.push({ name: "", max: max }) 239 + this.chartData.indicator.push({ name: "", max: max });
175 } 240 }
176 } 241 }
177 } 242 }
178 this.chartData.seriesData = [ 243 this.chartData.seriesData = [
179 { 244 {
180 - value: dataList.map(item => item.highestScore),  
181 - name: '班级最高分' 245 + value: dataList.map((item) => item.highestScore),
  246 + name: "班级最高分",
182 }, 247 },
183 { 248 {
184 - value: dataList.map(item => item.avgScore),  
185 - name: '班平均分' 249 + value: dataList.map((item) => item.avgScore),
  250 + name: "班平均分",
186 }, 251 },
187 { 252 {
188 - value: dataList.map(item => item.score),  
189 - name: '本人得分' 253 + value: dataList.map((item) => item.score),
  254 + name: "本人得分",
190 }, 255 },
191 - ]  
192 - this.chartDia = true  
193 -  
194 - 256 + ];
  257 + this.chartDia = true;
195 }, 258 },
196 async phaseExamReport() { 259 async phaseExamReport() {
197 this.loading = true; 260 this.loading = true;
@@ -222,7 +285,7 @@ export default { @@ -222,7 +285,7 @@ export default {
222 }; 285 };
223 }); 286 });
224 this.answerList = [...subjectName]; 287 this.answerList = [...subjectName];
225 - this.exportStudent = [...this.tableData] 288 + this.exportStudent = [...this.tableData];
226 } else { 289 } else {
227 this.$message.error(info); 290 this.$message.error(info);
228 } 291 }
@@ -237,21 +300,20 @@ export default { @@ -237,21 +300,20 @@ export default {
237 async exportData(arr) { 300 async exportData(arr) {
238 if (this.exportLoading == true) return; 301 if (this.exportLoading == true) return;
239 this.exportLoading = true; 302 this.exportLoading = true;
240 - let studentIds = arr 303 + let studentIds = arr;
241 let query = {}; 304 let query = {};
242 - if(studentIds != null){ 305 + if (studentIds != null) {
243 if (studentIds.length > 0) { 306 if (studentIds.length > 0) {
244 - query.studentIds = studentIds 307 + query.studentIds = studentIds;
245 } else { 308 } else {
246 - query.studentIds = [] 309 + query.studentIds = [];
247 } 310 }
248 } 311 }
249 312
250 -  
251 const data = await this.$request.cTExportPhaseExamReport({ 313 const data = await this.$request.cTExportPhaseExamReport({
252 classId: this.classId, 314 classId: this.classId,
253 examIds: this.ids, 315 examIds: this.ids,
254 - ...query 316 + ...query,
255 }); 317 });
256 this.exportLoading = false; 318 this.exportLoading = false;
257 if (data) { 319 if (data) {
@@ -265,12 +327,12 @@ export default { @@ -265,12 +327,12 @@ export default {
265 blob 327 blob
266 ); 328 );
267 this.$message.success("下载成功"); 329 this.$message.success("下载成功");
268 - this.cancel() 330 + this.cancel();
269 } else { 331 } else {
270 this.$message.error("下载失败"); 332 this.$message.error("下载失败");
271 } 333 }
272 }, 334 },
273 - } 335 + },
274 }; 336 };
275 </script> 337 </script>
276 <style lang="scss" scoped> 338 <style lang="scss" scoped>
src/views/basic/test/components/scoreSet.vue
@@ -178,36 +178,44 @@ export default { @@ -178,36 +178,44 @@ export default {
178 if (status === 0) { 178 if (status === 0) {
179 let studentList = data.students || []; 179 let studentList = data.students || [];
180 this.questionList = data?.questionList || []; 180 this.questionList = data?.questionList || [];
  181 + if (this.questionList.length == 0) {
  182 + this.questionList = Object.keys(studentList[0].scoreMap).map(
  183 + (item) => {
  184 + return {
  185 + questionId: item,
  186 + questionScore: 20,
  187 + };
  188 + }
  189 + );
  190 + }
181 this.tableData = 191 this.tableData =
182 - (this.questionList.length &&  
183 - studentList.map((item) => {  
184 - item.all = item.all || 0; //总分  
185 - item.object = item.object || 0; //客观题分数  
186 - item.subject = item.subject || 0; //主观题分数  
187 - if (!item.scoreMap) item.scoreMap = {};  
188 - this.questionList.map((question) => {  
189 - let keys = question.questionId;  
190 - if (!item.scoreMap[keys]) {  
191 - if (item.scoreMap[keys] == 0) {  
192 - item.scoreMap[keys] = 0;  
193 - } else {  
194 - item.scoreMap[keys] = "";  
195 - } 192 + studentList.map((item) => {
  193 + item.all = item.all || 0; //总分
  194 + item.object = item.object || 0; //客观题分数
  195 + item.subject = item.subject || 0; //主观题分数
  196 + if (!item.scoreMap) item.scoreMap = {};
  197 + this.questionList.map((question) => {
  198 + let keys = question.questionId;
  199 + if (!item.scoreMap[keys]) {
  200 + if (item.scoreMap[keys] == 0) {
  201 + item.scoreMap[keys] = 0;
196 } else { 202 } else {
197 - let num = Number(item.scoreMap[keys]);  
198 - item.scoreMap[keys] = num;  
199 - // item.score += num  
200 - // if (question.questionType == 5) {  
201 - // item.subjectiveScore += num  
202 - // } else {  
203 - // item.objectiveScore += num  
204 - // } 203 + item.scoreMap[keys] = "";
205 } 204 }
206 - }); 205 + } else {
  206 + let num = Number(item.scoreMap[keys]);
  207 + item.scoreMap[keys] = num;
  208 + // item.score += num
  209 + // if (question.questionType == 5) {
  210 + // item.subjectiveScore += num
  211 + // } else {
  212 + // item.objectiveScore += num
  213 + // }
  214 + }
  215 + });
207 216
208 - return item;  
209 - })) ||  
210 - []; 217 + return item;
  218 + }) || [];
211 this.setTableHeight(); 219 this.setTableHeight();
212 } else { 220 } else {
213 this.$message.error(info); 221 this.$message.error(info);
src/views/examinationPaper/add.vue
@@ -2022,9 +2022,9 @@ export default { @@ -2022,9 +2022,9 @@ export default {
2022 id: item.tagId, 2022 id: item.tagId,
2023 }; 2023 };
2024 }) || []; 2024 }) || [];
2025 - if (this.type != 2) {  
2026 - this.form.tagId = this.answerTypeList[0]?.id || "";  
2027 - } 2025 + // if (this.type != 2) {
  2026 + // this.form.tagId = this.answerTypeList[0]?.id || "";
  2027 + // }
2028 } else { 2028 } else {
2029 this.$message.error(info); 2029 this.$message.error(info);
2030 } 2030 }