Blame view

src/views/basic/ask/analysis.vue 12.5 KB
4c4f7640   梁保满   路由表,路由前端文件
1
  <template>
b769660c   梁保满   备课组题细节调整,随堂问列表页面开发完成
2
3
4
5
6
7
    <div>
      <back-box>
        <template slot="title">
          <span>单课分析</span>
        </template>
      </back-box>
ee6e7628   梁保满   备题组卷借口数据对接调整
8
9
      <div class="page-content">
        <div class="tab-box">
d01c5799   梁保满   随堂问 报表开发
10
11
          <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   梁保满   备题组卷借口数据对接调整
12
        </div>
9309dc5d   梁保满   任课老师接口完成
13
        <div v-loading="loading">
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
14
          <div id="print-content">
d01c5799   梁保满   随堂问 报表开发
15
16
17
18
19
20
21
22
23
24
25
  
            <!-- 学生答题情况 -->
            <Detail v-if="type == 1" :types="types" :detail="detail" />
            <!-- 学生答题情况 -->
            <Example v-if="type == 1" :types="types" :tableData="tableData" />
            <!-- 学生问答 -->
            <AnswerQustion v-if="type == 2" :types="types" :tableData="tableData" />
            <!-- 学生互动表现 -->
            <Interact v-if="type == 3" :types="types" :tableData="tableData" />
            <!-- 签到明细 -->
            <Report v-if="type == 4" :tableData="tableData" />
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
26
          </div>
9309dc5d   梁保满   任课老师接口完成
27
          <div class="pagination-box" v-show="type == 1">
d01c5799   梁保满   随堂问 报表开发
28
29
            <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   梁保满   任课老师接口完成
30
31
32
            </el-pagination>
          </div>
          <p class="down">
d01c5799   梁保满   随堂问 报表开发
33
34
35
            <el-button @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   梁保满   任课老师接口完成
36
37
          </p>
        </div>
d01c5799   梁保满   随堂问 报表开发
38
39
40
41
42
43
44
45
46
        <el-dialog :close-on-click-modal="false" :visible.sync="diaDown" width="360px">
          <div v-show="exportType == 1">
            <div class="down-item">
              <p class="tit">是否将学生表现折线图一起导出</p>
              <el-radio-group v-model="downType" @change="changeDownType">
                <el-radio :label="1">不导出</el-radio>
                <el-radio :label="2">导出</el-radio>
              </el-radio-group>
            </div>
9865dde4   梁保满   数据同步
47
            <div class="down-item" v-show="downType == 2">
d01c5799   梁保满   随堂问 报表开发
48
49
50
51
52
53
54
55
              <p class="tit">选择要导出的学生</p>
              <el-radio-group v-model="exportType">
                <el-radio :label="1">导出全部</el-radio>
                <el-radio :label="2">导出制定学生</el-radio>
              </el-radio-group>
            </div>
          </div>
          <ul v-show="exportType == 2">
9865dde4   梁保满   数据同步
56
57
58
59
60
61
62
63
            <p class="export-tit">选择学生</p>
            <el-table :data="exportStudent" @selection-change="handleSelectionChange" :max-height="300">
              <el-table-column type="selection"></el-table-column>
              <el-table-column prop="studentName" label="姓名" align="center"></el-table-column>
              <el-table-column prop="classRank" label="班名" align="center"></el-table-column>
              <el-table-column prop="correctRate" label="总正确率" align="center"><template slot-scope="scoped">{{
                scoped.row.correctRate }}%</template></el-table-column>
            </el-table>
d01c5799   梁保满   随堂问 报表开发
64
65
          </ul>
          <div class="dialog-footer" slot="footer">
9865dde4   梁保满   数据同步
66
67
            <el-button v-show="downType == 2" size="small" type="primary" round @click="exportData(10)">导出前十</el-button>
            <el-button size="small" type="primary" round @click="exportData(0)">确 定</el-button>
