@reskin/core 0.0.1

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.
Files changed (218) hide show
  1. package/README.md +25 -0
  2. package/bundles/reskin-core-classes.umd.js +48 -0
  3. package/bundles/reskin-core-classes.umd.js.map +1 -0
  4. package/bundles/reskin-core-directives.umd.js +147 -0
  5. package/bundles/reskin-core-directives.umd.js.map +1 -0
  6. package/bundles/reskin-core-entity-dictionary.umd.js +11 -0
  7. package/bundles/reskin-core-entity-dictionary.umd.js.map +1 -0
  8. package/bundles/reskin-core-entity-field.umd.js +49 -0
  9. package/bundles/reskin-core-entity-field.umd.js.map +1 -0
  10. package/bundles/reskin-core-entity-file.umd.js +11 -0
  11. package/bundles/reskin-core-entity-file.umd.js.map +1 -0
  12. package/bundles/reskin-core-entity-menu.umd.js +40 -0
  13. package/bundles/reskin-core-entity-menu.umd.js.map +1 -0
  14. package/bundles/reskin-core-entity-org.umd.js +50 -0
  15. package/bundles/reskin-core-entity-org.umd.js.map +1 -0
  16. package/bundles/reskin-core-entity-scheme.umd.js +63 -0
  17. package/bundles/reskin-core-entity-scheme.umd.js.map +1 -0
  18. package/bundles/reskin-core-entity-user.umd.js +11 -0
  19. package/bundles/reskin-core-entity-user.umd.js.map +1 -0
  20. package/bundles/reskin-core-entity.umd.js +11 -0
  21. package/bundles/reskin-core-entity.umd.js.map +1 -0
  22. package/bundles/reskin-core-guards.umd.js +89 -0
  23. package/bundles/reskin-core-guards.umd.js.map +1 -0
  24. package/bundles/reskin-core-interceptors.umd.js +702 -0
  25. package/bundles/reskin-core-interceptors.umd.js.map +1 -0
  26. package/bundles/reskin-core-services.umd.js +1188 -0
  27. package/bundles/reskin-core-services.umd.js.map +1 -0
  28. package/bundles/reskin-core-utils.umd.js +130 -0
  29. package/bundles/reskin-core-utils.umd.js.map +1 -0
  30. package/bundles/reskin-core.umd.js +13 -0
  31. package/bundles/reskin-core.umd.js.map +1 -0
  32. package/classes/package.json +10 -0
  33. package/classes/public-api.d.ts +1 -0
  34. package/classes/reskin-core-classes.d.ts +5 -0
  35. package/classes/table.helper.d.ts +23 -0
  36. package/directives/auth.directive.d.ts +27 -0
  37. package/directives/directives.module.d.ts +7 -0
  38. package/directives/package.json +10 -0
  39. package/directives/public-api.d.ts +2 -0
  40. package/directives/reskin-core-directives.d.ts +5 -0
  41. package/entity/Env.d.ts +66 -0
  42. package/entity/IPage.d.ts +35 -0
  43. package/entity/R.d.ts +25 -0
  44. package/entity/WC.d.ts +51 -0
  45. package/entity/dictionary/IDictionaryBaseInfo.d.ts +29 -0
  46. package/entity/dictionary/IDictionaryItem.d.ts +50 -0
  47. package/entity/dictionary/package.json +10 -0
  48. package/entity/dictionary/public-api.d.ts +2 -0
  49. package/entity/dictionary/reskin-core-entity-dictionary.d.ts +5 -0
  50. package/entity/field/ColumnTypeEnum.d.ts +33 -0
  51. package/entity/field/ITableField.d.ts +27 -0
  52. package/entity/field/package.json +10 -0
  53. package/entity/field/public-api.d.ts +2 -0
  54. package/entity/field/reskin-core-entity-field.d.ts +5 -0
  55. package/entity/file/IUploadFileData.d.ts +25 -0
  56. package/entity/file/package.json +10 -0
  57. package/entity/file/public-api.d.ts +1 -0
  58. package/entity/file/reskin-core-entity-file.d.ts +5 -0
  59. package/entity/menu/IMenu.d.ts +57 -0
  60. package/entity/menu/MenuTypeEnum.d.ts +24 -0
  61. package/entity/menu/package.json +10 -0
  62. package/entity/menu/public-api.d.ts +2 -0
  63. package/entity/menu/reskin-core-entity-menu.d.ts +5 -0
  64. package/entity/org/IOrgTreeNode.d.ts +58 -0
  65. package/entity/org/OrgTypeEnum.d.ts +31 -0
  66. package/entity/org/package.json +10 -0
  67. package/entity/org/public-api.d.ts +2 -0
  68. package/entity/org/reskin-core-entity-org.d.ts +5 -0
  69. package/entity/package.json +10 -0
  70. package/entity/public-api.d.ts +4 -0
  71. package/entity/reskin-core-entity.d.ts +5 -0
  72. package/entity/scheme/IFieldScheme.d.ts +97 -0
  73. package/entity/scheme/IScheme.d.ts +200 -0
  74. package/entity/scheme/SchemeEditTypeEnum.d.ts +25 -0
  75. package/entity/scheme/package.json +10 -0
  76. package/entity/scheme/public-api.d.ts +3 -0
  77. package/entity/scheme/reskin-core-entity-scheme.d.ts +5 -0
  78. package/entity/user/IAuth.d.ts +13 -0
  79. package/entity/user/IAuthAccount.d.ts +126 -0
  80. package/entity/user/package.json +10 -0
  81. package/entity/user/public-api.d.ts +2 -0
  82. package/entity/user/reskin-core-entity-user.d.ts +5 -0
  83. package/esm2015/classes/public-api.js +2 -0
  84. package/esm2015/classes/reskin-core-classes.js +5 -0
  85. package/esm2015/classes/table.helper.js +32 -0
  86. package/esm2015/directives/auth.directive.js +83 -0
  87. package/esm2015/directives/directives.module.js +16 -0
  88. package/esm2015/directives/public-api.js +3 -0
  89. package/esm2015/directives/reskin-core-directives.js +5 -0
  90. package/esm2015/entity/Env.js +2 -0
  91. package/esm2015/entity/IPage.js +2 -0
  92. package/esm2015/entity/R.js +2 -0
  93. package/esm2015/entity/WC.js +2 -0
  94. package/esm2015/entity/dictionary/IDictionaryBaseInfo.js +2 -0
  95. package/esm2015/entity/dictionary/IDictionaryItem.js +2 -0
  96. package/esm2015/entity/dictionary/public-api.js +3 -0
  97. package/esm2015/entity/dictionary/reskin-core-entity-dictionary.js +5 -0
  98. package/esm2015/entity/field/ColumnTypeEnum.js +35 -0
  99. package/esm2015/entity/field/ITableField.js +2 -0
  100. package/esm2015/entity/field/public-api.js +3 -0
  101. package/esm2015/entity/field/reskin-core-entity-field.js +5 -0
  102. package/esm2015/entity/file/IUploadFileData.js +2 -0
  103. package/esm2015/entity/file/public-api.js +2 -0
  104. package/esm2015/entity/file/reskin-core-entity-file.js +5 -0
  105. package/esm2015/entity/menu/IMenu.js +2 -0
  106. package/esm2015/entity/menu/MenuTypeEnum.js +26 -0
  107. package/esm2015/entity/menu/public-api.js +3 -0
  108. package/esm2015/entity/menu/reskin-core-entity-menu.js +5 -0
  109. package/esm2015/entity/org/IOrgTreeNode.js +2 -0
  110. package/esm2015/entity/org/OrgTypeEnum.js +33 -0
  111. package/esm2015/entity/org/public-api.js +3 -0
  112. package/esm2015/entity/org/reskin-core-entity-org.js +5 -0
  113. package/esm2015/entity/public-api.js +5 -0
  114. package/esm2015/entity/reskin-core-entity.js +5 -0
  115. package/esm2015/entity/scheme/IFieldScheme.js +2 -0
  116. package/esm2015/entity/scheme/IScheme.js +22 -0
  117. package/esm2015/entity/scheme/SchemeEditTypeEnum.js +27 -0
  118. package/esm2015/entity/scheme/public-api.js +4 -0
  119. package/esm2015/entity/scheme/reskin-core-entity-scheme.js +5 -0
  120. package/esm2015/entity/user/IAuth.js +2 -0
  121. package/esm2015/entity/user/IAuthAccount.js +2 -0
  122. package/esm2015/entity/user/public-api.js +3 -0
  123. package/esm2015/entity/user/reskin-core-entity-user.js +5 -0
  124. package/esm2015/guards/auth.guard.js +53 -0
  125. package/esm2015/guards/public-api.js +2 -0
  126. package/esm2015/guards/reskin-core-guards.js +5 -0
  127. package/esm2015/interceptors/blob.interceptor.js +66 -0
  128. package/esm2015/interceptors/cache.interceptor.js +36 -0
  129. package/esm2015/interceptors/error.interceptor.js +35 -0
  130. package/esm2015/interceptors/public-api.js +5 -0
  131. package/esm2015/interceptors/reskin-core-interceptors.js +5 -0
  132. package/esm2015/interceptors/token.interceptor.js +48 -0
  133. package/esm2015/public-api.js +2 -0
  134. package/esm2015/reskin-core.js +5 -0
  135. package/esm2015/services/account.service.js +58 -0
  136. package/esm2015/services/app.config.js +60 -0
  137. package/esm2015/services/auth.service.js +56 -0
  138. package/esm2015/services/cache.http.service.js +58 -0
  139. package/esm2015/services/destroy.service.js +15 -0
  140. package/esm2015/services/dictionary.service.js +107 -0
  141. package/esm2015/services/down.file.service.js +79 -0
  142. package/esm2015/services/field.scheme.service.js +37 -0
  143. package/esm2015/services/file.service.js +57 -0
  144. package/esm2015/services/menu.service.js +36 -0
  145. package/esm2015/services/org.service.js +46 -0
  146. package/esm2015/services/public-api.js +13 -0
  147. package/esm2015/services/reskin-core-services.js +5 -0
  148. package/esm2015/services/scheme.service.js +37 -0
  149. package/esm2015/utils/array.js +29 -0
  150. package/esm2015/utils/dom.js +18 -0
  151. package/esm2015/utils/public-api.js +4 -0
  152. package/esm2015/utils/reskin-core-utils.js +5 -0
  153. package/esm2015/utils/store.js +64 -0
  154. package/fesm2015/reskin-core-classes.js +39 -0
  155. package/fesm2015/reskin-core-classes.js.map +1 -0
  156. package/fesm2015/reskin-core-directives.js +103 -0
  157. package/fesm2015/reskin-core-directives.js.map +1 -0
  158. package/fesm2015/reskin-core-entity-dictionary.js +4 -0
  159. package/fesm2015/reskin-core-entity-dictionary.js.map +1 -0
  160. package/fesm2015/reskin-core-entity-field.js +41 -0
  161. package/fesm2015/reskin-core-entity-field.js.map +1 -0
  162. package/fesm2015/reskin-core-entity-file.js +4 -0
  163. package/fesm2015/reskin-core-entity-file.js.map +1 -0
  164. package/fesm2015/reskin-core-entity-menu.js +32 -0
  165. package/fesm2015/reskin-core-entity-menu.js.map +1 -0
  166. package/fesm2015/reskin-core-entity-org.js +39 -0
  167. package/fesm2015/reskin-core-entity-org.js.map +1 -0
  168. package/fesm2015/reskin-core-entity-scheme.js +55 -0
  169. package/fesm2015/reskin-core-entity-scheme.js.map +1 -0
  170. package/fesm2015/reskin-core-entity-user.js +4 -0
  171. package/fesm2015/reskin-core-entity-user.js.map +1 -0
  172. package/fesm2015/reskin-core-entity.js +4 -0
  173. package/fesm2015/reskin-core-entity.js.map +1 -0
  174. package/fesm2015/reskin-core-guards.js +60 -0
  175. package/fesm2015/reskin-core-guards.js.map +1 -0
  176. package/fesm2015/reskin-core-interceptors.js +179 -0
  177. package/fesm2015/reskin-core-interceptors.js.map +1 -0
  178. package/fesm2015/reskin-core-services.js +605 -0
  179. package/fesm2015/reskin-core-services.js.map +1 -0
  180. package/fesm2015/reskin-core-utils.js +118 -0
  181. package/fesm2015/reskin-core-utils.js.map +1 -0
  182. package/fesm2015/reskin-core.js +6 -0
  183. package/fesm2015/reskin-core.js.map +1 -0
  184. package/guards/auth.guard.d.ts +15 -0
  185. package/guards/package.json +10 -0
  186. package/guards/public-api.d.ts +1 -0
  187. package/guards/reskin-core-guards.d.ts +5 -0
  188. package/interceptors/blob.interceptor.d.ts +20 -0
  189. package/interceptors/cache.interceptor.d.ts +19 -0
  190. package/interceptors/error.interceptor.d.ts +19 -0
  191. package/interceptors/package.json +10 -0
  192. package/interceptors/public-api.d.ts +4 -0
  193. package/interceptors/reskin-core-interceptors.d.ts +5 -0
  194. package/interceptors/token.interceptor.d.ts +28 -0
  195. package/package.json +22 -0
  196. package/public-api.d.ts +2 -0
  197. package/reskin-core.d.ts +5 -0
  198. package/services/account.service.d.ts +33 -0
  199. package/services/app.config.d.ts +40 -0
  200. package/services/auth.service.d.ts +26 -0
  201. package/services/cache.http.service.d.ts +37 -0
  202. package/services/destroy.service.d.ts +8 -0
  203. package/services/dictionary.service.d.ts +57 -0
  204. package/services/down.file.service.d.ts +29 -0
  205. package/services/field.scheme.service.d.ts +17 -0
  206. package/services/file.service.d.ts +33 -0
  207. package/services/menu.service.d.ts +16 -0
  208. package/services/org.service.d.ts +31 -0
  209. package/services/package.json +10 -0
  210. package/services/public-api.d.ts +12 -0
  211. package/services/reskin-core-services.d.ts +5 -0
  212. package/services/scheme.service.d.ts +17 -0
  213. package/utils/array.d.ts +5 -0
  214. package/utils/dom.d.ts +6 -0
  215. package/utils/package.json +10 -0
  216. package/utils/public-api.d.ts +3 -0
  217. package/utils/reskin-core-utils.d.ts +5 -0
  218. package/utils/store.d.ts +42 -0
