Blame view

src/views/basic/test/index.vue 11.6 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>
079cb4cf   梁保满   即时测导出
32
33
34
35
          <div class="sel-item sel-item2">
            <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>
079cb4cf   梁保满   即时测导出
58
59
60
          <div class="sel-item">
            <span class="sel-label">日期:</span>
            <div class="d1">
58744c8c   梁保满   即时测多班淡斑逻辑修改
61
62
63
64
65
66
67
              <el-date-picker
                v-model="query.startDay"
                type="date"
                @change="handleChangeTimeStart"
                placeholder="选择日期时间"
                value-format="yyyy-MM-dd"
              >
079cb4cf   梁保满   即时测导出
68
69
              </el-date-picker>
              ~
58744c8c   梁保满   即时测多班淡斑逻辑修改
70
71
72
73
74
75
76
              <el-date-picker
                v-model="query.endDay"
                type="date"
                placeholder="选择日期时间"
                @change="handleChangeTimeEnd"
                value-format="yyyy-MM-dd"
              >
079cb4cf   梁保满   即时测导出
77
              </el-date-picker>
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
78
            </div>
079cb4cf   梁保满   即时测导出
79
            <p class="p1">
58744c8c   梁保满   即时测多班淡斑逻辑修改
80
81
82
83
84
85
86
87
88
              <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
89
            </p>
079cb4cf   梁保满   即时测导出
90
91
92
93
94
          </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
95
        </div>
079cb4cf   梁保满   即时测导出
96
      </div>
4c4f7640   梁保满   路由表,路由前端文件
97
98
99
100
    </div>
  </template>
  
  <script>
079cb4cf   梁保满   即时测导出
101
  import { formatDate } from "utils";
