Blame view

src/views/setUp/teacher.vue 23.3 KB
4c4f7640   梁保满   路由表,路由前端文件
1
  <template>
23a6dc5f   阿宝   学校管理相关接口简单对接
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
    <div>
      <back-box>
        <template slot="title">
          <span>教师管理</span>
        </template>
        <template slot="btns">
          <el-tooltip effect="dark" content="导入教师名单" placement="bottom">
            <el-button
              type="primary"
              icon="el-icon-upload2"
              size="mini"
              plain
              circle
              @click="diaUp = true"
            ></el-button>
          </el-tooltip>
          <el-tooltip effect="dark" content="添加教师" placement="bottom">
            <el-button
              type="primary"
              icon="el-icon-plus"
              size="mini"
              plain
              circle
bb4c8454   阿宝   添加,修改教师
25
              @click="addTeacherDia"
23a6dc5f   阿宝   学校管理相关接口简单对接
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
            ></el-button>
          </el-tooltip>
        </template>
      </back-box>
  
      <div class="answer-header">
        <div class="sel-box">
          <el-select
            class="sel"
            v-model="query.gradeName"
            placeholder="选择年级"
            @change="_QueryData(1)"
          >
            <el-option
              v-for="item in gradeList"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
          <el-input
            placeholder="请输入老师姓名"
            v-model="query.teacherName"
            class="input-with-select"
            @keyup.enter.native="_QueryData(2)"
          >
            <el-button
              slot="append"
              icon="el-icon-search"
              @click="_QueryData(2)"
            ></el-button>
          </el-input>
          <el-input
            type="number"
            placeholder="请输入老师手机号"
            v-model="query.phone"
            class="input-with-select"
            @keyup.enter.native="_QueryData(3)"
          >
            <el-button
              slot="append"
              icon="el-icon-search"
              @click="_QueryData(3)"
            ></el-button>
          </el-input>
        </div>
      </div>
      <div class="page-content">
        <el-empty
          :image-size="100"
          v-if="!teacherList.length && loading == false"
          description="没有更多数据"
        ></el-empty>
        <div class="teacher-box" v-loading="loading" v-else>
          <div class="teacher-list">
            <p class="h-title">教师列表</p>
            <ul class="teacher-ul">
              <li
                class="teacher-item"
                v-for="item in teacherList"
                :key="item.id"
                :class="showTId == item.id ? 'active' : ''"
                @click="showTeacher(item)"
              >
                {{ item.realName }}({{ setClass(item) }})
              </li>
            </ul>
          </div>
          <div class="teacher-detail">
            <div class="icon-box">
0a4de034   阿宝   教师管理,学生管理班级设置
97
98
99
100
101
              <i class="icon el-icon-edit-outline" @click="editTeacher(1)"></i>
              <i
                class="icon el-icon-circle-plus-outline"
                @click="editTeacher(2)"
              ></i>
23a6dc5f   阿宝   学校管理相关接口简单对接
102
103
104
105
            </div>
            <div class="detail-top">
              <p class="p-item">手机号码:{{ teacherDetail.loginName }}</p>
              <p class="p-item">
560c12f2   阿宝   学校设置,软件下载
106
                状态:{{ teacherDetail.available == 1 ? "不可用" : "正常" }}
23a6dc5f   阿宝   学校管理相关接口简单对接
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
              </p>
              <p class="p-item">
                性别:{{
                  teacherDetail.sex == 1
                    ? "男"
                    : teacherDetail.sex == 2
                    ? "女"
                    : "未知"
                }}
              </p>
            </div>
            <div
              class="grade-box"
              v-if="teacherDetail.managerList && teacherDetail.managerList.length"
            >
              <p class="h-title">班主任</p>
              <ul class="grade-info">
                <li
                  class="grade-li"
                  v-for="item in teacherDetail.managerList"
                  :key="item.classId"
                >
bb4c8454   阿宝   添加,修改教师
129
130
131
                  <el-popconfirm title="确定删除吗?" confirm="">
                    <i class="el-icon-delete" slot="reference"></i>
                  </el-popconfirm>
