Blame view

src/views/basic/ask/analysis.vue 11.6 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
        <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>
            <div class="down-item">
              <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">
            <li v-for="item in exportStudent"></li>
          </ul>
          <div class="dialog-footer" slot="footer">
            <el-button size="small" type="primary" round @click="exportData">确 定</el-button>
            <el-button size="small" type="danger" round @click="cancel">取 消</el-button>
          </div>
        </el-dialog>
b769660c   梁保满   备课组题细节调整,随堂问列表页面开发完成
63
      </div>
b769660c   梁保满   备课组题细节调整,随堂问列表页面开发完成
64
    </div>
4c4f7640   梁保满   路由表,路由前端文件
65
66
67
  </template>
  
  <script>
3617eaad   梁保满   长水账号设置
68
  import { downloadFile, tablePrint } from "@/utils";
d01c5799   梁保满   随堂问 报表开发
69
70
71
72
73
  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   梁保满   备题组卷借口数据对接调整
74
  export default {
d01c5799   梁保满   随堂问 报表开发
75
76
77
    components: {
      Detail, Example, AnswerQustion, Interact, Report
    },
ee6e7628   梁保满   备题组卷借口数据对接调整
78
79
    data() {
      return {
d01c5799   梁保满   随堂问 报表开发
80
        role: "",
9309dc5d   梁保满   任课老师接口完成
81
        loading: false,
d01c5799   梁保满   随堂问 报表开发
82
        id: [],
ee6e7628   梁保满   备题组卷借口数据对接调整
83
        type: 1,
d01c5799   梁保满   随堂问 报表开发
84
        tabList: [],
9309dc5d   梁保满   任课老师接口完成
85
86
        detail: {},
        tableData: [],
9309dc5d   梁保满   任课老师接口完成
87
88
89
        page: 1,
        size: 20,
        total: 0,
e5e4a3e6   梁保满   v1.3
90
        status: 0,
d01c5799   梁保满   随堂问 报表开发
91
92
93
94
        diaDown: false,
        downType: 1,
        exportType: 1,
        exportStudent: []
ee6e7628   梁保满   备题组卷借口数据对接调整
95
96
97
      };
    },
    created() {
d01c5799   梁保满   随堂问 报表开发
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
      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
117
      this.status = this.$route.query.status ? this.$route.query.status : 0;
9309dc5d   梁保满   任课老师接口完成
118
      this._QueryData();
d01c5799   梁保满   随堂问 报表开发
119
      this.types != 3 ? this.periodDetail() : '';
ee6e7628   梁保满   备题组卷借口数据对接调整
120
121
    },
    methods: {
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
122
      print() {
e5e4a3e6   梁保满   v1.3
123
124
125
126
        tablePrint(
          "print-content",
          this.detail.title + "_" + this.tabList[this.type - 1]
        );
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
127
      },
9309dc5d   梁保满   任课老师接口完成
128
129
130
131
      setType(type) {
        this.type = type;
        this.page = 1;
        this._QueryData();
d01c5799   梁保满   随堂问 报表开发
132
        this._QueryDataQuestionRank()
9309dc5d   梁保满   任课老师接口完成
133
      },
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
134
135
136
137
      setDuration(times) {
        let m = parseInt(times / 1000 / 60);
        let s = parseInt((times / 1000) % 60);
        let ms = times;
503b6063   梁保满   判断题答案选项
138
        let aTime;
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
139
140
141
142
143
144
145
146
147
        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   梁保满   判断题答案选项
148
149
          }
        }
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
150
        return aTime;
d32e461c   梁保满   备题组卷
151
      },
9309dc5d   梁保满   任课老师接口完成
152
153
154
155
156
      changePage(page) {
        this.page = page;
        this._QueryData();
      },
      async periodDetail() {
d01c5799   梁保满   随堂问 报表开发
157
158
159
160
161
        const periodDetail = this.role == "ROLE_PERSONAL" ?
          this.$request.pPeriodDetail :
          this.$request.periodDetail;
        let { data, info, status } = await periodDetail({
          periodId: this.id[0],
9309dc5d   梁保满   任课老师接口完成
162
163
164
        });
        if (status == 0) {
          this.detail = { ...data };
255e2506   梁保满   飞书bug及优化
165
166
167
168
169
170
          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   梁保满   任课老师接口完成
171
172
173
174
        } else {
          this.$message.error(info);
        }
      },
ee6e7628   梁保满   备题组卷借口数据对接调整
175
      async _QueryData() {
d01c5799   梁保满   随堂问 报表开发
176
        let queryData;
9309dc5d   梁保满   任课老师接口完成
177
        let query = {};
d01c5799   梁保满   随堂问 报表开发
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
        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) {
            this.type == 1
              ? this.$request.pPeriodQuestionReport
              : this.type == 2 ? this.$request.pPhaseAnswerReport : this.$request.pPhaseInteractiveReport;
          }
        } 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) {
            queryData = this.type == 1
              ? this.$request.periodQuestionReport
              : this.type == 2 ? this.$request.cTPhaseAnswerReport : this.$request.cTPhaseInteractiveReport;
          }
        }
  
  
        if (this.types == 1) {
          query.type = this.type
9309dc5d   梁保满   任课老师接口完成
216
217
218
        }
        this.loading = true;
        let { data, info, status } = await queryData({
d01c5799   梁保满   随堂问 报表开发
219
220
          // periodId: this.id,
          periodId: this.id[0],
9309dc5d   梁保满   任课老师接口完成
221
          ...query,
ee6e7628   梁保满   备题组卷借口数据对接调整
222
        });
