Blame view

src/views/basic/setUp/archived.vue 13.1 KB
dc56294d   梁保满   班级分班
1
2
3
4
5
6
7
8
9
  <template>
    <div>
      <back-box>
        <template slot="title">
          <span>分班</span>
        </template>
      </back-box>
      <div class="page-content">
        <el-steps :active="step" align-center class="step">
6bca489d   LH_PC   云平台二期UI
10
11
          <el-step title="1 解散班级"></el-step>
          <el-step title="2 导入班级名单"></el-step>
dc56294d   梁保满   班级分班
12
          <el-step title="3 分班后任课老师"></el-step>
dc56294d   梁保满   班级分班
13
14
        </el-steps>
        <ul v-loading="loading">
6bca489d   LH_PC   云平台二期UI
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
          <li v-show="step == 0" style="padding:0px 200px;">
            <el-row class="row-subfix" style="margin-top: 20px;">
              <el-row class="row-subfix">
                <div class="row-line">
                  <span class="line-subfix">选择年级:</span>
                  <span class="line-value">
                    <el-select class="sel" v-model="grade" placeholder="选择年级" @change="changeGrade">
                      <el-option v-for="item in gradeList" :key="item.value" :label="item.label" :value="item.value">
                      </el-option>
                    </el-select>
                  </span>
                </div>
              </el-row>
              <el-row class="row-subfix" style="margin-top: 20px;">
                <span class="line-subfix" style="float: left;">选择班级:</span>
                <div class="row-line"
                  style="float: left;  background:rgb(245,247,250);padding:15px;width: calc(100% - 220px);  border-radius:5px;">
                  <span class="line-value" style="min-height: 300px;border-radius: 4px; background: rgb(247,247,250);">
                    <el-checkbox :indeterminate="isIndeterminate" v-model="checkAll"
                      @change="handleCheckAllChange">全选</el-checkbox>
                    <el-checkbox-group v-model="checkedClass" style="margin-top: 15px;">
                      <el-checkbox v-for="(item, index) in classList" :label="item.id" :key="item.id">
                        {{ item.className }}
                      </el-checkbox>
                    </el-checkbox-group>
                  </span>
                </div>
              </el-row>
            </el-row>
            <el-row class="row-subfix form-item" style="margin-top: 20px;">
              <span class="line-subfix" style="float: left;"> <i class="el-icon-warning" /></span>
              <div class="row-line" style="float: left; width: calc(100% - 220px);  border-radius:5px;">
                <div>请谨慎操作,班级归档后,学生解除班级关系且相关老师任课信息将不存在。</div>
                <div style="margin-top: 10px;opacity: 0.7;">如需保存解散前的班级名单与任课信息,可点击“保存名单”按钮。</div>
5cfb0264   梁保满   班级管理交互优化
49
              </div>
6bca489d   LH_PC   云平台二期UI
50
51
52
53
54
55
56
57
58
            </el-row>
            <div style="margin:0px auto;width: 30%;">
              <el-button style="background: rgb(218,225,235) ;color:black;border:none !important;"
                @click="toClazz">取消</el-button>
              <el-button type="primary" @click="_downNameList">保存名单</el-button>
              <el-popconfirm confirm-button-text="确定" cancel-button-text="取消" title="确定要将所选班级解散吗吗?"
                @confirm="_ClassArchiving">
                <el-button slot="reference" v-loading="loadingDown"
                  style="background: rgb(242,168,65) ;color:white;margin-left: 10px;border:none !important;">确定解散</el-button>
dc56294d   梁保满   班级分班
59
60
61
62
              </el-popconfirm>
            </div>
          </li>
          <li v-show="step == 1">
