Blame view

src/views/basic/ask/list.vue 11.5 KB
d01c5799   梁保满   随堂问 报表开发
1
2
3
4
5
6
7
  <template>
    <div class="main" ref="main">
      <back-box v-show="!isDetail">
        <template slot="title">
          <span>随堂问-数据报表</span>
        </template>
        <template slot="btns">
f45b3c05   LH_PC   云平台新UI界面
8
9
10
          <el-tooltip v-if="this.role != 'ROLE_PERSONAL' && !code && gdClass" effect="dark" content="已归档试卷"
            placement="bottom">
            <el-button type="primary" icon="fa fa-archive" size="mini" plain circle @click="toArchiving"></el-button>
d01c5799   梁保满   随堂问 报表开发
11
12
13
14
15
          </el-tooltip>
        </template>
      </back-box>
      <div v-show="!isDetail" class="table-box">
        <div class="table-cont" v-loading="loading">
e17ec739   梁保满   随堂问,即时测导出爆表修改
16
          <p class="btn-box" v-if="tableData.length">
0f3dca29   梁保满   教师格式化确认,报表列表添加去筛选按钮
17
            <el-button type="primary" round @click="linkToAsk">筛选</el-button>
f45b3c05   LH_PC   云平台新UI界面
18
            <el-button type="primary" round @click="linkToDetail2">查看汇总报表</el-button>
d01c5799   梁保满   随堂问 报表开发
19
          </p>
9865dde4   梁保满   数据同步
20
          <div>
f45b3c05   LH_PC   云平台新UI界面
21
            <el-table :data="tableData" border :show-header="total > 0" style="width: 100%">
1410e5cd   梁保满   即时测随堂问多班汇总逻辑
22
23
              <el-table-column align="center" width="48">
                <template slot-scope="scope">
7222c2eb   梁保满   汇总前置条件修改,教学,行政可汇总
24
                  <!-- <el-checkbox
1410e5cd   梁保满   即时测随堂问多班汇总逻辑
25
26
27
28
                    v-model="multipleSelection"
                    :label="scope.row.id"
                    :disabled="checkboxDisabled(scope.row)"
                    ><span></span
7222c2eb   梁保满   汇总前置条件修改,教学,行政可汇总
29
                  ></el-checkbox> -->
f45b3c05   LH_PC   云平台新UI界面
30
                  <el-checkbox v-model="multipleSelection" :label="scope.row.id"><span></span></el-checkbox>
1410e5cd   梁保满   即时测随堂问多班汇总逻辑
31
32
                </template>
              </el-table-column>
f45b3c05   LH_PC   云平台新UI界面
33
34
35
36
37
38
              <el-table-column prop="subjectName" label="科目" align="center" width="80"></el-table-column>
              <el-table-column prop="title" label="课时名称" align="center"></el-table-column>
              <el-table-column prop="participationRate" label="总参与度" align="center">
                <template slot-scope="scoped">{{ scoped.row.participationRate }}%</template></el-table-column>
              <el-table-column prop="answerCorrectRate" label="已答总正确率" align="center"><template slot-scope="scoped">{{
        scoped.row.answerCorrectRate }}%</template>
d01c5799   梁保满   随堂问 报表开发
39
              </el-table-column>
f45b3c05   LH_PC   云平台新UI界面
40
41
42
43
              <el-table-column prop="classCorrectRate" label="班级总正确率" align="center"><template slot-scope="scoped">{{
        scoped.row.classCorrectRate }}%</template></el-table-column>
              <el-table-column prop="questionNum" label="题目总数" align="center"></el-table-column>
              <el-table-column prop="startTime" label="上课时间" align="center"></el-table-column>
d01c5799   梁保满   随堂问 报表开发
44
45
46
              <el-table-column label="操作" align="center" width="100">
                <template slot-scope="scoped">
                  <template v-if="scoped.row.answerNum == 0">
f45b3c05   LH_PC   云平台新UI界面
47
48
49
                    <el-tooltip v-if="role != 'ROLE_BANZHUREN'" effect="dark" content="设置答案" placement="top">
                      <el-button type="primary" circle size="mini" icon="fa fa-file-text"
                        @click="edit(scoped.row)"></el-button>
d01c5799   梁保满   随堂问 报表开发
50
51
52
53
                    </el-tooltip>
                    <template v-else>未设置答案</template>
                  </template>
                  <el-tooltip v-else effect="dark" content="详情" placement="top">
