Blame view

src/views/basic/ask/analysis.vue 12 KB
4c4f7640   梁保满   路由表,路由前端文件
1
  <template>
b769660c   梁保满   备课组题细节调整,随堂问列表页面开发完成
2
3
4
    <div>
      <back-box>
        <template slot="title">
049db2b2   梁保满   接口联调
5
          <span>{{
696f2d42   梁保满   fix:报表导出问题
6
7
8
9
10
11
            types == 1
              ? "单课分析"
              : types == 2
              ? `${className}-${subjectNames[0]}汇总分析`
              : `${className}-多科汇总分析`
          }}</span>
b769660c   梁保满   备课组题细节调整,随堂问列表页面开发完成
12
13
        </template>
      </back-box>
ee6e7628   梁保满   备题组卷借口数据对接调整
14
15
      <div class="page-content">
        <div class="tab-box">
696f2d42   梁保满   fix:报表导出问题
16
17
18
19
20
21
22
23
          <span
            class="tab-item"
            v-for="(item, index) in tabList"
            :key="index"
            :class="type == item.value ? 'active' : ''"
            @click="setType(item.value)"
            >{{ item.name }}</span
          >
ee6e7628   梁保满   备题组卷借口数据对接调整
24
        </div>
9309dc5d   梁保满   任课老师接口完成
25
        <div v-loading="loading">
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
26
          <div id="print-content">
d01c5799   梁保满   随堂问 报表开发
27
            <!-- 学生答题情况 -->
049db2b2   梁保满   接口联调
28
            <Detail v-if="type == 1" :types="types" :detail="detail" :id="id" />
d01c5799   梁保满   随堂问 报表开发
29
30
31
            <!-- 学生答题情况 -->
            <Example v-if="type == 1" :types="types" :tableData="tableData" />
            <!-- 学生问答 -->
696f2d42   梁保满   fix:报表导出问题
32
33
34
35
36
37
            <AnswerQustion
              v-if="type == 2"
              :types="types"
              :tableData="tableData"
              :subjectNames="subjectNames"
            />
d01c5799   梁保满   随堂问 报表开发
38
39
40
41
            <!-- 学生互动表现 -->
            <Interact v-if="type == 3" :types="types" :tableData="tableData" />
            <!-- 签到明细 -->
            <Report v-if="type == 4" :tableData="tableData" />
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
42
          </div>
9309dc5d   梁保满   任课老师接口完成
43
          <div class="pagination-box" v-show="type == 1">
696f2d42   梁保满   fix:报表导出问题
44
45
46
47
48
49
50
51
52
            <el-pagination
              small=""
              layout="total,prev, pager, next"
              :hide-on-single-page="true"
              :total="total"
              @current-change="changePage"
              :current-page="page"
              :page-size="size"
            >
9309dc5d   梁保满   任课老师接口完成
53
54
55
            </el-pagination>
          </div>
          <p class="down">
696f2d42   梁保满   fix:报表导出问题
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
            <el-button
              v-if="types == 1"
              @click="exportData"
              type="primary"
              plain
              round
              icon="fa fa-cloud-download"
              >导出报表</el-button
            >
            <el-button
              v-else
              @click="openDown"
              type="primary"
              plain
              round
              icon="fa fa-cloud-download"
              >导出报表</el-button
            >
            <el-button
              v-if="!this.$store.getters.code"
              @click="print"
              type="primary"
              plain
              round
              icon="el-icon-printer"
              >打印</el-button
            >
9309dc5d   梁保满   任课老师接口完成
83
84
          </p>
        </div>
696f2d42   梁保满   fix:报表导出问题
85
86
87
88
89
90
91
        <ExportDia
          :exportStudent="exportStudent"
          :diaShow="diaShow"
          @cancel="cancel"
          @exportData="exportData"
          :type="types == 3 ? '雷达图' : '折线图'"
        />