6bca489d   LH_PC   云平台二期UI
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
            <el-row class="row-subfix form-item">
              <div class="row-line" style="float: left;">
                <div>通过导入EXCEL文件方式添加班级名单,请按需求下载对应班级类型板并填写班级名单信息后,导入系统:</div>
                <div style="margin-top: 10px;opacity: 0.7;margin-left:20px;">
                  行政班定义:由固定学生、固定教室构成,由专门的班主任进行管理;
                </div>
                <div style="margin-top: 5px;opacity: 0.7;margin-left:20px;">
                  教学班定义:由不同行政班的学生临时组成,没有专门的班主任,是在选课制基础上,由于教学的需要而产生的。
                </div>
              </div>
            </el-row>
            <el-row class="row-subfix form-item" style="margin-top: 20px;">
              <el-button :icon="'el-icon-document'" @click="_downTemplate(0)">下载行政班名单模板</el-button>
              <el-button :icon="'el-icon-document'" @click="_downTemplate(1)">下载教学班名单模板</el-button>
            </el-row>
            <el-row class="row-subfix form-item" style="margin-top: 20px;">
              <upload id="downTeacher" drag :url="urlClazz"
                style="border:rgb(219,226,235) dashed 1px;width: 100%;padding:40px 0px;border-radius: 5px;"
                @upSuccess="upStudentSuccess" fileName="学生名单模板">
dc56294d   梁保满   班级分班
82
                <p class="down-txt" slot="down">
6bca489d   LH_PC   云平台二期UI
83
                  通过Excel名单导入学生名单模板
dc56294d   梁保满   班级分班
84
                </p>
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
85
              </upload>
6bca489d   LH_PC   云平台二期UI
86
            </el-row>
dc56294d   梁保满   班级分班
87
88
          </li>
          <li v-show="step == 2">
6bca489d   LH_PC   云平台二期UI
89
90
91
92
93
94
95
96
97
98
99
100
            <el-row class="row-subfix form-item">
              <div class="row-line" style="float: left;">
                <div>通过导入EXCEL文件方式添加教师任课信息,请按需求下载板并填写任课信息后,导入系统:</div>
              </div>
            </el-row>
            <el-row class="row-subfix form-item" style="margin-top: 20px;">
              <el-button :icon="'el-icon-document'" @click="_downTemplate(2)">下载任课信息模板</el-button>
            </el-row>
            <el-row class="row-subfix form-item" style="margin-top: 20px;">
              <upload id="downTeacher" drag :url="urlTeacher"
                style="border:rgb(219,226,235) dashed 1px;width: 100%;padding:40px 0px;border-radius: 5px;"
                @upSuccess="upTeacherSuccess" fileName="任课老师名单模板">
dc56294d   梁保满   班级分班
101
                <p class="down-txt" slot="down">
6bca489d   LH_PC   云平台二期UI
102
                  通过Excel名单导入任课老师名单模板
dc56294d   梁保满   班级分班
103
                </p>
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
104
              </upload>
6bca489d   LH_PC   云平台二期UI
105
            </el-row>
dc56294d   梁保满   班级分班
106
          </li>
dc56294d   梁保满   班级分班
107
108
109
          <li v-show="step != 0">
            <div class="btn-box">
              <el-button class="btn" round @click="step -= 1">上一步</el-button>
6bca489d   LH_PC   云平台二期UI
110
111
              <el-button v-show="step != 2" class="btn" type="primary" round @click="step += 1">下一步</el-button><el-button
                v-show="step == 2" class="btn" type="primary" round @click="toClazz">完成</el-button>
dc56294d   梁保满   班级分班
112
113
114
115
116
117
118
119
            </div>
          </li>
        </ul>
      </div>
    </div>
  </template>
  
  <script>
d4b9eb45   梁保满   设备异常信息
120
  import { downloadFile } from "utils";
