Blame view

src/views/standard/setUp/account.vue 22.3 KB
4c4f7640   梁保满   路由表,路由前端文件
1
  <template>
42056450   阿宝   权限修改
2
3
4
5
6
    <div>
      <back-box>
        <template slot="title">
          <span>账号管理</span>
        </template>
e5ff81a1   阿宝   集团管理员接口
7
        <template slot="btns" v-if="role == 'ROLE_JITUAN'">
d32e461c   梁保满   备题组卷
8
9
          <!-- 暂未有接口 -->
          <!-- <el-tooltip effect="dark" content="导入账号" placement="bottom">
e5ff81a1   阿宝   集团管理员接口
10
11
12
13
14
15
16
17
            <el-button
              type="primary"
              icon="el-icon-upload2"
              size="mini"
              plain
              circle
              @click="diaUp = true"
            ></el-button>
d32e461c   梁保满   备题组卷
18
          </el-tooltip> -->
f5729396   梁保满   批量设置答案
19
20
21
22
23
24
          <el-tooltip
            effect="dark"
            content="添加账号"
            placement="bottom"
            v-if="!code"
          >
e5ff81a1   阿宝   集团管理员接口
25
26
27
28
29
30
31
32
33
            <el-button
              type="primary"
              icon="el-icon-plus"
              size="mini"
              plain
              circle
              @click="openAddDia"
            ></el-button>
          </el-tooltip>
5be3bb70   梁保满   切换账号,缓存组件接口报错问题
34
35
          <el-tooltip effect="dark" content="账号同步" placement="bottom" v-else>
            <el-button
f5729396   梁保满   批量设置答案
36
              v-loading="syncLoading"
5be3bb70   梁保满   切换账号,缓存组件接口报错问题
37
38
39
40
41
42
43
44
              type="primary"
              icon="el-icon-refresh"
              size="mini"
              plain
              circle
              @click="refreshAcc"
            ></el-button>
          </el-tooltip>
e5ff81a1   阿宝   集团管理员接口
45
        </template>
42056450   阿宝   权限修改
46
47
48
      </back-box>
      <div class="answer-header">
        <div class="sel-box">
e5ff81a1   阿宝   集团管理员接口
49
          <el-cascader
225a00b6   梁保满   飞书问题解决
50
            size="small"
e5ff81a1   阿宝   集团管理员接口
51
52
            v-if="role == 'ROLE_JITUAN'"
            class="sel"
e5ff81a1   阿宝   集团管理员接口
53
54
            clearable
            placeholder="选择学校"
31f6e0f6   梁保满   集团管理员账号管理
55
            v-model="query.schoolIds"
e5ff81a1   阿宝   集团管理员接口
56
57
58
59
            :options="schoolList"
            :props="props"
            :show-all-levels="false"
          ></el-cascader>
42056450   阿宝   权限修改
60
          <el-select
e5ff81a1   阿宝   集团管理员接口
61
            v-else
42056450   阿宝   权限修改
62
            class="sel"
bb4c8454   阿宝   添加,修改教师
63
            v-model="query.roleId"
42056450   阿宝   权限修改
64
            placeholder="选择账号角色"
bb4c8454   阿宝   添加,修改教师
65
            @change="(page = 1), _QueryData(1)"
42056450   阿宝   权限修改
66
67
68
69
70
71
72
73
74
75
76
77
78
          >
            <el-option
              v-for="item in roleList"
              :key="item.id"
              :label="item.roleName"
              :value="item.id"
            >
            </el-option>
          </el-select>
          <el-select
            class="sel"
            v-model="query.available"
            placeholder="选择账号状态"
bb4c8454   阿宝   添加,修改教师
79
            @change="(page = 1), _QueryData(1)"
42056450   阿宝   权限修改
80
          >
bb4c8454   阿宝   添加,修改教师
81
82
            <el-option label="正常" :value="0"></el-option>
            <el-option label="禁用" :value="1"></el-option>
42056450   阿宝   权限修改
83
84
          </el-select>
          <el-input
31f6e0f6   梁保满   集团管理员账号管理
85
            :placeholder="role != 'ROLE_JITUAN' ? '请输入老师账号' : '请输入账号'"
42056450   阿宝   权限修改
86
            v-model="query.loginName"