d01c5799   梁保满   随堂问 报表开发
68
69
70
            <el-button size="small" type="danger" round @click="cancel">取 消</el-button>
          </div>
        </el-dialog>
b769660c   梁保满   备课组题细节调整,随堂问列表页面开发完成
71
      </div>
b769660c   梁保满   备课组题细节调整,随堂问列表页面开发完成
72
    </div>
4c4f7640   梁保满   路由表,路由前端文件
73
74
75
  </template>
  
  <script>
3617eaad   梁保满   长水账号设置
76
  import { downloadFile, tablePrint } from "@/utils";
d01c5799   梁保满   随堂问 报表开发
77
78
79
80
81
  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   梁保满   备题组卷借口数据对接调整
82
  export default {
d01c5799   梁保满   随堂问 报表开发
83
84
85
    components: {
      Detail, Example, AnswerQustion, Interact, Report
    },
ee6e7628   梁保满   备题组卷借口数据对接调整
86
87
    data() {
      return {
d01c5799   梁保满   随堂问 报表开发
88
        role: "",
9309dc5d   梁保满   任课老师接口完成
89
        loading: false,
d01c5799   梁保满   随堂问 报表开发
90
        id: [],
ee6e7628   梁保满   备题组卷借口数据对接调整
91
        type: 1,
d01c5799   梁保满   随堂问 报表开发
92
        tabList: [],
9309dc5d   梁保满   任课老师接口完成
93
94
        detail: {},
        tableData: [],
9309dc5d   梁保满   任课老师接口完成
95
96
97
        page: 1,
        size: 20,
        total: 0,
e5e4a3e6   梁保满   v1.3
98
        status: 0,
d01c5799   梁保满   随堂问 报表开发
99
100
101
        diaDown: false,
        downType: 1,
        exportType: 1,
9865dde4   梁保满   数据同步
102
103
        exportStudent: [],
        multipleSelection: [],
ee6e7628   梁保满   备题组卷借口数据对接调整
104
105
106
      };
    },
    created() {
d01c5799   梁保满   随堂问 报表开发
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
      this.role =
        this.$store.getters.info.showRole ||
        this.$store.getters.info.permissions[0].role;
      this.types = Number(this.$route.query.types)
      if (this.types == 1) {
        this.tabList = [{ name: "答题表现", value: 1 },
        { name: "学生问答表现", value: 2 },
        { name: "学生互动表现", value: 3 },
        { name: "签到明细", value: 4 },]
      } else if (this.types == 2) {
        this.tabList = [{ name: "答题表现", value: 1 },
        { name: "学生问答表现", value: 2 },
        { name: "学生互动表现", value: 3 }]
      } else if (this.types == 3) {
        this.tabList = [
          { name: "学生问答表现", value: 2 },
          { name: "学生互动表现", value: 3 }]
      }
      this.id = JSON.parse(this.$route.query.id)
e5e4a3e6   梁保满   v1.3
126
      this.status = this.$route.query.status ? this.$route.query.status : 0;
9309dc5d   梁保满   任课老师接口完成
127
      this._QueryData();
9865dde4   梁保满   数据同步
128
      this._QueryDataQuestionRank();
d01c5799   梁保满   随堂问 报表开发
129
      this.types != 3 ? this.periodDetail() : '';
ee6e7628   梁保满   备题组卷借口数据对接调整
130
131
    },
    methods: {
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
132
      print() {
e5e4a3e6   梁保满   v1.3
133
134
135
136
        tablePrint(
          "print-content",
          this.detail.title + "_" + this.tabList[this.type - 1]
        );
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
137
      },
9309dc5d   梁保满   任课老师接口完成
138
139
140
141
      setType(type) {
        this.type = type;
        this.page = 1;
        this._QueryData();
d01c5799   梁保满   随堂问 报表开发
142
        this._QueryDataQuestionRank()
9309dc5d   梁保满   任课老师接口完成
143
      },
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
144
145
146
147
      setDuration(times) {
        let m = parseInt(times / 1000 / 60);
        let s = parseInt((times / 1000) % 60);
        let ms = times;
503b6063   梁保满   判断题答案选项
148
        let aTime;
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
149
150
151
152
153
154
155
156
157
        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   梁保满   判断题答案选项
158
159
          }
        }
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
160
        return aTime;
d32e461c   梁保满   备题组卷
161
      },