4c4f7640   梁保满   路由表,路由前端文件
102
  export default {
f356590c   阿宝   即时测列表,分析页面
103
104
    data() {
      return {
e5e4a3e6   梁保满   v1.3
105
        code: "",
f356590c   阿宝   即时测列表,分析页面
106
        role: "",
f356590c   阿宝   即时测列表,分析页面
107
108
109
        date: "", //今天-昨天-本周
        query: {
          //搜索条件
079cb4cf   梁保满   即时测导出
110
111
          classId: [],
          subjectNames: [],
f356590c   阿宝   即时测列表,分析页面
112
113
          startDay: "",
          endDay: "",
f356590c   阿宝   即时测列表,分析页面
114
        },
f356590c   阿宝   即时测列表,分析页面
115
116
        classList: [], //班级
        subjectList: [], //科目
079cb4cf   梁保满   即时测导出
117
  
58744c8c   梁保满   即时测多班淡斑逻辑修改
118
119
120
121
        isIndeterminateClass: true, //全选样式
        allClass: false, //全选状态
        isIndeterminateSub: true, //全选样式
        allSubject: false, //全选状态
f356590c   阿宝   即时测列表,分析页面
122
123
124
      };
    },
    async created() {
7812e986   梁保满   班主任查看报表添加额外信息
125
      this.code = this.$store.getters.csCode;
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
126
127
128
      this.role =
        this.$store.getters.info.showRole ||
        this.$store.getters.info.permissions[0].role;
079cb4cf   梁保满   即时测导出
129
      this.query.subjectNames = [];
f356590c   阿宝   即时测列表,分析页面
130
      await this._QueryClassList();
e5e4a3e6   梁保满   v1.3
131
132
133
      if (!this.query.classId) {
        return;
      }
f356590c   阿宝   即时测列表,分析页面
134
      await this._QuerySubjectList();
9309dc5d   梁保满   任课老师接口完成
135
      await this.setDate(1);
f356590c   阿宝   即时测列表,分析页面
136
137
138
139
140
141
      let startDay = this.query?.startDay;
      if (!startDay) {
        this.query.startDay = new Date();
        this.query.endDay = new Date();
      }
    },
079cb4cf   梁保满   即时测导出
142
  
f356590c   阿宝   即时测列表,分析页面
143
    methods: {
079cb4cf   梁保满   即时测导出
144
      handleCheckAllChangeClass(val) {
58744c8c   梁保满   即时测多班淡斑逻辑修改
145
146
        this.isIndeterminateClass = false;
        this.query.classId = val ? this.classList.map((item) => item.value) : [];
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
147
      },
079cb4cf   梁保满   即时测导出
148
      changeclass(value) {
58744c8c   梁保满   即时测多班淡斑逻辑修改
149
150
151
152
153
154
155
156
157
        console.log(value);
        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
158
      },
079cb4cf   梁保满   即时测导出
159
      handleCheckAllChangeSub(val) {
58744c8c   梁保满   即时测多班淡斑逻辑修改
160
        this.isIndeterminate = false;
079cb4cf   梁保满   即时测导出
161
        this.query.subjectNames = val ? this.subjectList : [];
e5e4a3e6   梁保满   v1.3
162
      },
079cb4cf   梁保满   即时测导出
163
      CheckedSub(value) {
58744c8c   梁保满   即时测多班淡斑逻辑修改
164
        console.log(value);
079cb4cf   梁保满   即时测导出
165
166
        let checkedCount = value.length;
        this.allSubject = checkedCount === this.subjectList.length;
58744c8c   梁保满   即时测多班淡斑逻辑修改
167
168
        this.isIndeterminate =
          checkedCount > 0 && checkedCount < this.subjectList.length;
8ea67428   梁保满   飞书bug
169
      },
f356590c   阿宝   即时测列表,分析页面
170
171
172
173
174
      setDate(index) {
        const that = this;
        this.date = index == this.date ? "" : index;
        let aYear = new Date().getFullYear();
        let aMonth = new Date().getMonth() + 1;
f356590c   阿宝   即时测列表,分析页面
175
176
177
178
        that.query.startDay = "";
        that.query.endDay = "";
        switch (index) {
          case 1:
f356590c   阿宝   即时测列表,分析页面
179
180
181
182
183
            let day = new Date().getDay();
            if (day == 0) {
              //中国式星期天是一周的最后一天
              day = 7;
            }
8ea67428   梁保满   飞书bug
184
            day--;
f356590c   阿宝   即时测列表,分析页面
185
186
187
188
            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   梁保满   即时测导出
189
          case 2:
f356590c   阿宝   即时测列表,分析页面
190
191
192
193
            aMonth = aMonth < 10 ? "0" + aMonth : aMonth;
            that.query.startDay = `${aYear}-${aMonth}-01`;
            that.query.endDay = formatDate(new Date(), "yyyy-MM-dd");
            break;
079cb4cf   梁保满   即时测导出
194
          case 3:
9309dc5d   梁保满   任课老师接口完成
195
            if (aMonth > 0 && aMonth < 4) {
e3b0e3e7   梁保满   季度时间格式调整
196
              aMonth = "1";
f356590c   阿宝   即时测列表,分析页面
197
            } else if (aMonth > 3 && aMonth < 7) {
e3b0e3e7   梁保满   季度时间格式调整
198
              aMonth = "4";
f356590c   阿宝   即时测列表,分析页面
199
            } else if (aMonth > 6 && aMonth < 10) {
e3b0e3e7   梁保满   季度时间格式调整
200
              aMonth = "7";
f356590c   阿宝   即时测列表,分析页面
201
202
203
204
205
206
207
208
209
210
            } 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   阿宝   即时测列表,分析页面
211
212
      },
      handleChangeTimeStart(val) {
f356590c   阿宝   即时测列表,分析页面
213
214
215
216
217
218
219
220
221
        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   阿宝   即时测列表,分析页面
222
        this.date = "";
079cb4cf   梁保满   即时测导出
223
        if (this.query.startDay && val) {
f356590c   阿宝   即时测列表,分析页面
224
225
226
227
228
229
          if (new Date(val).getTime() < new Date(this.query.startDay).getTime()) {
            this.$message.error("任务结束时间不能任务开始时间前面,请重新设置");
            this.query.endDay = "";
          }
        }
      },
f356590c   阿宝   即时测列表,分析页面
230
      async _QueryClassList() {
9309dc5d   梁保满   任课老师接口完成
231
232
        const fetchClassList =
          this.role == "ROLE_BANZHUREN"
58744c8c   梁保满   即时测多班淡斑逻辑修改
233
234
235
236
            ? this.$request.cTClassList
            : this.role == "ROLE_PERSONAL"
            ? this.$request.pClassList
            : this.$request.tClassList;
9309dc5d   梁保满   任课老师接口完成
237
        const { data, status, info } = await fetchClassList();
f356590c   阿宝   即时测列表,分析页面
238
239
240
241
        if (status === 0) {
          this.classList = data.list.map((item) => {
            return {
              value: item.classId,
45504a95   阿宝   即时测页面,以及小题修改答案
242
              label: item.className,
f356590c   阿宝   即时测列表,分析页面
243
244
            };
          });
b0cd2598   梁保满   fix:测试问题
245
246
247
248
249
250
251
252
253
          // 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   阿宝   即时测列表,分析页面
254
255
256
257
258
        } else {
          this.$message.error(info);
        }
      },
      async _QuerySubjectList() {
9309dc5d   梁保满   任课老师接口完成
259
260
        const fetchSubjectList =
          this.role == "ROLE_BANZHUREN"
58744c8c   梁保满   即时测多班淡斑逻辑修改
261
262
263
264
            ? this.$request.cTSubjectList
            : this.role == "ROLE_PERSONAL"
            ? this.$request.pSubjectList
            : this.$request.tSubjectList;
9309dc5d   梁保满   任课老师接口完成
265
  
58744c8c   梁保满   即时测多班淡斑逻辑修改
266
        let classIds = this.query.classId;
9309dc5d   梁保满   任课老师接口完成
267
        const { data, status, info } = await fetchSubjectList({
079cb4cf   梁保满   即时测导出
268
          classIds: classIds,
f356590c   阿宝   即时测列表,分析页面
269
270
        });
        if (status === 0) {
079cb4cf   梁保满   即时测导出
271
          this.subjectList = data.subjectNames || [];
58744c8c   梁保满   即时测多班淡斑逻辑修改
272
273
274
          this.subjectList.length
            ? this.query.subjectNames.push(this.subjectList[0])
            : "";
f356590c   阿宝   即时测列表,分析页面
275
276
277
278
        } else {
          this.$message.error(info);
        }
      },
079cb4cf   梁保满   即时测导出
279
280
281
282
  
      //回主页
      goHome() {
        this.$router.push({
58744c8c   梁保满   即时测多班淡斑逻辑修改
283
284
          path: "/index",
        });
f356590c   阿宝   即时测列表,分析页面
285
      },
079cb4cf   梁保满   即时测导出
286
287
      //去列表
      goList() {
58744c8c   梁保满   即时测多班淡斑逻辑修改
288
289
290
        if (this.query.classId.length == 0) {
          this.$message.warning("请选择班级!");
          return;
384a2a54   梁保满   请求头添加班主任信息,bug修改
291
        }
58744c8c   梁保满   即时测多班淡斑逻辑修改
292
293
294
295
296
        if (this.query.subjectNames.length == 0) {
          this.$message.warning("请选择科目!");
          return;
        }
        let query = { ...this.query };
079cb4cf   梁保满   即时测导出
297
        this.$router.push({
58744c8c   梁保满   即时测多班淡斑逻辑修改
298
          path: "/testList",
079cb4cf   梁保满   即时测导出
299
          query: {
58744c8c   梁保满   即时测多班淡斑逻辑修改
300
301
302
303
            params: JSON.stringify(query),
          },
        });
      },
f356590c   阿宝   即时测列表,分析页面
304
305
    },
  };
4c4f7640   梁保满   路由表,路由前端文件
306
  </script>
9309dc5d   梁保满   任课老师接口完成
307
308
309
310
311
  <style>
  div::-webkit-scrollbar {
    width: 3px;
    height: 10px;
  }
079cb4cf   梁保满   即时测导出
312
  
9309dc5d   梁保满   任课老师接口完成
313
314
315
316
317
  div::-webkit-scrollbar-thumb {
    border-radius: 10px;
    background-color: #ccc;
  }
  </style>
f356590c   阿宝   即时测列表,分析页面
318
  <style lang="scss" scoped>
079cb4cf   梁保满   即时测导出
319
  .main {
255e2506   梁保满   飞书bug及优化
320
    height: 100%;
58744c8c   梁保满   即时测多班淡斑逻辑修改
321
    background: rgba($color: #000000, $alpha: 0.3);
079cb4cf   梁保满   即时测导出
322
323
    display: flex;
    justify-content: center;
9309dc5d   梁保满   任课老师接口完成
324
  }
079cb4cf   梁保满   即时测导出
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
353
354
355
356
357
358
359
360
361
362
  
  .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   阿宝   即时测列表,分析页面
363
    }
079cb4cf   梁保满   即时测导出
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
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
  
    .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   阿宝   即时测列表,分析页面
453
    }
aed43d3a   阿宝   即时测修改答案
454
  }
4c4f7640   梁保满   路由表,路由前端文件
455
  </style>