Blame view

src/views/standard/setUp/archived.vue 9.53 KB
dc56294d   梁保满   班级分班
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
  <template>
    <div>
      <back-box>
        <template slot="title">
          <span>分班</span>
        </template>
      </back-box>
      <div class="page-content">
        <el-steps :active="step" align-center class="step">
          <el-step title="1 班级归档"></el-step>
          <el-step title="2 分班后学生名单"></el-step>
          <el-step title="3 分班后任课老师"></el-step>
          <el-step title="4 授课端指引"></el-step>
        </el-steps>
        <ul v-loading="loading">
          <li v-show="step == 0">
            <div class="form-item">
              <span class="s-txt">选择分班年级:</span>
              <el-select
                class="sel"
                v-model="gradeName"
                placeholder="选择年级"
                @change="changeGrade"
              >
                <el-option
                  v-for="item in gradeList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
                <el-option label="未分配" :value="80"></el-option>
                <el-option label="已毕业" :value="81"></el-option>
              </el-select>
            </div>
            <div class="form-item">
              <span class="s-txt">确定班级:</span>
              <i class="el-icon-loading" v-show="loadingClass"></i>
              <el-checkbox-group v-model="classIds">
                <el-checkbox v-for="item in classList" :label="item.id">{{
                  item.className
                }}</el-checkbox>
              </el-checkbox-group>
            </div>
            <div class="form-item">
              <span class="s-txt"></span>
              <p class="tips">
                <i class="el-icon-warning"></i
                >请谨慎操作,班级归档后,学生解除班级关系且相关老师任课信息将不存在。
              </p>
            </div>
            <div class="btn-box">
              <el-button class="btn" round @click="classIds = []">取消</el-button>
              <el-popconfirm
                confirm-button-text="确定"
                cancel-button-text="取消"
                icon="el-icon-info"
                icon-color="red"
                title="确定要将所选班级归档吗?"
                @confirm="_ClassArchiving"
              >
                <el-button class="btn" slot="reference" type="primary" round
                  >归档</el-button
                >
              </el-popconfirm>
            </div>
          </li>
          <li v-show="step == 1">
            <div class="step-item">
              <up-load
                id="downTeacher"
0761e2ba   梁保满   分班和学校管理调整
72
                :url="urlClazz"
dc56294d   梁保满   班级分班
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
                @upSuccess="upStudentSuccess"
                fileName="学生名单模板"
              >
                <p class="down-txt" slot="down">
                  通过Excel名单导入学生名单模板,点击
                  <el-link type="primary" @click="downStudentExcel"
                    >导出未分配学生</el-link
                  >
  
                </p>
              </up-load>
            </div>
          </li>
          <li v-show="step == 2">
            <div class="step-item">
              <up-load
                id="downTeacher"
                :url="urlTeacher"
                @upSuccess="upTeacherSuccess"
                fileName="任课老师名单模板"
              >
                <p class="down-txt" slot="down">
                  通过Excel名单导入任课老师名单模板,点击
                  <el-link type="primary" @click="downTeacherExcel"
d4b9eb45   梁保满   设备异常信息
97
98
                    >导出未分配教师</el-link
                  >。
dc56294d   梁保满   班级分班
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
                </p>
              </up-load>
            </div>
          </li>
          <li v-show="step == 3">
            <div class="step-item2">
              <p class="p2">
                <el-button
                  class="btn"
                  type="success"
                  icon="el-icon-check"
                  circle
                  size="small"
                ></el-button
                >恭喜您,分班已经完成,分班后老师第一次上课时注意事项:
              </p>
              <p class="p1">
                1、点击授课端的设置—应用设置—初始化设置—重新选择绑定班级。
              </p>
              <p class="p1">
                2、点击授课端的设置—班级名册—基站登录—学生完成基站绑定。
              </p>
            </div>
          </li>
  
          <li v-show="step != 0">
            <div class="btn-box">
              <el-button class="btn" round @click="step -= 1">上一步</el-button>
              <el-button
                v-show="step != 3"
                class="btn"
                type="primary"
                round
                @click="step += 1"
                >下一步</el-button
              ><el-button
                v-show="step == 3"
                class="btn"
                type="primary"
                round
                @click="toClazz"
                >完成</el-button
              >
            </div>
          </li>
        </ul>
      </div>
    </div>
  </template>
  
  <script>
d4b9eb45   梁保满   设备异常信息
150
  import { downloadFile } from "utils";
