| 86201e49  梁保满
 
即时测模块 | 1
2
3 |   <template>
    <div class="table-box" ref="main" v-loading="loading">
      <div id="print-content">
 | 
| f45b3c05  LH_PC
 
云平台新UI界面 | 4
5 |         <el-table :max-height="tableMaxHeight" :data="tableData" border style="width: 100%">
          <el-table-column prop="studentCode" label="学号" align="center" fixed></el-table-column>
 | 
| 86201e49  梁保满
 
即时测模块 | 6 |           <el-table-column prop="studentName" label="姓名" fixed align="center">
 | 
| 7222c2eb  梁保满
 
汇总前置条件修改,教学,行政可汇总 | 7
8 |             <template slot-scope="scoped">
              {{ scoped.row.studentName }}
 | 
| f45b3c05  LH_PC
 
云平台新UI界面 | 9
10
11
12 |             </template></el-table-column>
          <el-table-column align="center" v-for="(item, index) in answerList" :key="index" :label="item.title">
            <el-table-column :prop="'score' + index" :label="index == 0 ? '总分' : '成绩'" align="center"
              :class-name="index % 2 == 0 ? 'bg' : ''">
 | 
| 6b3dde63  梁保满
 
随堂问,即时测没有数据显示-,其他... | 13 |               <template slot-scope="scoped">{{
 | 
| f45b3c05  LH_PC
 
云平台新UI界面 | 14
15
16
17
18 |       scoped.row["score" + index] ||
        Number(scoped.row["score" + index]) === 0
        ? scoped.row["score" + index]
        : "-"
    }}</template>
 | 
| 6b3dde63  梁保满
 
随堂问,即时测没有数据显示-,其他... | 19 |             </el-table-column>
 | 
| f45b3c05  LH_PC
 
云平台新UI界面 | 20
21 |             <el-table-column :prop="'classRank' + index" label="班名" align="center" sortable
              :class-name="index % 2 == 0 ? 'bg' : ''">
 | 
| 6b3dde63  梁保满
 
随堂问,即时测没有数据显示-,其他... | 22 |               <template slot-scope="scoped">{{
 | 
| f45b3c05  LH_PC
 
云平台新UI界面 | 23
24
25
26
27 |       scoped.row["classRank" + index] ||
        Number(scoped.row["classRank" + index]) === 0
        ? scoped.row["classRank" + index]
        : "-"
    }}</template>
 | 
| 6b3dde63  梁保满
 
随堂问,即时测没有数据显示-,其他... | 28 |             </el-table-column>
 | 
| 86201e49  梁保满
 
即时测模块 | 29
30
31 |           </el-table-column>
          <el-table-column label="查看折线图" align="center">
            <template slot-scope="scoped">
 | 
| f45b3c05  LH_PC
 
云平台新UI界面 | 32
33 |               <el-button @click="openChart(scoped.row)" type="primary" size="mini" circle
                icon="el-icon-arrow-right"></el-button>
 | 
| 86201e49  梁保满
 
即时测模块 | 34
35
36
37
38 |             </template>
          </el-table-column>
        </el-table>
      </div>
      <div class="down">
 | 
| f45b3c05  LH_PC
 
云平台新UI界面 | 39
40
41 |         <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>
 | 
| 86201e49  梁保满
 
即时测模块 | 42 |       </div>
 | 
| f45b3c05  LH_PC
 
云平台新UI界面 | 43 |       <el-dialog :append-to-body="true" class="chart-dia" :visible.sync="chartDia" :title="chartTitle" width="800">
 | 
| 86201e49  梁保满
 
即时测模块 | 44 |         <div class="chart-box">
 | 
| f45b3c05  LH_PC
 
云平台新UI界面 | 45 |           <LineChart id="lineChart" :params="chartData" :xAxis="xAxis" :formatterYAxis="false" />
 | 
| 86201e49  梁保满
 
即时测模块 | 46
47 |         </div>
      </el-dialog>
 | 
| f45b3c05  LH_PC
 
云平台新UI界面 | 48
49 |       <ExportDia :exportStudent="exportStudent" :diaShow="diaShow" @cancel="cancel" @exportData="exportData"
        lastLabel="总分" />
 | 
| 86201e49  梁保满
 
即时测模块 | 50
51
52
53 |     </div>
    <!-- 单科多卷 -->
  </template>
  <script>
 | 
| b0cd2598  梁保满
 
fix:测试问题 | 54 |   import LineChart from "@/components/charts/lineChart";
 | 
| 86201e49  梁保满
 
