Blame view

src/views/standard/setUp/teacher.vue 31.8 KB
4c4f7640   梁保满   路由表,路由前端文件
1
  <template>
23a6dc5f   阿宝   学校管理相关接口简单对接
2
3
4
5
6
    <div>
      <back-box>
        <template slot="title">
          <span>教师管理</span>
        </template>
b21d90ef   梁保满   长水登录
7
        <template slot="btns" v-if="!code">
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
8
          <el-tooltip effect="dark" content="导入教师名单" placement="bottom">
23a6dc5f   阿宝   学校管理相关接口简单对接
9
10
11
12
13
14
15
16
            <el-button
              type="primary"
              icon="el-icon-upload2"
              size="mini"
              plain
              circle
              @click="diaUp = true"
            ></el-button>
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
17
18
19
20
21
22
23
24
25
26
27
          </el-tooltip>
          <el-tooltip effect="dark" content="导出教师名单" placement="bottom">
            <el-button
              type="primary"
              icon="el-icon-download"
              size="mini"
              plain
              circle
              @click="exportTeacherExl"
            ></el-button>
          </el-tooltip>
23a6dc5f   阿宝   学校管理相关接口简单对接
28
29
30
31
32
33
34
          <el-tooltip effect="dark" content="添加教师" placement="bottom">
            <el-button
              type="primary"
              icon="el-icon-plus"
              size="mini"
              plain
              circle
bb4c8454   阿宝   添加,修改教师
35
              @click="addTeacherDia"
23a6dc5f   阿宝   学校管理相关接口简单对接
36
37
38
39
40
41
42
            ></el-button>
          </el-tooltip>
        </template>
      </back-box>
  
      <div class="answer-header">
        <div class="sel-box">
53424e83   梁保满   教师管理筛选条件
43
44
45
46
47
48
49
50
51
52
53
54
55
56
          <el-cascader
            size="small"
            class="sel sel2"
            clearable
            placeholder="选择范围"
            v-model="query.gradeClassSub"
            :options="gradeClassSubList"
            :props="{
              multiple: true,
              checkStrictly: true,
            }"
            collapse-tags
            :show-all-levels="false"
          ></el-cascader>
b8827a72   梁保满   测试bug
57
58
59
60
61
62
          <el-select
            class="sel"
            v-model="query.type"
            @change="_QueryData(4)"
            placeholder="选择类型"
          >
5cfb0264   梁保满   班级管理交互优化
63
            <el-option disabled label="请选择" :value="9"></el-option>
55eb13fd   梁保满   中天提出的交互优化
64
65
            <el-option label="已分配任课信息" :value="0"></el-option>
            <el-option label="未分配任课信息" :value="1"></el-option>
23a6dc5f   阿宝   学校管理相关接口简单对接
66
67
68
69
70
          </el-select>
          <el-input
            placeholder="请输入老师姓名"
            v-model="query.teacherName"
            class="input-with-select"
aeac66d4   阿宝   飞书测试bug
71
            maxlength="30"
53424e83   梁保满   教师管理筛选条件
72
            clearable
23a6dc5f   阿宝   学校管理相关接口简单对接
73
74
75
76
77
78
79
80
81
82
            @keyup.enter.native="_QueryData(2)"
          >
            <el-button
              slot="append"
              icon="el-icon-search"
              @click="_QueryData(2)"
            ></el-button>
          </el-input>
          <el-input
            type="number"
e5ff81a1   阿宝   集团管理员接口
83
            oninput="if(value.length > 11) value = value.slice(0,11)"
23a6dc5f   阿宝   学校管理相关接口简单对接
84
85
            placeholder="请输入老师手机号"
            v-model="query.phone"
53424e83   梁保满   教师管理筛选条件
86
            clearable
23a6dc5f   阿宝   学校管理相关接口简单对接
87
88
89
90
91
92
93
94
95
            class="input-with-select"
            @keyup.enter.native="_QueryData(3)"
          >
            <el-button
              slot="append"
              icon="el-icon-search"
              @click="_QueryData(3)"
            ></el-button>
          </el-input>
53424e83   梁保满   教师管理筛选条件
96
97
98
          <el-button class="serach-box" round @click="_QueryData(1)"
            >筛选</el-button
          >
23a6dc5f   阿宝   学校管理相关接口简单对接
99
100
        </div>
      </div>
99713685   梁保满   学生调班,班级数据重新请求,使用过...
101
102
103
      <p class="total" v-if="teacherList.length">
        共筛选出{{ teacherList.length }}名教师。
      </p>
23a6dc5f   阿宝   学校管理相关接口简单对接
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
      <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)"
              >
5cfb0264   梁保满   班级管理交互优化
121
122
123
124
                {{ item.realName
                }}<template v-if="setClass(item)"
                  >({{ setClass(item) }})</template
                >
23a6dc5f   阿宝   学校管理相关接口简单对接
125
126
127
128
              </li>
            </ul>
          </div>
          <div class="teacher-detail">
b21d90ef   梁保满   长水登录
129
            <div class="icon-box" v-if="!code">
