@yelon/bis 12.0.15 → 12.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, Component, ChangeDetectionStrategy, Injector, Inject, Input, ChangeDetectorRef, Renderer2, Optional, HostListener, isDevMode, NgModule, APP_INITIALIZER } from '@angular/core';
2
+ import { Injectable, Component, ChangeDetectionStrategy, Injector, Inject, Input, ChangeDetectorRef, Renderer2, Optional, HostListener, EventEmitter, ViewChild, Output, isDevMode, NgModule, APP_INITIALIZER } from '@angular/core';
3
3
  import * as i2$1 from '@yelon/cache';
4
4
  import { CacheService } from '@yelon/cache';
5
5
  import * as i1 from '@yelon/theme';
@@ -21,8 +21,8 @@ import { InputBoolean } from '@yelon/util/decorator';
21
21
  import { forkJoin, Subject, of, BehaviorSubject, throwError } from 'rxjs';
22
22
  import { map, takeUntil, mergeMap, mergeAll, filter, take, switchMap, catchError } from 'rxjs/operators';
23
23
  import { formatDistanceToNow } from 'date-fns';
24
- import { NzMessageService } from 'ng-zorro-antd/message';
25
24
  import { log } from '@yelon/util/other';
25
+ import { NzMessageService } from 'ng-zorro-antd/message';
26
26
  import { Directionality } from '@angular/cdk/bidi';
27
27
  import { YUNZAI_THEME_BTN_KEYS } from '@yelon/theme/theme-btn';
28
28
  import { YA_SERVICE_TOKEN, mergeConfig } from '@yelon/auth';
@@ -33,11 +33,12 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
33
33
  import * as i4 from '@angular/router';
34
34
  import { RouterModule, Router } from '@angular/router';
35
35
  import { YzSharedModule, ICONS } from '@yelon/bis/shared';
36
+ import { LayoutService } from '@yelon/theme/layout-default';
36
37
  import { RxStomp } from '@stomp/rx-stomp';
37
38
  import * as i3$1 from 'ng-zorro-antd/notification';
38
39
  import { NzNotificationService } from 'ng-zorro-antd/notification';
39
- import { NzIconService } from 'ng-zorro-antd/icon';
40
40
  import { ACLService } from '@yelon/acl';
41
+ import { NzIconService } from 'ng-zorro-antd/icon';
41
42
 
42
43
  // 请参考:https://ng.yunzainfo.com/docs/i18n
43
44
  const DEFAULT = 'zh-CN';
@@ -394,36 +395,37 @@ __decorate([
394
395
  ], YzHeaderI18NComponent.prototype, "showLangText", void 0);
395
396
 