dc56294d   梁保满   班级分班
121
122
123
124
125
  export default {
    data() {
      return {
        loading: false,
        loadingClass: false,
d4b9eb45   梁保满   设备异常信息
126
        loadingDown: false,
b8827a72   梁保满   测试bug
127
        step: 0,
d059a9d1   梁保满   接口调整
128
        grade: "",
dc56294d   梁保满   班级分班
129
        gradeList: [],
6bca489d   LH_PC   云平台二期UI
130
131
        checkAll: false,
        checkedClass: [],
dc56294d   梁保满   班级分班
132
        classList: [],
ea4f5fc9   梁保满   班级归档,学生名单上船地址
133
        urlClazz: "/api_html/school/manager/importClassAndStudent",
0761e2ba   梁保满   分班和学校管理调整
134
        urlTeacher: "/api_html/school/manager/importTeacher",
6bca489d   LH_PC   云平台二期UI
135
        isIndeterminate: true
dc56294d   梁保满   班级分班
136
137
      };
    },
6bca489d   LH_PC   云平台二期UI
138
139
140
141
142
143
    watch: {
      checkedClass(value) {
        this.checkAll = value.length == this.classList.length;
        this.isIndeterminate = value.length > 0 && value.length < this.classList.length;
      }
    },
dc56294d   梁保满   班级分班
144
145
146
147
    created() {
      this._QueryDataGrade();
    },
    methods: {
6bca489d   LH_PC   云平台二期UI
148
149
150
151
152
153
      async _downNameList() {
        this.loadingDown = true;
        await this.downStudentExcel();
        await this.downTeacherExcel();
        this.loadingDown = false;
      },
5cfb0264   梁保满   班级管理交互优化
154
      handleCheckAllChange(val) {
6bca489d   LH_PC   云平台二期UI
155
156
        if (val) this.checkedClass = this.classList.map(item => item.id);
        else this.checkedClass = [];
5cfb0264   梁保满   班级管理交互优化
157
      },
6bca489d   LH_PC   云平台二期UI
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
      async _downTemplate(type) {
  
        var template = type == 0 ? this.$request.classAndStudentTemplate : this.$request.tClassAndStudentTemplate;
  
        if (type == 2) template = await this.$request.teacherTemplate;
        console.log(type)
        let data = await template();
  
        if (data && !data.code) {
  
          let blob = new Blob([data], {
            type: "application/vnd.ms-excel;charset=utf-8",
          });
  
          downloadFile(type == 2 ? "教师任课信息" : type == 0 ? "行政班名单模板" : "教学班名单模板", blob);
        }
        else {
          this.$message.error(data.info);
        }
        // const classAndStudentTemplate =
        //   type == 0
        //     ? this.$request.classAndStudentTemplate ? type == 2 :
        //       await this.$request.teacherTemplate()
        //     : this.$request.tClassAndStudentTemplate;
        // let data = await classAndStudentTemplate();
        // if (data && !data.code) {
        //   let blob = new Blob([data], {
        //     type: "application/vnd.ms-excel;charset=utf-8",
        //   });
        //   downloadFile(type == 0 ? type == 2 ? "教师任课信息模板" : "行政班名单模板" : "教学班名单模板", blob);
        // } else {
        //   this.$message.error(data.info);
        // }
5cfb0264   梁保满   班级管理交互优化
191
      },
dc56294d   梁保满   班级分班
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
      toClazz() {
        this.$router.push({
          path: "/setUpClazz",
        });
      },
      //切换年级
      changeGrade() {
        this._QueryClass();
      },
      //学生名单上传成功回调
      upStudentSuccess(res) {
        this.$message.closeAll();
        this.$message({
          showClose: true,
          message: `成功(${res.data.success})`,
          type: "success",
          duration: 10000,
        });
      },
      //任课老师名单上传成功回调
      upTeacherSuccess(res) {
        this.$message.closeAll();
        this.$message({
          showClose: true,
          message: `成功(${res.data.success})`,
          type: "success",
          duration: 10000,
        });
      },
      //导出学生名单
      async downStudentExcel() {
6bca489d   LH_PC   云平台二期UI
223
224
225
226
227
  
        const exportClassAndStudent = this.$request.exportClassAndStudent;
  
        let data = await exportClassAndStudent();
  
d4b9eb45   梁保满   设备异常信息
228
229
        if (data) {
          let blob = new Blob([data], {
6bca489d   LH_PC   云平台二期UI
230
            type: "application/vnd.ms-excel;charset=utf-8",
d4b9eb45   梁保满   设备异常信息
231
          });
6bca489d   LH_PC   云平台二期UI
232
          downloadFile(`班级名单.xlsx`, blob);
dc56294d   梁保满   班级分班
233
        } else {
d4b9eb45   梁保满   设备异常信息
234
          this.$message.error("下载失败");
dc56294d   梁保满   班级分班
235
236
237
238
        }
      },
      //导出任课老师名单
      async downTeacherExcel() {
6bca489d   LH_PC   云平台二期UI
239
240
241
  
        let data = await this.$request.exportTeacher();
  
d4b9eb45   梁保满   设备异常信息
242
243
        if (data) {
          let blob = new Blob([data], {
6bca489d   LH_PC   云平台二期UI
244
            type: "application/vnd.ms-excel;charset=utf-8",
d4b9eb45   梁保满   设备异常信息
245
          });
6bca489d   LH_PC   云平台二期UI
246
          downloadFile(`教师名单.xlsx`, blob);
dc56294d   梁保满   班级分班
247
        } else {
d4b9eb45   梁保满   设备异常信息
248
          this.$message.error("下载失败");
dc56294d   梁保满   班级分班
249
        }
6bca489d   LH_PC   云平台二期UI
250
251
252
253
254
255
256
257
258
259
        // let data = await this.$request.exportNoClassTeacher();
  
        // if (data) {
        //   let blob = new Blob([data], {
        //     type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
        //   });
        //   downloadFile("未分配教师 名单.xlsx", blob);
        // } else {
        //   this.$message.error("下载失败");
        // }
dc56294d   梁保满   班级分班
260
261
262
      },
      //班级归档
      async _ClassArchiving() {
6bca489d   LH_PC   云平台二期UI
263
        if (!this.checkedClass.length) {
dc56294d   梁保满   班级分班
264
265
266
267
268
          this.$message.warning("班级不能为空,请选择班级~");
          return;
        }
        this.loading = true;
        const { status, info } = await this.$request.classArchiving({
6bca489d   LH_PC   云平台二期UI
269
          classIds: [...this.checkedClass],
dc56294d   梁保满   班级分班
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
        });
        this.loading = false;
        if (status === 0) {
          this.$message.success("班级归档成功!");
          this.step = 1;
          this._QueryDataGrade();
        } else {
          this.$message.error(info);
        }
      },
      //年级列表
      async _QueryDataGrade() {
        const { data, status, info } = await this.$request.gradeList();
        if (status === 0) {
          this.gradeList =
            data.list?.map((item) => {
              return {
d059a9d1   梁保满   接口调整
287
                value: item.grade,
dc56294d   梁保满   班级分班
288
289
290
                label: item.gradeName,
              };
            }) || [];
d059a9d1   梁保满   接口调整
291
          this.grade = this.gradeList[0]?.value;
dc56294d   梁保满   班级分班
292
293
294
295
296
297
298
299
300
301
          this._QueryClass();
        } else {
          this.$message.error(info);
        }
      },
      //班级列表
      async _QueryClass() {
        this.classList = [];
        this.loadingClass = true;
        const { data, status, info } = await this.$request.schoolClassList({
d059a9d1   梁保满   接口调整
302
          grade: this.grade,
6bca489d   LH_PC   云平台二期UI
303
          type: 0
dc56294d   梁保满   班级分班
304
305
306
        });
        this.loadingClass = false;
        if (status === 0) {
82b9014a   梁保满   交互调整
307
          this.classList = (data.list && [...data.list]) || [];
6bca489d   LH_PC   云平台二期UI
308
          this.checkedClass = this.classList.map(item => item.id);
dc56294d   梁保满   班级分班
309
310
311
312
313
314
315
316
317
318
319
320
321
322
        } else {
          this.$message.error(info);
        }
      },
    },
  };
  </script>
  
  <style lang="scss" scoped>
  .page-content {
    width: 100%;
    padding: 20px;
    box-sizing: border-box;
  }