0a4de034   阿宝   教师管理,学生管理班级设置
130
131
132
133
134
              <i class="icon el-icon-edit-outline" @click="editTeacher(1)"></i>
              <i
                class="icon el-icon-circle-plus-outline"
                @click="editTeacher(2)"
              ></i>
23a6dc5f   阿宝   学校管理相关接口简单对接
135
136
137
138
            </div>
            <div class="detail-top">
              <p class="p-item">手机号码:{{ teacherDetail.loginName }}</p>
              <p class="p-item">
560c12f2   阿宝   学校设置,软件下载
139
                状态:{{ teacherDetail.available == 1 ? "不可用" : "正常" }}
23a6dc5f   阿宝   学校管理相关接口简单对接
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
              </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"
                >
b21d90ef   梁保满   长水登录
162
163
164
165
166
                  <el-popconfirm
                    title="确定删除吗?"
                    @confirm="delTeacherManager(item, 1)"
                    v-if="!code"
                  >
bb4c8454   阿宝   添加,修改教师
167
168
                    <i class="el-icon-delete" slot="reference"></i>
                  </el-popconfirm>
23a6dc5f   阿宝   学校管理相关接口简单对接
169
                  <div class="grade-item">
ec6394d1   梁保满   v1.3.1。细节调整
170
                    <p class="grade-name">
0ca11cc2   梁保满   学段参数调整,发卡记录类型增加
171
                      {{ item.gradeName }}-{{ item.className }}
ec6394d1   梁保满   v1.3.1。细节调整
172
                    </p>
23a6dc5f   阿宝   学校管理相关接口简单对接
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
                    <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"
94c6aacc   梁保满   驾驶角色key重复问题
196
                  :key="item.classId+item.subjectName"
23a6dc5f   阿宝   学校管理相关接口简单对接
197
                >
b21d90ef   梁保满   长水登录
198
199
200
201
202
                  <el-popconfirm
                    title="确定删除吗?"
                    @confirm="delTeacherManager(item, 2)"
                    v-if="!code"
                  >
bb4c8454   阿宝   添加,修改教师
203
204
                    <i class="el-icon-delete" slot="reference"></i>
                  </el-popconfirm>
23a6dc5f   阿宝   学校管理相关接口简单对接
205
206
                  <div class="grade-item">
                    <p class="grade-name">
0ca11cc2   梁保满   学段参数调整,发卡记录类型增加
207
                      {{ item.gradeName }}-{{ item.className }}({{
ec6394d1   梁保满   v1.3.1。细节调整
208
209
                        item.subjectName
                      }})
23a6dc5f   阿宝   学校管理相关接口简单对接
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
                    </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">
b21d90ef   梁保满   长水登录
236
237
238
239
240
                  <el-popconfirm
                    title="确定删除吗?"
                    @confirm="delTeacherManager(item, 3)"
                    v-if="!code"
                  >
bb4c8454   阿宝   添加,修改教师
241
242
                    <i class="el-icon-delete" slot="reference"></i>
                  </el-popconfirm>
23a6dc5f   阿宝   学校管理相关接口简单对接
243
244
                  <div class="grade-item">
                    <p class="grade-name">
53424e83   梁保满   教师管理筛选条件
245
                      {{ item.gradeName }}({{ item.subjectName }})
23a6dc5f   阿宝   学校管理相关接口简单对接
246
247
248
249
250
251
252
253
                    </p>
                  </div>
                </li>
              </ul>
            </div>
          </div>
        </div>
      </div>
55eb13fd   梁保满   中天提出的交互优化
254
255
256
257
258
259
      <el-dialog
        :close-on-click-modal="false"
        title="导入教师名单"
        :visible.sync="diaUp"
        width="600"
      >
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
260
261
262
263
264
265
        <up-load
          id="downTeacher"
          :url="url"
          @upSuccess="upSuccess"
          fileName="教师名单"
        >
23a6dc5f   阿宝   学校管理相关接口简单对接
266
267
268
269
270
271
272
273
274
          <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>
55eb13fd   梁保满   中天提出的交互优化
275
276
      <el-dialog
        :close-on-click-modal="false"
e5ff81a1   阿宝   集团管理员接口
277
278
279
        :title="
          isAdd ? '添加教师' : setTercherType == 1 ? '编辑教师信息' : '管理班级'
        "
0a4de034   阿宝   教师管理,学生管理班级设置
280
281
        :visible.sync="diaTeacher"
        width="400"
86e47820   梁保满   科目添加删除操作,教师角色选择。学...
282
        append-to-body
0a4de034   阿宝   教师管理,学生管理班级设置
283
      >
dd5150c5   阿宝   数据同步
284
285
        <el-form
          class="form-box"
bb4c8454   阿宝   添加,修改教师
286
          ref="formTeacher"
dd5150c5   阿宝   数据同步
287
288
289
290
          :model="formTeacher"
          :rules="rulesTeacher"
          label-width="160px"
        >