396
397
  class YzHeaderNotifyComponent {
397
- constructor(injector, msg, nzI18n, cdr, httpClient) {
398
+ constructor(injector, msg, y18n, nzI18n, cdr, httpClient) {
398
399
  this.injector = injector;
399
400
  this.msg = msg;
401
+ this.y18n = y18n;
400
402
  this.nzI18n = nzI18n;
401
403
  this.cdr = cdr;
402
404
  this.httpClient = httpClient;
403
405
  this.data = [
404
406
  {
405
407
  key: 'msg',
406
- title: '消息',
408
+ title: this.y18n.fanyi('notify.message'),
407
409
  list: [],
408
- emptyText: '您已读完所有消息',
410
+ emptyText: this.y18n.fanyi('notify.message.emptyText'),
409
411
  emptyImage: './assets/tmp/img/message.svg',
410
- clearText: '清空消息'
412
+ clearText: this.y18n.fanyi('notify.message.clearText')
411
413
  },
412
414
  {
413
415
  key: 'todo',
414
- title: '待办',
416
+ title: this.y18n.fanyi('notify.todo'),
415
417
  list: [],
416
- emptyText: '你已完成所有待办',
418
+ emptyText: this.y18n.fanyi('notify.todo.emptyText'),
417
419
  emptyImage: './assets/tmp/img/todo.svg',
418
- clearText: '重新加载'
420
+ clearText: this.y18n.fanyi('notify.todo.clearText')
419
421
  },
420
422
  {
421
423
  key: 'notice',
422
- title: '通知',
424
+ title: this.y18n.fanyi('notify.notice'),
423
425
  list: [],
424
- emptyText: '你已查看所有通知',
426
+ emptyText: this.y18n.fanyi('notify.notice.emptyText'),
425
427
  emptyImage: './assets/tmp/img/notice.svg',
426
- clearText: '重新加载'
428
+ clearText: this.y18n.fanyi('notify.notice.clearText')
427
429
  }
428
430
  ];
429
431
  this.loading = false;
@@ -446,11 +448,11 @@ class YzHeaderNotifyComponent {
446
448
  const formatMessageStatus = (status) => {
447
449
  switch (status) {
448
450
  case '0':
449
- return { extra: '未读', color: 'red' };
451
+ return { extra: this.y18n.fanyi('notify.unread'), color: 'red' };
450
452
  case '1':
451
- return { extra: '已读', color: 'green' };
453
+ return { extra: this.y18n.fanyi('notify.readed'), color: 'green' };
452
454
  default:
453
- return { extra: '无状态', color: 'primary' };
455
+ return { extra: this.y18n.fanyi('notify.nostatus'), color: 'primary' };
454
456
  }
455
457
  };
456
458
  return this.httpClient
@@ -472,11 +474,11 @@ class YzHeaderNotifyComponent {
472
474
  const formatTodoStatus = (status) => {
473
475
  switch (status) {
474
476
  case '0':
475
- return { extra: '未开始', color: 'red' };
477
+ return { extra: this.y18n.fanyi('notify.unstart'), color: 'red' };
476
478
  case '1':
477
- return { extra: '已开始', color: 'green' };
479
+ return { extra: this.y18n.fanyi('notify.started'), color: 'green' };
478
480
  default:
479
- return { extra: '无状态', color: 'primary' };
481
+ return { extra: this.y18n.fanyi('notify.nostatus'), color: 'primary' };
480
482
  }
481
483
  };
482
484
  return this.httpClient
@@ -497,7 +499,7 @@ class YzHeaderNotifyComponent {
497
499
  const t = this.data.filter(d => d.title === type)[0];
498
500
  if (t.key == 'msg' || t.key == 'notice') {
499
501
  this.subs.push(this.httpClient.post(`/message-center-3/my-msg-and-todo/msg-clear`, {}).subscribe(_ => {
500
- this.msg.success(`清空了 ${type}`);
502
+ this.msg.success(`${this.y18n.fanyi('notify.clear')} ${type}`);
501
503
  this.loadData();
502
504
  }));
503
505
  }
@@ -533,6 +535,7 @@ YzHeaderNotifyComponent.decorators = [
533
535
  YzHeaderNotifyComponent.ctorParameters = () => [
534
536
  { type: Injector },
535
537
  { type: NzMessageService },
538
+ { type: YzI18NService, decorators: [{ type: Inject, args: [YUNZAI_I18N_TOKEN,] }] },
536
539
  { type: NzI18nService },
537
540
  { type: ChangeDetectorRef },
538
541
  { type: _HttpClient }
@@ -832,6 +835,581 @@ YzHeaderFullScreenComponent.propDecorators = {
832
835
  _click: [{ type: HostListener, args: ['click',] }]
833
836
  };
834
837
 
838
+ class ContactService {
839
+ constructor(http, cache) {
840
+ this.http = http;
841
+ this.cache = cache;
842
+ }
843
+ /**
844
+ * 部门树查询
845
+ *
846
+ * @param clas 包含班级
847
+ * @param his 包含历史班级
848
+ * @param grade 系部
849
+ * @param gradeID 系部ID
850
+ * @returns 可观察部门树
851
+ */
852
+ dept(clas, his, grade, gradeID) {
853
+ let baseUrl = `/auth/baseDepartMent/tree?debug=false`;
854
+ if (clas) {
855
+ baseUrl += `&includeClass=true`;
856
+ }
857
+ else {
858
+ baseUrl += `&includeClass=false`;
859
+ }
860
+ if (his) {
861
+ baseUrl += `&includeHisClass=true`;
862
+ }
863
+ else {
864
+ baseUrl += `&includeHisClass=false`;
865
+ }
866
+ if (grade) {
867
+ baseUrl += `&deptTypes=2,class`;
868
+ }
869
+ if (gradeID) {
870
+ baseUrl += `&gradeId=${gradeID}`;
871
+ }
872
+ return this.http.get(baseUrl).pipe(map((response) => {
873
+ return response.data || [];
874
+ }));
875
+ }
876
+ page(uri, page) {
877
+ return this.http.post(`${uri}/queryListForPage`, page);
878
+ }
879
+ pageBaseUser(page) {
880
+ return this.page('/auth/baseUser', page);
881
+ }
882
+ getUserByIds(ids) {
883
+ return this.http
884
+ .post('/auth/baseUser/users', {
885
+ userIds: ids
886
+ })
887
+ .pipe((response) => {
888
+ return response.data || [];
889
+ });
890
+ }
891
+ /**
892
+ * 查询人员信息
893
+ *
894
+ * @param userIds[] 用户id数组,["aaa","bbb","ccc"]
895
+ */
896
+ getUserByUserIds(userIds) {
897
+ return this.http
898
+ .post(`/auth/baseUser/users`, {
899
+ userIds: userIds
900
+ })
901
+ .pipe(map((response) => {
902
+ return response.data ? response.data : [];
903
+ }));
904
+ }
905
+ /**
906
+ * 获取角色组角色
907
+ *
908
+ * @param roleGroupCode 角色组code
909
+ */
910
+ getGroupRole(roleGroupCode) {
911
+ return this.http
912
+ .post(`/auth/baseRole/findGroupRole`, {
913
+ roleGroupCode: roleGroupCode
914
+ })
915
+ .pipe(map((response) => {
916
+ return response.data ? response.data : [];
917
+ }));
918
+ }
919
+ /**
920
+ * 查询当前用户好友分组
921
+ */
922
+ getFriendGroup() {
923
+ return this.http.post(`/contact/appcontact/findGroup`, {}).pipe(map((response) => {
924
+ return response.data ? response.data : [];
925
+ }));
926
+ }
927
+ /**
928
+ * 查询年级
929
+ */
930
+ getGrade() {
931
+ return this.http.get(`/auth/gradeYear/queryListForPage`).pipe(map((response) => {
932
+ return response.data ? response.data : [];
933
+ }));
934
+ }
935
+ /**
936
+ * 查询人员类别列表
937
+ */
938
+ getRylbs() {
939
+ return this.http.post(`/auth/baseTeacher/queryRylbs`, {}).pipe(map((response) => {
940
+ return response.data ? response.data : [];
941
+ }));
942
+ }
943
+ /**
944
+ * 获取学生公寓树
945
+ *
946
+ * @param isPower 是否带有权限,默认false
947
+ * @param treeType 树类型 0:宿舍楼 1:宿舍楼+层 2:宿舍楼+层+房间
948
+ */
949
+ getDormTree(isPower, treeType) {
950
+ const user = this.cache.get('_yz_user', { mode: 'none' });
951
+ let params = {};
952
+ if (isPower) {
953
+ params = {
954
+ isPower: isPower,
955
+ userId: user.userId,
956
+ treeType: treeType
957
+ };
958
+ }
959
+ else {
960
+ params = {
961
+ isPower: isPower,
962
+ treeType: treeType
963
+ };
964
+ }
965
+ return this.http.post(`/auth/dorm/tree`, params).pipe(map((response) => {
966
+ return response.data ? response.data : [];
967
+ }));
968
+ }
969
+ }
970
+ ContactService.ɵprov = i0.ɵɵdefineInjectable({ factory: function ContactService_Factory() { return new ContactService(i0.ɵɵinject(i1._HttpClient), i0.ɵɵinject(i2$1.CacheService)); }, token: ContactService, providedIn: "root" });
971
+ ContactService.decorators = [
972
+ { type: Injectable, args: [{
973
+ providedIn: 'root'
974
+ },] }
975
+ ];
976
+ ContactService.ctorParameters = () => [
977
+ { type: _HttpClient },
978
+ { type: CacheService }
979
+ ];
980
+
981
+ class ContactComponent {
982
+ constructor(contact, changeDetectorRef) {
983
+ this.contact = contact;
984
+ this.changeDetectorRef = changeDetectorRef;
985
+ this.subs = [];
986
+ /**
987
+ * tabset
988
+ */
989
+ this.nzTabsetSearch = null;
990
+ this.nzTabsetLoading = false;
991
+ /**
992
+ * 树展开状态
993
+ */
994
+ this.nzExpandAll = true;
995
+ /**
996
+ * 部门树和部门查询的一些选项/可传可不传
997
+ */
998
+ this.nzDepts = [];
999
+ this._nzDeptsCopy = [];
1000
+ this.nzDeptTreeVirtualHeight = null;
1001
+ this.nzDeptClass = true;
1002
+ this.nzDeptClassHistory = true;
1003
+ this.nzDeptGrade = false;
1004
+ /**
1005
+ * 角色树
1006
+ */
1007
+ this.nzRoles = [];
1008
+ this._nzRolesCopy = [];
1009
+ this.nzRoleTreeVirtualHeight = null;
1010
+ /**
1011
+ * 好友分组
1012
+ */
1013
+ this.nzFriendGroups = [];
1014
+ this._nzFriendGroupsCopy = [];
1015
+ /**
1016
+ * 联系人
1017
+ */
1018
+ this.defaultContacts = [];
1019
+ this.nzContacts = [];
1020
+ this.nzContactLoading = false;
1021
+ /**
1022
+ * 提交和提交按钮
1023
+ */
1024
+ this.button = true;
1025
+ this.confirmed = new EventEmitter();
1026
+ }
1027
+ /**
1028
+ * 初始化,首先加载部门树和默认选中的人的数据
1029
+ */
1030
+ ngOnInit() {
1031
+ this.onTabsetDept();
1032
+ this.onContactsInit();
1033
+ }
1034
+ /**
1035
+ * 视图初始化完毕后进行table初始化
1036
+ */
1037
+ ngAfterViewInit() {
1038
+ this.onTableInit();
1039
+ }
1040
+ /**
1041
+ * 初始化默认选中联系人
1042
+ */
1043
+ onContactsInit() {
1044
+ if (this.defaultContacts && this.defaultContacts.length > 0) {
1045
+ this.nzContactLoading = true;
1046
+ this.subs.push(this.contact.getUserByUserIds(this.defaultContacts).subscribe(contacts => {
1047
+ this.nzContacts = contacts;
1048
+ this.nzContactLoading = false;
1049
+ this.refresh();
1050
+ }));
1051
+ }
1052
+ }
1053
+ /**
1054
+ * table初始化
1055
+ */
1056
+ onTableInit() {
1057
+ // 设置表头
1058
+ this.st.resetColumns({
1059
+ columns: [
1060
+ { title: '选择', type: 'checkbox' },
1061
+ { title: '序号', type: 'no' },
1062
+ { title: '姓名', index: 'realName' },
1063
+ { title: '学号/工号', index: 'userCode' },
1064
+ { title: '部门', index: 'dept.deptName' }
1065
+ ]
1066
+ });
1067
+ // 订阅table点击checkbox事件变化
1068
+ this.subs.push(this.st.change.subscribe(e => {
1069
+ if (e.type === 'checkbox') {
1070
+ // 点击checkbox新增联系人
1071
+ const contactIds = this.nzContacts.map(c => c.userId);
1072
+ this.nzContacts = this.nzContacts.concat(e.checkbox.filter(c => !contactIds.includes(c.userId)));
1073
+ // 取消checkbox取消联系人
1074
+ const cancelIds = this.st.list.filter(d => !d.checked).map(d => d.userId);
1075
+ this.nzContacts = this.nzContacts.filter(d => !cancelIds.includes(d.userId));
1076
+ }
1077
+ }));
1078
+ }
1079
+ /**
1080
+ * tabset进入加载状态
1081
+ */
1082
+ onTabsetLoadStart() {
1083
+ this.nzTabsetLoading = true;
1084
+ }
1085
+ /**
1086
+ * tabset取消加载状态
1087
+ */
1088
+ onTabsetLoadEnd() {
1089
+ this.nzTabsetLoading = false;
1090
+ }
1091
+ /**
1092
+ * tabset搜索框清除
1093
+ */
1094
+ onTabsetSearchClean() {
1095
+ this.nzDepts = this._nzDeptsCopy;
1096
+ this.nzRoles = this._nzRolesCopy;
1097
+ this.nzFriendGroups = this._nzFriendGroupsCopy;
1098
+ this.nzTabsetSearch = null;
1099
+ }
1100
+ /**
1101
+ * tabset搜索框输入
1102
+ *
1103
+ * @param type 类型
1104
+ * @param value 值
1105
+ */
1106
+ onTabsetSearchChange(type, value) {
1107
+ this.onTabsetLoadStart();
1108
+ if (!value || value === '') {
1109
+ this.nzDepts = this._nzDeptsCopy;
1110
+ this.nzRoles = this._nzRolesCopy;
1111
+ this.nzFriendGroups = this._nzFriendGroupsCopy;
1112
+ }
1113
+ else {
1114
+ const trees = [];
1115
+ if (type === 'dept') {
1116
+ this.searchTree(value, this._nzDeptsCopy, trees);
1117
+ this.nzDepts = trees;
1118
+ }
1119
+ if (type === 'role') {
1120
+ this.searchTree(value, this._nzRolesCopy, trees);
1121
+ this.nzRoles = trees;
1122
+ }
1123
+ if (type === 'friendGroup') {
1124
+ this.nzFriendGroups = this._nzFriendGroupsCopy.filter(f => {
1125
+ return !f.name.indexOf(value);
1126
+ });
1127
+ }
1128
+ }
1129
+ this.onTabsetLoadEnd();
1130
+ this.refresh();
1131
+ }
1132
+ /**
1133
+ * tabset切换到部门
1134
+ */
1135
+ onTabsetDept() {
1136
+ this.onTabsetSearchClean();
1137
+ if (!this.nzDepts || this.nzDepts.length === 0) {
1138
+ this.onTabsetDeptFlush();
1139
+ }
1140
+ }
1141
+ /**
1142
+ * tabset切换到角色
1143
+ */
1144
+ onTabsetRole() {
1145
+ this.onTabsetSearchClean();
1146
+ if (!this.nzRoles || this.nzRoles.length === 0) {
1147
+ this.onTabsetRoleFlush(null);
1148
+ }
1149
+ }
1150
+ /**
1151
+ * tabset切换到好友分组
1152
+ */
1153
+ onTabsetFriendGroup() {
1154
+ this.onTabsetSearchClean();
1155
+ if (!this.nzFriendGroups || this.nzFriendGroups.length === 0) {
1156
+ this.onTabsetFriendGroupFlush();
1157
+ }
1158
+ }
1159
+ /**
1160
+ * 获取部门树
1161
+ */
1162
+ onTabsetDeptFlush() {
1163
+ this.onTabsetLoadStart();
1164
+ this.subs.push(this.contact
1165
+ .dept(this.nzDeptClass, this.nzDeptClassHistory, this.nzDeptGrade, this.nzDeptGradeID)
1166
+ .subscribe((trees) => {
1167
+ this.expandTree(trees);
1168
+ this.nzDepts = trees;
1169
+ this._nzDeptsCopy = trees;
1170
+ this.onTabsetLoadEnd();
1171
+ this.refresh();
1172
+ }));
1173
+ }
1174
+ // 获取角色树
1175
+ onTabsetRoleFlush(groupRoleCode) {
1176
+ this.onTabsetLoadStart();
1177
+ this.subs.push(this.contact.getGroupRole(groupRoleCode).subscribe((roles) => {
1178
+ this.expandTree(roles);
1179
+ this.nzRoles = roles;
1180
+ this._nzRolesCopy = roles;
1181
+ this.onTabsetLoadEnd();
1182
+ this.refresh();
1183
+ }));
1184
+ }
1185
+ // 获取好友分组列表
1186
+ onTabsetFriendGroupFlush() {
1187
+ this.onTabsetLoadStart();
1188
+ this.subs.push(this.contact.getFriendGroup().subscribe((group) => {
1189
+ this.nzFriendGroups = group;
1190
+ this._nzFriendGroupsCopy = group;
1191
+ this.onTabsetLoadEnd();
1192
+ this.refresh();
1193
+ }));
1194
+ }
1195
+ /**
1196
+ * 部门树点击
1197
+ *
1198
+ * @param e 节点
1199
+ */
1200
+ onDeptClick(e) {
1201
+ var _a;
1202
+ // 构造分页请求,直接传入stTable组件,剩下的所有交给组件自己完成
1203
+ this.st.data = '/auth/baseUser/queryListForPage';
1204
+ this.st.req = {
1205
+ allInBody: true,
1206
+ method: 'POST',
1207
+ type: 'page',
1208
+ reName: {
1209
+ pi: 'pageNum',
1210
+ ps: 'pageSize'
1211
+ },
1212
+ body: {
1213
+ pageParam: {
1214
+ deptId: (_a = e.keys) === null || _a === void 0 ? void 0 : _a.pop()
1215
+ }
1216
+ }
1217
+ };
1218
+ // table数据预处理
1219
+ this.st.res = {
1220
+ process: data => {
1221
+ this.onTableCheck(data);
1222
+ return data;
1223
+ }
1224
+ };
1225
+ // 加载第一页
1226
+ this.st.load(1);
1227
+ }
1228
+ /**
1229
+ * 角色树点击
1230
+ *
1231
+ * @param e 节点
1232
+ */
1233
+ onRoleClick(e) {
1234
+ var _a;
1235
+ // 构造分页请求,直接传入stTable组件,剩下的所有交给组件自己完成
1236
+ this.st.data = '/auth/baseUser/queryListForPage';
1237
+ this.st.req = {
1238
+ allInBody: true,
1239
+ method: 'POST',
1240
+ type: 'page',
1241
+ reName: {
1242
+ pi: 'pageNum',
1243
+ ps: 'pageSize'
1244
+ },
1245
+ body: {
1246
+ pageParam: {
1247
+ roleId: (_a = e.keys) === null || _a === void 0 ? void 0 : _a.pop()
1248
+ }
1249
+ }
1250
+ };
1251
+ // table数据预处理
1252
+ this.st.res = {
1253
+ process: data => {
1254
+ this.onTableCheck(data);
1255
+ return data;
1256
+ }
1257
+ };
1258
+ // 加载第一页
1259
+ this.st.load(1);
1260
+ }
1261
+ /**
1262
+ * 好友分组点击
1263
+ *
1264
+ * @param e 分组
1265
+ */
1266
+ onFriendGroupClick(e) {
1267
+ // 构造分页请求,直接传入stTable组件,剩下的所有交给组件自己完成
1268
+ this.st.data = '/auth/baseUser/queryListForPage';
1269
+ this.st.req = {
1270
+ allInBody: true,
1271
+ method: 'POST',
1272
+ type: 'page',
1273
+ reName: {
1274
+ pi: 'pageNum',
1275
+ ps: 'pageSize'
1276
+ },
1277
+ body: {
1278
+ pageParam: {
1279
+ friendGroupId: e.id
1280
+ }
1281
+ }
1282
+ };
1283
+ // table数据预处理
1284
+ this.st.res = {
1285
+ process: data => {
1286
+ this.onTableCheck(data);
1287
+ return data;
1288
+ }
1289
+ };
1290
+ // 加载第一页
1291
+ this.st.load(1);
1292
+ }
1293
+ /**
1294
+ * 点击右侧联系人进行删除
1295
+ *
1296
+ * @param c 点击的联系人
1297
+ */
1298
+ onContactRemove(c) {
1299
+ this.nzContacts = this.nzContacts.filter(contact => {
1300
+ return contact.userId != c.userId;
1301
+ });
1302
+ this.st.reload();
1303
+ }
1304
+ /**
1305
+ * 预处理table当前页数据,和nzContat对比,确定checkbox状态
1306
+ *
1307
+ * @param data 预处理数据
1308
+ */
1309
+ onTableCheck(data) {
1310
+ const ids = this.nzContacts.map(u => u.userId);
1311
+ data.forEach(d => {
1312
+ if (ids.includes(d.userId)) {
1313
+ d.checked = true;
1314
+ }
1315
+ else {
1316
+ d.checked = false;
1317
+ }
1318
+ });
1319
+ }
1320
+ /**
1321
+ * 递归树寻找name相同节点
1322
+ *
1323
+ * @param name 名称
1324
+ * @param trees 需要递归的树
1325
+ * @param list 搜索结果
1326
+ */
1327
+ searchTree(name, trees, list) {
1328
+ if (trees && trees.length && trees.length > 0) {
1329
+ trees.forEach((tree) => {
1330
+ if (tree.title.indexOf(name) != -1) {
1331
+ list.push(tree);
1332
+ }
1333
+ if (tree.children) {
1334
+ this.searchTree(name, tree.children, list);
1335
+ }
1336
+ });
1337
+ }
1338
+ }
1339
+ /**
1340
+ * 递归树展开所有有子节点的节点
1341
+ *
1342
+ * @param trees 需要展开的树
1343
+ */
1344
+ expandTree(trees) {
1345
+ if (trees && trees.length && trees.length > 0) {
1346
+ trees.forEach(tree => {
1347
+ if (!tree.children || tree.children.length === 0) {
1348
+ tree.expanded = false;
1349
+ tree.isLeaf = true;
1350
+ }
1351
+ if (tree.children) {
1352
+ tree.expanded = this.nzExpandAll;
1353
+ tree.isLeaf = false;
1354
+ this.expandTree(tree.children);
1355
+ }
1356
+ });
1357
+ }
1358
+ }
1359
+ /**
1360
+ * 刷新当前页面
1361
+ */
1362
+ refresh() {
1363
+ this.changeDetectorRef.detectChanges();
1364
+ }
1365
+ /**
1366
+ * 确认按钮output数据
1367
+ */
1368
+ confirm() {
1369
+ this.confirmed.next(this.nzContacts);
1370
+ }
1371
+ /**
1372
+ * 销毁函数
1373
+ */
1374
+ ngOnDestroy() {
1375
+ this.nzDepts = [];
1376
+ this.nzRoles = [];
1377
+ this.nzContacts = [];
1378
+ this.subs.forEach(s => s.unsubscribe());
1379
+ }
1380
+ }
1381
+ ContactComponent.decorators = [
1382
+ { type: Component, args: [{
1383
+ selector: 'contact',
1384
+ template: "<nz-row [nzGutter]=\"16\">\n <nz-col [nzXs]=\"24\" [nzSm]=\"24\" [nzMd]=\"24\" [nzLg]=\"8\" [nzXl]=\"6\" [nzXXl]=\"6\">\n <nz-tabset nzCentered>\n <nz-tab nzTitle=\"\u90E8\u95E8\" (nzSelect)=\"onTabsetDept()\">\n <div sg-container=\"2\">\n <sg col=\"1\" class=\"nz-tabset-sg\">\n <nz-input-group class=\"nz-tabset-input\" [nzSuffix]=\"searchInputTpl\">\n <input\n nz-input\n [(ngModel)]=\"nzTabsetSearch\"\n (ngModelChange)=\"onTabsetSearchChange('dept', $event)\"\n type=\"text\"\n placeholder=\"\u8BF7\u8F93\u5165\u90E8\u95E8\u540D\u79F0\"\n />\n </nz-input-group>\n </sg>\n <sg col=\"1\">\n <nz-spin [nzSpinning]=\"nzTabsetLoading\">\n <nz-tree\n class=\"nz-tabset-content\"\n (nzClick)=\"onDeptClick($event)\"\n [nzBlockNode]=\"true\"\n [nzShowLine]=\"true\"\n [nzHideUnMatched]=\"true\"\n [nzVirtualHeight]=\"nzDeptTreeVirtualHeight\"\n [nzData]=\"nzDepts\"\n ></nz-tree>\n </nz-spin>\n </sg>\n </div>\n </nz-tab>\n <nz-tab nzTitle=\"\u89D2\u8272\" (nzSelect)=\"onTabsetRole()\">\n <div sg-container=\"2\">\n <sg col=\"1\" class=\"nz-tabset-sg\">\n <nz-input-group class=\"nz-tabset-input\" [nzSuffix]=\"searchInputTpl\">\n <input\n nz-input\n [(ngModel)]=\"nzTabsetSearch\"\n (ngModelChange)=\"onTabsetSearchChange('role', $event)\"\n type=\"text\"\n placeholder=\"\u8BF7\u8F93\u5165\u89D2\u8272\u540D\u79F0\"\n />\n </nz-input-group>\n </sg>\n <sg col=\"1\">\n <nz-spin [nzSpinning]=\"nzTabsetLoading\">\n <nz-tree\n class=\"nz-tabset-content\"\n (nzClick)=\"onRoleClick($event)\"\n [nzBlockNode]=\"true\"\n [nzShowLine]=\"true\"\n [nzHideUnMatched]=\"true\"\n [nzVirtualHeight]=\"nzRoleTreeVirtualHeight\"\n [nzData]=\"nzRoles\"\n ></nz-tree>\n </nz-spin>\n </sg>\n </div>\n </nz-tab>\n <nz-tab nzTitle=\"\u597D\u53CB\" (nzSelect)=\"onTabsetFriendGroup()\">\n <div sg-container=\"2\">\n <sg col=\"1\" class=\"nz-tabset-sg\">\n <nz-input-group class=\"nz-tabset-input\" [nzSuffix]=\"searchInputTpl\">\n <input\n nz-input\n [(ngModel)]=\"nzTabsetSearch\"\n (ngModelChange)=\"onTabsetSearchChange('friendGroup', $event)\"\n type=\"text\"\n placeholder=\"\u8BF7\u8F93\u5165\u597D\u53CB\u540D\u79F0\"\n />\n </nz-input-group>\n </sg>\n <sg col=\"1\">\n <nz-spin [nzSpinning]=\"nzTabsetLoading\">\n <nz-list class=\"nz-tabset-content\" nzItemLayout=\"horizontal\" [nzSplit]=\"false\" nzSize=\"small\">\n <nz-list-item\n class=\"nz-tabset-content-item\"\n *ngFor=\"let group of nzFriendGroups\"\n (click)=\"onFriendGroupClick(group)\"\n >\n <nz-list-item-meta>\n <nz-list-item-meta-title>\n {{ group.name }}\n </nz-list-item-meta-title>\n </nz-list-item-meta>\n </nz-list-item>\n </nz-list>\n </nz-spin>\n </sg>\n </div>\n </nz-tab>\n </nz-tabset>\n </nz-col>\n\n <nz-col [nzXs]=\"24\" [nzSm]=\"24\" [nzMd]=\"24\" [nzLg]=\"16\" [nzXl]=\"13\" [nzXXl]=\"13\">\n <st #st responsiveHideHeaderFooter></st>\n </nz-col>\n\n <nz-col [nzXs]=\"24\" [nzSm]=\"24\" [nzMd]=\"24\" [nzLg]=\"24\" [nzXl]=\"5\" [nzXXl]=\"5\">\n <nz-spin [nzSpinning]=\"nzContactLoading\">\n <nz-list nzItemLayout=\"horizontal\" [nzSplit]=\"false\" nzSize=\"small\">\n <nz-list-item\n class=\"nz-tabset-content-item\"\n *ngFor=\"let contact of nzContacts\"\n (click)=\"onContactRemove(contact)\"\n >\n <nz-list-item-meta>\n <nz-list-item-meta-title>\n {{ contact.realName }}\n </nz-list-item-meta-title>\n </nz-list-item-meta>\n </nz-list-item>\n </nz-list>\n </nz-spin>\n </nz-col>\n</nz-row>\n\n<nz-row *ngIf=\"button\">\n <nz-col [nzSpan]=\"4\" [nzOffset]=\"20\">\n <button nz-button nzType=\"primary\" (click)=\"confirm()\">\u786E\u5B9A</button>\n </nz-col>\n</nz-row>\n\n<ng-template #searchInputTpl>\n <i nz-icon nzType=\"close\" nzTheme=\"outline\" *ngIf=\"nzTabsetSearch\" (click)=\"onTabsetSearchClean()\"></i>\n <i nz-icon nzType=\"search\" nzTheme=\"outline\" *ngIf=\"!nzTabsetSearch\"></i>\n</ng-template>\n",
1385
+ styles: [".nz-tabset-input{width:100%}.nz-tabset-content{padding:20px}.nz-tabset-sg{padding-right:38px!important;padding-left:38px!important}.nz-tabset-content-item:hover{background-color:#f1f1f1;cursor:pointer}\n"]
1386
+ },] }
1387
+ ];
1388
+ ContactComponent.ctorParameters = () => [
1389
+ { type: ContactService },
1390
+ { type: ChangeDetectorRef }
1391
+ ];
1392
+ ContactComponent.propDecorators = {
1393
+ nzTabsetSearch: [{ type: Optional }, { type: Input }],
1394
+ nzTabsetLoading: [{ type: Optional }, { type: Input }],
1395
+ nzExpandAll: [{ type: Optional }, { type: Input }],
1396
+ nzDepts: [{ type: Optional }, { type: Input }],
1397
+ nzDeptTreeVirtualHeight: [{ type: Optional }, { type: Input }],
1398
+ nzDeptClass: [{ type: Optional }, { type: Input }],
1399
+ nzDeptClassHistory: [{ type: Optional }, { type: Input }],
1400
+ nzDeptGrade: [{ type: Optional }, { type: Input }],
1401
+ nzDeptGradeID: [{ type: Optional }, { type: Input }],
1402
+ nzRoles: [{ type: Optional }, { type: Input }],
1403
+ nzRoleTreeVirtualHeight: [{ type: Optional }, { type: Input }],
1404
+ nzFriendGroups: [{ type: Optional }, { type: Input }],
1405
+ st: [{ type: ViewChild, args: ['st', { static: false },] }],
1406
+ defaultContacts: [{ type: Optional }, { type: Input }],
1407
+ nzContacts: [{ type: Optional }, { type: Input }],
1408
+ nzContactLoading: [{ type: Optional }, { type: Input }],
1409
+ button: [{ type: Optional }, { type: Input }],
1410
+ confirmed: [{ type: Output }]
1411
+ };
1412
+
835
1413
  const ɵ0 = msg => {
836
1414
  log$1(msg);
837
1415
  };
@@ -930,9 +1508,10 @@ YzStompService.ctorParameters = () => [
930
1508
  ];
931
1509
 
932
1510
  class YzLayoutBasicComponent {
933
- constructor(cacheService, yzStompService) {
1511
+ constructor(cacheService, yzStompService, layoutService) {
934
1512
  this.cacheService = cacheService;
935
1513
  this.yzStompService = yzStompService;
1514
+ this.layoutService = layoutService;
936
1515
  this.options = {
937
1516
  logoExpanded: `./assets/logo-full.svg`,
938
1517
  logoCollapsed: `./assets/logo.svg`
@@ -940,6 +1519,19 @@ class YzLayoutBasicComponent {
940
1519
  this.intro = '';
941
1520
  this.text = '';
942
1521
  this.icon = '';
1522
+ this.showReuseTab = true;
1523
+ this.showHeader = true;
1524
+ this.showSider = true;
1525
+ }
1526
+ get reuseStyleSheet() {
1527
+ let cascadingStyleSheet = {};
1528
+ if (!this.showHeader) {
1529
+ cascadingStyleSheet = Object.assign(Object.assign({}, cascadingStyleSheet), { top: 0 });
1530
+ }
1531
+ if (!this.showSider) {
1532
+ cascadingStyleSheet = Object.assign(Object.assign({}, cascadingStyleSheet), { left: '24px' });
1533
+ }
1534
+ return cascadingStyleSheet;
943
1535
  }
944
1536
  ngOnInit() {
945
1537
  const current = this.cacheService.get('_yz_current', { mode: 'none' });
@@ -950,6 +1542,9 @@ class YzLayoutBasicComponent {
950
1542
  this.options.logoExpanded = project.maxLogoUrl ? project.maxLogoUrl : `./assets/logo-full.svg`;
951
1543
  this.options.logoCollapsed = project.miniLogoUrl ? project.miniLogoUrl : `./assets/logo.svg`;
952
1544
  this.yzStompService.listen();
1545
+ this.layoutService.reuseTab.asObservable().subscribe(show => (this.showReuseTab = show));
1546
+ this.layoutService.header.asObservable().subscribe(show => (this.showHeader = show));
1547
+ this.layoutService.sidebar.asObservable().subscribe(show => (this.showSider = show));
953
1548
  }
954
1549
  ngOnDestroy() {
955
1550
  this.yzStompService.unListen();
@@ -959,7 +1554,7 @@ YzLayoutBasicComponent.decorators = [
959
1554
  { type: Component, args: [{
960
1555
  selector: 'yz-layout-basic',
961
1556
  template: `
962
- <layout-default [options]="options" [asideUser]="asideUserTpl" [content]="contentTpl">
1557
+ <layout-default [options]="options" [asideUser]="asideUserTpl" [content]="showReuseTab ? contentTpl : noneTpl">
963
1558
  <layout-default-header-item direction="left">
964
1559
  <yz-header-application></yz-header-application>
965
1560
  </layout-default-header-item>
@@ -1014,9 +1609,12 @@ YzLayoutBasicComponent.decorators = [
1014
1609
  </nz-dropdown-menu>
1015
1610
  </ng-template>
1016
1611
  <ng-template #contentTpl>
1017
- <reuse-tab #reuseTab></reuse-tab>
1612
+ <reuse-tab #reuseTab [ngStyle]="reuseStyleSheet"></reuse-tab>
1018
1613
  <router-outlet (activate)="reuseTab.activate($event)"></router-outlet>
1019
1614
  </ng-template>
1615
+ <ng-template #noneTpl>
1616
+ <router-outlet></router-outlet>
1617
+ </ng-template>
1020
1618
  </layout-default>
1021
1619
  `,
1022
1620
  changeDetection: ChangeDetectionStrategy.OnPush
@@ -1024,11 +1622,22 @@ YzLayoutBasicComponent.decorators = [
1024
1622
  ];
1025
1623
  YzLayoutBasicComponent.ctorParameters = () => [
1026
1624
  { type: CacheService },
1027
- { type: YzStompService }
1625
+ { type: YzStompService },
1626
+ { type: LayoutService }
1028
1627
  ];
1029
1628
 
1629
+ /*
1630
+ * @Author: cui <devcui@outlook.com>
1631
+ * @Editor: microsoft vscode
1632
+ * @Date: 2021-11-27 11:30:50
1633
+ * @LastEditTime: 2021-11-27 14:38:46
1634
+ * @LastEditors: cui <devcui@outlook.com>
1635
+ * @Description: empty description
1636
+ * @FilePath: \yelon\packages\bis\layout\layout.module.ts
1637
+ * LICENSE HERE
1638
+ */
1030
1639
  const COMPONENTS = [
1031
- // ContactComponent,
1640
+ ContactComponent,
1032
1641
  YzLayoutBasicComponent,
1033
1642
  YzHeaderApplicationComponent,
1034
1643
  YzHeaderNotifyComponent,
@@ -1464,7 +2073,7 @@ class YzStartupService {
1464
2073
  // menu
1465
2074
  const ms = deepCopy(user.menu).filter((m) => m.systemCode && m.systemCode === this.bis.systemCode);
1466
2075
  mapYzSideToYelonMenu(ms);
1467
- const currentMenu = ms.pop();
2076
+ const currentMenu = ms.pop() || [];
1468
2077
  this.menuService.add([currentMenu]);
1469
2078
  // logo app
1470
2079
  this.settingService.setApp({ name: currentMenu.text, description: currentMenu.intro });
@@ -1474,8 +2083,8 @@ class YzStartupService {
1474
2083
  email: user.email || 'no email'
1475
2084
  });
1476
2085
  // title
1477
- this.titleService.default = currentMenu.text || 'default application name';
1478
- this.titleService.setTitle(currentMenu.text || 'no title');
2086
+ this.titleService.default = currentMenu && currentMenu.text ? currentMenu.text : 'default application name';
2087
+ this.titleService.setTitle(currentMenu && currentMenu.text ? currentMenu.text : 'no title');
1479
2088
  // acl
1480
2089
  const abilities = [];
1481
2090
  generateAbility([currentMenu], abilities, '');
@@ -1865,5 +2474,5 @@ ActGuard.ctorParameters = () => [
1865
2474
  * Generated bundle index. Do not edit.
1866
2475
  */
1867
2476
 
1868
- export { ActGuard, BUSINESS_DEFAULT_CONFIG, PathToRegexpService, STOMP_DEFAULT_CONFIG, TOPIC, YZ_APPINIT_PROVIDES, YunzaiLayoutModule, YzAuthService, YzDefaultInterceptor, YzHeaderApplicationComponent, YzHeaderClearStorageComponent, YzHeaderFullScreenComponent, YzHeaderI18NComponent, YzHeaderNotifyComponent, YzHeaderThemBtnComponent, YzHeaderUserComponent, YzI18NService, YzLayoutBasicComponent, YzStartupService, YzStartupServiceFactory, YzStompService, generateAbility, mapYzSideToYelonMenu, mergeBisConfig, mergeStompConfig, ɵ0, YzHeaderApplicationComponent as ɵa, YzHeaderNotifyComponent as ɵb, YzHeaderThemBtnComponent as ɵc, YzHeaderUserComponent as ɵd, YzHeaderFullScreenComponent as ɵe, YzHeaderClearStorageComponent as ɵf, YzHeaderI18NComponent as ɵg };
2477
+ export { ActGuard, BUSINESS_DEFAULT_CONFIG, PathToRegexpService, STOMP_DEFAULT_CONFIG, TOPIC, YZ_APPINIT_PROVIDES, YunzaiLayoutModule, YzAuthService, YzDefaultInterceptor, YzHeaderApplicationComponent, YzHeaderClearStorageComponent, YzHeaderFullScreenComponent, YzHeaderI18NComponent, YzHeaderNotifyComponent, YzHeaderThemBtnComponent, YzHeaderUserComponent, YzI18NService, YzLayoutBasicComponent, YzStartupService, YzStartupServiceFactory, YzStompService, generateAbility, mapYzSideToYelonMenu, mergeBisConfig, mergeStompConfig, ɵ0, ContactComponent as ɵa, ContactService as ɵb, YzHeaderApplicationComponent as ɵc, YzHeaderNotifyComponent as ɵd, YzHeaderThemBtnComponent as ɵe, YzHeaderUserComponent as ɵf, YzHeaderFullScreenComponent as ɵg, YzHeaderClearStorageComponent as ɵh, YzHeaderI18NComponent as ɵi };
1869
2478
  //# sourceMappingURL=layout.js.map