Blame view

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