e5ff81a1   阿宝   集团管理员接口
291
292
          <el-form-item v-show="!isAdd && setTercherType == 2" label="教师姓名:">
            <span>{{ formTeacher.teacherName }}</span>
0a4de034   阿宝   教师管理,学生管理班级设置
293
294
295
296
297
298
          </el-form-item>
          <el-form-item
            v-show="isAdd || (!isAdd && setTercherType == 1)"
            label="手机号码:"
            prop="loginName"
          >
dd5150c5   阿宝   数据同步
299
            <el-col :span="10">
e5ff81a1   阿宝   集团管理员接口
300
301
              <el-input
                type="number"
9309dc5d   梁保满   任课老师接口完成
302
                oninput="if(value.length > 11) value = value.slice(0,11)"
e5ff81a1   阿宝   集团管理员接口
303
304
                v-model.trim="formTeacher.loginName"
              />
dd5150c5   阿宝   数据同步
305
306
            </el-col>
          </el-form-item>
e5ff81a1   阿宝   集团管理员接口
307
308
309
310
311
          <el-form-item
            v-show="isAdd || (!isAdd && setTercherType == 1)"
            label="教师姓名:"
            prop="teacherName"
          >
dd5150c5   阿宝   数据同步
312
313
314
315
            <el-col :span="10">
              <el-input maxlength="30" v-model.trim="formTeacher.teacherName" />
            </el-col>
          </el-form-item>
e5ff81a1   阿宝   集团管理员接口
316
317
318
319
320
          <el-form-item
            v-show="isAdd || (!isAdd && setTercherType == 1)"
            label="性别:"
            prop="sex"
          >
dd5150c5   阿宝   数据同步
321
322
323
324
325
            <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>
e5ff81a1   阿宝   集团管理员接口
326
327
328
329
330
          <el-form-item
            v-show="isAdd || (!isAdd && setTercherType == 2)"
            label="教师角色:"
            prop="roleList"
          >
bb4c8454   阿宝   添加,修改教师
331
332
333
334
335
336
337
338
339
340
341
342
            <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   阿宝   教师管理,学生管理班级设置
343
                  v-for="item in teacherRoleList"
bb4c8454   阿宝   添加,修改教师
344
345
346
347
348
349
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
350
351
              <el-cascader
                size="small"
bb4c8454   阿宝   添加,修改教师
352
353
354
355
                v-if="item.roleId == 6"
                class="sel-t"
                collapse
                clearable
dba7b13a   梁保满   添加账号模式,修改教师角色显示问题
356
                placeholder="选择年级-班级"
bb4c8454   阿宝   添加,修改教师
357
358
359
360
                v-model="item.classId"
                :options="gradeClassList"
                :props="{ expandTrigger: 'hover' }"
              ></el-cascader>
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
361
362
              <el-cascader
                size="small"
bb4c8454   阿宝   添加,修改教师
363
                v-if="item.roleId == 7"
86e47820   梁保满   科目添加删除操作,教师角色选择。学...
364
                class="sel-t teacher-cascader"
bb4c8454   阿宝   添加,修改教师
365
366
                collapse
                clearable
55eb13fd   梁保满   中天提出的交互优化
367
                placeholder="选择年级-科目-班级"
bb4c8454   阿宝   添加,修改教师
368
                v-model="item.classId"
55eb13fd   梁保满   中天提出的交互优化
369
370
                :options="gradeSubListClass"
                :props="{ expandTrigger: 'hover', multiple: true }"
86e47820   梁保满   科目添加删除操作,教师角色选择。学...
371
                popperClass="cascader-clazz"
bb4c8454   阿宝   添加,修改教师
372
              ></el-cascader>
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
373
374
              <el-cascader
                size="small"
bb4c8454   阿宝   添加,修改教师
375
376
377
378
379
380
                v-if="item.roleId == 8"
                class="sel-t"
                collapse
                clearable
                placeholder="选择年级-科目"
                v-model="item.classId"
dba7b13a   梁保满   添加账号模式,修改教师角色显示问题
381
                :options="gradeList"
bb4c8454   阿宝   添加,修改教师
382
383
384
385
386
387
388
                :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   阿宝   数据同步
389
390
391
          </el-form-item>
        </el-form>
        <div class="dialog-footer" slot="footer">
0a4de034   阿宝   教师管理,学生管理班级设置
392
          <el-button type="primary" @click="addTeacher">确 定</el-button>
dd5150c5   阿宝   数据同步
393
394
395
          <el-button @click="diaTeacher = false">取 消</el-button>
        </div>
      </el-dialog>
23a6dc5f   阿宝   学校管理相关接口简单对接
396
    </div>
4c4f7640   梁保满   路由表,路由前端文件
397
398
399
  </template>
  
  <script>
ec6394d1   梁保满   v1.3.1。细节调整
400
401
402
403
404
405
  import {
    downloadFile,
    formatGradeClass,
    randomWord,
    setGradeName,
  } from "@/utils";
