Blame view

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