Blame view

src/views/basic/test/index.vue 12.4 KB
4c4f7640   梁保满   路由表,路由前端文件
1
  <template>
079cb4cf   梁保满   即时测导出
2
3
4
5
6
7
8
9
10
    <div class="main" ref="main">
      <div class="sel-dia">
        <p class="tit">
          <span>报表数据配置</span>
          <i class="el-icon-close" @click="goHome"></i>
        </p>
        <div class="select-box">
          <div class="sel-item sel-item2">
            <span class="sel-label">班级:</span>
b0cd2598   梁保满   fix:测试问题
11
            <div class="sel-d">
079cb4cf   梁保满   即时测导出
12
              <p class="p-all">
58744c8c   梁保满   即时测多班淡斑逻辑修改
13
14
15
16
17
18
                <el-checkbox
                  :indeterminate="isIndeterminateClass"
                  v-model="allClass"
                  @change="handleCheckAllChangeClass"
                  >全选</el-checkbox
                >
079cb4cf   梁保满   即时测导出
19
20
21
              </p>
              <p class="sel-p">
                <el-checkbox-group v-model="query.classId" @change="changeclass">
58744c8c   梁保满   即时测多班淡斑逻辑修改
22
23
24
25
26
27
                  <el-checkbox
                    v-for="item in classList"
                    :label="item.value"
                    :key="item.value"
                    >{{ item.label }}</el-checkbox
                  >
079cb4cf   梁保满   即时测导出
28
29
30
                </el-checkbox-group>
              </p>
            </div>
f356590c   阿宝   即时测列表,分析页面
31
          </div>
e9713b69   梁保满   备题支持无大题
32
          <div class="sel-item sel-item2" v-if="role == 'ROLE_BANZHUREN'">
079cb4cf   梁保满   即时测导出
33
34
35
            <span class="sel-label">科目:</span>
            <div class="sel-d">
              <p class="p-all">
58744c8c   梁保满   即时测多班淡斑逻辑修改
36
37
38
39
40
41
                <el-checkbox
                  :indeterminate="isIndeterminateSub"
                  v-model="allSubject"
                  @change="handleCheckAllChangeSub"
                  >全选</el-checkbox
                >
079cb4cf   梁保满   即时测导出
42
43
              </p>
              <p class="sel-p">
58744c8c   梁保满   即时测多班淡斑逻辑修改
44
45
46
47
48
49
50
51
52
53
                <el-checkbox-group
                  v-model="query.subjectNames"
                  @change="CheckedSub"
                >
                  <el-checkbox
                    v-for="item in subjectList"
                    :label="item"
                    :key="item"
                    >{{ item }}</el-checkbox
                  >
079cb4cf   梁保满   即时测导出
54
55
56
                </el-checkbox-group>
              </p>
            </div>
9309dc5d   梁保满   任课老师接口完成
57
          </div>
e9713b69   梁保满   备题支持无大题
58
59
60
61
          <div class="sel-item sel-item2" v-else>
            <span class="sel-label">科目:</span>
            <div class="sel-d">
              <p class="sel-p">
82235092   梁保满   导入或者修改答案没有答案报错,修改...
62
                <el-radio-group v-model="query.subjectNames">
e9713b69   梁保满   备题支持无大题
63
64
65
66
67
68
69
70
71
72
                  <el-radio
                    v-for="item in subjectList"
                    :label="item"
                    :key="item"
                    >{{ item }}</el-radio
                  >
                </el-radio-group>
              </p>
            </div>
          </div>
079cb4cf   梁保满   即时测导出
73
74
75
          <div class="sel-item">
            <span class="sel-label">日期:</span>
            <div class="d1">
58744c8c   梁保满   即时测多班淡斑逻辑修改
76
77
78
79
80
81
82
              <el-date-picker
                v-model="query.startDay"
                type="date"
                @change="handleChangeTimeStart"
                placeholder="选择日期时间"
                value-format="yyyy-MM-dd"
              >
079cb4cf   梁保满   即时测导出
83
84
              </el-date-picker>
              ~
58744c8c   梁保满   即时测多班淡斑逻辑修改
85
86
87
88
89
90
91
              <el-date-picker
                v-model="query.endDay"
                type="date"
                placeholder="选择日期时间"
                @change="handleChangeTimeEnd"
                value-format="yyyy-MM-dd"
              >