4c4f7640   梁保满   路由表,路由前端文件
406
  export default {
23a6dc5f   阿宝   学校管理相关接口简单对接
407
408
    data() {
      return {
b21d90ef   梁保满   长水登录
409
        code: "",
dd5150c5   阿宝   数据同步
410
        loading: false,
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
411
        url: "/api_html/school/manager/importTeacher",
23a6dc5f   阿宝   学校管理相关接口简单对接
412
        diaUp: false,
bb4c8454   阿宝   添加,修改教师
413
414
        diaTeacher: false,
        isAdd: false,
0a4de034   阿宝   教师管理,学生管理班级设置
415
        setTercherType: 1,
23a6dc5f   阿宝   学校管理相关接口简单对接
416
        query: {
53424e83   梁保满   教师管理筛选条件
417
418
          gradeClassSub: [],
          type: 0,
23a6dc5f   阿宝   学校管理相关接口简单对接
419
420
421
          teacherName: "",
          phone: "",
        },
bb4c8454   阿宝   添加,修改教师
422
        subjectList: [],
23a6dc5f   阿宝   学校管理相关接口简单对接
423
        gradeList: [],
bb4c8454   阿宝   添加,修改教师
424
        classList: [],
53424e83   梁保满   教师管理筛选条件
425
        gradeClassSubList: [],
55eb13fd   梁保满   中天提出的交互优化
426
        gradeSubListClass: [],
dd5150c5   阿宝   数据同步
427
        teacherList: [],
0a4de034   阿宝   教师管理,学生管理班级设置
428
429
        teacherRoleList: [
          //角色
bb4c8454   阿宝   添加,修改教师
430
431
432
433
434
435
436
437
438
439
440
441
442
          {
            value: 6,
            label: "班主任",
          },
          {
            value: 7,
            label: "任课老师",
          },
          {
            value: 8,
            label: "备课组长",
          },
        ],
23a6dc5f   阿宝   学校管理相关接口简单对接
443
444
445
446
447
448
449
450
451
452
        teacherDetail: {
          teacherName: "",
          loginName: "",
          sex: "",
          available: "",
          managerList: [],
          teacherCourseList: [],
          teacherGradeList: [],
        },
        showTId: "", //显示详情 教师ID
bb4c8454   阿宝   添加,修改教师
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
        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   阿宝   数据同步
471
        },
23a6dc5f   阿宝   学校管理相关接口简单对接
472
473
474
      };
    },
    async created() {
b21d90ef   梁保满   长水登录
475
      this.code = localStorage.getItem("csCode") || "";
b8827a72   梁保满   测试bug
476
      this._QueryData(4);
53424e83   梁保满   教师管理筛选条件
477
      await this._QuerySubject();
23a6dc5f   阿宝   学校管理相关接口简单对接
478
      await this._QueryDataGrade();
bb4c8454   阿宝   添加,修改教师
479
      this._RoleList();
bb4c8454   阿宝   添加,修改教师
480
      await this._QueryClass();
23a6dc5f   阿宝   学校管理相关接口简单对接
481
482
    },
    methods: {
ec6394d1   梁保满   v1.3.1。细节调整
483
484
485
      gradeName(type) {
        return setGradeName(type);
      },
757a21e3   梁保满   上传成功提示成功数量
486
      upSuccess(res) {
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
487
        //导入成功
757a21e3   梁保满   上传成功提示成功数量
488
489
490
491
492
        this.$message.closeAll();
        this.$message({
          showClose: true,
          message: `成功(${res.data.success})`,
          type: "success",
54857fa3   梁保满   下载模板跨域,集团管理员选择角色范...
493
          duration: 5000,
757a21e3   梁保满   上传成功提示成功数量
494
        });
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
495
        this.diaUp = false;
3b9f2ddb   梁保满   学生。教师筛选参数
496
        this._QueryData(5);
255e2506   梁保满   飞书bug及优化
497
      },
bb4c8454   阿宝   添加,修改教师
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
      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,
9309dc5d   梁保满   任课老师接口完成
517
          roleList: [],
bb4c8454   阿宝   添加,修改教师
518
519
520
        };
        this.diaTeacher = true;
      },
23a6dc5f   阿宝   学校管理相关接口简单对接
521
      setClass(obj) {
bb4c8454   阿宝   添加,修改教师
522
        //教师角色数量
23a6dc5f   阿宝   学校管理相关接口简单对接
523
524
525
526
527
528
        return (
          obj.managerList?.length +
          obj.teacherCourseList?.length +
          obj.teacherGradeList?.length
        );
      },
dba7b13a   梁保满   添加账号模式,修改教师角色显示问题
529
530
531
532
533
534
535
536
537
      getClassName(id) {
        let name;
        this.classList.map((item) => {
          if (item.value == id) {
            name = item.label;
          }
        });
        return name;
      },
23a6dc5f   阿宝   学校管理相关接口简单对接
538
      showTeacher(obj) {
bb4c8454   阿宝   添加,修改教师
539
        //教师详细数据
23a6dc5f   阿宝   学校管理相关接口简单对接
540
541
542
        this.showTId = obj.id;
        this.teacherDetail = { ...obj };
      },