@@ -0,0 +1,605 @@
1
+ import { __awaiter } from 'tslib';
2
+ import * as i0 from '@angular/core';
3
+ import { InjectionToken, Injectable, Inject, APP_INITIALIZER } from '@angular/core';
4
+ import * as i1 from '@angular/platform-browser';
5
+ import * as i1$1 from '@angular/common/http';
6
+ import { HttpHeaders } from '@angular/common/http';
7
+ import { tap, filter, map } from 'rxjs/operators';
8
+ import { Store } from '@reskin/core/utils';
9
+ import { Subject } from 'rxjs';
10
+
11
+ /**
12
+ * 项目环境变量配置 Token
13
+ */
14
+ const RK_ENVIRONMENT = new InjectionToken('environment');
15
+ class AppConfig {
16
+ constructor(env, title) {
17
+ this.env = env;
18
+ this.title = title;
19
+ }
20
+ /**
21
+ * 加载配置
22
+ */
23
+ onLoad() {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ const url = `api/gl-service-sys-core/v1/core/system/parameter/getOneByCode/${this.env.config.PROJECT_CONFIG_KEY}`;
26
+ const response = yield fetch(url);
27
+ const json = yield response.json();
28
+ if (json.code !== 0) {
29
+ throw new Error(json.msg);
30
+ }
31
+ const config = json.data.SYSTEM_PARAMETER_VALUE && JSON.parse(json.data.SYSTEM_PARAMETER_VALUE);
32
+ config.production = config.production === 'true';
33
+ AppConfig.settings = config;
34
+ this.title.setTitle(config.insights.PROJECT_NAME);
35
+ return config;
36
+ });
37
+ }
38
+ }
39
+ AppConfig.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: AppConfig, deps: [{ token: RK_ENVIRONMENT }, { token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
40
+ AppConfig.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: AppConfig, providedIn: 'root' });
41
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: AppConfig, decorators: [{
42
+ type: Injectable,
43
+ args: [{
44
+ providedIn: 'root',
45
+ }]
46
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
47
+ type: Inject,
48
+ args: [RK_ENVIRONMENT]
49
+ }] }, { type: i1.Title }]; } });
50
+ /**
51
+ * 项目初始化配置
52
+ * @param environment
53
+ */
54
+ function providerAppConfig(environment) {
55
+ return [
56
+ { provide: RK_ENVIRONMENT, useValue: environment },
57
+ AppConfig,
58
+ {
59
+ provide: APP_INITIALIZER,
60
+ useFactory: (appConfig) => () => appConfig.onLoad(),
61
+ deps: [AppConfig],
62
+ multi: true,
63
+ },
64
+ ];
65
+ }
66
+
67
+ class RkAuthService {
68
+ constructor(env, http) {
69
+ this.env = env;
70
+ this.http = http;
71
+ this.auth = new Store('auth', {});
72
+ }
73
+ /**
74
+ * 系统登录
75
+ * @param data 验证信息
76
+ * @returns
77
+ */
78
+ onLogin(data) {
79
+ const url = 'api/gl-service-sys-user/v1/user/system/auth/login';
80
+ const headers = new HttpHeaders({
81
+ 'ProjectNo': this.env.config.PROJECT_TYPE,
82
+ 'Token-Control': 'no-token',
83
+ });
84
+ return this.http.post(url, { data }, { headers }).pipe(tap((json) => {
85
+ if (json.code === 0) {
86
+ this.auth.set(json.data);
87
+ }
88
+ }));
89
+ }
90
+ /**
91
+ * 注销系统
92
+ */
93
+ onLogout() {
94
+ const url = 'api/gl-service-sys-user/v1/user/system/auth/logoutByAuthId';
95
+ return this.http.post(url, { AUTH_ID: this.token.id });
96
+ }
97
+ /**
98
+ * 获得 token
99
+ */
100
+ get token() {
101
+ return this.auth.get();
102
+ }
103
+ }
104
+ RkAuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RkAuthService, deps: [{ token: RK_ENVIRONMENT }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
105
+ RkAuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RkAuthService, providedIn: 'root' });
106
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RkAuthService, decorators: [{
107
+ type: Injectable,
108
+ args: [{
109
+ providedIn: 'root',
110
+ }]
111
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
112
+ type: Inject,
113
+ args: [RK_ENVIRONMENT]
114
+ }] }, { type: i1$1.HttpClient }]; } });
115
+
116
+ class RkAccountService {
117
+ constructor(http, auth) {
118
+ this.http = http;
119
+ this.auth = auth;
120
+ this.account = new Store('account', {});
121
+ }
122
+ /**
123
+ * 加载人员权限
124
+ */
125
+ onLoadAuth() {
126
+ var _a;
127
+ const url = 'api/gl-service-sys-user/v1/user/system/user/loadAuthData';
128
+ return this.http.post(url, { SYSTEM_USER_ID: (_a = this.auth.token) === null || _a === void 0 ? void 0 : _a.id }).pipe(tap((json) => {
129
+ if (json.code === 0) {
130
+ this.account.set(json.data);
131
+ }
132
+ }));
133
+ }
134
+ /**
135
+ * 获得账号基本信息
136
+ */
137
+ get userInfo() {
138
+ return this.account.get().UserInfo;
139
+ }
140
+ /**
141
+ * 获得账号人员库权限
142
+ */
143
+ get personnelPool() {
144
+ return this.account.get().AuthPersonnelPool;
145
+ }
146
+ /**
147
+ * 获得账号业务权限
148
+ */
149
+ get workflowAuth() {
150
+ return this.account.get().AuthWfId;
151
+ }
152
+ /**
153
+ * 获得账号机构分组权限
154
+ */
155
+ get authOrgGroup() {
156
+ return this.account.get().AuthOrgGroup;
157
+ }
158
+ }
159
+ RkAccountService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RkAccountService, deps: [{ token: i1$1.HttpClient }, { token: RkAuthService }], target: i0.ɵɵFactoryTarget.Injectable });
160
+ RkAccountService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RkAccountService, providedIn: 'root' });
161
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RkAccountService, decorators: [{
162
+ type: Injectable,
163
+ args: [{
164
+ providedIn: 'root',
165
+ }]
166
+ }], ctorParameters: function () { return [{ type: i1$1.HttpClient }, { type: RkAuthService }]; } });
167
+
168
+ class RkCacheHttpService {
169
+ constructor() {
170
+ this.cache = new Map();
171
+ }
172
+ /**
173
+ * 获得已缓存的请求
174
+ * @param url GET请求地址
175
+ */
176
+ get(url) {
177
+ return this.cache.get(url);
178
+ }
179
+ /**
180
+ * 缓存请求
181
+ * @param url GET请求地址
182
+ * @param response 响应内容
183
+ */
184
+ set(url, response) {
185
+ this.cache.set(url, response);
186
+ }
187
+ /**
188
+ * 删除指定已缓存的请求
189
+ * @param url GET请求地址
190
+ */
191
+ delete(url) {
192
+ this.cache.delete(url);
193
+ }
194
+ /**
195
+ * 删除所有已缓存的请求
196
+ */
197
+ clear() {
198
+ this.cache.clear();
199
+ }
200
+ }
201
+ RkCacheHttpService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RkCacheHttpService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
202
+ RkCacheHttpService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RkCacheHttpService, providedIn: 'root' });
203
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RkCacheHttpService, decorators: [{
204
+ type: Injectable,
205
+ args: [{
206
+ providedIn: 'root',
207
+ }]
208
+ }] });
209
+ /**
210
+ * 设置为缓存请求
211
+ * 使用方法:http.get(...CacheHttpTemplate`api/response.json`)
212
+ * @param urls 请求地址
213
+ * @param params 模板参数
214
+ */
215
+ function CacheHttpTemplate(urls, ...params) {
216
+ let [url] = urls;
217
+ if (params.length > 0) {
218
+ url = String.raw(urls, ...params);
219
+ }
220
+ return [url, { headers: new HttpHeaders({ 'Cache-Map': 'Storage' }) }];
221
+ }
222
+
223
+ class RkMenuService {
224
+ constructor(http) {
225
+ this.http = http;
226
+ this.appSettings = AppConfig.settings;
227
+ }
228
+ /**
229
+ * 获得系统导航列表
230
+ */
231
+ requestData() {
232
+ const url = 'api/gl-service-sys-core/v1/core/system/resource/tree/selectListNav';
233
+ return this.http.get(...CacheHttpTemplate `${url}/${this.appSettings.servers.RESOURCE_GROUP_ID}`).pipe(tap((json) => {
234
+ if (json.code !== 0) {
235
+ throw new Error(`获得系统导航列表 ${url} 出现错误: ${json.msg}`);
236
+ }
237
+ const menus = json.data;
238
+ menus.forEach((menu) => {
239
+ menu.children = menus.filter((v) => menu.SYSTEM_RESOURCE_TREE_ID === v.SYS_PARENT) || [];
240
+ });
241
+ }));
242
+ }
243
+ }
244
+ RkMenuService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RkMenuService, deps: [{ token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
245
+ RkMenuService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RkMenuService, providedIn: 'root' });
246
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RkMenuService, decorators: [{
247
+ type: Injectable,
248
+ args: [{
249
+ providedIn: 'root',
250
+ }]
251
+ }], ctorParameters: function () { return [{ type: i1$1.HttpClient }]; } });
252
+
253
+ class RkDownFileService {
254
+ constructor(http) {
255
+ this.http = http;
256
+ }
257
+ /**
258
+ * 使用GET方法下载文件
259
+ * @param url 请求链接; url可以传递自定义文件名优先级最高;如:api/file/down?fileName=身份证.jpg
260
+ * @param params 请求参数
261
+ */
262
+ get(url, params) {
263
+ return this.http
264
+ .get(url, { params, responseType: 'blob', observe: 'response' })
265
+ .pipe(tap((response) => this.handleResponse(response, url)));
266
+ }
267
+ /**
268
+ * 使用POST方法下载文件
269
+ * @param url 请求链接; url可以传递自定义文件名优先级最高;如:api/file/down?fileName=身份证.jpg
270
+ * @param params 请求参数
271
+ */
272
+ post(url, params) {
273
+ return this.http
274
+ .post(url, params, { responseType: 'blob', observe: 'response' })
275
+ .pipe(tap((response) => this.handleResponse(response, url)));
276
+ }
277
+ handleResponse(response, url) {
278
+ const filename = this.getFileName(response.headers, url);
279
+ this.saveAs(response.body, filename);
280
+ }
281
+ getFileName(headers, url) {
282
+ const urlParams = new URLSearchParams(url.split('?')[1]);
283
+ const fileNameFromParams = urlParams.get('fileName');
284
+ if (fileNameFromParams) {
285
+ return decodeURIComponent(fileNameFromParams);
286
+ }
287
+ const disposition = headers.get('content-disposition');
288
+ if (disposition) {
289
+ const filenameMatch = disposition.match(/filename=([^;]+)/);
290
+ if (filenameMatch) {
291
+ return decodeURIComponent(filenameMatch[1]);
292
+ }
293
+ }
294
+ const filenameFromHeaders = headers.get('filename');
295
+ if (filenameFromHeaders) {
296
+ return decodeURIComponent(filenameFromHeaders);
297
+ }
298
+ const urlSegments = url.split('/');
299
+ return decodeURIComponent(urlSegments[urlSegments.length - 1].split('?')[0]);
300
+ }
301
+ /**
302
+ * 文件另存为
303
+ * @param body 二进制内容
304
+ * @param filename 文件名
305
+ */
306
+ saveAs(body, filename) {
307
+ const blob = new Blob([body], { type: 'application/x-msdownload' });
308
+ const blobURL = URL.createObjectURL(blob);
309
+ const link = document.createElement('a');
310
+ link.href = blobURL;
311
+ link.download = filename;
312
+ link.style.display = 'none';
313
+ document.body.appendChild(link);
314
+ link.click();
315
+ document.body.removeChild(link);
316
+ URL.revokeObjectURL(blobURL);
317
+ }
318
+ }
319
+ RkDownFileService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RkDownFileService, deps: [{ token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
320
+ RkDownFileService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RkDownFileService, providedIn: 'root' });
321
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RkDownFileService, decorators: [{
322
+ type: Injectable,
323
+ args: [{
324
+ providedIn: 'root',
325
+ }]
326
+ }], ctorParameters: function () { return [{ type: i1$1.HttpClient }]; } });
327
+
328
+ class RkFileService {
329
+ constructor(http) {
330
+ this.http = http;
331
+ }
332
+ /**
333
+ * 获得人员照片静态路径
334
+ * @param fileId 文件编码
335
+ * @param fileName 文件名称
336
+ */
337
+ staticPhotoUrl(fileId, fileName) {
338
+ let url = `api/gl-file-service/static/photo/${fileId}`;
339
+ if (fileName) {
340
+ url += `?fileName=${encodeURI(fileName)}`;
341
+ }
342
+ return url;
343
+ }
344
+ /**
345
+ * 上传人员照片
346
+ * @param data 文件
347
+ */
348
+ photoUpload(data) {
349
+ const url = 'api/gl-file-service/photo/upload';
350
+ return this.http.post(url, data);
351
+ }
352
+ /**
353
+ * 获得附件静态路径
354
+ * @param fileId 文件编码
355
+ * @param fileName 文件名称
356
+ */
357
+ staticFileUrl(fileId, fileName) {
358
+ let url = `api/gl-file-service/static/attachment/${fileId}`;
359
+ if (fileName) {
360
+ url += `?fileName=${encodeURI(fileName)}`;
361
+ }
362
+ return url;
363
+ }
364
+ /**
365
+ * 上传附件
366
+ * @param data 文件
367
+ */
368
+ fileUpload(data) {
369
+ const url = 'api/gl-file-service/attachment/upload';
370
+ return this.http.post(url, data);
371
+ }
372
+ }
373
+ RkFileService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RkFileService, deps: [{ token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
374
+ RkFileService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RkFileService, providedIn: 'root' });
375
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RkFileService, decorators: [{
376
+ type: Injectable,
377
+ args: [{
378
+ providedIn: 'root',
379
+ }]
380
+ }], ctorParameters: function () { return [{ type: i1$1.HttpClient }]; } });
381
+
382
+ class RkOrgService {
383
+ constructor(http) {
384
+ this.http = http;
385
+ }
386
+ /**
387
+ * 通过父节点编码获得单位列表
388
+ * @param groupId 机构分组
389
+ * @param parentId 父节点编码;默认 -1
390
+ * @param isAll 是否显示全部单位(不受权限控制);默认 false
391
+ * @returns 单位列表
392
+ */
393
+ getChildren(groupId, parentId = '-1', isAll = false) {
394
+ const url = 'api/gl-service-data/v1/data/unit/org/selectListByParent';
395
+ return this.http.post(url, { ORG_GROUP_ID: groupId, SYS_PARENT: parentId, IS_ALL: isAll });
396
+ }
397
+ /**
398
+ * 搜索机构
399
+ * @param groupId 机构分组
400
+ * @param keyName 搜索关键字
401
+ * @returns 返回匹配项节点列表
402
+ */
403
+ requestKeywordList(groupId, keyName) {
404
+ const url = 'api/gl-service-data/v1/data/unit/org/selectListByQuery';
405
+ return this.http.post(url, { ORG_GROUP_ID: groupId, ORG_NAME: keyName });
406
+ }
407
+ /**
408
+ * 通过单位编码获得所有父节点
409
+ * @param id
410
+ */
411
+ requestParentList(id) {
412
+ const url = 'api/gl-service-data/v1/data/unit/org/selectListAllParentById';
413
+ return this.http.post(url, { DATA_UNIT_ORG_ID: id });
414
+ }
415
+ }
416
+ RkOrgService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RkOrgService, deps: [{ token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
417
+ RkOrgService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RkOrgService, providedIn: 'root' });
418
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RkOrgService, decorators: [{
419
+ type: Injectable,
420
+ args: [{
421
+ providedIn: 'root',
422
+ }]
423
+ }], ctorParameters: function () { return [{ type: i1$1.HttpClient }]; } });
424
+
425
+ class RkDictionaryService {
426
+ constructor(http) {
427
+ this.http = http;
428
+ this.useItems = new Store('dictionary_use_items', {}, { expires: 1000 * 60 * 60 * 24 * 7 });
429
+ }
430
+ /**
431
+ * 通过字典编码获得常用项
432
+ * @param code 字典编码
433
+ * @returns 常用项
434
+ */
435
+ getUseItems(code) {
436
+ return this.useItems.get()[code] || [];
437
+ }
438
+ /**
439
+ * 通过字典编码设置常用项
440
+ * @param code 字典编码
441
+ * @param item 常用项
442
+ */
443
+ setUseItems(code, item) {
444
+ const data = this.useItems.get();
445
+ if (!data[code]) {
446
+ data[code] = [item];
447
+ }
448
+ else {
449
+ if (data[code].find((v) => v.DICTIONARY_ITEM_CODE === item.DICTIONARY_ITEM_CODE)) {
450
+ return;
451
+ }
452
+ if (data[code].length > 9) {
453
+ data[code].pop();
454
+ }
455
+ data[code].unshift(item);
456
+ }
457
+ this.useItems.set(data);
458
+ }
459
+ /**
460
+ * 通过字典编码获得字典基本信息
461
+ * @param code 字典编码
462
+ * @returns 字典基本信息
463
+ */
464
+ getBaseInfo(code) {
465
+ const url = `api/gl-service-sys-core/v1/core/system/dictionary/selectOneByDictionaryCode`;
466
+ return this.http.get(...CacheHttpTemplate `${url}/${this.codeReplace(code)}`).pipe(filter((json) => json.code === 0), map((json) => json.data));
467
+ }
468
+ /**
469
+ * 通过字典编码获得获得字典项
470
+ * @param code 字典编码
471
+ * @returns 字典项列表
472
+ */
473
+ getData(code) {
474
+ const url = `api/gl-service-sys-core/v1/core/system/dictionary/item/selectListByDictionaryCode`;
475
+ return this.http.get(...CacheHttpTemplate `${url}/${this.codeReplace(code)}`).pipe(filter((json) => json.code === 0), map((json) => json.data));
476
+ }
477
+ /**
478
+ * 通过父节点获得字典项编码
479
+ * @param code 字典编码
480
+ * @param parentId 父节点编码
481
+ * @returns 字典项列表
482
+ */
483
+ getChildData(code, parentId = '-1') {
484
+ const url = `api/gl-service-sys-core/v1/core/system/dictionary/item/selectListByDictionaryCode`;
485
+ return this.http.post(url, { DICTIONARY_CODE: code, SYS_PARENT: parentId }).pipe(filter((json) => json.code === 0), map((json) => json.data));
486
+ }
487
+ codeReplace(code) {
488
+ return code.replace(/\//g, '_');
489
+ }
490
+ /**
491
+ * 通过字典编码获得获得字典项
492
+ * @param code 字典编码
493
+ * @param keyword 关键字
494
+ * @returns 字典项列表
495
+ */
496
+ requestSearchData(code, keyword) {
497
+ const url = 'api/gl-service-sys-core/v1/core/system/dictionary/item/selectListByQuery';
498
+ return this.http.post(url, { DICTIONARY_CODE: code, DICTIONARY_ITEM_NAME: keyword }).pipe(filter((json) => json.code === 0), map((json) => json.data
499
+ .filter((item, index) => index < 10)
500
+ .map((item) => ({
501
+ label: item.DICTIONARY_ITEM_NAME,
502
+ key: item.SYSTEM_DICTIONARY_ITEM_ID,
503
+ value: item.DICTIONARY_ITEM_CODE,
504
+ }))));
505
+ }
506
+ /**
507
+ * 获得字典项的所有父节点
508
+ * @param code 字典编码
509
+ * @param id 字典项编码
510
+ * @returns 字典项列表
511
+ */
512
+ requestParentList(code, id) {
513
+ const url = 'api/gl-service-sys-core/v1/core/system/dictionary/item/selectListInfoAllParentByCode';
514
+ return this.http.post(url, { DICTIONARY_CODE: code, DICTIONARY_ITEM_CODE: id }).pipe(filter((json) => json.code === 0), map((json) => json.data));
515
+ }
516
+ }
517
+ RkDictionaryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RkDictionaryService, deps: [{ token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
518
+ RkDictionaryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RkDictionaryService, providedIn: 'root' });
519
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RkDictionaryService, decorators: [{
520
+ type: Injectable,
521
+ args: [{
522
+ providedIn: 'root',
523
+ }]
524
+ }], ctorParameters: function () { return [{ type: i1$1.HttpClient }]; } });
525
+
526
+ class RkSchemeService {
527
+ constructor(http) {
528
+ this.http = http;
529
+ this.appSettings = AppConfig.settings;
530
+ }
531
+ /**
532
+ * 通过界面方案标识符获得界面方案内容
533
+ * @param permission 界面方案标识符
534
+ * @returns 界面方案
535
+ */
536
+ getData(permission) {
537
+ if (this.appSettings && this.appSettings.servers.AREA_CODE) {
538
+ permission = `${this.appSettings.servers.AREA_CODE}_${permission}`;
539
+ }
540
+ const url = `api/gl-service-sys-core/v1/core/system/scheme/selectSchemeByPermission`;
541
+ return this.http.get(...CacheHttpTemplate `${url}/${permission}`).pipe(tap((json) => {
542
+ if (json.code !== 0) {
543
+ throw new Error(`通过界面方案标识符获得界面方案内容 ${url} 出现错误: ${json.msg}`);
544
+ }
545
+ }), filter((json) => json.code === 0), map((json) => json.data));
546
+ }
547
+ }
548
+ RkSchemeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RkSchemeService, deps: [{ token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
549
+ RkSchemeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RkSchemeService, providedIn: 'root' });
550
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RkSchemeService, decorators: [{
551
+ type: Injectable,
552
+ args: [{
553
+ providedIn: 'root',
554
+ }]
555
+ }], ctorParameters: function () { return [{ type: i1$1.HttpClient }]; } });
556
+
557
+ class RkFieldSchemeService {
558
+ constructor(http) {
559
+ this.http = http;
560
+ this.appSettings = AppConfig.settings;
561
+ }
562
+ /**
563
+ * 通过字段方案标识符获得字段方案内容
564
+ * @param permission 字段方案标识符
565
+ * @returns 字段方案
566
+ */
567
+ getData(permission) {
568
+ if (this.appSettings && this.appSettings.servers.AREA_CODE) {
569
+ permission = `${this.appSettings.servers.AREA_CODE}_${permission}`;
570
+ }
571
+ const url = `api/gl-service-sys-core/v1/core/system/field/scheme/selectSchemeByIdentifier`;
572
+ return this.http.get(...CacheHttpTemplate `${url}/${permission}`).pipe(tap((json) => {
573
+ if (json.code !== 0) {
574
+ throw new Error(`通过字段方案标识符获得字段方案内容 ${url} 出现错误: ${json.msg}`);
575
+ }
576
+ }), filter((json) => json.code === 0), map((json) => json.data));
577
+ }
578
+ }
579
+ RkFieldSchemeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RkFieldSchemeService, deps: [{ token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
580
+ RkFieldSchemeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RkFieldSchemeService, providedIn: 'root' });
581
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RkFieldSchemeService, decorators: [{
582
+ type: Injectable,
583
+ args: [{
584
+ providedIn: 'root',
585
+ }]
586
+ }], ctorParameters: function () { return [{ type: i1$1.HttpClient }]; } });
587
+
588
+ class RkDestroyService extends Subject {
589
+ ngOnDestroy() {
590
+ this.next();
591
+ this.complete();
592
+ }
593
+ }
594
+ RkDestroyService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RkDestroyService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
595
+ RkDestroyService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RkDestroyService });
596
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RkDestroyService, decorators: [{
597
+ type: Injectable
598
+ }] });
599
+
600
+ /**
601
+ * Generated bundle index. Do not edit.
602
+ */
603
+
604
+ export { AppConfig, CacheHttpTemplate, RK_ENVIRONMENT, RkAccountService, RkAuthService, RkCacheHttpService, RkDestroyService, RkDictionaryService, RkDownFileService, RkFieldSchemeService, RkFileService, RkMenuService, RkOrgService, RkSchemeService, providerAppConfig };
605
+ //# sourceMappingURL=reskin-core-services.js.map