23a6dc5f   阿宝   学校管理相关接口简单对接
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
                  <div class="grade-item">
                    <p class="grade-name">{{ item.className }}</p>
                    <div class="grade-class">
                      <p>
                        <i class="fa fa-address-book-o"></i>学生:{{
                          item.studentCount
                        }}个
                      </p>
                    </div>
                  </div>
                </li>
              </ul>
            </div>
            <div
              class="grade-box"
              v-if="
                teacherDetail.teacherCourseList &&
                teacherDetail.teacherCourseList.length
              "
            >
              <p class="h-title">任课老师</p>
              <ul class="grade-info">
                <li
                  class="grade-li"
                  v-for="item in teacherDetail.teacherCourseList"
                  :key="item.classId"
                >
bb4c8454   阿宝   添加,修改教师
159
160
161
                  <el-popconfirm title="确定删除吗?" confirm="">
                    <i class="el-icon-delete" slot="reference"></i>
                  </el-popconfirm>
23a6dc5f   阿宝   学校管理相关接口简单对接
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
                  <div class="grade-item">
                    <p class="grade-name">
                      {{ item.className }}({{ item.subjectName }})
                    </p>
                    <div class="grade-class">
                      <p>
                        <i class="fa fa-address-book-o"></i>学生:{{
                          item.studentCount
                        }}个
                      </p>
                    </div>
                  </div>
                </li>
              </ul>
            </div>
            <div
              class="grade-box"
              v-if="
                teacherDetail.teacherGradeList &&
                teacherDetail.teacherGradeList.length
              "
            >
              <p class="h-title">备课组长</p>
              <ul
                class="grade-info"
                v-for="item in teacherDetail.teacherGradeList"
                :key="item.grade"
              >
                <li class="grade-li">
bb4c8454   阿宝   添加,修改教师
191
192
193
                  <el-popconfirm title="确定删除吗?" confirm="">
                    <i class="el-icon-delete" slot="reference"></i>
                  </el-popconfirm>
23a6dc5f   阿宝   学校管理相关接口简单对接
194
195
196
197
198
199
200
201
202
203
204
                  <div class="grade-item">
                    <p class="grade-name">
                      {{ item.gradeName }}({{ item.subjectName }})
                    </p>
                  </div>
                </li>
              </ul>
            </div>
          </div>
        </div>
      </div>
bb4c8454   阿宝   添加,修改教师
205
      <el-dialog title="导入教师名单" :visible.sync="diaUp" width="600">
23a6dc5f   阿宝   学校管理相关接口简单对接
206
207
208
209
210
211
212
213
214
215
        <up-load id="downTeacher" :url="url" fileName="教师名单">
          <p class="down-txt" slot="down">
            通过Excel名单导入教师名单,点击
            <el-link type="danger" @click="downExcel">模板下载</el-link> 。
          </p>
        </up-load>
        <div class="dialog-footer" slot="footer">
          <el-button @click="diaUp = false">取 消</el-button>
        </div>
      </el-dialog>
0a4de034   阿宝   教师管理,学生管理班级设置
216
217
218
219
220
      <el-dialog
        :title="isAdd ? '添加教师' : setTercherType==1?'编辑教师信息':'管理班级'"
        :visible.sync="diaTeacher"
        width="400"
      >
dd5150c5   阿宝   数据同步
221
222
        <el-form
          class="form-box"
bb4c8454   阿宝   添加,修改教师
223
          ref="formTeacher"
dd5150c5   阿宝   数据同步
224
225
226
227
          :model="formTeacher"
          :rules="rulesTeacher"
          label-width="160px"
        >
a37317f4   阿宝   使用分析,发卡记录
228
         <el-form-item v-show="!isAdd && setTercherType == 2" label="教师姓名:">
0a4de034   阿宝   教师管理,学生管理班级设置
229
230
231
232
233
234
235
            <span>{{formTeacher.teacherName}}</span>
          </el-form-item>
          <el-form-item
            v-show="isAdd || (!isAdd && setTercherType == 1)"
            label="手机号码:"
            prop="loginName"
          >