0a4de034   阿宝   教师管理,学生管理班级设置
543
      editTeacher(type) {
a37317f4   阿宝   使用分析,发卡记录
544
        this.diaTeacher = true;
e5ff81a1   阿宝   集团管理员接口
545
        this.setTercherType = type;
bb4c8454   阿宝   添加,修改教师
546
547
548
549
550
551
552
553
554
        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   阿宝   添加,修改教师
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
      },
      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 {
bb4c8454   阿宝   添加,修改教师
574
575
576
577
578
579
580
581
582
583
584
              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;
3b9f2ddb   梁保满   学生。教师筛选参数
585
              this._QueryData(5);
bb4c8454   阿宝   添加,修改教师
586
587
588
589
            } else {
              this.$message.error(res.info);
            }
          } else {
e5ff81a1   阿宝   集团管理员接口
590
            this.$message.warning("输入有误请检查!");
bb4c8454   阿宝   添加,修改教师
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
            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],
e5ff81a1   阿宝   集团管理员接口
609
610
611
                className:
                  this.classList.find((items) => items.value == item.classId[1])
                    ?.label || "",
bb4c8454   阿宝   添加,修改教师
612
613
              });
            } else if (item.roleId == 7) {
55eb13fd   梁保满   中天提出的交互优化
614
615
616
617
618
619
620
621
              item.classId.map((clazz) => {
                teacherCourseList.push({
                  classId: clazz[2],
                  className:
                    this.classList.find((items) => items.value == clazz[2])
                      ?.label || "",
                  subjectName: clazz[1],
                });
bb4c8454   阿宝   添加,修改教师
622
623
624
625
              });
            } else {
              gradeGroupList.push({
                grade: item.classId[0],
e5ff81a1   阿宝   集团管理员接口
626
627
628
                gradeName:
                  this.gradeList.find((items) => items.id == item.classId[0])
                    ?.label || "",
bb4c8454   阿宝   添加,修改教师
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
                subjectName: item.classId[1],
              });
            }
          });
          return {
            managerList,
            teacherCourseList,
            gradeGroupList,
          };
        } else {
          return false;
        }
      },
      toTeacherForm() {
        //教师角色数据转换为form格式数据
        this.formTeacher.roleList = [];
        this.formTeacher.managerList?.map((item) => {
bb4c8454   阿宝   添加,修改教师
646
647
648
649
650
651
          this.formTeacher.roleList.push({
            id: randomWord(true, 16, 20),
            roleId: 6,
            classId: [
              this.classList.find(
                (items) =>
47a01cb6   梁保满   v1.3测试问题
652
653
                  items.value == item.classId ||
                  items.label.includes(item.className)
bb4c8454   阿宝   添加,修改教师
654
655
656
657
658
              ).grade,
              item.classId,
            ],
          });
        });
55eb13fd   梁保满   中天提出的交互优化
659
        let teacherClassId = [];
bb4c8454   阿宝   添加,修改教师
660
        this.formTeacher.teacherCourseList?.map((item) => {
55eb13fd   梁保满   中天提出的交互优化
661
662
663
664
665
666
667
668
669
670
671
          teacherClassId.push([
            item.grade,
            item.subjectName,
            this.classList.find(
              (items) =>
                items.value == item.classId ||
                items.label.includes(item.className)
            ).value,
          ]);
        });
        if (teacherClassId.length) {
bb4c8454   阿宝   添加,修改教师
672
673
674
          this.formTeacher.roleList.push({
            id: randomWord(true, 16, 20),
            roleId: 7,
55eb13fd   梁保满   中天提出的交互优化
675
            classId: [...teacherClassId],
bb4c8454   阿宝   添加,修改教师
676
          });
55eb13fd   梁保满   中天提出的交互优化
677
        }
bb4c8454   阿宝   添加,修改教师
678
679
680
681
682
683
684
685
686
687
688
        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,
            ],
          });
        });
      },
b21d90ef   梁保满   长水登录
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
      async delTeacherManager(obj, type) {
        let query;
        switch (type) {
          case 1:
            query = {
              classId: obj.classId,
            };
            break;
          case 2:
            query = {
              classId: obj.classId,
              subjectName: obj.subjectName,
            };
            break;
          case 3:
            query = {
              classId: obj.classId,
              grade: obj.grade,
              subjectName: obj.subjectName,
            };
            break;
        }
        //角色
        const { data, status, info } = await this.$request.delTeacherManager({
          teacherId: obj.teacherId,
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
714
          ...query,
b21d90ef   梁保满   长水登录
715
716
        });
        if (status === 0) {
3b9f2ddb   梁保满   学生。教师筛选参数
717
          this._QueryData(5);
b21d90ef   梁保满   长水登录
718
719
720
721
        } else {
          this.$message.error(info);
        }
      },
bb4c8454   阿宝   添加,修改教师
722
723
724
725
726
727
728
729
730
      async _RoleList() {
        //角色
        const { data, status, info } = await this.$request.roleList();
        if (status === 0) {
          this.roleList = data.list || [];
        } else {
          this.$message.error(info);
        }
      },