352c53cc   梁保满   上传word回传数据
323
  
dc56294d   梁保满   班级分班
324
325
326
  .step {
    margin-bottom: 40px;
  }
352c53cc   梁保满   上传word回传数据
327
  
dc56294d   梁保满   班级分班
328
329
330
331
  .form-item {
    width: 70%;
    display: flex;
    margin: 0 auto 20px;
352c53cc   梁保满   上传word回传数据
332
  
5cfb0264   梁保满   班级管理交互优化
333
334
335
    .check-box {
      flex: 1;
    }
352c53cc   梁保满   上传word回传数据
336
  
5cfb0264   梁保满   班级管理交互优化
337
338
339
    .all-check {
      margin-right: 30px;
    }
352c53cc   梁保满   上传word回传数据
340
  
dc56294d   梁保满   班级分班
341
342
343
344
345
    &:first-of-type {
      .s-txt {
        line-height: 40px;
      }
    }
352c53cc   梁保满   上传word回传数据
346
  
dc56294d   梁保满   班级分班
347
348
349
350
    .s-txt {
      width: 160px;
      flex-shrink: 0;
    }
352c53cc   梁保满   上传word回传数据
351
  
dc56294d   梁保满   班级分班
352
353
354
355
356
    .sel {
      :deep(.el-input__inner) {
        border-radius: 20px;
      }
    }
352c53cc   梁保满   上传word回传数据
357
  
dc56294d   梁保满   班级分班
358
359
360
    :deep(.el-checkbox) {
      margin-bottom: 12px;
    }
352c53cc   梁保满   上传word回传数据
361
  
dc56294d   梁保满   班级分班
362
363
364
365
366
    .tips {
      display: flex;
      align-items: center;
      color: #666;
    }
352c53cc   梁保满   上传word回传数据
367
  
dc56294d   梁保满   班级分班
368
369
370
371
372
373
    .el-icon-warning {
      font-size: 20px;
      color: #ec7f8c;
      margin-right: 10px;
    }
  }