079cb4cf   梁保满   即时测导出
92
              </el-date-picker>
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
93
            </div>
079cb4cf   梁保满   即时测导出
94
            <p class="p1">
58744c8c   梁保满   即时测多班淡斑逻辑修改
95
96
97
98
99
100
101
102
103
              <span @click="setDate(1)" :class="[date == 1 ? 'active' : '', 's1']"
                >本周</span
              >
              <span @click="setDate(2)" :class="[date == 2 ? 'active' : '', 's1']"
                >本月</span
              >
              <span @click="setDate(3)" :class="[date == 3 ? 'active' : '', 's1']"
                >本季度</span
              >
8ea67428   梁保满   飞书bug
104
            </p>
079cb4cf   梁保满   即时测导出
105
106
107
108
109
          </div>
        </div>
        <div class="foot-box">
          <el-button type="primary" round @click="goList">确定</el-button>
          <el-button type="danger" round @click="goHome">取消</el-button>
8ea67428   梁保满   飞书bug
110
        </div>
079cb4cf   梁保满   即时测导出
111
      </div>
4c4f7640   梁保满   路由表,路由前端文件
112
113
114
115
    </div>
  </template>
  
  <script>
079cb4cf   梁保满   即时测导出
116
  import { formatDate } from "utils";
4c4f7640   梁保满   路由表,路由前端文件
117
  export default {
f356590c   阿宝   即时测列表,分析页面
118
119
    data() {
      return {
e5e4a3e6   梁保满   v1.3
120
        code: "",
f356590c   阿宝   即时测列表,分析页面
121
        role: "",
f356590c   阿宝   即时测列表,分析页面
122
123
124
        date: "", //今天-昨天-本周
        query: {
          //搜索条件
079cb4cf   梁保满   即时测导出
125
126
          classId: [],
          subjectNames: [],
f356590c   阿宝   即时测列表,分析页面
127
128
          startDay: "",
          endDay: "",
f356590c   阿宝   即时测列表,分析页面
129
        },
f356590c   阿宝   即时测列表,分析页面
130
131
        classList: [], //班级
        subjectList: [], //科目
079cb4cf   梁保满   即时测导出
132
  
58744c8c   梁保满   即时测多班淡斑逻辑修改
133
134
135
136
        isIndeterminateClass: true, //全选样式
        allClass: false, //全选状态
        isIndeterminateSub: true, //全选样式
        allSubject: false, //全选状态
f356590c   阿宝   即时测列表,分析页面
137
138
139
      };
    },
    async created() {
7812e986   梁保满   班主任查看报表添加额外信息
140
      this.code = this.$store.getters.csCode;
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
141
142
143
      this.role =
        this.$store.getters.info.showRole ||
        this.$store.getters.info.permissions[0].role;
079cb4cf   梁保满   即时测导出
144
      this.query.subjectNames = [];
f356590c   阿宝   即时测列表,分析页面
145
      await this._QueryClassList();
e5e4a3e6   梁保满   v1.3
146
147
148
      if (!this.query.classId) {
        return;
      }
f356590c   阿宝   即时测列表,分析页面
149
      await this._QuerySubjectList();
9309dc5d   梁保满   任课老师接口完成
150
      await this.setDate(1);
f356590c   阿宝   即时测列表,分析页面
151
152
153
154
155
156
      let startDay = this.query?.startDay;
      if (!startDay) {
        this.query.startDay = new Date();
        this.query.endDay = new Date();
      }
    },
079cb4cf   梁保满   即时测导出
157
  
f356590c   阿宝   即时测列表,分析页面
158
    methods: {
079cb4cf   梁保满   即时测导出
159
      handleCheckAllChangeClass(val) {
58744c8c   梁保满   即时测多班淡斑逻辑修改
160
161
        this.isIndeterminateClass = false;
        this.query.classId = val ? this.classList.map((item) => item.value) : [];
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
162
      },
079cb4cf   梁保满   即时测导出
163
      changeclass(value) {
58744c8c   梁保满   即时测多班淡斑逻辑修改
164
165
166
167
168
169
170
171
        if (this.role == "ROLE_BANZHUREN") {
          this._QuerySubjectList();
        } else {
          let checkedCount = value.length;
          this.allClass = checkedCount === this.classList.length;
          this.isIndeterminateClass =
            checkedCount > 0 && checkedCount < this.classList.length;
        }
dbbfc6c5   梁保满   飞书优化及bug
172
      },
079cb4cf   梁保满   即时测导出
173
      handleCheckAllChangeSub(val) {
ddcd75d7   梁保满   教师二次管理数据问题
174
        this.isIndeterminateSub = false;
079cb4cf   梁保满   即时测导出
175
        this.query.subjectNames = val ? this.subjectList : [];
e5e4a3e6   梁保满   v1.3
176
      },
079cb4cf   梁保满   即时测导出
177
      CheckedSub(value) {
079cb4cf   梁保满   即时测导出
178
179
        let checkedCount = value.length;
        this.allSubject = checkedCount === this.subjectList.length;
ddcd75d7   梁保满   教师二次管理数据问题
180
        this.isIndeterminateSub =
58744c8c   梁保满   即时测多班淡斑逻辑修改
181
          checkedCount > 0 && checkedCount < this.subjectList.length;
8ea67428   梁保满   飞书bug
182
      },
f356590c   阿宝   即时测列表,分析页面
183
184
185
186
187
      setDate(index) {
        const that = this;
        this.date = index == this.date ? "" : index;
        let aYear = new Date().getFullYear();
        let aMonth = new Date().getMonth() + 1;
f356590c   阿宝   即时测列表,分析页面
188
189
190
191
        that.query.startDay = "";
        that.query.endDay = "";
        switch (index) {
          case 1:
f356590c   阿宝   即时测列表,分析页面
192
193
194
195
196
            let day = new Date().getDay();
            if (day == 0) {
              //中国式星期天是一周的最后一天
              day = 7;
            }
8ea67428   梁保满   飞书bug
197
            day--;
f356590c   阿宝   即时测列表,分析页面
198
199
200
201
            let aTime = new Date().getTime() - 24 * 60 * 60 * 1000 * day;
            that.query.startDay = formatDate(new Date(aTime), "yyyy-MM-dd");
            that.query.endDay = formatDate(new Date(), "yyyy-MM-dd");
            break;
079cb4cf   梁保满   即时测导出
202
          case 2:
f356590c   阿宝   即时测列表,分析页面
203
204
205
206
            aMonth = aMonth < 10 ? "0" + aMonth : aMonth;
            that.query.startDay = `${aYear}-${aMonth}-01`;
            that.query.endDay = formatDate(new Date(), "yyyy-MM-dd");
            break;
079cb4cf   梁保满   即时测导出
207
          case 3:
9309dc5d   梁保满   任课老师接口完成
208
            if (aMonth > 0 && aMonth < 4) {
e3b0e3e7   梁保满   季度时间格式调整
209
              aMonth = "1";
f356590c   阿宝   即时测列表,分析页面
210
            } else if (aMonth > 3 && aMonth < 7) {
e3b0e3e7   梁保满   季度时间格式调整
211
              aMonth = "4";
f356590c   阿宝   即时测列表,分析页面
212
            } else if (aMonth > 6 && aMonth < 10) {
e3b0e3e7   梁保满   季度时间格式调整
213
              aMonth = "7";
f356590c   阿宝   即时测列表,分析页面
214
215
216
217
218
219
220
221
222
223
            } else {
              aMonth = "10";
            }
  
            aMonth = aMonth < 10 ? "0" + aMonth : aMonth;
            that.query.startDay = `${aYear}-${aMonth}-01`;
            that.query.endDay = formatDate(new Date(), "yyyy-MM-dd");
            break;
        }
        this.page = 1;
f356590c   阿宝   即时测列表,分析页面
224
225
      },
      handleChangeTimeStart(val) {
f356590c   阿宝   即时测列表,分析页面
226
227
228
229
230
231
232
233
234
        this.date = "";
        if (this.query.endDay) {
          if (new Date(val).getTime() > new Date(this.query.endDay).getTime()) {
            this.$message.error("任务结束时间不能任务开始时间前面,请重新设置");
            this.query.startDay = "";
          }
        }
      },
      handleChangeTimeEnd(val) {
f356590c   阿宝   即时测列表,分析页面
235
        this.date = "";
079cb4cf   梁保满   即时测导出
236
        if (this.query.startDay && val) {
f356590c   阿宝   即时测列表,分析页面
237
238
239
240
241
242
          if (new Date(val).getTime() < new Date(this.query.startDay).getTime()) {
            this.$message.error("任务结束时间不能任务开始时间前面,请重新设置");
            this.query.endDay = "";
          }
        }
      },
f356590c   阿宝   即时测列表,分析页面
243
      async _QueryClassList() {
9309dc5d   梁保满   任课老师接口完成
244
245
        const fetchClassList =
          this.role == "ROLE_BANZHUREN"
58744c8c   梁保满   即时测多班淡斑逻辑修改
246
247
248
249
            ? this.$request.cTClassList
            : this.role == "ROLE_PERSONAL"
            ? this.$request.pClassList
            : this.$request.tClassList;
9309dc5d   梁保满   任课老师接口完成
250
        const { data, status, info } = await fetchClassList();
f356590c   阿宝   即时测列表,分析页面
251
252
253
254
        if (status === 0) {
          this.classList = data.list.map((item) => {
            return {
              value: item.classId,
45504a95   阿宝   即时测页面,以及小题修改答案
255
              label: item.className,
f356590c   阿宝   即时测列表,分析页面
256
257
            };
          });
b0cd2598   梁保满   fix:测试问题
258
259
260
261
262
263
264
265
266
          // if (this.role == "ROLE_BANZHUREN") {
          //   this.query.classId = this.classList.length
          //     ? this.classList[0].value
          //     : "";
          // } else {
          this.classList.length
            ? this.query.classId.push(this.classList[0].value)
            : "";
          // }
f356590c   阿宝   即时测列表,分析页面
267
268
269
270
271
        } else {
          this.$message.error(info);
        }
      },
      async _QuerySubjectList() {
9309dc5d   梁保满   任课老师接口完成
272
273
        const fetchSubjectList =
          this.role == "ROLE_BANZHUREN"
58744c8c   梁保满   即时测多班淡斑逻辑修改
274
275
276
277
            ? this.$request.cTSubjectList
            : this.role == "ROLE_PERSONAL"
            ? this.$request.pSubjectList
            : this.$request.tSubjectList;
9309dc5d   梁保满   任课老师接口完成
278
  
58744c8c   梁保满   即时测多班淡斑逻辑修改
279
        let classIds = this.query.classId;
9895b056   梁保满   无班级不去查找科目
280
        if (!classIds || classIds.length == 0) return;
9309dc5d   梁保满   任课老师接口完成
281
        const { data, status, info } = await fetchSubjectList({
079cb4cf   梁保满   即时测导出
282
          classIds: classIds,
f356590c   阿宝   即时测列表,分析页面
283
284
        });
        if (status === 0) {
079cb4cf   梁保满   即时测导出
285
          this.subjectList = data.subjectNames || [];
572de367   梁保满   多班对比问题
286
287
288
289
290
291
292
293
294
          if (this.role == "ROLE_BANZHUREN") {
            this.subjectList.length
              ? this.query.subjectNames.push(this.subjectList[0])
              : "";
          } else {
            this.subjectList.length
              ? (this.query.subjectNames = this.subjectList[0])
              : "";
          }
f356590c   阿宝   即时测列表,分析页面
295
296
297
298
        } else {
          this.$message.error(info);
        }
      },
079cb4cf   梁保满   即时测导出
299
300
301
302
  
      //回主页
      goHome() {
        this.$router.push({
58744c8c   梁保满   即时测多班淡斑逻辑修改
303
304
          path: "/index",
        });
f356590c   阿宝   即时测列表,分析页面
305
      },
079cb4cf   梁保满   即时测导出
306
307
      //去列表
      goList() {
58744c8c   梁保满   即时测多班淡斑逻辑修改
308
309
310
        if (this.query.classId.length == 0) {
          this.$message.warning("请选择班级!");
          return;
384a2a54   梁保满   请求头添加班主任信息,bug修改
311
        }
58744c8c   梁保满   即时测多班淡斑逻辑修改
312
313
314
315
316
        if (this.query.subjectNames.length == 0) {
          this.$message.warning("请选择科目!");
          return;
        }
        let query = { ...this.query };
e9713b69   梁保满   备题支持无大题
317
318
319
        if (this.role != "ROLE_BANZHUREN") {
          query.subjectNames = [query.subjectNames];
        }
079cb4cf   梁保满   即时测导出
320
        this.$router.push({
58744c8c   梁保满   即时测多班淡斑逻辑修改
321
          path: "/testList",
079cb4cf   梁保满   即时测导出
322
          query: {
58744c8c   梁保满   即时测多班淡斑逻辑修改
323
324
325
326
            params: JSON.stringify(query),
          },
        });
      },
f356590c   阿宝   即时测列表,分析页面
327
328
    },
  };