53424e83   梁保满   教师管理筛选条件
731
      setQuery(type) {
23a6dc5f   阿宝   学校管理相关接口简单对接
732
        let query = {};
b8827a72   梁保满   测试bug
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
        if (type == 1) {
          query.grades = [];
          query.classIds = [];
          query.subjectNames = [];
          this.query.gradeClassSub?.map((item) => {
            if (item.length == 1) {
              if (!query.grades.includes(item[0])) {
                query.grades.push(item[0]);
              }
            } else if (item.length == 2) {
              if (!query.classIds.includes(item[1])) {
                query.classIds.push(item[1]);
              }
              query.grades.includes(item[0]) && query.grades.remove(item[0]);
            } else if (item.length == 3) {
              if (!query.subjectNames.includes(item[2])) {
                query.subjectNames.push(item[2]);
              }
              query.grades.includes(item[0]) && query.grades.remove(item[0]);
              query.classIds.includes(item[0]) && query.classIds.remove(item[0]);
            }
          });
  
          delete query.gradeClassSub;
          query.grades.length ? "" : delete query.grades;
          query.classIds.length ? "" : delete query.classIds;
          query.subjectNames.length ? "" : delete query.subjectNames;
          this.query.teacherName = "";
          this.query.phone = "";
3b9f2ddb   梁保满   学生。教师筛选参数
762
          this.query.type = 0;
5cfb0264   梁保满   班级管理交互优化
763
        } else if (type == 2) {
3b9f2ddb   梁保满   学生。教师筛选参数
764
          this.query.type = 9;
23a6dc5f   阿宝   学校管理相关接口简单对接
765
          this.query.phone = "";
53424e83   梁保满   教师管理筛选条件
766
          this.query.gradeClassSub = [];
3b9f2ddb   梁保满   学生。教师筛选参数
767
768
          query.teacherName = this.query.teacherName;
          query.type = this.query.type;
23a6dc5f   阿宝   学校管理相关接口简单对接
769
        } else if (type == 3) {
3b9f2ddb   梁保满   学生。教师筛选参数
770
          this.query.type = 9;
23a6dc5f   阿宝   学校管理相关接口简单对接
771
          this.query.teacherName = "";
53424e83   梁保满   教师管理筛选条件
772
          this.query.gradeClassSub = [];
3b9f2ddb   梁保满   学生。教师筛选参数
773
774
          query.phone = this.query.phone;
          query.type = this.query.type;
b8827a72   梁保满   测试bug
775
776
777
778
779
        } else if (type == 4) {
          this.query.teacherName = "";
          this.query.phone = "";
          this.query.gradeClassSub = [];
          query.type = this.query.type;
ec6394d1   梁保满   v1.3.1。细节调整
780
        } else {
53424e83   梁保满   教师管理筛选条件
781
          query = { ...this.query };
d059a9d1   梁保满   接口调整
782
          query.grades = [];
53424e83   梁保满   教师管理筛选条件
783
784
785
786
          query.classIds = [];
          query.subjectNames = [];
          this.query.gradeClassSub?.map((item) => {
            if (item.length == 1) {
d059a9d1   梁保满   接口调整
787
788
              if (!query.grades.includes(item[0])) {
                query.grades.push(item[0]);
53424e83   梁保满   教师管理筛选条件
789
790
791
792
793
              }
            } else if (item.length == 2) {
              if (!query.classIds.includes(item[1])) {
                query.classIds.push(item[1]);
              }
b8827a72   梁保满   测试bug
794
              query.grades.includes(item[0]) && query.grades.remove(item[0]);
53424e83   梁保满   教师管理筛选条件
795
796
797
798
            } else if (item.length == 3) {
              if (!query.subjectNames.includes(item[2])) {
                query.subjectNames.push(item[2]);
              }
b8827a72   梁保满   测试bug
799
              query.grades.includes(item[0]) && query.grades.remove(item[0]);
53424e83   梁保满   教师管理筛选条件
800
801
802
803
804
              query.classIds.includes(item[0]) && query.classIds.remove(item[0]);
            }
          });
  
          delete query.gradeClassSub;
d059a9d1   梁保满   接口调整
805
          query.grades.length ? "" : delete query.grades;
53424e83   梁保满   教师管理筛选条件
806
807
808
809
          query.classIds.length ? "" : delete query.classIds;
          query.subjectNames.length ? "" : delete query.subjectNames;
          query.teacherName.length ? "" : delete query.teacherName;
          query.phone.length ? "" : delete query.phone;
ec6394d1   梁保满   v1.3.1。细节调整
810
        }
53424e83   梁保满   教师管理筛选条件
811
812
813
814
815
  
        return query;
      },
      async _QueryData(type) {
        if (this.loading) return;
5cfb0264   梁保满   班级管理交互优化
816
817
818
819
820
821
822
823
824
825
826
        if (type == 2) {
          if (this.query.teacherName == "") {
            this.$message.warning("请输入老师姓名");
            return;
          }
        } else if (type == 3) {
          if (this.query.phone == "") {
            this.$message.warning("请输入老师手机");
            return;
          }
        }
23a6dc5f   阿宝   学校管理相关接口简单对接
827
        this.loading = true;
b8827a72   梁保满   测试bug
828
        let query = this.setQuery(type);
0a4de034   阿宝   教师管理,学生管理班级设置
829
        this.teacherList = [];
23a6dc5f   阿宝   学校管理相关接口简单对接
830
831
832
833
834
835
836
        const { data, status, info } = await this.$request.teacherList({
          ...query,
        });
        this.loading = false;
        console.log(status);
        if (status === 0) {
          this.teacherList = data.list || [];
bb4c8454   阿宝   添加,修改教师
837
838
839
840
841
842
843
844
845
846
          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   阿宝   学校管理相关接口简单对接
847
848
849
850
        } else {
          this.$message.error(info);
        }
      },
