@yelon/bis 12.0.17 → 13.0.0
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.
- package/LICENSE +21 -21
- package/bis.d.ts +5 -4
- package/{esm2015/bis.js → esm2020/bis.mjs} +4 -4
- package/esm2020/layout/act.guard.mjs +108 -0
- package/{esm2015/layout/bis.config.js → esm2020/layout/bis.config.mjs} +10 -10
- package/esm2020/layout/contact/contact.component.mjs +492 -0
- package/esm2020/layout/contact/contact.service.mjs +146 -0
- package/esm2020/layout/layout.mjs +5 -0
- package/esm2020/layout/layout.module.mjs +73 -0
- package/{esm2015/layout/path-to-regexp.service.js → esm2020/layout/path-to-regexp.service.mjs} +238 -237
- package/{esm2015/layout/public_api.js → esm2020/layout/public_api.mjs} +15 -15
- package/esm2020/layout/stomp.config.mjs +18 -0
- package/{esm2015/layout/widgets/index.js → esm2020/layout/widgets/index.mjs} +7 -7
- package/esm2020/layout/widgets/yz.application.component.mjs +271 -0
- package/esm2020/layout/widgets/yz.clear-storage.component.mjs +45 -0
- package/esm2020/layout/widgets/yz.fullscreen.component.mjs +45 -0
- package/esm2020/layout/widgets/yz.i18n.component.mjs +115 -0
- package/esm2020/layout/widgets/yz.notify.component.mjs +184 -0
- package/esm2020/layout/widgets/yz.them-btn.component.mjs +196 -0
- package/esm2020/layout/widgets/yz.user.component.mjs +112 -0
- package/esm2020/layout/yz.auth.service.mjs +156 -0
- package/esm2020/layout/yz.basic.component.mjs +207 -0
- package/esm2020/layout/yz.default.interceptor.mjs +203 -0
- package/esm2020/layout/yz.i18n.service.mjs +93 -0
- package/esm2020/layout/yz.startup.service.mjs +137 -0
- package/esm2020/layout/yz.stomp.service.mjs +88 -0
- package/{esm2015/public_api.js → esm2020/public_api.mjs} +1 -1
- package/{esm2015/shared/public_api.js → esm2020/shared/public_api.mjs} +4 -4
- package/{esm2015/shared/shared-yelon.module.js → esm2020/shared/shared-yelon.module.mjs} +107 -107
- package/{esm2015/shared/shared-zorro.module.js → esm2020/shared/shared-zorro.module.mjs} +80 -80
- package/{esm2015/shared/shared.js → esm2020/shared/shared.mjs} +4 -4
- package/esm2020/shared/shared.module.mjs +116 -0
- package/{esm2015/shared/style-icons.js → esm2020/shared/style-icons.mjs} +795 -795
- package/fesm2015/{bis.js → bis.mjs} +3 -3
- package/fesm2015/bis.mjs.map +1 -0
- package/fesm2015/{layout.js → layout.mjs} +2514 -2181
- package/fesm2015/layout.mjs.map +1 -0
- package/fesm2015/{shared.js → shared.mjs} +1004 -910
- package/fesm2015/shared.mjs.map +1 -0
- package/fesm2020/bis.mjs +6 -0
- package/fesm2020/bis.mjs.map +1 -0
- package/fesm2020/layout.mjs +2796 -0
- package/fesm2020/layout.mjs.map +1 -0
- package/fesm2020/shared.mjs +1106 -0
- package/fesm2020/shared.mjs.map +1 -0
- package/layout/act.guard.d.ts +23 -20
- package/layout/bis.config.d.ts +3 -3
- package/layout/contact/contact.component.d.ts +169 -166
- package/layout/contact/contact.service.d.ts +118 -115
- package/layout/layout.d.ts +5 -7
- package/layout/layout.module.d.ts +20 -2
- package/layout/package.json +5 -6
- package/layout/path-to-regexp.service.d.ts +26 -23
- package/layout/public_api.d.ts +14 -12
- package/layout/stomp.config.d.ts +3 -3
- package/layout/widgets/index.d.ts +7 -7
- package/layout/widgets/yz.application.component.d.ts +48 -45
- package/layout/widgets/yz.clear-storage.component.d.ts +11 -8
- package/layout/widgets/yz.fullscreen.component.d.ts +8 -6
- package/layout/widgets/yz.i18n.component.d.ts +22 -19
- package/layout/widgets/yz.notify.component.d.ts +30 -25
- package/layout/widgets/yz.them-btn.component.d.ts +32 -29
- package/layout/widgets/yz.user.component.d.ts +28 -25
- package/layout/yz.auth.service.d.ts +22 -19
- package/layout/yz.basic.component.d.ts +24 -15
- package/layout/yz.default.interceptor.d.ts +29 -26
- package/layout/yz.i18n.service.d.ts +27 -24
- package/layout/yz.startup.service.d.ts +34 -31
- package/layout/yz.stomp.service.d.ts +42 -39
- package/package.json +46 -18
- package/public_api.d.ts +2 -2
- package/shared/package.json +5 -6
- package/shared/public_api.d.ts +4 -4
- package/shared/shared-yelon.module.d.ts +3 -3
- package/shared/shared-zorro.module.d.ts +2 -2
- package/shared/shared.d.ts +5 -4
- package/shared/shared.module.d.ts +95 -2
- package/shared/style-icons.d.ts +1 -1
- package/bis.metadata.json +0 -1
- package/bundles/bis.umd.js +0 -18
- package/bundles/bis.umd.js.map +0 -1
- package/bundles/layout.umd.js +0 -2669
- package/bundles/layout.umd.js.map +0 -1
- package/bundles/shared.umd.js +0 -1249
- package/bundles/shared.umd.js.map +0 -1
- package/esm2015/layout/act.guard.js +0 -115
- package/esm2015/layout/contact/contact.component.js +0 -434
- package/esm2015/layout/contact/contact.service.js +0 -150
- package/esm2015/layout/layout.js +0 -8
- package/esm2015/layout/layout.module.js +0 -47
- package/esm2015/layout/stomp.config.js +0 -20
- package/esm2015/layout/widgets/yz.application.component.js +0 -200
- package/esm2015/layout/widgets/yz.clear-storage.component.js +0 -39
- package/esm2015/layout/widgets/yz.fullscreen.component.js +0 -36
- package/esm2015/layout/widgets/yz.i18n.component.js +0 -78
- package/esm2015/layout/widgets/yz.notify.component.js +0 -154
- package/esm2015/layout/widgets/yz.them-btn.component.js +0 -146
- package/esm2015/layout/widgets/yz.user.component.js +0 -81
- package/esm2015/layout/yz.auth.service.js +0 -158
- package/esm2015/layout/yz.basic.component.js +0 -101
- package/esm2015/layout/yz.default.interceptor.js +0 -204
- package/esm2015/layout/yz.i18n.service.js +0 -102
- package/esm2015/layout/yz.startup.service.js +0 -138
- package/esm2015/layout/yz.stomp.service.js +0 -91
- package/esm2015/shared/shared.module.js +0 -22
- package/fesm2015/bis.js.map +0 -1
- package/fesm2015/layout.js.map +0 -1
- package/fesm2015/shared.js.map +0 -1
- package/layout/layout.metadata.json +0 -1
- package/shared/shared.metadata.json +0 -1
|
@@ -0,0 +1,2796 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injectable, Component, ChangeDetectionStrategy, Inject, Input, Optional, HostListener, EventEmitter, ViewChild, Output, isDevMode, NgModule, APP_INITIALIZER } from '@angular/core';
|
|
3
|
+
import * as i1$2 from '@yelon/util';
|
|
4
|
+
import { WINDOW, log as log$1, deepCopy } from '@yelon/util';
|
|
5
|
+
import * as i2$1 from '@yelon/cache';
|
|
6
|
+
import { CacheService } from '@yelon/cache';
|
|
7
|
+
import * as i9$1 from '@angular/common';
|
|
8
|
+
import { registerLocaleData, DOCUMENT, CommonModule } from '@angular/common';
|
|
9
|
+
import ngEn from '@angular/common/locales/en';
|
|
10
|
+
import ngZh from '@angular/common/locales/zh';
|
|
11
|
+
import ngZhTw from '@angular/common/locales/zh-Hant';
|
|
12
|
+
import { zhCN, zhTW, enUS } from 'date-fns/locale';
|
|
13
|
+
import * as i1 from '@yelon/theme';
|
|
14
|
+
import { zh_CN as zh_CN$1, zh_TW as zh_TW$1, en_US as en_US$1, YunzaiI18nBaseService, YUNZAI_I18N_TOKEN, _HttpClient } from '@yelon/theme';
|
|
15
|
+
import * as i2 from 'ng-zorro-antd/i18n';
|
|
16
|
+
import { zh_CN, zh_TW, en_US } from 'ng-zorro-antd/i18n';
|
|
17
|
+
import * as i3 from '@angular/cdk/platform';
|
|
18
|
+
import * as i4 from '@yelon/util/config';
|
|
19
|
+
import { YunzaiConfigService } from '@yelon/util/config';
|
|
20
|
+
import * as i4$1 from 'ng-zorro-antd/input';
|
|
21
|
+
import * as i5 from 'ng-zorro-antd/grid';
|
|
22
|
+
import * as i8 from 'ng-zorro-antd/core/transition-patch';
|
|
23
|
+
import * as i7 from '@angular/forms';
|
|
24
|
+
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
25
|
+
import * as i9 from 'ng-zorro-antd/icon';
|
|
26
|
+
import { __decorate } from 'tslib';
|
|
27
|
+
import { InputBoolean } from '@yelon/util/decorator';
|
|
28
|
+
import * as i2$2 from 'ng-zorro-antd/dropdown';
|
|
29
|
+
import * as i6 from 'ng-zorro-antd/menu';
|
|
30
|
+
import { forkJoin, Subject, of, BehaviorSubject, throwError } from 'rxjs';
|
|
31
|
+
import { map, takeUntil, mergeMap, mergeAll, filter, take, switchMap, catchError } from 'rxjs/operators';
|
|
32
|
+
import { formatDistanceToNow } from 'date-fns';
|
|
33
|
+
import { log } from '@yelon/util/other';
|
|
34
|
+
import * as i1$1 from 'ng-zorro-antd/message';
|
|
35
|
+
import * as i4$2 from '@yelon/abc/notice-icon';
|
|
36
|
+
import { YUNZAI_THEME_BTN_KEYS } from '@yelon/theme/theme-btn';
|
|
37
|
+
import * as i3$1 from '@angular/cdk/bidi';
|
|
38
|
+
import * as i5$1 from 'ng-zorro-antd/tooltip';
|
|
39
|
+
import { YA_SERVICE_TOKEN, mergeConfig } from '@yelon/auth';
|
|
40
|
+
import * as i4$3 from 'ng-zorro-antd/avatar';
|
|
41
|
+
import * as i1$3 from 'ng-zorro-antd/modal';
|
|
42
|
+
import screenfull from 'screenfull';
|
|
43
|
+
import { HttpClientModule, HttpErrorResponse, HttpResponse, HttpResponseBase } from '@angular/common/http';
|
|
44
|
+
import * as i17 from '@angular/router';
|
|
45
|
+
import { RouterModule, Router } from '@angular/router';
|
|
46
|
+
import { YzSharedModule, ICONS } from '@yelon/bis/shared';
|
|
47
|
+
import * as i2$3 from 'ng-zorro-antd/tabs';
|
|
48
|
+
import * as i3$2 from '@yelon/abc/sg';
|
|
49
|
+
import * as i5$2 from 'ng-zorro-antd/spin';
|
|
50
|
+
import * as i6$1 from 'ng-zorro-antd/tree';
|
|
51
|
+
import * as i7$1 from 'ng-zorro-antd/list';
|
|
52
|
+
import * as i8$1 from '@yelon/abc/st';
|
|
53
|
+
import * as i9$2 from 'ng-zorro-antd/button';
|
|
54
|
+
import * as i14 from 'ng-zorro-antd/core/wave';
|
|
55
|
+
import { RxStomp } from '@stomp/rx-stomp';
|
|
56
|
+
import * as i3$3 from 'ng-zorro-antd/notification';
|
|
57
|
+
import { NzNotificationService } from 'ng-zorro-antd/notification';
|
|
58
|
+
import * as i3$4 from '@yelon/theme/layout-default';
|
|
59
|
+
import * as i13 from '@yelon/abc/reuse-tab';
|
|
60
|
+
import * as i3$5 from '@yelon/acl';
|
|
61
|
+
|
|
62
|
+
const DEFAULT = 'zh-CN';
|
|
63
|
+
const LANGS = {
|
|
64
|
+
'zh-CN': {
|
|
65
|
+
text: '简体中文',
|
|
66
|
+
ng: ngZh,
|
|
67
|
+
zorro: zh_CN,
|
|
68
|
+
date: zhCN,
|
|
69
|
+
yelon: zh_CN$1,
|
|
70
|
+
abbr: '🇨🇳'
|
|
71
|
+
},
|
|
72
|
+
'zh-TW': {
|
|
73
|
+
text: '繁体中文',
|
|
74
|
+
ng: ngZhTw,
|
|
75
|
+
zorro: zh_TW,
|
|
76
|
+
date: zhTW,
|
|
77
|
+
yelon: zh_TW$1,
|
|
78
|
+
abbr: '🇭🇰'
|
|
79
|
+
},
|
|
80
|
+
'en-US': {
|
|
81
|
+
text: 'English',
|
|
82
|
+
ng: ngEn,
|
|
83
|
+
zorro: en_US,
|
|
84
|
+
date: enUS,
|
|
85
|
+
yelon: en_US$1,
|
|
86
|
+
abbr: '🇬🇧'
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
class YzI18NService extends YunzaiI18nBaseService {
|
|
90
|
+
constructor(http, settings, nzI18nService, yelonLocaleService, platform, cogSrv) {
|
|
91
|
+
super(cogSrv);
|
|
92
|
+
this.http = http;
|
|
93
|
+
this.settings = settings;
|
|
94
|
+
this.nzI18nService = nzI18nService;
|
|
95
|
+
this.yelonLocaleService = yelonLocaleService;
|
|
96
|
+
this.platform = platform;
|
|
97
|
+
this._defaultLang = DEFAULT;
|
|
98
|
+
this._langs = Object.keys(LANGS).map(code => {
|
|
99
|
+
const item = LANGS[code];
|
|
100
|
+
return { code, text: item.text, abbr: item.abbr };
|
|
101
|
+
});
|
|
102
|
+
const defaultLang = this.getDefaultLang();
|
|
103
|
+
this._defaultLang = this._langs.findIndex(w => w.code === defaultLang) === -1 ? DEFAULT : defaultLang;
|
|
104
|
+
}
|
|
105
|
+
getDefaultLang() {
|
|
106
|
+
if (!this.platform.isBrowser) {
|
|
107
|
+
return DEFAULT;
|
|
108
|
+
}
|
|
109
|
+
if (this.settings.layout.lang) {
|
|
110
|
+
return this.settings.layout.lang;
|
|
111
|
+
}
|
|
112
|
+
let res = (navigator.languages ? navigator.languages[0] : null) || navigator.language;
|
|
113
|
+
const arr = res.split('-');
|
|
114
|
+
return arr.length <= 1 ? res : `${arr[0]}-${arr[1].toUpperCase()}`;
|
|
115
|
+
}
|
|
116
|
+
loadLangData(lang) {
|
|
117
|
+
return this.http.get(`assets/tmp/i18n/${lang}.json`);
|
|
118
|
+
}
|
|
119
|
+
use(lang, data) {
|
|
120
|
+
if (this._currentLang === lang)
|
|
121
|
+
return;
|
|
122
|
+
this._data = this.flatData(data, []);
|
|
123
|
+
const item = LANGS[lang];
|
|
124
|
+
registerLocaleData(item.ng);
|
|
125
|
+
this.nzI18nService.setLocale(item.zorro);
|
|
126
|
+
this.nzI18nService.setDateLocale(item.date);
|
|
127
|
+
this.yelonLocaleService.setLocale(item.yelon);
|
|
128
|
+
this._currentLang = lang;
|
|
129
|
+
this._change$.next(lang);
|
|
130
|
+
}
|
|
131
|
+
getLangs() {
|
|
132
|
+
return this._langs;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
YzI18NService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YzI18NService, deps: [{ token: i1._HttpClient }, { token: i1.SettingsService }, { token: i2.NzI18nService }, { token: i1.YelonLocaleService }, { token: i3.Platform }, { token: i4.YunzaiConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
136
|
+
YzI18NService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YzI18NService, providedIn: 'root' });
|
|
137
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YzI18NService, decorators: [{
|
|
138
|
+
type: Injectable,
|
|
139
|
+
args: [{ providedIn: 'root' }]
|
|
140
|
+
}], ctorParameters: function () { return [{ type: i1._HttpClient }, { type: i1.SettingsService }, { type: i2.NzI18nService }, { type: i1.YelonLocaleService }, { type: i3.Platform }, { type: i4.YunzaiConfigService }]; } });
|
|
141
|
+
|
|
142
|
+
var TOPIC;
|
|
143
|
+
(function (TOPIC) {
|
|
144
|
+
TOPIC[TOPIC["FULL"] = 0] = "FULL";
|
|
145
|
+
TOPIC[TOPIC["OWN"] = 1] = "OWN";
|
|
146
|
+
TOPIC[TOPIC["EVERY"] = 2] = "EVERY";
|
|
147
|
+
})(TOPIC || (TOPIC = {}));
|
|
148
|
+
class YzHeaderApplicationComponent {
|
|
149
|
+
constructor(inject, cacheService, i18n, http) {
|
|
150
|
+
this.inject = inject;
|
|
151
|
+
this.cacheService = cacheService;
|
|
152
|
+
this.i18n = i18n;
|
|
153
|
+
this.http = http;
|
|
154
|
+
this.T = TOPIC;
|
|
155
|
+
this.active = false;
|
|
156
|
+
this.topicData = [];
|
|
157
|
+
this.listData = [];
|
|
158
|
+
this.topic = TOPIC.FULL;
|
|
159
|
+
this.searchValue = null;
|
|
160
|
+
this.subs = [];
|
|
161
|
+
}
|
|
162
|
+
ngOnInit() {
|
|
163
|
+
this.topicData = this.cacheService.get('_yz_header', { mode: 'none' });
|
|
164
|
+
this.listData = this.cacheService.get('_yz_header', { mode: 'none' });
|
|
165
|
+
}
|
|
166
|
+
ngOnDestroy() {
|
|
167
|
+
this.subs.forEach(f => f.unsubscribe());
|
|
168
|
+
}
|
|
169
|
+
diffChange(flag) {
|
|
170
|
+
if (flag) {
|
|
171
|
+
this.active = flag;
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
this.active = !this.active;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
initTopic(topic) {
|
|
178
|
+
this.searchValue = null;
|
|
179
|
+
this.listData = this.cacheService.get('_yz_header', { mode: 'none' });
|
|
180
|
+
this.topic = topic;
|
|
181
|
+
}
|
|
182
|
+
full() {
|
|
183
|
+
this.initTopic(TOPIC.FULL);
|
|
184
|
+
}
|
|
185
|
+
own() {
|
|
186
|
+
this.initTopic(TOPIC.OWN);
|
|
187
|
+
const temp = this.cacheService.get('_yz_header', { mode: 'none' });
|
|
188
|
+
this.listData = temp
|
|
189
|
+
.filter((topic) => {
|
|
190
|
+
topic.children = topic.children.filter((child) => {
|
|
191
|
+
return child.auth;
|
|
192
|
+
});
|
|
193
|
+
return topic;
|
|
194
|
+
})
|
|
195
|
+
.filter((topic) => {
|
|
196
|
+
return topic.children.length > 0;
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
every(e) {
|
|
200
|
+
this.initTopic(TOPIC.EVERY);
|
|
201
|
+
this.choosed = e;
|
|
202
|
+
const temp = this.cacheService.get('_yz_header', { mode: 'none' });
|
|
203
|
+
this.listData = [...temp.filter(t => t.key === e.key)[0].children];
|
|
204
|
+
}
|
|
205
|
+
onSearch() {
|
|
206
|
+
const temp = this.cacheService.get('_yz_header', { mode: 'none' });
|
|
207
|
+
// 如果搜索输入的有值
|
|
208
|
+
if (this.searchValue) {
|
|
209
|
+
// 过滤菜单过滤出搜索的值
|
|
210
|
+
this.listData = temp
|
|
211
|
+
.filter((topic) => {
|
|
212
|
+
if (this.i18n.fanyi(topic.name).includes(this.searchValue)) {
|
|
213
|
+
return topic;
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
topic.children = topic.children.filter((child) => {
|
|
217
|
+
return this.i18n.fanyi(child.name).includes(this.searchValue);
|
|
218
|
+
});
|
|
219
|
+
return topic;
|
|
220
|
+
}
|
|
221
|
+
})
|
|
222
|
+
.filter((topic) => {
|
|
223
|
+
return topic.children.length > 0;
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
// 如果没有值,取消搜索
|
|
228
|
+
this.listData = this.cacheService.get('_yz_header', { mode: 'none' });
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
open(topic) {
|
|
232
|
+
if (topic.key) {
|
|
233
|
+
this.subs.push(this.http
|
|
234
|
+
.post(`/app-manager/web-scan/save`, {
|
|
235
|
+
appId: topic.key,
|
|
236
|
+
createDate: new Date()
|
|
237
|
+
})
|
|
238
|
+
.subscribe());
|
|
239
|
+
}
|
|
240
|
+
switch (topic.target) {
|
|
241
|
+
case 'href':
|
|
242
|
+
this.inject.get(WINDOW).location.href = topic.url;
|
|
243
|
+
break;
|
|
244
|
+
case 'blank':
|
|
245
|
+
this.inject.get(WINDOW).location.href = topic.url;
|
|
246
|
+
break;
|
|
247
|
+
case 'target':
|
|
248
|
+
this.inject.get(WINDOW).location.href = topic.url;
|
|
249
|
+
break;
|
|
250
|
+
default:
|
|
251
|
+
this.inject.get(WINDOW).location.href = topic.url;
|
|
252
|
+
break;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
YzHeaderApplicationComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YzHeaderApplicationComponent, deps: [{ token: i0.Injector }, { token: i2$1.CacheService }, { token: YzI18NService }, { token: i1._HttpClient }], target: i0.ɵɵFactoryTarget.Component });
|
|
257
|
+
YzHeaderApplicationComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: YzHeaderApplicationComponent, selector: "yz-header-application", ngImport: i0, template: `
|
|
258
|
+
<!-- template start-->
|
|
259
|
+
<ng-template #search>
|
|
260
|
+
<div nz-row class="yz-application-list-search">
|
|
261
|
+
<nz-input-group [nzPrefix]="prefixTemplate">
|
|
262
|
+
<input
|
|
263
|
+
type="text"
|
|
264
|
+
nz-input
|
|
265
|
+
placeholder="{{ 'application.search' | i18n }}"
|
|
266
|
+
[(ngModel)]="searchValue"
|
|
267
|
+
(ngModelChange)="onSearch()"
|
|
268
|
+
/>
|
|
269
|
+
<ng-template #prefixTemplate>
|
|
270
|
+
<i nz-icon nzType="search" nzTheme="outline"></i>
|
|
271
|
+
</ng-template>
|
|
272
|
+
</nz-input-group>
|
|
273
|
+
</div>
|
|
274
|
+
</ng-template>
|
|
275
|
+
<ng-template #ld>
|
|
276
|
+
<div class="yz-application-list">
|
|
277
|
+
<ul>
|
|
278
|
+
<li *ngFor="let d of listData">
|
|
279
|
+
<h5>{{ d.name }}</h5>
|
|
280
|
+
<a href="javascript:;" *ngFor="let cd of d.children" (click)="open(cd)">{{ cd.name }}</a>
|
|
281
|
+
</li>
|
|
282
|
+
</ul>
|
|
283
|
+
</div>
|
|
284
|
+
</ng-template>
|
|
285
|
+
<!-- template end-->
|
|
286
|
+
|
|
287
|
+
<!-- button start-->
|
|
288
|
+
<div class="yunzai-default__nav-item" (click)="diffChange()"> {{ 'application.button' | i18n }}</div>
|
|
289
|
+
<!-- button end-->
|
|
290
|
+
|
|
291
|
+
<!-- header start-->
|
|
292
|
+
<div class="yz-application" nz-row *ngIf="active">
|
|
293
|
+
<div nz-col [nzSpan]="3" class="yz-application-topic">
|
|
294
|
+
<div class="yz-application-text" (click)="full()">{{ 'application.all' | i18n }}</div>
|
|
295
|
+
<div class="yz-application-text" (click)="own()">{{ 'application.mine' | i18n }}</div>
|
|
296
|
+
<div class="yz-application-text" *ngFor="let d of topicData" (click)="every(d)">
|
|
297
|
+
{{ d.name }}
|
|
298
|
+
</div>
|
|
299
|
+
</div>
|
|
300
|
+
<div nz-col [nzSpan]="21" [ngSwitch]="topic" class="yz-application-container">
|
|
301
|
+
<div *ngSwitchCase="T.FULL">
|
|
302
|
+
<ng-template [ngTemplateOutlet]="search"></ng-template>
|
|
303
|
+
<ng-template [ngTemplateOutlet]="ld"></ng-template>
|
|
304
|
+
</div>
|
|
305
|
+
<div *ngSwitchCase="T.OWN">
|
|
306
|
+
<ng-template [ngTemplateOutlet]="search"></ng-template>
|
|
307
|
+
<ng-template [ngTemplateOutlet]="ld"></ng-template>
|
|
308
|
+
</div>
|
|
309
|
+
<div *ngSwitchCase="T.EVERY" class="yz-application-list">
|
|
310
|
+
<div class="yz-application-list-item">
|
|
311
|
+
<ul>
|
|
312
|
+
<li *ngFor="let d of listData" (click)="open(d)">
|
|
313
|
+
<a href="javascript:;">
|
|
314
|
+
<h4>{{ d.name }}</h4>
|
|
315
|
+
<p>{{ d.intro }}</p>
|
|
316
|
+
</a>
|
|
317
|
+
</li>
|
|
318
|
+
</ul>
|
|
319
|
+
</div>
|
|
320
|
+
</div>
|
|
321
|
+
</div>
|
|
322
|
+
</div>
|
|
323
|
+
<!-- header end-->
|
|
324
|
+
`, isInline: true, components: [{ type: i4$1.NzInputGroupComponent, selector: "nz-input-group", inputs: ["nzAddOnBeforeIcon", "nzAddOnAfterIcon", "nzPrefixIcon", "nzSuffixIcon", "nzAddOnBefore", "nzAddOnAfter", "nzPrefix", "nzSuffix", "nzSize", "nzSearch", "nzCompact"], exportAs: ["nzInputGroup"] }], directives: [{ type: i5.NzRowDirective, selector: "[nz-row],nz-row,nz-form-item", inputs: ["nzAlign", "nzJustify", "nzGutter"], exportAs: ["nzRow"] }, { type: i8.ɵNzTransitionPatchDirective, selector: "[nz-button], nz-button-group, [nz-icon], [nz-menu-item], [nz-submenu], nz-select-top-control, nz-select-placeholder, nz-input-group", inputs: ["hidden"] }, { type: i4$1.NzInputGroupWhitSuffixOrPrefixDirective, selector: "nz-input-group[nzSuffix], nz-input-group[nzPrefix]" }, { type: i4$1.NzInputDirective, selector: "input[nz-input],textarea[nz-input]", inputs: ["nzBorderless", "nzSize", "disabled"], exportAs: ["nzInput"] }, { type: i7.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i7.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i7.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i9.NzIconDirective, selector: "[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { type: i9$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i9$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5.NzColDirective, selector: "[nz-col],nz-col,nz-form-control,nz-form-label", inputs: ["nzFlex", "nzSpan", "nzOrder", "nzOffset", "nzPush", "nzPull", "nzXs", "nzSm", "nzMd", "nzLg", "nzXl", "nzXXl"], exportAs: ["nzCol"] }, { type: i9$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i9$1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i9$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], pipes: { "i18n": i1.I18nPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
325
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YzHeaderApplicationComponent, decorators: [{
|
|
326
|
+
type: Component,
|
|
327
|
+
args: [{
|
|
328
|
+
selector: 'yz-header-application',
|
|
329
|
+
template: `
|
|
330
|
+
<!-- template start-->
|
|
331
|
+
<ng-template #search>
|
|
332
|
+
<div nz-row class="yz-application-list-search">
|
|
333
|
+
<nz-input-group [nzPrefix]="prefixTemplate">
|
|
334
|
+
<input
|
|
335
|
+
type="text"
|
|
336
|
+
nz-input
|
|
337
|
+
placeholder="{{ 'application.search' | i18n }}"
|
|
338
|
+
[(ngModel)]="searchValue"
|
|
339
|
+
(ngModelChange)="onSearch()"
|
|
340
|
+
/>
|
|
341
|
+
<ng-template #prefixTemplate>
|
|
342
|
+
<i nz-icon nzType="search" nzTheme="outline"></i>
|
|
343
|
+
</ng-template>
|
|
344
|
+
</nz-input-group>
|
|
345
|
+
</div>
|
|
346
|
+
</ng-template>
|
|
347
|
+
<ng-template #ld>
|
|
348
|
+
<div class="yz-application-list">
|
|
349
|
+
<ul>
|
|
350
|
+
<li *ngFor="let d of listData">
|
|
351
|
+
<h5>{{ d.name }}</h5>
|
|
352
|
+
<a href="javascript:;" *ngFor="let cd of d.children" (click)="open(cd)">{{ cd.name }}</a>
|
|
353
|
+
</li>
|
|
354
|
+
</ul>
|
|
355
|
+
</div>
|
|
356
|
+
</ng-template>
|
|
357
|
+
<!-- template end-->
|
|
358
|
+
|
|
359
|
+
<!-- button start-->
|
|
360
|
+
<div class="yunzai-default__nav-item" (click)="diffChange()"> {{ 'application.button' | i18n }}</div>
|
|
361
|
+
<!-- button end-->
|
|
362
|
+
|
|
363
|
+
<!-- header start-->
|
|
364
|
+
<div class="yz-application" nz-row *ngIf="active">
|
|
365
|
+
<div nz-col [nzSpan]="3" class="yz-application-topic">
|
|
366
|
+
<div class="yz-application-text" (click)="full()">{{ 'application.all' | i18n }}</div>
|
|
367
|
+
<div class="yz-application-text" (click)="own()">{{ 'application.mine' | i18n }}</div>
|
|
368
|
+
<div class="yz-application-text" *ngFor="let d of topicData" (click)="every(d)">
|
|
369
|
+
{{ d.name }}
|
|
370
|
+
</div>
|
|
371
|
+
</div>
|
|
372
|
+
<div nz-col [nzSpan]="21" [ngSwitch]="topic" class="yz-application-container">
|
|
373
|
+
<div *ngSwitchCase="T.FULL">
|
|
374
|
+
<ng-template [ngTemplateOutlet]="search"></ng-template>
|
|
375
|
+
<ng-template [ngTemplateOutlet]="ld"></ng-template>
|
|
376
|
+
</div>
|
|
377
|
+
<div *ngSwitchCase="T.OWN">
|
|
378
|
+
<ng-template [ngTemplateOutlet]="search"></ng-template>
|
|
379
|
+
<ng-template [ngTemplateOutlet]="ld"></ng-template>
|
|
380
|
+
</div>
|
|
381
|
+
<div *ngSwitchCase="T.EVERY" class="yz-application-list">
|
|
382
|
+
<div class="yz-application-list-item">
|
|
383
|
+
<ul>
|
|
384
|
+
<li *ngFor="let d of listData" (click)="open(d)">
|
|
385
|
+
<a href="javascript:;">
|
|
386
|
+
<h4>{{ d.name }}</h4>
|
|
387
|
+
<p>{{ d.intro }}</p>
|
|
388
|
+
</a>
|
|
389
|
+
</li>
|
|
390
|
+
</ul>
|
|
391
|
+
</div>
|
|
392
|
+
</div>
|
|
393
|
+
</div>
|
|
394
|
+
</div>
|
|
395
|
+
<!-- header end-->
|
|
396
|
+
`,
|
|
397
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
|
398
|
+
}]
|
|
399
|
+
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: i2$1.CacheService }, { type: YzI18NService }, { type: i1._HttpClient }]; } });
|
|
400
|
+
|
|
401
|
+
class YzHeaderI18NComponent {
|
|
402
|
+
constructor(settings, i18n, doc) {
|
|
403
|
+
this.settings = settings;
|
|
404
|
+
this.i18n = i18n;
|
|
405
|
+
this.doc = doc;
|
|
406
|
+
/** Whether to display language text */
|
|
407
|
+
this.showLangText = true;
|
|
408
|
+
}
|
|
409
|
+
get langs() {
|
|
410
|
+
return this.i18n.getLangs();
|
|
411
|
+
}
|
|
412
|
+
get curLangCode() {
|
|
413
|
+
return this.settings.layout.lang;
|
|
414
|
+
}
|
|
415
|
+
change(lang) {
|
|
416
|
+
const spinEl = this.doc.createElement('div');
|
|
417
|
+
spinEl.setAttribute('class', `page-loading ant-spin ant-spin-lg ant-spin-spinning`);
|
|
418
|
+
spinEl.innerHTML = `<span class="ant-spin-dot ant-spin-dot-spin"><i></i><i></i><i></i><i></i></span>`;
|
|
419
|
+
this.doc.body.appendChild(spinEl);
|
|
420
|
+
this.i18n.loadLangData(lang).subscribe(res => {
|
|
421
|
+
this.i18n.use(lang, res);
|
|
422
|
+
this.settings.setLayout('lang', lang);
|
|
423
|
+
setTimeout(() => this.doc.location.reload());
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
YzHeaderI18NComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YzHeaderI18NComponent, deps: [{ token: i1.SettingsService }, { token: YUNZAI_I18N_TOKEN }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Component });
|
|
428
|
+
YzHeaderI18NComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: YzHeaderI18NComponent, selector: "yz-header-i18n", inputs: { showLangText: "showLangText" }, ngImport: i0, template: `
|
|
429
|
+
<div *ngIf="showLangText" nz-dropdown [nzDropdownMenu]="langMenu" nzPlacement="bottomRight">
|
|
430
|
+
<i nz-icon nzType="global"></i>
|
|
431
|
+
{{ 'menu.lang' | i18n }}
|
|
432
|
+
<i nz-icon nzType="down"></i>
|
|
433
|
+
</div>
|
|
434
|
+
<i
|
|
435
|
+
*ngIf="!showLangText"
|
|
436
|
+
nz-dropdown
|
|
437
|
+
[nzDropdownMenu]="langMenu"
|
|
438
|
+
nzPlacement="bottomRight"
|
|
439
|
+
nz-icon
|
|
440
|
+
nzType="global"
|
|
441
|
+
></i>
|
|
442
|
+
<nz-dropdown-menu #langMenu="nzDropdownMenu">
|
|
443
|
+
<ul nz-menu>
|
|
444
|
+
<li
|
|
445
|
+
nz-menu-item
|
|
446
|
+
*ngFor="let item of langs"
|
|
447
|
+
[nzSelected]="item.code === curLangCode"
|
|
448
|
+
(click)="change(item.code)"
|
|
449
|
+
>
|
|
450
|
+
<span role="img" [attr.aria-label]="item.text" class="pr-xs">{{ item.abbr }}</span>
|
|
451
|
+
{{ item.text }}
|
|
452
|
+
</li>
|
|
453
|
+
</ul>
|
|
454
|
+
</nz-dropdown-menu>
|
|
455
|
+
`, isInline: true, components: [{ type: i2$2.NzDropdownMenuComponent, selector: "nz-dropdown-menu", exportAs: ["nzDropdownMenu"] }], directives: [{ type: i9$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2$2.NzDropDownDirective, selector: "[nz-dropdown]", inputs: ["nzDropdownMenu", "nzTrigger", "nzMatchWidthElement", "nzBackdrop", "nzClickHide", "nzDisabled", "nzVisible", "nzOverlayClassName", "nzOverlayStyle", "nzPlacement"], outputs: ["nzVisibleChange"], exportAs: ["nzDropdown"] }, { type: i8.ɵNzTransitionPatchDirective, selector: "[nz-button], nz-button-group, [nz-icon], [nz-menu-item], [nz-submenu], nz-select-top-control, nz-select-placeholder, nz-input-group", inputs: ["hidden"] }, { type: i9.NzIconDirective, selector: "[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { type: i6.NzMenuDirective, selector: "[nz-menu]", inputs: ["nzInlineIndent", "nzTheme", "nzMode", "nzInlineCollapsed", "nzSelectable"], outputs: ["nzClick"], exportAs: ["nzMenu"] }, { type: i9$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6.NzMenuItemDirective, selector: "[nz-menu-item]", inputs: ["nzPaddingLeft", "nzDisabled", "nzSelected", "nzDanger", "nzMatchRouterExact", "nzMatchRouter"], exportAs: ["nzMenuItem"] }], pipes: { "i18n": i1.I18nPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
456
|
+
__decorate([
|
|
457
|
+
InputBoolean()
|
|
458
|
+
], YzHeaderI18NComponent.prototype, "showLangText", void 0);
|
|
459
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YzHeaderI18NComponent, decorators: [{
|
|
460
|
+
type: Component,
|
|
461
|
+
args: [{
|
|
462
|
+
selector: 'yz-header-i18n',
|
|
463
|
+
template: `
|
|
464
|
+
<div *ngIf="showLangText" nz-dropdown [nzDropdownMenu]="langMenu" nzPlacement="bottomRight">
|
|
465
|
+
<i nz-icon nzType="global"></i>
|
|
466
|
+
{{ 'menu.lang' | i18n }}
|
|
467
|
+
<i nz-icon nzType="down"></i>
|
|
468
|
+
</div>
|
|
469
|
+
<i
|
|
470
|
+
*ngIf="!showLangText"
|
|
471
|
+
nz-dropdown
|
|
472
|
+
[nzDropdownMenu]="langMenu"
|
|
473
|
+
nzPlacement="bottomRight"
|
|
474
|
+
nz-icon
|
|
475
|
+
nzType="global"
|
|
476
|
+
></i>
|
|
477
|
+
<nz-dropdown-menu #langMenu="nzDropdownMenu">
|
|
478
|
+
<ul nz-menu>
|
|
479
|
+
<li
|
|
480
|
+
nz-menu-item
|
|
481
|
+
*ngFor="let item of langs"
|
|
482
|
+
[nzSelected]="item.code === curLangCode"
|
|
483
|
+
(click)="change(item.code)"
|
|
484
|
+
>
|
|
485
|
+
<span role="img" [attr.aria-label]="item.text" class="pr-xs">{{ item.abbr }}</span>
|
|
486
|
+
{{ item.text }}
|
|
487
|
+
</li>
|
|
488
|
+
</ul>
|
|
489
|
+
</nz-dropdown-menu>
|
|
490
|
+
`,
|
|
491
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
|
492
|
+
}]
|
|
493
|
+
}], ctorParameters: function () { return [{ type: i1.SettingsService }, { type: YzI18NService, decorators: [{
|
|
494
|
+
type: Inject,
|
|
495
|
+
args: [YUNZAI_I18N_TOKEN]
|
|
496
|
+
}] }, { type: undefined, decorators: [{
|
|
497
|
+
type: Inject,
|
|
498
|
+
args: [DOCUMENT]
|
|
499
|
+
}] }]; }, propDecorators: { showLangText: [{
|
|
500
|
+
type: Input
|
|
501
|
+
}] } });
|
|
502
|
+
|
|
503
|
+
class YzHeaderNotifyComponent {
|
|
504
|
+
constructor(injector, msg, y18n, nzI18n, cdr, httpClient) {
|
|
505
|
+
this.injector = injector;
|
|
506
|
+
this.msg = msg;
|
|
507
|
+
this.y18n = y18n;
|
|
508
|
+
this.nzI18n = nzI18n;
|
|
509
|
+
this.cdr = cdr;
|
|
510
|
+
this.httpClient = httpClient;
|
|
511
|
+
this.data = [
|
|
512
|
+
{
|
|
513
|
+
key: 'msg',
|
|
514
|
+
title: this.y18n.fanyi('notify.message'),
|
|
515
|
+
list: [],
|
|
516
|
+
emptyText: this.y18n.fanyi('notify.message.emptyText'),
|
|
517
|
+
emptyImage: './assets/tmp/img/message.svg',
|
|
518
|
+
clearText: this.y18n.fanyi('notify.message.clearText')
|
|
519
|
+
},
|
|
520
|
+
{
|
|
521
|
+
key: 'todo',
|
|
522
|
+
title: this.y18n.fanyi('notify.todo'),
|
|
523
|
+
list: [],
|
|
524
|
+
emptyText: this.y18n.fanyi('notify.todo.emptyText'),
|
|
525
|
+
emptyImage: './assets/tmp/img/todo.svg',
|
|
526
|
+
clearText: this.y18n.fanyi('notify.todo.clearText')
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
key: 'notice',
|
|
530
|
+
title: this.y18n.fanyi('notify.notice'),
|
|
531
|
+
list: [],
|
|
532
|
+
emptyText: this.y18n.fanyi('notify.notice.emptyText'),
|
|
533
|
+
emptyImage: './assets/tmp/img/notice.svg',
|
|
534
|
+
clearText: this.y18n.fanyi('notify.notice.clearText')
|
|
535
|
+
}
|
|
536
|
+
];
|
|
537
|
+
this.loading = false;
|
|
538
|
+
this.count = 0;
|
|
539
|
+
this.subs = [];
|
|
540
|
+
}
|
|
541
|
+
ngOnInit() {
|
|
542
|
+
this.loadData();
|
|
543
|
+
}
|
|
544
|
+
loadData() {
|
|
545
|
+
this.count = 0;
|
|
546
|
+
this.loading = true;
|
|
547
|
+
this.subs.push(forkJoin(this.loadTodo(), this.loadMessage()).subscribe(() => {
|
|
548
|
+
this.loading = false;
|
|
549
|
+
this.cdr.detectChanges();
|
|
550
|
+
}));
|
|
551
|
+
}
|
|
552
|
+
loadMessage() {
|
|
553
|
+
log('notify.component: ', 'fetch message list');
|
|
554
|
+
const formatMessageStatus = (status) => {
|
|
555
|
+
switch (status) {
|
|
556
|
+
case '0':
|
|
557
|
+
return { extra: this.y18n.fanyi('notify.unread'), color: 'red' };
|
|
558
|
+
case '1':
|
|
559
|
+
return { extra: this.y18n.fanyi('notify.readed'), color: 'green' };
|
|
560
|
+
default:
|
|
561
|
+
return { extra: this.y18n.fanyi('notify.nostatus'), color: 'primary' };
|
|
562
|
+
}
|
|
563
|
+
};
|
|
564
|
+
return this.httpClient
|
|
565
|
+
.post(`/message-center-3/my-msg-and-todo/msg-list`, {
|
|
566
|
+
pageNum: 1,
|
|
567
|
+
pageSize: 10,
|
|
568
|
+
status: '0'
|
|
569
|
+
})
|
|
570
|
+
.pipe(map((response) => {
|
|
571
|
+
const viewMessage = this.data.filter(d => d.key === 'msg')[0];
|
|
572
|
+
viewMessage.list = response.data.list.map((m) => {
|
|
573
|
+
return {
|
|
574
|
+
...m,
|
|
575
|
+
avatar: m?.imgUrl || './assets/tmp/img/message.png',
|
|
576
|
+
title: m.systemName,
|
|
577
|
+
description: m.content,
|
|
578
|
+
extra: formatMessageStatus(m.status).extra,
|
|
579
|
+
color: formatMessageStatus(m.status).color,
|
|
580
|
+
datetime: formatDistanceToNow(new Date(m.date), { locale: this.nzI18n.getDateLocale() })
|
|
581
|
+
};
|
|
582
|
+
});
|
|
583
|
+
this.count += viewMessage.list.length;
|
|
584
|
+
}));
|
|
585
|
+
}
|
|
586
|
+
loadTodo() {
|
|
587
|
+
log('notify.component: ', 'fetch todo list');
|
|
588
|
+
const formatTodoStatus = (status) => {
|
|
589
|
+
switch (status) {
|
|
590
|
+
case '0':
|
|
591
|
+
return { extra: this.y18n.fanyi('notify.unstart'), color: 'red' };
|
|
592
|
+
case '1':
|
|
593
|
+
return { extra: this.y18n.fanyi('notify.started'), color: 'green' };
|
|
594
|
+
default:
|
|
595
|
+
return { extra: this.y18n.fanyi('notify.nostatus'), color: 'primary' };
|
|
596
|
+
}
|
|
597
|
+
};
|
|
598
|
+
return this.httpClient
|
|
599
|
+
.post(`/message-center-3/my-msg-and-todo/todo-list`, {
|
|
600
|
+
pageNum: 1,
|
|
601
|
+
pageSize: 10,
|
|
602
|
+
status: '0'
|
|
603
|
+
})
|
|
604
|
+
.pipe(map((response) => {
|
|
605
|
+
const viewTodo = this.data.filter(d => d.key === 'todo')[0];
|
|
606
|
+
viewTodo.list = response.data.list.map((t) => {
|
|
607
|
+
return {
|
|
608
|
+
...t,
|
|
609
|
+
avatar: t?.imgUrl || './assets/tmp/img/todo.png',
|
|
610
|
+
title: t.systemName,
|
|
611
|
+
description: t.content,
|
|
612
|
+
datetime: formatDistanceToNow(new Date(t.date), { locale: this.nzI18n.getDateLocale() }),
|
|
613
|
+
extra: formatTodoStatus(t.status).extra,
|
|
614
|
+
color: formatTodoStatus(t.status).color
|
|
615
|
+
};
|
|
616
|
+
});
|
|
617
|
+
this.count += viewTodo.list.length;
|
|
618
|
+
}));
|
|
619
|
+
}
|
|
620
|
+
clear(type) {
|
|
621
|
+
const t = this.data.filter(d => d.title === type)[0];
|
|
622
|
+
if (t.key == 'msg' || t.key == 'notice') {
|
|
623
|
+
this.subs.push(this.httpClient.post(`/message-center-3/my-msg-and-todo/msg-clear`, {}).subscribe(_ => {
|
|
624
|
+
this.msg.success(`${this.y18n.fanyi('notify.clear')} ${type}`);
|
|
625
|
+
this.loadData();
|
|
626
|
+
}));
|
|
627
|
+
}
|
|
628
|
+
if (t.key == 'todo') {
|
|
629
|
+
this.loadData();
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
select(res) {
|
|
633
|
+
this.injector.get(WINDOW).open(res.item.url);
|
|
634
|
+
this.loadData();
|
|
635
|
+
}
|
|
636
|
+
ngOnDestroy() {
|
|
637
|
+
this.subs.forEach(a => a.unsubscribe());
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
YzHeaderNotifyComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YzHeaderNotifyComponent, deps: [{ token: i0.Injector }, { token: i1$1.NzMessageService }, { token: YUNZAI_I18N_TOKEN }, { token: i2.NzI18nService }, { token: i0.ChangeDetectorRef }, { token: i1._HttpClient }], target: i0.ɵɵFactoryTarget.Component });
|
|
641
|
+
YzHeaderNotifyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: YzHeaderNotifyComponent, selector: "yz-header-notify", ngImport: i0, template: `
|
|
642
|
+
<notice-icon
|
|
643
|
+
[data]="data"
|
|
644
|
+
[count]="count"
|
|
645
|
+
[loading]="loading"
|
|
646
|
+
btnClass="yunzai-default__nav-item"
|
|
647
|
+
btnIconClass="yunzai-default__nav-item-icon"
|
|
648
|
+
(select)="select($event)"
|
|
649
|
+
(clear)="clear($event)"
|
|
650
|
+
></notice-icon>
|
|
651
|
+
`, isInline: true, components: [{ type: i4$2.NoticeIconComponent, selector: "notice-icon", inputs: ["data", "count", "loading", "popoverVisible", "btnClass", "btnIconClass"], outputs: ["select", "clear", "popoverVisibleChange"], exportAs: ["noticeIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
652
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YzHeaderNotifyComponent, decorators: [{
|
|
653
|
+
type: Component,
|
|
654
|
+
args: [{
|
|
655
|
+
selector: 'yz-header-notify',
|
|
656
|
+
template: `
|
|
657
|
+
<notice-icon
|
|
658
|
+
[data]="data"
|
|
659
|
+
[count]="count"
|
|
660
|
+
[loading]="loading"
|
|
661
|
+
btnClass="yunzai-default__nav-item"
|
|
662
|
+
btnIconClass="yunzai-default__nav-item-icon"
|
|
663
|
+
(select)="select($event)"
|
|
664
|
+
(clear)="clear($event)"
|
|
665
|
+
></notice-icon>
|
|
666
|
+
`,
|
|
667
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
|
668
|
+
}]
|
|
669
|
+
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: i1$1.NzMessageService }, { type: YzI18NService, decorators: [{
|
|
670
|
+
type: Inject,
|
|
671
|
+
args: [YUNZAI_I18N_TOKEN]
|
|
672
|
+
}] }, { type: i2.NzI18nService }, { type: i0.ChangeDetectorRef }, { type: i1._HttpClient }]; } });
|
|
673
|
+
|
|
674
|
+
class YzHeaderThemBtnComponent {
|
|
675
|
+
constructor(renderer, configSrv, platform, doc, directionality, KEYS) {
|
|
676
|
+
this.renderer = renderer;
|
|
677
|
+
this.configSrv = configSrv;
|
|
678
|
+
this.platform = platform;
|
|
679
|
+
this.doc = doc;
|
|
680
|
+
this.directionality = directionality;
|
|
681
|
+
this.KEYS = KEYS;
|
|
682
|
+
this.theme = 'default';
|
|
683
|
+
this.types = [
|
|
684
|
+
{ key: 'default', text: 'theme.default', color: '#2163ff' },
|
|
685
|
+
{ key: 'compact', text: 'theme.compact', color: '#2163ff' },
|
|
686
|
+
{ key: 'dark', text: 'theme.dark', color: '#020202' },
|
|
687
|
+
{ key: 'yuhong', text: 'theme.yuhong', color: '#C04851' },
|
|
688
|
+
{ key: 'danjuhuang', text: 'theme.danjuhuang', color: '#FBA414' },
|
|
689
|
+
{ key: 'xinghuang', text: 'theme.xinghuang', color: '#F28E16' },
|
|
690
|
+
{ key: 'shilv', text: 'theme.shilv', color: '#57C3C2' },
|
|
691
|
+
{ key: 'zhulv', text: 'theme.zhulv', color: '#1BA784' },
|
|
692
|
+
{ key: 'youlan', text: 'theme.youlan', color: '#1781B5' },
|
|
693
|
+
{ key: 'dianqing', text: 'theme.dianqing', color: '#1661AB' },
|
|
694
|
+
{ key: 'shangengzi', text: 'theme.shangengzi', color: '#61649F' },
|
|
695
|
+
{ key: 'shuiniuhui', text: 'theme.shuiniuhui', color: '#2F2F35' }
|
|
696
|
+
];
|
|
697
|
+
this.devTips = `When the dark.css file can't be found, you need to run it once: npm run theme`;
|
|
698
|
+
this.deployUrl = '';
|
|
699
|
+
this.destroy$ = new Subject();
|
|
700
|
+
this.dir = 'ltr';
|
|
701
|
+
}
|
|
702
|
+
ngOnInit() {
|
|
703
|
+
this.dir = this.directionality.value;
|
|
704
|
+
this.directionality.change?.pipe(takeUntil(this.destroy$)).subscribe((direction) => {
|
|
705
|
+
this.dir = direction;
|
|
706
|
+
});
|
|
707
|
+
this.initTheme();
|
|
708
|
+
}
|
|
709
|
+
initTheme() {
|
|
710
|
+
if (!this.platform.isBrowser) {
|
|
711
|
+
return;
|
|
712
|
+
}
|
|
713
|
+
this.theme = localStorage.getItem(this.KEYS) || 'default';
|
|
714
|
+
this.updateChartTheme();
|
|
715
|
+
this.onThemeChange(this.theme);
|
|
716
|
+
}
|
|
717
|
+
updateChartTheme() {
|
|
718
|
+
this.configSrv.set('chart', { theme: this.theme === 'dark' ? 'dark' : '' });
|
|
719
|
+
}
|
|
720
|
+
onThemeChange(theme) {
|
|
721
|
+
if (!this.platform.isBrowser) {
|
|
722
|
+
return;
|
|
723
|
+
}
|
|
724
|
+
this.theme = theme;
|
|
725
|
+
this.renderer.setAttribute(this.doc.body, 'data-theme', theme);
|
|
726
|
+
const dom = this.doc.getElementById(this.KEYS);
|
|
727
|
+
if (dom) {
|
|
728
|
+
dom.remove();
|
|
729
|
+
}
|
|
730
|
+
localStorage.removeItem(this.KEYS);
|
|
731
|
+
if (theme !== 'default') {
|
|
732
|
+
const el = this.doc.createElement('link');
|
|
733
|
+
el.type = 'text/css';
|
|
734
|
+
el.rel = 'stylesheet';
|
|
735
|
+
el.id = this.KEYS;
|
|
736
|
+
el.href = `${this.deployUrl}assets/style.${theme}.css`;
|
|
737
|
+
localStorage.setItem(this.KEYS, theme);
|
|
738
|
+
this.doc.body.append(el);
|
|
739
|
+
}
|
|
740
|
+
this.updateChartTheme();
|
|
741
|
+
}
|
|
742
|
+
ngOnDestroy() {
|
|
743
|
+
const el = this.doc.getElementById(this.KEYS);
|
|
744
|
+
if (el != null) {
|
|
745
|
+
this.doc.body.removeChild(el);
|
|
746
|
+
}
|
|
747
|
+
this.destroy$.next();
|
|
748
|
+
this.destroy$.complete();
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
YzHeaderThemBtnComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YzHeaderThemBtnComponent, deps: [{ token: i0.Renderer2 }, { token: i4.YunzaiConfigService }, { token: i3.Platform }, { token: DOCUMENT }, { token: i3$1.Directionality, optional: true }, { token: YUNZAI_THEME_BTN_KEYS }], target: i0.ɵɵFactoryTarget.Component });
|
|
752
|
+
YzHeaderThemBtnComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: YzHeaderThemBtnComponent, selector: "yz-header-theme-btn", inputs: { types: "types", devTips: "devTips", deployUrl: "deployUrl" }, ngImport: i0, template: `
|
|
753
|
+
<div
|
|
754
|
+
class="yunzai-default__nav-item"
|
|
755
|
+
nz-dropdown
|
|
756
|
+
[nzDropdownMenu]="iconMenu"
|
|
757
|
+
nzTrigger="click"
|
|
758
|
+
nzPlacement="bottomRight"
|
|
759
|
+
>
|
|
760
|
+
<svg nz-tooltip class="anticon" role="img" width="21" height="21" viewBox="0 0 21 21" fill="currentColor">
|
|
761
|
+
<g fill-rule="evenodd">
|
|
762
|
+
<g fill-rule="nonzero">
|
|
763
|
+
<path
|
|
764
|
+
d="M7.02 3.635l12.518 12.518a1.863 1.863 0 010 2.635l-1.317 1.318a1.863 1.863 0 01-2.635 0L3.068 7.588A2.795 2.795 0 117.02 3.635zm2.09 14.428a.932.932 0 110 1.864.932.932 0 010-1.864zm-.043-9.747L7.75 9.635l9.154 9.153 1.318-1.317-9.154-9.155zM3.52 12.473c.514 0 .931.417.931.931v.932h.932a.932.932 0 110 1.864h-.932v.931a.932.932 0 01-1.863 0l-.001-.931h-.93a.932.932 0 010-1.864h.93v-.932c0-.514.418-.931.933-.931zm15.374-3.727a1.398 1.398 0 110 2.795 1.398 1.398 0 010-2.795zM4.385 4.953a.932.932 0 000 1.317l2.046 2.047L7.75 7 5.703 4.953a.932.932 0 00-1.318 0zM14.701.36a.932.932 0 01.931.932v.931h.932a.932.932 0 010 1.864h-.933l.001.932a.932.932 0 11-1.863 0l-.001-.932h-.93a.932.932 0 110-1.864h.93v-.931a.932.932 0 01.933-.932z"
|
|
765
|
+
></path>
|
|
766
|
+
</g>
|
|
767
|
+
</g>
|
|
768
|
+
</svg>
|
|
769
|
+
</div>
|
|
770
|
+
<nz-dropdown-menu #iconMenu="nzDropdownMenu">
|
|
771
|
+
<ul nz-menu>
|
|
772
|
+
<li
|
|
773
|
+
nz-menu-item
|
|
774
|
+
*ngFor="let theme of types"
|
|
775
|
+
(click)="onThemeChange(theme.key)"
|
|
776
|
+
[style]="{ color: theme.color }"
|
|
777
|
+
>
|
|
778
|
+
<i nz-icon nzType="bg-colors"></i>
|
|
779
|
+
{{ theme.text | i18n }}
|
|
780
|
+
</li>
|
|
781
|
+
</ul>
|
|
782
|
+
<!-- <div nz-menu class="wd-xl animated jello">-->
|
|
783
|
+
<!-- <div nz-row [nzJustify]="'space-between'" [nzAlign]="'middle'" class="app-icons">-->
|
|
784
|
+
<!-- <div nz-col [nzSpan]="4" *ngFor="let theme of types" (click)="onThemeChange(theme.key)">-->
|
|
785
|
+
<!-- <i nz-icon nzType="bg-colors" class="text-white" [style]="{ backgroundColor: theme.color }"></i>-->
|
|
786
|
+
<!-- <span [ngStyle]="{ color: theme.color }">{{ theme.text | i18n }}</span>-->
|
|
787
|
+
<!-- </div>-->
|
|
788
|
+
<!-- </div>-->
|
|
789
|
+
<!-- </div>-->
|
|
790
|
+
</nz-dropdown-menu>
|
|
791
|
+
`, isInline: true, components: [{ type: i2$2.NzDropdownMenuComponent, selector: "nz-dropdown-menu", exportAs: ["nzDropdownMenu"] }], directives: [{ type: i2$2.NzDropDownDirective, selector: "[nz-dropdown]", inputs: ["nzDropdownMenu", "nzTrigger", "nzMatchWidthElement", "nzBackdrop", "nzClickHide", "nzDisabled", "nzVisible", "nzOverlayClassName", "nzOverlayStyle", "nzPlacement"], outputs: ["nzVisibleChange"], exportAs: ["nzDropdown"] }, { type: i5$1.NzTooltipDirective, selector: "[nz-tooltip]", inputs: ["nzTooltipTitle", "nzTooltipTitleContext", "nz-tooltip", "nzTooltipTrigger", "nzTooltipPlacement", "nzTooltipOrigin", "nzTooltipVisible", "nzTooltipMouseEnterDelay", "nzTooltipMouseLeaveDelay", "nzTooltipOverlayClassName", "nzTooltipOverlayStyle", "nzTooltipArrowPointAtCenter", "nzTooltipColor"], outputs: ["nzTooltipVisibleChange"], exportAs: ["nzTooltip"] }, { type: i6.NzMenuDirective, selector: "[nz-menu]", inputs: ["nzInlineIndent", "nzTheme", "nzMode", "nzInlineCollapsed", "nzSelectable"], outputs: ["nzClick"], exportAs: ["nzMenu"] }, { type: i9$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i8.ɵNzTransitionPatchDirective, selector: "[nz-button], nz-button-group, [nz-icon], [nz-menu-item], [nz-submenu], nz-select-top-control, nz-select-placeholder, nz-input-group", inputs: ["hidden"] }, { type: i6.NzMenuItemDirective, selector: "[nz-menu-item]", inputs: ["nzPaddingLeft", "nzDisabled", "nzSelected", "nzDanger", "nzMatchRouterExact", "nzMatchRouter"], exportAs: ["nzMenuItem"] }, { type: i9.NzIconDirective, selector: "[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }], pipes: { "i18n": i1.I18nPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
792
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YzHeaderThemBtnComponent, decorators: [{
|
|
793
|
+
type: Component,
|
|
794
|
+
args: [{
|
|
795
|
+
selector: 'yz-header-theme-btn',
|
|
796
|
+
template: `
|
|
797
|
+
<div
|
|
798
|
+
class="yunzai-default__nav-item"
|
|
799
|
+
nz-dropdown
|
|
800
|
+
[nzDropdownMenu]="iconMenu"
|
|
801
|
+
nzTrigger="click"
|
|
802
|
+
nzPlacement="bottomRight"
|
|
803
|
+
>
|
|
804
|
+
<svg nz-tooltip class="anticon" role="img" width="21" height="21" viewBox="0 0 21 21" fill="currentColor">
|
|
805
|
+
<g fill-rule="evenodd">
|
|
806
|
+
<g fill-rule="nonzero">
|
|
807
|
+
<path
|
|
808
|
+
d="M7.02 3.635l12.518 12.518a1.863 1.863 0 010 2.635l-1.317 1.318a1.863 1.863 0 01-2.635 0L3.068 7.588A2.795 2.795 0 117.02 3.635zm2.09 14.428a.932.932 0 110 1.864.932.932 0 010-1.864zm-.043-9.747L7.75 9.635l9.154 9.153 1.318-1.317-9.154-9.155zM3.52 12.473c.514 0 .931.417.931.931v.932h.932a.932.932 0 110 1.864h-.932v.931a.932.932 0 01-1.863 0l-.001-.931h-.93a.932.932 0 010-1.864h.93v-.932c0-.514.418-.931.933-.931zm15.374-3.727a1.398 1.398 0 110 2.795 1.398 1.398 0 010-2.795zM4.385 4.953a.932.932 0 000 1.317l2.046 2.047L7.75 7 5.703 4.953a.932.932 0 00-1.318 0zM14.701.36a.932.932 0 01.931.932v.931h.932a.932.932 0 010 1.864h-.933l.001.932a.932.932 0 11-1.863 0l-.001-.932h-.93a.932.932 0 110-1.864h.93v-.931a.932.932 0 01.933-.932z"
|
|
809
|
+
></path>
|
|
810
|
+
</g>
|
|
811
|
+
</g>
|
|
812
|
+
</svg>
|
|
813
|
+
</div>
|
|
814
|
+
<nz-dropdown-menu #iconMenu="nzDropdownMenu">
|
|
815
|
+
<ul nz-menu>
|
|
816
|
+
<li
|
|
817
|
+
nz-menu-item
|
|
818
|
+
*ngFor="let theme of types"
|
|
819
|
+
(click)="onThemeChange(theme.key)"
|
|
820
|
+
[style]="{ color: theme.color }"
|
|
821
|
+
>
|
|
822
|
+
<i nz-icon nzType="bg-colors"></i>
|
|
823
|
+
{{ theme.text | i18n }}
|
|
824
|
+
</li>
|
|
825
|
+
</ul>
|
|
826
|
+
<!-- <div nz-menu class="wd-xl animated jello">-->
|
|
827
|
+
<!-- <div nz-row [nzJustify]="'space-between'" [nzAlign]="'middle'" class="app-icons">-->
|
|
828
|
+
<!-- <div nz-col [nzSpan]="4" *ngFor="let theme of types" (click)="onThemeChange(theme.key)">-->
|
|
829
|
+
<!-- <i nz-icon nzType="bg-colors" class="text-white" [style]="{ backgroundColor: theme.color }"></i>-->
|
|
830
|
+
<!-- <span [ngStyle]="{ color: theme.color }">{{ theme.text | i18n }}</span>-->
|
|
831
|
+
<!-- </div>-->
|
|
832
|
+
<!-- </div>-->
|
|
833
|
+
<!-- </div>-->
|
|
834
|
+
</nz-dropdown-menu>
|
|
835
|
+
`,
|
|
836
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
|
837
|
+
}]
|
|
838
|
+
}], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i4.YunzaiConfigService }, { type: i3.Platform }, { type: undefined, decorators: [{
|
|
839
|
+
type: Inject,
|
|
840
|
+
args: [DOCUMENT]
|
|
841
|
+
}] }, { type: i3$1.Directionality, decorators: [{
|
|
842
|
+
type: Optional
|
|
843
|
+
}] }, { type: undefined, decorators: [{
|
|
844
|
+
type: Inject,
|
|
845
|
+
args: [YUNZAI_THEME_BTN_KEYS]
|
|
846
|
+
}] }]; }, propDecorators: { types: [{
|
|
847
|
+
type: Input
|
|
848
|
+
}], devTips: [{
|
|
849
|
+
type: Input
|
|
850
|
+
}], deployUrl: [{
|
|
851
|
+
type: Input
|
|
852
|
+
}] } });
|
|
853
|
+
|
|
854
|
+
const BUSINESS_DEFAULT_CONFIG = {
|
|
855
|
+
baseUrl: '/backstage',
|
|
856
|
+
systemCode: 'portal',
|
|
857
|
+
loginForm: null,
|
|
858
|
+
refreshTokenEnabled: true,
|
|
859
|
+
refreshTokenType: 're-request'
|
|
860
|
+
};
|
|
861
|
+
function mergeBisConfig(srv) {
|
|
862
|
+
return srv.merge('bis', BUSINESS_DEFAULT_CONFIG);
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
class YzHeaderUserComponent {
|
|
866
|
+
constructor(injector, msg, tokenService,
|
|
867
|
+
// @ts-ignore
|
|
868
|
+
configService, cacheService) {
|
|
869
|
+
this.injector = injector;
|
|
870
|
+
this.msg = msg;
|
|
871
|
+
this.tokenService = tokenService;
|
|
872
|
+
this.configService = configService;
|
|
873
|
+
this.cacheService = cacheService;
|
|
874
|
+
this.icon = '';
|
|
875
|
+
this.username = '';
|
|
876
|
+
this.menus = [];
|
|
877
|
+
this.config = mergeBisConfig(configService);
|
|
878
|
+
}
|
|
879
|
+
ngOnInit() {
|
|
880
|
+
const projectInfo = this.cacheService.get('_yz_project_info', { mode: 'none' });
|
|
881
|
+
const user = this.cacheService.get('_yz_user', { mode: 'none' });
|
|
882
|
+
this.username = user.realname ? user.realname : '未命名';
|
|
883
|
+
this.icon = user.avatarId
|
|
884
|
+
? `${this.config.baseUrl}/filecenter/file/${user.avatarId}`
|
|
885
|
+
: `./assets/tmp/img/avatar.jpg`;
|
|
886
|
+
this.menus = projectInfo.profileList;
|
|
887
|
+
}
|
|
888
|
+
logout() {
|
|
889
|
+
localStorage.clear();
|
|
890
|
+
this.tokenService.clear();
|
|
891
|
+
this.injector.get(WINDOW).location.href = `${this.config.baseUrl}/cas-proxy/app/logout`;
|
|
892
|
+
}
|
|
893
|
+
to(href) {
|
|
894
|
+
if (href) {
|
|
895
|
+
this.injector.get(WINDOW).open(href);
|
|
896
|
+
}
|
|
897
|
+
else {
|
|
898
|
+
this.msg.error('该菜单没有配置链接!');
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
YzHeaderUserComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YzHeaderUserComponent, deps: [{ token: i0.Injector }, { token: i1$1.NzMessageService }, { token: YA_SERVICE_TOKEN }, { token: i1$2.YunzaiConfigService }, { token: i2$1.CacheService }], target: i0.ɵɵFactoryTarget.Component });
|
|
903
|
+
YzHeaderUserComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: YzHeaderUserComponent, selector: "yz-header-user", ngImport: i0, template: `
|
|
904
|
+
<div
|
|
905
|
+
class="yunzai-default__nav-item d-flex align-items-center px-sm"
|
|
906
|
+
nz-dropdown
|
|
907
|
+
nzPlacement="bottomRight"
|
|
908
|
+
[nzDropdownMenu]="userMenu"
|
|
909
|
+
>
|
|
910
|
+
<nz-avatar [nzSrc]="icon" nzSize="small" class="mr-sm"></nz-avatar>
|
|
911
|
+
{{ username }}
|
|
912
|
+
</div>
|
|
913
|
+
<nz-dropdown-menu #userMenu="nzDropdownMenu">
|
|
914
|
+
<div nz-menu class="width-sm">
|
|
915
|
+
<div nz-menu-item *ngFor="let m of menus" (click)="to(m.url)">
|
|
916
|
+
<i nz-icon [nzType]="m.icon" class="mr-sm"></i>
|
|
917
|
+
{{ m.name | i18n }}
|
|
918
|
+
</div>
|
|
919
|
+
<li nz-menu-divider></li>
|
|
920
|
+
<div nz-menu-item (click)="logout()">
|
|
921
|
+
<i nz-icon nzType="logout" class="mr-sm"></i>
|
|
922
|
+
{{ 'menu.account.logout' | i18n }}
|
|
923
|
+
</div>
|
|
924
|
+
</div>
|
|
925
|
+
</nz-dropdown-menu>
|
|
926
|
+
`, isInline: true, components: [{ type: i4$3.NzAvatarComponent, selector: "nz-avatar", inputs: ["nzShape", "nzSize", "nzGap", "nzText", "nzSrc", "nzSrcSet", "nzAlt", "nzIcon"], outputs: ["nzError"], exportAs: ["nzAvatar"] }, { type: i2$2.NzDropdownMenuComponent, selector: "nz-dropdown-menu", exportAs: ["nzDropdownMenu"] }], directives: [{ type: i2$2.NzDropDownDirective, selector: "[nz-dropdown]", inputs: ["nzDropdownMenu", "nzTrigger", "nzMatchWidthElement", "nzBackdrop", "nzClickHide", "nzDisabled", "nzVisible", "nzOverlayClassName", "nzOverlayStyle", "nzPlacement"], outputs: ["nzVisibleChange"], exportAs: ["nzDropdown"] }, { type: i6.NzMenuDirective, selector: "[nz-menu]", inputs: ["nzInlineIndent", "nzTheme", "nzMode", "nzInlineCollapsed", "nzSelectable"], outputs: ["nzClick"], exportAs: ["nzMenu"] }, { type: i9$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i8.ɵNzTransitionPatchDirective, selector: "[nz-button], nz-button-group, [nz-icon], [nz-menu-item], [nz-submenu], nz-select-top-control, nz-select-placeholder, nz-input-group", inputs: ["hidden"] }, { type: i6.NzMenuItemDirective, selector: "[nz-menu-item]", inputs: ["nzPaddingLeft", "nzDisabled", "nzSelected", "nzDanger", "nzMatchRouterExact", "nzMatchRouter"], exportAs: ["nzMenuItem"] }, { type: i9.NzIconDirective, selector: "[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { type: i6.NzMenuDividerDirective, selector: "[nz-menu-divider]", exportAs: ["nzMenuDivider"] }], pipes: { "i18n": i1.I18nPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
927
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YzHeaderUserComponent, decorators: [{
|
|
928
|
+
type: Component,
|
|
929
|
+
args: [{
|
|
930
|
+
selector: 'yz-header-user',
|
|
931
|
+
template: `
|
|
932
|
+
<div
|
|
933
|
+
class="yunzai-default__nav-item d-flex align-items-center px-sm"
|
|
934
|
+
nz-dropdown
|
|
935
|
+
nzPlacement="bottomRight"
|
|
936
|
+
[nzDropdownMenu]="userMenu"
|
|
937
|
+
>
|
|
938
|
+
<nz-avatar [nzSrc]="icon" nzSize="small" class="mr-sm"></nz-avatar>
|
|
939
|
+
{{ username }}
|
|
940
|
+
</div>
|
|
941
|
+
<nz-dropdown-menu #userMenu="nzDropdownMenu">
|
|
942
|
+
<div nz-menu class="width-sm">
|
|
943
|
+
<div nz-menu-item *ngFor="let m of menus" (click)="to(m.url)">
|
|
944
|
+
<i nz-icon [nzType]="m.icon" class="mr-sm"></i>
|
|
945
|
+
{{ m.name | i18n }}
|
|
946
|
+
</div>
|
|
947
|
+
<li nz-menu-divider></li>
|
|
948
|
+
<div nz-menu-item (click)="logout()">
|
|
949
|
+
<i nz-icon nzType="logout" class="mr-sm"></i>
|
|
950
|
+
{{ 'menu.account.logout' | i18n }}
|
|
951
|
+
</div>
|
|
952
|
+
</div>
|
|
953
|
+
</nz-dropdown-menu>
|
|
954
|
+
`,
|
|
955
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
|
956
|
+
}]
|
|
957
|
+
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: i1$1.NzMessageService }, { type: undefined, decorators: [{
|
|
958
|
+
type: Inject,
|
|
959
|
+
args: [YA_SERVICE_TOKEN]
|
|
960
|
+
}] }, { type: i1$2.YunzaiConfigService }, { type: i2$1.CacheService }]; } });
|
|
961
|
+
|
|
962
|
+
class YzHeaderClearStorageComponent {
|
|
963
|
+
constructor(modalSrv, messageSrv) {
|
|
964
|
+
this.modalSrv = modalSrv;
|
|
965
|
+
this.messageSrv = messageSrv;
|
|
966
|
+
}
|
|
967
|
+
_click() {
|
|
968
|
+
this.modalSrv.confirm({
|
|
969
|
+
nzTitle: 'Make sure clear all local storage?',
|
|
970
|
+
nzOnOk: () => {
|
|
971
|
+
localStorage.clear();
|
|
972
|
+
this.messageSrv.success('Clear Finished!');
|
|
973
|
+
}
|
|
974
|
+
});
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
YzHeaderClearStorageComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YzHeaderClearStorageComponent, deps: [{ token: i1$3.NzModalService }, { token: i1$1.NzMessageService }], target: i0.ɵɵFactoryTarget.Component });
|
|
978
|
+
YzHeaderClearStorageComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: YzHeaderClearStorageComponent, selector: "yz-header-clear-storage", host: { listeners: { "click": "_click()" }, properties: { "class.d-block": "true" } }, ngImport: i0, template: `
|
|
979
|
+
<i nz-icon nzType="tool"></i>
|
|
980
|
+
{{ 'menu.clear.local.storage' | i18n }}
|
|
981
|
+
`, isInline: true, directives: [{ type: i8.ɵNzTransitionPatchDirective, selector: "[nz-button], nz-button-group, [nz-icon], [nz-menu-item], [nz-submenu], nz-select-top-control, nz-select-placeholder, nz-input-group", inputs: ["hidden"] }, { type: i9.NzIconDirective, selector: "[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }], pipes: { "i18n": i1.I18nPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
982
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YzHeaderClearStorageComponent, decorators: [{
|
|
983
|
+
type: Component,
|
|
984
|
+
args: [{
|
|
985
|
+
selector: 'yz-header-clear-storage',
|
|
986
|
+
template: `
|
|
987
|
+
<i nz-icon nzType="tool"></i>
|
|
988
|
+
{{ 'menu.clear.local.storage' | i18n }}
|
|
989
|
+
`,
|
|
990
|
+
host: {
|
|
991
|
+
'[class.d-block]': 'true'
|
|
992
|
+
},
|
|
993
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
|
994
|
+
}]
|
|
995
|
+
}], ctorParameters: function () { return [{ type: i1$3.NzModalService }, { type: i1$1.NzMessageService }]; }, propDecorators: { _click: [{
|
|
996
|
+
type: HostListener,
|
|
997
|
+
args: ['click']
|
|
998
|
+
}] } });
|
|
999
|
+
|
|
1000
|
+
class YzHeaderFullScreenComponent {
|
|
1001
|
+
constructor() {
|
|
1002
|
+
this.status = false;
|
|
1003
|
+
}
|
|
1004
|
+
_resize() {
|
|
1005
|
+
this.status = screenfull.isFullscreen;
|
|
1006
|
+
}
|
|
1007
|
+
_click() {
|
|
1008
|
+
if (screenfull.isEnabled) {
|
|
1009
|
+
screenfull.toggle();
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
YzHeaderFullScreenComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YzHeaderFullScreenComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1014
|
+
YzHeaderFullScreenComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: YzHeaderFullScreenComponent, selector: "yz-header-fullscreen", host: { listeners: { "window:resize": "_resize()", "click": "_click()" }, properties: { "class.d-block": "true" } }, ngImport: i0, template: `
|
|
1015
|
+
<i nz-icon [nzType]="status ? 'fullscreen-exit' : 'fullscreen'"></i>
|
|
1016
|
+
{{ (status ? 'menu.fullscreen.exit' : 'menu.fullscreen') | i18n }}
|
|
1017
|
+
`, isInline: true, directives: [{ type: i8.ɵNzTransitionPatchDirective, selector: "[nz-button], nz-button-group, [nz-icon], [nz-menu-item], [nz-submenu], nz-select-top-control, nz-select-placeholder, nz-input-group", inputs: ["hidden"] }, { type: i9.NzIconDirective, selector: "[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }], pipes: { "i18n": i1.I18nPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1018
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YzHeaderFullScreenComponent, decorators: [{
|
|
1019
|
+
type: Component,
|
|
1020
|
+
args: [{
|
|
1021
|
+
selector: 'yz-header-fullscreen',
|
|
1022
|
+
template: `
|
|
1023
|
+
<i nz-icon [nzType]="status ? 'fullscreen-exit' : 'fullscreen'"></i>
|
|
1024
|
+
{{ (status ? 'menu.fullscreen.exit' : 'menu.fullscreen') | i18n }}
|
|
1025
|
+
`,
|
|
1026
|
+
host: {
|
|
1027
|
+
'[class.d-block]': 'true'
|
|
1028
|
+
},
|
|
1029
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
|
1030
|
+
}]
|
|
1031
|
+
}], propDecorators: { _resize: [{
|
|
1032
|
+
type: HostListener,
|
|
1033
|
+
args: ['window:resize']
|
|
1034
|
+
}], _click: [{
|
|
1035
|
+
type: HostListener,
|
|
1036
|
+
args: ['click']
|
|
1037
|
+
}] } });
|
|
1038
|
+
|
|
1039
|
+
class ContactService {
|
|
1040
|
+
constructor(http, cache) {
|
|
1041
|
+
this.http = http;
|
|
1042
|
+
this.cache = cache;
|
|
1043
|
+
}
|
|
1044
|
+
/**
|
|
1045
|
+
* 部门树查询
|
|
1046
|
+
*
|
|
1047
|
+
* @param clas 包含班级
|
|
1048
|
+
* @param his 包含历史班级
|
|
1049
|
+
* @param grade 系部
|
|
1050
|
+
* @param gradeID 系部ID
|
|
1051
|
+
* @returns 可观察部门树
|
|
1052
|
+
*/
|
|
1053
|
+
dept(clas, his, grade, gradeID) {
|
|
1054
|
+
let baseUrl = `/auth/baseDepartMent/tree?debug=false`;
|
|
1055
|
+
if (clas) {
|
|
1056
|
+
baseUrl += `&includeClass=true`;
|
|
1057
|
+
}
|
|
1058
|
+
else {
|
|
1059
|
+
baseUrl += `&includeClass=false`;
|
|
1060
|
+
}
|
|
1061
|
+
if (his) {
|
|
1062
|
+
baseUrl += `&includeHisClass=true`;
|
|
1063
|
+
}
|
|
1064
|
+
else {
|
|
1065
|
+
baseUrl += `&includeHisClass=false`;
|
|
1066
|
+
}
|
|
1067
|
+
if (grade) {
|
|
1068
|
+
baseUrl += `&deptTypes=2,class`;
|
|
1069
|
+
}
|
|
1070
|
+
if (gradeID) {
|
|
1071
|
+
baseUrl += `&gradeId=${gradeID}`;
|
|
1072
|
+
}
|
|
1073
|
+
return this.http.get(baseUrl).pipe(map((response) => {
|
|
1074
|
+
return response.data || [];
|
|
1075
|
+
}));
|
|
1076
|
+
}
|
|
1077
|
+
page(uri, page) {
|
|
1078
|
+
return this.http.post(`${uri}/queryListForPage`, page);
|
|
1079
|
+
}
|
|
1080
|
+
pageBaseUser(page) {
|
|
1081
|
+
return this.page('/auth/baseUser', page);
|
|
1082
|
+
}
|
|
1083
|
+
getUserByIds(ids) {
|
|
1084
|
+
return this.http
|
|
1085
|
+
.post('/auth/baseUser/users', {
|
|
1086
|
+
userIds: ids
|
|
1087
|
+
})
|
|
1088
|
+
.pipe((response) => {
|
|
1089
|
+
return response.data || [];
|
|
1090
|
+
});
|
|
1091
|
+
}
|
|
1092
|
+
/**
|
|
1093
|
+
* 查询人员信息
|
|
1094
|
+
*
|
|
1095
|
+
* @param userIds[] 用户id数组,["aaa","bbb","ccc"]
|
|
1096
|
+
*/
|
|
1097
|
+
getUserByUserIds(userIds) {
|
|
1098
|
+
return this.http
|
|
1099
|
+
.post(`/auth/baseUser/users`, {
|
|
1100
|
+
userIds: userIds
|
|
1101
|
+
})
|
|
1102
|
+
.pipe(map((response) => {
|
|
1103
|
+
return response.data ? response.data : [];
|
|
1104
|
+
}));
|
|
1105
|
+
}
|
|
1106
|
+
/**
|
|
1107
|
+
* 获取角色组角色
|
|
1108
|
+
*
|
|
1109
|
+
* @param roleGroupCode 角色组code
|
|
1110
|
+
*/
|
|
1111
|
+
getGroupRole(roleGroupCode) {
|
|
1112
|
+
return this.http
|
|
1113
|
+
.post(`/auth/baseRole/findGroupRole`, {
|
|
1114
|
+
roleGroupCode: roleGroupCode
|
|
1115
|
+
})
|
|
1116
|
+
.pipe(map((response) => {
|
|
1117
|
+
return response.data ? response.data : [];
|
|
1118
|
+
}));
|
|
1119
|
+
}
|
|
1120
|
+
/**
|
|
1121
|
+
* 查询当前用户好友分组
|
|
1122
|
+
*/
|
|
1123
|
+
getFriendGroup() {
|
|
1124
|
+
return this.http.post(`/contact/appcontact/findGroup`, {}).pipe(map((response) => {
|
|
1125
|
+
return response.data ? response.data : [];
|
|
1126
|
+
}));
|
|
1127
|
+
}
|
|
1128
|
+
/**
|
|
1129
|
+
* 查询年级
|
|
1130
|
+
*/
|
|
1131
|
+
getGrade() {
|
|
1132
|
+
return this.http.get(`/auth/gradeYear/queryListForPage`).pipe(map((response) => {
|
|
1133
|
+
return response.data ? response.data : [];
|
|
1134
|
+
}));
|
|
1135
|
+
}
|
|
1136
|
+
/**
|
|
1137
|
+
* 查询人员类别列表
|
|
1138
|
+
*/
|
|
1139
|
+
getRylbs() {
|
|
1140
|
+
return this.http.post(`/auth/baseTeacher/queryRylbs`, {}).pipe(map((response) => {
|
|
1141
|
+
return response.data ? response.data : [];
|
|
1142
|
+
}));
|
|
1143
|
+
}
|
|
1144
|
+
/**
|
|
1145
|
+
* 获取学生公寓树
|
|
1146
|
+
*
|
|
1147
|
+
* @param isPower 是否带有权限,默认false
|
|
1148
|
+
* @param treeType 树类型 0:宿舍楼 1:宿舍楼+层 2:宿舍楼+层+房间
|
|
1149
|
+
*/
|
|
1150
|
+
getDormTree(isPower, treeType) {
|
|
1151
|
+
const user = this.cache.get('_yz_user', { mode: 'none' });
|
|
1152
|
+
let params = {};
|
|
1153
|
+
if (isPower) {
|
|
1154
|
+
params = {
|
|
1155
|
+
isPower: isPower,
|
|
1156
|
+
userId: user.userId,
|
|
1157
|
+
treeType: treeType
|
|
1158
|
+
};
|
|
1159
|
+
}
|
|
1160
|
+
else {
|
|
1161
|
+
params = {
|
|
1162
|
+
isPower: isPower,
|
|
1163
|
+
treeType: treeType
|
|
1164
|
+
};
|
|
1165
|
+
}
|
|
1166
|
+
return this.http.post(`/auth/dorm/tree`, params).pipe(map((response) => {
|
|
1167
|
+
return response.data ? response.data : [];
|
|
1168
|
+
}));
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
ContactService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ContactService, deps: [{ token: i1._HttpClient }, { token: i2$1.CacheService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1172
|
+
ContactService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ContactService, providedIn: 'root' });
|
|
1173
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ContactService, decorators: [{
|
|
1174
|
+
type: Injectable,
|
|
1175
|
+
args: [{
|
|
1176
|
+
providedIn: 'root'
|
|
1177
|
+
}]
|
|
1178
|
+
}], ctorParameters: function () { return [{ type: i1._HttpClient }, { type: i2$1.CacheService }]; } });
|
|
1179
|
+
|
|
1180
|
+
class ContactComponent {
|
|
1181
|
+
constructor(contact, changeDetectorRef) {
|
|
1182
|
+
this.contact = contact;
|
|
1183
|
+
this.changeDetectorRef = changeDetectorRef;
|
|
1184
|
+
this.subs = [];
|
|
1185
|
+
/**
|
|
1186
|
+
* tabset
|
|
1187
|
+
*/
|
|
1188
|
+
this.nzTabsetSearch = null;
|
|
1189
|
+
this.nzTabsetLoading = false;
|
|
1190
|
+
/**
|
|
1191
|
+
* 树展开状态
|
|
1192
|
+
*/
|
|
1193
|
+
this.nzExpandAll = true;
|
|
1194
|
+
/**
|
|
1195
|
+
* 部门树和部门查询的一些选项/可传可不传
|
|
1196
|
+
*/
|
|
1197
|
+
this.nzDepts = [];
|
|
1198
|
+
this._nzDeptsCopy = [];
|
|
1199
|
+
this.nzDeptTreeVirtualHeight = null;
|
|
1200
|
+
this.nzDeptClass = true;
|
|
1201
|
+
this.nzDeptClassHistory = true;
|
|
1202
|
+
this.nzDeptGrade = false;
|
|
1203
|
+
this.nzDeptGradeID = null;
|
|
1204
|
+
/**
|
|
1205
|
+
* 角色树
|
|
1206
|
+
*/
|
|
1207
|
+
this.nzRoles = [];
|
|
1208
|
+
this._nzRolesCopy = [];
|
|
1209
|
+
this.nzRoleTreeVirtualHeight = null;
|
|
1210
|
+
/**
|
|
1211
|
+
* 好友分组
|
|
1212
|
+
*/
|
|
1213
|
+
this.nzFriendGroups = [];
|
|
1214
|
+
this._nzFriendGroupsCopy = [];
|
|
1215
|
+
/**
|
|
1216
|
+
* 联系人
|
|
1217
|
+
*/
|
|
1218
|
+
this.defaultContacts = [];
|
|
1219
|
+
this.nzContacts = [];
|
|
1220
|
+
this.nzContactLoading = false;
|
|
1221
|
+
/**
|
|
1222
|
+
* 提交和提交按钮
|
|
1223
|
+
*/
|
|
1224
|
+
this.button = true;
|
|
1225
|
+
this.confirmed = new EventEmitter();
|
|
1226
|
+
}
|
|
1227
|
+
/**
|
|
1228
|
+
* 初始化,首先加载部门树和默认选中的人的数据
|
|
1229
|
+
*/
|
|
1230
|
+
ngOnInit() {
|
|
1231
|
+
this.onTabsetDept();
|
|
1232
|
+
this.onContactsInit();
|
|
1233
|
+
}
|
|
1234
|
+
/**
|
|
1235
|
+
* 视图初始化完毕后进行table初始化
|
|
1236
|
+
*/
|
|
1237
|
+
ngAfterViewInit() {
|
|
1238
|
+
this.onTableInit();
|
|
1239
|
+
}
|
|
1240
|
+
/**
|
|
1241
|
+
* 初始化默认选中联系人
|
|
1242
|
+
*/
|
|
1243
|
+
onContactsInit() {
|
|
1244
|
+
if (this.defaultContacts && this.defaultContacts.length > 0) {
|
|
1245
|
+
this.nzContactLoading = true;
|
|
1246
|
+
this.subs.push(this.contact.getUserByUserIds(this.defaultContacts).subscribe(contacts => {
|
|
1247
|
+
this.nzContacts = contacts;
|
|
1248
|
+
this.nzContactLoading = false;
|
|
1249
|
+
this.refresh();
|
|
1250
|
+
}));
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
/**
|
|
1254
|
+
* table初始化
|
|
1255
|
+
*/
|
|
1256
|
+
onTableInit() {
|
|
1257
|
+
// 设置表头
|
|
1258
|
+
this.st.resetColumns({
|
|
1259
|
+
columns: [
|
|
1260
|
+
{ title: '选择', type: 'checkbox' },
|
|
1261
|
+
{ title: '序号', type: 'no' },
|
|
1262
|
+
{ title: '姓名', index: 'realName' },
|
|
1263
|
+
{ title: '学号/工号', index: 'userCode' },
|
|
1264
|
+
{ title: '部门', index: 'dept.deptName' }
|
|
1265
|
+
]
|
|
1266
|
+
});
|
|
1267
|
+
// 订阅table点击checkbox事件变化
|
|
1268
|
+
this.subs.push(this.st.change.subscribe(e => {
|
|
1269
|
+
if (e.type === 'checkbox') {
|
|
1270
|
+
// 点击checkbox新增联系人
|
|
1271
|
+
const contactIds = this.nzContacts.map(c => c.userId);
|
|
1272
|
+
this.nzContacts = this.nzContacts.concat(e.checkbox.filter(c => !contactIds.includes(c.userId)));
|
|
1273
|
+
// 取消checkbox取消联系人
|
|
1274
|
+
const cancelIds = this.st.list.filter(d => !d.checked).map(d => d.userId);
|
|
1275
|
+
this.nzContacts = this.nzContacts.filter(d => !cancelIds.includes(d.userId));
|
|
1276
|
+
}
|
|
1277
|
+
}));
|
|
1278
|
+
}
|
|
1279
|
+
/**
|
|
1280
|
+
* tabset进入加载状态
|
|
1281
|
+
*/
|
|
1282
|
+
onTabsetLoadStart() {
|
|
1283
|
+
this.nzTabsetLoading = true;
|
|
1284
|
+
}
|
|
1285
|
+
/**
|
|
1286
|
+
* tabset取消加载状态
|
|
1287
|
+
*/
|
|
1288
|
+
onTabsetLoadEnd() {
|
|
1289
|
+
this.nzTabsetLoading = false;
|
|
1290
|
+
}
|
|
1291
|
+
/**
|
|
1292
|
+
* tabset搜索框清除
|
|
1293
|
+
*/
|
|
1294
|
+
onTabsetSearchClean() {
|
|
1295
|
+
this.nzDepts = this._nzDeptsCopy;
|
|
1296
|
+
this.nzRoles = this._nzRolesCopy;
|
|
1297
|
+
this.nzFriendGroups = this._nzFriendGroupsCopy;
|
|
1298
|
+
this.nzTabsetSearch = null;
|
|
1299
|
+
}
|
|
1300
|
+
/**
|
|
1301
|
+
* tabset搜索框输入
|
|
1302
|
+
*
|
|
1303
|
+
* @param type 类型
|
|
1304
|
+
* @param value 值
|
|
1305
|
+
*/
|
|
1306
|
+
onTabsetSearchChange(type, value) {
|
|
1307
|
+
this.onTabsetLoadStart();
|
|
1308
|
+
if (!value || value === '') {
|
|
1309
|
+
this.nzDepts = this._nzDeptsCopy;
|
|
1310
|
+
this.nzRoles = this._nzRolesCopy;
|
|
1311
|
+
this.nzFriendGroups = this._nzFriendGroupsCopy;
|
|
1312
|
+
}
|
|
1313
|
+
else {
|
|
1314
|
+
const trees = [];
|
|
1315
|
+
if (type === 'dept') {
|
|
1316
|
+
this.searchTree(value, this._nzDeptsCopy, trees);
|
|
1317
|
+
this.nzDepts = trees;
|
|
1318
|
+
}
|
|
1319
|
+
if (type === 'role') {
|
|
1320
|
+
this.searchTree(value, this._nzRolesCopy, trees);
|
|
1321
|
+
this.nzRoles = trees;
|
|
1322
|
+
}
|
|
1323
|
+
if (type === 'friendGroup') {
|
|
1324
|
+
this.nzFriendGroups = this._nzFriendGroupsCopy.filter(f => {
|
|
1325
|
+
return !f.name.indexOf(value);
|
|
1326
|
+
});
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
this.onTabsetLoadEnd();
|
|
1330
|
+
this.refresh();
|
|
1331
|
+
}
|
|
1332
|
+
/**
|
|
1333
|
+
* tabset切换到部门
|
|
1334
|
+
*/
|
|
1335
|
+
onTabsetDept() {
|
|
1336
|
+
this.onTabsetSearchClean();
|
|
1337
|
+
if (!this.nzDepts || this.nzDepts.length === 0) {
|
|
1338
|
+
this.onTabsetDeptFlush();
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
/**
|
|
1342
|
+
* tabset切换到角色
|
|
1343
|
+
*/
|
|
1344
|
+
onTabsetRole() {
|
|
1345
|
+
this.onTabsetSearchClean();
|
|
1346
|
+
if (!this.nzRoles || this.nzRoles.length === 0) {
|
|
1347
|
+
this.onTabsetRoleFlush(null);
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1350
|
+
/**
|
|
1351
|
+
* tabset切换到好友分组
|
|
1352
|
+
*/
|
|
1353
|
+
onTabsetFriendGroup() {
|
|
1354
|
+
this.onTabsetSearchClean();
|
|
1355
|
+
if (!this.nzFriendGroups || this.nzFriendGroups.length === 0) {
|
|
1356
|
+
this.onTabsetFriendGroupFlush();
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
/**
|
|
1360
|
+
* 获取部门树
|
|
1361
|
+
*/
|
|
1362
|
+
onTabsetDeptFlush() {
|
|
1363
|
+
this.onTabsetLoadStart();
|
|
1364
|
+
this.subs.push(this.contact
|
|
1365
|
+
.dept(this.nzDeptClass, this.nzDeptClassHistory, this.nzDeptGrade, this.nzDeptGradeID)
|
|
1366
|
+
.subscribe((trees) => {
|
|
1367
|
+
this.expandTree(trees);
|
|
1368
|
+
this.nzDepts = trees;
|
|
1369
|
+
this._nzDeptsCopy = trees;
|
|
1370
|
+
this.onTabsetLoadEnd();
|
|
1371
|
+
this.refresh();
|
|
1372
|
+
}));
|
|
1373
|
+
}
|
|
1374
|
+
// 获取角色树
|
|
1375
|
+
onTabsetRoleFlush(groupRoleCode) {
|
|
1376
|
+
this.onTabsetLoadStart();
|
|
1377
|
+
this.subs.push(this.contact.getGroupRole(groupRoleCode).subscribe((roles) => {
|
|
1378
|
+
this.expandTree(roles);
|
|
1379
|
+
this.nzRoles = roles;
|
|
1380
|
+
this._nzRolesCopy = roles;
|
|
1381
|
+
this.onTabsetLoadEnd();
|
|
1382
|
+
this.refresh();
|
|
1383
|
+
}));
|
|
1384
|
+
}
|
|
1385
|
+
// 获取好友分组列表
|
|
1386
|
+
onTabsetFriendGroupFlush() {
|
|
1387
|
+
this.onTabsetLoadStart();
|
|
1388
|
+
this.subs.push(this.contact.getFriendGroup().subscribe((group) => {
|
|
1389
|
+
this.nzFriendGroups = group;
|
|
1390
|
+
this._nzFriendGroupsCopy = group;
|
|
1391
|
+
this.onTabsetLoadEnd();
|
|
1392
|
+
this.refresh();
|
|
1393
|
+
}));
|
|
1394
|
+
}
|
|
1395
|
+
/**
|
|
1396
|
+
* 部门树点击
|
|
1397
|
+
*
|
|
1398
|
+
* @param e 节点
|
|
1399
|
+
*/
|
|
1400
|
+
onDeptClick(e) {
|
|
1401
|
+
// 构造分页请求,直接传入stTable组件,剩下的所有交给组件自己完成
|
|
1402
|
+
this.st.data = '/auth/baseUser/queryListForPage';
|
|
1403
|
+
this.st.req = {
|
|
1404
|
+
allInBody: true,
|
|
1405
|
+
method: 'POST',
|
|
1406
|
+
type: 'page',
|
|
1407
|
+
reName: {
|
|
1408
|
+
pi: 'pageNum',
|
|
1409
|
+
ps: 'pageSize'
|
|
1410
|
+
},
|
|
1411
|
+
body: {
|
|
1412
|
+
pageParam: {
|
|
1413
|
+
deptId: e.keys?.pop()
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
};
|
|
1417
|
+
// table数据预处理
|
|
1418
|
+
this.st.res = {
|
|
1419
|
+
process: data => {
|
|
1420
|
+
this.onTableCheck(data);
|
|
1421
|
+
return data;
|
|
1422
|
+
}
|
|
1423
|
+
};
|
|
1424
|
+
// 加载第一页
|
|
1425
|
+
this.st.load(1);
|
|
1426
|
+
}
|
|
1427
|
+
/**
|
|
1428
|
+
* 角色树点击
|
|
1429
|
+
*
|
|
1430
|
+
* @param e 节点
|
|
1431
|
+
*/
|
|
1432
|
+
onRoleClick(e) {
|
|
1433
|
+
// 构造分页请求,直接传入stTable组件,剩下的所有交给组件自己完成
|
|
1434
|
+
this.st.data = '/auth/baseUser/queryListForPage';
|
|
1435
|
+
this.st.req = {
|
|
1436
|
+
allInBody: true,
|
|
1437
|
+
method: 'POST',
|
|
1438
|
+
type: 'page',
|
|
1439
|
+
reName: {
|
|
1440
|
+
pi: 'pageNum',
|
|
1441
|
+
ps: 'pageSize'
|
|
1442
|
+
},
|
|
1443
|
+
body: {
|
|
1444
|
+
pageParam: {
|
|
1445
|
+
roleId: e.keys?.pop()
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
};
|
|
1449
|
+
// table数据预处理
|
|
1450
|
+
this.st.res = {
|
|
1451
|
+
process: data => {
|
|
1452
|
+
this.onTableCheck(data);
|
|
1453
|
+
return data;
|
|
1454
|
+
}
|
|
1455
|
+
};
|
|
1456
|
+
// 加载第一页
|
|
1457
|
+
this.st.load(1);
|
|
1458
|
+
}
|
|
1459
|
+
/**
|
|
1460
|
+
* 好友分组点击
|
|
1461
|
+
*
|
|
1462
|
+
* @param e 分组
|
|
1463
|
+
*/
|
|
1464
|
+
onFriendGroupClick(e) {
|
|
1465
|
+
// 构造分页请求,直接传入stTable组件,剩下的所有交给组件自己完成
|
|
1466
|
+
this.st.data = '/auth/baseUser/queryListForPage';
|
|
1467
|
+
this.st.req = {
|
|
1468
|
+
allInBody: true,
|
|
1469
|
+
method: 'POST',
|
|
1470
|
+
type: 'page',
|
|
1471
|
+
reName: {
|
|
1472
|
+
pi: 'pageNum',
|
|
1473
|
+
ps: 'pageSize'
|
|
1474
|
+
},
|
|
1475
|
+
body: {
|
|
1476
|
+
pageParam: {
|
|
1477
|
+
friendGroupId: e.id
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
};
|
|
1481
|
+
// table数据预处理
|
|
1482
|
+
this.st.res = {
|
|
1483
|
+
process: data => {
|
|
1484
|
+
this.onTableCheck(data);
|
|
1485
|
+
return data;
|
|
1486
|
+
}
|
|
1487
|
+
};
|
|
1488
|
+
// 加载第一页
|
|
1489
|
+
this.st.load(1);
|
|
1490
|
+
}
|
|
1491
|
+
/**
|
|
1492
|
+
* 点击右侧联系人进行删除
|
|
1493
|
+
*
|
|
1494
|
+
* @param c 点击的联系人
|
|
1495
|
+
*/
|
|
1496
|
+
onContactRemove(c) {
|
|
1497
|
+
this.nzContacts = this.nzContacts.filter(contact => {
|
|
1498
|
+
return contact.userId != c.userId;
|
|
1499
|
+
});
|
|
1500
|
+
this.st.reload();
|
|
1501
|
+
}
|
|
1502
|
+
/**
|
|
1503
|
+
* 预处理table当前页数据,和nzContat对比,确定checkbox状态
|
|
1504
|
+
*
|
|
1505
|
+
* @param data 预处理数据
|
|
1506
|
+
*/
|
|
1507
|
+
onTableCheck(data) {
|
|
1508
|
+
const ids = this.nzContacts.map(u => u.userId);
|
|
1509
|
+
data.forEach(d => {
|
|
1510
|
+
if (ids.includes(d.userId)) {
|
|
1511
|
+
d.checked = true;
|
|
1512
|
+
}
|
|
1513
|
+
else {
|
|
1514
|
+
d.checked = false;
|
|
1515
|
+
}
|
|
1516
|
+
});
|
|
1517
|
+
}
|
|
1518
|
+
/**
|
|
1519
|
+
* 递归树寻找name相同节点
|
|
1520
|
+
*
|
|
1521
|
+
* @param name 名称
|
|
1522
|
+
* @param trees 需要递归的树
|
|
1523
|
+
* @param list 搜索结果
|
|
1524
|
+
*/
|
|
1525
|
+
searchTree(name, trees, list) {
|
|
1526
|
+
if (trees && trees.length && trees.length > 0) {
|
|
1527
|
+
trees.forEach((tree) => {
|
|
1528
|
+
if (tree.title.indexOf(name) != -1) {
|
|
1529
|
+
list.push(tree);
|
|
1530
|
+
}
|
|
1531
|
+
if (tree.children) {
|
|
1532
|
+
this.searchTree(name, tree.children, list);
|
|
1533
|
+
}
|
|
1534
|
+
});
|
|
1535
|
+
}
|
|
1536
|
+
}
|
|
1537
|
+
/**
|
|
1538
|
+
* 递归树展开所有有子节点的节点
|
|
1539
|
+
*
|
|
1540
|
+
* @param trees 需要展开的树
|
|
1541
|
+
*/
|
|
1542
|
+
expandTree(trees) {
|
|
1543
|
+
if (trees && trees.length && trees.length > 0) {
|
|
1544
|
+
trees.forEach(tree => {
|
|
1545
|
+
if (!tree.children || tree.children.length === 0) {
|
|
1546
|
+
tree.expanded = false;
|
|
1547
|
+
tree.isLeaf = true;
|
|
1548
|
+
}
|
|
1549
|
+
if (tree.children) {
|
|
1550
|
+
tree.expanded = this.nzExpandAll;
|
|
1551
|
+
tree.isLeaf = false;
|
|
1552
|
+
this.expandTree(tree.children);
|
|
1553
|
+
}
|
|
1554
|
+
});
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
/**
|
|
1558
|
+
* 刷新当前页面
|
|
1559
|
+
*/
|
|
1560
|
+
refresh() {
|
|
1561
|
+
this.changeDetectorRef.detectChanges();
|
|
1562
|
+
}
|
|
1563
|
+
/**
|
|
1564
|
+
* 确认按钮output数据
|
|
1565
|
+
*/
|
|
1566
|
+
confirm() {
|
|
1567
|
+
this.confirmed.next(this.nzContacts);
|
|
1568
|
+
}
|
|
1569
|
+
/**
|
|
1570
|
+
* 销毁函数
|
|
1571
|
+
*/
|
|
1572
|
+
ngOnDestroy() {
|
|
1573
|
+
this.nzDepts = [];
|
|
1574
|
+
this.nzRoles = [];
|
|
1575
|
+
this.nzContacts = [];
|
|
1576
|
+
this.subs.forEach(s => s.unsubscribe());
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
ContactComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ContactComponent, deps: [{ token: ContactService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1580
|
+
ContactComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: ContactComponent, selector: "contact", inputs: { nzTabsetSearch: "nzTabsetSearch", nzTabsetLoading: "nzTabsetLoading", nzExpandAll: "nzExpandAll", nzDepts: "nzDepts", nzDeptTreeVirtualHeight: "nzDeptTreeVirtualHeight", nzDeptClass: "nzDeptClass", nzDeptClassHistory: "nzDeptClassHistory", nzDeptGrade: "nzDeptGrade", nzDeptGradeID: "nzDeptGradeID", nzRoles: "nzRoles", nzRoleTreeVirtualHeight: "nzRoleTreeVirtualHeight", nzFriendGroups: "nzFriendGroups", defaultContacts: "defaultContacts", nzContacts: "nzContacts", nzContactLoading: "nzContactLoading", button: "button" }, outputs: { confirmed: "confirmed" }, viewQueries: [{ propertyName: "st", first: true, predicate: ["st"], descendants: true }], ngImport: i0, 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", 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"], components: [{ type: i2$3.NzTabSetComponent, selector: "nz-tabset", inputs: ["nzSelectedIndex", "nzTabPosition", "nzTabBarExtraContent", "nzCanDeactivate", "nzAddIcon", "nzTabBarStyle", "nzType", "nzSize", "nzAnimated", "nzTabBarGutter", "nzHideAdd", "nzCentered", "nzHideAll", "nzLinkRouter", "nzLinkExact"], outputs: ["nzSelectChange", "nzSelectedIndexChange", "nzTabListScroll", "nzClose", "nzAdd"], exportAs: ["nzTabset"] }, { type: i2$3.NzTabComponent, selector: "nz-tab", inputs: ["nzTitle", "nzClosable", "nzCloseIcon", "nzDisabled", "nzForceRender"], outputs: ["nzSelect", "nzDeselect", "nzClick", "nzContextmenu"], exportAs: ["nzTab"] }, { type: i3$2.SGContainerComponent, selector: "sg-container, [sg-container]", inputs: ["gutter", "sg-container", "col"], exportAs: ["sgContainer"] }, { type: i3$2.SGComponent, selector: "sg", inputs: ["col"], exportAs: ["sg"] }, { type: i4$1.NzInputGroupComponent, selector: "nz-input-group", inputs: ["nzAddOnBeforeIcon", "nzAddOnAfterIcon", "nzPrefixIcon", "nzSuffixIcon", "nzAddOnBefore", "nzAddOnAfter", "nzPrefix", "nzSuffix", "nzSize", "nzSearch", "nzCompact"], exportAs: ["nzInputGroup"] }, { type: i5$2.NzSpinComponent, selector: "nz-spin", inputs: ["nzIndicator", "nzSize", "nzTip", "nzDelay", "nzSimple", "nzSpinning"], exportAs: ["nzSpin"] }, { type: i6$1.NzTreeComponent, selector: "nz-tree", inputs: ["nzShowIcon", "nzHideUnMatched", "nzBlockNode", "nzExpandAll", "nzSelectMode", "nzCheckStrictly", "nzShowExpand", "nzShowLine", "nzCheckable", "nzAsyncData", "nzDraggable", "nzMultiple", "nzExpandedIcon", "nzVirtualItemSize", "nzVirtualMaxBufferPx", "nzVirtualMinBufferPx", "nzVirtualHeight", "nzTreeTemplate", "nzBeforeDrop", "nzData", "nzExpandedKeys", "nzSelectedKeys", "nzCheckedKeys", "nzSearchValue", "nzSearchFunc"], outputs: ["nzExpandedKeysChange", "nzSelectedKeysChange", "nzCheckedKeysChange", "nzSearchValueChange", "nzClick", "nzDblClick", "nzContextMenu", "nzCheckBoxChange", "nzExpandChange", "nzOnDragStart", "nzOnDragEnter", "nzOnDragOver", "nzOnDragLeave", "nzOnDrop", "nzOnDragEnd"], exportAs: ["nzTree"] }, { type: i7$1.NzListComponent, selector: "nz-list, [nz-list]", inputs: ["nzDataSource", "nzBordered", "nzGrid", "nzHeader", "nzFooter", "nzItemLayout", "nzRenderItem", "nzLoading", "nzLoadMore", "nzPagination", "nzSize", "nzSplit", "nzNoResult"], exportAs: ["nzList"] }, { type: i7$1.NzListItemComponent, selector: "nz-list-item, [nz-list-item]", inputs: ["nzActions", "nzContent", "nzExtra", "nzNoFlex"], exportAs: ["nzListItem"] }, { type: i7$1.NzListItemMetaComponent, selector: "nz-list-item-meta, [nz-list-item-meta]", inputs: ["nzAvatar", "nzTitle", "nzDescription"], exportAs: ["nzListItemMeta"] }, { type: i7$1.NzListItemMetaTitleComponent, selector: "nz-list-item-meta-title", exportAs: ["nzListItemMetaTitle"] }, { type: i8$1.STComponent, selector: "st", inputs: ["req", "res", "page", "data", "columns", "contextmenu", "ps", "pi", "total", "loading", "loadingDelay", "loadingIndicator", "bordered", "size", "scroll", "singleSort", "multiSort", "rowClassName", "clickRowClassName", "widthMode", "widthConfig", "resizable", "header", "showHeader", "footer", "bodyHeader", "body", "expandRowByClick", "expandAccordion", "expand", "noResult", "responsive", "responsiveHideHeaderFooter", "virtualScroll", "virtualItemSize", "virtualMaxBufferPx", "virtualMinBufferPx", "customRequest", "virtualForTrackBy"], outputs: ["error", "change"], exportAs: ["st"] }, { type: i9$2.NzButtonComponent, selector: "button[nz-button], a[nz-button]", inputs: ["nzBlock", "nzGhost", "nzSearch", "nzLoading", "nzDanger", "disabled", "tabIndex", "nzType", "nzShape", "nzSize"], exportAs: ["nzButton"] }], directives: [{ type: i5.NzRowDirective, selector: "[nz-row],nz-row,nz-form-item", inputs: ["nzAlign", "nzJustify", "nzGutter"], exportAs: ["nzRow"] }, { type: i5.NzColDirective, selector: "[nz-col],nz-col,nz-form-control,nz-form-label", inputs: ["nzFlex", "nzSpan", "nzOrder", "nzOffset", "nzPush", "nzPull", "nzXs", "nzSm", "nzMd", "nzLg", "nzXl", "nzXXl"], exportAs: ["nzCol"] }, { type: i8.ɵNzTransitionPatchDirective, selector: "[nz-button], nz-button-group, [nz-icon], [nz-menu-item], [nz-submenu], nz-select-top-control, nz-select-placeholder, nz-input-group", inputs: ["hidden"] }, { type: i4$1.NzInputGroupWhitSuffixOrPrefixDirective, selector: "nz-input-group[nzSuffix], nz-input-group[nzPrefix]" }, { type: i4$1.NzInputDirective, selector: "input[nz-input],textarea[nz-input]", inputs: ["nzBorderless", "nzSize", "disabled"], exportAs: ["nzInput"] }, { type: i7.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i7.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i7.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i9$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i9$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i14.NzWaveDirective, selector: "[nz-wave],button[nz-button]:not([nzType=\"link\"]):not([nzType=\"text\"])", inputs: ["nzWaveExtraNode"], exportAs: ["nzWave"] }, { type: i9.NzIconDirective, selector: "[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }] });
|
|
1581
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ContactComponent, decorators: [{
|
|
1582
|
+
type: Component,
|
|
1583
|
+
args: [{ selector: 'contact', 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", 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"] }]
|
|
1584
|
+
}], ctorParameters: function () { return [{ type: ContactService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { nzTabsetSearch: [{
|
|
1585
|
+
type: Optional
|
|
1586
|
+
}, {
|
|
1587
|
+
type: Input
|
|
1588
|
+
}], nzTabsetLoading: [{
|
|
1589
|
+
type: Optional
|
|
1590
|
+
}, {
|
|
1591
|
+
type: Input
|
|
1592
|
+
}], nzExpandAll: [{
|
|
1593
|
+
type: Optional
|
|
1594
|
+
}, {
|
|
1595
|
+
type: Input
|
|
1596
|
+
}], nzDepts: [{
|
|
1597
|
+
type: Optional
|
|
1598
|
+
}, {
|
|
1599
|
+
type: Input
|
|
1600
|
+
}], nzDeptTreeVirtualHeight: [{
|
|
1601
|
+
type: Optional
|
|
1602
|
+
}, {
|
|
1603
|
+
type: Input
|
|
1604
|
+
}], nzDeptClass: [{
|
|
1605
|
+
type: Optional
|
|
1606
|
+
}, {
|
|
1607
|
+
type: Input
|
|
1608
|
+
}], nzDeptClassHistory: [{
|
|
1609
|
+
type: Optional
|
|
1610
|
+
}, {
|
|
1611
|
+
type: Input
|
|
1612
|
+
}], nzDeptGrade: [{
|
|
1613
|
+
type: Optional
|
|
1614
|
+
}, {
|
|
1615
|
+
type: Input
|
|
1616
|
+
}], nzDeptGradeID: [{
|
|
1617
|
+
type: Optional
|
|
1618
|
+
}, {
|
|
1619
|
+
type: Input
|
|
1620
|
+
}], nzRoles: [{
|
|
1621
|
+
type: Optional
|
|
1622
|
+
}, {
|
|
1623
|
+
type: Input
|
|
1624
|
+
}], nzRoleTreeVirtualHeight: [{
|
|
1625
|
+
type: Optional
|
|
1626
|
+
}, {
|
|
1627
|
+
type: Input
|
|
1628
|
+
}], nzFriendGroups: [{
|
|
1629
|
+
type: Optional
|
|
1630
|
+
}, {
|
|
1631
|
+
type: Input
|
|
1632
|
+
}], st: [{
|
|
1633
|
+
type: ViewChild,
|
|
1634
|
+
args: ['st', { static: false }]
|
|
1635
|
+
}], defaultContacts: [{
|
|
1636
|
+
type: Optional
|
|
1637
|
+
}, {
|
|
1638
|
+
type: Input
|
|
1639
|
+
}], nzContacts: [{
|
|
1640
|
+
type: Optional
|
|
1641
|
+
}, {
|
|
1642
|
+
type: Input
|
|
1643
|
+
}], nzContactLoading: [{
|
|
1644
|
+
type: Optional
|
|
1645
|
+
}, {
|
|
1646
|
+
type: Input
|
|
1647
|
+
}], button: [{
|
|
1648
|
+
type: Optional
|
|
1649
|
+
}, {
|
|
1650
|
+
type: Input
|
|
1651
|
+
}], confirmed: [{
|
|
1652
|
+
type: Output
|
|
1653
|
+
}] } });
|
|
1654
|
+
|
|
1655
|
+
const STOMP_DEFAULT_CONFIG = {
|
|
1656
|
+
connectHeaders: {
|
|
1657
|
+
login: 'guest',
|
|
1658
|
+
passcode: 'guest'
|
|
1659
|
+
},
|
|
1660
|
+
brokerURL: '/websocket/ws/',
|
|
1661
|
+
heartbeatIncoming: 1000 * 60,
|
|
1662
|
+
heartbeatOutgoing: 1000 * 60,
|
|
1663
|
+
reconnectDelay: 30000000,
|
|
1664
|
+
debug: msg => {
|
|
1665
|
+
log$1(msg);
|
|
1666
|
+
}
|
|
1667
|
+
};
|
|
1668
|
+
function mergeStompConfig(srv) {
|
|
1669
|
+
return srv.merge('stomp', STOMP_DEFAULT_CONFIG);
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1672
|
+
class YzStompService {
|
|
1673
|
+
constructor(csr, cache, injector, notification) {
|
|
1674
|
+
this.csr = csr;
|
|
1675
|
+
this.cache = cache;
|
|
1676
|
+
this.injector = injector;
|
|
1677
|
+
this.notification = notification;
|
|
1678
|
+
this.config = null;
|
|
1679
|
+
this.bisConfig = null;
|
|
1680
|
+
this.rxStomp = null;
|
|
1681
|
+
this.subs = [];
|
|
1682
|
+
if (!this.user) {
|
|
1683
|
+
this.user = this.cache.get('_yz_user', { mode: 'none' });
|
|
1684
|
+
}
|
|
1685
|
+
if (!this.config) {
|
|
1686
|
+
this.config = mergeStompConfig(this.csr);
|
|
1687
|
+
}
|
|
1688
|
+
if (!this.bisConfig) {
|
|
1689
|
+
this.bisConfig = mergeBisConfig(csr);
|
|
1690
|
+
}
|
|
1691
|
+
if (!this.rxStomp) {
|
|
1692
|
+
this.rxStomp = new RxStomp();
|
|
1693
|
+
if (isDevMode()) {
|
|
1694
|
+
log$1('yz.stomp.service: is dev mode');
|
|
1695
|
+
log$1('yz.stomp.service: ', `config is ${JSON.stringify(this.config)}`);
|
|
1696
|
+
this.rxStomp.configure(this.config);
|
|
1697
|
+
return;
|
|
1698
|
+
}
|
|
1699
|
+
const { location } = this.injector.get(DOCUMENT);
|
|
1700
|
+
const { protocol, host } = location;
|
|
1701
|
+
log$1('yz.stomp.service: ', `protocol is ${protocol},host is ${host}`);
|
|
1702
|
+
if (protocol.includes('http') && !protocol.includes('https')) {
|
|
1703
|
+
this.config.brokerURL = `ws://${host}${this.config.brokerURL}`;
|
|
1704
|
+
}
|
|
1705
|
+
if (protocol.includes('https')) {
|
|
1706
|
+
this.config.brokerURL = `wss://${host}${this.config.brokerURL}`;
|
|
1707
|
+
}
|
|
1708
|
+
log$1('yz.stomp.service: ', `config is ${this.config}`);
|
|
1709
|
+
this.rxStomp.configure(this.config);
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
listen() {
|
|
1713
|
+
this.subs.push(this.rxStomp.watch(`/topic/layout_${this.user.username}`).subscribe(message => {
|
|
1714
|
+
this.createNotification(JSON.parse(message.body));
|
|
1715
|
+
}));
|
|
1716
|
+
this.subs.push(this.rxStomp.watch(`/topic/layout_xx_${this.user.username}`).subscribe((message) => {
|
|
1717
|
+
this.logoutNotification(JSON.parse(message.body));
|
|
1718
|
+
}));
|
|
1719
|
+
this.rxStomp.activate();
|
|
1720
|
+
}
|
|
1721
|
+
createNotification(message) {
|
|
1722
|
+
this.notification.create(message.type, message.title, `<a href=${message.href}>${message.content}</a>`);
|
|
1723
|
+
}
|
|
1724
|
+
logoutNotification(message) {
|
|
1725
|
+
this.notification.create(message.type, message.title, `${message.content},剩余时间5秒`);
|
|
1726
|
+
setTimeout(() => {
|
|
1727
|
+
this.cache.clear();
|
|
1728
|
+
localStorage.clear();
|
|
1729
|
+
this.injector.get(WINDOW).location.href = `${this.bisConfig.baseUrl}/cas-proxy/app/logout`;
|
|
1730
|
+
}, 5000);
|
|
1731
|
+
}
|
|
1732
|
+
unListen() {
|
|
1733
|
+
this.subs.forEach(s => s.unsubscribe());
|
|
1734
|
+
this.rxStomp.deactivate().then();
|
|
1735
|
+
}
|
|
1736
|
+
publish(parameters) {
|
|
1737
|
+
this.rxStomp.publish(parameters);
|
|
1738
|
+
}
|
|
1739
|
+
watch(destination, headers) {
|
|
1740
|
+
return this.rxStomp.watch(destination, headers);
|
|
1741
|
+
}
|
|
1742
|
+
}
|
|
1743
|
+
YzStompService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YzStompService, deps: [{ token: i1$2.YunzaiConfigService }, { token: i2$1.CacheService }, { token: i0.Injector }, { token: i3$3.NzNotificationService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1744
|
+
YzStompService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YzStompService, providedIn: 'root' });
|
|
1745
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YzStompService, decorators: [{
|
|
1746
|
+
type: Injectable,
|
|
1747
|
+
args: [{ providedIn: 'root' }]
|
|
1748
|
+
}], ctorParameters: function () { return [{ type: i1$2.YunzaiConfigService }, { type: i2$1.CacheService }, { type: i0.Injector }, { type: i3$3.NzNotificationService }]; } });
|
|
1749
|
+
|
|
1750
|
+
class YzLayoutBasicComponent {
|
|
1751
|
+
constructor(cacheService, yzStompService, layoutService) {
|
|
1752
|
+
this.cacheService = cacheService;
|
|
1753
|
+
this.yzStompService = yzStompService;
|
|
1754
|
+
this.layoutService = layoutService;
|
|
1755
|
+
this.options = {
|
|
1756
|
+
logoExpanded: `./assets/logo-full.svg`,
|
|
1757
|
+
logoCollapsed: `./assets/logo.svg`
|
|
1758
|
+
};
|
|
1759
|
+
this.intro = '';
|
|
1760
|
+
this.text = '';
|
|
1761
|
+
this.icon = '';
|
|
1762
|
+
this.showReuseTab = true;
|
|
1763
|
+
this.showHeader = true;
|
|
1764
|
+
this.showSider = true;
|
|
1765
|
+
}
|
|
1766
|
+
get reuseStyleSheet() {
|
|
1767
|
+
let cascadingStyleSheet = {};
|
|
1768
|
+
if (!this.showHeader) {
|
|
1769
|
+
cascadingStyleSheet = {
|
|
1770
|
+
...cascadingStyleSheet,
|
|
1771
|
+
top: 0
|
|
1772
|
+
};
|
|
1773
|
+
}
|
|
1774
|
+
if (!this.showSider) {
|
|
1775
|
+
cascadingStyleSheet = {
|
|
1776
|
+
...cascadingStyleSheet,
|
|
1777
|
+
left: '24px'
|
|
1778
|
+
};
|
|
1779
|
+
}
|
|
1780
|
+
return cascadingStyleSheet;
|
|
1781
|
+
}
|
|
1782
|
+
ngOnInit() {
|
|
1783
|
+
const current = this.cacheService.get('_yz_current', { mode: 'none' });
|
|
1784
|
+
const project = this.cacheService.get('_yz_project_info', { mode: 'none' });
|
|
1785
|
+
this.text = current.text ? current.text : '应用名称';
|
|
1786
|
+
this.intro = current.intro ? current.intro : '应用描述';
|
|
1787
|
+
this.icon = current.icon ? current.icon : `./assets/tmp/img/avatar.jpg`;
|
|
1788
|
+
this.options.logoExpanded = project.maxLogoUrl ? project.maxLogoUrl : `./assets/logo-full.svg`;
|
|
1789
|
+
this.options.logoCollapsed = project.miniLogoUrl ? project.miniLogoUrl : `./assets/logo.svg`;
|
|
1790
|
+
this.yzStompService.listen();
|
|
1791
|
+
this.layoutService.reuseTab.asObservable().subscribe(show => (this.showReuseTab = show));
|
|
1792
|
+
this.layoutService.header.asObservable().subscribe(show => (this.showHeader = show));
|
|
1793
|
+
this.layoutService.sidebar.asObservable().subscribe(show => (this.showSider = show));
|
|
1794
|
+
}
|
|
1795
|
+
ngOnDestroy() {
|
|
1796
|
+
this.yzStompService.unListen();
|
|
1797
|
+
}
|
|
1798
|
+
}
|
|
1799
|
+
YzLayoutBasicComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YzLayoutBasicComponent, deps: [{ token: i2$1.CacheService }, { token: YzStompService }, { token: i3$4.LayoutService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1800
|
+
YzLayoutBasicComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: YzLayoutBasicComponent, selector: "yz-layout-basic", ngImport: i0, template: `
|
|
1801
|
+
<layout-default [options]="options" [asideUser]="asideUserTpl" [content]="showReuseTab ? contentTpl : noneTpl">
|
|
1802
|
+
<layout-default-header-item direction="left">
|
|
1803
|
+
<yz-header-application></yz-header-application>
|
|
1804
|
+
</layout-default-header-item>
|
|
1805
|
+
|
|
1806
|
+
<layout-default-header-item direction="right" hidden="mobile">
|
|
1807
|
+
<yz-header-notify></yz-header-notify>
|
|
1808
|
+
</layout-default-header-item>
|
|
1809
|
+
|
|
1810
|
+
<layout-default-header-item direction="right" hidden="mobile">
|
|
1811
|
+
<yz-header-theme-btn></yz-header-theme-btn>
|
|
1812
|
+
</layout-default-header-item>
|
|
1813
|
+
|
|
1814
|
+
<layout-default-header-item direction="right" hidden="mobile">
|
|
1815
|
+
<div
|
|
1816
|
+
layout-default-header-item-trigger
|
|
1817
|
+
nz-dropdown
|
|
1818
|
+
[nzDropdownMenu]="settingsMenu"
|
|
1819
|
+
nzTrigger="click"
|
|
1820
|
+
nzPlacement="bottomRight"
|
|
1821
|
+
>
|
|
1822
|
+
<i nz-icon nzType="setting"></i>
|
|
1823
|
+
</div>
|
|
1824
|
+
<nz-dropdown-menu #settingsMenu="nzDropdownMenu">
|
|
1825
|
+
<div nz-menu style="width: 200px;">
|
|
1826
|
+
<div nz-menu-item>
|
|
1827
|
+
<yz-header-fullscreen></yz-header-fullscreen>
|
|
1828
|
+
</div>
|
|
1829
|
+
<div nz-menu-item>
|
|
1830
|
+
<yz-header-clear-storage></yz-header-clear-storage>
|
|
1831
|
+
</div>
|
|
1832
|
+
<div nz-menu-item>
|
|
1833
|
+
<yz-header-i18n></yz-header-i18n>
|
|
1834
|
+
</div>
|
|
1835
|
+
</div>
|
|
1836
|
+
</nz-dropdown-menu>
|
|
1837
|
+
</layout-default-header-item>
|
|
1838
|
+
<layout-default-header-item direction="right">
|
|
1839
|
+
<yz-header-user></yz-header-user>
|
|
1840
|
+
</layout-default-header-item>
|
|
1841
|
+
<ng-template #asideUserTpl>
|
|
1842
|
+
<div nz-dropdown nzTrigger="click" [nzDropdownMenu]="userMenu" class="yunzai-default__aside-user">
|
|
1843
|
+
<nz-avatar class="yunzai-default__aside-user-avatar" [nzSrc]="icon"></nz-avatar>
|
|
1844
|
+
<div class="yunzai-default__aside-user-info">
|
|
1845
|
+
<strong>{{ text }}</strong>
|
|
1846
|
+
<p class="mb0">{{ intro }}</p>
|
|
1847
|
+
</div>
|
|
1848
|
+
</div>
|
|
1849
|
+
<nz-dropdown-menu #userMenu="nzDropdownMenu">
|
|
1850
|
+
<ul nz-menu>
|
|
1851
|
+
<li nz-menu-item routerLink="/">{{ 'menu.backtohome' | i18n }}</li>
|
|
1852
|
+
</ul>
|
|
1853
|
+
</nz-dropdown-menu>
|
|
1854
|
+
</ng-template>
|
|
1855
|
+
<ng-template #contentTpl>
|
|
1856
|
+
<reuse-tab #reuseTab [ngStyle]="reuseStyleSheet"></reuse-tab>
|
|
1857
|
+
<router-outlet (activate)="reuseTab.activate($event)"></router-outlet>
|
|
1858
|
+
</ng-template>
|
|
1859
|
+
<ng-template #noneTpl>
|
|
1860
|
+
<router-outlet></router-outlet>
|
|
1861
|
+
</ng-template>
|
|
1862
|
+
</layout-default>
|
|
1863
|
+
`, isInline: true, components: [{ type: i3$4.LayoutDefaultComponent, selector: "layout-default", inputs: ["options", "asideUser", "nav", "content", "customError"], exportAs: ["layoutDefault"] }, { type: i3$4.LayoutDefaultHeaderItemComponent, selector: "layout-default-header-item", inputs: ["hidden", "direction"] }, { type: YzHeaderApplicationComponent, selector: "yz-header-application" }, { type: YzHeaderNotifyComponent, selector: "yz-header-notify" }, { type: YzHeaderThemBtnComponent, selector: "yz-header-theme-btn", inputs: ["types", "devTips", "deployUrl"] }, { type: i2$2.NzDropdownMenuComponent, selector: "nz-dropdown-menu", exportAs: ["nzDropdownMenu"] }, { type: YzHeaderFullScreenComponent, selector: "yz-header-fullscreen" }, { type: YzHeaderClearStorageComponent, selector: "yz-header-clear-storage" }, { type: YzHeaderI18NComponent, selector: "yz-header-i18n", inputs: ["showLangText"] }, { type: YzHeaderUserComponent, selector: "yz-header-user" }, { type: i4$3.NzAvatarComponent, selector: "nz-avatar", inputs: ["nzShape", "nzSize", "nzGap", "nzText", "nzSrc", "nzSrcSet", "nzAlt", "nzIcon"], outputs: ["nzError"], exportAs: ["nzAvatar"] }, { type: i13.ReuseTabComponent, selector: "reuse-tab, [reuse-tab]", inputs: ["mode", "i18n", "debug", "max", "tabMaxWidth", "excludes", "allowClose", "keepingScroll", "keepingScrollContainer", "customContextMenu", "tabBarExtraContent", "tabBarGutter", "tabBarStyle", "tabType", "routeParamMatchMode", "disabled", "titleRender"], outputs: ["change", "close"], exportAs: ["reuseTab"] }], directives: [{ type: i3$4.LayoutDefaultHeaderItemTriggerDirective, selector: "[layout-default-header-item-trigger]" }, { type: i2$2.NzDropDownDirective, selector: "[nz-dropdown]", inputs: ["nzDropdownMenu", "nzTrigger", "nzMatchWidthElement", "nzBackdrop", "nzClickHide", "nzDisabled", "nzVisible", "nzOverlayClassName", "nzOverlayStyle", "nzPlacement"], outputs: ["nzVisibleChange"], exportAs: ["nzDropdown"] }, { type: i8.ɵNzTransitionPatchDirective, selector: "[nz-button], nz-button-group, [nz-icon], [nz-menu-item], [nz-submenu], nz-select-top-control, nz-select-placeholder, nz-input-group", inputs: ["hidden"] }, { type: i9.NzIconDirective, selector: "[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { type: i6.NzMenuDirective, selector: "[nz-menu]", inputs: ["nzInlineIndent", "nzTheme", "nzMode", "nzInlineCollapsed", "nzSelectable"], outputs: ["nzClick"], exportAs: ["nzMenu"] }, { type: i6.NzMenuItemDirective, selector: "[nz-menu-item]", inputs: ["nzPaddingLeft", "nzDisabled", "nzSelected", "nzDanger", "nzMatchRouterExact", "nzMatchRouter"], exportAs: ["nzMenuItem"] }, { type: i17.RouterLink, selector: ":not(a):not(area)[routerLink]", inputs: ["queryParams", "fragment", "queryParamsHandling", "preserveFragment", "skipLocationChange", "replaceUrl", "state", "relativeTo", "routerLink"] }, { type: i9$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i17.RouterOutlet, selector: "router-outlet", outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }], pipes: { "i18n": i1.I18nPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1864
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YzLayoutBasicComponent, decorators: [{
|
|
1865
|
+
type: Component,
|
|
1866
|
+
args: [{
|
|
1867
|
+
selector: 'yz-layout-basic',
|
|
1868
|
+
template: `
|
|
1869
|
+
<layout-default [options]="options" [asideUser]="asideUserTpl" [content]="showReuseTab ? contentTpl : noneTpl">
|
|
1870
|
+
<layout-default-header-item direction="left">
|
|
1871
|
+
<yz-header-application></yz-header-application>
|
|
1872
|
+
</layout-default-header-item>
|
|
1873
|
+
|
|
1874
|
+
<layout-default-header-item direction="right" hidden="mobile">
|
|
1875
|
+
<yz-header-notify></yz-header-notify>
|
|
1876
|
+
</layout-default-header-item>
|
|
1877
|
+
|
|
1878
|
+
<layout-default-header-item direction="right" hidden="mobile">
|
|
1879
|
+
<yz-header-theme-btn></yz-header-theme-btn>
|
|
1880
|
+
</layout-default-header-item>
|
|
1881
|
+
|
|
1882
|
+
<layout-default-header-item direction="right" hidden="mobile">
|
|
1883
|
+
<div
|
|
1884
|
+
layout-default-header-item-trigger
|
|
1885
|
+
nz-dropdown
|
|
1886
|
+
[nzDropdownMenu]="settingsMenu"
|
|
1887
|
+
nzTrigger="click"
|
|
1888
|
+
nzPlacement="bottomRight"
|
|
1889
|
+
>
|
|
1890
|
+
<i nz-icon nzType="setting"></i>
|
|
1891
|
+
</div>
|
|
1892
|
+
<nz-dropdown-menu #settingsMenu="nzDropdownMenu">
|
|
1893
|
+
<div nz-menu style="width: 200px;">
|
|
1894
|
+
<div nz-menu-item>
|
|
1895
|
+
<yz-header-fullscreen></yz-header-fullscreen>
|
|
1896
|
+
</div>
|
|
1897
|
+
<div nz-menu-item>
|
|
1898
|
+
<yz-header-clear-storage></yz-header-clear-storage>
|
|
1899
|
+
</div>
|
|
1900
|
+
<div nz-menu-item>
|
|
1901
|
+
<yz-header-i18n></yz-header-i18n>
|
|
1902
|
+
</div>
|
|
1903
|
+
</div>
|
|
1904
|
+
</nz-dropdown-menu>
|
|
1905
|
+
</layout-default-header-item>
|
|
1906
|
+
<layout-default-header-item direction="right">
|
|
1907
|
+
<yz-header-user></yz-header-user>
|
|
1908
|
+
</layout-default-header-item>
|
|
1909
|
+
<ng-template #asideUserTpl>
|
|
1910
|
+
<div nz-dropdown nzTrigger="click" [nzDropdownMenu]="userMenu" class="yunzai-default__aside-user">
|
|
1911
|
+
<nz-avatar class="yunzai-default__aside-user-avatar" [nzSrc]="icon"></nz-avatar>
|
|
1912
|
+
<div class="yunzai-default__aside-user-info">
|
|
1913
|
+
<strong>{{ text }}</strong>
|
|
1914
|
+
<p class="mb0">{{ intro }}</p>
|
|
1915
|
+
</div>
|
|
1916
|
+
</div>
|
|
1917
|
+
<nz-dropdown-menu #userMenu="nzDropdownMenu">
|
|
1918
|
+
<ul nz-menu>
|
|
1919
|
+
<li nz-menu-item routerLink="/">{{ 'menu.backtohome' | i18n }}</li>
|
|
1920
|
+
</ul>
|
|
1921
|
+
</nz-dropdown-menu>
|
|
1922
|
+
</ng-template>
|
|
1923
|
+
<ng-template #contentTpl>
|
|
1924
|
+
<reuse-tab #reuseTab [ngStyle]="reuseStyleSheet"></reuse-tab>
|
|
1925
|
+
<router-outlet (activate)="reuseTab.activate($event)"></router-outlet>
|
|
1926
|
+
</ng-template>
|
|
1927
|
+
<ng-template #noneTpl>
|
|
1928
|
+
<router-outlet></router-outlet>
|
|
1929
|
+
</ng-template>
|
|
1930
|
+
</layout-default>
|
|
1931
|
+
`,
|
|
1932
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
|
1933
|
+
}]
|
|
1934
|
+
}], ctorParameters: function () { return [{ type: i2$1.CacheService }, { type: YzStompService }, { type: i3$4.LayoutService }]; } });
|
|
1935
|
+
|
|
1936
|
+
/*
|
|
1937
|
+
* @Author: cui <devcui@outlook.com>
|
|
1938
|
+
* @Editor: microsoft vscode
|
|
1939
|
+
* @Date: 2021-11-27 11:30:50
|
|
1940
|
+
* @LastEditTime: 2021-11-27 14:38:46
|
|
1941
|
+
* @LastEditors: cui <devcui@outlook.com>
|
|
1942
|
+
* @Description: empty description
|
|
1943
|
+
* @FilePath: \yelon\packages\bis\layout\layout.module.ts
|
|
1944
|
+
* LICENSE HERE
|
|
1945
|
+
*/
|
|
1946
|
+
const COMPONENTS = [
|
|
1947
|
+
ContactComponent,
|
|
1948
|
+
YzLayoutBasicComponent,
|
|
1949
|
+
YzHeaderApplicationComponent,
|
|
1950
|
+
YzHeaderNotifyComponent,
|
|
1951
|
+
YzHeaderThemBtnComponent,
|
|
1952
|
+
YzHeaderUserComponent,
|
|
1953
|
+
YzHeaderFullScreenComponent,
|
|
1954
|
+
YzHeaderClearStorageComponent,
|
|
1955
|
+
YzHeaderI18NComponent
|
|
1956
|
+
];
|
|
1957
|
+
class YunzaiLayoutModule {
|
|
1958
|
+
}
|
|
1959
|
+
YunzaiLayoutModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YunzaiLayoutModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1960
|
+
YunzaiLayoutModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YunzaiLayoutModule, declarations: [ContactComponent,
|
|
1961
|
+
YzLayoutBasicComponent,
|
|
1962
|
+
YzHeaderApplicationComponent,
|
|
1963
|
+
YzHeaderNotifyComponent,
|
|
1964
|
+
YzHeaderThemBtnComponent,
|
|
1965
|
+
YzHeaderUserComponent,
|
|
1966
|
+
YzHeaderFullScreenComponent,
|
|
1967
|
+
YzHeaderClearStorageComponent,
|
|
1968
|
+
YzHeaderI18NComponent], imports: [HttpClientModule, CommonModule, FormsModule, RouterModule, ReactiveFormsModule, YzSharedModule], exports: [ContactComponent,
|
|
1969
|
+
YzLayoutBasicComponent,
|
|
1970
|
+
YzHeaderApplicationComponent,
|
|
1971
|
+
YzHeaderNotifyComponent,
|
|
1972
|
+
YzHeaderThemBtnComponent,
|
|
1973
|
+
YzHeaderUserComponent,
|
|
1974
|
+
YzHeaderFullScreenComponent,
|
|
1975
|
+
YzHeaderClearStorageComponent,
|
|
1976
|
+
YzHeaderI18NComponent] });
|
|
1977
|
+
YunzaiLayoutModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YunzaiLayoutModule, providers: [
|
|
1978
|
+
{
|
|
1979
|
+
provide: YUNZAI_THEME_BTN_KEYS,
|
|
1980
|
+
useValue: 'site-theme'
|
|
1981
|
+
}
|
|
1982
|
+
], imports: [[HttpClientModule, CommonModule, FormsModule, RouterModule, ReactiveFormsModule, YzSharedModule]] });
|
|
1983
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YunzaiLayoutModule, decorators: [{
|
|
1984
|
+
type: NgModule,
|
|
1985
|
+
args: [{
|
|
1986
|
+
imports: [HttpClientModule, CommonModule, FormsModule, RouterModule, ReactiveFormsModule, YzSharedModule],
|
|
1987
|
+
providers: [
|
|
1988
|
+
{
|
|
1989
|
+
provide: YUNZAI_THEME_BTN_KEYS,
|
|
1990
|
+
useValue: 'site-theme'
|
|
1991
|
+
}
|
|
1992
|
+
],
|
|
1993
|
+
declarations: [...COMPONENTS],
|
|
1994
|
+
exports: [...COMPONENTS]
|
|
1995
|
+
}]
|
|
1996
|
+
}] });
|
|
1997
|
+
|
|
1998
|
+
class YzAuthService {
|
|
1999
|
+
constructor(injector) {
|
|
2000
|
+
this.injector = injector;
|
|
2001
|
+
this.option = mergeConfig(this.csr);
|
|
2002
|
+
this.bis = mergeBisConfig(this.csr);
|
|
2003
|
+
}
|
|
2004
|
+
get csr() {
|
|
2005
|
+
return this.injector.get(YunzaiConfigService);
|
|
2006
|
+
}
|
|
2007
|
+
get tokenService() {
|
|
2008
|
+
return this.injector.get(YA_SERVICE_TOKEN);
|
|
2009
|
+
}
|
|
2010
|
+
get httpClient() {
|
|
2011
|
+
return this.injector.get(_HttpClient);
|
|
2012
|
+
}
|
|
2013
|
+
get cacheService() {
|
|
2014
|
+
return this.injector.get(CacheService);
|
|
2015
|
+
}
|
|
2016
|
+
askToken() {
|
|
2017
|
+
log('yz.auth.service: ', 'askToken');
|
|
2018
|
+
if (this.tokenService.get()?.token) {
|
|
2019
|
+
return of(this.tokenService.get());
|
|
2020
|
+
}
|
|
2021
|
+
else {
|
|
2022
|
+
if (this.bis.loginForm) {
|
|
2023
|
+
return this.fetchTokenByUP();
|
|
2024
|
+
}
|
|
2025
|
+
else {
|
|
2026
|
+
return this.fetchTokenByCas();
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
2029
|
+
}
|
|
2030
|
+
fetchTokenByUP() {
|
|
2031
|
+
log('yz.auth.service: ', 'fetchTokenByUP');
|
|
2032
|
+
return this.httpClient.post(`/auth/oauth/token?_allow_anonymous=true`, this.bis.loginForm).pipe(map((response) => {
|
|
2033
|
+
const { access_token, expires_in, refresh_token, scope, token_type } = response;
|
|
2034
|
+
return {
|
|
2035
|
+
token: access_token,
|
|
2036
|
+
expired: expires_in,
|
|
2037
|
+
refreshToken: refresh_token,
|
|
2038
|
+
tokenType: token_type,
|
|
2039
|
+
scope
|
|
2040
|
+
};
|
|
2041
|
+
}));
|
|
2042
|
+
}
|
|
2043
|
+
fetchTokenByCas() {
|
|
2044
|
+
log('yz.auth.service: ', 'fetchTokenByCas');
|
|
2045
|
+
const uri = encodeURIComponent(this.injector.get(WINDOW).location.href);
|
|
2046
|
+
return this.httpClient
|
|
2047
|
+
.get(`/cas-proxy/app/validate_full?callback=${uri}&_allow_anonymous=true×tamp=${new Date().getTime()}`)
|
|
2048
|
+
.pipe(map((response) => {
|
|
2049
|
+
switch (response.errcode) {
|
|
2050
|
+
case 2000:
|
|
2051
|
+
const { access_token, expires_in, refresh_token, scope, token_type } = response.data;
|
|
2052
|
+
return {
|
|
2053
|
+
token: access_token,
|
|
2054
|
+
expired: expires_in,
|
|
2055
|
+
refreshToken: refresh_token,
|
|
2056
|
+
tokenType: token_type,
|
|
2057
|
+
scope
|
|
2058
|
+
};
|
|
2059
|
+
case 2001:
|
|
2060
|
+
this.injector.get(WINDOW).location.href = response.msg;
|
|
2061
|
+
throw Error("Cookie Error: Can't find Cas Cookie,So jump to login!");
|
|
2062
|
+
default:
|
|
2063
|
+
if (response.data) {
|
|
2064
|
+
console.error(response.data);
|
|
2065
|
+
throw Error(response.data);
|
|
2066
|
+
}
|
|
2067
|
+
else if (response.msg) {
|
|
2068
|
+
console.error(response.msg);
|
|
2069
|
+
throw Error(response.msg);
|
|
2070
|
+
}
|
|
2071
|
+
else {
|
|
2072
|
+
console.error('cas unknown error');
|
|
2073
|
+
throw Error('Unknown Error: Cas auth exception!');
|
|
2074
|
+
}
|
|
2075
|
+
}
|
|
2076
|
+
}));
|
|
2077
|
+
}
|
|
2078
|
+
login() {
|
|
2079
|
+
log('yz.auth.service: ', 'login white login form->', this.bis.loginForm);
|
|
2080
|
+
return this.askToken().pipe(mergeMap(token => {
|
|
2081
|
+
log('yz.auth.service: get token->', token);
|
|
2082
|
+
this.csr.set('auth', {
|
|
2083
|
+
token_send_key: 'Authorization',
|
|
2084
|
+
token_send_template: `${token.tokenType} \${token}`,
|
|
2085
|
+
token_send_place: 'header'
|
|
2086
|
+
});
|
|
2087
|
+
log('yz.auth.service: ', 'set token');
|
|
2088
|
+
this.tokenService.set(token);
|
|
2089
|
+
return this.cacheInit();
|
|
2090
|
+
}), mergeAll());
|
|
2091
|
+
}
|
|
2092
|
+
cacheInit() {
|
|
2093
|
+
log('yz.auth.service: ', 'cacheInit');
|
|
2094
|
+
const user = this.cacheService.get('_yz_user', { mode: 'none' });
|
|
2095
|
+
const header = this.cacheService.get('_yz_header', { mode: 'none' });
|
|
2096
|
+
const project = this.cacheService.get('_yz_project_info', { mode: 'none' });
|
|
2097
|
+
return forkJoin(of(user), of(header), of(project)).pipe(mergeMap(([u, h, p]) => {
|
|
2098
|
+
let list = [];
|
|
2099
|
+
// user cache
|
|
2100
|
+
if (!u) {
|
|
2101
|
+
log('yz.auth.service: ', 'fetch user cache');
|
|
2102
|
+
list.push(this.httpClient.get(`/auth/user`).pipe(map((user) => {
|
|
2103
|
+
this.cacheService.set('_yz_user', user.principal);
|
|
2104
|
+
})));
|
|
2105
|
+
}
|
|
2106
|
+
else {
|
|
2107
|
+
log('yz.auth.service: ', 'user recache');
|
|
2108
|
+
list.push(of(() => { }));
|
|
2109
|
+
}
|
|
2110
|
+
// header cache
|
|
2111
|
+
if (!h) {
|
|
2112
|
+
log('yz.auth.service: ', 'fetch header cache');
|
|
2113
|
+
list.push(this.httpClient.get(`/auth/allheader/v2`).pipe(map((header) => {
|
|
2114
|
+
this.cacheService.set('_yz_header', header.data);
|
|
2115
|
+
})));
|
|
2116
|
+
}
|
|
2117
|
+
else {
|
|
2118
|
+
log('yz.auth.service: ', 'header recache');
|
|
2119
|
+
list.push(of(() => { }));
|
|
2120
|
+
}
|
|
2121
|
+
// project cache
|
|
2122
|
+
if (!p) {
|
|
2123
|
+
log('yz.auth.service: ', 'fetch project cache');
|
|
2124
|
+
list.push(this.httpClient.get(`/app-manager/project/info`).pipe(map((info) => {
|
|
2125
|
+
this.cacheService.set('_yz_project_info', info.data);
|
|
2126
|
+
})));
|
|
2127
|
+
}
|
|
2128
|
+
else {
|
|
2129
|
+
log('yz.auth.service: ', 'project recache');
|
|
2130
|
+
list.push(of(() => { }));
|
|
2131
|
+
}
|
|
2132
|
+
return forkJoin(list);
|
|
2133
|
+
}));
|
|
2134
|
+
}
|
|
2135
|
+
}
|
|
2136
|
+
YzAuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YzAuthService, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2137
|
+
YzAuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YzAuthService, providedIn: 'root' });
|
|
2138
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YzAuthService, decorators: [{
|
|
2139
|
+
type: Injectable,
|
|
2140
|
+
args: [{ providedIn: 'root' }]
|
|
2141
|
+
}], ctorParameters: function () { return [{ type: i0.Injector }]; } });
|
|
2142
|
+
|
|
2143
|
+
const CODEMESSAGE = {
|
|
2144
|
+
200: '服务器成功返回请求的数据。',
|
|
2145
|
+
201: '新建或修改数据成功。',
|
|
2146
|
+
202: '一个请求已经进入后台排队(异步任务)。',
|
|
2147
|
+
204: '删除数据成功。',
|
|
2148
|
+
400: '发出的请求有错误,服务器没有进行新建或修改数据的操作。',
|
|
2149
|
+
401: '用户没有权限(令牌、用户名、密码错误)。',
|
|
2150
|
+
403: '用户得到授权,但是访问是被禁止的。',
|
|
2151
|
+
404: '发出的请求针对的是不存在的记录,服务器没有进行操作。',
|
|
2152
|
+
406: '请求的格式不可得。',
|
|
2153
|
+
410: '请求的资源被永久删除,且不会再得到的。',
|
|
2154
|
+
422: '当创建一个对象时,发生一个验证错误。',
|
|
2155
|
+
500: '服务器发生错误,请检查服务器。',
|
|
2156
|
+
502: '网关错误。',
|
|
2157
|
+
503: '服务不可用,服务器暂时过载或维护。',
|
|
2158
|
+
504: '网关超时。'
|
|
2159
|
+
};
|
|
2160
|
+
/**
|
|
2161
|
+
* 默认HTTP拦截器,其注册细节见 `app.module.ts`
|
|
2162
|
+
*/
|
|
2163
|
+
class YzDefaultInterceptor {
|
|
2164
|
+
constructor(injector) {
|
|
2165
|
+
this.injector = injector;
|
|
2166
|
+
this.jump = false;
|
|
2167
|
+
this.refreshToking = false;
|
|
2168
|
+
this.refreshToken$ = new BehaviorSubject(null);
|
|
2169
|
+
if (this.config.refreshTokenType === 'auth-refresh') {
|
|
2170
|
+
console.error("can't use auth-refresh, please change yz.default.interceptor to default.interceptor!");
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
get notification() {
|
|
2174
|
+
return this.injector.get(NzNotificationService);
|
|
2175
|
+
}
|
|
2176
|
+
get tokenSrv() {
|
|
2177
|
+
return this.injector.get(YA_SERVICE_TOKEN);
|
|
2178
|
+
}
|
|
2179
|
+
get http() {
|
|
2180
|
+
return this.injector.get(_HttpClient);
|
|
2181
|
+
}
|
|
2182
|
+
get config() {
|
|
2183
|
+
return mergeBisConfig(this.injector.get(YunzaiConfigService));
|
|
2184
|
+
}
|
|
2185
|
+
goTo(url) {
|
|
2186
|
+
setTimeout(() => this.injector.get(Router).navigateByUrl(url));
|
|
2187
|
+
}
|
|
2188
|
+
checkStatus(ev) {
|
|
2189
|
+
if ((ev.status >= 200 && ev.status < 300) || ev.status === 401) {
|
|
2190
|
+
return;
|
|
2191
|
+
}
|
|
2192
|
+
if (ev instanceof HttpErrorResponse && (ev.error.message || ev.error.errorMessage)) {
|
|
2193
|
+
if (ev.error.errorMessage) {
|
|
2194
|
+
this.notification.error(`发生了一些错误 `, ev.error.errorMessage);
|
|
2195
|
+
}
|
|
2196
|
+
else {
|
|
2197
|
+
this.notification.error(`发生了一些错误 `, ev.error.message);
|
|
2198
|
+
}
|
|
2199
|
+
return;
|
|
2200
|
+
}
|
|
2201
|
+
if (ev instanceof HttpResponse && ev.body.errorMessage) {
|
|
2202
|
+
this.notification.error(`发生了一些错误 `, ev.body.errorMessage);
|
|
2203
|
+
return;
|
|
2204
|
+
}
|
|
2205
|
+
const errortext = CODEMESSAGE[ev.status] || ev.statusText;
|
|
2206
|
+
this.notification.error(`请求错误 ${ev.status}: ${ev.url}`, errortext);
|
|
2207
|
+
}
|
|
2208
|
+
ToLogin() {
|
|
2209
|
+
this.notification.error(`未登录或登录状态已过期,5秒后将跳转到登录页面。`, ``);
|
|
2210
|
+
setTimeout(() => {
|
|
2211
|
+
localStorage.clear();
|
|
2212
|
+
this.injector.get(WINDOW).location.href = `${this.config.baseUrl}/cas-proxy/app/logout`;
|
|
2213
|
+
}, 5000);
|
|
2214
|
+
}
|
|
2215
|
+
reAttachToken(req) {
|
|
2216
|
+
const token = this.tokenSrv.get()?.token;
|
|
2217
|
+
return req.clone({
|
|
2218
|
+
setHeaders: {
|
|
2219
|
+
Authorization: `Bearer ${token}`
|
|
2220
|
+
}
|
|
2221
|
+
});
|
|
2222
|
+
}
|
|
2223
|
+
refreshTokenRequest() {
|
|
2224
|
+
const model = this.tokenSrv.get();
|
|
2225
|
+
const form = new FormData();
|
|
2226
|
+
form.set('refresh_token', model?.refreshToken);
|
|
2227
|
+
log('yz.default.interceptor: use the refresh token to request a new token', model?.refreshToken);
|
|
2228
|
+
return this.http.post(`/auth/user/token/refresh?_allow_anonymous=true`, form);
|
|
2229
|
+
}
|
|
2230
|
+
tryRefreshToken(ev, req, next) {
|
|
2231
|
+
// 连刷新Token的请求都错了,那就是真错了
|
|
2232
|
+
if (['/auth/oauth/token'].some(url => req.url.includes(url))) {
|
|
2233
|
+
this.ToLogin();
|
|
2234
|
+
return throwError(ev);
|
|
2235
|
+
}
|
|
2236
|
+
// 正在刷新token,所有其他请求排队
|
|
2237
|
+
if (this.refreshToking) {
|
|
2238
|
+
return this.refreshToken$.pipe(filter(v => !!v), take(1), switchMap(() => next.handle(this.reAttachToken(req))));
|
|
2239
|
+
}
|
|
2240
|
+
//尝试调用刷新 Token
|
|
2241
|
+
this.refreshToking = true;
|
|
2242
|
+
this.refreshToken$.next(null);
|
|
2243
|
+
// 处理Token
|
|
2244
|
+
return this.refreshTokenRequest().pipe(switchMap(res => {
|
|
2245
|
+
log('yz.default.interceptor: refresh token accessed -> ', res);
|
|
2246
|
+
// 重新保存新 token
|
|
2247
|
+
const { access_token, expires_in, refresh_token, scope, token_type } = res;
|
|
2248
|
+
this.tokenSrv.set({
|
|
2249
|
+
token: access_token,
|
|
2250
|
+
expired: expires_in,
|
|
2251
|
+
refreshToken: refresh_token,
|
|
2252
|
+
tokenType: token_type,
|
|
2253
|
+
scope
|
|
2254
|
+
});
|
|
2255
|
+
// 通知后续请求继续执行
|
|
2256
|
+
this.refreshToking = false;
|
|
2257
|
+
this.refreshToken$.next(res);
|
|
2258
|
+
// 重新发起请求
|
|
2259
|
+
return next.handle(this.reAttachToken(req));
|
|
2260
|
+
}), catchError(err => {
|
|
2261
|
+
this.refreshToking = false;
|
|
2262
|
+
this.ToLogin();
|
|
2263
|
+
return throwError(err);
|
|
2264
|
+
}));
|
|
2265
|
+
}
|
|
2266
|
+
getAdditionalHeaders(headers) {
|
|
2267
|
+
const res = {};
|
|
2268
|
+
const lang = this.injector.get(YUNZAI_I18N_TOKEN).currentLang;
|
|
2269
|
+
if (!headers?.has('Accept-Language') && lang) {
|
|
2270
|
+
res['Accept-Language'] = lang;
|
|
2271
|
+
}
|
|
2272
|
+
return res;
|
|
2273
|
+
}
|
|
2274
|
+
handleData(ev, req, next) {
|
|
2275
|
+
this.checkStatus(ev);
|
|
2276
|
+
switch (ev.status) {
|
|
2277
|
+
case 200:
|
|
2278
|
+
return of(ev);
|
|
2279
|
+
case 401:
|
|
2280
|
+
if (this.config.refreshTokenEnabled && this.config.refreshTokenType === 're-request') {
|
|
2281
|
+
return this.tryRefreshToken(ev, req, next);
|
|
2282
|
+
}
|
|
2283
|
+
this.ToLogin();
|
|
2284
|
+
break;
|
|
2285
|
+
case 403:
|
|
2286
|
+
case 404:
|
|
2287
|
+
case 500:
|
|
2288
|
+
if (this.jump) {
|
|
2289
|
+
this.goTo(`/exception/${ev.status}`);
|
|
2290
|
+
}
|
|
2291
|
+
break;
|
|
2292
|
+
default:
|
|
2293
|
+
if (ev instanceof HttpErrorResponse) {
|
|
2294
|
+
console.warn('未可知错误,大部分是由于后端不支持跨域CORS或无效配置引起,请参考 https://ng.yunzainfo.com/docs/server 解决跨域问题', ev);
|
|
2295
|
+
}
|
|
2296
|
+
break;
|
|
2297
|
+
}
|
|
2298
|
+
if (ev instanceof HttpErrorResponse) {
|
|
2299
|
+
return throwError(ev);
|
|
2300
|
+
}
|
|
2301
|
+
else {
|
|
2302
|
+
return of(ev);
|
|
2303
|
+
}
|
|
2304
|
+
}
|
|
2305
|
+
intercept(req, next) {
|
|
2306
|
+
log('yz.default.interceptor.ts: ', 'request ', req);
|
|
2307
|
+
// 统一加前缀
|
|
2308
|
+
let url = req.url;
|
|
2309
|
+
if (!url.startsWith('https://') && !url.startsWith('http://')) {
|
|
2310
|
+
url = this.config.baseUrl + url;
|
|
2311
|
+
}
|
|
2312
|
+
if (url.includes('.json') && url.includes('assets')) {
|
|
2313
|
+
url = req.url;
|
|
2314
|
+
}
|
|
2315
|
+
// 加入语言头
|
|
2316
|
+
const newReq = req.clone({ url, setHeaders: this.getAdditionalHeaders(req.headers) });
|
|
2317
|
+
return next.handle(newReq).pipe(mergeMap(ev => {
|
|
2318
|
+
// 允许统一对请求错误处理
|
|
2319
|
+
if (ev instanceof HttpResponseBase) {
|
|
2320
|
+
return this.handleData(ev, newReq, next);
|
|
2321
|
+
}
|
|
2322
|
+
// 若一切都正常,则后续操作
|
|
2323
|
+
return of(ev);
|
|
2324
|
+
}), catchError((err) => this.handleData(err, newReq, next)));
|
|
2325
|
+
}
|
|
2326
|
+
}
|
|
2327
|
+
YzDefaultInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YzDefaultInterceptor, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2328
|
+
YzDefaultInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YzDefaultInterceptor });
|
|
2329
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YzDefaultInterceptor, decorators: [{
|
|
2330
|
+
type: Injectable
|
|
2331
|
+
}], ctorParameters: function () { return [{ type: i0.Injector }]; } });
|
|
2332
|
+
|
|
2333
|
+
function mapYzSideToYelonMenu(menus) {
|
|
2334
|
+
menus.forEach(menu => {
|
|
2335
|
+
menu.badgeDot = menu.badge_dot || null;
|
|
2336
|
+
menu.badgeStatus = menu.badge_status || null;
|
|
2337
|
+
menu.shortcutRoot = menu.shortcut_root || null;
|
|
2338
|
+
menu.reuse = true;
|
|
2339
|
+
if (menu.children) {
|
|
2340
|
+
mapYzSideToYelonMenu(menu.children);
|
|
2341
|
+
}
|
|
2342
|
+
});
|
|
2343
|
+
}
|
|
2344
|
+
function generateAbility(menus, abilities, prefix) {
|
|
2345
|
+
menus.forEach(menu => {
|
|
2346
|
+
if (menu.link) {
|
|
2347
|
+
prefix += menu.link;
|
|
2348
|
+
}
|
|
2349
|
+
else {
|
|
2350
|
+
prefix += '';
|
|
2351
|
+
}
|
|
2352
|
+
if (menu.menuAuths) {
|
|
2353
|
+
menu.menuAuths.forEach((a) => {
|
|
2354
|
+
abilities.push(`${prefix}:${a}`);
|
|
2355
|
+
abilities.push(a);
|
|
2356
|
+
});
|
|
2357
|
+
}
|
|
2358
|
+
if (menu.children) {
|
|
2359
|
+
generateAbility(menu.children, abilities, prefix);
|
|
2360
|
+
}
|
|
2361
|
+
});
|
|
2362
|
+
}
|
|
2363
|
+
class YzStartupService {
|
|
2364
|
+
constructor(iconSrv, menuService, i18n, settingService, aclService, titleService, yzAuthService, cacheService, configService) {
|
|
2365
|
+
this.menuService = menuService;
|
|
2366
|
+
this.i18n = i18n;
|
|
2367
|
+
this.settingService = settingService;
|
|
2368
|
+
this.aclService = aclService;
|
|
2369
|
+
this.titleService = titleService;
|
|
2370
|
+
this.yzAuthService = yzAuthService;
|
|
2371
|
+
this.cacheService = cacheService;
|
|
2372
|
+
this.configService = configService;
|
|
2373
|
+
this.bis = BUSINESS_DEFAULT_CONFIG;
|
|
2374
|
+
this.bis = mergeBisConfig(this.configService);
|
|
2375
|
+
iconSrv.addIcon(...ICONS);
|
|
2376
|
+
}
|
|
2377
|
+
load() {
|
|
2378
|
+
log$1('startup.service: ', 'load');
|
|
2379
|
+
const defaultLang = this.i18n.defaultLang;
|
|
2380
|
+
return this.i18n.loadLangData(defaultLang).pipe(mergeMap(langData => {
|
|
2381
|
+
log$1('startup.service: ', 'set i18n, defaultLang->', defaultLang, ' langData->', langData);
|
|
2382
|
+
this.i18n.use(defaultLang, langData);
|
|
2383
|
+
return of(null);
|
|
2384
|
+
}), mergeMap(() => {
|
|
2385
|
+
return this.yzAuthService.login();
|
|
2386
|
+
}), mergeMap(v => {
|
|
2387
|
+
// preloader finish
|
|
2388
|
+
this.systemInit();
|
|
2389
|
+
log$1('startup.service: preloader finish');
|
|
2390
|
+
const win = window;
|
|
2391
|
+
if (win && win.appBootstrap) {
|
|
2392
|
+
win.appBootstrap();
|
|
2393
|
+
}
|
|
2394
|
+
return of(v);
|
|
2395
|
+
}));
|
|
2396
|
+
}
|
|
2397
|
+
systemInit() {
|
|
2398
|
+
log$1('startup.service: system init');
|
|
2399
|
+
// user
|
|
2400
|
+
const user = this.cacheService.get('_yz_user', { mode: 'none' });
|
|
2401
|
+
// menu
|
|
2402
|
+
const ms = deepCopy(user.menu).filter((m) => m.systemCode && m.systemCode === this.bis.systemCode);
|
|
2403
|
+
mapYzSideToYelonMenu(ms);
|
|
2404
|
+
const currentMenu = ms.pop() || [];
|
|
2405
|
+
this.menuService.add([currentMenu]);
|
|
2406
|
+
// logo app
|
|
2407
|
+
this.settingService.setApp({ name: currentMenu.text, description: currentMenu.intro });
|
|
2408
|
+
this.settingService.setUser({
|
|
2409
|
+
name: user.realname || 'no name',
|
|
2410
|
+
avatar: `${this.bis.baseUrl}/filecenter/file/${user.avatarId}` || '',
|
|
2411
|
+
email: user.email || 'no email'
|
|
2412
|
+
});
|
|
2413
|
+
// title
|
|
2414
|
+
this.titleService.default = currentMenu && currentMenu.text ? currentMenu.text : 'default application name';
|
|
2415
|
+
this.titleService.setTitle(currentMenu && currentMenu.text ? currentMenu.text : 'no title');
|
|
2416
|
+
// acl
|
|
2417
|
+
const abilities = [];
|
|
2418
|
+
generateAbility([currentMenu], abilities, '');
|
|
2419
|
+
this.aclService.attachRole(user?.roles
|
|
2420
|
+
.map((role) => {
|
|
2421
|
+
return role.roleValue;
|
|
2422
|
+
})
|
|
2423
|
+
.filter((a) => !!a) || []);
|
|
2424
|
+
this.aclService.attachAbility(abilities);
|
|
2425
|
+
// cache current
|
|
2426
|
+
this.cacheService.set('_yz_current', {
|
|
2427
|
+
text: currentMenu.text,
|
|
2428
|
+
intro: currentMenu.intro,
|
|
2429
|
+
icon: currentMenu.appIconUrl
|
|
2430
|
+
});
|
|
2431
|
+
}
|
|
2432
|
+
}
|
|
2433
|
+
YzStartupService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YzStartupService, deps: [{ token: i9.NzIconService }, { token: i1.MenuService }, { token: YUNZAI_I18N_TOKEN }, { token: i1.SettingsService }, { token: i3$5.ACLService }, { token: i1.TitleService }, { token: YzAuthService }, { token: i2$1.CacheService }, { token: i1$2.YunzaiConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2434
|
+
YzStartupService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YzStartupService });
|
|
2435
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: YzStartupService, decorators: [{
|
|
2436
|
+
type: Injectable
|
|
2437
|
+
}], ctorParameters: function () { return [{ type: i9.NzIconService }, { type: i1.MenuService }, { type: YzI18NService, decorators: [{
|
|
2438
|
+
type: Inject,
|
|
2439
|
+
args: [YUNZAI_I18N_TOKEN]
|
|
2440
|
+
}] }, { type: i1.SettingsService }, { type: i3$5.ACLService }, { type: i1.TitleService }, { type: YzAuthService }, { type: i2$1.CacheService }, { type: i1$2.YunzaiConfigService }]; } });
|
|
2441
|
+
function YzStartupServiceFactory(startupService) {
|
|
2442
|
+
return () => startupService.load();
|
|
2443
|
+
}
|
|
2444
|
+
//@ts-ignore
|
|
2445
|
+
const YZ_APPINIT_PROVIDES = [
|
|
2446
|
+
YzStartupService,
|
|
2447
|
+
{
|
|
2448
|
+
provide: APP_INITIALIZER,
|
|
2449
|
+
useFactory: YzStartupServiceFactory,
|
|
2450
|
+
deps: [YzStartupService],
|
|
2451
|
+
multi: true
|
|
2452
|
+
}
|
|
2453
|
+
];
|
|
2454
|
+
|
|
2455
|
+
class PathToRegexpService {
|
|
2456
|
+
constructor() {
|
|
2457
|
+
this.DEFAULT_DELIMITER = '/';
|
|
2458
|
+
this.PATH_REGEXP = new RegExp(['(\\\\.)', '(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?'].join('|'), 'g');
|
|
2459
|
+
}
|
|
2460
|
+
parse(str, options) {
|
|
2461
|
+
const tokens = [];
|
|
2462
|
+
let key = 0;
|
|
2463
|
+
let index = 0;
|
|
2464
|
+
let path = '';
|
|
2465
|
+
const defaultDelimiter = (options && options.delimiter) || this.DEFAULT_DELIMITER;
|
|
2466
|
+
const whitelist = (options && options.whitelist) || undefined;
|
|
2467
|
+
let pathEscaped = false;
|
|
2468
|
+
let res;
|
|
2469
|
+
while ((res = this.PATH_REGEXP.exec(str)) !== null) {
|
|
2470
|
+
const m = res[0];
|
|
2471
|
+
const escaped = res[1];
|
|
2472
|
+
const offset = res.index;
|
|
2473
|
+
path += str.slice(index, offset);
|
|
2474
|
+
index = offset + m.length;
|
|
2475
|
+
// Ignore already escaped sequences.
|
|
2476
|
+
if (escaped) {
|
|
2477
|
+
path += escaped[1];
|
|
2478
|
+
pathEscaped = true;
|
|
2479
|
+
continue;
|
|
2480
|
+
}
|
|
2481
|
+
let prev = '';
|
|
2482
|
+
const name = res[2];
|
|
2483
|
+
const capture = res[3];
|
|
2484
|
+
const group = res[4];
|
|
2485
|
+
const modifier = res[5];
|
|
2486
|
+
if (!pathEscaped && path.length) {
|
|
2487
|
+
const k = path.length - 1;
|
|
2488
|
+
const c = path[k];
|
|
2489
|
+
const matches = whitelist ? whitelist.indexOf(c) > -1 : true;
|
|
2490
|
+
if (matches) {
|
|
2491
|
+
prev = c;
|
|
2492
|
+
path = path.slice(0, k);
|
|
2493
|
+
}
|
|
2494
|
+
}
|
|
2495
|
+
// Push the current path onto the tokens.
|
|
2496
|
+
if (path) {
|
|
2497
|
+
tokens.push(path);
|
|
2498
|
+
path = '';
|
|
2499
|
+
pathEscaped = false;
|
|
2500
|
+
}
|
|
2501
|
+
const repeat = modifier === '+' || modifier === '*';
|
|
2502
|
+
const optional = modifier === '?' || modifier === '*';
|
|
2503
|
+
const pattern = capture || group;
|
|
2504
|
+
const delimiter = prev || defaultDelimiter;
|
|
2505
|
+
tokens.push({
|
|
2506
|
+
name: name || key++,
|
|
2507
|
+
prefix: prev,
|
|
2508
|
+
delimiter: delimiter,
|
|
2509
|
+
optional: optional,
|
|
2510
|
+
repeat: repeat,
|
|
2511
|
+
pattern: pattern
|
|
2512
|
+
? this.escapeGroup(pattern)
|
|
2513
|
+
: `[^${this.escapeString(delimiter === defaultDelimiter ? delimiter : delimiter + defaultDelimiter)}]+?`
|
|
2514
|
+
});
|
|
2515
|
+
}
|
|
2516
|
+
// Push any remaining characters.
|
|
2517
|
+
if (path || index < str.length) {
|
|
2518
|
+
tokens.push(path + str.substr(index));
|
|
2519
|
+
}
|
|
2520
|
+
return tokens;
|
|
2521
|
+
}
|
|
2522
|
+
compile(str, options) {
|
|
2523
|
+
return this.tokensToFunction(this.parse(str, options), options);
|
|
2524
|
+
}
|
|
2525
|
+
tokensToFunction(tokens, options) {
|
|
2526
|
+
const matches = new Array(tokens.length);
|
|
2527
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
2528
|
+
if (typeof tokens[i] === 'object') {
|
|
2529
|
+
matches[i] = new RegExp(`^(?:${tokens[i].pattern})$`, this.flags(options));
|
|
2530
|
+
}
|
|
2531
|
+
}
|
|
2532
|
+
return function (data, options) {
|
|
2533
|
+
let path = '';
|
|
2534
|
+
const encode = (options && options.encode) || encodeURIComponent;
|
|
2535
|
+
const validate = options ? options.validate !== false : true;
|
|
2536
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
2537
|
+
const token = tokens[i];
|
|
2538
|
+
if (typeof token === 'string') {
|
|
2539
|
+
path += token;
|
|
2540
|
+
continue;
|
|
2541
|
+
}
|
|
2542
|
+
const value = data ? data[token.name] : undefined;
|
|
2543
|
+
let segment;
|
|
2544
|
+
if (Array.isArray(value)) {
|
|
2545
|
+
if (!token.repeat) {
|
|
2546
|
+
throw new TypeError(`Expected "${token.name}" to not repeat, but got array`);
|
|
2547
|
+
}
|
|
2548
|
+
if (value.length === 0) {
|
|
2549
|
+
if (token.optional) {
|
|
2550
|
+
continue;
|
|
2551
|
+
}
|
|
2552
|
+
throw new TypeError(`Expected "${token.name}" to not be empty`);
|
|
2553
|
+
}
|
|
2554
|
+
for (let j = 0; j < value.length; j++) {
|
|
2555
|
+
segment = encode(value[j], token);
|
|
2556
|
+
if (validate && !matches[i].test(segment)) {
|
|
2557
|
+
throw new TypeError(`Expected all "${token.name}" to match "${token.pattern}"`);
|
|
2558
|
+
}
|
|
2559
|
+
path += (j === 0 ? token.prefix : token.delimiter) + segment;
|
|
2560
|
+
}
|
|
2561
|
+
continue;
|
|
2562
|
+
}
|
|
2563
|
+
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
|
2564
|
+
segment = encode(String(value), token);
|
|
2565
|
+
if (validate && !matches[i].test(segment)) {
|
|
2566
|
+
throw new TypeError(`Expected "${token.name}" to match "${token.pattern}", but got "${segment}"`);
|
|
2567
|
+
}
|
|
2568
|
+
path += token.prefix + segment;
|
|
2569
|
+
continue;
|
|
2570
|
+
}
|
|
2571
|
+
if (token.optional) {
|
|
2572
|
+
continue;
|
|
2573
|
+
}
|
|
2574
|
+
throw new TypeError(`Expected "${token.name}" to be ${token.repeat ? 'an array' : 'a string'}`);
|
|
2575
|
+
}
|
|
2576
|
+
return path;
|
|
2577
|
+
};
|
|
2578
|
+
}
|
|
2579
|
+
escapeString(str) {
|
|
2580
|
+
return str.replace(/([.+*?=^!:${}()[\]|/\\])/g, '\\$1');
|
|
2581
|
+
}
|
|
2582
|
+
escapeGroup(group) {
|
|
2583
|
+
return group.replace(/([=!:$/()])/g, '\\$1');
|
|
2584
|
+
}
|
|
2585
|
+
flags(options) {
|
|
2586
|
+
return options && options.sensitive ? '' : 'i';
|
|
2587
|
+
}
|
|
2588
|
+
regexpToRegexp(path, keys) {
|
|
2589
|
+
if (!keys) {
|
|
2590
|
+
return path;
|
|
2591
|
+
}
|
|
2592
|
+
const groups = path.source.match(/\((?!\?)/g);
|
|
2593
|
+
if (groups) {
|
|
2594
|
+
for (let i = 0; i < groups.length; i++) {
|
|
2595
|
+
keys.push({
|
|
2596
|
+
name: i,
|
|
2597
|
+
prefix: null,
|
|
2598
|
+
delimiter: null,
|
|
2599
|
+
optional: false,
|
|
2600
|
+
repeat: false,
|
|
2601
|
+
pattern: null
|
|
2602
|
+
});
|
|
2603
|
+
}
|
|
2604
|
+
}
|
|
2605
|
+
return path;
|
|
2606
|
+
}
|
|
2607
|
+
arrayToRegexp(path, keys, options) {
|
|
2608
|
+
const parts = [];
|
|
2609
|
+
for (let i = 0; i < path.length; i++) {
|
|
2610
|
+
parts.push(this.pathToRegexp(path[i], keys, options).source);
|
|
2611
|
+
}
|
|
2612
|
+
return new RegExp(`(?:${parts.join('|')})`, this.flags(options));
|
|
2613
|
+
}
|
|
2614
|
+
stringToRegexp(path, keys, options) {
|
|
2615
|
+
return this.tokensToRegExp(this.parse(path, options), keys, options);
|
|
2616
|
+
}
|
|
2617
|
+
tokensToRegExp(tokens, keys, options) {
|
|
2618
|
+
options = options || {};
|
|
2619
|
+
const strict = options.strict;
|
|
2620
|
+
const start = options.start !== false;
|
|
2621
|
+
const end = options.end !== false;
|
|
2622
|
+
const delimiter = options.delimiter || this.DEFAULT_DELIMITER;
|
|
2623
|
+
const endsWith = []
|
|
2624
|
+
.concat(options.endsWith || [])
|
|
2625
|
+
.map(this.escapeString)
|
|
2626
|
+
.concat('$')
|
|
2627
|
+
.join('|');
|
|
2628
|
+
let route = start ? '^' : '';
|
|
2629
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
2630
|
+
const token = tokens[i];
|
|
2631
|
+
if (typeof token === 'string') {
|
|
2632
|
+
route += this.escapeString(token);
|
|
2633
|
+
}
|
|
2634
|
+
else {
|
|
2635
|
+
const capture = token.repeat
|
|
2636
|
+
? `(?:${token.pattern})(?:${this.escapeString(token.delimiter)}(?:${token.pattern}))*`
|
|
2637
|
+
: token.pattern;
|
|
2638
|
+
if (keys) {
|
|
2639
|
+
keys.push(token);
|
|
2640
|
+
}
|
|
2641
|
+
if (token.optional) {
|
|
2642
|
+
if (!token.prefix) {
|
|
2643
|
+
route += `(${capture})?`;
|
|
2644
|
+
}
|
|
2645
|
+
else {
|
|
2646
|
+
route += `(?:${this.escapeString(token.prefix)}(${capture}))?`;
|
|
2647
|
+
}
|
|
2648
|
+
}
|
|
2649
|
+
else {
|
|
2650
|
+
route += `${this.escapeString(token.prefix)}(${capture})`;
|
|
2651
|
+
}
|
|
2652
|
+
}
|
|
2653
|
+
}
|
|
2654
|
+
if (end) {
|
|
2655
|
+
if (!strict) {
|
|
2656
|
+
route += `(?:${this.escapeString(delimiter)})?`;
|
|
2657
|
+
}
|
|
2658
|
+
route += endsWith === '$' ? '$' : `(?=${endsWith})`;
|
|
2659
|
+
}
|
|
2660
|
+
else {
|
|
2661
|
+
const endToken = tokens[tokens.length - 1];
|
|
2662
|
+
const isEndDelimited = typeof endToken === 'string' ? endToken[endToken.length - 1] === delimiter : endToken === undefined;
|
|
2663
|
+
if (!strict) {
|
|
2664
|
+
route += `(?:${this.escapeString(delimiter)}(?=${endsWith}))?`;
|
|
2665
|
+
}
|
|
2666
|
+
if (!isEndDelimited) {
|
|
2667
|
+
route += `(?=${this.escapeString(delimiter)}|${endsWith})`;
|
|
2668
|
+
}
|
|
2669
|
+
}
|
|
2670
|
+
return new RegExp(route, this.flags(options));
|
|
2671
|
+
}
|
|
2672
|
+
pathToRegexp(path, keys, options) {
|
|
2673
|
+
if (path instanceof RegExp) {
|
|
2674
|
+
return this.regexpToRegexp(path, keys);
|
|
2675
|
+
}
|
|
2676
|
+
if (Array.isArray(path)) {
|
|
2677
|
+
return this.arrayToRegexp(/** @type {!Array} */ path, keys, options);
|
|
2678
|
+
}
|
|
2679
|
+
return this.stringToRegexp(/** @type {string} */ path, keys, options);
|
|
2680
|
+
}
|
|
2681
|
+
}
|
|
2682
|
+
PathToRegexpService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: PathToRegexpService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2683
|
+
PathToRegexpService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: PathToRegexpService, providedIn: 'root' });
|
|
2684
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: PathToRegexpService, decorators: [{
|
|
2685
|
+
type: Injectable,
|
|
2686
|
+
args: [{
|
|
2687
|
+
providedIn: 'root'
|
|
2688
|
+
}]
|
|
2689
|
+
}], ctorParameters: function () { return []; } });
|
|
2690
|
+
|
|
2691
|
+
class ActGuard {
|
|
2692
|
+
constructor(configService, cacheService, pathToRegexp, router) {
|
|
2693
|
+
this.configService = configService;
|
|
2694
|
+
this.cacheService = cacheService;
|
|
2695
|
+
this.pathToRegexp = pathToRegexp;
|
|
2696
|
+
this.router = router;
|
|
2697
|
+
this.bis = BUSINESS_DEFAULT_CONFIG;
|
|
2698
|
+
this.menus = [];
|
|
2699
|
+
this.links = [];
|
|
2700
|
+
log$1('act: ');
|
|
2701
|
+
this.bis = mergeBisConfig(this.configService);
|
|
2702
|
+
log$1('act: config ', this.bis);
|
|
2703
|
+
const user = this.cacheService.get('_yz_user', { mode: 'none' });
|
|
2704
|
+
log$1('act: user ', user);
|
|
2705
|
+
this.menus = deepCopy(user.menu).filter((m) => m.systemCode && m.systemCode === this.bis.systemCode);
|
|
2706
|
+
log$1('act: menus ', this.menus);
|
|
2707
|
+
this.getAllLinks(this.menus, this.links);
|
|
2708
|
+
log$1('act: links ', this.links);
|
|
2709
|
+
}
|
|
2710
|
+
canActivate(_, state) {
|
|
2711
|
+
log$1('act: can activate ', state);
|
|
2712
|
+
if (this.preHandle(state)) {
|
|
2713
|
+
return true;
|
|
2714
|
+
}
|
|
2715
|
+
log$1('act: can activate child prehandle success');
|
|
2716
|
+
let canactivate = false;
|
|
2717
|
+
this.links.forEach((link) => {
|
|
2718
|
+
const regexp = this.pathToRegexp.stringToRegexp(link, null, null);
|
|
2719
|
+
log$1(`act: ${link} test ${state.url.split('?')[0]}`);
|
|
2720
|
+
if (regexp.test(state.url.split('?')[0])) {
|
|
2721
|
+
canactivate = true;
|
|
2722
|
+
log$1(`act: test value ${canactivate}`);
|
|
2723
|
+
return;
|
|
2724
|
+
}
|
|
2725
|
+
});
|
|
2726
|
+
if (canactivate) {
|
|
2727
|
+
log$1(`act: test sucess`);
|
|
2728
|
+
return true;
|
|
2729
|
+
}
|
|
2730
|
+
else {
|
|
2731
|
+
log$1(`act: test error`);
|
|
2732
|
+
this.router.navigate(['displayIndex']);
|
|
2733
|
+
return false;
|
|
2734
|
+
}
|
|
2735
|
+
}
|
|
2736
|
+
canActivateChild(_, state) {
|
|
2737
|
+
log$1('act: can activate child ', state);
|
|
2738
|
+
if (this.preHandle(state)) {
|
|
2739
|
+
return true;
|
|
2740
|
+
}
|
|
2741
|
+
log$1('act: can activate child prehandle success');
|
|
2742
|
+
let canactivate = false;
|
|
2743
|
+
this.links.forEach((link) => {
|
|
2744
|
+
const regexp = this.pathToRegexp.stringToRegexp(link, null, null);
|
|
2745
|
+
if (regexp.test(state.url.split('?')[0])) {
|
|
2746
|
+
log$1(`act: ${link} test ${state.url.split('?')[0]}`);
|
|
2747
|
+
canactivate = true;
|
|
2748
|
+
log$1(`act: test value ${canactivate}`);
|
|
2749
|
+
return;
|
|
2750
|
+
}
|
|
2751
|
+
});
|
|
2752
|
+
if (canactivate) {
|
|
2753
|
+
log$1(`act: test sucess`);
|
|
2754
|
+
return true;
|
|
2755
|
+
}
|
|
2756
|
+
else {
|
|
2757
|
+
log$1(`act: test error`);
|
|
2758
|
+
this.router.navigate(['displayIndex']);
|
|
2759
|
+
return false;
|
|
2760
|
+
}
|
|
2761
|
+
}
|
|
2762
|
+
preHandle(state) {
|
|
2763
|
+
return (state.url.includes('error') ||
|
|
2764
|
+
state.url.includes('exception') ||
|
|
2765
|
+
state.url.includes('displayIndex') ||
|
|
2766
|
+
state.url === '' ||
|
|
2767
|
+
state.url === null ||
|
|
2768
|
+
state.url === '/' ||
|
|
2769
|
+
state.url.includes('iframePage'));
|
|
2770
|
+
}
|
|
2771
|
+
getAllLinks(menu, links) {
|
|
2772
|
+
menu.forEach((sider) => {
|
|
2773
|
+
if (sider.link) {
|
|
2774
|
+
links.push(sider.link);
|
|
2775
|
+
}
|
|
2776
|
+
if (sider.children && sider.children.length > 0) {
|
|
2777
|
+
this.getAllLinks(sider.children, links);
|
|
2778
|
+
}
|
|
2779
|
+
});
|
|
2780
|
+
}
|
|
2781
|
+
}
|
|
2782
|
+
ActGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ActGuard, deps: [{ token: i1$2.YunzaiConfigService }, { token: i2$1.CacheService }, { token: PathToRegexpService }, { token: i17.Router }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2783
|
+
ActGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ActGuard, providedIn: 'root' });
|
|
2784
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ActGuard, decorators: [{
|
|
2785
|
+
type: Injectable,
|
|
2786
|
+
args: [{
|
|
2787
|
+
providedIn: 'root'
|
|
2788
|
+
}]
|
|
2789
|
+
}], ctorParameters: function () { return [{ type: i1$2.YunzaiConfigService }, { type: i2$1.CacheService }, { type: PathToRegexpService }, { type: i17.Router }]; } });
|
|
2790
|
+
|
|
2791
|
+
/**
|
|
2792
|
+
* Generated bundle index. Do not edit.
|
|
2793
|
+
*/
|
|
2794
|
+
|
|
2795
|
+
export { ActGuard, BUSINESS_DEFAULT_CONFIG, ContactComponent, ContactService, 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 };
|
|
2796
|
+
//# sourceMappingURL=layout.mjs.map
|