|
@@ -5,7 +5,7 @@
|
5
|
5
|
<div class="class_list">
|
6
|
6
|
<div v-for="item in schoolInfo.children" :key="item.id">
|
7
|
7
|
<div
|
8
|
|
- :class="[curClass === item.id ? 'active' : '']"
|
|
8
|
+ :class="[curClass.id === item.id ? 'active' : '']"
|
9
|
9
|
:title="item.name"
|
10
|
10
|
@click="selectClass(item)"
|
11
|
11
|
>
|
|
@@ -80,7 +80,12 @@
|
80
|
80
|
<div class="table_wrap">
|
81
|
81
|
<Table :columns="columns" :data="searchForm.list">
|
82
|
82
|
<template slot-scope="{ row }" slot="loginname">
|
83
|
|
- <span v-if="row.care === 1" style="color: #FCC138" class="ivu-icon iconfont icon-guanzhu-yiguanzhu"></span> {{row.loginname}}
|
|
83
|
+ <span
|
|
84
|
+ v-if="row.care === 1"
|
|
85
|
+ style="color: #fcc138"
|
|
86
|
+ class="ivu-icon iconfont icon-guanzhu-yiguanzhu"
|
|
87
|
+ ></span>
|
|
88
|
+ {{ row.loginname }}
|
84
|
89
|
</template>
|
85
|
90
|
<template slot-scope="{ row }" slot="enabled">
|
86
|
91
|
<i-switch
|
|
@@ -97,7 +102,10 @@
|
97
|
102
|
<template slot-scope="{ row }" slot="actionSlot">
|
98
|
103
|
<div class="action_list">
|
99
|
104
|
<div class="action_del" @click="toDel(row)">删除</div>
|
100
|
|
- <div class="action_success" @click="toCare(row)">重点关注</div>
|
|
105
|
+ <div class="action_success" @click="toCare(row)">
|
|
106
|
+ <span v-if="row.care === 2">重点关注</span>
|
|
107
|
+ <span v-else>取消关注</span>
|
|
108
|
+ </div>
|
101
|
109
|
</div>
|
102
|
110
|
</template>
|
103
|
111
|
</Table>
|
|
@@ -116,26 +124,58 @@
|
116
|
124
|
></Page>
|
117
|
125
|
</div>
|
118
|
126
|
</div>
|
|
127
|
+ <!-- 已存在列表 -->
|
|
128
|
+ <Modal
|
|
129
|
+ v-model="exitInfo.show"
|
|
130
|
+ :mask-closable="false"
|
|
131
|
+ class="exit_modal modal1"
|
|
132
|
+ title="提示"
|
|
133
|
+ >
|
|
134
|
+ <div class="exit">
|
|
135
|
+ <div>
|
|
136
|
+ <div v-if="exitInfo.studentsExisted.length > 0">
|
|
137
|
+ 以下学生信息已存在
|
|
138
|
+ <Table border :columns="columns2" :data="exitInfo.studentsExisted">
|
|
139
|
+ <template slot-scope="{ row }" slot="usersex">
|
|
140
|
+ <span>
|
|
141
|
+ {{
|
|
142
|
+ row.usersex == 1 ? "男" : row.usersex == 2 ? "女" : "未知"
|
|
143
|
+ }}
|
|
144
|
+ </span>
|
|
145
|
+ </template>
|
|
146
|
+ </Table>
|
|
147
|
+ </div>
|
|
148
|
+ <div v-if="exitInfo.usersExisted.length > 0">
|
|
149
|
+ 已存在非本校账号列表
|
|
150
|
+ <Table border :columns="columns2" :data="exitInfo.usersExisted">
|
|
151
|
+ <template slot-scope="{ row }" slot="usersex">
|
|
152
|
+ <span>
|
|
153
|
+ {{
|
|
154
|
+ row.usersex == 1 ? "男" : row.usersex == 2 ? "女" : "未知"
|
|
155
|
+ }}
|
|
156
|
+ </span>
|
|
157
|
+ </template>
|
|
158
|
+ </Table>
|
|
159
|
+ </div>
|
|
160
|
+ </div>
|
|
161
|
+ </div>
|
|
162
|
+ </Modal>
|
119
|
163
|
<!-- 导入 -->
|
120
|
164
|
<Modal
|
121
|
|
- :mask-closable="false"
|
122
|
|
- v-model="importInfo.show"
|
123
|
|
- class="modal_tip"
|
124
|
|
- title="导入"
|
|
165
|
+ :mask-closable="false"
|
|
166
|
+ v-model="importInfo.show"
|
|
167
|
+ class="modal_tip"
|
|
168
|
+ title="导入"
|
125
|
169
|
>
|
126
|
170
|
<Upload
|
127
|
|
- v-if="importInfo.show"
|
128
|
|
- type="drag"
|
129
|
|
- action
|
130
|
|
- accept=".xls,.xlsx"
|
131
|
|
- :before-upload="handleUpload"
|
|
171
|
+ v-if="importInfo.show"
|
|
172
|
+ type="drag"
|
|
173
|
+ action
|
|
174
|
+ accept=".xls,.xlsx"
|
|
175
|
+ :before-upload="handleUpload"
|
132
|
176
|
>
|
133
|
177
|
<div style="padding: 30px 0; background: #f8f8f9">
|
134
|
|
- <Button
|
135
|
|
- type="primary"
|
136
|
|
- class="primary_btn"
|
137
|
|
- style="font-size: 16px"
|
138
|
|
- >
|
|
178
|
+ <Button type="primary" class="primary_btn" style="font-size: 16px">
|
139
|
179
|
<Icon type="ios-cloud-upload-outline" size="18"></Icon>上传excel
|
140
|
180
|
</Button>
|
141
|
181
|
<div style="margin-top: 10px; color: #999">支持上传xlsx/xls文件</div>
|
|
@@ -150,8 +190,12 @@
|
150
|
190
|
</div>
|
151
|
191
|
<div slot="footer">
|
152
|
192
|
<Button @click="importInfo.show = false">取消</Button>
|
153
|
|
- <Button @click="ok_import" class="primary_btn" :loading="wait_flag" type="primary"
|
154
|
|
- >保存</Button
|
|
193
|
+ <Button
|
|
194
|
+ @click="ok_import"
|
|
195
|
+ class="primary_btn"
|
|
196
|
+ :loading="wait_flag"
|
|
197
|
+ type="primary"
|
|
198
|
+ >保存</Button
|
155
|
199
|
>
|
156
|
200
|
</div>
|
157
|
201
|
</Modal>
|
|
@@ -174,7 +218,7 @@
|
174
|
218
|
<Input v-model="addInfo.username" placeholder="请输入姓名"></Input>
|
175
|
219
|
</FormItem>
|
176
|
220
|
<FormItem label="性别" style="width: calc(50% - 10px)">
|
177
|
|
- <RadioGroup v-model="addInfo.sex">
|
|
221
|
+ <RadioGroup v-model="addInfo.usersex">
|
178
|
222
|
<Radio :label="1">男</Radio>
|
179
|
223
|
<Radio :label="2">女</Radio>
|
180
|
224
|
<Radio :label="0">未知</Radio>
|
|
@@ -262,9 +306,13 @@ import {
|
262
|
306
|
user_delete,
|
263
|
307
|
user_disabled,
|
264
|
308
|
user_enable,
|
265
|
|
- user_list
|
|
309
|
+ user_export,
|
|
310
|
+ user_import,
|
|
311
|
+ user_list,
|
|
312
|
+ user_un_care
|
266
|
313
|
} from "@/api/school";
|
267
|
314
|
import { user_add, user_edit } from "@/api/school";
|
|
315
|
+import { exportToExcel } from "@/utils/exportToExcel";
|
268
|
316
|
|
269
|
317
|
export default {
|
270
|
318
|
data() {
|
|
@@ -295,6 +343,32 @@ export default {
|
295
|
343
|
show: false,
|
296
|
344
|
file: null
|
297
|
345
|
},
|
|
346
|
+ exitInfo: {
|
|
347
|
+ show: false,
|
|
348
|
+ studentsExisted: [],
|
|
349
|
+ usersExisted: []
|
|
350
|
+ },
|
|
351
|
+ columns2: [
|
|
352
|
+ {
|
|
353
|
+ title: "姓名",
|
|
354
|
+ key: "username",
|
|
355
|
+ minWidth: 140,
|
|
356
|
+ align: "center"
|
|
357
|
+ },
|
|
358
|
+ {
|
|
359
|
+ title: "登录名",
|
|
360
|
+ key: "loginname",
|
|
361
|
+ minWidth: 140,
|
|
362
|
+ align: "center"
|
|
363
|
+ },
|
|
364
|
+ {
|
|
365
|
+ title: "性别",
|
|
366
|
+ key: "usersex",
|
|
367
|
+ align: "center",
|
|
368
|
+ slot: "usersex"
|
|
369
|
+ }
|
|
370
|
+ ],
|
|
371
|
+ form_data: null,
|
298
|
372
|
wait_flag: false,
|
299
|
373
|
showLoading: false,
|
300
|
374
|
care_list: [
|
|
@@ -312,7 +386,10 @@ export default {
|
312
|
386
|
{ id: 1, title: "管控中" },
|
313
|
387
|
{ id: 2, title: "解除管控" }
|
314
|
388
|
],
|
315
|
|
- curClass: 0,
|
|
389
|
+ curClass: {
|
|
390
|
+ id: 0,
|
|
391
|
+ name: ""
|
|
392
|
+ },
|
316
|
393
|
addInfo: {
|
317
|
394
|
show: false,
|
318
|
395
|
userid: null,
|
|
@@ -430,7 +507,6 @@ export default {
|
430
|
507
|
this.userInfo = JSON.parse(
|
431
|
508
|
localStorage.getItem("xh_control_userInfo")
|
432
|
509
|
).content;
|
433
|
|
- console.log(this.userInfo);
|
434
|
510
|
this.init();
|
435
|
511
|
this.searchList();
|
436
|
512
|
},
|
|
@@ -444,24 +520,55 @@ export default {
|
444
|
520
|
)[0];
|
445
|
521
|
this.addInfo.classname = classInfo.name;
|
446
|
522
|
},
|
447
|
|
- download(){
|
|
523
|
+ download() {
|
448
|
524
|
//下载模版
|
449
|
525
|
let url = "../../../../doc/student.xls";
|
450
|
|
- console.log(url)
|
451
|
526
|
const a = document.createElement("a"); // 创建a标签
|
452
|
527
|
a.setAttribute("download", "学生信息模版"); // download属性
|
453
|
528
|
a.setAttribute("href", url); // href链接
|
454
|
529
|
a.click(); // 自执行点击事件
|
455
|
530
|
},
|
456
|
|
- ok_import(){
|
457
|
|
- //确定导入
|
|
531
|
+ //确定导入
|
|
532
|
+ ok_import() {
|
|
533
|
+ if (!this.importInfo.file) {
|
|
534
|
+ this.$Message.error("请选择上传文件");
|
|
535
|
+ return;
|
|
536
|
+ }
|
|
537
|
+ this.wait_flag = true;
|
|
538
|
+ let that = this;
|
|
539
|
+ user_import(this.form_data)
|
|
540
|
+ .then((res) => {
|
|
541
|
+ this.wait_flag = false;
|
|
542
|
+ if (res.code == 0) {
|
|
543
|
+ this.importInfo = {
|
|
544
|
+ show: false,
|
|
545
|
+ file: null
|
|
546
|
+ };
|
|
547
|
+ if (res.obj.code == 0) {
|
|
548
|
+ this.$Message.success("导入成功");
|
|
549
|
+ this.searchList();
|
|
550
|
+ } else {
|
|
551
|
+ this.exitInfo = {
|
|
552
|
+ show: true,
|
|
553
|
+ studentsExisted: res.obj.studentsExisted,
|
|
554
|
+ usersExisted: res.obj.usersExisted
|
|
555
|
+ };
|
|
556
|
+ }
|
|
557
|
+ } else {
|
|
558
|
+ this.$Message.error(res.msg);
|
|
559
|
+ }
|
|
560
|
+ this.form_data = null;
|
|
561
|
+ })
|
|
562
|
+ .catch(() => {
|
|
563
|
+ that.wait_flag = false;
|
|
564
|
+ });
|
458
|
565
|
},
|
459
|
566
|
//导入
|
460
|
567
|
userImport() {
|
461
|
568
|
this.importInfo = {
|
462
|
569
|
show: true,
|
463
|
|
- file: null
|
464
|
|
- }
|
|
570
|
+ file: null
|
|
571
|
+ };
|
465
|
572
|
},
|
466
|
573
|
// 上传文件
|
467
|
574
|
handleUpload(file) {
|
|
@@ -469,26 +576,49 @@ export default {
|
469
|
576
|
let suffix = str[str.length - 1];
|
470
|
577
|
suffix = suffix.toLowerCase();
|
471
|
578
|
if (suffix === "xls" || suffix === "xlsx") {
|
472
|
|
- this.import_obj.file = file;
|
|
579
|
+ this.importInfo.file = file;
|
473
|
580
|
this.import_img = true;
|
474
|
581
|
this.form_data = new FormData();
|
475
|
582
|
this.form_data.append("file", file);
|
476
|
|
- this.form_data.append("schoolid", this.userInfo.schoolid);
|
477
|
|
- this.form_data.append("createid", this.userInfo.userid);
|
478
|
|
- this.form_data.append("classid", this.form_list.classid);
|
479
|
|
- this.form_data.append("groupid", 1);
|
|
583
|
+ this.form_data.append("schoolid", 1);
|
|
584
|
+ this.form_data.append("regionid", this.userInfo.regionid);
|
480
|
585
|
} else {
|
481
|
|
- this.import_obj.file = undefined;
|
|
586
|
+ this.importInfo.file = null;
|
482
|
587
|
this.$Message.error("请上传excel文件");
|
483
|
588
|
}
|
484
|
589
|
return false;
|
485
|
590
|
},
|
486
|
|
- userExport() {},
|
|
591
|
+ //导出
|
|
592
|
+ userExport() {
|
|
593
|
+ user_export({ schoolid: 1 }).then((res) => {
|
|
594
|
+ if (res.code === 0) {
|
|
595
|
+ exportToExcel(
|
|
596
|
+ [
|
|
597
|
+ {
|
|
598
|
+ list: res.obj.map((item) => {
|
|
599
|
+ return {
|
|
600
|
+ 登录名: item.loginname,
|
|
601
|
+ 姓名: item.username,
|
|
602
|
+ 班级: item.classname,
|
|
603
|
+ 状态: item.enabled === 1 ? "启用" : "禁用",
|
|
604
|
+ 最后登录时间: item.lasttime || ""
|
|
605
|
+ };
|
|
606
|
+ }),
|
|
607
|
+ name: this.curClass.name
|
|
608
|
+ }
|
|
609
|
+ ],
|
|
610
|
+ this.curClass.name
|
|
611
|
+ );
|
|
612
|
+ } else {
|
|
613
|
+ this.$Message.error(res.msg);
|
|
614
|
+ }
|
|
615
|
+ });
|
|
616
|
+ },
|
487
|
617
|
toAdd() {
|
488
|
618
|
this.addInfo = {
|
489
|
619
|
show: true,
|
490
|
620
|
userid: null,
|
491
|
|
- sex: 1,
|
|
621
|
+ usersex: 1,
|
492
|
622
|
username: "",
|
493
|
623
|
loginname: "",
|
494
|
624
|
loginpwd: "",
|
|
@@ -503,10 +633,8 @@ export default {
|
503
|
633
|
};
|
504
|
634
|
},
|
505
|
635
|
saveAddInfo() {
|
506
|
|
- console.log(this.addInfo);
|
507
|
636
|
this.$refs.addForm.validate((valid) => {
|
508
|
637
|
if (valid) {
|
509
|
|
- console.log(this.addInfo.classid);
|
510
|
638
|
if (this.addInfo.userphone) {
|
511
|
639
|
var filter = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
|
512
|
640
|
if (!filter.test(this.addInfo.userphone)) {
|
|
@@ -521,6 +649,7 @@ export default {
|
521
|
649
|
let form = {
|
522
|
650
|
username: this.addInfo.username,
|
523
|
651
|
loginname: this.addInfo.loginname,
|
|
652
|
+ usersex: this.addInfo.usersex,
|
524
|
653
|
loginpwd: this.addInfo.loginpwd,
|
525
|
654
|
classid: this.addInfo.classid,
|
526
|
655
|
classname: this.addInfo.classname,
|
|
@@ -531,17 +660,10 @@ export default {
|
531
|
660
|
userphone: this.addInfo.userphone,
|
532
|
661
|
cardid: this.addInfo.cardid
|
533
|
662
|
};
|
534
|
|
- //编辑
|
535
|
|
- // if (this.addInfo.appid) {
|
536
|
|
- // form.userid = this.addInfo.userid;
|
537
|
|
- // form.rversion = this.addInfo.rversion;
|
538
|
|
- // }
|
539
|
|
- console.log(form);
|
540
|
663
|
let api = this.addInfo.userid ? user_edit : user_add;
|
541
|
664
|
api(form).then((res) => {
|
542
|
665
|
if (res.code === 0) {
|
543
|
666
|
this.addInfo.show = false;
|
544
|
|
- console.log(res.obj);
|
545
|
667
|
this.$Message.success(res.msg);
|
546
|
668
|
this.searchList();
|
547
|
669
|
} else {
|
|
@@ -551,9 +673,9 @@ export default {
|
551
|
673
|
}
|
552
|
674
|
});
|
553
|
675
|
},
|
554
|
|
- toEdit(row) {},
|
555
|
676
|
toCare(row) {
|
556
|
|
- user_care({ userid: row.userid, rversion: row.rversion }).then((res) => {
|
|
677
|
+ let api = row.care === 1 ? user_un_care : user_care;
|
|
678
|
+ api({ userid: row.userid, rversion: row.rversion }).then((res) => {
|
557
|
679
|
if (res.code === 0) {
|
558
|
680
|
this.searchList();
|
559
|
681
|
this.$Message.success(res.msg);
|
|
@@ -589,7 +711,8 @@ export default {
|
589
|
711
|
});
|
590
|
712
|
},
|
591
|
713
|
selectClass(item) {
|
592
|
|
- this.curClass = item.id;
|
|
714
|
+ this.curClass = item;
|
|
715
|
+ this.searchList();
|
593
|
716
|
},
|
594
|
717
|
init() {
|
595
|
718
|
this.showLoading = true;
|
|
@@ -598,9 +721,8 @@ export default {
|
598
|
721
|
if (res.code === 0) {
|
599
|
722
|
this.schoolInfo = res.obj;
|
600
|
723
|
if (this.schoolInfo.children.length > 0) {
|
601
|
|
- this.curClass = this.schoolInfo.children[0].id;
|
|
724
|
+ this.curClass = this.schoolInfo.children[0];
|
602
|
725
|
}
|
603
|
|
- console.log(res.obj);
|
604
|
726
|
} else {
|
605
|
727
|
this.$Message.error(res.msg);
|
606
|
728
|
}
|
|
@@ -629,7 +751,7 @@ export default {
|
629
|
751
|
page: this.searchForm.page,
|
630
|
752
|
size: this.searchForm.size,
|
631
|
753
|
schoolid: this.searchForm.schoolid,
|
632
|
|
- classid: this.curClass,
|
|
754
|
+ classid: this.curClass.id,
|
633
|
755
|
care: this.searchForm.care,
|
634
|
756
|
enabled: this.searchForm.enabled,
|
635
|
757
|
control: this.searchForm.control,
|
|
@@ -639,7 +761,6 @@ export default {
|
639
|
761
|
if (res.code === 0) {
|
640
|
762
|
this.searchForm.list = res.obj.data;
|
641
|
763
|
this.searchForm.total = res.obj.total;
|
642
|
|
- console.log(this.searchForm.list);
|
643
|
764
|
} else {
|
644
|
765
|
this.$Message.error(res.msg);
|
645
|
766
|
}
|
|
@@ -674,7 +795,7 @@ export default {
|
674
|
795
|
line-height: 30px;
|
675
|
796
|
height: 30px;
|
676
|
797
|
text-align: center;
|
677
|
|
- cursor: p;
|
|
798
|
+ cursor: pointer;
|
678
|
799
|
}
|
679
|
800
|
.active {
|
680
|
801
|
border-radius: 6px;
|
|
@@ -685,6 +806,7 @@ export default {
|
685
|
806
|
.user_list {
|
686
|
807
|
width: calc(100% - 216px);
|
687
|
808
|
height: 100%;
|
|
809
|
+ overflow-y: auto;
|
688
|
810
|
border-radius: 15px;
|
689
|
811
|
background-color: white;
|
690
|
812
|
}
|
|
@@ -733,19 +855,44 @@ export default {
|
733
|
855
|
}
|
734
|
856
|
}
|
735
|
857
|
}
|
736
|
|
-.modal_tip{
|
737
|
|
- .files_list{
|
|
858
|
+.modal_tip {
|
|
859
|
+ .files_list {
|
738
|
860
|
height: 30px;
|
739
|
861
|
line-height: 30px;
|
740
|
862
|
}
|
741
|
|
- .import_tip{
|
|
863
|
+ .import_tip {
|
742
|
864
|
height: 30px;
|
743
|
865
|
line-height: 30px;
|
744
|
866
|
text-align: center;
|
745
|
|
- .theme_color{
|
|
867
|
+ .theme_color {
|
746
|
868
|
color: #339dff;
|
747
|
869
|
cursor: pointer;
|
748
|
870
|
}
|
749
|
871
|
}
|
750
|
872
|
}
|
|
873
|
+// 存在信息
|
|
874
|
+.exit_modal {
|
|
875
|
+ /deep/ .ivu-modal {
|
|
876
|
+ .ivu-modal-content {
|
|
877
|
+ .exit {
|
|
878
|
+ div {
|
|
879
|
+ // margin-bottom: 10px;
|
|
880
|
+ font-size: 18px;
|
|
881
|
+ line-height: 40px;
|
|
882
|
+ }
|
|
883
|
+ }
|
|
884
|
+ .ivu-table {
|
|
885
|
+ -moz-user-select: none;
|
|
886
|
+ -khtml-user-select: none;
|
|
887
|
+ user-select: none;
|
|
888
|
+ }
|
|
889
|
+ div .ivu-table-header thead tr > th {
|
|
890
|
+ height: 40px;
|
|
891
|
+ }
|
|
892
|
+ .ivu-modal-footer {
|
|
893
|
+ display: none;
|
|
894
|
+ }
|
|
895
|
+ }
|
|
896
|
+ }
|
|
897
|
+}
|
751
|
898
|
</style>
|