dd5150c5   阿宝   数据同步
236
            <el-col :span="10">
bb4c8454   阿宝   添加,修改教师
237
              <el-input maxlength="11" v-model.trim="formTeacher.loginName" />
dd5150c5   阿宝   数据同步
238
239
            </el-col>
          </el-form-item>
0a4de034   阿宝   教师管理,学生管理班级设置
240
          <el-form-item v-show="isAdd || (!isAdd && setTercherType == 1)" label="教师姓名:" prop="teacherName">
dd5150c5   阿宝   数据同步
241
242
243
244
            <el-col :span="10">
              <el-input maxlength="30" v-model.trim="formTeacher.teacherName" />
            </el-col>
          </el-form-item>
0a4de034   阿宝   教师管理,学生管理班级设置
245
          <el-form-item v-show="isAdd || (!isAdd && setTercherType == 1)" label="性别:" prop="sex">
dd5150c5   阿宝   数据同步
246
247
248
249
250
            <el-radio-group v-model="formTeacher.sex">
              <el-radio :label="1">男</el-radio>
              <el-radio :label="2">女</el-radio>
            </el-radio-group>
          </el-form-item>
0a4de034   阿宝   教师管理,学生管理班级设置
251
          <el-form-item v-show="isAdd || (!isAdd && setTercherType == 2)" label="教师角色:" prop="roleList">
bb4c8454   阿宝   添加,修改教师
252
253
254
255
256
257
258
259
260
261
262
263
            <div
              class="role-list"
              v-for="(item, index) in formTeacher.roleList"
              :key="item.id"
            >
              <el-select
                class="sel-c"
                v-model="item.roleId"
                placeholder="选择角色"
                @change="item.classId = []"
              >
                <el-option
0a4de034   阿宝   教师管理,学生管理班级设置
264
                  v-for="item in teacherRoleList"
bb4c8454   阿宝   添加,修改教师
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
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
              <el-cascader
                v-if="item.roleId == 6"
                class="sel-t"
                collapse
                clearable
                placeholder="选择班级"
                v-model="item.classId"
                :options="gradeClassList"
                :props="{ expandTrigger: 'hover' }"
              ></el-cascader>
              <el-cascader
                v-if="item.roleId == 7"
                class="sel-t"
                collapse
                clearable
                placeholder="选择班级-科目"
                v-model="item.classId"
                :options="classList"
                :props="{ expandTrigger: 'hover' }"
              ></el-cascader>
              <el-cascader
                v-if="item.roleId == 8"
                class="sel-t"
                collapse
                clearable
                placeholder="选择年级-科目"
                v-model="item.classId"
                :options="gradeSubList"
                :props="{ expandTrigger: 'hover' }"
              ></el-cascader>
              <i class="el-icon-close" @click="removeRoleList(index)"></i>
            </div>
            <p class="add-box">
              <el-button icon="el-icon-plus" @click="addRoleList">添加</el-button>
            </p>
dd5150c5   阿宝   数据同步
306
307
308
          </el-form-item>
        </el-form>
        <div class="dialog-footer" slot="footer">
0a4de034   阿宝   教师管理,学生管理班级设置
309
          <el-button type="primary" @click="addTeacher">确 定</el-button>
dd5150c5   阿宝   数据同步
310
311
312
          <el-button @click="diaTeacher = false">取 消</el-button>
        </div>
      </el-dialog>
23a6dc5f   阿宝   学校管理相关接口简单对接
313
    </div>
4c4f7640   梁保满   路由表,路由前端文件
314
315
316
  </template>
  
  <script>
bb4c8454   阿宝   添加,修改教师
317
  import { downloadFile, formatGradeClass, randomWord } from "@/utils";
