Blame view

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