9309dc5d   梁保满   任课老师接口完成
162
163
164
165
166
      changePage(page) {
        this.page = page;
        this._QueryData();
      },
      async periodDetail() {
d01c5799   梁保满   随堂问 报表开发
167
168
169
170
171
        const periodDetail = this.role == "ROLE_PERSONAL" ?
          this.$request.pPeriodDetail :
          this.$request.periodDetail;
        let { data, info, status } = await periodDetail({
          periodId: this.id[0],
9309dc5d   梁保满   任课老师接口完成
172
173
174
        });
        if (status == 0) {
          this.detail = { ...data };
255e2506   梁保满   飞书bug及优化
175
176
177
178
179
180
          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   梁保满   任课老师接口完成
181
182
183
184
        } else {
          this.$message.error(info);
        }
      },
ee6e7628   梁保满   备题组卷借口数据对接调整
185
      async _QueryData() {
d01c5799   梁保满   随堂问 报表开发
186
        let queryData;
9309dc5d   梁保满   任课老师接口完成
187
        let query = {};
d01c5799   梁保满   随堂问 报表开发
188
189
190
191
192
193
194
195
196
197
198
199
200
        if (this.role == "ROLE_PERSONAL") {
          if (this.types == 1) {
            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;
          } else if (this.types == 3) {
9865dde4   梁保满   数据同步
201
            queryData = this.type == 2 ? this.$request.pPhaseAnswerReport : this.$request.pPhaseInteractiveReport;
d01c5799   梁保满   随堂问 报表开发
202
203
204
205
206
207
208
209
210
211
212
213
214
          }
        } else {
          if (this.types == 1) {
            query.page = this.page
            query.size = this.size
            queryData = this.type == 1
              ? this.$request.periodQuestionReport
              : this.$request.periodStudentReport
          } else if (this.types == 2) {
            queryData = this.type == 1
              ? this.$request.periodQuestionReport
              : this.type == 2 ? this.$request.phaseAnswerReport : this.$request.phaseInteractiveReport;
          } else if (this.types == 3) {
9865dde4   梁保满   数据同步
215
            queryData = this.type == 2 ? this.$request.cTPhaseAnswerReport : this.$request.cTPhaseInteractiveReport;
d01c5799   梁保满   随堂问 报表开发
216
217
          }
        }
d01c5799   梁保满   随堂问 报表开发
218
219
        if (this.types == 1) {
          query.type = this.type
9309dc5d   梁保满   任课老师接口完成
220
221
222
        }
        this.loading = true;
        let { data, info, status } = await queryData({
d01c5799   梁保满   随堂问 报表开发
223
224
          // periodId: this.id,
          periodId: this.id[0],
9309dc5d   梁保满   任课老师接口完成
225
          ...query,
ee6e7628   梁保满   备题组卷借口数据对接调整
226
        });
9309dc5d   梁保满   任课老师接口完成
227
228
        this.loading = false;
        if (status === 0) {
255e2506   梁保满   飞书bug及优化
229
          if (this.type == 2) {
d01c5799   梁保满   随堂问 报表开发
230
            this.tableData = data?.list || []
255e2506   梁保满   飞书bug及优化
231
          } else {
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
232
233
            this.tableData = data?.list.sort((a, b) => {
              return a.questionIndex - b.questionIndex;
255e2506   梁保满   飞书bug及优化
234
235
            });
          }
9309dc5d   梁保满   任课老师接口完成
236
237
238
239
240
          this.total = data.count;
        } else {
          this.$message.error(info);
        }
      },