dc56294d   梁保满   班级分班
151
152
153
154
155
  export default {
    data() {
      return {
        loading: false,
        loadingClass: false,
d4b9eb45   梁保满   设备异常信息
156
157
        loadingDown: false,
        step: 1,
dc56294d   梁保满   班级分班
158
159
160
161
        gradeName: "",
        gradeList: [],
        classIds: [],
        classList: [],
0761e2ba   梁保满   分班和学校管理调整
162
163
        urlClazz: "/api_html/school/manager/importClazzClicker",
        urlTeacher: "/api_html/school/manager/importTeacher",
dc56294d   梁保满   班级分班
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
191
192
193
194
195
196
197
198
199
200
201
      };
    },
    created() {
      this._QueryDataGrade();
    },
    methods: {
      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() {
        this.loadingDown = true;
d4b9eb45   梁保满   设备异常信息
202
        let data = await this.$request.exportNoClassStudent();
dc56294d   梁保满   班级分班
203
        this.loadingDown = false;
d4b9eb45   梁保满   设备异常信息
204
205
206
207
208
        if (data) {
          let blob = new Blob([data], {
            type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
          });
          downloadFile("未分配学生名单.xlsx", blob);
dc56294d   梁保满   班级分班
209
        } else {
d4b9eb45   梁保满   设备异常信息
210
          this.$message.error("下载失败");
dc56294d   梁保满   班级分班
211
212
213
214
215
        }
      },
      //导出任课老师名单
      async downTeacherExcel() {
        this.loadingDown = true;
d4b9eb45   梁保满   设备异常信息
216
        let data = await this.$request.exportNoClassTeacher();
dc56294d   梁保满   班级分班
217
        this.loadingDown = false;
d4b9eb45   梁保满   设备异常信息
218
219
220
221
222
        if (data) {
          let blob = new Blob([data], {
            type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
          });
          downloadFile("未分配教师 名单.xlsx", blob);
dc56294d   梁保满   班级分班
223
        } else {
d4b9eb45   梁保满   设备异常信息
224
          this.$message.error("下载失败");
dc56294d   梁保满   班级分班
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
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
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
        }
      },
      //班级归档
      async _ClassArchiving() {
        if (!this.classIds.length) {
          this.$message.warning("班级不能为空,请选择班级~");
          return;
        }
        this.loading = true;
        const { status, info } = await this.$request.classArchiving({
          classIds: [...this.classIds],
        });
        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 {
                value: item.gradeName,
                label: item.gradeName,
              };
            }) || [];
          this.gradeName = this.gradeList[0]?.value;
          this._QueryClass();
        } else {
          this.$message.error(info);
        }
      },
      //班级列表
      async _QueryClass() {
        this.classList = [];
        this.loadingClass = true;
        const { data, status, info } = await this.$request.schoolClassList({
          gradeName: this.gradeName,
        });
        this.loadingClass = false;
        if (status === 0) {
          this.classList = [...data.list] || [];
          this.classIds = [];
        } else {
          this.$message.error(info);
        }
      },
    },
  };
  </script>
  
  <style lang="scss" scoped>
  .page-content {
    width: 100%;
    padding: 20px;
    box-sizing: border-box;
  }
  .step {
    margin-bottom: 40px;
  }
  .form-item {
    width: 70%;
    display: flex;
    margin: 0 auto 20px;
    &:first-of-type {
      .s-txt {
        line-height: 40px;
      }
    }
    .s-txt {
      width: 160px;
      flex-shrink: 0;
    }
    .sel {
      :deep(.el-input__inner) {
        border-radius: 20px;
      }
    }
    :deep(.el-checkbox) {
      margin-bottom: 12px;
    }
    .tips {
      display: flex;
      align-items: center;
      color: #666;
    }
    .el-icon-warning {
      font-size: 20px;
      color: #ec7f8c;
      margin-right: 10px;
    }
  }
  .btn-box {
    width: 80%;
    margin: 60px auto 0;
    display: flex;
    justify-content: flex-end;
    .btn {
      margin: 0 10px;
    }
  }
  .step-item {
    text-align: center;
  }
  .step-item2 {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #000;
    font-weight: 500;
    .p2 {
      font-size: 16px;
      margin: 0 0 20px -68px;
      .btn {
        margin-right: 14px;
      }
    }
    .p1 {
      width: 450px;
      text-align: left;
      margin-bottom: 20px;
    }
  }
  :deep(.down-txt) {
    justify-content: center;
    padding-left: 0;
  }
  </style>