4c2fb560   梁保满   反馈新需求
87
            class="input-with-select sel"
1365ef5e   梁保满   优化
88
            type="number"
4c2fb560   梁保满   反馈新需求
89
            clearable
1365ef5e   梁保满   优化
90
            oninput="if(value.length > 11) value = value.slice(0,11)"
bb4c8454   阿宝   添加,修改教师
91
            @keyup.enter.native="(page = 1), _QueryData(2)"
42056450   阿宝   权限修改
92
93
94
95
          >
            <el-button
              slot="append"
              icon="el-icon-search"
bb4c8454   阿宝   添加,修改教师
96
              @click="(page = 1), _QueryData(2)"
42056450   阿宝   权限修改
97
98
99
            ></el-button>
          </el-input>
          <el-input
42056450   阿宝   权限修改
100
            placeholder="请输入老师姓名"
1365ef5e   梁保满   优化
101
            maxlength="30"
42056450   阿宝   权限修改
102
103
            v-model="query.realName"
            class="input-with-select"
4c2fb560   梁保满   反馈新需求
104
            clearable
bb4c8454   阿宝   添加,修改教师
105
            @keyup.enter.native="(page = 1), _QueryData(3)"
42056450   阿宝   权限修改
106
107
108
109
          >
            <el-button
              slot="append"
              icon="el-icon-search"
bb4c8454   阿宝   添加,修改教师
110
              @click="(page = 1), _QueryData(3)"
42056450   阿宝   权限修改
111
112
            ></el-button>
          </el-input>
e5ff81a1   阿宝   集团管理员接口
113
114
115
116
          <el-button
            v-if="role == 'ROLE_JITUAN'"
            type="primary"
            round
189da653   梁保满   跳转旧平台入口权限设置,集团管理员...
117
            @click="(page = 1), _QueryData(4)"
e5ff81a1   阿宝   集团管理员接口
118
119
            >筛选</el-button
          >
42056450   阿宝   权限修改
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
        </div>
      </div>
      <div class="table-box">
        <el-table
          :data="tableData"
          border
          style="width: 100%"
          v-loading="loading"
        >
          <el-table-column
            prop="loginName"
            label="账号"
            align="center"
          ></el-table-column>
          <el-table-column
            prop="realName"
            label="姓名"
            align="center"
          ></el-table-column>
          <el-table-column prop="roleList" label="角色" align="center">
            <template slot-scope="scoped">
              <span v-for="(item, index) in scoped.row.roleList" :key="item.id">{{
                `${item.roleName}${
                  index != scoped.row.roleList.length - 1 ? "、" : ""
                }`
              }}</span>
            </template>
          </el-table-column>
e5ff81a1   阿宝   集团管理员接口
148
149
150
151
152
153
          <el-table-column
            v-if="role == 'ROLE_JITUAN'"
            prop="regionList"
            label="管辖范围"
            align="center"
          >
dbbfc6c5   梁保满   飞书优化及bug
154
155
156
            <template slot-scope="scoped" v-if="scoped.row.schoolList.length">
              <span v-for="item in scoped.row.schoolList" :key="item.id">{{
                item.schoolName
e5ff81a1   阿宝   集团管理员接口
157
158
159
              }}</span>
            </template>
          </el-table-column>
42056450   阿宝   权限修改
160
161
          <el-table-column prop="available" label="状态" align="center"
            ><template slot-scope="scoped">{{
aeac66d4   阿宝   飞书测试bug
162
              `${scoped.row.available == 0 ? "正常" : "禁用"}`
42056450   阿宝   权限修改
163
164
165
166
167
168
            }}</template></el-table-column
          >
          <el-table-column
            prop="createdTime"
            label="创建时间"
            align="center"
225a00b6   梁保满   飞书问题解决
169
            width="200"
42056450   阿宝   权限修改
170
          ></el-table-column>
addb60e3   梁保满   长水集团管理员屏蔽账号管理页面各种增删改
171
          <el-table-column label="操作" align="center" width="160" v-if="!code">
