Blame view

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