Blame view

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