4c4f7640   梁保满   路由表,路由前端文件
329
  </script>
9309dc5d   梁保满   任课老师接口完成
330
331
332
333
334
  <style>
  div::-webkit-scrollbar {
    width: 3px;
    height: 10px;
  }
079cb4cf   梁保满   即时测导出
335
  
9309dc5d   梁保满   任课老师接口完成
336
337
338
339
340
  div::-webkit-scrollbar-thumb {
    border-radius: 10px;
    background-color: #ccc;
  }
  </style>
f356590c   阿宝   即时测列表,分析页面
341
  <style lang="scss" scoped>
079cb4cf   梁保满   即时测导出
342
  .main {
255e2506   梁保满   飞书bug及优化
343
    height: 100%;
58744c8c   梁保满   即时测多班淡斑逻辑修改
344
    background: rgba($color: #000000, $alpha: 0.3);
079cb4cf   梁保满   即时测导出
345
346
    display: flex;
    justify-content: center;
9309dc5d   梁保满   任课老师接口完成
347
  }
079cb4cf   梁保满   即时测导出
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
  
  .sel-dia {
    margin-top: 100px;
    width: 750px;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    height: 460px;
    display: flex;
    flex-direction: column;
  
    .tit {
      text-align: center;
      position: relative;
      padding: 20px 0 12px;
      font-size: 18px;
      font-weight: 500;
      flex-shrink: 0;
  
      .el-icon-close {
        position: absolute;
        top: 0;
        right: 0;
        width: 30px;
        height: 30px;
        text-align: center;
        line-height: 28px;
        background: #e2e2e2;
        border-radius: 0 0 0 24px;
        box-sizing: border-box;
        padding-left: 6px;
        font-size: 18px;
        cursor: pointer;
  
        &:hover {
          color: #f30;
        }
      }
f356590c   阿宝   即时测列表,分析页面
386
    }
079cb4cf   梁保满   即时测导出
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
  
    .select-box {
      flex: 1;
      overflow-y: auto;
      padding: 0 30px;
  
      .sel-item {
        display: flex;
        align-items: center;
        margin-bottom: 12px;
  
        .sel-label {
          width: 60px;
          margin-right: 10px;
          flex-shrink: 0;
          font-size: 15px;
          font-weight: 500;
        }
  
        :deep(.el-input__inner) {
          height: 36px;
          line-height: 36px;
          border-radius: 18px;
        }
  
        :deep(.el-input__suffix) {
          .el-input__icon {
            line-height: 36px;
          }
        }
  
        :deep(.el-input__inner) {
          height: 36px;
          line-height: 36px;
          border-radius: 18px;
  
          .el-input__icon {
            line-height: 36px;
          }
        }
  
        .el-date-editor.el-input,
        .el-date-editor.el-input__inner {
          width: 160px;
          height: 36px;
          line-height: 36px;
  
          :deep(.el-input__icon) {
            line-height: 36px;
          }
        }
      }
  
      .sel-item2 {
        align-items: flex-start;
        line-height: 20px;
        padding-top: 10px;
  
        .p-all {
          padding-bottom: 6px;
        }
      }
  
      .p1 {
        .s1 {
          margin-left: 20px;
          cursor: pointer;
          color: #7f7f7f;
  
          &:hover {
            color: #409eff;
          }
  
          &.active {
            color: #667ffd;
          }
        }
      }
    }
  
    .foot-box {
      flex-shrink: 0;
      padding: 12px 0 20px;
      display: flex;
      justify-content: center;
  
      .el-button {
        margin: 0 30px;
      }
f356590c   阿宝   即时测列表,分析页面
476
    }
aed43d3a   阿宝   即时测修改答案
477
  }
4c4f7640   梁保满   路由表,路由前端文件
478
  </style>