Blame view

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