53424e83   梁保满   教师管理筛选条件
851
852
853
854
855
856
857
858
      async _QuerySubject() {
        const { data, status, info } = await this.$request.subjectList();
        if (status === 0) {
          this.subjectList = [...data?.subjectNames] || [];
        } else {
          this.$message.error(info);
        }
      },
23a6dc5f   阿宝   学校管理相关接口简单对接
859
      async _QueryDataGrade() {
bb4c8454   阿宝   添加,修改教师
860
        //年级数据
23a6dc5f   阿宝   学校管理相关接口简单对接
861
862
863
864
        const { data, status, info } = await this.$request.gradeList();
        if (status === 0) {
          this.gradeList =
            data.list?.map((item) => {
53424e83   梁保满   教师管理筛选条件
865
866
867
868
869
870
871
              let subList = item.subjectNames?.map((items) => {
                return {
                  value: items,
                  label: items,
                };
              });
              this.gradeClassSubList.push({
d059a9d1   梁保满   接口调整
872
                value: item.grade,
23a6dc5f   阿宝   学校管理相关接口简单对接
873
                label: item.gradeName,
bb4c8454   阿宝   添加,修改教师
874
                id: item.grade,
53424e83   梁保满   教师管理筛选条件
875
                children: item.classList.map((clazz) => {
dba7b13a   梁保满   添加账号模式,修改教师角色显示问题
876
                  return {
53424e83   梁保满   教师管理筛选条件
877
878
879
880
                    value: clazz.id,
                    label: clazz.className,
                    id: clazz.id,
                    children: [...subList],
dba7b13a   梁保满   添加账号模式,修改教师角色显示问题
881
882
                  };
                }),
53424e83   梁保满   教师管理筛选条件
883
              });
55eb13fd   梁保满   中天提出的交互优化
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
              this.gradeSubListClass.push({
                value: item.grade,
                label: item.gradeName,
                id: item.grade,
                children: item.subjectNames.map((items) => {
                  return {
                    value: items,
                    label: items,
                    children: item.classList.map((clazz) => {
                      return {
                        value: clazz.id,
                        label: clazz.className,
                      };
                    }),
                  };
                }),
              });
53424e83   梁保满   教师管理筛选条件
901
              return {
d059a9d1   梁保满   接口调整
902
                value: item.grade,
53424e83   梁保满   教师管理筛选条件
903
904
905
                label: item.gradeName,
                id: item.grade,
                children: [...subList],
23a6dc5f   阿宝   学校管理相关接口简单对接
906
907
              };
            }) || [];
23a6dc5f   阿宝   学校管理相关接口简单对接
908
909
910
911
        } else {
          this.$message.error(info);
        }
      },
bb4c8454   阿宝   添加,修改教师
912
913
914
915
      async _QueryClass() {
        //班级数据
        const { data, status, info } = await this.$request.schoolClassList();
        if (status === 0) {
dba7b13a   梁保满   添加账号模式,修改教师角色显示问题
916
917
          let gradeSubList = {};
          this.gradeList.map((item) => {
b8827a72   梁保满   测试bug
918
            gradeSubList[item.label] = [...item.children];
dba7b13a   梁保满   添加账号模式,修改教师角色显示问题
919
          });
bb4c8454   阿宝   添加,修改教师
920
921
922
          this.classList =
            data.list.map((item) => {
              return {
1365ef5e   梁保满   优化
923
                value: item.id,
47a01cb6   梁保满   v1.3测试问题
924
                label: `${item.className}(${item.gradeName})`,
bb4c8454   阿宝   添加,修改教师
925
                grade: item.grade,
dba7b13a   梁保满   添加账号模式,修改教师角色显示问题
926
927
                gradeName: item.gradeName,
                children: gradeSubList[item.gradeName],
bb4c8454   阿宝   添加,修改教师
928
929
930
931
932
933
934
              };
            }) || [];
          this.gradeClassList = formatGradeClass([...data.list]);
        } else {
          this.$message.error(info);
        }
      },