f45b3c05   LH_PC   云平台新UI界面
54
55
                    <el-button type="primary" circle size="mini" icon="fa fa-arrow-right"
                      @click="linkToDetail(scoped.row, 1)"></el-button>
d01c5799   梁保满   随堂问 报表开发
56
                  </el-tooltip>
f45b3c05   LH_PC   云平台新UI界面
57
58
59
                  <el-popconfirm v-if="role != 'ROLE_BANZHUREN'" title="确定删除吗?" @confirm="remove(scoped.row)">
                    <el-button class="remove-test" slot="reference" type="danger" circle size="mini" icon="el-icon-delete"
                      :loading="scoped.row.loading"></el-button>
50c1482f   梁保满   授课端日志下载。学生教师管理添加全部类型
60
                  </el-popconfirm>
d01c5799   梁保满   随堂问 报表开发
61
62
63
64
65
                </template>
              </el-table-column>
            </el-table>
          </div>
          <div class="pagination-box">
f45b3c05   LH_PC   云平台新UI界面
66
67
            <el-pagination small="" layout="total,prev, pager, next" :hide-on-single-page="true" :total="total"
              @current-change="changePage" :current-page="page" :page-size="size">
d01c5799   梁保满   随堂问 报表开发
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
            </el-pagination>
          </div>
        </div>
      </div>
      <router-view v-show="isDetail"></router-view>
    </div>
  </template>
  
  <script>
  import { downloadFile } from "utils";
  export default {
    data() {
      return {
        gdClass: 0, //已归档班级数量
        code: "",
        role: "",
        loading: false,
        query: {
          //搜索条件
          classId: "",
          subjectNames: [],
          startDay: "",
          endDay: "",
        },
        tableData: [],
        multipleSelection: [],
109a6161   梁保满   班主任汇总选择问题
94
        multipleSelectionObj: {},
d01c5799   梁保满   随堂问 报表开发
95
96
97
98
99
100
101
        page: 1,
        size: 20,
        total: 0,
      };
    },
    computed: {
      isDetail: function () {
1410e5cd   梁保满   即时测随堂问多班汇总逻辑
102
103
104
        let bol = this.$route.name == "随堂问报表分析" ? true : false;
        return bol;
      },
d01c5799   梁保满   随堂问 报表开发
105
106
    },
    async created() {
7812e986   梁保满   班主任查看报表添加额外信息
107
      this.code = this.$store.getters.csCode;
1410e5cd   梁保满   即时测随堂问多班汇总逻辑
108
      this.init();
d01c5799   梁保满   随堂问 报表开发
109
110
111
112
113
    },
    watch: {
      "$route.query.params": function (nVal) {
        let isFromAskDetail = sessionStorage.getItem("isFromAskDetail");
        if (!isFromAskDetail && nVal) {
1410e5cd   梁保满   即时测随堂问多班汇总逻辑
114
          this.init();
d01c5799   梁保满   随堂问 报表开发
115
        }
1410e5cd   梁保满   即时测随堂问多班汇总逻辑
116
      },
109a6161   梁保满   班主任汇总选择问题
117
118
119
120
121
122
123
124
      multipleSelection: {
        handler: function (nVal) {
          this.multipleSelectionObj[this.page] = this.tableData.filter((item) =>
            nVal.includes(item.id)
          );
        },
        deep: true,
      },
d01c5799   梁保满   随堂问 报表开发
125
126
127
128
    },
    methods: {
      //初始化
      init() {
1410e5cd   梁保满   即时测随堂问多班汇总逻辑
129
130
131
132
        const queryData = this.$route.query.params;
        queryData
          ? (this.query = { ...this.query, ...JSON.parse(queryData) })
          : "";
d01c5799   梁保满   随堂问 报表开发
133
134
135
136
        this.role =
          this.$store.getters.info.showRole ||
          this.$store.getters.info.permissions[0].role;
        if (this.role != "ROLE_PERSONAL") {
1410e5cd   梁保满   即时测随堂问多班汇总逻辑
137
138
139
140
141
142
143
          this._QueryGdClass();
        }
        this.$store.commit("setClasses", this.query.classId);
        this.page = 1;
        this.total = 0;
        this.tableData = [];
        this._QueryData();
d01c5799   梁保满   随堂问 报表开发
144
145
146
147
148
149
150
      },
      //归档
      toArchiving() {
        this.$router.push({
          path: "/askArchiving",
        });
      },
1410e5cd   梁保满   即时测随堂问多班汇总逻辑
151
152
153
      // 班主任教学班不能与行政班汇总
      checkboxDisabled(obj) {
        if (this.role == "ROLE_BANZHUREN") {
109a6161   梁保满   班主任汇总选择问题
154
155
156
157
158
          let classId =
            (this.multipleSelectionObj[1] &&
              this.multipleSelectionObj[1][0]?.classId) ||
            "";
          if (classId) {
1410e5cd   梁保满   即时测随堂问多班汇总逻辑
159
160
161
162
            return obj.classId == classId ? false : true;
          } else {
            return false;
          }
109a6161   梁保满   班主任汇总选择问题
163
164
        } else {
          return false;
1410e5cd   梁保满   即时测随堂问多班汇总逻辑
165
        }
d01c5799   梁保满   随堂问 报表开发
166
      },
0f3dca29   梁保满   教师格式化确认,报表列表添加去筛选按钮
167
168
169
170
171
172
      //去筛选
      linkToAsk() {
        this.$router.push({
          path: "/ask",
        });
      },
d01c5799   梁保满   随堂问 报表开发
173
174
175
176
177
178
179
      //去详情
      linkToDetail(obj, types) {
        this.$router.push({
          path: "/askAnalysis",
          query: {
            id: JSON.stringify([obj.id]),
            types: types,
049db2b2   梁保满   接口联调
180
            subjectNames: obj.subjectName,
22095aba   梁保满   接口联调
181
            params: this.$route.query.params,
049db2b2   梁保满   接口联调
182
            className: this.$route.query.className,
d01c5799   梁保满   随堂问 报表开发
183
184
185
186
187
          },
        });
      },
      //去详情
      linkToDetail2() {
22095aba   梁保满   接口联调
188
        if (this.multipleSelection.length == 0) {
1410e5cd   梁保满   即时测随堂问多班汇总逻辑
189
190
          this.$message.warning("未选择课时,请选择~");
          return;
22095aba   梁保满   接口联调
191
        }
1410e5cd   梁保满   即时测随堂问多班汇总逻辑
192
        let subjectArr = [];
7222c2eb   梁保满   汇总前置条件修改,教学,行政可汇总
193
        let classIds = [];
109a6161   梁保满   班主任汇总选择问题
194
195
196
197
198
199
200
201
        let multipleData = [];
        let multipleSelectionData = [];
        Object.keys(this.multipleSelectionObj).map((keys) => {
          multipleSelectionData = multipleSelectionData.concat(
            this.multipleSelectionObj[keys]
          );
        });
        multipleSelectionData.map((item) => {
a736cb8b   梁保满   fix:教师管理班级权限问题,删除...
202
          if (this.multipleSelection.includes(item.id)) {
1410e5cd   梁保满   即时测随堂问多班汇总逻辑
203
            subjectArr.push(item.subjectName);
109a6161   梁保满   班主任汇总选择问题
204
            multipleData.push(item);
7222c2eb   梁保满   汇总前置条件修改,教学,行政可汇总
205
            classIds.push(item.classId);
1410e5cd   梁保满   即时测随堂问多班汇总逻辑
206
207
208
          }
        });
        subjectArr = [...new Set(subjectArr)];
7222c2eb   梁保满   汇总前置条件修改,教学,行政可汇总
209
        classIds = [...new Set(classIds)];
109a6161   梁保满   班主任汇总选择问题
210
211
212
213
214
215
216
        if (this.multipleSelection.length == 1) {
          this.$router.push({
            path: "/askAnalysis",
            query: {
              id: JSON.stringify(this.multipleSelection),
              types: 1,
              subjectNames: subjectArr[0],
7222c2eb   梁保满   汇总前置条件修改,教学,行政可汇总
217
              classIds: classIds,
109a6161   梁保满   班主任汇总选择问题
218
219
220
221
222
223
224
225
226
227
228
229
              params: this.$route.query.params,
            },
          });
        } else {
          this.$router.push({
            path: "/askAnalysis",
            query: {
              id: JSON.stringify(this.multipleSelection),
              types:
                this.multipleSelection.length == 1
                  ? 1
                  : subjectArr.length == 1
f45b3c05   LH_PC   云平台新UI界面
230
231
                    ? 2
                    : 3,
109a6161   梁保满   班主任汇总选择问题
232
233
              subjectNames: subjectArr.join(","),
              params: this.$route.query.params,
7222c2eb   梁保满   汇总前置条件修改,教学,行政可汇总
234
235
              // classId: classId,
              classIds: classIds,
109a6161   梁保满   班主任汇总选择问题
236
237
238
            },
          });
        }
d01c5799   梁保满   随堂问 报表开发
239
      },
109a6161   梁保满   班主任汇总选择问题
240
  
d01c5799   梁保满   随堂问 报表开发
241
      //删除
a736cb8b   梁保满   fix:教师管理班级权限问题,删除...
242
243
      async remove(obj) {
        const { data, status, info } = await this.$request.deletePaperReport({
d01c5799   梁保满   随堂问 报表开发
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
          id: obj.id,
        });
        if (status === 0) {
          this.$message.success(info);
          this._QueryData();
        } else {
          this.$message.error(info);
        }
      },
      //修改答案
      async edit(item) {
        this.$router.push({
          path: "/examinationPaperEdit",
          query: {
            paperId: item.id,
            title: item.title,
            type: 3,
          },
        });
      },
      changePage(page) {
        this.page = page;
        this._QueryData();
      },
      async _QueryGdClass() {
        const fetchClassList =
          this.role == "ROLE_BANZHUREN"
            ? this.$request.cTClassList
            : this.$request.tClassList;
        const { data, status, info } = await fetchClassList({
          status: 1,
        });
        if (status === 0) {
          this.gdClass = data?.list?.length || 0;
        } else {
          this.$message.error(info);
        }
      },
      //分页查询课时报表列表
      async _QueryData() {
        this.loading = true;
        let query = {};
        for (let key in this.query) {
          if (this.query[key] != "" || this.query[key].length != 0) {
            query[key] = this.query[key];
          }
        }
1410e5cd   梁保满   即时测随堂问多班汇总逻辑
291
292
293
294
        const periodReportList =
          this.role == "ROLE_PERSONAL"
            ? this.$request.pPhaseInteractiveReport
            : this.$request.periodReportList;
d01c5799   梁保满   随堂问 报表开发
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
        const { data, status, info } = await periodReportList({
          ...query,
          page: this.page,
          size: this.size,
        });
        this.loading = false;
        if (status === 0) {
          this.tableData = (data?.list && [...data?.list]) || [];
          this.total = data?.count || 0;
        } else {
          this.$message.error(info);
        }
      },
      //导出
      async exportData() {
        if (this.exportLoading == true) return;
        let query = {};
        for (let key in this.query) {
          if (this.query[key] != "" || this.query[key].length != 0) {
            query[key] = this.query[key];
          }
        }
        this.exportLoading = true;
1410e5cd   梁保满   即时测随堂问多班汇总逻辑
318
319
320
321
        let exportData =
          this.role == "ROLE_BANZHUREN"
            ? this.$request.cTExportPhaseInteractiveReport
            : this.role == "ROLE_PERSONAL"
f45b3c05   LH_PC   云平台新UI界面
322
323
              ? this.$request.pExportPhaseReport
              : this.$request.exportPhaseInteractiveReport;
d01c5799   梁保满   随堂问 报表开发
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
        const data = await exportData({ ...query });
        this.exportLoading = false;
        if (data) {
          let blob = new Blob([data], {
            type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
          });
          downloadFile("随堂问-数据报表.xlsx", blob);
        } else {
          this.$message.error("下载失败");
        }
      },
    },
  };
  </script>
  <style>
  div::-webkit-scrollbar {
    width: 3px;
    height: 10px;
  }
  
  div::-webkit-scrollbar-thumb {
    border-radius: 10px;
    background-color: #ccc;
  }
  </style>
  <style lang="scss" scoped>
  .main {
    height: 100%;
  }
f45b3c05   LH_PC   云平台新UI界面
353
  
50c1482f   梁保满   授课端日志下载。学生教师管理添加全部类型
354
355
356
  .remove-test {
    margin-left: 10px;
  }
f45b3c05   LH_PC   云平台新UI界面
357
  
d01c5799   梁保满   随堂问 报表开发
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
  .table-box {
    padding: 16px;
    border-radius: 5px;
  
    .table-cont {
      min-height: 300px;
    }
  
    :deep(.fa-arrow-right) {
      padding-left: 2px;
    }
  
    :deep(.fa-file-text) {
      padding-left: 2px;
    }
  }
  
  .btn-box {
0f3dca29   梁保满   教师格式化确认,报表列表添加去筛选按钮
376
377
378
    display: flex;
    justify-content: space-between;
    padding: 0 12px 16px 0;
948b6a2c   梁保满   汇总按钮样式调整
379
380
381
    position: sticky;
    top: 4px;
    z-index: 10;
d01c5799   梁保满   随堂问 报表开发
382
  }
f45b3c05   LH_PC   云平台新UI界面
383
  </style>