UserListManager.vue
44.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
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
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
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
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
<template>
<el-container class="fullheight" :class="{'tenant-user-list': isTenant}">
<el-aside width="230px" style="overflow-x:hidden;border: 1px solid #eee">
<ht-select
v-model="selectOrgId"
class="org-select"
:options="orgList"
@change="demChange"
/>
<ht-tree
:data="treeData"
:props="defaultProps"
node-key="id"
highlight-current
:expand-on-click-node="false"
:support-filter="true"
@node-click="orgTreeClick"
@refresh="handleRefresh"
ref="htTree"
class="orgTree"
@row-click="rowClick"
>
</ht-tree>
</el-aside>
<el-container>
<el-main>
<ht-table
@row-click="rowClick"
@load="loadData"
:data="data"
:pageResult="pageResult"
:selection="true"
:default-sorter="[{direction: 'DESC', property: 'updateTime'}]"
quick-search-props="account,fullname,mobile"
:show-custom-column="false"
:show-export="false"
ref="htTable"
@select="selectRow"
@select-all="selectRow"
:header-cell-class-name="headerCellClassName"
@selection-change="handleSelectionChange"
style="padding-bottom: 15px;margin-right: -20px;"
>
<template v-slot:toolbar>
<!-- <el-button-group> -->
<el-button
size="small"
@click="showDialog()"
icon="el-icon-plus"
type="primary"
>添加</el-button
>
<!-- <el-button size="small" @click="beforeSynchronization()" icon="icon-wechat-fill">同步微信通讯录</el-button> -->
<el-button
size="small"
@click="signatureImport()"
icon="el-icon-upload"
>签章导入</el-button
>
<el-button
size="small"
v-if="showExcel"
@click="excelImport()"
icon="el-icon-upload"
>Excel导入</el-button
>
<el-button
size="small"
v-if="showExcel"
@click="excelExport()"
icon="el-icon-download"
:disabled="isDisabled"
>Excel导出</el-button
>
<el-button
@click="setShiftUser()"
size="small"
:disabled="isDisabled"
>设置轮班</el-button
>
<ht-delete-button
style="margin-left:10;"
:url="userDeleteUrl"
:htTable="$refs.htTable"
:disabled="isDisabled"
@after-delete="afterDelete"
>删除</ht-delete-button
>
<!-- </el-button-group> -->
</template>
<template v-slot:search>
<ht-table-search-panel :divide="3">
<ht-table-search-field
label="姓名"
prop="fullname"
placeholder="请输入姓名"
/>
<ht-table-search-field
label="账号"
prop="account"
placeholder="请输入账号"
/>
<ht-table-search-field
label="邮箱"
prop="email"
placeholder="请输入邮箱"
/>
<ht-table-search-field
label="电话"
prop="mobile"
placeholder="请输入电话"
/>
<ht-table-search-field
label="岗位"
prop="POST_NAME_"
placeholder="请选择岗位名称"
/>
<ht-table-search-field
label="职务"
prop="JOB_NAME_"
placeholder="请选择职务名称"
/>
<ht-table-search-field
label="角色"
prop="ROLE_NAME_"
placeholder="请选择角色名称"
/>
<!--<ht-table-search-field type="select" :options="posts" label="岗位" prop="POST_NAME_" placeholder="请选择岗位名称" />
<ht-table-search-field type="select" :options="jobs" label="职务" prop="JOB_NAME_" placeholder="请选择职务名称" />
<ht-table-search-field type="select" :options="roles" label="角色" prop="ROLE_NAME_" placeholder="请选择角色名称" />-->
</ht-table-search-panel>
</template>
<template>
<ht-table-column
type="index"
width="50"
align="center"
label="序号"
/>
<ht-table-column
prop="fullname"
label="名称"
:sortable="true"
:show-overflow-tooltip="true"
>
<template v-slot="{row}">
<el-link
type="primary"
@click="handleCommand({row: row, command: 'showInfo'})"
title="查看详情"
>{{ row.fullname }}</el-link
>
</template>
</ht-table-column>
<ht-table-column prop="account" label="账号" :sortable="true" />
<ht-table-column prop="email" label="邮箱" />
<ht-table-column prop="mobile" label="电话" sortable />
<ht-table-column prop="address" label="地址" :hidden="true" />
<ht-table-column
prop="sex"
label="性别"
width="80"
:render-header="renderHeaderMethod"
:filters="[
{text: '男士', value: '男'},
{text: '女士', value: '女'}
]"
>
<template v-slot="{row}">
<el-tag v-if="row.sex == '男'">男士</el-tag>
<el-tag type="success" v-if="row.sex == '女'">女士</el-tag>
</template>
</ht-table-column>
<ht-table-column
prop="status"
label="状态"
width="110"
:render-header="renderHeaderMethod"
:filters="[
{text: '禁用', value: 0},
{text: '正常', value: 1},
{text: '离职', value: -2}
]"
>
<template v-slot="{row}">
<el-tag type="warning" v-if="row.status == 0">禁用</el-tag>
<el-tag v-if="row.status == 1">正常</el-tag>
<el-tag type="info" v-if="row.status == -2">离职</el-tag>
</template>
</ht-table-column>
<ht-table-column width="230" label="操作" align="left">
<template v-slot="{row}">
<el-button
type="text"
@click="handleCommand({row: row, command: 'edit'})"
>编辑</el-button
>
<el-button
type="text"
class="copy-btn"
@click="handleCommand({row: row, command: 'toUnderUserPage'})"
>下属管理</el-button
>
<el-dropdown
size="mini"
@command="handleCommand"
trigger="click"
class="more-operate-btn__dropdown"
>
<!-- <span> 编辑 </span> -->
<span class="more-operate-btn"
>更多操作<i class="el-icon-caret-bottom"></i>
</span>
<el-dropdown-menu
slot="dropdown"
class="operate-dropdown__button"
>
<!-- <el-dropdown-item :command="{row: row, command: 'toUnderUserPage'}">下属管理</el-dropdown-item> -->
<el-dropdown-item
:command="{row: row, command: 'updatePwd'}"
>重置密码</el-dropdown-item
>
<el-dropdown-item
:command="{row: row, command: 'toFront'}"
v-if="row.status == 1"
>应用端登录
</el-dropdown-item>
<el-dropdown-item
:command="{row: row, command: 'toManager'}"
v-if="row.status == 1"
>管理端登录
</el-dropdown-item>
<el-dropdown-item :command="{row: row, command: 'bindWxDk'}"
>企微钉钉绑定</el-dropdown-item
>
<!-- <el-dropdown-item-->
<!-- :command="{ row: row, command: 'shiftUser'}">设置轮班</el-dropdown-item>-->
</el-dropdown-menu>
</el-dropdown>
<!-- <el-button size="mini" @click="handleCommand({row:row,command:'edit'})">编辑</el-button>
<el-button size="mini" @click="handleCommand({row:row,command:'updatePwd'})">重置密码</el-button>-->
</template>
</ht-table-column>
</template>
</ht-table>
<el-dialog
width="70%"
:title="dialogTitle"
:visible="isUserManagerShow"
:before-close="handleCloseUserManager"
ref="userManagerref"
:close-on-click-modal="false"
append-to-body
class="elDialog"
>
<!--编辑用户面板-->
<user-manager
ref="userManager"
:user-account="clickUserAccount"
v-if="isUserManagerShow"
:org-code="orgCode"
@handleCloseUserManager="handleCloseUserManager"
@closeUserManeger="closeUserManeger"
></user-manager>
</el-dialog>
<ht-sidebar-dialog
width="36%"
title="查看用户"
:visible.sync="isUserInfo"
append-to-body
:before-close="handleCloseUserManager"
>
<user-detail :user="user" />
</ht-sidebar-dialog>
<ht-sidebar-dialog
width="28%"
title="重置密码"
:visible="isUpdatePwd"
append-to-body
:before-close="handleCloseUserManager"
>
<el-form v-model="password">
<ht-form-item label="请输入密码" prop="name" label-width="100px">
<ht-input
v-model="password.pwd"
autocomplete="off"
:validate="pwdValidate"
placeholder="请输入密码"
show-password
></ht-input>
</ht-form-item>
<ht-form-item label="确认密码" prop="name" label-width="100px">
<ht-input
v-model="password.newPwd"
autocomplete="off"
:validate="{
required: true,
regex: {
exp: '^[\\s\\S]{1,20}$',
message: '内容超出输入限制'
}
}"
placeholder="确认密码"
show-password
></ht-input>
</ht-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogCancle('isUpdatePwd')">{{
$t('eip.common.cancel')
}}</el-button>
<el-button @click="updatePwd()" type="primary">修改</el-button>
</div>
</ht-sidebar-dialog>
<ht-load-data
:url="loadDataUrl"
context="uc"
@after-load-data="afterLoadData"
></ht-load-data>
<!-- 角色用户管理 -->
<user-role-manager ref="userRoleManager"></user-role-manager>
<!-- 分类对话框 -->
<eip-sys-type-dialog
ref="flowTypeDialog"
cat-id="6"
></eip-sys-type-dialog>
<!-- 用户导入 -->
<el-dialog
title="导入Excel"
:visible.sync="importDialogVisible"
top="15vh"
:append-to-body="true"
:close-on-click-modal="false"
v-if="importDialogVisible"
>
<div style="padding-left: 20px ;">
<el-row class="import_row ">
<el-col :span="20">
<span class="m-r-10">组织维度: </span>
<ht-select
v-model="importDemCode"
class="org-select"
:options="demList"
/>
</el-col>
<el-col :span="4">
<el-button
size="small"
type="primary"
icon="el-icon-download"
@click="downloadTemplate()"
>模板下载
</el-button>
</el-col>
</el-row>
<el-row class="import_row">
<span class="m-r-10">导入文件: </span>
<el-upload
style="display: inline-block;"
:action="importUserUrl"
:on-success="hadleUploadResult"
:on-error="hadleUploadResult"
:headers="uploadHeaders"
:on-exceed="onExceed"
accept=".xlsx,.xls"
:before-upload="beforeUpload"
:limit="1"
:data="{isCheck: true}"
:auto-upload="false"
ref="upload"
>
<el-button size="small" icon="el-icon-upload"
>选择Excel文件</el-button
>
</el-upload>
</el-row>
<el-row class="import_row">
<span class="m-r-10">用户组织、岗位关系数据导入模式: </span>
<el-radio-group v-model="importRepeatConver">
<el-radio-button label="false">新增</el-radio-button>
<el-radio-button label="true">覆盖</el-radio-button>
</el-radio-group>
</el-row>
<el-row class="import_row descript-title">
<strong>导入须知: </strong>
<p>
1、姓名、帐号为必填字段,组织名称列以“/”开头,下级组织同样用“/”分隔;
</p>
<p>
2、岗位和职务导入规则:一一对应导入,多个用;号隔开,如果没有职务,则不导入岗位,如果有职务,则对应顺序以岗位为准(第一个岗位对应第一个职务,以此类推)(如果岗位有多个,职务只有一个时,导入同一个职务中);
</p>
<p>
3、邮箱格式必须符合标准,将不导入不符合规范的邮箱数据;
</p>
<p>
4、导入过程中如果出现错误则会终止导入,且回滚已导入数据;
</p>
<p>
5、“编码前缀”说明:编码前缀用于生成组织编码的前缀,区分不同组织维度(使得相同的组织架构可以导入到多个不同的组织维度下),不同组织维度导入时需要输入不同的前缀编码,相同的组织维度,输入相同的组织维度编码;
</p>
<p>
6、“用户组织、岗位关系数据导入模式”涉及到已存在用户(导入的用户在系统中已存在)数据导入时组织、岗位关系数据的处理方式(覆盖:先删除旧的组织、岗位关系数据,再按excel中的数据生成新关系数据;新增:不删除旧数据,excel中的数据做新增处理(如果和旧的一样,不会增加多份))。
</p>
</el-row>
</div>
<span slot="footer" class="dialog-footer confirm-detail">
<el-button @click="importDialogVisible = false">取 消</el-button>
<el-button
type="primary"
@click="submitImport"
element-loading-text="拼命导入中"
v-loading.fullscreen.lock="fullscreenLoading"
>确 定</el-button
>
</span>
</el-dialog>
<!-- 签章导入 -->
<el-dialog
title="签章批量导入"
:visible.sync="signatureImportVisible"
top="15vh"
:append-to-body="true"
:close-on-click-modal="false"
v-if="signatureImportVisible"
>
<div style="padding-left: 20px ;">
<el-row class="import_row">
<span class="m-r-10">导入文件: </span>
<el-upload
style="display: inline-block;"
:action="importSignatureUrl"
:on-success="hadleSignatureUploadResult"
:on-error="hadleSignatureUploadResult"
:headers="uploadHeaders"
:on-exceed="onExceed"
accept=".zip"
:before-upload="beforeSignatureUpload"
:limit="1"
:data="{isCheck: true}"
:auto-upload="false"
ref="signatureFile"
>
<el-button size="small" icon="el-icon-upload"
>选择压缩文件</el-button
>
</el-upload>
</el-row>
<el-row class="import_row">
<span class="m-r-10">存在时是否覆盖: </span>
<el-radio-group v-model="signatureRepeatConver">
<el-radio-button label="true">是</el-radio-button>
<el-radio-button label="false">否</el-radio-button>
</el-radio-group>
</el-row>
<el-row class="import_row descript-title">
<strong>导入须知: </strong>
<p>
1、上传附件为压缩文件,文件格式只支持.zip文件,压缩文件中至少包含一个签章文件且签章文件不存在嵌套层级;
</p>
<p>
2、压缩文件中的签章文件只支持.png图片文件,建议图片尺寸:250*70px;
</p>
<p>
3、签章图片以用户账号命名,如用户张三(账号:zhangsan),则签章图片名称为zhangsan.png;
</p>
<p>
4、如果用户已存在签章,则根据导入时的选项执行替换或不操作;
</p>
<p>
5、签章默认密码来自密码策略模块的初始密码。
</p>
</el-row>
</div>
<span slot="footer" class="dialog-footer confirm-detail">
<el-button @click="signatureImportVisible = false">取 消</el-button>
<el-button
type="primary"
@click="submitSignature"
element-loading-text="拼命导入中"
v-loading.fullscreen.lock="fullscreenLoading"
>确 定</el-button
>
</span>
</el-dialog>
<!-- 直接下属管理组件 -->
<under-user-table
:user-id="selectOrgUserAccount"
:dem-list="dimenList"
ref="underUserTable"
/>
<shift-rule-dialog
:single="true"
ref="shiftRuleDialog"
@onConfirm="shiftConfirm"
/>
</el-main>
</el-container>
<ht-sidebar-dialog
width="33%"
append-to-body
title="企微钉钉信息绑定"
class="sp-manager__dialog"
:visible="wxDtVisible"
:before-close="() => (wxDtVisible = false)"
>
<el-form v-form data-vv-scope="userUniteForm">
<ht-form-item label="企业微信userid" label-width="30%">
<ht-input v-model.trim="userUnite.wxWorkId" style="width:90%;" />
</ht-form-item>
<ht-form-item label="阿里钉钉userid" label-width="30%">
<ht-input v-model.trim="userUnite.dingtalkId" style="width:90%;" />
</ht-form-item>
<ht-form-item label="飞书userid" label-width="30%">
<ht-input v-model.trim="userUnite.flybookId" style="width:90%;" />
</ht-form-item>
<ht-form-item label="公众号openid" label-width="30%">
<ht-input v-model.trim="userUnite.openId" style="width:90%;" />
</ht-form-item>
<ht-form-item label="小程序openid" label-width="30%">
<ht-input v-model.trim="userUnite.mpOpenId" style="width:90%;" />
</ht-form-item>
</el-form>
<div slot="footer" style="text-align: right; margin-top: -20px">
<el-button
@click="
() => {
wxDtVisible = false
}
"
>{{ $t('eip.common.cancel') }}</el-button
>
<ht-submit-button
url="${uc}/uc/userUnite/v1/save"
:model="userUnite"
scope-name="userUniteForm"
@after-save-data="() => (wxDtVisible = false)"
>{{ $t('eip.common.save') }}</ht-submit-button
>
</div>
</ht-sidebar-dialog>
</el-container>
</template>
<script>
import uc from '@/api/uc.js'
import org from '@/api/org.js'
import utils from '@/hotent-ui-util.js'
import UserManager from './UserManager'
import UserDetail from './UserDetail'
import EipUserDialog from '@/components/dialog/EipUserDialog.vue'
const UserRoleManager = () => import('@/views/uc/UserRoleManager.vue')
const EipSysTypeDialog = () =>
import('@/components/dialog/EipSysTypeDialog.vue')
const UnderUserTable = () => import('@/views/uc/org/UnderUserTable')
const ShiftRuleDialog = () => import('@/components/dialog/ShiftRuleDialog.vue')
import tenant from '@/store/tenant'
import tableHeaderFilter from '@/mixins/tableHeaderFilter.js'
export default {
components: {
EipUserDialog,
UserRoleManager,
EipSysTypeDialog,
UserManager,
UserDetail,
UnderUserTable,
ShiftRuleDialog
},
mixins: [tableHeaderFilter],
props: {
isTenant: {
type: Boolean,
default: false
}
},
computed: {
userDeleteUrl: function() {
return window.context.uc + '/api/user/v1/user/deleteUserByIds'
},
saveUserUrl: function() {
let preUrl = window.context.uc + '/api/user/v1/user'
if (this.user.id) {
preUrl += '/updateUser'
} else {
preUrl += '/addUser'
}
return preUrl
},
requestMethod: function() {
return this.role.id ? 'PUT' : 'POST'
},
roleCodesOptions: function() {
let result = []
for (let role of this.allowRoles) {
let obj = {}
obj.key = role.code
obj.value = role.name
result.push(obj)
}
return result
},
saveRoleCopy: function() {
return `${window.context.uc}/sys/sysRoleAuth/v1/saveCopy?oldCode=${this.menuPerm.code}&newCodes=${this.menuPerm.newCodes}`
},
importUserUrl: function() {
let tenantId = ''
if (tenant.state.tenantId) {
tenantId = '&tenantId=' + tenant.state.tenantId
}
return (
window.context.uc +
'/api/user/v1/users/importExcelUser?demCode=' +
this.importDemCode +
'&repeatConver=' +
this.importRepeatConver +
tenantId
)
},
importSignatureUrl: function() {
let tenantId = ''
if (tenant.state.tenantId) {
tenantId = '&tenantId=' + tenant.state.tenantId
}
return (
window.context.portal +
'/system/file/v1/importSignature?repeatConver=' +
this.signatureRepeatConver +
tenantId
)
},
uploadHeaders: function(mapState) {
return {
Authorization: 'Bearer ' + this.$store.state.login.currentUser.token
}
}
},
data() {
return {
selectOrgId: '',
selectOrgName: '',
orgList: [], //下拉框待选择的组织
demList: [], //下拉框待选择的维度
treeData: [], //树形菜单展示的数组
defaultProps: {
children: 'children',
label: 'name'
},
reFresh: true,
dialogVisible: false,
isUserManagerShow: false,
showExcel: false,
role: {
name: '',
code: ''
},
user: {
account: '',
address: '',
email: '',
fullname: '',
mobile: '',
password: '',
photo: '',
sex: '',
status: 1,
roleName: '',
orgPostList: []
},
userParam: {},
isSubmit: true,
data: [],
pageResult: {
page: 1,
pageSize: 50,
total: 0
},
loadDataUrl: '',
menuPerm: {},
allowRoles: [],
fileList: [],
img: '',
clickUserAccount: '', //当前点击用户的用户账号
isUserInfo: false,
isUpdatePwd: false,
password: {
pwd: '',
newPwd: ''
},
pwdValidate: {
required: true,
min: 6,
max: 30
},
dialogTitle: '',
roles: [],
jobs: [],
posts: [],
importDialogVisible: false,
importDemCode: '',
importRepeatConver: false,
exportSelection: [],
orgCode: '',
selectOrgUserAccount: '',
orgId: '',
dimenList: [],
wxDtVisible: false,
userUnite: {},
signatureImportVisible: false,
signatureRepeatConver: true,
fullscreenLoading: false,
isDisabled: true, //按钮的禁用
selectedList: []
}
},
watch: {
// 监听选中下
selectedList: {
handler(val) {
this.isDisabled = val.length < 1 ? true : false
},
deep: true
}
},
mounted() {
this.$validator = this.$root.$validator
//维度-组织数据
this.getAllDemList()
//获取用户导入按钮参数
this.getUserExcel()
//默认密码策略
//this.loadPwdStratege();
/*//加载全部角色
this.getAllRoles();
//加载全部职务
this.getAllJobs();
//加载全部岗位
this.getAllPosts();*/
},
methods: {
handleSelectionChange(selection) {
this.selectedList = selection
},
rowClick(row, column, event) {
this.$refs.htTable.$refs.htTable.toggleRowSelection(row)
},
getUserExcel() {
let this_ = this
this.$http
.get('${portal}/sys/sysProperties/v1/getByAlias?alias=userExcel')
.then(function(resp) {
if (resp.data) {
this_.showExcel = true
}
})
},
demChange(data) {
this.selectOrgId = data
this.orgCode = ''
this.loadTreeData()
},
orgTreeClick(orgbytree) {
//重置数据
let ary = this.$refs.htTable.querys
for (var i = 0; i < ary.length; i++) {
if (ary[i].group && ary[i].group == 'orgTree') {
ary.remove(ary[i])
}
}
let quickSearchEl = document.querySelector('.quick-search input')
if (quickSearchEl && !quickSearchEl.value) {
this.$refs.htTable.querys = []
}
if(orgbytree){
if (!orgbytree.code) {
this.$refs.htTable.querys.push({
property: 'DEM_ID_',
value: orgbytree.demId,
group: 'orgTree',
relation: 'AND',
operation: 'EQUAL'
})
} else {
this.orgCode = orgbytree.code
let ids = []
let trees = ''
this.getOrgTrees(orgbytree, ids)
trees = ids.join(',')
if (trees != '') {
this.$refs.htTable.querys.push({
property: 'ORG_ID_',
value: trees,
group: 'orgTree',
relation: 'AND',
operation: 'IN'
})
}
}
}
this.$refs.htTable.load()
},
getOrgTrees(node, ids) {
ids.push(node.id)
let arr = node.children
if (arr) {
for (var i = 0; i < arr.length; i++) {
this.getOrgTrees(arr[i], ids)
}
}
},
async handleRefresh(cb) {
await this.loadTreeData(cb)
//重置数据
let ary = this.$refs.htTable.querys
for (var i = 0; i < ary.length; i++) {
if (ary[i].group && ary[i].group == 'orgTree') {
ary.remove(ary[i])
}
}
// await this.$refs.htTable.load()
this.treeData[0] && this.orgTreeClick(this.treeData[0])
},
getAllDemList() {
org
.getDescAll()
.then(resp => {
for (let i = 0; i < resp.length; i++) {
this.orgList.push({
key: resp[i].id,
value: resp[i].demName
})
this.demList.push({
key: resp[i].code,
value: resp[i].demName
})
this.dimenList = resp
if (resp[i].isDefault === 1) {
this.selectOrgId = resp[i].id
}
}
})
.then(params => {
var dem = {
demId: this.selectOrgId
}
org.getByParentAndDemToTree(dem).then(data => {
this.treeData = utils.tile2nest(data)
this.orgTreeClick()
})
})
},
async loadTreeData(cb) {
var param = {
demId: this.selectOrgId
}
await org.getByParentAndDemToTree(param).then(data => {
this.treeData = utils.tile2nest(data)
this.treeData[0] && this.orgTreeClick(this.treeData[0])
cb && cb()
})
},
loadPwdStratege() {
uc.getDefaultPwdStrategy().then(data => {
if (data) {
let form = data
if (form.enable == 1) {
let pwdRule = form.pwdRule
let pwdLength = form.pwdLength
if (pwdRule == 1) {
this.pwdValidate = {
required: true,
min: pwdLength
}
} else {
let regex = {}
if (pwdRule == 2) {
regex = {
exp: '^(?=.*[0-9])(?=.*[a-zA-Z]).{' + pwdLength + ',30}$',
message: '密码必须包含字母、数字,至少' + pwdLength + '位'
}
} else if (pwdRule == 3) {
regex = {
exp:
'^(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9]).{' +
pwdLength +
',30}$',
message:
'密码必须包含数字、字母、特殊字符,至少' + pwdLength + '位'
}
} else if (pwdRule == 4) {
regex = {
exp:
'^(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.*[^a-zA-Z0-9]).{' +
pwdLength +
',30}$',
message:
'密码必须包含数字、大小写字母、特殊字符,至少' +
pwdLength +
'位'
}
}
this.pwdValidate = {
required: true,
regex: regex
}
}
}
}
})
},
onBeforeUploadImage(file) {
const isIMAGE = file.type === 'image/jpeg' || 'image/jpg' || 'image/png'
const isLt1M = file.size / 1024 / 1024 < 1
if (!isIMAGE) {
this.$message.error('上传文件只能是图片格式!')
}
if (!isLt1M) {
this.$message.error('上传文件大小不能超过 1MB!')
}
return isIMAGE && isLt1M
},
UploadImage(param) {
//执行文件上传
const formData = new FormData()
formData.append('files', param.file)
uc.fileUpload(formData)
.then(response => {
this.user.photo =
'/system/file/v1/downloadFile?fileId=' + response.fileId
param.onSuccess() // 上传成功的图片会显示绿色的对勾
})
.catch(response => {
param.onError()
})
},
handleClose() {
this.dialogVisible = false
},
handleCloseUserManager() {
this.isUserManagerShow = false
this.isUserInfo = false
this.isUpdatePwd = false
this.password = {}
this.clickUserAccount = ''
this.$refs.htTable.load()
},
showDialog(row) {
this.dialogTitle = '添加用户'
this.isUserManagerShow = false
this.$nextTick(() => {
this.isUserManagerShow = true
})
},
dialogCancle(dialogVisible) {
this[dialogVisible] = false
},
loadData(param, cb) {
uc.getOrgUserQuery(param)
.then(response => {
this.data = response.rows
this.pageResult = {
page: response.page,
pageSize: response.pageSize,
total: response.total
}
})
.finally(() => cb())
},
handleCommand(params) {
switch (params.command) {
case 'edit':
this.dialogTitle = '编辑用户'
this.clickUserAccount = params.row.account
this.isUserManagerShow = false
this.$nextTick(() => {
this.isUserManagerShow = true
})
break
case 'showInfo':
this.selectUserInfo(params.row.account)
break
case 'updatePwd':
this.user = params.row
this.isUpdatePwd = true
break
case 'toFront':
uc.getTokenByUserName(params.row.account).then(resp => {
let token = resp.value
// window.location.href = `${window.context.front}?token= ` + token;
window.open(`${window.context.front}/index?token=` + token)
})
break
case 'toManager':
uc.getTokenByUserName(params.row.account).then(resp => {
let token = resp.value
let target = 'toManager'
// window.location.href = `${window.context.front}?token= ` + token;
window.open(
`${window.context.manage}?toManager=${target}&token=${token}`,
'_blank'
)
})
break
case 'bindWxDk':
this.getUserUniteData(params.row.userId)
break
case 'toUnderUserPage':
this.selectOrgUserAccount = params.row.account
this.$refs.underUserTable.showDialog(params.row.userId)
break
case 'shiftUser':
this.setShiftUser(params.row.userId)
default:
break
}
},
async beforeSaveData() {
this.isSubmit = true
},
afterSaveData() {
this.dialogVisible = false
this.$refs.htTable.load()
},
afterDelete() {
this.$refs.htTable.load()
},
afterLoadData(data) {
// 菜单权限复制
if (this.isUserManagerShow) {
this.allowRoles = data
}
// 编辑角色
if (this.dialogVisible) {
this.role = data.value
setTimeout(() => this.$validator.validateAll('editRoleForm'))
}
},
showFlowTypeDialog() {
this.$refs.flowTypeDialog.showDialog()
},
selectUserInfo(account) {
//查询用户的详细信息
uc.getUser(account)
.then(resp => {
resp.photo = `${window.context.portal}` + resp.photo
this.user = {...resp.user}
})
.then(() => {
// 获取用户参数
this.getUserParams(account)
// 所属角色
this.userRoleLoad({
groupRelation: 'AND',
pageBean: {
page: 1,
pageSize: -1,
showTotal: true
},
querys: [
{
group: 'main',
operation: 'EQUAL',
parentGroup: '',
property: 'u.account_',
relation: 'AND',
value: account
}
]
})
// 获取签章
this.getSealByUserId()
// 查询所属组织岗位,所属角色信息
uc.getUserByUserId(this.user.id).then(resp => {
this.$set(
this.user,
'roleName',
resp[resp.length - 1].roleName.roleName
)
let _orgPostList = []
for (var i = 0; i < resp.length - 1; i++) {
_orgPostList.push(resp[i])
}
this.$set(this.user, 'orgPostList', _orgPostList)
this.isUserInfo = true
})
})
},
// 获取签章
getSealByUserId() {
uc.getSealByUserId(this.user.id).then(resp => {
if (resp) {
this.$store.dispatch('menu/downloadImg', resp.fileId).then(res => {
if (res != '') {
this.$set(this.user, 'electronicSealPic', res)
}
})
}
})
},
// 所属角色
userRoleLoad(param, cb) {
uc.userRolePage(param).then(response => {
if (response) {
this.$set(this.user, 'userRoleList', response.rows)
}
})
},
// 获取用户参数
getUserParams(account) {
uc.getUserParams()
.then(resp => {
return resp
})
.then(params => {
if (!params || params.constructor != Array || params.length < 1) {
return
}
uc.getUserParamsValue(account).then(response => {
if (response && response.constructor == Array) {
response.forEach(r => {
this.userParam[r['alias']] = r['value']
})
this.$set(this.user, 'userParam', this.userParam)
this.$set(this.user, 'userParams', params)
}
})
})
},
beforeSynchronization() {
var users = this.$refs.htTable.$refs.htTable.selection
let userIds = users.map(obj => {
return obj.userId
})
uc.syncUserToWx(userIds).then(() => {
this.$refs.htTable.load()
})
},
updatePwd() {
if (this.password.pwd != this.password.newPwd) {
this.$message.error('两次输入密码不一致')
return
} else if (this.password.newPwd == '' || this.password.newPwd == null) {
this.$message.error('请输入密码')
return
} else if (this.password.newPwd.length < 6) {
this.$message.error('密码长度必须到6位')
return
}
var param = {
account: this.user.account,
newPwd: this.password.newPwd
}
uc.updateUserPsw(param).then(result => {
if (result.state) {
this.$message({
message: '修改成功!',
type: 'success'
})
this.isUpdatePwd = false
this.password = {}
}
})
},
closeUserManeger() {
this.handleCloseUserManager()
},
excelImport() {
this.fullscreenLoading = false
this.importDialogVisible = true
},
signatureImport() {
this.fullscreenLoading = false
this.signatureImportVisible = true
},
excelExport() {
if (this.exportSelection.length < 1) {
this.$message({type: 'warning', message: '请选择需要导出的数据!'})
return false
}
let select = []
for (let i = 0; i < this.exportSelection.length; i++) {
select.push(JSON.stringify(this.exportSelection[i]))
}
let loading = this.$loading()
uc.userExport(select, resp => {
loading.close()
this.$message({type: 'success', message: '导出成功'})
})
},
rowClick(row, column, event) {
this.$refs.htTable.$refs.htTable.toggleRowSelection(row)
},
selectRow(selection, row) {
this.exportSelection = selection
},
getAllRoles() {
uc.getAllRoles().then(data => {
data.forEach(item => {
this.roles.push({
key: item.name,
value: item.name
})
})
})
},
getAllJobs() {
uc.getAllJobs().then(data => {
data.forEach(item => {
this.jobs.push({
key: item.name,
value: item.name
})
})
})
},
getAllPosts() {
uc.getAllPosts().then(data => {
data.rows.forEach(item => {
this.posts.push({
key: item.name,
value: item.name
})
})
})
},
getTokenByUserName(username) {
let token = ''
uc.getTokenByUserName(username).then(resp => {
token = resp.value
})
return token
},
onExceed(file) {
this.$message.warning('只能选择一个Excel文件!')
},
submitImport() {
if (
!this.$refs.upload.uploadFiles ||
this.$refs.upload.uploadFiles.length == 0
) {
this.$message.warning('请选择要导入的数据文件!')
return false
}
if (!this.importDemCode) {
this.$message.warning('请选择要导入的维度!')
return false
}
this.$refs.upload.submit()
},
beforeUpload(file) {
if (!file.name.endsWith('.xlsx') && !file.name.endsWith('.xls')) {
this.$message.warning('只能导入Excel文件!')
return false
}
this.fullscreenLoading = true
},
hadleUploadResult(response, file, fileList) {
this.fullscreenLoading = false
if (response.state) {
this.$message.success(response.message)
this.importDialogVisible = false
this.$refs.htTable.load()
} else {
this.$message({
type: 'error',
message: response.message + ':' + response.value,
duration: 10000
})
}
this.$refs.upload.handleRemove(file)
},
submitSignature() {
if (
!this.$refs.signatureFile.uploadFiles ||
this.$refs.signatureFile.uploadFiles.length == 0
) {
this.$message.warning('请选择要导入的数据文件!')
return false
}
this.$refs.signatureFile.submit()
},
beforeSignatureUpload(file) {
if (!file.name.endsWith('.zip')) {
this.$message.warning('只能导入压缩(zip)文件!')
return false
}
this.fullscreenLoading = true
},
hadleSignatureUploadResult(response, file, fileList) {
this.fullscreenLoading = false
if (response.state) {
this.$message.success(response.message)
this.signatureImportVisible = false
this.$refs.htTable.load()
} else {
if (response.value) {
this.$message.error(response.message + ':' + response.value)
} else {
this.$message.error(response.message)
}
}
},
downloadTemplate() {
window.location.href =
window.context.manage + '/static/excel/importOrgUser.xlsx'
},
setShiftUser(id) {
let selection = this.$refs.htTable.$refs.htTable.selection
if (selection.length <= 0) {
this.$message.error('请选择用户!')
return
}
this.$refs.shiftRuleDialog.showDialog()
},
shiftConfirm(data) {
let selection = this.$refs.htTable.$refs.htTable.selection
if (data.length > 0) {
let shiftUser = selection.map(item => {
return {
userId: item.id,
shiftId: data[0].id
}
})
uc.saveShiftUser(shiftUser).then(response => {
if (response.state) {
this.$message.success('设置成功')
}
})
} else {
let ids = selection.map(item => item.id).join(',')
uc.removeShiftUser(ids).then(response => {
if (response.state) {
this.$message.success('设置成功')
}
})
}
},
getUserUniteData(userId) {
this.userUnite = {}
this.userUnite.userId = userId
uc.getUserUniteByUserId(userId).then(resp => {
if (resp.data) {
this.userUnite = resp.data
}
this.wxDtVisible = true
})
}
}
}
</script>
<style lang="scss" scoped>
.fullheight {
margin-left: -24px;
}
.tenant-user-list {
margin-left: 0;
}
::v-deep {
.cell > .el-table__column-filter-trigger {
display: none;
}
}
div[aria-invalid='true'] >>> .el-input__inner,
div[aria-invalid='true'] >>> .el-input__inner:focus {
border-color: #f56c6c;
}
>>> .el-tree .el-tree-node__label {
font-size: 14px;
}
>>> .import_row {
margin-bottom: 15px;
.org-select {
width: 300px !important;
}
}
@media (max-width: 1440px) {
/deep/ .search-container__col {
flex-wrap: wrap;
.el-button-group {
margin-top: 10px;
}
}
}
@media (max-width: 1024px) {
/deep/ .el-dialog {
width: 90% !important;
}
}
.sp-manager__dialog /deep/ .el-dialog > .el-dialog__body {
height: calc(100% - 170px);
}
.descript-title {
pointer-events: none;
strong {
color: red;
}
p {
text-indent: -1.6em;
padding-left: 1.6em;
margin: 5px 0;
}
}
.m-r-10 {
margin-right: 10px;
}
.confirm-detail {
pointer-events: auto;
}
.el-aside /deep/ .inputs.ht-form-inputs__inline {
width: 100%;
}
.elDialog {
::v-deep {
.el-dialog {
height: 78vh;
min-height: 500px;
overflow-y: auto;
}
.el-dialog__body {
height: calc(78vh - 130px);
}
}
}
</style>