23a6dc5f   阿宝   学校管理相关接口简单对接
935
      async downExcel() {
a3fcda80   梁保满   教师模版下载调整
936
        let data = await this.$request.teacherTemplate();
f20c48c9   梁保满   集团管理员添加发卡记录,并添加报表导出
937
938
939
940
941
        if (data && !data.code) {
          let blob = new Blob([data], {
            type: "application/vnd.ms-excel;charset=utf-8",
          });
          downloadFile(`教师名单模版.xlsx`, blob);
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
942
        } else {
f20c48c9   梁保满   集团管理员添加发卡记录,并添加报表导出
943
          this.$message.error(data.info);
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
944
945
946
947
948
949
950
        }
      },
      async exportTeacherExl() {
        this.loadingDown = true;
        let data = await this.$request.exportTeacher();
        this.loadingDown = false;
        if (data) {
23a6dc5f   阿宝   学校管理相关接口简单对接
951
952
953
          let blob = new Blob([data], {
            type: "application/vnd.ms-excel;charset=utf-8",
          });
236b1f0e   梁保满   周末-飞书bug
954
          downloadFile(`教师名单.xlsx`, blob);
23a6dc5f   阿宝   学校管理相关接口简单对接
955
        } else {
e371f2dc   梁保满   软件下载,学校,班级老师等报表导入...
956
          this.$message.error("下载失败");
23a6dc5f   阿宝   学校管理相关接口简单对接
957
958
959
960
961
        }
      },
    },
  };
  </script>
4c4f7640   梁保满   路由表,路由前端文件
962
  
23a6dc5f   阿宝   学校管理相关接口简单对接
963
964
965
  <style lang="scss" scoped>
  .page-content {
    padding: 0 20px 20px;
4c4f7640   梁保满   路由表,路由前端文件
966
  }
99713685   梁保满   学生调班,班级数据重新请求,使用过...
967
968
969
970
971
  .total {
    padding: 0 20px 10px;
    font-size: 14px;
    color: #666;
  }
23a6dc5f   阿宝   学校管理相关接口简单对接
972
973
974
975
976
977
978
  .teacher-box {
    display: flex;
    background: #f8f8f8;
    border-radius: 10px;
    overflow: hidden;
    min-height: 400px;
    .teacher-ul {
b21d90ef   梁保满   长水登录
979
      max-height: 60vh;
23a6dc5f   阿宝   学校管理相关接口简单对接
980
      overflow-y: scroll;
f20c48c9   梁保满   集团管理员添加发卡记录,并添加报表导出
981
982
983
984
985
986
987
      &::-webkit-scrollbar {
        width: 6px;
      }
      &::-webkit-scrollbar-thumb {
        border-radius: 10px;
        background-color: #ccc;
      }
23a6dc5f   阿宝   学校管理相关接口简单对接
988
989
990
    }
    .teacher-list {
      width: 240px;
4c4f7640   梁保满   路由表,路由前端文件
991
  
23a6dc5f   阿宝   学校管理相关接口简单对接
992
993
994
995
      .h-title {
        height: 40px;
        line-height: 40px;
        background: #eee;
f20c48c9   梁保满   集团管理员添加发卡记录,并添加报表导出
996
        // border-radius: 10px 10px 0 0;
23a6dc5f   阿宝   学校管理相关接口简单对接
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
      }
      .teacher-item {
        font-size: 16px;
        color: #7f7f7f;
        line-height: 36px;
        cursor: pointer;
        padding-left: 12px;
        &:hover {
          background: #eee;
        }
        &.active {
          color: #667ffd;
ca39cc52   阿宝   飞书问题处理
1009
          background: #eee;
23a6dc5f   阿宝   学校管理相关接口简单对接
1010
1011
1012
        }
      }
    }
4c4f7640   梁保满   路由表,路由前端文件
1013
  
23a6dc5f   阿宝   学校管理相关接口简单对接
1014
1015
1016
    .teacher-detail {
      flex: 1;
      position: relative;
f20c48c9   梁保满   集团管理员添加发卡记录,并添加报表导出
1017
      padding-left: 10px;
23a6dc5f   阿宝   学校管理相关接口简单对接
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
      .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   阿宝   添加,修改教师
1101
1102
1103
1104
1105
1106
1107
1108
1109
  .add-box {
    margin-top: 10px;
  }
  .sel-c {
    width: 120px;
    margin-right: 12px;
  }
  .role-list {
    margin-bottom: 10px;
dba7b13a   梁保满   添加账号模式,修改教师角色显示问题
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
    position: relative;
    .sel-p {
      position: absolute;
      left: 146px;
      top: 0;
      font-size: 13px;
      color: #606266;
    }
    .sel-t {
      :deep(.el-input__inner) {
        background: transparent;
      }
    }
bb4c8454   阿宝   添加,修改教师
1123
1124
1125
1126
1127
1128
1129
1130
    .el-icon-close {
      padding: 5px;
      cursor: pointer;
      margin-left: 16px;
      background: #ccc;
      border-radius: 50%;
    }
  }
4c4f7640   梁保满   路由表,路由前端文件
1131
  </style>