4c4f7640   梁保满   路由表,路由前端文件
318
  export default {
23a6dc5f   阿宝   学校管理相关接口简单对接
319
320
    data() {
      return {
dd5150c5   阿宝   数据同步
321
        loading: false,
23a6dc5f   阿宝   学校管理相关接口简单对接
322
323
        url: "",
        diaUp: false,
bb4c8454   阿宝   添加,修改教师
324
325
        diaTeacher: false,
        isAdd: false,
0a4de034   阿宝   教师管理,学生管理班级设置
326
        setTercherType: 1,
23a6dc5f   阿宝   学校管理相关接口简单对接
327
328
329
330
331
        query: {
          gradeName: "",
          teacherName: "",
          phone: "",
        },
bb4c8454   阿宝   添加,修改教师
332
        subjectList: [],
23a6dc5f   阿宝   学校管理相关接口简单对接
333
        gradeList: [],
bb4c8454   阿宝   添加,修改教师
334
335
336
        classList: [],
        gradeClassList: [],
        gradeSubList: [],
dd5150c5   阿宝   数据同步
337
        teacherList: [],
0a4de034   阿宝   教师管理,学生管理班级设置
338
339
        teacherRoleList: [
          //角色
bb4c8454   阿宝   添加,修改教师
340
341
342
343
344
345
346
347
348
349
350
351
352
          {
            value: 6,
            label: "班主任",
          },
          {
            value: 7,
            label: "任课老师",
          },
          {
            value: 8,
            label: "备课组长",
          },
        ],
23a6dc5f   阿宝   学校管理相关接口简单对接
353
354
355
356
357
358
359
360
361
362
        teacherDetail: {
          teacherName: "",
          loginName: "",
          sex: "",
          available: "",
          managerList: [],
          teacherCourseList: [],
          teacherGradeList: [],
        },
        showTId: "", //显示详情 教师ID
bb4c8454   阿宝   添加,修改教师
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
        roleList: [],
        formTeacher: {
          teacherName: "",
          loginName: "",
          sex: 1,
          roleList: [],
        },
        rulesTeacher: {
          teacherName: [
            { required: true, message: "请输入联系电话", trigger: "blur" },
          ],
          loginName: [
            { required: true, message: "请输入教师姓名", trigger: "blur" },
          ],
          sex: [{ required: true, message: "请选择性别", trigger: "blur" }],
          roleList: [
            { required: true, message: "请选择角色信息", trigger: "blur" },
          ],
dd5150c5   阿宝   数据同步
381
        },
23a6dc5f   阿宝   学校管理相关接口简单对接
382
383
384
385
386
      };
    },
    async created() {
      await this._QueryDataGrade();
      this._QueryData(1);
bb4c8454   阿宝   添加,修改教师
387
388
389
      this._RoleList();
      await this._QuerySubject();
      await this._QueryClass();
23a6dc5f   阿宝   学校管理相关接口简单对接
390
391
    },
    methods: {
bb4c8454   阿宝   添加,修改教师
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
      addRoleList() {
        //添加教师角色
        this.formTeacher.roleList.push({
          id: randomWord(true, 16, 20),
          roleId: "",
          classId: [],
        });
      },
      removeRoleList(index) {
        //删除教师角色
        this.formTeacher.roleList.splice(index, 1);
      },
      addTeacherDia() {
        //添加教师弹窗
        this.isAdd = true;
        this.formTeacher = {
          teacherName: "",
          loginName: "",
          sex: 1,
          managerList: [],
        };
        this.diaTeacher = true;
      },
23a6dc5f   阿宝   学校管理相关接口简单对接
415
      setClass(obj) {
bb4c8454   阿宝   添加,修改教师
416
        //教师角色数量
23a6dc5f   阿宝   学校管理相关接口简单对接
417
418
419
420
421
422
423
        return (
          obj.managerList?.length +
          obj.teacherCourseList?.length +
          obj.teacherGradeList?.length
        );
      },
      showTeacher(obj) {
bb4c8454   阿宝   添加,修改教师
424
        //教师详细数据
23a6dc5f   阿宝   学校管理相关接口简单对接
425
426
427
        this.showTId = obj.id;
        this.teacherDetail = { ...obj };
      },
0a4de034   阿宝   教师管理,学生管理班级设置
428
      editTeacher(type) {
a37317f4   阿宝   使用分析,发卡记录
429
        this.diaTeacher = true;
0a4de034   阿宝   教师管理,学生管理班级设置
430
        this.setTercherType = type
bb4c8454   阿宝   添加,修改教师
431
432
433
434
435
436
437
438
439
        this.isAdd = false;
        for (let key in this.teacherDetail) {
          if (key == "realName") {
            this.formTeacher.teacherName = this.teacherDetail.realName;
          } else {
            this.formTeacher[key] = this.teacherDetail[key];
          }
        }
        this.toTeacherForm();
bb4c8454   阿宝   添加,修改教师
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
      },
      addTeacher() {
        //添加教师
        this.$refs.formTeacher.validate(async (valid) => {
          if (valid) {
            let obj = this.setTeacharForm();
            if (!obj) {
              this.$message.error("教师角色数据有误请检查!");
              return;
            }
            let res;
            if (this.isAdd) {
              res = await this.$request.addTeacher({
                teacherName: this.formTeacher.teacherName,
                loginName: this.formTeacher.loginName,
                sex: this.formTeacher.sex,
                ...obj,
              });
            } else {
              res = await this.$request.updateTeacher({
                teacherId: this.formTeacher.id,
                teacherName: this.formTeacher.teacherName,
                loginName: this.formTeacher.loginName,
                sex: this.formTeacher.sex,
                ...obj,
              });
            }
            if (res.status === 0) {
              this.$message.success(res.info);
              this.diaTeacher = false;
              this._QueryData(10);
            } else {
              this.$message.error(res.info);
            }
          } else {
            console.log("输入有误请检查!");
            return false;
          }
        });
      },
      setTeacharForm() {
        //转换保存教师数据格式
        let ERR_OK = true;
        this.formTeacher.roleList.map((item) => {
          if (item.classId.length == 0) {
            ERR_OK = false;
          }
        });
        if (ERR_OK) {
          let [managerList, teacherCourseList, gradeGroupList] = [[], [], []];
          this.formTeacher.roleList.map((item) => {
            if (item.roleId == 6) {
              managerList.push({
                classId: item.classId[1],
                className: this.classList.find(
                  (items) => items.value == item.classId[1]
0a4de034   阿宝   教师管理,学生管理班级设置
496
                )?.label||"",
bb4c8454   阿宝   添加,修改教师
497
498
499
500
501
502
              });
            } else if (item.roleId == 7) {
              teacherCourseList.push({
                classId: item.classId[0],
                className: this.classList.find(
                  (items) => items.value == item.classId[0]
0a4de034   阿宝   教师管理,学生管理班级设置
503
                )?.label||"",
bb4c8454   阿宝   添加,修改教师
504
505
506
507
508
509
510
                subjectName: item.classId[1],
              });
            } else {
              gradeGroupList.push({
                grade: item.classId[0],
                gradeName: this.gradeList.find(
                  (items) => items.id == item.classId[0]
0a4de034   阿宝   教师管理,学生管理班级设置
511
                )?.label||"",
bb4c8454   阿宝   添加,修改教师
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
                subjectName: item.classId[1],
              });
            }
          });
          return {
            managerList,
            teacherCourseList,
            gradeGroupList,
          };
        } else {
          return false;
        }
      },
      toTeacherForm() {
        //教师角色数据转换为form格式数据
        this.formTeacher.roleList = [];
        this.formTeacher.managerList?.map((item) => {
bb4c8454   阿宝   添加,修改教师
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
          this.formTeacher.roleList.push({
            id: randomWord(true, 16, 20),
            roleId: 6,
            classId: [
              this.classList.find(
                (items) =>
                  items.value == item.classId || items.label == item.className
              ).grade,
              item.classId,
            ],
          });
        });
        this.formTeacher.teacherCourseList?.map((item) => {
          this.formTeacher.roleList.push({
            id: randomWord(true, 16, 20),
            roleId: 7,
            classId: [
              this.classList.find(
                (items) =>
                  items.value == item.classId || items.label == item.className
              ).value,
              item.subjectName,
            ],
          });
        });
        this.formTeacher.gradeGroupList?.map((item) => {
          this.formTeacher.roleList.push({
            id: randomWord(true, 16, 20),
            roleId: 8,
            classId: [
              this.gradeList.find((items) => items.id == item.classId[0]).id,
              item.subjectName,
            ],
          });
        });
      },
      async _RoleList() {
        //角色
        const { data, status, info } = await this.$request.roleList();
        if (status === 0) {
          this.roleList = data.list || [];
        } else {
          this.$message.error(info);
        }
      },
23a6dc5f   阿宝   学校管理相关接口简单对接
574
575
576
577
578
579
580
581
582
583
584
585
586
587
      async _QueryData(type) {
        let query = {};
        if (type == 1) {
          query.gradeName = this.query.gradeName;
          this.query.teacherName = "";
          this.query.phone = "";
        } else if (type == 2) {
          query.teacherName = this.query.teacherName;
          this.query.gradeName = "";
          this.query.phone = "";
        } else if (type == 3) {
          query.phone = this.query.phone;
          this.query.teacherName = "";
          this.query.gradeName = "";
bb4c8454   阿宝   添加,修改教师
588
589
        } else if (type == 10) {
          query = { ...this.query };
23a6dc5f   阿宝   学校管理相关接口简单对接
590
591
        }
        this.loading = true;
0a4de034   阿宝   教师管理,学生管理班级设置
592
        this.teacherList = [];
23a6dc5f   阿宝   学校管理相关接口简单对接
593
594
595
596
597
598
599
        const { data, status, info } = await this.$request.teacherList({
          ...query,
        });
        this.loading = false;
        console.log(status);
        if (status === 0) {
          this.teacherList = data.list || [];
bb4c8454   阿宝   添加,修改教师
600
601
602
603
604
605
606
607
608
609
          if (type == 10) {
            let detailArr =
              data.list.filter((item) => item.id == this.formTeacher.id) || [];
            this.teacherDetail = (detailArr.length && detailArr[0]) || {
              ...data.list[0],
            };
          } else {
            this.teacherDetail = { ...this.teacherList[0] };
          }
          this.showTId = this.teacherDetail.id;
23a6dc5f   阿宝   学校管理相关接口简单对接
610
611
612
613
614
        } else {
          this.$message.error(info);
        }
      },
      async _QueryDataGrade() {
bb4c8454   阿宝   添加,修改教师
615
        //年级数据
23a6dc5f   阿宝   学校管理相关接口简单对接
616
617
618
619
620
621
622
        const { data, status, info } = await this.$request.gradeList();
        if (status === 0) {
          this.gradeList =
            data.list?.map((item) => {
              return {
                value: item.gradeName,
                label: item.gradeName,
bb4c8454   阿宝   添加,修改教师
623
                id: item.grade,
23a6dc5f   阿宝   学校管理相关接口简单对接
624
625
              };
            }) || [];
bb4c8454   阿宝   添加,修改教师
626
  
23a6dc5f   阿宝   学校管理相关接口简单对接
627
628
629
630
631
          this.query.gradeName = this.gradeList[0]?.value;
        } else {
          this.$message.error(info);
        }
      },
bb4c8454   阿宝   添加,修改教师
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
      async _QuerySubject() {
        //科目信息
        const { data, status, info } = await this.$request.subjectList();
        console.log(status);
        if (status === 0) {
          this.subjectList = [...data.subjectNames] || [];
          this.gradeSubList = this.gradeList?.map((item) => {
            return {
              value: item.id,
              label: item.label,
              children: data.subjectNames.map((sub) => {
                return {
                  value: sub,
                  label: sub,
                };
              }),
            };
          });
        } else {
          this.$message.error(info);
        }
      },
      async _QueryClass() {
        //班级数据
        const { data, status, info } = await this.$request.schoolClassList();
        if (status === 0) {
          this.classList =
            data.list.map((item) => {
              return {
                value: item.classCode,
                label: item.className,
                grade: item.grade,
                children: this.subjectList.map((sub) => {
                  return {
                    value: sub,
                    label: sub,
                  };
                }),
              };
            }) || [];
          this.gradeClassList = formatGradeClass([...data.list]);
        } else {
          this.$message.error(info);
        }
      },
23a6dc5f   阿宝   学校管理相关接口简单对接
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
      async downExcel() {
        let data = await this.$request.downDevice({
          id: this.id,
        });
        if (data && !data.code) {
          let blob = new Blob([data], {
            type: "application/vnd.ms-excel;charset=utf-8",
          });
          downloadFile(`设备信息.xlsx`, blob);
        } else {
          this.$message.error(data.message);
        }
      },
    },
  };
  </script>