d01c5799   梁保满   随堂问 报表开发
241
242
243
244
      async _QueryDataQuestionRank() {
        let queryData;
        if (this.role == "ROLE_PERSONAL") {
          if (this.types == 1) {
9865dde4   梁保满   数据同步
245
            queryData = this.$request.pPeriodStudentReport
d01c5799   梁保满   随堂问 报表开发
246
247
248
          }
          else if (this.types == 2) {
            queryData = this.type == 1
9865dde4   梁保满   数据同步
249
              ? this.$request.pPeriodStudentReport
d01c5799   梁保满   随堂问 报表开发
250
251
              : this.type == 2 ? this.$request.phaseAnswerReport : this.$request.phaseInteractiveReport;
          } else if (this.types == 3) {
9865dde4   梁保满   数据同步
252
            this.type == 2 ? this.$request.pPhaseAnswerReport : this.$request.pPhaseInteractiveReport;
d01c5799   梁保满   随堂问 报表开发
253
254
255
          }
        } else {
          if (this.types == 1) {
9865dde4   梁保满   数据同步
256
            queryData = this.$request.periodStudentReport
d01c5799   梁保满   随堂问 报表开发
257
258
          } else if (this.types == 2) {
            queryData = this.type == 1
9865dde4   梁保满   数据同步
259
              ? this.$request.periodStudentReport
d01c5799   梁保满   随堂问 报表开发
260
261
              : this.type == 2 ? this.$request.phaseAnswerReport : this.$request.phaseInteractiveReport;
          } else if (this.types == 3) {
9865dde4   梁保满   数据同步
262
            queryData = this.type == 2 ? this.$request.cTPhaseAnswerReport : this.$request.cTPhaseInteractiveReport;
d01c5799   梁保满   随堂问 报表开发
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
          }
        }
  
        let query = {};
        if (this.types == 1) {
          query.type = this.type
        }
        this.loading = true;
        let { data, info, status } = await queryData({
          // periodId: this.id,
          periodId: this.id[0],
          onlyRate: true,
          ...query,
        });
        this.loading = false;
        if (status === 0) {
          this.exportStudent = [...data?.list] || []
        } else {
          this.$message.error(info);
        }
      },
  
  
      openDown() {
        this.diaDown = true;
        this.downType = 1
      },
      cancel() {
        if (this.exportType == 2) {
          this.exportType = 1
        } else {
          this.diaDown = false;
        }
      },
      changeDownType() {
        this.exportType = 1
      },
9865dde4   梁保满   数据同步
300
301
302
303
304
      handleSelectionChange(val) {
        this.multipleSelection = val
      },
      //导出  
      async exportData(length) {
255e2506   梁保满   飞书bug及优化
305
        if (this.exportLoading == true) return;
9309dc5d   梁保满   任课老师接口完成
306
        this.exportLoading = true;
d01c5799   梁保满   随堂问 报表开发
307
        let studentIds = []
9865dde4   梁保满   数据同步
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
        if (length) {
          studentIds = this.exportStudent.slice(0, 10).map(item => {
            return item.studentId
          })
        } else {
          studentIds = this.multipleSelection.map(item => {
            return item.studentId
          })
        }
        let query = {};
        if (studentIds.length == this.exportStudent.length) {
          query.studentIds = []
        } else if (studentIds.length > 0) {
          query.studentIds = studentIds
        }
255e2506   梁保满   飞书bug及优化
323
        const data = await this.$request.exportPeriodReport({
d01c5799   梁保满   随堂问 报表开发
324
325
          // periodId: this.id,
          periodId: this.id[0],
9865dde4   梁保满   数据同步
326
          ...query
255e2506   梁保满   飞书bug及优化
327
        });
9309dc5d   梁保满   任课老师接口完成
328
329
        this.exportLoading = false;
        if (data) {
255e2506   梁保满   飞书bug及优化
330
331
332
          let blob = new Blob([data], {
            type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
          });
d01c5799   梁保满   随堂问 报表开发
333
          downloadFile(this.status ? "随堂问-已归档单课时报表.xlsx" : "随堂问-单课时报表.xlsx", blob);
9309dc5d   梁保满   任课老师接口完成
334
        } else {
236b1f0e   梁保满   周末-飞书bug
335
          this.$message.error("下载失败");
9309dc5d   梁保满   任课老师接口完成
336
        }
ee6e7628   梁保满   备题组卷借口数据对接调整
337
338
339
      },
    },
  };