即时测模块 | 55
56
57
58
59
60 |   import { downloadFile, tablePrint } from "@/utils";
  export default {
    components: { LineChart },
    props: {
      role: "",
      ids: Array,
 | 
| 7222c2eb  梁保满
 
汇总前置条件修改,教学,行政可汇总 | 61 |       classIds: Array,
 | 
| 86201e49  梁保满
 
即时测模块 | 62
63
64
65
66
67
68
69
70
71
72
73
74 |       subjectName: String,
    },
    data() {
      return {
        tableMaxHeight: null,
        answerList: [], //设置多卷内容供tableStage表格数据用
        tableData: [],
        loading: false,
        exportLoading: false,
        chartDia: false,
        studentName: "",
        xAxis: [],
        chartData: [],
 | 
| e17ec739  梁保满
 
随堂问,即时测导出爆表修改 | 75
76
77 |   
        //导出相关
        diaShow: false,
 | 
| b0cd2598  梁保满
 
fix:测试问题 | 78
79 |         exportStudent: [],
      };
 | 
| 86201e49  梁保满
 
即时测模块 | 80
81
82 |     },
    computed: {
      chartTitle: function () {
 | 
| b0cd2598  梁保满
 
fix:测试问题 | 83
84 |         return `${this.studentName}-${this.subjectName}-多课时作答表现图`;
      },
 | 
| 86201e49  梁保满
 
即时测模块 | 85
86 |     },
    created() {
 | 
| b0cd2598  梁保满
 
fix:测试问题 | 87 |       this.phaseExamReport();
 | 
| 86201e49  梁保满
 
即时测模块 | 88
89
90
91
92
93 |     },
    mounted() {
      this.tableMaxHeight = this.$refs.main.offsetHeight;
    },
    methods: {
      print() {
 | 
| ef16e57e  LH_PC
 
fix:前端版本迭代 | 94
95
96
97 |         tablePrint({
          id: "print-content",
          title: this.subjectName + "汇总报表"
        }) 
 | 
| 86201e49  梁保满
 
即时测模块 | 98 |       },
 | 
| 86201e49  梁保满
 
即时测模块 | 99
100 |       //查看折线图
      openChart(obj) {
 | 
| b0cd2598  梁保满
 
fix:测试问题 | 101
102
103
104
105
106
107
108
109
110
111
112 |         this.studentName = obj.studentName;
        this.chartDia = true;
        let score = [];
        let classRank = [];
        let avgScore = [];
        const examList = obj.examList.slice(1, obj.examList.length);
        this.xAxis = examList.map((item) => {
          score.push(item.score);
          classRank.push(item.classRank);
          avgScore.push(item.avgScore);
          return item.title;
        });
 | 
| 86201e49  梁保满
 
即时测模块 | 113
114 |         this.chartData = [
          {
 | 
| 22095aba  梁保满
 
接口联调 | 115 |             name: "班级排名",
 | 
| b0cd2598  梁保满
 
fix:测试问题 | 116 |             value: classRank,
 | 
| 86201e49  梁保满
 
即时测模块 | 117
118 |           },
          {
 | 
| 22095aba  梁保满
 
接口联调 | 119 |             name: "班平均分",
 | 
| b0cd2598  梁保满
 
fix:测试问题 | 120 |             value: avgScore,
 | 
| 86201e49  梁保满
 
即时测模块 | 121
122 |           },
          {
 | 
| 22095aba  梁保满
 
接口联调 | 123 |             name: "个人成绩",
 | 
| b0cd2598  梁保满
 
fix:测试问题 | 124 |             value: score,
 | 
| 86201e49  梁保满
 
即时测模块 | 125 |           },
 | 
| b0cd2598  梁保满
 
fix:测试问题 | 126 |         ];
 | 
| 86201e49  梁保满
 
即时测模块 | 127
128
129
130
131
132
133
134 |       },
      async phaseExamReport() {
        this.loading = true;
        const phaseExamReport =
          this.role == "ROLE_PERSONAL"
            ? this.$request.pPhaseExamReport
            : this.$request.phaseExamReport;
        const { data, status, info } = await phaseExamReport({
 | 
| 7222c2eb  梁保满
 
汇总前置条件修改,教学,行政可汇总 | 135 |           classIds: this.classIds,
 | 
| 86201e49  梁保满
 
即时测模块 | 136 |           examIds: this.ids,
 | 
| b0cd2598  梁保满
 
fix:测试问题 | 137 |           subjectName: this.subjectName,
 | 
| 86201e49  梁保满
 
即时测模块 | 138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158 |         });
        this.loading = false;
        if (status === 0) {
          this.total = data.count;
          let dataIdsList = [],
            dataList = [];
          data?.list.map((item) => {
            item.examList.map((items) => {
              if (!dataIdsList.includes(items.title)) {
                dataIdsList.push(items.title);
                dataList.push(items);
              }
            });
          });
          this.tableData = data?.list.map((item) => {
            let params = {};
            dataIdsList.map((ids, index) => {
              params["score" + index] = "--";
              params["classRank" + index] = "--";
              item.examList.map((items) => {
                if (items.title == ids) {
 | 
| 384a2a54  梁保满
 
请求头添加班主任信息,bug修改 | 159 |                   params["score" + index] = Number(items.score);
 | 
| 86201e49  梁保满
 
即时测模块 | 160
161
162
163
164
165
166
167
168
169 |                   params["classRank" + index] = items.classRank;
                }
              });
            });
            return {
              ...item,
              ...params,
            };
          });
          this.answerList = dataList;
 | 
| e17ec739  梁保满
 
随堂问,即时测导出爆表修改 | 170 |   
 | 
| b0cd2598  梁保满
 
fix:测试问题 | 171 |           this.exportStudent = [...this.tableData];
 | 
| 86201e49  梁保满
 
即时测模块 | 172
173
174
175
176 |         } else {
          this.$message.error(info);
        }
      },
      //导出
 | 
| e17ec739  梁保满
 
随堂问,即时测导出爆表修改 | 177
178
179
180
181
182
183 |       openDown() {
        this.diaShow = true;
      },
      cancel() {
        this.diaShow = false;
      },
      async exportData(arr) {
 | 
| 86201e49  梁保满
 
即时测模块 | 184
185 |         if (this.exportLoading == true) return;
        this.exportLoading = true;
 | 
| b0cd2598  梁保满
 
fix:测试问题 | 186 |         let studentIds = arr;
 | 
| e17ec739  梁保满
 
随堂问,即时测导出爆表修改 | 187 |         let query = {};
 | 
| b0cd2598  梁保满
 
fix:测试问题 | 188 |         if (studentIds != null) {
 | 
| ce278878  梁保满
 
2-2 bugfix | 189 |           if (studentIds.length > 0) {
 | 
| b0cd2598  梁保满
 
fix:测试问题 | 190 |             query.studentIds = studentIds;
 | 
| ce278878  梁保满
 
2-2 bugfix | 191 |           } else {
 | 
| b0cd2598  梁保满
 
fix:测试问题 | 192 |             query.studentIds = [];
 | 
| ce278878  梁保满
 
2-2 bugfix | 193 |           }
 | 
| e17ec739  梁保满
 
随堂问,即时测导出爆表修改 | 194 |         }
 | 
| b0cd2598  梁保满
 
fix:测试问题 | 195
196
197
198 |         const exportPhaseExamReport =
          this.role == "ROLE_PERSONAL"
            ? this.$request.pExportPhaseExamReport
            : this.$request.exportPhaseExamReport;
 | 
| 86201e49  梁保满
 
即时测模块 | 199 |         const data = await exportPhaseExamReport({
 | 
| 7222c2eb  梁保满
 
汇总前置条件修改,教学,行政可汇总 | 200 |           classIds: this.classIds,
 | 
| 049db2b2  梁保满
 
接口联调 | 201 |           examIds: this.ids,
 | 
| b0cd2598  梁保满
 
fix:测试问题 | 202 |           ...query,
 | 
| 86201e49  梁保满
 
即时测模块 | 203
204
205
206
207
208
209 |         });
        this.exportLoading = false;
        if (data) {
          let blob = new Blob([data], {
            type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
          });
          downloadFile("即时测-单科多卷报表.xlsx", blob);
 | 
| f9916d4c  梁保满
 
导出摸板 | 210 |           this.$message.success("下载成功");
 | 
| b0cd2598  梁保满
 
fix:测试问题 | 211 |           this.cancel();
 | 
| 86201e49  梁保满
 
即时测模块 | 212
213
214
215 |         } else {
          this.$message.error("下载失败");
        }
      },
 | 
| b0cd2598  梁保满
 
fix:测试问题 | 216 |     },
 | 
| 86201e49  梁保满
 
即时测模块 | 217
218
219
220
221
222
223
224
225
226
227
228
229
230 |   };
  </script>
  <style lang="scss" scoped>
  .table-box {
    padding: 20px;
  }
  
  .down {
    padding-top: 20px;
    width: 100%;
    display: flex;
    justify-content: space-between;
  }
  
 | 
| 86201e49  梁保满
 
即时测模块 | 231
232
233
234
235
236
237
238
239
240
241 |   .chart-dia {
    .chart-box {
      width: 100%;
      height: 300px;
    }
  
    :deep(.el-dialog__body) {
      padding: 0 0 20px 0;
    }
  }
  </style>
 |