4c4f7640   梁保满   路由表,路由前端文件
693
  
23a6dc5f   阿宝   学校管理相关接口简单对接
694
695
696
  <style lang="scss" scoped>
  .page-content {
    padding: 0 20px 20px;
4c4f7640   梁保满   路由表,路由前端文件
697
  }
23a6dc5f   阿宝   学校管理相关接口简单对接
698
699
700
701
702
703
704
705
706
707
708
709
  .teacher-box {
    display: flex;
    background: #f8f8f8;
    border-radius: 10px;
    overflow: hidden;
    min-height: 400px;
    .teacher-ul {
      max-height: 70vh;
      overflow-y: scroll;
    }
    .teacher-list {
      width: 240px;
4c4f7640   梁保满   路由表,路由前端文件
710
  
23a6dc5f   阿宝   学校管理相关接口简单对接
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
      .h-title {
        height: 40px;
        line-height: 40px;
        background: #eee;
        border-radius: 10px 10px 0 0;
      }
      .teacher-item {
        font-size: 16px;
        color: #7f7f7f;
        line-height: 36px;
        cursor: pointer;
        padding-left: 12px;
        &:hover {
          background: #eee;
        }
        &.active {
          color: #667ffd;
        }
      }
    }
4c4f7640   梁保满   路由表,路由前端文件
731
  
23a6dc5f   阿宝   学校管理相关接口简单对接
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
    .teacher-detail {
      flex: 1;
      position: relative;
      .icon-box {
        position: absolute;
        top: 12px;
        right: 20px;
        .icon {
          font-size: 24px;
          color: #7f7f7f;
          cursor: pointer;
        }
        .el-icon-circle-plus-outline {
          margin-left: 10px;
        }
      }
      .detail-top {
        padding: 12px 20px;
        box-sizing: border-box;
        display: flex;
        flex-wrap: wrap;
        font-size: 14px;
        color: #7f7f7f;
        .p-item {
          width: 40%;
          line-height: 28px;
        }
      }
      .grade-box {
        .grade-info {
          display: flex;
          flex-wrap: wrap;
          padding: 20px 20px 0;
          & > li {
            margin-right: 20px;
            margin-bottom: 20px;
            position: relative;
            .el-icon-delete {
              position: absolute;
              top: 8px;
              right: 8px;
              padding: 2px;
              cursor: pointer;
              display: none;
              &:hover {
                color: #667ffd;
              }
            }
            &:hover {
              .el-icon-delete {
                display: block;
              }
            }
          }
  
          .grade-item {
            width: 200px;
            box-sizing: border-box;
            padding: 12px 16px;
            border-radius: 10px;
            box-shadow: 1px 1px 3px #888;
          }
          .grade-name {
            font-size: 16px;
            font-weight: bold;
            line-height: 18px;
            padding-bottom: 12px;
          }
          .grade-class {
            display: flex;
            justify-content: space-between;
            font-size: 15px;
            padding-right: 20px;
            .fa {
              font-size: 18px;
              margin-right: 5px;
              color: #a4a4a4;
            }
            .fa-book {
              font-size: 20px;
            }
          }
        }
      }
    }
  }
bb4c8454   阿宝   添加,修改教师
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
  .add-box {
    margin-top: 10px;
  }
  .sel-c {
    width: 120px;
    margin-right: 12px;
  }
  .role-list {
    margin-bottom: 10px;
    .el-icon-close {
      padding: 5px;
      cursor: pointer;
      margin-left: 16px;
      background: #ccc;
      border-radius: 50%;
    }
  }
4c4f7640   梁保满   路由表,路由前端文件
835
  </style>