4c4f7640   梁保满   路由表,路由前端文件
340
  </script>
dbbfc6c5   梁保满   飞书优化及bug
341
342
343
344
345
  <style>
  div::-webkit-scrollbar {
    width: 3px;
    height: 10px;
  }
d01c5799   梁保满   随堂问 报表开发
346
  
dbbfc6c5   梁保满   飞书优化及bug
347
348
349
350
351
  div::-webkit-scrollbar-thumb {
    border-radius: 10px;
    background-color: #ccc;
  }
  </style>
b769660c   梁保满   备课组题细节调整,随堂问列表页面开发完成
352
  <style lang="scss" scoped>
9309dc5d   梁保满   任课老师接口完成
353
354
355
356
357
358
  .down {
    padding-top: 20px;
    width: 100%;
    display: flex;
    justify-content: space-between;
  }
d01c5799   梁保满   随堂问 报表开发
359
  
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
360
361
362
  .red {
    color: #f30;
  }
d01c5799   梁保满   随堂问 报表开发
363
  
ee6e7628   梁保满   备题组卷借口数据对接调整
364
365
366
  .page-content {
    padding: 20px 20px 0;
  }
d01c5799   梁保满   随堂问 报表开发
367
  
b769660c   梁保满   备课组题细节调整,随堂问列表页面开发完成
368
369
  .tab-box {
    width: 800px;
ee6e7628   梁保满   备题组卷借口数据对接调整
370
    margin: 0 auto 12px;
b769660c   梁保满   备课组题细节调整,随堂问列表页面开发完成
371
372
373
    background: #f8f8f8;
    border-radius: 20px;
    display: flex;
d01c5799   梁保满   随堂问 报表开发
374
  
b769660c   梁保满   备课组题细节调整,随堂问列表页面开发完成
375
376
377
378
379
380
381
382
383
384
    .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   梁保满   备题组卷借口数据对接调整
385
      cursor: pointer;
d01c5799   梁保满   随堂问 报表开发
386
  
b769660c   梁保满   备课组题细节调整,随堂问列表页面开发完成
387
388
389
390
391
392
      &.active {
        background: #667ffd;
        color: #fff;
      }
    }
  }
d01c5799   梁保满   随堂问 报表开发
393
  
9865dde4   梁保满   数据同步
394
395
396
397
  :deep(.el-dialog__body) {
    padding-top: 0;
  }
  
d01c5799   梁保满   随堂问 报表开发
398
  .el-dialog {
9865dde4   梁保满   数据同步
399
  
d01c5799   梁保满   随堂问 报表开发
400
401
402
403
404
405
406
407
    .down-item {
      font-size: 15px;
      margin-bottom: 10px;
  
      .tit {
        line-height: 18px;
        padding: 10px 0;
      }
ee6e7628   梁保满   备题组卷借口数据对接调整
408
    }
9865dde4   梁保满   数据同步
409
410
411
412
413
414
  
    .export-tit {
      text-align: center;
      font-size: 16px;
      padding-bottom: 10px;
    }
ee6e7628   梁保满   备题组卷借口数据对接调整
415
  }
d01c5799   梁保满   随堂问 报表开发
416
417
418
419
  
  .dialog-footer {
    text-align: center;
  }
4c4f7640   梁保满   路由表,路由前端文件
420
  </style>