352c53cc   梁保满   上传word回传数据
374
  
dc56294d   梁保满   班级分班
375
376
377
378
379
  .btn-box {
    width: 80%;
    margin: 60px auto 0;
    display: flex;
    justify-content: flex-end;
352c53cc   梁保满   上传word回传数据
380
  
dc56294d   梁保满   班级分班
381
382
383
384
    .btn {
      margin: 0 10px;
    }
  }
352c53cc   梁保满   上传word回传数据
385
  
dc56294d   梁保满   班级分班
386
387
388
  .step-item {
    text-align: center;
  }
352c53cc   梁保满   上传word回传数据
389
  
dc56294d   梁保满   班级分班
390
391
392
393
394
395
396
  .step-item2 {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #000;
    font-weight: 500;
352c53cc   梁保满   上传word回传数据
397
  
dc56294d   梁保满   班级分班
398
399
400
    .p2 {
      font-size: 16px;
      margin: 0 0 20px -68px;
352c53cc   梁保满   上传word回传数据
401
  
dc56294d   梁保满   班级分班
402
403
404
405
      .btn {
        margin-right: 14px;
      }
    }
352c53cc   梁保满   上传word回传数据
406
  
dc56294d   梁保满   班级分班
407
408
409
410
411
412
    .p1 {
      width: 450px;
      text-align: left;
      margin-bottom: 20px;
    }
  }
352c53cc   梁保满   上传word回传数据
413
  
dc56294d   梁保满   班级分班
414
415
416
417
418
  :deep(.down-txt) {
    justify-content: center;
    padding-left: 0;
  }
  </style>