42056450   阿宝   权限修改
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
            <template slot-scope="scoped">
              <el-tooltip content="修改账号" placement="left">
                <el-button
                  class="set-count"
                  type="primary"
                  circle
                  icon="el-icon-edit-outline"
                  size="mini"
                  @click="setCount(scoped.row)"
                ></el-button>
              </el-tooltip>
              <el-dropdown
                trigger="hover"
                @command="handleDropdownClick($event, scoped.row)"
              >
                <el-button
                  type="info"
                  size="mini"
                  circle
                  icon="el-icon-more"
                ></el-button>
                <el-dropdown-menu slot="dropdown">
                  <el-dropdown-item :command="0">重置密码</el-dropdown-item>
bb4c8454   阿宝   添加,修改教师
195
196
197
                  <el-dropdown-item :command="1">{{
                    `${scoped.row.available == 0 ? "禁用" : "启用"}`
                  }}</el-dropdown-item>
42056450   阿宝   权限修改
198
199
200
201
202
203
204
205
                  <el-dropdown-item :command="2">删除</el-dropdown-item>
                </el-dropdown-menu>
              </el-dropdown>
            </template>
          </el-table-column>
        </el-table>
        <div class="pagination-box">
          <el-pagination
42056450   阿宝   权限修改
206
207
208
209
210
211
212
213
214
            layout="total,prev, pager, next"
            :hide-on-single-page="true"
            :total="total"
            @current-change="changePage"
            :current-page="page"
            :page-size="size"
          >
          </el-pagination>
        </div>
42056450   阿宝   权限修改
215
      </div>
ee00775c   梁保满   测试bug
216
217
218
219
220
221
      <el-dialog
        :close-on-click-modal="false"
        title="修改账号信息"
        :visible.sync="diaCount"
        width="400"
      >
42056450   阿宝   权限修改
222
223
224
225
226
227
228
229
230
231
232
233
        <el-form
          class="form-box"
          :model="formCount"
          :rules="ruleCount"
          ref="formCount"
          label-width="160px"
        >
          <el-form-item label="手机号码:" prop="loginName">
            <el-col :span="12">
              <el-input
                placeholder="请输入联系电话"
                v-model.trim="formCount.loginName"
4c2fb560   梁保满   反馈新需求
234
                clearable
42056450   阿宝   权限修改
235
236
237
238
239
240
241
242
243
244
                maxlength="11"
              >
              </el-input>
            </el-col>
          </el-form-item>
          <el-form-item label="姓名:" prop="realName">
            <el-col :span="12">
              <el-input
                placeholder="请输入教师姓名"
                v-model.trim="formCount.realName"
4c2fb560   梁保满   反馈新需求
245
                clearable
42056450   阿宝   权限修改
246
247
248
249
250
251
                maxlength="11"
              >
              </el-input>
            </el-col>
          </el-form-item>
        </el-form>
ee00775c   梁保满   测试bug
252
        <div class="dialog-footer" slot="footer" v-loading="loadingSave">
42056450   阿宝   权限修改
253
254
255
256
          <el-button @click="saveCount">确 定</el-button>
          <el-button @click="diaCount = false">取 消</el-button>
        </div>
      </el-dialog>
ee00775c   梁保满   测试bug
257
258
259
260
261
262
      <el-dialog
        :close-on-click-modal="false"
        title="添加账号"
        :visible.sync="diaAdd"
        width="400"
      >
e5ff81a1   阿宝   集团管理员接口
263
264
265
266
267
268
269
270
271
272
273
274
        <el-form
          class="form-box"
          :model="formAddCount"
          :rules="ruleAddCount"
          ref="formAddCount"
          label-width="160px"
        >
          <el-form-item label="手机号码:" prop="phone">
            <el-col :span="12">
              <el-input
                placeholder="请输入联系电话"
                v-model.trim="formAddCount.phone"
1365ef5e   梁保满   优化
275
                type="number"
4c2fb560   梁保满   反馈新需求
276
                clearable
1365ef5e   梁保满   优化
277
                oninput="if(value.length > 11) value = value.slice(0,11)"
e5ff81a1   阿宝   集团管理员接口
278
279
280
281
282
283
284
285
286
              >
              </el-input>
            </el-col>
          </el-form-item>
          <el-form-item label="密码:" prop="password">
            <el-col :span="12">
              <el-input
                placeholder="请输入密码"
                v-model.trim="formAddCount.password"
4c2fb560   梁保满   反馈新需求
287
                clearable