b769660c   梁保满   备课组题细节调整,随堂问列表页面开发完成
92
      </div>
b769660c   梁保满   备课组题细节调整,随堂问列表页面开发完成
93
    </div>
4c4f7640   梁保满   路由表,路由前端文件
94
95
96
  </template>
  
  <script>
3617eaad   梁保满   长水账号设置
97
  import { downloadFile, tablePrint } from "@/utils";
696f2d42   梁保满   fix:报表导出问题
98
99
100
101
102
  import Detail from "./components/detail.vue";
  import Example from "./components/example.vue";
  import AnswerQustion from "./components/answerQustion.vue";
  import Interact from "./components/interact.vue";
  import Report from "./components/report.vue";
ee6e7628   梁保满   备题组卷借口数据对接调整
103
  export default {
d01c5799   梁保满   随堂问 报表开发
104
    components: {
696f2d42   梁保满   fix:报表导出问题
105
106
107
108
109
      Detail,
      Example,
      AnswerQustion,
      Interact,
      Report,
d01c5799   梁保满   随堂问 报表开发
110
    },
ee6e7628   梁保满   备题组卷借口数据对接调整
111
112
    data() {
      return {
d01c5799   梁保满   随堂问 报表开发
113
        role: "",
9309dc5d   梁保满   任课老师接口完成
114
        loading: false,
22095aba   梁保满   接口联调
115
        classId: "",
049db2b2   梁保满   接口联调
116
        className: "",
22095aba   梁保满   接口联调
117
        subjectNames: "",
d01c5799   梁保满   随堂问 报表开发
118
        id: [],
ee6e7628   梁保满   备题组卷借口数据对接调整
119
        type: 1,
d01c5799   梁保满   随堂问 报表开发
120
        tabList: [],
9309dc5d   梁保满   任课老师接口完成
121
122
        detail: {},
        tableData: [],
9309dc5d   梁保满   任课老师接口完成
123
124
125
        page: 1,
        size: 20,
        total: 0,
e5e4a3e6   梁保满   v1.3
126
        status: 0,
e17ec739   梁保满   随堂问,即时测导出爆表修改
127
128
        //导出相关
        diaShow: false,
9865dde4   梁保满   数据同步
129
        exportStudent: [],
ee6e7628   梁保满   备题组卷借口数据对接调整
130
131
132
      };
    },
    created() {
d01c5799   梁保满   随堂问 报表开发
133
134
135
      this.role =
        this.$store.getters.info.showRole ||
        this.$store.getters.info.permissions[0].role;
696f2d42   梁保满   fix:报表导出问题
136
137
138
139
140
141
      this.types = Number(this.$route.query.types);
      this.className = this.$route.query.className;
      const queryData = JSON.parse(this.$route.query.params);
      this.classId = queryData.classId;
      console.log(this.$route.query);
      this.subjectNames = this.$route.query.subjectNames.split(",");
d01c5799   梁保满   随堂问 报表开发
142
      if (this.types == 1) {
696f2d42   梁保满   fix:报表导出问题
143
144
145
146
147
148
        this.tabList = [
          { name: "答题表现", value: 1 },
          { name: "学生问答表现", value: 2 },
          { name: "学生互动表现", value: 3 },
          { name: "签到明细", value: 4 },
        ];
d01c5799   梁保满   随堂问 报表开发
149
      } else if (this.types == 2) {
696f2d42   梁保满   fix:报表导出问题
150
151
152
153
154
        this.tabList = [
          { name: "答题表现", value: 1 },
          { name: "学生问答表现", value: 2 },
          { name: "学生互动表现", value: 3 },
        ];
d01c5799   梁保满   随堂问 报表开发
155
156
157
      } else if (this.types == 3) {
        this.tabList = [
          { name: "学生问答表现", value: 2 },
696f2d42   梁保满   fix:报表导出问题
158
159
          { name: "学生互动表现", value: 3 },
        ];
d01c5799   梁保满   随堂问 报表开发
160
      }
696f2d42   梁保满   fix:报表导出问题
161
162
      this.type = this.tabList[0].value;
      this.id = JSON.parse(this.$route.query.id);
e5e4a3e6   梁保满   v1.3
163
      this.status = this.$route.query.status ? this.$route.query.status : 0;
9309dc5d   梁保满   任课老师接口完成
164
      this._QueryData();
696f2d42   梁保满   fix:报表导出问题
165
166
      this.types != 1 ? this._QueryDataQuestionRank() : "";
      this.types != 3 ? this.periodDetail() : "";
ee6e7628   梁保满   备题组卷借口数据对接调整
167
168
    },
    methods: {
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
169
      print() {
c410e3c4   梁保满   init
170
171
172
173
174
175
        let name = "";
        this.tabList.map((item) => {
          if (item.value == this.type) {
            name = item.name;
          }
        });
e5e4a3e6   梁保满   v1.3
176
177
        tablePrint(
          "print-content",
c410e3c4   梁保满   init
178
          (this.detail.title || this.subjectNames.join()) + "_" + name
e5e4a3e6   梁保满   v1.3
179
        );
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
180
      },
9309dc5d   梁保满   任课老师接口完成
181
182
183
184
      setType(type) {
        this.type = type;
        this.page = 1;
        this._QueryData();
9309dc5d   梁保满   任课老师接口完成
185
      },
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
186
187
188
189
      setDuration(times) {
        let m = parseInt(times / 1000 / 60);
        let s = parseInt((times / 1000) % 60);
        let ms = times;
503b6063   梁保满   判断题答案选项
190
        let aTime;
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
191
192
193
194
195
196
197
198
199
        if (times == 0) {
          aTime = `0`;
        } else {
          if (m == 0 && s == 0) {
            aTime = `${ms}毫秒`;
          } else if (m == 0 && s != 0) {
            aTime = `${s}秒`;
          } else if (m != 0 && s != 0) {
            aTime = `${m}分${s}秒`;
503b6063   梁保满   判断题答案选项
200
201
          }
        }
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
202
        return aTime;
d32e461c   梁保满   备题组卷
203
      },
9309dc5d   梁保满   任课老师接口完成
204
205
206
207
208
      changePage(page) {
        this.page = page;
        this._QueryData();
      },
      async periodDetail() {
696f2d42   梁保满   fix:报表导出问题
209
210
211
212
        const periodDetail =
          this.role == "ROLE_PERSONAL"
            ? this.$request.pPeriodDetail
            : this.$request.periodDetail;
d01c5799   梁保满   随堂问 报表开发
213
        let { data, info, status } = await periodDetail({
22095aba   梁保满   接口联调
214
          periodIds: this.id,
9309dc5d   梁保满   任课老师接口完成
215
216
217
        });
        if (status == 0) {
          this.detail = { ...data };
255e2506   梁保满   飞书bug及优化
218
219
220
221
222
223
          this.detail.duration = this.detail.duration
            ? (this.detail.duration / 60).toFixed(2)
            : 0;
          this.detail.consumingDuration = this.detail.consumingDuration
            ? (this.detail.consumingDuration / 60).toFixed(2)
            : 0;
9309dc5d   梁保满   任课老师接口完成
224
225
226
227
        } else {
          this.$message.error(info);
        }
      },
ee6e7628   梁保满   备题组卷借口数据对接调整
228
      async _QueryData() {
d01c5799   梁保满   随堂问 报表开发
229
        let queryData;
9309dc5d   梁保满   任课老师接口完成
230
        let query = {};
d01c5799   梁保满   随堂问 报表开发
231
232
        if (this.role == "ROLE_PERSONAL") {
          if (this.types == 1) {
696f2d42   梁保满   fix:报表导出问题
233
234
235
236
237
238
239
240
241
242
243
244
245
            query.page = this.page;
            query.size = this.size;
            queryData =
              this.type == 1
                ? this.$request.pPeriodQuestionReport
                : this.$request.pPeriodStudentReport;
          } else if (this.types == 2) {
            queryData =
              this.type == 1
                ? this.$request.pPeriodQuestionReport
                : this.type == 2
                ? this.$request.phaseAnswerReport
                : this.$request.phaseInteractiveReport;
d01c5799   梁保满   随堂问 报表开发
246
          } else if (this.types == 3) {
696f2d42   梁保满   fix:报表导出问题
247
248
249
250
            queryData =
              this.type == 2
                ? this.$request.pPhaseAnswerReport
                : this.$request.pPhaseInteractiveReport;
d01c5799   梁保满   随堂问 报表开发
251
252
253
          }
        } else {
          if (this.types == 1) {
696f2d42   梁保满   fix:报表导出问题
254
255
256
257
258
259
            query.page = this.page;
            query.size = this.size;
            queryData =
              this.type == 1
                ? this.$request.periodQuestionReport
                : this.$request.periodStudentReport;
d01c5799   梁保满   随堂问 报表开发
260
          } else if (this.types == 2) {
696f2d42   梁保满   fix:报表导出问题
261
262
263
264
265
266
            queryData =
              this.type == 1
                ? this.$request.periodQuestionReport
                : this.type == 2
                ? this.$request.phaseAnswerReport
                : this.$request.phaseInteractiveReport;
d01c5799   梁保满   随堂问 报表开发
267
          } else if (this.types == 3) {
696f2d42   梁保满   fix:报表导出问题
268
269
270
271
            queryData =
              this.type == 2
                ? this.$request.cTPhaseAnswerReport
                : this.$request.cTPhaseInteractiveReport;
d01c5799   梁保满   随堂问 报表开发
272
273
          }
        }
d01c5799   梁保满   随堂问 报表开发
274
        if (this.types == 1) {
696f2d42   梁保满   fix:报表导出问题
275
276
          query.periodId = this.id[0];
          query.type = this.type - 1;
049db2b2   梁保满   接口联调
277
        } else {
696f2d42   梁保满   fix:报表导出问题
278
          query.periodIds = this.id;
049db2b2   梁保满   接口联调
279
          if (this.types == 3) {
696f2d42   梁保满   fix:报表导出问题
280
            query.subjectNames = this.subjectNames;
049db2b2   梁保满   接口联调
281
          }
9309dc5d   梁保满   任课老师接口完成
282
283
284
        }
        this.loading = true;
        let { data, info, status } = await queryData({
22095aba   梁保满   接口联调
285
          classId: this.classId,
9309dc5d   梁保满   任课老师接口完成
286
          ...query,
ee6e7628   梁保满   备题组卷借口数据对接调整
287
        });
9309dc5d   梁保满   任课老师接口完成
288
289
        this.loading = false;
        if (status === 0) {
696f2d42   梁保满   fix:报表导出问题
290
          this.tableData = data?.list || [];
9309dc5d   梁保满   任课老师接口完成
291
292
293
294
295
          this.total = data.count;
        } else {
          this.$message.error(info);
        }
      },
d01c5799   梁保满   随堂问 报表开发
296
297
      async _QueryDataQuestionRank() {
        let queryData;
22095aba   梁保满   接口联调
298
        let query = {};
696f2d42   梁保满   fix:报表导出问题
299
300
301
302
303
304
305
  
        query.periodIds = this.id;
        if (this.types == 2) {
          queryData = this.$request.phaseAnswerReport;
        } else if (this.types == 3) {
          queryData = this.$request.cTPhaseAnswerReport;
        }
22095aba   梁保满   接口联调
306
        if (this.types != 1) {
696f2d42   梁保满   fix:报表导出问题
307
          query.classId = this.classId;
d01c5799   梁保满   随堂问 报表开发
308
309
310
        }
        this.loading = true;
        let { data, info, status } = await queryData({
d01c5799   梁保满   随堂问 报表开发
311
312
313
314
          onlyRate: true,
          ...query,
        });
        this.loading = false;
696f2d42   梁保满   fix:报表导出问题
315
        console.log(data);
d01c5799   梁保满   随堂问 报表开发
316
        if (status === 0) {
696f2d42   梁保满   fix:报表导出问题
317
          this.exportStudent = (data?.list && [...data?.list]) || [];
d01c5799   梁保满   随堂问 报表开发
318
319
320
321
322
        } else {
          this.$message.error(info);
        }
      },
  
696f2d42   梁保满   fix:报表导出问题
323
      //导出
d01c5799   梁保满   随堂问 报表开发
324
      openDown() {
e17ec739   梁保满   随堂问,即时测导出爆表修改
325
        this.diaShow = true;
d01c5799   梁保满   随堂问 报表开发
326
327
      },
      cancel() {
e17ec739   梁保满   随堂问,即时测导出爆表修改
328
        this.diaShow = false;
d01c5799   梁保满   随堂问 报表开发
329
      },
e17ec739   梁保满   随堂问,即时测导出爆表修改
330
      async exportData(arr) {
255e2506   梁保满   飞书bug及优化
331
        if (this.exportLoading == true) return;
9309dc5d   梁保满   任课老师接口完成
332
        this.exportLoading = true;
696f2d42   梁保满   fix:报表导出问题
333
        let studentIds = arr;
9865dde4   梁保满   数据同步
334
        let query = {};
696f2d42   梁保满   fix:报表导出问题
335
        if (studentIds != null) {
ce278878   梁保满   2-2 bugfix
336
          if (studentIds.length > 0) {
696f2d42   梁保满   fix:报表导出问题
337
            query.studentIds = studentIds;
ce278878   梁保满   2-2 bugfix
338
          } else {
696f2d42   梁保满   fix:报表导出问题
339
            query.studentIds = [];
ce278878   梁保满   2-2 bugfix
340
          }
9865dde4   梁保满   数据同步
341
        }
696f2d42   梁保满   fix:报表导出问题
342
        let exportPeriodReport = "";
ce278878   梁保满   2-2 bugfix
343
        if (this.types == 1) {
696f2d42   梁保满   fix:报表导出问题
344
345
346
347
348
349
350
351
352
353
354
355
356
357
          query.periodId = this.id[0];
          exportPeriodReport =
            this.role == "ROLE_PERSONAL"
              ? this.$request.pExportPeriodReport
              : this.$request.exportPeriodReport;
        } else if (this.types == 2) {
          query.periodIds = this.id;
          exportPeriodReport =
            this.role == "ROLE_PERSONAL"
              ? this.$request.pExportPhaseAnswerReport
              : this.$request.exportPhaseAnswerReport;
        } else {
          query.periodIds = this.id;
          exportPeriodReport = this.$request.cTExportPhaseAnswerReport;
049db2b2   梁保满   接口联调
358
359
360
        }
        const data = await exportPeriodReport({
          classId: this.classId,
696f2d42   梁保满   fix:报表导出问题
361
          ...query,
255e2506   梁保满   飞书bug及优化
362
        });
9309dc5d   梁保满   任课老师接口完成
363
364
        this.exportLoading = false;
        if (data) {
696f2d42   梁保满   fix:报表导出问题
365
          this.cancel();
255e2506   梁保满   飞书bug及优化
366
367
368
          let blob = new Blob([data], {
            type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
          });
696f2d42   梁保满   fix:报表导出问题
369
370
371
372
373
374
          let name =
            this.types == 1
              ? "随堂问-单课时报表.xlsx"
              : this.types == 2
              ? `随堂问-${this.className}-${this.subjectNames[0]}汇总分析报表.xlsx`
              : `随堂问-${this.className}-多科汇总分析报表.xlsx`;
f9916d4c   梁保满   导出摸板
375
          downloadFile(this.status ? "随堂问-已归档单课时报表.xlsx" : name, blob);
9309dc5d   梁保满   任课老师接口完成
376
        } else {
236b1f0e   梁保满   周末-飞书bug
377
          this.$message.error("下载失败");
9309dc5d   梁保满   任课老师接口完成
378
        }
ee6e7628   梁保满   备题组卷借口数据对接调整
379
380
381
      },
    },
  };