9309dc5d   梁保满   任课老师接口完成
223
224
        this.loading = false;
        if (status === 0) {
255e2506   梁保满   飞书bug及优化
225
          if (this.type == 2) {
d01c5799   梁保满   随堂问 报表开发
226
            this.tableData = data?.list || []
255e2506   梁保满   飞书bug及优化
227
          } else {
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
228
229
            this.tableData = data?.list.sort((a, b) => {
              return a.questionIndex - b.questionIndex;
255e2506   梁保满   飞书bug及优化
230
231
            });
          }
9309dc5d   梁保满   任课老师接口完成
232
233
234
235
236
          this.total = data.count;
        } else {
          this.$message.error(info);
        }
      },
d01c5799   梁保满   随堂问 报表开发
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
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
300
301
302
303
304
      async _QueryDataQuestionRank() {
        let queryData;
        if (this.role == "ROLE_PERSONAL") {
          if (this.types == 1) {
            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) {
            this.type == 1
              ? this.$request.pPeriodQuestionReport
              : this.type == 2 ? this.$request.pPhaseAnswerReport : this.$request.pPhaseInteractiveReport;
          }
        } else {
          if (this.types == 1) {
            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) {
            queryData = this.type == 1
              ? this.$request.periodQuestionReport
              : this.type == 2 ? this.$request.cTPhaseAnswerReport : this.$request.cTPhaseInteractiveReport;
          }
        }
  
        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
      },
  
9309dc5d   梁保满   任课老师接口完成
305
306
      //导出
      async exportData() {
255e2506   梁保满   飞书bug及优化
307
        if (this.exportLoading == true) return;
9309dc5d   梁保满   任课老师接口完成
308
        this.exportLoading = true;
d01c5799   梁保满   随堂问 报表开发
309
        let studentIds = []
255e2506   梁保满   飞书bug及优化
310
        const data = await this.$request.exportPeriodReport({
d01c5799   梁保满   随堂问 报表开发
311
312
          // periodId: this.id,
          periodId: this.id[0],
255e2506   梁保满   飞书bug及优化
313
        });
9309dc5d   梁保满   任课老师接口完成
314
315
        this.exportLoading = false;
        if (data) {
255e2506   梁保满   飞书bug及优化
316
317
318
          let blob = new Blob([data], {
            type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
          });
d01c5799   梁保满   随堂问 报表开发
319
          downloadFile(this.status ? "随堂问-已归档单课时报表.xlsx" : "随堂问-单课时报表.xlsx", blob);
9309dc5d   梁保满   任课老师接口完成
320
        } else {
236b1f0e   梁保满   周末-飞书bug
321
          this.$message.error("下载失败");
9309dc5d   梁保满   任课老师接口完成
322
        }
ee6e7628   梁保满   备题组卷借口数据对接调整
323
324
325
      },
    },
  };
4c4f7640   梁保满   路由表,路由前端文件
326
  </script>
dbbfc6c5   梁保满   飞书优化及bug
327
328
329
330
331
  <style>
  div::-webkit-scrollbar {
    width: 3px;
    height: 10px;
  }
d01c5799   梁保满   随堂问 报表开发
332
  
dbbfc6c5   梁保满   飞书优化及bug
333
334
335
336
337
  div::-webkit-scrollbar-thumb {
    border-radius: 10px;
    background-color: #ccc;
  }
  </style>
b769660c   梁保满   备课组题细节调整,随堂问列表页面开发完成
338
  <style lang="scss" scoped>
9309dc5d   梁保满   任课老师接口完成
339
340
341
342
343
344
  .down {
    padding-top: 20px;
    width: 100%;
    display: flex;
    justify-content: space-between;
  }
d01c5799   梁保满   随堂问 报表开发
345
  
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
346
347
348
  .red {
    color: #f30;
  }
d01c5799   梁保满   随堂问 报表开发
349
  
ee6e7628   梁保满   备题组卷借口数据对接调整
350
351
352
  .page-content {
    padding: 20px 20px 0;
  }
d01c5799   梁保满   随堂问 报表开发
353
  
b769660c   梁保满   备课组题细节调整,随堂问列表页面开发完成
354
355
  .tab-box {
    width: 800px;
ee6e7628   梁保满   备题组卷借口数据对接调整
356
    margin: 0 auto 12px;
b769660c   梁保满   备课组题细节调整,随堂问列表页面开发完成
357
358
359
    background: #f8f8f8;
    border-radius: 20px;
    display: flex;
d01c5799   梁保满   随堂问 报表开发
360
  
b769660c   梁保满   备课组题细节调整,随堂问列表页面开发完成
361
362
363
364
365
366
367
368
369
370
    .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   梁保满   备题组卷借口数据对接调整
371
      cursor: pointer;
d01c5799   梁保满   随堂问 报表开发
372
  
b769660c   梁保满   备课组题细节调整,随堂问列表页面开发完成
373
374
375
376
377
378
      &.active {
        background: #667ffd;
        color: #fff;
      }
    }
  }
d01c5799   梁保满   随堂问 报表开发
379
380
381
382
383
384
385
386
387
388
  
  .el-dialog {
    .down-item {
      font-size: 15px;
      margin-bottom: 10px;
  
      .tit {
        line-height: 18px;
        padding: 10px 0;
      }
ee6e7628   梁保满   备题组卷借口数据对接调整
389
390
    }
  }
d01c5799   梁保满   随堂问 报表开发
391
392
393
394
  
  .dialog-footer {
    text-align: center;
  }
4c4f7640   梁保满   路由表,路由前端文件
395
  </style>