e5ff81a1   阿宝   集团管理员接口
288
289
290
291
292
293
294
295
296
297
                maxlength="18"
              >
              </el-input>
            </el-col>
          </el-form-item>
          <el-form-item label="姓名:" prop="realName">
            <el-col :span="12">
              <el-input
                placeholder="请输入姓名"
                v-model.trim="formAddCount.realName"
4c2fb560   梁保满   反馈新需求
298
                clearable
e5ff81a1   阿宝   集团管理员接口
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
                maxlength="30"
              >
              </el-input>
            </el-col>
          </el-form-item>
          <el-form-item label="选择角色:" prop="roleId">
            <el-col :span="12">
              <el-select
                class="sel"
                v-model="formAddCount.roleId"
                placeholder="选择角色"
              >
                <el-option
                  v-for="item in tenantRoleList"
                  :key="item.id"
                  :label="item.roleName"
                  :value="item.id"
                ></el-option>
              </el-select>
            </el-col>
          </el-form-item>
255e2506   梁保满   飞书bug及优化
320
          <el-form-item
e0c18984   梁保满   集团管理员添加账号权限问题
321
            v-if="permissionLevel(formAddCount.roleId) != 6"
255e2506   梁保满   飞书bug及优化
322
            label="选择管辖范围:"
54857fa3   梁保满   下载模板跨域,集团管理员选择角色范...
323
324
325
            :prop="
              permissionLevel(formAddCount.roleId) == 5 ? 'regionId' : 'schoolId'
            "
255e2506   梁保满   飞书bug及优化
326
          >
e5ff81a1   阿宝   集团管理员接口
327
328
            <el-col :span="12">
              <el-select
54857fa3   梁保满   下载模板跨域,集团管理员选择角色范...
329
                v-show="permissionLevel(formAddCount.roleId) == 5"
e5ff81a1   阿宝   集团管理员接口
330
331
332
333
334
335
336
337
338
339
340
                class="sel"
                v-model="formAddCount.regionId"
                placeholder="选择管辖范围"
              >
                <el-option
                  v-for="item in regionList"
                  :key="item.id"
                  :label="item.regionName"
                  :value="item.id"
                ></el-option>
              </el-select>
225a00b6   梁保满   飞书问题解决
341
              <el-select
54857fa3   梁保满   下载模板跨域,集团管理员选择角色范...
342
                v-show="permissionLevel(formAddCount.roleId) == 4"
225a00b6   梁保满   飞书问题解决
343
344
345
346
347
348
349
350
351
352
353
                class="sel"
                v-model="formAddCount.schoolId"
                placeholder="选择管辖范围"
              >
                <el-option
                  v-for="item in addSelectSchoolList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                ></el-option>
              </el-select>
e5ff81a1   阿宝   集团管理员接口
354
355
356
            </el-col>
          </el-form-item>
        </el-form>
ee00775c   梁保满   测试bug
357
        <div class="dialog-footer" slot="footer" v-loading="loadingSave">
e5ff81a1   阿宝   集团管理员接口
358
359
360
361
          <el-button @click="saveAddCount">确 定</el-button>
          <el-button @click="diaAdd = false">取 消</el-button>
        </div>
      </el-dialog>
ee00775c   梁保满   测试bug
362
363
364
365
366
367
      <el-dialog
        :close-on-click-modal="false"
        title="导入账号名单"
        :visible.sync="diaUp"
        width="600"
      >
1365ef5e   梁保满   优化
368
369
370
371
372
373
        <up-load
          id="downTeacher"
          :url="url"
          @upSuccess="upSuccess"
          fileName="教师名单"
        >
e5ff81a1   阿宝   集团管理员接口
374
375
376
377
378
379
380
381
382
          <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>
42056450   阿宝   权限修改
383
    </div>
4c4f7640   梁保满   路由表,路由前端文件
384
385
386
  </template>
  
  <script>
e5ff81a1   阿宝   集团管理员接口
387
  import { encryptLoginPassword } from "@/utils";