4c4f7640   梁保满   路由表,路由前端文件
382
  </script>
dbbfc6c5   梁保满   飞书优化及bug
383
384
385
386
387
  <style>
  div::-webkit-scrollbar {
    width: 3px;
    height: 10px;
  }
d01c5799   梁保满   随堂问 报表开发
388
  
dbbfc6c5   梁保满   飞书优化及bug
389
390
391
392
393
  div::-webkit-scrollbar-thumb {
    border-radius: 10px;
    background-color: #ccc;
  }
  </style>
b769660c   梁保满   备课组题细节调整,随堂问列表页面开发完成
394
  <style lang="scss" scoped>
9309dc5d   梁保满   任课老师接口完成
395
396
397
398
399
400
  .down {
    padding-top: 20px;
    width: 100%;
    display: flex;
    justify-content: space-between;
  }
d01c5799   梁保满   随堂问 报表开发
401
  
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
402
403
404
  .red {
    color: #f30;
  }
d01c5799   梁保满   随堂问 报表开发
405
  
ee6e7628   梁保满   备题组卷借口数据对接调整
406
407
408
  .page-content {
    padding: 20px 20px 0;
  }
d01c5799   梁保满   随堂问 报表开发
409
  
b769660c   梁保满   备课组题细节调整,随堂问列表页面开发完成
410
411
  .tab-box {
    width: 800px;
ee6e7628   梁保满   备题组卷借口数据对接调整
412
    margin: 0 auto 12px;
b769660c   梁保满   备课组题细节调整,随堂问列表页面开发完成
413
414
415
    background: #f8f8f8;
    border-radius: 20px;
    display: flex;
d01c5799   梁保满   随堂问 报表开发
416
  
b769660c   梁保满   备课组题细节调整,随堂问列表页面开发完成
417
418
419
420
421
422
423
424
425
426
    .tab-item {
      flex: 1;
      height: 40px;
      line-height: 40px;
      text-align: center;
      font-size: 16px;
      color: #666;
      font-weight: 500;
      background: transparent;
      border-radius: 20px;
ee6e7628   梁保满   备题组卷借口数据对接调整
427
      cursor: pointer;
d01c5799   梁保满   随堂问 报表开发
428
  
b769660c   梁保满   备课组题细节调整,随堂问列表页面开发完成
429
430
431
432
433
434
      &.active {
        background: #667ffd;
        color: #fff;
      }
    }
  }
d01c5799   梁保满   随堂问 报表开发
435
  
9865dde4   梁保满   数据同步
436
437
438
439
  :deep(.el-dialog__body) {
    padding-top: 0;
  }
  
d01c5799   梁保满   随堂问 报表开发
440
  .el-dialog {
d01c5799   梁保满   随堂问 报表开发
441
442
443
444
445
446
447
448
    .down-item {
      font-size: 15px;
      margin-bottom: 10px;
  
      .tit {
        line-height: 18px;
        padding: 10px 0;
      }
ee6e7628   梁保满   备题组卷借口数据对接调整
449
    }
9865dde4   梁保满   数据同步
450
451
452
453
454
455
  
    .export-tit {
      text-align: center;
      font-size: 16px;
      padding-bottom: 10px;
    }
ee6e7628   梁保满   备题组卷借口数据对接调整
456
  }
d01c5799   梁保满   随堂问 报表开发
457
458
459
460
  
  .dialog-footer {
    text-align: center;
  }
4c4f7640   梁保满   路由表,路由前端文件
461
  </style>