4c4f7640   梁保满   路由表,路由前端文件
388
  export default {
42056450   阿宝   权限修改
389
390
    data() {
      return {
f5729396   梁保满   批量设置答案
391
        code: "",
e5ff81a1   阿宝   集团管理员接口
392
393
394
395
        role: "",
        diaUp: false,
        diaAdd: false,
        url: "", //上传地址
42056450   阿宝   权限修改
396
        loading: false,
f5729396   梁保满   批量设置答案
397
        syncLoading: false,
ee00775c   梁保满   测试bug
398
        loadingSave: false,
42056450   阿宝   权限修改
399
        diaCount: false,
e5ff81a1   阿宝   集团管理员接口
400
401
402
        tenantRoleList: [],
        regionList: [],
        schoolList: [],
225a00b6   梁保满   飞书问题解决
403
        schoolAll: [],
1b9bae95   梁保满   级联选择器调整,日志接口调整
404
        props: { multiple: true, checkStrictly: true },
e5ff81a1   阿宝   集团管理员接口
405
406
        roleList: [],
        query: {
31f6e0f6   梁保满   集团管理员账号管理
407
          schoolIds: [],
e5ff81a1   阿宝   集团管理员接口
408
409
410
411
412
413
414
415
416
          roleId: "",
          available: "",
          loginName: "",
          realName: "",
        },
        tableData: [],
        total: 0,
        page: 1,
        size: 20,
42056450   阿宝   权限修改
417
418
419
420
421
422
423
424
425
426
427
428
429
        formCount: {
          userId: "",
          loginName: "",
          realName: "",
        },
        ruleCount: {
          loginName: [
            { required: true, message: "请输入联系电话", trigger: "blur" },
          ],
          realName: [
            { required: true, message: "请输入教师姓名", trigger: "blur" },
          ],
        },
e5ff81a1   阿宝   集团管理员接口
430
431
        formAddCount: {
          phone: "",
42056450   阿宝   权限修改
432
          realName: "",
e5ff81a1   阿宝   集团管理员接口
433
434
435
          password: "",
          roleId: "",
          regionId: "",
9309dc5d   梁保满   任课老师接口完成
436
          schoolId: "",
e5ff81a1   阿宝   集团管理员接口
437
        },
225a00b6   梁保满   飞书问题解决
438
        addSelectSchoolList: [],
e5ff81a1   阿宝   集团管理员接口
439
440
441
442
443
444
445
446
        ruleAddCount: {
          phone: [{ required: true, message: "请输入联系电话", trigger: "blur" }],
          realName: [{ required: true, message: "请输入姓名", trigger: "blur" }],
          password: [{ required: true, message: "请输入密码", trigger: "blur" }],
          roleId: [{ required: true, message: "请选择角色", trigger: "blur" }],
          regionId: [
            { required: true, message: "请选择权限区域", trigger: "blur" },
          ],
9309dc5d   梁保满   任课老师接口完成
447
448
449
          schoolId: [
            { required: true, message: "请选择权限区域", trigger: "blur" },
          ],
42056450   阿宝   权限修改
450
        },
42056450   阿宝   权限修改
451
452
453
      };
    },
    created() {
addb60e3   梁保满   长水集团管理员屏蔽账号管理页面各种增删改
454
      this.code = localStorage.getItem("csCode") || "";
54857fa3   梁保满   下载模板跨域,集团管理员选择角色范...
455
456
457
      this.role =
        this.$store.getters.info.showRole ||
        this.$store.getters.info.permissions[0].role;
e5ff81a1   阿宝   集团管理员接口
458
459
460
      if (this.role == "ROLE_JITUAN") {
        this._TenantRoleList();
        this._RegionList();
225a00b6   梁保满   飞书问题解决
461
        this.showSchool();
e5ff81a1   阿宝   集团管理员接口
462
463
464
      } else {
        this._RoleList();
      }
42056450   阿宝   权限修改
465
      this._QueryData(4);
42056450   阿宝   权限修改
466
467
    },
    methods: {
54857fa3   梁保满   下载模板跨域,集团管理员选择角色范...
468
469
470
471
472
473
474
475
476
      permissionLevel(id) {
        let permissionLevel;
        this.tenantRoleList.map((item) => {
          if (item.id == id) {
            permissionLevel = item.permissionLevel;
          }
        });
        return permissionLevel;
      },
f5729396   梁保满   批量设置答案
477
478
479
480
481
482
      async refreshAcc() {
        //长水账号同步
        if (this.syncLoading) return;
        this.syncLoading = true;
        const { data, status, info } = await this.$request.syncUser();
        this.syncLoading = false;
5be3bb70   梁保满   切换账号,缓存组件接口报错问题
483
        if (status === 0) {
f5729396   梁保满   批量设置答案
484
485
          this.$message.success("同步中,请稍后刷新重试~");
          // this._QueryData(4);
5be3bb70   梁保满   切换账号,缓存组件接口报错问题
486
487
488
489
        } else {
          this.$message.error(info);
        }
      },
757a21e3   梁保满   上传成功提示成功数量
490
      upSuccess(res) {
1365ef5e   梁保满   优化
491
        //导入成功
757a21e3   梁保满   上传成功提示成功数量
492
493
494
495
496
        this.$message.closeAll();
        this.$message({
          showClose: true,
          message: `成功(${res.data.success})`,
          type: "success",
54857fa3   梁保满   下载模板跨域,集团管理员选择角色范...
497
          duration: 5000,
757a21e3   梁保满   上传成功提示成功数量
498
        });
1365ef5e   梁保满   优化
499
        this.diaUp = false;
255e2506   梁保满   飞书bug及优化
500
501
        this._QueryData(4);
      },
e5ff81a1   阿宝   集团管理员接口
502
503
504
505
506
507
508
509
      async downExcel() {
        let data = await this.$request.downDevice();
        if (data && !data.code) {
          let blob = new Blob([data], {
            type: "application/vnd.ms-excel;charset=utf-8",
          });
          downloadFile(`账号信息.xlsx`, blob);
        } else {
236b1f0e   梁保满   周末-飞书bug
510
          this.$message.error(data.info);
e5ff81a1   阿宝   集团管理员接口
511
512
513
514
515
516
517
518
519
        }
      },
      openAddDia() {
        //添加账号
        this.formAddCount.phone = "";
        this.formAddCount.realName = "";
        this.formAddCount.password = "";
        this.formAddCount.roleId = "";
        this.formAddCount.regionId = "";
225a00b6   梁保满   飞书问题解决
520
        this.formAddCount.schoolId = "";
e5ff81a1   阿宝   集团管理员接口
521
522
523
524
525
        this.diaAdd = true;
      },
      saveAddCount() {
        this.$refs.formAddCount.validate(async (valid) => {
          if (valid) {
ee00775c   梁保满   测试bug
526
            this.loadingSave = true;
e5ff81a1   阿宝   集团管理员接口
527
528
529
530
531
            let params = { ...this.formAddCount };
            params.password = encryptLoginPassword(params.password);
            const { data, status, info } = await this.$request.addUser({
              ...params,
            });
ee00775c   梁保满   测试bug
532
            this.loadingSave = false;
e5ff81a1   阿宝   集团管理员接口
533
534
535
536
537
538
539
540
541
542
543
544
545
            if (status === 0) {
              this.$message.success(info);
              this._QueryData(4);
              this.diaAdd = false;
            } else {
              this.$message.error(info);
            }
          } else {
            this.$message.warning("输入有误请检查!");
            return false;
          }
        });
      },
42056450   阿宝   权限修改
546
      setCount(obj) {
9309dc5d   梁保满   任课老师接口完成
547
548
549
        if (this.role != "ROLE_JITUAN") {
          this.formCount.userId = obj.userId;
        } else {
dbbfc6c5   梁保满   飞书优化及bug
550
          this.formCount.userId = obj.id;
9309dc5d   梁保满   任课老师接口完成
551
        }
42056450   阿宝   权限修改
552
553
554
555
556
        this.formCount.loginName = obj.loginName;
        this.formCount.realName = obj.realName;
        this.diaCount = true;
      },
      handleDropdownClick(value, item) {
e5ff81a1   阿宝   集团管理员接口
557
        console.log(item);
42056450   阿宝   权限修改
558
        //更多
bb4c8454   阿宝   添加,修改教师
559
560
561
562
563
564
565
566
567
568
569
570
        if (value == 2) {
          this.$confirm("确定要删除这条账号信息吗?", "提示", {
            customClass: "del-model",
            cancelButttonText: "取消",
            confirmButtonText: "确定",
            type: "warning",
          }).then(() => {
            this.updateUser(item, value);
          });
        } else {
          this.updateUser(item, value);
        }
42056450   阿宝   权限修改
571
572
573
574
575
      },
      changePage(page) {
        this.page = page;
        this._QueryData(4);
      },
4c4f7640   梁保满   路由表,路由前端文件
576
  
42056450   阿宝   权限修改
577
578
579
      saveCount() {
        this.$refs.formCount.validate(async (valid) => {
          if (valid) {
ee00775c   梁保满   测试bug
580
            this.loadingSave = true;
e5ff81a1   阿宝   集团管理员接口
581
582
583
584
585
586
587
588
589
590
            const { data, status, info } =
              this.role != "ROLE_JITUAN"
                ? await this.$request.updateUser({
                    type: 3,
                    ...this.formCount,
                  })
                : await this.$request.tenantUpdateUser({
                    type: 3,
                    ...this.formCount,
                  });
ee00775c   梁保满   测试bug
591
            this.loadingSave = false;
42056450   阿宝   权限修改
592
593
            if (status === 0) {
              this.$message.success(info);
255e2506   梁保满   飞书bug及优化
594
              this.diaCount = false;
42056450   阿宝   权限修改
595
596
597
598
599
              this._QueryData(4);
            } else {
              this.$message.error(info);
            }
          } else {
e5ff81a1   阿宝   集团管理员接口
600
            this.$message.warning("输入有误请检查!");
42056450   阿宝   权限修改
601
602
603
604
            return false;
          }
        });
      },
296f7c47   梁保满   集团管理员接口调整
605
606
607
      async showSchool() {
        const { data, status, info } = await this.$request.schoolList();
        if (status === 0) {
225a00b6   梁保满   飞书问题解决
608
609
610
611
612
613
614
615
616
617
618
619
620
621
          (this.addSelectSchoolList = data.list?.map((item) => {
            return {
              value: item.id,
              label: item.schoolName,
            };
          })),
            (this.schoolAll = [
              {
                value: 0,
                label: "全部",
                children: [...this.addSelectSchoolList],
              },
            ]);
          this.schoolList = [...this.schoolAll, ...this.schoolList];
296f7c47   梁保满   集团管理员接口调整
622
623
624
625
        } else {
          this.$message.error(info);
        }
      },
42056450   阿宝   权限修改
626
      async updateUser(obj, type) {
9309dc5d   梁保满   任课老师接口完成
627
628
        let query = {};
        console.log(query);
42056450   阿宝   权限修改
629
630
631
        if (type == 1) {
          query.available = obj.available == 0 ? 1 : 0;
        }
e5ff81a1   阿宝   集团管理员接口
632
633
634
        const { data, status, info } =
          this.role != "ROLE_JITUAN"
            ? await this.$request.updateUser({
9309dc5d   梁保满   任课老师接口完成
635
636
                userId: obj.userId,
                type: type,
e5ff81a1   阿宝   集团管理员接口
637
638
639
                ...query,
              })
            : await this.$request.tenantUpdateUser({
dbbfc6c5   梁保满   飞书优化及bug
640
                userId: obj.id,
9309dc5d   梁保满   任课老师接口完成
641
                type: type,
e5ff81a1   阿宝   集团管理员接口
642
643
                ...query,
              });
42056450   阿宝   权限修改
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
        if (status === 0) {
          this.$message.success(info);
          this._QueryData(4);
        } else {
          this.$message.error(info);
        }
      },
      async _RoleList() {
        const { data, status, info } = await this.$request.roleList();
        if (status === 0) {
          this.roleList = data.list || [];
        } else {
          this.$message.error(info);
        }
      },
e5ff81a1   阿宝   集团管理员接口
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
      async _TenantRoleList() {
        //集团-添加账号权限
        const { data, status, info } = await this.$request.tenantRoleList();
        if (status === 0) {
          this.tenantRoleList = data.list || [];
        } else {
          this.$message.error(info);
        }
      },
      async _RegionList() {
        //集团-区域列表
        const { data, status, info } = await this.$request.regionList();
        if (status === 0) {
          this.regionList = [...data.list] || [];
          this.schoolList = data.list?.map((item) => {
            let children = item.schoolList?.map((items) => {
              return {
                value: items.id,
                label: items.schoolName,
              };
            });
            return {
              value: item.id,
              label: item.regionName,
              children: children,
            };
          });
225a00b6   梁保满   飞书问题解决
686
          this.schoolList = [...this.schoolAll, ...this.schoolList];
e5ff81a1   阿宝   集团管理员接口
687
688
689
690
        } else {
          this.$message.error(info);
        }
      },
225a00b6   梁保满   飞书问题解决
691
692
      setQuery(type) {
        //整理请求参数
42056450   阿宝   权限修改
693
694
695
696
697
698
699
700
701
        let query = {};
        if (type == 1) {
          query.roleId = this.query.roleId;
          query.available = this.query.available;
          this.query.loginName = "";
          this.query.realName = "";
        } else if (type == 2) {
          this.query.roleId = "";
          this.query.available = "";
31f6e0f6   梁保满   集团管理员账号管理
702
          this.query.schoolIds = [];
42056450   阿宝   权限修改
703
704
705
          query.loginName = this.query.loginName;
          this.query.realName = "";
        } else if (type == 3) {
31f6e0f6   梁保满   集团管理员账号管理
706
          this.query.schoolIds = [];
42056450   阿宝   权限修改
707
708
709
710
711
712
713
          this.query.roleId = "";
          this.query.available = "";
          this.query.loginName = "";
          query.realName = this.query.realName;
        } else {
          query = { ...this.query };
        }
e5ff81a1   阿宝   集团管理员接口
714
        if (this.role == "ROLE_JITUAN") {
31f6e0f6   梁保满   集团管理员账号管理
715
716
          let isAll = false;
          query.schoolIds?.map((item) => {
1b9bae95   梁保满   级联选择器调整,日志接口调整
717
            if (item.length == 1) {
31f6e0f6   梁保满   集团管理员账号管理
718
              isAll = true;
e5ff81a1   阿宝   集团管理员接口
719
720
            }
          });
31f6e0f6   梁保满   集团管理员账号管理
721
722
723
724
725
          query.schoolIds = isAll
            ? null
            : query.schoolIds?.map((item) => {
                return item[1];
              });
47a01cb6   梁保满   v1.3测试问题
726
          delete query.roleId;
31f6e0f6   梁保满   集团管理员账号管理
727
728
        } else {
          delete query.schoolIds;
e5ff81a1   阿宝   集团管理员接口
729
        }
1b9bae95   梁保满   级联选择器调整,日志接口调整
730
731
732
733
        return query;
      },
      async _QueryData(type) {
        let query = this.setQuery(type);
42056450   阿宝   权限修改
734
735
        this.loading = true;
        this.tableData = [];
31f6e0f6   梁保满   集团管理员账号管理
736
        let userPage =
e5ff81a1   阿宝   集团管理员接口
737
          this.role != "ROLE_JITUAN"
31f6e0f6   梁保满   集团管理员账号管理
738
739
740
741
742
743
744
            ? this.$request.userPage
            : this.$request.tenantUserPage;
        const { data, status, info } = await userPage({
          ...query,
          page: this.page,
          size: this.size,
        });
e5ff81a1   阿宝   集团管理员接口
745
  
42056450   阿宝   权限修改
746
747
748
749
750
751
752
753
754
755
        this.loading = false;
        if (status === 0) {
          this.tableData = data.list || [];
          this.total = data.count;
        } else {
          this.$message.error(info);
        }
      },
    },
  };
4c4f7640   梁保满   路由表,路由前端文件
756
  </script>
bb4c8454   阿宝   添加,修改教师
757
758
759
760
761
762
763
  <style  lang="scss">
  .del-model {
    .el-message-box__btns button:nth-child(1) {
      color: #667ffd;
    }
  }
  </style>
42056450   阿宝   权限修改
764
  <style lang="scss" scoped>
bb4c8454   阿宝   添加,修改教师
765
766
767
  .el-message-box .el-button--default {
    color: red;
  }
42056450   阿宝   权限修改
768
769
770
771
772
773
  .set-count {
    margin-right: 12px;
  }
  .table-box {
    padding: 0 20px;
  }
31f6e0f6   梁保满   集团管理员账号管理
774
775
776
777
  .answer-header {
    .sel-box {
      .sel {
        margin-right: 20px;
4c2fb560   梁保满   反馈新需求
778
779
      }
    }
31f6e0f6   梁保满   集团管理员账号管理
780
781
    :deep(.el-input-group__append) {
      padding: 0 20px 0 12px;
4c2fb560   梁保满   反馈新需求
782
783
    }
  }
4c4f7640   梁保满   路由表,路由前端文件
784
  </style>