@ibiz-template/runtime 0.0.4-beta.1 → 0.0.4-beta.2

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.
@@ -0,0 +1,4544 @@
1
+ // src/config/global-config.ts
2
+ var GlobalConfig = class {
3
+ constructor() {
4
+ this.enableDataInfoBar = true;
5
+ this.defaultCodeListCacheTimeout = 36e5;
6
+ this.gridEditShowMode = "cell";
7
+ this.gridEditSaveMode = "cell-blur";
8
+ this.defaultTimerLogicInterval = 6e4;
9
+ }
10
+ };
11
+
12
+ // src/register/ui-action-register.ts
13
+ import { RuntimeError } from "@ibiz-template/core";
14
+
15
+ // src/register/register-base.ts
16
+ var RegisterBase = class {
17
+ constructor() {
18
+ this.providers = /* @__PURE__ */ new Map();
19
+ }
20
+ register(key, provider) {
21
+ this.providers.set(key, provider);
22
+ }
23
+ unRegister(key) {
24
+ this.providers.delete(key);
25
+ }
26
+ getByKey(key) {
27
+ return this.providers.get(key);
28
+ }
29
+ };
30
+
31
+ // src/register/ui-action-register.ts
32
+ var UIActionRegister = class extends RegisterBase {
33
+ async get(model) {
34
+ const { uiactionTag } = model;
35
+ const uiactionMode = model.uiactionMode;
36
+ if (uiactionMode === "SYS") {
37
+ const key = `${uiactionMode}_${uiactionTag}`;
38
+ if (this.providers.has(key)) {
39
+ return this.providers.get(key);
40
+ }
41
+ throw new RuntimeError(
42
+ `\u627E\u4E0D\u5230\u7CFB\u7EDF\u9884\u7F6E\u754C\u9762\u884C\u4E3A${uiactionTag}\u5BF9\u5E94\u7684\u9002\u914D\u5668`
43
+ );
44
+ } else {
45
+ if (this.providers.has(uiactionMode)) {
46
+ return this.providers.get(uiactionMode);
47
+ }
48
+ throw new RuntimeError(`\u627E\u4E0D\u754C\u9762\u884C\u4E3A\u6A21\u5F0F${uiactionMode}\u5BF9\u5E94\u7684\u9002\u914D\u5668`);
49
+ }
50
+ }
51
+ };
52
+
53
+ // src/register/register-center.ts
54
+ var RegisterCenter = class {
55
+ constructor() {
56
+ /**
57
+ * 界面行为注册器
58
+ *
59
+ * @author lxm
60
+ * @date 2022-10-25 15:10:39
61
+ * @type {UIActionRegister}
62
+ */
63
+ this.uiAction = new UIActionRegister();
64
+ }
65
+ // /**
66
+ // * 编辑器注册器
67
+ // *
68
+ // * @author lxm
69
+ // * @date 2022-09-19 22:09:08
70
+ // * @type {IEditorRegister}
71
+ // */
72
+ // editor: IEditorRegister = new EditorRegister();
73
+ // /**
74
+ // * 表单成员注册器
75
+ // *
76
+ // * @author lxm
77
+ // * @date 2022-10-17 17:10:40
78
+ // * @type {IFormDetailRegister}
79
+ // */
80
+ // formDetail: IFormDetailRegister = new FormDetailRegister();
81
+ // /**
82
+ // * 面板成员注册
83
+ // *
84
+ // * @author lxm
85
+ // * @date 2023-02-07 05:35:56
86
+ // * @type {IPanelItemRegister}
87
+ // * @memberof RegisterCenter
88
+ // */
89
+ // panelItem: IPanelItemRegister = new PanelItemRegister();
90
+ // /**
91
+ // * 表格列注册器
92
+ // *
93
+ // * @author lxm
94
+ // * @date 2022-11-14 10:11:52
95
+ // * @type {IGridColumnRegister}
96
+ // */
97
+ // gridColumn: IGridColumnRegister = new GridColumnRegister();
98
+ // /**
99
+ // * 数据看板成员注册器
100
+ // *
101
+ // * @author lxm
102
+ // * @date 2022-10-17 17:10:40
103
+ // * @type {IPortletPartRegister}
104
+ // */
105
+ // portletPart: IPortletPartRegister = new PortletPartRegister();
106
+ // /**
107
+ // * 部件注册器
108
+ // *
109
+ // * @author lxm
110
+ // * @date 2022-10-25 18:10:16
111
+ // * @type {IControlRegister}
112
+ // */
113
+ // control: IControlRegister = new ControlRegister();
114
+ // /**
115
+ // * 视图注册器
116
+ // *
117
+ // * @author lxm
118
+ // * @date 2022-10-26 11:10:24
119
+ // * @type {IViewRegister}
120
+ // */
121
+ // view: IViewRegister = new ViewRegister();
122
+ };
123
+
124
+ // src/command/app/app-func/app-func.ts
125
+ var _AppFuncCommand = class {
126
+ constructor() {
127
+ ibiz.commands.register(_AppFuncCommand.TAG, this.exec.bind(this));
128
+ }
129
+ /**
130
+ * 执行应用功能
131
+ *
132
+ * @author chitanda
133
+ * @date 2022-07-25 17:07:35
134
+ * @param {IAppFunc} appFunc 应用功能模型
135
+ * @param {IContext} [context] 执行上下文
136
+ * @param {IParams} [params={}] 参数
137
+ * @param {IData} [opts={}] 额外参数,与具体执行对象规划好的额外参数。如需要给飘窗使用的 event 事件对象.
138
+ * @return {*} {Promise<void>}
139
+ */
140
+ async exec(appFunc, context, params = {}, opts = {}) {
141
+ const navContext = appFunc.navigateContexts;
142
+ if (navContext) {
143
+ Object.assign(context, navContext);
144
+ }
145
+ const navParams = appFunc.navigateParams;
146
+ if (navParams) {
147
+ Object.assign(params, navParams);
148
+ }
149
+ switch (appFunc.appFuncType) {
150
+ case "APPVIEW":
151
+ return this.openAppView(appFunc, context, params, opts);
152
+ case "OPENHTMLPAGE":
153
+ return this.openHtmlPage(appFunc);
154
+ case "PDTAPPFUNC":
155
+ return this.openPdAppFunc(appFunc, context, params);
156
+ case "JAVASCRIPT":
157
+ return this.executeJavaScript(appFunc, context, params);
158
+ case "CUSTOM":
159
+ return this.custom(appFunc, context, params);
160
+ default:
161
+ throw new Error(`\u672A\u77E5\u7684\u5E94\u7528\u529F\u80FD\u7C7B\u578B: ${appFunc.appFuncType}`);
162
+ }
163
+ }
164
+ /**
165
+ * 打开应用视图
166
+ *
167
+ * @author chitanda
168
+ * @date 2022-07-25 18:07:49
169
+ * @protected
170
+ * @param {IAppFunc} appFunc
171
+ * @param {IContext} [context]
172
+ * @param {IParams} [params]
173
+ * @return {*} {Promise<void>}
174
+ */
175
+ async openAppView(appFunc, context, params, opts) {
176
+ }
177
+ /**
178
+ * 打开HTML页面
179
+ *
180
+ * @author chitanda
181
+ * @date 2022-07-25 18:07:56
182
+ * @protected
183
+ * @param {IAppFunc} appFunc
184
+ */
185
+ openHtmlPage(appFunc) {
186
+ const url = appFunc.htmlPageUrl;
187
+ window.open(url, "_blank");
188
+ }
189
+ /**
190
+ * 应用预置功能
191
+ *
192
+ * @author chitanda
193
+ * @date 2022-07-25 18:07:22
194
+ * @protected
195
+ * @param {IAppFunc} appFunc
196
+ * @param {IContext} [context]
197
+ * @param {IParams} [params]
198
+ */
199
+ openPdAppFunc(appFunc, context, params) {
200
+ ibiz.log.warn("openPdAppFunc", appFunc, context, params);
201
+ throw new Error("\u672A\u5B9E\u73B0");
202
+ }
203
+ /**
204
+ * 执行 JavaScript 脚本
205
+ *
206
+ * @author chitanda
207
+ * @date 2022-07-25 18:07:09
208
+ * @protected
209
+ * @param {IAppFunc} appFunc
210
+ * @param {IContext} [context]
211
+ * @param {IParams} [params]
212
+ */
213
+ executeJavaScript(appFunc, context, params) {
214
+ ibiz.log.warn("executeJavaScript", appFunc, context, params);
215
+ throw new Error("\u672A\u5B9E\u73B0");
216
+ }
217
+ /**
218
+ * 自定义应用功能
219
+ *
220
+ * @author chitanda
221
+ * @date 2022-07-25 18:07:51
222
+ * @protected
223
+ * @param {IAppFunc} appFunc
224
+ * @param {IContext} [context]
225
+ * @param {IParams} [params]
226
+ */
227
+ custom(appFunc, context, params) {
228
+ ibiz.log.warn("custom", appFunc, context, params);
229
+ throw new Error("\u672A\u5B9E\u73B0");
230
+ }
231
+ };
232
+ var AppFuncCommand = _AppFuncCommand;
233
+ /**
234
+ * 指令标识
235
+ *
236
+ * @author chitanda
237
+ * @date 2022-07-25 17:07:20
238
+ * @see 具体实现 {@link AppFuncCommand.exec}
239
+ * @static
240
+ */
241
+ AppFuncCommand.TAG = "ibiz.app-func.exec";
242
+
243
+ // src/utils/nav-params/nav-params.ts
244
+ import { isEmpty } from "lodash-es";
245
+ import { isNilOrEmpty, notNilEmpty } from "qx-util";
246
+ function convertNavData(naviDatas, ...origins) {
247
+ if (!naviDatas || isEmpty(naviDatas)) {
248
+ return {};
249
+ }
250
+ if (Object.prototype.toString.call(naviDatas) === "[object Array]") {
251
+ return convertNavDataByArray(naviDatas, ...origins);
252
+ }
253
+ if (Object.prototype.toString.call(naviDatas) === "[object Object]") {
254
+ return convertNavDataByObject(naviDatas, ...origins);
255
+ }
256
+ return {};
257
+ }
258
+ function convertNavDataByArray(naviDatas, ...origins) {
259
+ const result = {};
260
+ for (const naviData of naviDatas) {
261
+ if (notNilEmpty(naviData.value) && !naviData.rawValue) {
262
+ const findOrigin = origins.find((item) => {
263
+ if (isNilOrEmpty(item)) {
264
+ return false;
265
+ }
266
+ return (
267
+ // proxy数据判断是否能拿到值
268
+ item[naviData.value] || // 上下文等判断是否有这个属性,如果有且值为空,则赋该空值
269
+ Object.prototype.hasOwnProperty.call(item, naviData.value)
270
+ );
271
+ });
272
+ if (findOrigin) {
273
+ result[naviData.key.toLowerCase()] = findOrigin[naviData.value];
274
+ }
275
+ } else {
276
+ result[naviData.key.toLowerCase()] = naviData.value || null;
277
+ }
278
+ }
279
+ return result;
280
+ }
281
+ function convertNavDataByObject(naviData, ...origins) {
282
+ const result = {};
283
+ const reg = /^%(.+)%$/;
284
+ for (const key in naviData) {
285
+ if (notNilEmpty(naviData[key]) && reg.test(naviData[key])) {
286
+ const valueKey = naviData[key].substring(1, naviData[key].length - 1);
287
+ const findOrigin = origins.find((item) => {
288
+ return Object.prototype.hasOwnProperty.call(item, valueKey);
289
+ });
290
+ if (findOrigin) {
291
+ result[key.toLowerCase()] = findOrigin[valueKey];
292
+ }
293
+ } else {
294
+ result[key.toLowerCase()] = naviData[key] || null;
295
+ }
296
+ }
297
+ return result;
298
+ }
299
+
300
+ // src/utils/nav-params/calc-nav-params.ts
301
+ function calcNavParams(model, originParams) {
302
+ const { deName, navFilter, pickupDEFName, navContexts, navParams } = model;
303
+ const { context, params, datum, derValue } = originParams;
304
+ const resultContext = {};
305
+ const resultParams = {};
306
+ const deSrfkey = derValue || datum[deName];
307
+ if (deSrfkey) {
308
+ if (deName) {
309
+ resultContext[deName] = deSrfkey;
310
+ }
311
+ if (navFilter) {
312
+ resultParams[navFilter] = deSrfkey;
313
+ }
314
+ if (pickupDEFName) {
315
+ resultParams[`n_${pickupDEFName}_eq`] = deSrfkey;
316
+ }
317
+ }
318
+ const tempContext = convertNavData(navContexts, context, params, datum);
319
+ const tempParams = convertNavData(navParams, context, params, datum);
320
+ Object.assign(resultContext, tempContext);
321
+ Object.assign(resultParams, tempParams);
322
+ return {
323
+ resultContext,
324
+ resultParams
325
+ };
326
+ }
327
+
328
+ // src/utils/app-de-ui-action-util/app-de-ui-action-util.ts
329
+ var AppDEUIActionUtil = class {
330
+ /**
331
+ * 执行界面行为
332
+ *
333
+ * @author chitanda
334
+ * @date 2022-08-29 15:08:47
335
+ * @static
336
+ * @param {IAppDEUIAction} action
337
+ * @param {IContext} context
338
+ * @param {(IData | null)} data
339
+ * @param {IParams} [params]
340
+ * @param {IData} [opts]
341
+ * @return {*} {Promise<IUIActionResult>}
342
+ */
343
+ static async exec(action, context, data, params, opts) {
344
+ const provider = await ibiz.register.uiAction.get(action);
345
+ const handler = await provider.getHandler();
346
+ return handler.exec(action, context, data || [], params, opts);
347
+ }
348
+ };
349
+
350
+ // src/utils/app-de-ui-action-util/handler/ui-action-handler.ts
351
+ var UIActionHandler = class {
352
+ async exec(action, context, data, params, opts) {
353
+ const result = {
354
+ refresh: action.reloadData,
355
+ closeView: action.closeEditView
356
+ };
357
+ if (!await this.isConfirm(action)) {
358
+ return this.returnError(result);
359
+ }
360
+ const _result = await this.execAction(action, context, data, params, opts);
361
+ Object.assign(result, _result);
362
+ if (result.cancel === true) {
363
+ return this.returnError(result);
364
+ }
365
+ const nextResult = await this.doNextAction(
366
+ action,
367
+ result.nextContext || context,
368
+ result.data || data,
369
+ result.nextParams || params,
370
+ opts
371
+ );
372
+ if (nextResult) {
373
+ Object.assign(result, nextResult);
374
+ if (nextResult.cancel === true) {
375
+ return this.returnError(result);
376
+ }
377
+ }
378
+ return result;
379
+ }
380
+ /**
381
+ * 有错误和取消时对result做的处理
382
+ * @author lxm
383
+ * @date 2023-03-15 07:43:21
384
+ * @protected
385
+ * @param {IUIActionResult} result
386
+ * @returns {*} {IUIActionResult}
387
+ * @memberof UIActionHandler
388
+ */
389
+ returnError(result) {
390
+ return Object.assign(result, {
391
+ refresh: false,
392
+ closeView: false
393
+ });
394
+ }
395
+ /**
396
+ * 用户操作确认
397
+ *
398
+ * @author lxm
399
+ * @date 2022-10-25 14:10:55
400
+ * @param {IAppDEUIAction} action 界面行为模型
401
+ * @returns {*} {Promise<boolean>}
402
+ */
403
+ async isConfirm(action) {
404
+ if (action.enableConfirm && action.confirmMsg) {
405
+ return ibiz.modal.confirm({ title: action.confirmMsg });
406
+ }
407
+ return true;
408
+ }
409
+ /**
410
+ * 执行后续界面行为
411
+ *
412
+ * @author lxm
413
+ * @date 2022-10-25 15:10:54
414
+ * @param {IAppDEUIAction} action
415
+ * @param {IContext} context
416
+ * @param {(IDatum[])} data
417
+ * @param {IParams} params
418
+ * @param {(IData | undefined)} [opts]
419
+ * @returns {*} {Promise<void>}
420
+ */
421
+ async doNextAction(action, context, data, params, opts) {
422
+ const nextAction = void 0;
423
+ if (nextAction) {
424
+ return AppDEUIActionUtil.exec(nextAction, context, data, params, opts);
425
+ }
426
+ }
427
+ /**
428
+ * 参数处理(根据数据目标和数据参数,导航参数)
429
+ *
430
+ * @author lxm
431
+ * @date 2022-08-29 17:08:00
432
+ * @protected
433
+ * @static
434
+ * @param {IAppDEUIAction} action 界面行为
435
+ * @param {IContext} context 上下文
436
+ * @param {(IDatum[])} data 数据集合
437
+ * @param {IParams} params 视图参数
438
+ * @returns {*} {Promise<{
439
+ * resultContext: IContext; 处理后的上下文
440
+ * resultData: IDatum[]; 处理后的数据集合
441
+ * resultParams: IParams; 处理后的视图参数
442
+ * }>}
443
+ */
444
+ async handleParams(action, context, data, params) {
445
+ let resultData = [];
446
+ if (["MULTIDATA", "MULTIKEY"].indexOf(action.actionTarget) !== -1) {
447
+ throw new Error(
448
+ `\u6570\u636E\u7C7B\u578B${action.actionTarget}\u6682\u672A\u652F\u6301,\u8BF7\u914D\u7F6E\u65E0\u6570\u636E\u6216\u5355\u9879\u6570\u636E\u4E3B\u952E`
449
+ );
450
+ }
451
+ const deName = "";
452
+ const originData = data[0] || {};
453
+ const deSrfkey = originData.srfkey || originData[deName || ""];
454
+ switch (action.actionTarget) {
455
+ case "NONE":
456
+ resultData = [];
457
+ break;
458
+ case "SINGLEDATA":
459
+ resultData = [data[0]];
460
+ break;
461
+ case "MULTIDATA":
462
+ resultData = data;
463
+ break;
464
+ case "SINGLEKEY":
465
+ resultData = deName ? [{ [deName]: deSrfkey }] : [];
466
+ break;
467
+ default:
468
+ break;
469
+ }
470
+ const resultContext = context.clone();
471
+ const navContexts = action.navigateContexts || [];
472
+ if (deName && ["SINGLEKEY", "SINGLEDATA"].includes(action.actionTarget)) {
473
+ const { valueItem, paramItem } = action;
474
+ const key = paramItem || deName;
475
+ const value = valueItem ? originData[valueItem] : deSrfkey;
476
+ resultContext[key] = value;
477
+ }
478
+ const datum = (resultData == null ? void 0 : resultData[0]) || {};
479
+ const tempContext = convertNavData(navContexts, context, params, datum);
480
+ Object.assign(resultContext, tempContext);
481
+ const navParams = action.navigateParams;
482
+ const resultParams = convertNavData(navParams, context, params, datum);
483
+ return { resultContext, resultData, resultParams };
484
+ }
485
+ };
486
+
487
+ // src/utils/app-de-ui-action-util/handler/common-sys-ui-action-handler.ts
488
+ var CommonSysUIActionHandler = class extends UIActionHandler {
489
+ async execAction(action, context, data, params, opts) {
490
+ const { neuron, event, view } = opts;
491
+ const uIActionTag = action.uiactionTag;
492
+ const result = {};
493
+ if (uIActionTag === "New") {
494
+ if (!view.newData) {
495
+ throw new Error(`\u8BE5\u89C6\u56FE\u4E0D\u5B58\u5728newData\u80FD\u529B`);
496
+ }
497
+ await view.newData(event);
498
+ }
499
+ if (uIActionTag === "Edit") {
500
+ if (!view.openData) {
501
+ throw new Error(`\u8BE5\u89C6\u56FE\u4E0D\u5B58\u5728openData\u80FD\u529B`);
502
+ }
503
+ await view.openData(data == null ? void 0 : data[0], event);
504
+ }
505
+ const saveTags = ["SaveAndExit", "Save", "SaveRow"];
506
+ if (saveTags.indexOf(uIActionTag) !== -1) {
507
+ if (!neuron.save) {
508
+ throw new Error(`\u8BE5\u89C6\u56FE\u4E0D\u5B58\u5728save\u80FD\u529B`);
509
+ }
510
+ await neuron.save();
511
+ }
512
+ if (uIActionTag === "SaveAndNew") {
513
+ if (!neuron.saveAndNew) {
514
+ throw new Error(`\u8BE5\u89C6\u56FE\u4E0D\u5B58\u5728saveAndNew\u80FD\u529B`);
515
+ }
516
+ await neuron.saveAndNew();
517
+ }
518
+ if (uIActionTag === "Remove" || uIActionTag === "RemoveAndExit") {
519
+ if (!neuron.remove) {
520
+ throw new Error(`\u8BE5\u89C6\u56FE\u4E0D\u5B58\u5728remove\u80FD\u529B`);
521
+ }
522
+ await neuron.remove();
523
+ }
524
+ if (uIActionTag === "NewRow") {
525
+ if (!neuron.newRow) {
526
+ throw new Error(`\u8BE5\u89C6\u56FE\u4E0D\u5B58\u5728newRow\u80FD\u529B`);
527
+ }
528
+ await neuron.newRow();
529
+ }
530
+ if (uIActionTag === "ToggleFilter") {
531
+ if (!neuron.toggleFilter) {
532
+ throw new Error(`\u8BE5\u89C6\u56FE\u4E0D\u5B58\u5728ToggleFilter\u80FD\u529B`);
533
+ }
534
+ neuron.toggleFilter();
535
+ }
536
+ if (uIActionTag === "Import") {
537
+ if (!neuron.importData) {
538
+ throw new Error(`\u8BE5\u89C6\u56FE\u4E0D\u5B58\u5728Import\u80FD\u529B`);
539
+ }
540
+ neuron.importData();
541
+ }
542
+ if (uIActionTag === "ExportExcel") {
543
+ if (!neuron.exportData) {
544
+ throw new Error(`\u8BE5\u89C6\u56FE\u4E0D\u5B58\u5728ExportExcel\u80FD\u529B`);
545
+ }
546
+ neuron.exportData(event);
547
+ }
548
+ if (uIActionTag === "SaveAndStart") {
549
+ if (!neuron.wfStart) {
550
+ throw new Error(`\u8BE5\u89C6\u56FE\u4E0D\u5B58\u5728SaveAndStart\u80FD\u529B`);
551
+ }
552
+ await neuron.wfStart();
553
+ }
554
+ if (uIActionTag === "ViewWFStep") {
555
+ if (!neuron.wfSubmit) {
556
+ throw new Error(`\u8BE5\u89C6\u56FE\u4E0D\u5B58\u5728ViewWFStep\u80FD\u529B`);
557
+ }
558
+ await neuron.wfSubmit();
559
+ }
560
+ if (["SaveAndExit", "Exit", "RemoveAndExit"].indexOf(uIActionTag) !== -1) {
561
+ result.closeView = true;
562
+ }
563
+ if (["Refresh"].indexOf(uIActionTag) !== -1) {
564
+ result.refresh = true;
565
+ }
566
+ return result;
567
+ }
568
+ };
569
+
570
+ // src/utils/app-de-ui-action-util/handler/backend-ui-action-handler.ts
571
+ var BackendUIActionHandler = class extends UIActionHandler {
572
+ /**
573
+ * 打开实体行为前选择视图
574
+ * @author lxm
575
+ * @date 2023-03-27 11:21:01
576
+ * @param {IAppDEUIAction} action
577
+ * @param {IContext} context
578
+ * @param {IParams} params
579
+ * @param {(IData | undefined)} [opts]
580
+ * @return {*}
581
+ */
582
+ async openSelectView(action, context, params, opts) {
583
+ }
584
+ async execAction(action, context, data, params, opts) {
585
+ const actionResult = {};
586
+ return actionResult;
587
+ }
588
+ };
589
+
590
+ // src/utils/app-de-ui-action-util/handler/front-ui-action-handler.ts
591
+ var FrontUIActionHandler = class extends UIActionHandler {
592
+ async execAction(action, context, data, params, opts) {
593
+ const actionResult = {};
594
+ return actionResult;
595
+ }
596
+ };
597
+
598
+ // src/utils/app-de-ui-action-util/handler/wf-withdraw-handler.ts
599
+ var WFWithdrawUIActionHandler = class extends UIActionHandler {
600
+ async execAction(action, context, data, params, opts) {
601
+ const isWithdraw = await ibiz.modal.confirm({
602
+ title: "\u63D0\u793A",
603
+ desc: "\u662F\u5426\u786E\u8BA4\u6267\u884C\u64A4\u56DE\u64CD\u4F5C\uFF1F"
604
+ });
605
+ let isCloseView = false;
606
+ if (isWithdraw && (opts == null ? void 0 : opts.neuron)) {
607
+ await opts.neuron.wfWithdraw(context, params, (data == null ? void 0 : data[0]) || []);
608
+ isCloseView = true;
609
+ }
610
+ return {
611
+ refresh: false,
612
+ closeView: isCloseView
613
+ };
614
+ }
615
+ };
616
+
617
+ // src/utils/open-redirect-view/open-redirect-view.ts
618
+ import { ModelError } from "@ibiz-template/core";
619
+ async function openRedirectView(appView, context, params = {}, data = []) {
620
+ throw new ModelError(appView, `\u672A\u652F\u6301\u7684\u91CD\u5B9A\u5411\u89C6\u56FE\u7C7B\u578B: ${appView.viewType}`);
621
+ }
622
+ async function toLocalOpenWFRedirectView(context, linkUrl) {
623
+ }
624
+
625
+ // src/utils/verify/verify.ts
626
+ import { RuntimeError as RuntimeError2 } from "@ibiz-template/core";
627
+ import { isNilOrEmpty as isNilOrEmpty2, notNilEmpty as notNilEmpty2 } from "qx-util";
628
+ import { isNil } from "ramda";
629
+ function testCond(value, op, value2) {
630
+ if (Object.is(op, "IN")) {
631
+ return contains(value, value2);
632
+ }
633
+ if (Object.is(op, "NOTIN")) {
634
+ return !contains(value, value2);
635
+ }
636
+ switch (op) {
637
+ case "EQ":
638
+ return `${value}` === `${value2}`;
639
+ case "NOTEQ":
640
+ return `${value}` !== `${value2}`;
641
+ case "LT":
642
+ return compare(value, value2) < 0;
643
+ case "LTANDEQ":
644
+ return compare(value, value2) <= 0;
645
+ case "GT":
646
+ return compare(value, value2) > 0;
647
+ case "GTANDEQ":
648
+ return compare(value, value2) >= 0;
649
+ case "ISNULL":
650
+ return isNilOrEmpty2(value);
651
+ case "ISNOTNULL":
652
+ return notNilEmpty2(value);
653
+ case "TESTNULL":
654
+ return isNil(value);
655
+ case "IN":
656
+ return contains(value, value2);
657
+ case "NOTIN":
658
+ return !contains(value, value2);
659
+ case "LIKE":
660
+ return strContain(value, value2);
661
+ case "LEFTLIKE":
662
+ return strContain(value, value2, "start");
663
+ case "RIGHTLIKE":
664
+ return strContain(value, value2, "end");
665
+ default:
666
+ throw new RuntimeError2(`\u503C\u64CD\u4F5C\uFF1A${op}\uFF0C\u6682\u672A\u652F\u6301`);
667
+ }
668
+ }
669
+ function compare(value, value2) {
670
+ const number1 = Number(value);
671
+ const number2 = Number(value2);
672
+ if (!Number.isNaN(number1) && !Number.isNaN(number2)) {
673
+ return compareNumber(number1, number2);
674
+ }
675
+ const date1 = new Date(value).getTime();
676
+ const date2 = new Date(value2).getTime();
677
+ if (!Number.isNaN(date1) && !Number.isNaN(date2)) {
678
+ return compareNumber(date1, date2);
679
+ }
680
+ throw new RuntimeError2(`${value} \u548C ${value2} \u65E0\u6CD5\u6BD4\u8F83\u5927\u5C0F`);
681
+ }
682
+ function compareNumber(value, value2) {
683
+ if (Number.isNaN(value)) {
684
+ value = 0;
685
+ }
686
+ if (Number.isNaN(value2)) {
687
+ value2 = 0;
688
+ }
689
+ if (value > value2) {
690
+ return 1;
691
+ }
692
+ if (value < value2) {
693
+ return -1;
694
+ }
695
+ return 0;
696
+ }
697
+ function contains(value, value2) {
698
+ if (!value2 || typeof value2 !== "string") {
699
+ throw new RuntimeError2("\u8303\u56F4\u6BD4\u8F83\u7684\u6761\u4EF6\u503C\u4E0D\u5B58\u6216\u8005\u4E0D\u662F\u5B57\u7B26\u4E32");
700
+ }
701
+ if (value) {
702
+ const arr = value2.split(",");
703
+ return arr.includes(`${value}`);
704
+ }
705
+ return false;
706
+ }
707
+ function strContain(value, value2, mode) {
708
+ if (!value || !value2) {
709
+ return false;
710
+ }
711
+ const val = `${value}`.toUpperCase();
712
+ const val2 = `${value2}`.toUpperCase();
713
+ const index = val.indexOf(val2);
714
+ switch (mode) {
715
+ case "start":
716
+ return index === 0;
717
+ case "end":
718
+ return index + val2.length === val.length;
719
+ default:
720
+ return index !== -1;
721
+ }
722
+ }
723
+
724
+ // src/utils/verify/de-rule-verify.ts
725
+ import { isNilOrEmpty as isNilOrEmpty3 } from "qx-util";
726
+ import { isEmpty as isEmpty2, isNil as isNil2 } from "ramda";
727
+ function isGroupCondition(condition) {
728
+ return condition.condType === "GROUP";
729
+ }
730
+ function isSimpleCondition(condition) {
731
+ return condition.condType === "SIMPLE";
732
+ }
733
+ function isValueRange2Condition(condition) {
734
+ return condition.condType === "VALUERANGE2";
735
+ }
736
+ function isRegExCondition(condition) {
737
+ return condition.condType === "REGEX";
738
+ }
739
+ function isStringLengthCondition(condition) {
740
+ return condition.condType === "STRINGLENGTH";
741
+ }
742
+ function isSysValueRuleCondition(condition) {
743
+ return condition.condType === "SYSVALUERULE";
744
+ }
745
+ function verifyDeRules(name, data, condition) {
746
+ const flag = { isPast: true, infoMessage: condition.ruleInfo };
747
+ if (isGroupCondition(condition)) {
748
+ const childRules = [];
749
+ if (childRules && childRules.length > 0) {
750
+ flag.isPast = logicForEach(
751
+ childRules,
752
+ (item) => {
753
+ const { isPast, infoMessage } = verifyDeRules(name, data, item);
754
+ flag.infoMessage = infoMessage;
755
+ return isPast;
756
+ },
757
+ condition.condOp,
758
+ !!condition.notMode
759
+ );
760
+ if (!flag.isPast && (condition.condOp === "AND" && condition.notMode || condition.condOp === "OR" && !condition.notMode)) {
761
+ flag.infoMessage = condition.ruleInfo;
762
+ }
763
+ }
764
+ } else {
765
+ name = condition == null ? void 0 : condition.defname.toLowerCase();
766
+ try {
767
+ if (isSimpleCondition(condition)) {
768
+ flag.isPast = !checkFieldSimpleRule(
769
+ data[name],
770
+ condition.condOp,
771
+ condition.paramValue,
772
+ condition.ruleInfo,
773
+ condition.paramType,
774
+ data,
775
+ condition.keyCond
776
+ );
777
+ } else if (isValueRange2Condition(condition)) {
778
+ flag.isPast = !checkFieldValueRangeRule(
779
+ data[name],
780
+ condition.minValue,
781
+ condition.includeMinValue,
782
+ condition.maxValue,
783
+ condition.includeMaxValue,
784
+ condition.ruleInfo,
785
+ condition.keyCond
786
+ );
787
+ } else if (isRegExCondition(condition)) {
788
+ flag.isPast = !checkFieldRegExRule(
789
+ data[name],
790
+ condition.regExCode,
791
+ condition.ruleInfo,
792
+ condition.keyCond
793
+ );
794
+ } else if (isStringLengthCondition(condition)) {
795
+ flag.isPast = !checkFieldStringLengthRule(
796
+ data[name],
797
+ condition.minValue,
798
+ condition.includeMinValue,
799
+ condition.maxValue,
800
+ condition.includeMaxValue,
801
+ condition.ruleInfo,
802
+ condition.keyCond
803
+ );
804
+ } else if (isSysValueRuleCondition(condition) && (condition == null ? void 0 : condition.sysValueRule)) {
805
+ const { ruleType, regExCode, scriptCode, ruleInfo } = condition.sysValueRule;
806
+ flag.infoMessage = condition.ruleInfo || ruleInfo;
807
+ if (ruleType === "REG") {
808
+ flag.isPast = !checkFieldRegExRule(
809
+ data[name],
810
+ regExCode,
811
+ flag.infoMessage,
812
+ condition.keyCond
813
+ );
814
+ } else if (ruleType === "SCRIPT") {
815
+ const { isPast, infoMessage } = checkFieldScriptRule(
816
+ data[name],
817
+ data,
818
+ scriptCode,
819
+ flag.infoMessage,
820
+ condition.keyCond
821
+ );
822
+ flag.isPast = isPast;
823
+ flag.infoMessage = infoMessage || flag.infoMessage;
824
+ }
825
+ }
826
+ } catch (error) {
827
+ flag.isPast = false;
828
+ }
829
+ flag.isPast = condition.notMode ? !flag.isPast : flag.isPast;
830
+ }
831
+ return flag;
832
+ }
833
+ function logicForEach(array, callback, operateTag = "AND", isReverse = false) {
834
+ if (!((array == null ? void 0 : array.length) > 0)) {
835
+ return false;
836
+ }
837
+ let result = operateTag === "AND";
838
+ for (let i = 0, len = array.length; i < len; i++) {
839
+ const temp = callback(array[i], i);
840
+ if (operateTag === "AND") {
841
+ if (!temp) {
842
+ result = false;
843
+ break;
844
+ }
845
+ } else if (operateTag === "OR") {
846
+ if (temp) {
847
+ result = true;
848
+ break;
849
+ }
850
+ }
851
+ }
852
+ return isReverse ? !result : result;
853
+ }
854
+ function checkFieldSimpleRule(value, op, value2, errorInfo, paramType, form, primaryModel) {
855
+ if (Object.is(paramType, "CURTIME")) {
856
+ value2 = `${/* @__PURE__ */ new Date()}`;
857
+ }
858
+ if (Object.is(paramType, "ENTITYFIELD")) {
859
+ value2 = value2 ? value2.toLowerCase() : "";
860
+ const _value2Field = form[value2] ? form[value2] : value2;
861
+ value2 = _value2Field;
862
+ }
863
+ if (isNil2(errorInfo) || isEmpty2(errorInfo)) {
864
+ errorInfo = "\u5185\u5BB9\u5FC5\u987B\u7B26\u5408\u503C\u89C4\u5219";
865
+ }
866
+ const result = testCond(value, op, value2);
867
+ if (!result) {
868
+ if (primaryModel) {
869
+ throw new Error(errorInfo);
870
+ }
871
+ }
872
+ return !result;
873
+ }
874
+ function checkFieldStringLengthRule(viewValue, minLength, indexOfMin, maxLength, indexOfMax, errorInfo, primaryModel) {
875
+ if (isNilOrEmpty3(errorInfo)) {
876
+ errorInfo = "\u5185\u5BB9\u957F\u5EA6\u5FC5\u987B\u7B26\u5408\u8303\u56F4\u89C4\u5219";
877
+ }
878
+ const judge = isNilOrEmpty3(viewValue);
879
+ if (judge) {
880
+ if (primaryModel) {
881
+ throw new Error("\u503C\u4E3A\u7A7A");
882
+ }
883
+ errorInfo = "\u503C\u4E3A\u7A7A";
884
+ return true;
885
+ }
886
+ const viewValueLength = viewValue.length;
887
+ if (minLength !== null) {
888
+ if (indexOfMin) {
889
+ if (viewValueLength < minLength) {
890
+ if (primaryModel) {
891
+ throw new Error(errorInfo);
892
+ }
893
+ return true;
894
+ }
895
+ } else if (viewValueLength <= minLength) {
896
+ if (primaryModel) {
897
+ throw new Error(errorInfo);
898
+ }
899
+ return true;
900
+ }
901
+ }
902
+ if (maxLength !== null) {
903
+ if (indexOfMax) {
904
+ if (viewValueLength > maxLength) {
905
+ if (primaryModel) {
906
+ throw new Error(errorInfo);
907
+ }
908
+ return true;
909
+ }
910
+ } else if (viewValueLength >= maxLength) {
911
+ if (primaryModel) {
912
+ throw new Error(errorInfo);
913
+ }
914
+ return true;
915
+ }
916
+ }
917
+ errorInfo = "";
918
+ return false;
919
+ }
920
+ function checkFieldRegExRule(viewValue, strReg, errorInfo, primaryModel) {
921
+ if (isNilOrEmpty3(errorInfo)) {
922
+ errorInfo = "\u503C\u5FC5\u987B\u7B26\u5408\u6B63\u5219\u89C4\u5219";
923
+ }
924
+ const judge = isNilOrEmpty3(viewValue);
925
+ if (judge) {
926
+ if (primaryModel) {
927
+ throw new Error("\u503C\u4E3A\u7A7A");
928
+ }
929
+ errorInfo = "\u503C\u4E3A\u7A7A";
930
+ return true;
931
+ }
932
+ const regExp = new RegExp(strReg);
933
+ if (!regExp.test(viewValue)) {
934
+ if (primaryModel) {
935
+ throw new Error(errorInfo);
936
+ }
937
+ return true;
938
+ }
939
+ errorInfo = "";
940
+ return false;
941
+ }
942
+ function checkFieldValueRangeRule(viewValue, minNumber, indexOfMin, maxNumber, indexOfMax, errorInfo, primaryModel) {
943
+ if (isNilOrEmpty3(errorInfo)) {
944
+ errorInfo = "\u503C\u5FC5\u987B\u7B26\u5408\u503C\u8303\u56F4\u89C4\u5219";
945
+ }
946
+ const isEmptyVal = isNilOrEmpty3(viewValue);
947
+ if (isEmptyVal) {
948
+ if (primaryModel) {
949
+ throw new Error("\u503C\u4E3A\u7A7A");
950
+ }
951
+ errorInfo = "\u503C\u4E3A\u7A7A";
952
+ return true;
953
+ }
954
+ const valueFormat = checkFieldRegExRule(
955
+ viewValue,
956
+ /^-?\d*\.?\d+$/,
957
+ "",
958
+ primaryModel
959
+ );
960
+ if (valueFormat) {
961
+ return true;
962
+ }
963
+ const data = Number.parseFloat(viewValue);
964
+ if (minNumber !== null) {
965
+ if (indexOfMin) {
966
+ if (data < minNumber) {
967
+ if (primaryModel) {
968
+ throw new Error(errorInfo);
969
+ }
970
+ return true;
971
+ }
972
+ } else if (data <= minNumber) {
973
+ if (primaryModel) {
974
+ throw new Error(errorInfo);
975
+ }
976
+ return true;
977
+ }
978
+ }
979
+ if (maxNumber != null) {
980
+ if (indexOfMax) {
981
+ if (data > maxNumber) {
982
+ if (primaryModel) {
983
+ throw new Error(errorInfo);
984
+ }
985
+ return true;
986
+ }
987
+ } else if (data >= maxNumber) {
988
+ if (primaryModel) {
989
+ throw new Error(errorInfo);
990
+ }
991
+ return true;
992
+ }
993
+ }
994
+ errorInfo = "";
995
+ return false;
996
+ }
997
+ function checkFieldScriptRule(value, data, scriptCode, errorInfo, primaryModel) {
998
+ if (isNilOrEmpty3(errorInfo)) {
999
+ errorInfo = "\u503C\u5FC5\u987B\u7B26\u5408\u811A\u672C\u89C4\u5219";
1000
+ }
1001
+ const source = data;
1002
+ let selfError = "";
1003
+ let resultBoolean = true;
1004
+ const callback = (error) => {
1005
+ resultBoolean = false;
1006
+ if ((error == null ? void 0 : error.length) > 0) {
1007
+ error.forEach((item) => {
1008
+ if (item == null ? void 0 : item.message) {
1009
+ selfError += item.message;
1010
+ }
1011
+ });
1012
+ } else if (error == null ? void 0 : error.message) {
1013
+ selfError = error.message;
1014
+ }
1015
+ };
1016
+ try {
1017
+ const runScript = new Function("value", "data", scriptCode);
1018
+ const result = runScript(value, source);
1019
+ if (typeof result === "boolean") {
1020
+ resultBoolean = result;
1021
+ }
1022
+ } catch (error) {
1023
+ ibiz.log.error(error);
1024
+ callback(error);
1025
+ }
1026
+ errorInfo = "";
1027
+ if (!resultBoolean && primaryModel) {
1028
+ throw new Error(errorInfo);
1029
+ }
1030
+ return { isPast: resultBoolean, infoMessage: selfError || errorInfo };
1031
+ }
1032
+
1033
+ // src/utils/verify/form-dynamic-logic.ts
1034
+ import { ModelError as ModelError2, RuntimeModelError } from "@ibiz-template/core";
1035
+ function isGroupLogic(logic) {
1036
+ return logic.logicType === "GROUP";
1037
+ }
1038
+ function isSingleLogic(logic) {
1039
+ return logic.logicType === "SINGLE";
1040
+ }
1041
+ function verifyFormGroupLogic(data, logic) {
1042
+ if (isGroupLogic(logic)) {
1043
+ const children = logic.defdlogics;
1044
+ if (!children || children.length === 0) {
1045
+ throw new RuntimeModelError(logic, "\u53D1\u73B0\u7A7A\u903B\u8F91\u7EC4\uFF0C\u903B\u8F91\u65E0\u6CD5\u6B63\u5E38\u6267\u884C\uFF01");
1046
+ }
1047
+ let result = true;
1048
+ if (logic.groupOP === "AND") {
1049
+ const falseItem = children.find((childLogic) => {
1050
+ return !verifyFormGroupLogic(data, childLogic);
1051
+ });
1052
+ result = falseItem === void 0;
1053
+ } else if (logic.groupOP === "OR") {
1054
+ const trueItem = logic.defdlogics.find(
1055
+ (childLogic) => {
1056
+ return verifyFormGroupLogic(data, childLogic);
1057
+ }
1058
+ );
1059
+ result = trueItem !== void 0;
1060
+ }
1061
+ return logic.notMode ? !result : result;
1062
+ }
1063
+ if (isSingleLogic(logic)) {
1064
+ return testCond(
1065
+ data[logic.defdname.toLowerCase()],
1066
+ logic.condOP,
1067
+ logic.value
1068
+ );
1069
+ }
1070
+ throw new ModelError2(logic, `\u672A\u652F\u6301\u7684\u903B\u8F91\u7C7B\u578B${logic.logicType}`);
1071
+ }
1072
+
1073
+ // src/utils/verify/panel-dynamic-logic.ts
1074
+ import { ModelError as ModelError3, RuntimeModelError as RuntimeModelError2 } from "@ibiz-template/core";
1075
+ function isGroupLogic2(logic) {
1076
+ return logic.logicType === "GROUP";
1077
+ }
1078
+ function isSingleLogic2(logic) {
1079
+ return logic.logicType === "SINGLE";
1080
+ }
1081
+ function verifyPanelGroupLogic(data, logic) {
1082
+ if (isGroupLogic2(logic)) {
1083
+ const children = logic.panelItemLogics;
1084
+ if (!children || children.length === 0) {
1085
+ throw new RuntimeModelError2(logic, "\u53D1\u73B0\u7A7A\u903B\u8F91\u7EC4\uFF0C\u903B\u8F91\u65E0\u6CD5\u6B63\u5E38\u6267\u884C\uFF01");
1086
+ }
1087
+ let result = true;
1088
+ if (logic.groupOP === "AND") {
1089
+ const falseItem = children.find((childLogic) => {
1090
+ return !verifyPanelGroupLogic(data, childLogic);
1091
+ });
1092
+ result = falseItem === void 0;
1093
+ } else if (logic.groupOP === "OR") {
1094
+ const trueItem = logic.panelItemLogics.find(
1095
+ (childLogic) => {
1096
+ return verifyPanelGroupLogic(data, childLogic);
1097
+ }
1098
+ );
1099
+ result = trueItem !== void 0;
1100
+ }
1101
+ return logic.notMode ? !result : result;
1102
+ }
1103
+ if (isSingleLogic2(logic)) {
1104
+ return testCond(
1105
+ data[logic.dstModelField.toLowerCase()],
1106
+ logic.condOp,
1107
+ logic.value
1108
+ );
1109
+ }
1110
+ throw new ModelError3(logic, `\u672A\u652F\u6301\u7684\u903B\u8F91\u7C7B\u578B${logic.logicType}`);
1111
+ }
1112
+
1113
+ // src/utils/wf-helper/wf-helper.ts
1114
+ function getWFContext(data) {
1115
+ const tempContext = {};
1116
+ if (data.param09) {
1117
+ tempContext.srfprocessinstanceid = data.param09;
1118
+ }
1119
+ return tempContext;
1120
+ }
1121
+
1122
+ // src/command/app/open-app-view/open-app-view.ts
1123
+ var _OpenAppViewCommand = class {
1124
+ constructor() {
1125
+ ibiz.commands.register(_OpenAppViewCommand.TAG, this.exec.bind(this));
1126
+ }
1127
+ /**
1128
+ * xhr模式打开
1129
+ *
1130
+ * @author chitanda
1131
+ * @date 2022-08-25 23:08:08
1132
+ * @param {IAppView} appView
1133
+ * @param {IContext} [context]
1134
+ * @param {IParams} [params={}]
1135
+ * @param {IData} [_opts={}]
1136
+ * @return {*} {(Promise<IModalData | void>)}
1137
+ */
1138
+ async exec(appView, context, params = {}, opts = {}) {
1139
+ if (appView.redirectView) {
1140
+ return openRedirectView(
1141
+ appView,
1142
+ context,
1143
+ params,
1144
+ opts.data
1145
+ );
1146
+ }
1147
+ const { openMode = "INDEXVIEWTAB" } = appView;
1148
+ switch (openMode) {
1149
+ case "INDEXVIEWTAB":
1150
+ return this.openIndexViewTab(appView, context, params);
1151
+ case "POPUP":
1152
+ throw new Error("\u672A\u652F\u6301\u7684\u89C6\u56FE\u6253\u5F00\u6A21\u5F0F: POPUP");
1153
+ case "POPUPMODAL":
1154
+ return this.openModal(appView, context, params);
1155
+ case "POPUPAPP":
1156
+ throw new Error("\u672A\u652F\u6301\u7684\u89C6\u56FE\u6253\u5F00\u6A21\u5F0F: POPUPAPP");
1157
+ case "POPOVER":
1158
+ return this.openPopover(appView, opts.event, context, params);
1159
+ case "DRAWER_LEFT":
1160
+ case "DRAWER_RIGHT":
1161
+ case "DRAWER_TOP":
1162
+ case "DRAWER_BOTTOM":
1163
+ return this.openDrawer(appView, context, params);
1164
+ case "USER":
1165
+ return this.openUserCustom(appView, context, params);
1166
+ default:
1167
+ return this.openIndexViewTab(appView, context, params);
1168
+ }
1169
+ }
1170
+ /**
1171
+ * 首页导航模式打开
1172
+ *
1173
+ * @author chitanda
1174
+ * @date 2022-07-25 20:07:43
1175
+ * @protected
1176
+ * @param {IAppView} appView
1177
+ * @param {IContext} [context]
1178
+ * @param {IParams} [params={}]
1179
+ */
1180
+ openIndexViewTab(appView, context, params = {}) {
1181
+ return ibiz.openView.root(appView, context, params);
1182
+ }
1183
+ /**
1184
+ * 模态窗口打开
1185
+ *
1186
+ * @author chitanda
1187
+ * @date 2022-07-25 20:07:55
1188
+ * @protected
1189
+ * @param {IAppView} appView
1190
+ * @param {IContext} [context]
1191
+ * @param {IParams} [params={}]
1192
+ * @return {*} {Promise<IModalData>}
1193
+ */
1194
+ async openModal(appView, context, params = {}) {
1195
+ return ibiz.openView.modal(appView, context, params);
1196
+ }
1197
+ /**
1198
+ * 气泡模式打开
1199
+ *
1200
+ * @author chitanda
1201
+ * @date 2022-07-25 20:07:17
1202
+ * @protected
1203
+ * @param {IAppView} appView
1204
+ * @param {IContext} [context]
1205
+ * @param {IParams} [params={}]
1206
+ * @return {*} {Promise<IModalData>}
1207
+ */
1208
+ async openPopover(appView, event, context, params = {}) {
1209
+ return ibiz.openView.popover(appView, event, context, params);
1210
+ }
1211
+ /**
1212
+ * 抽屉模式打开
1213
+ *
1214
+ * @author chitanda
1215
+ * @date 2022-07-25 20:07:08
1216
+ * @protected
1217
+ * @param {IAppView} appView
1218
+ * @param {IContext} [context]
1219
+ * @param {IParams} [params={}]
1220
+ * @return {*} {Promise<void>}
1221
+ */
1222
+ async openDrawer(appView, context, params = {}) {
1223
+ return ibiz.openView.drawer(appView, context, params);
1224
+ }
1225
+ /**
1226
+ * 用户自定义
1227
+ *
1228
+ * @author chitanda
1229
+ * @date 2022-07-25 20:07:41
1230
+ * @protected
1231
+ * @param {IAppView} appView
1232
+ * @param {IContext} [context]
1233
+ * @param {IParams} [params={}]
1234
+ * @return {*} {Promise<void>}
1235
+ */
1236
+ async openUserCustom(appView, context, params = {}) {
1237
+ return ibiz.openView.custom(appView, context, params);
1238
+ }
1239
+ };
1240
+ var OpenAppViewCommand = _OpenAppViewCommand;
1241
+ OpenAppViewCommand.TAG = "ibiz.app-view.open";
1242
+
1243
+ // src/command/index.ts
1244
+ function installCommand() {
1245
+ new AppFuncCommand();
1246
+ new OpenAppViewCommand();
1247
+ }
1248
+
1249
+ // src/provider/ui-action/backend-ui-action-provider.ts
1250
+ var BackendUIActionProvider = class {
1251
+ async getHandler() {
1252
+ if (!this.handler) {
1253
+ this.handler = new BackendUIActionHandler();
1254
+ }
1255
+ return this.handler;
1256
+ }
1257
+ };
1258
+
1259
+ // src/provider/ui-action/common-sys-ui-action-provider.ts
1260
+ var CommonSysUIActionProvider = class {
1261
+ async getHandler() {
1262
+ if (!this.handler) {
1263
+ this.handler = new CommonSysUIActionHandler();
1264
+ }
1265
+ return this.handler;
1266
+ }
1267
+ };
1268
+
1269
+ // src/provider/ui-action/front-ui-action-provider.ts
1270
+ var FrontUIActionProvider = class {
1271
+ async getHandler() {
1272
+ if (!this.handler) {
1273
+ this.handler = new FrontUIActionHandler();
1274
+ }
1275
+ return this.handler;
1276
+ }
1277
+ };
1278
+
1279
+ // src/provider/ui-action/wf-withdraw-ui-action-provider.ts
1280
+ var WFWithdrawUIActionProvider = class {
1281
+ async getHandler() {
1282
+ if (!this.handler) {
1283
+ this.handler = new WFWithdrawUIActionHandler();
1284
+ }
1285
+ return this.handler;
1286
+ }
1287
+ };
1288
+
1289
+ // src/provider/ui-action/index.ts
1290
+ function presetUIActionProvider() {
1291
+ const { uiAction } = ibiz.register;
1292
+ if (!uiAction) {
1293
+ return;
1294
+ }
1295
+ uiAction.register("FRONT", new FrontUIActionProvider());
1296
+ uiAction.register("BACKEND", new BackendUIActionProvider());
1297
+ uiAction.register("SYS_New", new CommonSysUIActionProvider());
1298
+ uiAction.register("SYS_Edit", new CommonSysUIActionProvider());
1299
+ uiAction.register("SYS_Save", new CommonSysUIActionProvider());
1300
+ uiAction.register("SYS_SaveAndExit", new CommonSysUIActionProvider());
1301
+ uiAction.register("SYS_SaveRow", new CommonSysUIActionProvider());
1302
+ uiAction.register("SYS_SaveAndNew", new CommonSysUIActionProvider());
1303
+ uiAction.register("SYS_Remove", new CommonSysUIActionProvider());
1304
+ uiAction.register("SYS_RemoveAndExit", new CommonSysUIActionProvider());
1305
+ uiAction.register("SYS_NewRow", new CommonSysUIActionProvider());
1306
+ uiAction.register("SYS_SaveAndStart", new CommonSysUIActionProvider());
1307
+ uiAction.register("SYS_ViewWFStep", new CommonSysUIActionProvider());
1308
+ uiAction.register("SYS_ToggleFilter", new CommonSysUIActionProvider());
1309
+ uiAction.register("SYS_Exit", new CommonSysUIActionProvider());
1310
+ uiAction.register("SYS_Refresh", new CommonSysUIActionProvider());
1311
+ uiAction.register("SYS_Import", new CommonSysUIActionProvider());
1312
+ uiAction.register("SYS_ExportExcel", new CommonSysUIActionProvider());
1313
+ uiAction.register("DEUIACTION_WFWithdraw", new WFWithdrawUIActionProvider());
1314
+ }
1315
+
1316
+ // src/service/utils/app-counter/app-counter.ts
1317
+ import { IBizContext } from "@ibiz-template/core";
1318
+ import { notNilEmpty as notNilEmpty3, QXEvent } from "qx-util";
1319
+ import { clone } from "ramda";
1320
+ var AppCounter = class {
1321
+ /**
1322
+ * Creates an instance of AppCounter.
1323
+ *
1324
+ * @author chitanda
1325
+ * @date 2022-10-26 20:10:55
1326
+ * @param {IAppCounter} model 应用计数器模型
1327
+ */
1328
+ constructor(model) {
1329
+ this.model = model;
1330
+ this.destroyed = false;
1331
+ this.context = IBizContext.create();
1332
+ this.params = {};
1333
+ this.evt = new QXEvent();
1334
+ /**
1335
+ * 计数器数据
1336
+ *
1337
+ * @author chitanda
1338
+ * @date 2022-10-26 19:10:08
1339
+ * @protected
1340
+ * @type {IData}
1341
+ */
1342
+ this.data = {};
1343
+ }
1344
+ /**
1345
+ * 计数器是否已经销毁
1346
+ *
1347
+ * @author chitanda
1348
+ * @date 2022-10-26 20:10:55
1349
+ * @protected
1350
+ * @type {boolean}
1351
+ */
1352
+ get isDestroyed() {
1353
+ return this.destroyed;
1354
+ }
1355
+ /**
1356
+ * 计数器初始化
1357
+ *
1358
+ * @author chitanda
1359
+ * @date 2022-10-26 19:10:24
1360
+ * @param {IParams} [context]
1361
+ * @param {IParams} [params]
1362
+ */
1363
+ async init(_context, _params) {
1364
+ }
1365
+ /**
1366
+ * 设置上下文以及查询参数
1367
+ *
1368
+ * @author chitanda
1369
+ * @date 2022-10-26 19:10:58
1370
+ * @protected
1371
+ * @param {IParams} [context]
1372
+ * @param {IParams} [params]
1373
+ */
1374
+ setParams(context, params) {
1375
+ if (context) {
1376
+ this.context = clone(context);
1377
+ }
1378
+ if (params) {
1379
+ this.params = clone(params);
1380
+ }
1381
+ }
1382
+ /**
1383
+ * 计数器定时刷新
1384
+ *
1385
+ * @author chitanda
1386
+ * @date 2022-10-26 18:10:13
1387
+ * @protected
1388
+ */
1389
+ interval() {
1390
+ this.destroyInterval();
1391
+ this.intervalTimer = setInterval(() => {
1392
+ if (this.evt.getSize("change") > 0) {
1393
+ this.load();
1394
+ }
1395
+ }, this.model.timer || 6e3);
1396
+ }
1397
+ /**
1398
+ * 销毁定时器自动刷新
1399
+ *
1400
+ * @author chitanda
1401
+ * @date 2022-10-26 18:10:31
1402
+ * @protected
1403
+ */
1404
+ destroyInterval() {
1405
+ if (this.intervalTimer) {
1406
+ clearInterval(this.intervalTimer);
1407
+ this.intervalTimer = null;
1408
+ }
1409
+ }
1410
+ /**
1411
+ * 加载计数器
1412
+ *
1413
+ * @author chitanda
1414
+ * @date 2022-10-26 19:10:38
1415
+ * @protected
1416
+ * @return {*} {Promise<IData>}
1417
+ */
1418
+ async load() {
1419
+ const res = await this.service.exec(this.action, this.context, this.params);
1420
+ if (res.ok) {
1421
+ this.data = res.data;
1422
+ this.evt.emit("change", this.data);
1423
+ }
1424
+ return this.data;
1425
+ }
1426
+ /**
1427
+ * 计数器刷新
1428
+ *
1429
+ * @author chitanda
1430
+ * @date 2022-10-26 19:10:46
1431
+ * @param {IParams} [context]
1432
+ * @param {IParams} [params]
1433
+ * @return {*} {Promise<IData>}
1434
+ */
1435
+ refresh(context, params) {
1436
+ this.setParams(context, params);
1437
+ return this.load();
1438
+ }
1439
+ /**
1440
+ * 计数器数据变更事件监听
1441
+ *
1442
+ * @author chitanda
1443
+ * @date 2022-10-26 20:10:13
1444
+ * @param {(data: IData) => void} fn
1445
+ * @param {boolean} [immediate=true] 当有计时器数据时,立即触发一次回调
1446
+ */
1447
+ onChange(fn, immediate = true) {
1448
+ this.evt.on("change", fn);
1449
+ if (immediate && notNilEmpty3(this.data)) {
1450
+ fn(this.data);
1451
+ }
1452
+ }
1453
+ /**
1454
+ * 取消计数器数据变更监听
1455
+ *
1456
+ * @author chitanda
1457
+ * @date 2022-10-26 20:10:13
1458
+ * @param {(data: IData) => void} fn
1459
+ */
1460
+ offChange(fn) {
1461
+ this.evt.off("change", fn);
1462
+ }
1463
+ /**
1464
+ * 根据计数器标识,获取计数器数值
1465
+ *
1466
+ * @author chitanda
1467
+ * @date 2022-10-26 20:10:08
1468
+ * @param {string} tag
1469
+ * @return {*} {number}
1470
+ */
1471
+ getCounter(tag) {
1472
+ return this.data[tag.toLowerCase()] || 0;
1473
+ }
1474
+ /**
1475
+ * 销毁计数器
1476
+ *
1477
+ * @author chitanda
1478
+ * @date 2022-10-26 18:10:31
1479
+ */
1480
+ destroy() {
1481
+ this.destroyed = true;
1482
+ this.context.destroy();
1483
+ this.destroyInterval();
1484
+ this.evt.reset();
1485
+ }
1486
+ };
1487
+
1488
+ // src/service/utils/de-dq-cond/ps-de-dq-cond-engine.ts
1489
+ import { isEmpty as isEmpty3 } from "ramda";
1490
+
1491
+ // src/service/utils/de-dq-cond/ps-model-cond-engine-base.ts
1492
+ var PSModelCondEngineBase = class {
1493
+ constructor() {
1494
+ /**
1495
+ * 根分组条件
1496
+ *
1497
+ * @private
1498
+ * @type {(PSModelGroupCondBase | null)}
1499
+ * @memberof PSModelCondEngineBase
1500
+ */
1501
+ this.psModelGroupCondBase = null;
1502
+ }
1503
+ /**
1504
+ * 解析条件
1505
+ *
1506
+ * @param {IDatum[]} obj
1507
+ * @memberof PSModelCondEngineBase
1508
+ */
1509
+ parse(obj) {
1510
+ if (obj instanceof Array) {
1511
+ const psModelGroupCondBase = this.createPSModelGroupCond();
1512
+ psModelGroupCondBase.parse(obj);
1513
+ this.psModelGroupCondBase = psModelGroupCondBase;
1514
+ }
1515
+ }
1516
+ /**
1517
+ * 测试项
1518
+ *
1519
+ * @protected
1520
+ * @param {string} strCondOp
1521
+ * @param {*} objValue
1522
+ * @param {*} objCondValue
1523
+ * @return {*} {boolean}
1524
+ * @memberof PSModelCondEngineBase
1525
+ */
1526
+ testSingleCond(strCondOp, objValue, objCondValue) {
1527
+ try {
1528
+ if ("ISNULL" /* CONDOP_ISNULL */ === strCondOp) {
1529
+ return objValue == null;
1530
+ }
1531
+ if ("ISNOTNULL" /* CONDOP_ISNOTNULL */ === strCondOp) {
1532
+ return objValue != null;
1533
+ }
1534
+ if ("EQ" /* CONDOP_EQ */ === strCondOp || "ABSEQ" /* CONDOP_ABSEQ */ === strCondOp || "GT" /* CONDOP_GT */ === strCondOp || "GTANDEQ" /* CONDOP_GTANDEQ */ === strCondOp || "LT" /* CONDOP_LT */ === strCondOp || "LTANDEQ" /* CONDOP_LTANDEQ */ === strCondOp || "NOTEQ" /* CONDOP_NOTEQ */ === strCondOp) {
1535
+ let nRet = -1;
1536
+ if (objValue == objCondValue) {
1537
+ nRet = 0;
1538
+ } else if (objValue > objCondValue) {
1539
+ nRet = 1;
1540
+ }
1541
+ if ("EQ" /* CONDOP_EQ */ === strCondOp || "ABSEQ" /* CONDOP_ABSEQ */ === strCondOp) {
1542
+ return nRet === 0;
1543
+ }
1544
+ if ("GT" /* CONDOP_GT */ === strCondOp) {
1545
+ return nRet > 0;
1546
+ }
1547
+ if ("GTANDEQ" /* CONDOP_GTANDEQ */ === strCondOp) {
1548
+ return nRet >= 0;
1549
+ }
1550
+ if ("LT" /* CONDOP_LT */ === strCondOp) {
1551
+ return nRet < 0;
1552
+ }
1553
+ if ("LTANDEQ" /* CONDOP_LTANDEQ */ === strCondOp) {
1554
+ return nRet <= 0;
1555
+ }
1556
+ if ("NOTEQ" /* CONDOP_NOTEQ */ === strCondOp) {
1557
+ return nRet !== 0;
1558
+ }
1559
+ }
1560
+ if ("LIKE" /* CONDOP_LIKE */ === strCondOp) {
1561
+ if (objValue != null && objCondValue != null) {
1562
+ return objValue.toString().toUpperCase().indexOf(objCondValue.toString().toUpperCase()) !== -1;
1563
+ }
1564
+ return false;
1565
+ }
1566
+ if ("LEFTLIKE" /* CONDOP_LEFTLIKE */ === strCondOp) {
1567
+ if (objValue != null && objCondValue != null) {
1568
+ return objValue.toString().toUpperCase().indexOf(objCondValue.toString().toUpperCase()) === 0;
1569
+ }
1570
+ return false;
1571
+ }
1572
+ } catch (err) {
1573
+ ibiz.log.error(err);
1574
+ }
1575
+ return false;
1576
+ }
1577
+ /**
1578
+ * 获取根分组条件
1579
+ *
1580
+ * @return {*} {PSModelGroupCondBase}
1581
+ * @memberof PSModelCondEngineBase
1582
+ */
1583
+ getPSModelGroupCondBase() {
1584
+ return this.psModelGroupCondBase;
1585
+ }
1586
+ };
1587
+
1588
+ // src/service/utils/de-dq-cond/ps-model-cond-base.ts
1589
+ var PSModelCondBase = class {
1590
+ constructor() {
1591
+ this.strCondOp = null;
1592
+ }
1593
+ getCondOp() {
1594
+ return this.strCondOp;
1595
+ }
1596
+ setCondOp(strCondOp) {
1597
+ this.strCondOp = strCondOp;
1598
+ }
1599
+ };
1600
+
1601
+ // src/service/utils/de-dq-cond/ps-model-single-cond-base.ts
1602
+ var PSModelSingleCondBase = class extends PSModelCondBase {
1603
+ /**
1604
+ * 编译条件
1605
+ *
1606
+ * @author chitanda
1607
+ * @date 2022-08-17 23:08:35
1608
+ * @param {unknown[]} arr
1609
+ */
1610
+ parse(arr) {
1611
+ const nCount = arr.length;
1612
+ let bOpStart = true;
1613
+ let bParamStart = false;
1614
+ let bValueStart = false;
1615
+ for (let i = 0; i < nCount; i++) {
1616
+ if (bOpStart) {
1617
+ const strText = arr[i];
1618
+ this.setCondOp(strText);
1619
+ bOpStart = false;
1620
+ bParamStart = true;
1621
+ continue;
1622
+ }
1623
+ if (bParamStart) {
1624
+ const strText = arr[i];
1625
+ this.setParam(strText);
1626
+ bParamStart = false;
1627
+ bValueStart = true;
1628
+ continue;
1629
+ }
1630
+ if (bValueStart) {
1631
+ const obj = arr[i];
1632
+ if (obj instanceof Object && !(obj instanceof Array)) {
1633
+ const data = obj;
1634
+ if (data.type != null) {
1635
+ this.setValueType(data.type.toString());
1636
+ }
1637
+ if (data.value != null) {
1638
+ this.setValue(data.value.toString());
1639
+ }
1640
+ } else {
1641
+ this.setValue(obj);
1642
+ }
1643
+ break;
1644
+ }
1645
+ }
1646
+ }
1647
+ getValueType() {
1648
+ return this.strValueType;
1649
+ }
1650
+ setValueType(strValueType) {
1651
+ this.strValueType = strValueType;
1652
+ }
1653
+ getValue() {
1654
+ return this.strValue;
1655
+ }
1656
+ setValue(strValue) {
1657
+ this.strValue = strValue;
1658
+ }
1659
+ getParamType() {
1660
+ return this.strParamType;
1661
+ }
1662
+ setParamType(strParamType) {
1663
+ this.strParamType = strParamType;
1664
+ }
1665
+ getParam() {
1666
+ return this.strParam;
1667
+ }
1668
+ setParam(strParam) {
1669
+ this.strParam = strParam;
1670
+ }
1671
+ };
1672
+
1673
+ // src/service/utils/de-dq-cond/ps-model-group-cond-base.ts
1674
+ var PSModelGroupCondBase = class extends PSModelCondBase {
1675
+ constructor() {
1676
+ super(...arguments);
1677
+ /**
1678
+ * 子条件项
1679
+ *
1680
+ * @private
1681
+ * @type {PSModelCondBase[]}
1682
+ * @memberof PSModelGroupCondBase
1683
+ */
1684
+ this.childCondList = [];
1685
+ /**
1686
+ * 是否取反
1687
+ *
1688
+ * @private
1689
+ * @memberof PSModelGroupCondBase
1690
+ */
1691
+ this.bNotMode = false;
1692
+ }
1693
+ /**
1694
+ * 解析分组条件
1695
+ *
1696
+ * @param {unknown[]} arr
1697
+ * @memberof PSModelGroupCondBase
1698
+ */
1699
+ parse(arr) {
1700
+ const nCount = arr.length;
1701
+ let bNotStart = true;
1702
+ let bOpStart = true;
1703
+ let bCondStart = false;
1704
+ for (let i = 0; i < nCount; i++) {
1705
+ if (bNotStart && bOpStart) {
1706
+ const strText = arr[i];
1707
+ if (strText === "!") {
1708
+ this.setNotMode(true);
1709
+ bNotStart = false;
1710
+ continue;
1711
+ }
1712
+ }
1713
+ if (bOpStart) {
1714
+ const strText = arr[i];
1715
+ this.setCondOp(strText);
1716
+ bOpStart = false;
1717
+ bNotStart = false;
1718
+ bCondStart = true;
1719
+ continue;
1720
+ }
1721
+ if (bCondStart) {
1722
+ const list = arr[i];
1723
+ if (list instanceof Array) {
1724
+ list.forEach((item) => {
1725
+ if (item.length > 0) {
1726
+ const strText = item[0].toString();
1727
+ if (strText === "!" || "OR" /* GROUPOP_OR */ === strText || "AND" /* GROUPOP_AND */ === strText) {
1728
+ const child = new PSModelGroupCondBase();
1729
+ child.parse(item);
1730
+ this.childCondList.push(child);
1731
+ } else {
1732
+ const child = new PSModelSingleCondBase();
1733
+ child.parse(item);
1734
+ this.childCondList.push(child);
1735
+ }
1736
+ }
1737
+ });
1738
+ } else {
1739
+ throw new Error("\u503C\u5FC5\u987B\u4E3A\u6570\u7EC4");
1740
+ }
1741
+ }
1742
+ }
1743
+ }
1744
+ setNotMode(bNotMode) {
1745
+ this.bNotMode = bNotMode;
1746
+ }
1747
+ isNotMode() {
1748
+ return this.bNotMode;
1749
+ }
1750
+ getChildPSModelCondBases() {
1751
+ return this.childCondList;
1752
+ }
1753
+ };
1754
+
1755
+ // src/service/utils/de-dq-cond/ps-model-group-cond.ts
1756
+ var PSDEDQGroupCond = class extends PSModelGroupCondBase {
1757
+ };
1758
+
1759
+ // src/service/utils/de-dq-cond/ps-model-single-cond.ts
1760
+ var PSDEDQSingleCond = class extends PSModelSingleCondBase {
1761
+ };
1762
+
1763
+ // src/service/utils/de-dq-cond/ps-de-dq-cond-engine.ts
1764
+ var _PSDEDQCondEngine = class extends PSModelCondEngineBase {
1765
+ /**
1766
+ * 测试
1767
+ *
1768
+ * @param {IData} data 检测的数据
1769
+ * @param {SearchFilter} filter 过滤条件
1770
+ * @return {*} {boolean}
1771
+ * @memberof PSDEDQCondEngine
1772
+ */
1773
+ test(data, filter) {
1774
+ return this.testCond(this.getPSModelGroupCondBase(), data, filter);
1775
+ }
1776
+ /**
1777
+ * 查询条件判断
1778
+ *
1779
+ * @author chitanda
1780
+ * @date 2022-08-17 23:08:11
1781
+ * @protected
1782
+ * @param {PSModelCondBase} cond
1783
+ * @param {IData} data
1784
+ * @param {SearchFilter} filter
1785
+ * @return {*} {boolean}
1786
+ */
1787
+ testCond(cond, data, filter) {
1788
+ if (cond instanceof PSModelGroupCondBase) {
1789
+ const list = cond.getChildPSModelCondBases();
1790
+ if (list == null || isEmpty3(list)) {
1791
+ return !cond.isNotMode();
1792
+ }
1793
+ const bAnd = "AND" /* GROUPOP_AND */ === cond.getCondOp();
1794
+ let bRet = bAnd;
1795
+ for (let i = 0; i < list.length; i++) {
1796
+ const childCond = list[i];
1797
+ if (this.testCond(childCond, data, filter)) {
1798
+ if (!bAnd) {
1799
+ bRet = true;
1800
+ break;
1801
+ }
1802
+ } else if (bAnd) {
1803
+ bRet = false;
1804
+ break;
1805
+ }
1806
+ }
1807
+ if (cond.isNotMode()) {
1808
+ return !bRet;
1809
+ }
1810
+ return bRet;
1811
+ }
1812
+ if (cond instanceof PSModelSingleCondBase) {
1813
+ if (isEmpty3(cond.getParam())) {
1814
+ ibiz.log.warn("\u6CA1\u6709\u6307\u5B9A\u5C5E\u6027\u540D\u79F0", cond);
1815
+ }
1816
+ const objValue = data[cond.getParam().toLowerCase()];
1817
+ let objCondValue = null;
1818
+ const valType = cond.getValueType();
1819
+ const val = cond.getValue();
1820
+ if (valType != null && !isEmpty3(valType)) {
1821
+ if (isEmpty3(val)) {
1822
+ ibiz.log.warn("\u6CA1\u6709\u6307\u5B9A\u4E0A\u4E0B\u6587\u53C2\u6570\u540D\u79F0");
1823
+ }
1824
+ if (_PSDEDQCondEngine.PARAMTYPE_WEBCONTEXT === valType) {
1825
+ objCondValue = filter.data[val.toLowerCase()];
1826
+ } else if (_PSDEDQCondEngine.PARAMTYPE_DATACONTEXT === valType) {
1827
+ objCondValue = filter.getValue(val.toLowerCase());
1828
+ }
1829
+ } else {
1830
+ objCondValue = cond.getValue();
1831
+ }
1832
+ return this.testSingleCond(cond.getCondOp(), objValue, objCondValue);
1833
+ }
1834
+ ibiz.log.warn(`\u65E0\u6CD5\u8BC6\u522B\u7684\u6761\u4EF6\u5BF9\u8C61`, cond);
1835
+ return false;
1836
+ }
1837
+ createPSModelSingleCond() {
1838
+ return new PSDEDQSingleCond();
1839
+ }
1840
+ createPSModelGroupCond() {
1841
+ return new PSDEDQGroupCond();
1842
+ }
1843
+ };
1844
+ var PSDEDQCondEngine = _PSDEDQCondEngine;
1845
+ /**
1846
+ * 数据上下文
1847
+ *
1848
+ * @static
1849
+ * @memberof PSDEDQCondEngine
1850
+ */
1851
+ PSDEDQCondEngine.PARAMTYPE_DATACONTEXT = "DATACONTEXT";
1852
+ /**
1853
+ * 网页请求上下文
1854
+ *
1855
+ * @static
1856
+ * @memberof PSDEDQCondEngine
1857
+ */
1858
+ PSDEDQCondEngine.PARAMTYPE_WEBCONTEXT = "WEBCONTEXT";
1859
+
1860
+ // src/service/utils/de-dq-cond-util/de-dq-cond-util.ts
1861
+ var DEDQCondUtil = class {
1862
+ /**
1863
+ * 根据数据查询获取查询
1864
+ *
1865
+ * @author chitanda
1866
+ * @date 2022-08-25 17:08:04
1867
+ * @static
1868
+ * @param {IAppDEDataSet} dataSet
1869
+ * @return {*} {PSDEDQCondEngine}
1870
+ */
1871
+ static getCond(dataSet) {
1872
+ if (this.map.has(dataSet)) {
1873
+ return this.map.get(dataSet);
1874
+ }
1875
+ const groups = dataSet.dedqgroupConditions;
1876
+ if (groups) {
1877
+ const cond = new PSDEDQCondEngine();
1878
+ cond.parse(["OR", this.calcCond(groups)]);
1879
+ this.map.set(dataSet, cond);
1880
+ return cond;
1881
+ }
1882
+ return null;
1883
+ }
1884
+ /**
1885
+ * 计算查询条件
1886
+ *
1887
+ * @author chitanda
1888
+ * @date 2022-08-25 17:08:39
1889
+ * @protected
1890
+ * @static
1891
+ * @param {IDEDQCondition[]} items
1892
+ * @return {*} {unknown[]}
1893
+ */
1894
+ static calcCond(items) {
1895
+ const arr = [];
1896
+ items.forEach((item) => {
1897
+ const condArr = [];
1898
+ if (item.condType === "GROUP") {
1899
+ const cond = item;
1900
+ if (cond.notMode) {
1901
+ condArr.push("!");
1902
+ }
1903
+ condArr.push(item.condOp);
1904
+ const children = cond.dedqconditions;
1905
+ if (children) {
1906
+ const child = this.calcCond(children);
1907
+ condArr.push(child);
1908
+ }
1909
+ } else if (item.condType === "SINGLE") {
1910
+ const cond = item;
1911
+ condArr.push(cond.fieldName);
1912
+ if (cond.condValue) {
1913
+ } else {
1914
+ condArr.push("");
1915
+ }
1916
+ } else {
1917
+ throw new Error(`\u6682\u672A\u652F\u6301\u7684\u67E5\u8BE2\u6761\u4EF6\u7C7B\u578B: ${item.condType}`);
1918
+ }
1919
+ arr.push(condArr);
1920
+ });
1921
+ return arr;
1922
+ }
1923
+ };
1924
+ /**
1925
+ * 查询条件缓存
1926
+ *
1927
+ * @author chitanda
1928
+ * @date 2022-08-25 17:08:57
1929
+ * @protected
1930
+ * @static
1931
+ * @type {WeakMap<IAppDEDataSet, PSDEDQCondEngine>}
1932
+ */
1933
+ DEDQCondUtil.map = /* @__PURE__ */ new WeakMap();
1934
+
1935
+ // src/service/utils/dynamic-code-list/dynamic-code-list.ts
1936
+ import { ModelError as ModelError4 } from "@ibiz-template/core";
1937
+ var DynamicCodeListCache = class {
1938
+ constructor(codeList) {
1939
+ /**
1940
+ * 缓存的map,key是context和params合成的字符串
1941
+ *
1942
+ * @author lxm
1943
+ * @date 2022-08-26 14:08:19
1944
+ * @protected
1945
+ */
1946
+ this.cache = /* @__PURE__ */ new Map();
1947
+ /**
1948
+ * 是否是预定义类型
1949
+ *
1950
+ * @author lxm
1951
+ * @date 2022-10-20 10:10:48
1952
+ * @protected
1953
+ * @type {boolean}
1954
+ */
1955
+ this.isPredefined = false;
1956
+ this.codeList = codeList;
1957
+ }
1958
+ /**
1959
+ * 初始化
1960
+ *
1961
+ * @author lxm
1962
+ * @date 2022-08-26 14:08:28
1963
+ * @returns {*} {Promise<void>}
1964
+ */
1965
+ async init() {
1966
+ const fn = async () => {
1967
+ const { predefinedType } = this.codeList;
1968
+ if (predefinedType) {
1969
+ this.isPredefined = true;
1970
+ if (!["OPERATOR", "RUNTIME"].includes(predefinedType)) {
1971
+ throw new ModelError4(
1972
+ this.codeList,
1973
+ `\u9884\u5B9A\u4E49\u7C7B\u578B${predefinedType}\u6682\u4E0D\u652F\u6301`
1974
+ );
1975
+ }
1976
+ return;
1977
+ }
1978
+ this.initPromise = void 0;
1979
+ };
1980
+ this.initPromise = fn();
1981
+ return this.initPromise;
1982
+ }
1983
+ /**
1984
+ * 把数据转换成代码项
1985
+ *
1986
+ * @author lxm
1987
+ * @date 2022-08-26 15:08:24
1988
+ * @param {IData} data
1989
+ * @returns {*}
1990
+ */
1991
+ convertData(_data) {
1992
+ const result = {};
1993
+ return Object.freeze(result);
1994
+ }
1995
+ /**
1996
+ * 加载服务获取数据,返回代码项
1997
+ *
1998
+ * @author lxm
1999
+ * @date 2022-08-26 14:08:08
2000
+ * @protected
2001
+ * @param {IParams} [context={}]
2002
+ * @param {IParams} [params={}]
2003
+ * @returns {*} {Promise<CodeListItem[]>}
2004
+ */
2005
+ async load(_context = {}, params = {}) {
2006
+ if (this.isPredefined) {
2007
+ if (!params.size) {
2008
+ params.size = 1e4;
2009
+ }
2010
+ const res = await this.app.net.get(
2011
+ `/dictionaries/codelist/${this.codeList.codeName}`,
2012
+ params
2013
+ );
2014
+ return Object.freeze(res.data.items);
2015
+ }
2016
+ if (!this.entity || !this.methodName) {
2017
+ new Error("\u52A8\u6001\u4EE3\u7801\u8868\u627E\u4E0D\u5230\u5B9E\u4F53\u6216\u6570\u636E\u96C6");
2018
+ }
2019
+ return [];
2020
+ }
2021
+ /**
2022
+ * 获取动态的代码项
2023
+ *
2024
+ * @author lxm
2025
+ * @date 2022-08-26 14:08:44
2026
+ * @param {IParams} [context={}]
2027
+ * @param {IParams} [params={}]
2028
+ * @returns {*} {Promise<IData[]>}
2029
+ */
2030
+ async get(context = {}, params = {}) {
2031
+ if (this.initPromise) {
2032
+ await this.initPromise;
2033
+ }
2034
+ if (!this.codeList.enableCache) {
2035
+ return this.load(context, params);
2036
+ }
2037
+ const key = JSON.stringify(context) + JSON.stringify(params);
2038
+ if (this.cache.has(key)) {
2039
+ const cacheData2 = this.cache.get(key);
2040
+ if (cacheData2.expirationTime > (/* @__PURE__ */ new Date()).getTime()) {
2041
+ return cacheData2.promise ? cacheData2.promise : cacheData2.items;
2042
+ }
2043
+ this.cache.delete(key);
2044
+ }
2045
+ const promise = this.load(context, params);
2046
+ const waitTime = this.codeList.cacheTimeout === -1 ? ibiz.config.defaultCodeListCacheTimeout : this.codeList.cacheTimeout;
2047
+ const cacheData = {
2048
+ expirationTime: (/* @__PURE__ */ new Date()).getTime() + waitTime,
2049
+ promise
2050
+ };
2051
+ this.cache.set(key, cacheData);
2052
+ const result = await promise;
2053
+ cacheData.items = result;
2054
+ delete cacheData.promise;
2055
+ return result;
2056
+ }
2057
+ };
2058
+
2059
+ // src/service/utils/entity-cache/entity-cache.ts
2060
+ import { where, equals, clone as clone2, isNil as isNil4, isEmpty as isEmpty5 } from "ramda";
2061
+ import { createUUID } from "qx-util";
2062
+
2063
+ // src/service/utils/service-exist-util/service-exist-util.ts
2064
+ import { RuntimeError as RuntimeError3 } from "@ibiz-template/core";
2065
+ import { isEmpty as isEmpty4, isNil as isNil3 } from "ramda";
2066
+ function isExistSrfKey(funcName, entity) {
2067
+ if (entity != null) {
2068
+ const { srfkey } = entity;
2069
+ if (!isNil3(srfkey) && !isEmpty4(srfkey)) {
2070
+ return true;
2071
+ }
2072
+ }
2073
+ throw new RuntimeError3(`\u6267\u884C\u300C${funcName}\u300D\u4E0D\u5B58\u5728\u300Csrfkey\u300D\u65E0\u6CD5\u5904\u7406`);
2074
+ }
2075
+ function isExistSessionId(funcName, context) {
2076
+ const { srfsessionid } = context;
2077
+ if (!isNil3(srfsessionid) && !isEmpty4(srfsessionid)) {
2078
+ return true;
2079
+ }
2080
+ throw new RuntimeError3(`\u6267\u884C\u300C${funcName}\u300D\u4E0D\u5B58\u5728\u300Csrfsessionid\u300D\u65E0\u6CD5\u5904\u7406`);
2081
+ }
2082
+
2083
+ // src/service/utils/entity-cache/entity-cache.ts
2084
+ var EntityCache = class {
2085
+ constructor() {
2086
+ /**
2087
+ * 数据缓存
2088
+ *
2089
+ * @author chitanda
2090
+ * @date 2022-08-17 23:08:08
2091
+ * @type {Map<string, Map<string, Entity>>}
2092
+ */
2093
+ this.cacheMap = /* @__PURE__ */ new Map();
2094
+ }
2095
+ /**
2096
+ * 强制设置数据,忽略其他逻辑
2097
+ *
2098
+ * @author chitanda
2099
+ * @date 2022-05-10 17:05:45
2100
+ * @param {IParams} context
2101
+ * @param {Entity} entity
2102
+ */
2103
+ forceAdd(context, entity) {
2104
+ const map = this.getCacheByTag(context);
2105
+ const data = map.get(entity.srfkey);
2106
+ if (data) {
2107
+ data.assign(entity);
2108
+ ibiz.log.warn("forceAdd", entity.srfkey, entity);
2109
+ }
2110
+ }
2111
+ /**
2112
+ * 强制更新数据,非合并,忽略其他逻辑
2113
+ *
2114
+ * @author chitanda
2115
+ * @date 2022-05-10 17:05:27
2116
+ * @param {IParams} context
2117
+ * @param {Entity} entity
2118
+ */
2119
+ forceUpdate(context, entity) {
2120
+ const map = this.getCacheByTag(context);
2121
+ map.set(entity.srfkey, clone2(entity));
2122
+ ibiz.log.warn("forceUpdate", entity.srfkey, entity);
2123
+ }
2124
+ /**
2125
+ * 强制删除数据,忽略其他逻辑
2126
+ *
2127
+ * @author chitanda
2128
+ * @date 2022-05-10 17:05:08
2129
+ * @param {IParams} context
2130
+ * @param {string} srfKey
2131
+ */
2132
+ forceDelete(context, srfKey) {
2133
+ const map = this.getCacheByTag(context);
2134
+ map.delete(srfKey);
2135
+ ibiz.log.warn("forceDelete", srfKey);
2136
+ }
2137
+ /**
2138
+ * 新增数据
2139
+ *
2140
+ * @param {*} context
2141
+ * @param {Entity} entity
2142
+ * @return {*} {boolean}
2143
+ * @memberof EntityCache
2144
+ */
2145
+ add(context, entity) {
2146
+ try {
2147
+ isExistSessionId("add", context);
2148
+ if (isNil4(entity.srfkey) || isEmpty5(entity.srfkey)) {
2149
+ entity.srfkey = createUUID();
2150
+ }
2151
+ entity.srftempdate = (/* @__PURE__ */ new Date()).getTime();
2152
+ const map = this.getCacheByTag(context);
2153
+ map.set(entity.srfkey, clone2(entity));
2154
+ ibiz.log.warn("add", entity.srfkey, entity);
2155
+ return entity;
2156
+ } catch (err) {
2157
+ ibiz.log.error(err);
2158
+ return null;
2159
+ }
2160
+ }
2161
+ /**
2162
+ * 查找数据
2163
+ *
2164
+ * @param {*} context
2165
+ * @param {string} srfKey
2166
+ * @return {*} {Entity}
2167
+ * @memberof EntityCache
2168
+ */
2169
+ get(context, srfKey) {
2170
+ try {
2171
+ isExistSessionId("get", context);
2172
+ const map = this.getCacheByTag(context);
2173
+ const data = map.get(srfKey);
2174
+ ibiz.log.warn("get", srfKey, data);
2175
+ return clone2(data);
2176
+ } catch (err) {
2177
+ ibiz.log.error(err);
2178
+ return null;
2179
+ }
2180
+ }
2181
+ /**
2182
+ * 更新数据
2183
+ *
2184
+ * @param {IParams} context
2185
+ * @param {Entity} entity
2186
+ * @return {*} {Entity}
2187
+ * @memberof EntityCache
2188
+ */
2189
+ update(context, entity) {
2190
+ try {
2191
+ isExistSessionId("update", context);
2192
+ isExistSrfKey("update", entity);
2193
+ entity.srftempdate = (/* @__PURE__ */ new Date()).getTime();
2194
+ const map = this.getCacheByTag(context);
2195
+ const data = map.get(entity.srfkey);
2196
+ if (data) {
2197
+ data.assign(entity);
2198
+ map.set(entity.srfkey, data);
2199
+ ibiz.log.warn("update", entity.srfkey, entity);
2200
+ return clone2(data);
2201
+ }
2202
+ throw new Error("\u6570\u636E\u4E0D\u5B58\u5728\uFF0C\u65E0\u6CD5\u66F4\u65B0!");
2203
+ } catch (err) {
2204
+ ibiz.log.error(err);
2205
+ return null;
2206
+ }
2207
+ }
2208
+ /**
2209
+ * 删除数据
2210
+ *
2211
+ * @param {IParams} context
2212
+ * @param {string} srfKey
2213
+ * @return {*} {(Entity | null)}
2214
+ * @memberof EntityCache
2215
+ */
2216
+ delete(context, srfKey) {
2217
+ try {
2218
+ isExistSessionId("delete", context);
2219
+ const map = this.getCacheByTag(context);
2220
+ const key = srfKey;
2221
+ if (map.has(key)) {
2222
+ const data = map.get(key);
2223
+ data.srftempdate = (/* @__PURE__ */ new Date()).getTime();
2224
+ map.delete(key);
2225
+ ibiz.log.warn("delete", key);
2226
+ return data;
2227
+ }
2228
+ return null;
2229
+ } catch (err) {
2230
+ ibiz.log.error(err);
2231
+ return null;
2232
+ }
2233
+ }
2234
+ /**
2235
+ * 批量创建临时数据
2236
+ *
2237
+ * @author chitanda
2238
+ * @date 2022-03-23 11:03:52
2239
+ * @param {IParams} context
2240
+ * @param {Entity[]} entities
2241
+ * @return {*} {Entity[]}
2242
+ */
2243
+ createBatch(context, entities) {
2244
+ try {
2245
+ isExistSessionId("add", context);
2246
+ const map = this.getCacheByTag(context);
2247
+ for (let i = 0; i < entities.length; i++) {
2248
+ const entity = entities[i];
2249
+ if (isNil4(entity.srfkey) || isEmpty5(entity.srfkey)) {
2250
+ entity.srfkey = createUUID();
2251
+ }
2252
+ entity.srftempdate = (/* @__PURE__ */ new Date()).getTime();
2253
+ const data = clone2(entity);
2254
+ map.set(entity.srfkey, data);
2255
+ entities[i] = data;
2256
+ ibiz.log.warn("add", entity.srfkey, entity);
2257
+ }
2258
+ return entities;
2259
+ } catch (err) {
2260
+ ibiz.log.error(err);
2261
+ }
2262
+ return [];
2263
+ }
2264
+ /**
2265
+ * 批量更新数据
2266
+ *
2267
+ * @author chitanda
2268
+ * @date 2022-03-23 10:03:17
2269
+ * @param {IParams} context
2270
+ * @param {Entity[]} entities
2271
+ * @return {*} {Entity[]}
2272
+ */
2273
+ updateBatch(context, entities) {
2274
+ try {
2275
+ isExistSessionId("update", context);
2276
+ const map = this.getCacheByTag(context);
2277
+ for (let i = 0; i < entities.length; i++) {
2278
+ const entity = entities[i];
2279
+ isExistSrfKey("update", entity);
2280
+ entity.srftempdate = (/* @__PURE__ */ new Date()).getTime();
2281
+ const data = map.get(entity.srfkey);
2282
+ if (data) {
2283
+ data.assign(entity);
2284
+ map.set(entity.srfkey, data);
2285
+ ibiz.log.warn("update", entity.srfkey, entity);
2286
+ entities[i] = clone2(data);
2287
+ } else {
2288
+ throw new Error(
2289
+ `\u6570\u636E[${entity.srfdename}-${entity.srfmajortext}(${entity.srfkey})]\u4E0D\u5B58\u5728\uFF0C\u65E0\u6CD5\u66F4\u65B0!`
2290
+ );
2291
+ }
2292
+ }
2293
+ return entities;
2294
+ } catch (err) {
2295
+ ibiz.log.error(err);
2296
+ return null;
2297
+ }
2298
+ }
2299
+ /**
2300
+ * 批量删除数据
2301
+ *
2302
+ * @author chitanda
2303
+ * @date 2022-03-23 10:03:40
2304
+ * @param {IParams} context 上下文
2305
+ * @param {string[]} srfKeys 需要删除的数据主键
2306
+ * @return {*} {string[]} 未能删除的数据主键
2307
+ */
2308
+ deleteBatch(context, srfKeys) {
2309
+ try {
2310
+ isExistSessionId("delete", context);
2311
+ } catch (err) {
2312
+ ibiz.log.error(err);
2313
+ return srfKeys;
2314
+ }
2315
+ const map = this.getCacheByTag(context);
2316
+ const notRemoveKeys = [];
2317
+ for (let i = 0; i < srfKeys.length; i++) {
2318
+ const key = srfKeys[i];
2319
+ if (!map.has(key)) {
2320
+ notRemoveKeys.push(key);
2321
+ }
2322
+ }
2323
+ if (notRemoveKeys.length > 0) {
2324
+ throw new Error(
2325
+ `\u672A\u627E\u5230\u4EE5\u4E0B\u6570\u636E\u300C${notRemoveKeys.join("\u3001")}\u300D\uFF0C\u65E0\u6CD5\u5220\u9664!`
2326
+ );
2327
+ }
2328
+ for (let i = 0; i < srfKeys.length; i++) {
2329
+ const key = srfKeys[i];
2330
+ map.delete(key);
2331
+ ibiz.log.warn("delete", key);
2332
+ }
2333
+ return [];
2334
+ }
2335
+ /**
2336
+ * 检查数据是否已经存在
2337
+ *
2338
+ * @author chitanda
2339
+ * @date 2022-08-17 23:08:06
2340
+ * @param {IParams} context
2341
+ * @param {string} srfkey
2342
+ * @return {*} {boolean}
2343
+ */
2344
+ checkData(context, srfkey) {
2345
+ const list = this.getList(context);
2346
+ const i = list.findIndex((item) => item.srfkey === srfkey);
2347
+ return i !== -1;
2348
+ }
2349
+ /**
2350
+ * 根据条件查找数据,未设置条件默认返回全部
2351
+ *
2352
+ * @author chitanda
2353
+ * @date 2022-08-17 23:08:56
2354
+ * @param {IParams} context
2355
+ * @return {*} {Entity[]}
2356
+ */
2357
+ getList(context) {
2358
+ try {
2359
+ isExistSessionId("getList", context);
2360
+ const map = this.getCacheByTag(context);
2361
+ if (!map) {
2362
+ return [];
2363
+ }
2364
+ const values = map.values();
2365
+ return Array.from(values);
2366
+ } catch (err) {
2367
+ ibiz.log.error(err);
2368
+ return [];
2369
+ }
2370
+ }
2371
+ /**
2372
+ * 根据条件生成查询
2373
+ *
2374
+ * @author chitanda
2375
+ * @date 2022-08-17 23:08:33
2376
+ * @param {IParams} [params={}]
2377
+ * @return {*} {<U>(testObj: U) => boolean}
2378
+ */
2379
+ generatePred(params = {}) {
2380
+ const data = {};
2381
+ if (params.srfkey) {
2382
+ data.srfkey = equals(params.srfkey);
2383
+ }
2384
+ delete params.srfkey;
2385
+ for (const key in params) {
2386
+ if (Object.prototype.hasOwnProperty.call(params, key)) {
2387
+ const val = params[key];
2388
+ data[key] = equals(val);
2389
+ }
2390
+ }
2391
+ return where(data);
2392
+ }
2393
+ /**
2394
+ * 清除缓存
2395
+ *
2396
+ * @author chitanda
2397
+ * @date 2022-08-17 23:08:54
2398
+ * @param {IParams} context
2399
+ */
2400
+ clear(context) {
2401
+ const tag = context.srfsessionid;
2402
+ if (this.cacheMap.size > 0) {
2403
+ this.cacheMap.delete(tag);
2404
+ }
2405
+ }
2406
+ /**
2407
+ * 根据标识获取map组
2408
+ *
2409
+ * @author chitanda
2410
+ * @date 2022-08-17 23:08:47
2411
+ * @private
2412
+ * @param {IParams} context
2413
+ * @return {*} {Map<string, Entity>}
2414
+ */
2415
+ getCacheByTag(context) {
2416
+ const tag = context.srfsessionid;
2417
+ if (!this.cacheMap.has(tag)) {
2418
+ this.cacheMap.set(tag, /* @__PURE__ */ new Map());
2419
+ }
2420
+ return this.cacheMap.get(tag);
2421
+ }
2422
+ };
2423
+
2424
+ // src/service/utils/res-path/res-path.ts
2425
+ function calcResPath(context, pathItems) {
2426
+ let paths = [];
2427
+ pathItems.forEach((items) => {
2428
+ let values = [];
2429
+ for (let i = 0; i < items.length - 1; i++) {
2430
+ const item = items[i];
2431
+ const val = context[item.name];
2432
+ if (val) {
2433
+ values.push(item.plural);
2434
+ values.push(val);
2435
+ } else {
2436
+ values = [];
2437
+ }
2438
+ }
2439
+ paths.push(values);
2440
+ });
2441
+ paths = paths.sort((a, b) => b.length - a.length);
2442
+ const [pathArr] = paths;
2443
+ if (pathArr) {
2444
+ return `${pathArr.length > 1 ? "/" : ""}${pathArr.join("/")}`;
2445
+ }
2446
+ return "";
2447
+ }
2448
+
2449
+ // src/constant/control-type/control-type.ts
2450
+ var ControlType = /* @__PURE__ */ ((ControlType2) => {
2451
+ ControlType2["APP_MENU"] = "APPMENU";
2452
+ ControlType2["GRID"] = "GRID";
2453
+ ControlType2["FORM"] = "FORM";
2454
+ ControlType2["SEARCHFORM"] = "SEARCHFORM";
2455
+ ControlType2["TOOLBAR"] = "TOOLBAR";
2456
+ ControlType2["DRBAR"] = "DRBAR";
2457
+ ControlType2["VIEWPANEL"] = "VIEWPANEL";
2458
+ ControlType2["PICKUP_VIEW_PANEL"] = "PICKUPVIEWPANEL";
2459
+ ControlType2["DATAVIEW"] = "DATAVIEW";
2460
+ ControlType2["TREEGRID"] = "TREEGRID";
2461
+ ControlType2["WF_EXPBAR"] = "WFEXPBAR";
2462
+ ControlType2["TREEVIEW"] = "TREEVIEW";
2463
+ ControlType2["TREE_EXP_BAR"] = "TREEEXPBAR";
2464
+ ControlType2["TAB_VIEWPANEL"] = "TABVIEWPANEL";
2465
+ ControlType2["DRTAB"] = "DRTAB";
2466
+ ControlType2["CHART"] = "CHART";
2467
+ ControlType2["REPORT_PANEL"] = "REPORTPANEL";
2468
+ ControlType2["LIST"] = "LIST";
2469
+ ControlType2["MOB_MDCTRL"] = "MOBMDCTRL";
2470
+ ControlType2["MULTI_EDIT_VIEWPANEL"] = "MULTIEDITVIEWPANEL";
2471
+ ControlType2["WIZARD_PANEL"] = "WIZARDPANEL";
2472
+ ControlType2["UPDATE_PANEL"] = "UPDATEPANEL";
2473
+ ControlType2["SEARCHBAR"] = "SEARCHBAR";
2474
+ ControlType2["DASHBOARD"] = "DASHBOARD";
2475
+ ControlType2["CALENDAR"] = "CALENDAR";
2476
+ ControlType2["PANEL"] = "PANEL";
2477
+ ControlType2["VIEW_LAYOUT_PANEL"] = "VIEWLAYOUTPANEL";
2478
+ ControlType2["MAP"] = "MAP";
2479
+ ControlType2["GANTT"] = "GANTT";
2480
+ ControlType2["TREE_GRIDEX"] = "TREEGRIDEX";
2481
+ ControlType2["KANBAN"] = "KANBAN";
2482
+ ControlType2["CALENDAR_EXPBAR"] = "CALENDAREXPBAR";
2483
+ ControlType2["CHART_EXPBAR"] = "CHARTEXPBAR";
2484
+ ControlType2["DATA_VIEW_EXPBAR"] = "DATAVIEWEXPBAR";
2485
+ ControlType2["GANTT_EXPBAR"] = "GANTTEXPBAR";
2486
+ ControlType2["GRID_EXPBAR"] = "GRIDEXPBAR";
2487
+ ControlType2["LIST_EXPBAR"] = "LISTEXPBAR";
2488
+ ControlType2["MAP_EXPBAR"] = "MAPEXPBAR";
2489
+ ControlType2["STATE_WIZARD_PANEL"] = "STATEWIZARDPANEL";
2490
+ ControlType2["TAB_EXP_PANEL"] = "TABEXPPANEL";
2491
+ ControlType2["CUSTOM"] = "CUSTOM";
2492
+ return ControlType2;
2493
+ })(ControlType || {});
2494
+
2495
+ // src/constant/view-type/view-type.ts
2496
+ var ViewType = /* @__PURE__ */ ((ViewType2) => {
2497
+ ViewType2["APP_INDEX_VIEW"] = "APPINDEXVIEW";
2498
+ ViewType2["DE_GRID_VIEW"] = "DEGRIDVIEW";
2499
+ ViewType2["DE_EDIT_VIEW"] = "DEEDITVIEW";
2500
+ ViewType2["APP_DATA_UPLOAD_VIEW"] = "APPDATAUPLOADVIEW";
2501
+ ViewType2["APP_ERROR_VIEW"] = "APPERRORVIEW";
2502
+ ViewType2["APP_FILE_UPLOAD_VIEW"] = "APPFILEUPLOADVIEW";
2503
+ ViewType2["APP_FUN_PICKUP_VIEW"] = "APPFUNCPICKUPVIEW";
2504
+ ViewType2["APP_LOGIN_VIEW"] = "APPLOGINVIEW";
2505
+ ViewType2["APP_LOGOUT_VIEW"] = "APPLOGOUTVIEW";
2506
+ ViewType2["APP_PANEL_VIEW"] = "APPPANELVIEW";
2507
+ ViewType2["APP_PIC_UPLOAD_VIEW"] = "APPPICUPLOADVIEW";
2508
+ ViewType2["APP_PORTAL_VIEW"] = "APPPORTALVIEW";
2509
+ ViewType2["APP_REDIRECT_VIEW"] = "APPREDIRECTVIEW";
2510
+ ViewType2["APP_START_VIEW"] = "APPSTARTVIEW";
2511
+ ViewType2["APP_WELCOME_VIEW"] = "APPWELCOMEVIEW";
2512
+ ViewType2["APP_WF_ADD_STEP_AFTER_VIEW"] = "APPWFADDSTEPAFTERVIEW";
2513
+ ViewType2["APP_WF_ADD_STEP_BEFORE_VIEW"] = "APPWFADDSTEPBEFOREVIEW";
2514
+ ViewType2["APP_WF_REDIRECT_VIEW"] = "APPWFREDIRECTVIEW";
2515
+ ViewType2["APP_WF_SENDBAC_VIEW"] = "APPWFSENDBACKVIEW";
2516
+ ViewType2["APP_WF_STEP_ACTOR_VIEW"] = "APPWFSTEPACTORVIEW";
2517
+ ViewType2["APP_WF_STEP_DATA_VIEW"] = "APPWFSTEPDATAVIEW";
2518
+ ViewType2["APP_WF_STEP_TRACE_VIEW"] = "APPWFSTEPTRACEVIEW";
2519
+ ViewType2["APP_WF_SUPPLY_INFO_VIEW"] = "APPWFSUPPLYINFOVIEW";
2520
+ ViewType2["APP_WF_TAKE_ADVICE_VIEW"] = "APPWFTAKEADVICEVIEW";
2521
+ ViewType2["DE_CALENDAR_EXP_VIEW"] = "DECALENDAREXPVIEW";
2522
+ ViewType2["DE_CALENDAR_VIEW"] = "DECALENDARVIEW";
2523
+ ViewType2["DE_CHART_EXP_VIEW"] = "DECHARTEXPVIEW";
2524
+ ViewType2["DE_CHART_VIEW"] = "DECHARTVIEW";
2525
+ ViewType2["DE_CHART_VIEW9"] = "DECHARTVIEW9";
2526
+ ViewType2["DE_CUSTOM_VIEW"] = "DECUSTOMVIEW";
2527
+ ViewType2["DE_DATA_VIEW"] = "DEDATAVIEW";
2528
+ ViewType2["DE_DATA_VIEW9"] = "DEDATAVIEW9";
2529
+ ViewType2["DE_DATAVIEW_EXP_VIEW"] = "DEDATAVIEWEXPVIEW";
2530
+ ViewType2["DE_EDIT_VIEW2"] = "DEEDITVIEW2";
2531
+ ViewType2["DE_EDIT_VIEW3"] = "DEEDITVIEW3";
2532
+ ViewType2["DE_EDIT_VIEW4"] = "DEEDITVIEW4";
2533
+ ViewType2["DE_EDIT_VIEW9"] = "DEEDITVIEW9";
2534
+ ViewType2["DE_FORM_PICKUP_DATA_VIEW"] = "DEFORMPICKUPDATAVIEW";
2535
+ ViewType2["DE_GANTT_EXP_VIEW"] = "DEGANTTEXPVIEW";
2536
+ ViewType2["DE_GANTT_VIEW"] = "DEGANTTVIEW";
2537
+ ViewType2["DE_GANTT_VIEW9"] = "DEGANTTVIEW9";
2538
+ ViewType2["DE_GRID_EXP_VIEW"] = "DEGRIDEXPVIEW";
2539
+ ViewType2["DE_GRID_VIEW2"] = "DEGRIDVIEW2";
2540
+ ViewType2["DE_GRID_VIEW4"] = "DEGRIDVIEW4";
2541
+ ViewType2["DE_GRID_VIEW8"] = "DEGRIDVIEW8";
2542
+ ViewType2["DE_GRID_VIEW9"] = "DEGRIDVIEW9";
2543
+ ViewType2["DE_HTML_VIEW"] = "DEHTMLVIEW";
2544
+ ViewType2["DE_INDEX_PICKUP_DATA_VIEW"] = "DEINDEXPICKUPDATAVIEW";
2545
+ ViewType2["DE_INDEX_VIEW"] = "DEINDEXVIEW";
2546
+ ViewType2["DE_KANBAN_VIEW"] = "DEKANBANVIEW";
2547
+ ViewType2["DE_KANBAN_VIEW9"] = "DEKANBANVIEW9";
2548
+ ViewType2["DE_LIST_EXP_VIEW"] = "DELISTEXPVIEW";
2549
+ ViewType2["DE_LIST_VIEW"] = "DELISTVIEW";
2550
+ ViewType2["DE_LIST_VIEW9"] = "DELISTVIEW9";
2551
+ ViewType2["DE_MAP_EXP_VIEW"] = "DEMAPEXPVIEW";
2552
+ ViewType2["DE_MAP_VIEW"] = "DEMAPVIEW";
2553
+ ViewType2["DE_MAP_VIEW9"] = "DEMAPVIEW9";
2554
+ ViewType2["DE_MD_CUSTOM_VIEW"] = "DEMDCUSTOMVIEW";
2555
+ ViewType2["DE_MEDITVIEW9"] = "DEMEDITVIEW9";
2556
+ ViewType2["DE_MOB_CALENDAR_EXP_VIEW"] = "DEMOBCALENDAREXPVIEW";
2557
+ ViewType2["DE_MOB_CALENDAR_VIEW"] = "DEMOBCALENDARVIEW";
2558
+ ViewType2["DE_MOB_CALENDAR_VIEW9"] = "DEMOBCALENDARVIEW9";
2559
+ ViewType2["DE_MOB_CHART_EXP_VIEW"] = "DEMOBCHARTEXPVIEW";
2560
+ ViewType2["DE_MO_BCHART_VIEW"] = "DEMOBCHARTVIEW";
2561
+ ViewType2["D_EMOB_CHART_VIEW9"] = "DEMOBCHARTVIEW9";
2562
+ ViewType2["DE_MOB_CUSTOM_VIEW"] = "DEMOBCUSTOMVIEW";
2563
+ ViewType2["DE_MOB_DATA_VIEW"] = "DEMOBDATAVIEW";
2564
+ ViewType2["DE_MOB_DATA_VIEW_EXP_VIEW"] = "DEMOBDATAVIEWEXPVIEW";
2565
+ ViewType2["DE_MOB_EDIT_VIEW"] = "DEMOBEDITVIEW";
2566
+ ViewType2["DE_MOB_EDIT_VIEW3"] = "DEMOBEDITVIEW3";
2567
+ ViewType2["DE_MOB_EDITVIEW9"] = "DEMOBEDITVIEW9";
2568
+ ViewType2["DE_MOB_FORM_PICKUP_MDVIEW"] = "DEMOBFORMPICKUPMDVIEW";
2569
+ ViewType2["DE_MOB_GANTT_EXP_VIEW"] = "DEMOBGANTTEXPVIEW";
2570
+ ViewType2["DE_MOB_GANTT_VIEW"] = "DEMOBGANTTVIEW";
2571
+ ViewType2["DE_MOB_GANTT_VIEW9"] = "DEMOBGANTTVIEW9";
2572
+ ViewType2["DE_MOB_HTML_VIEW"] = "DEMOBHTMLVIEW";
2573
+ ViewType2["DE_MOB_INDEX_PICKUP_MDVIEW"] = "DEMOBINDEXPICKUPMDVIEW";
2574
+ ViewType2["DE_MOB_LIST_EXP_VIEW"] = "DEMOBLISTEXPVIEW";
2575
+ ViewType2["DE_MOB_LIST_VIEW"] = "DEMOBLISTVIEW";
2576
+ ViewType2["DE_MOB_MAP_VIEW"] = "DEMOBMAPVIEW";
2577
+ ViewType2["DE_MOB_MAP_VIEW9"] = "DEMOBMAPVIEW9";
2578
+ ViewType2["DE_MOB_MDVIEW"] = "DEMOBMDVIEW";
2579
+ ViewType2["DE_MOB_MDVIEW9"] = "DEMOBMDVIEW9";
2580
+ ViewType2["DE_MOB_MEDIT_VIEW9"] = "DEMOBMEDITVIEW9";
2581
+ ViewType2["DE_MOB_MPICKUP_VIEW"] = "DEMOBMPICKUPVIEW";
2582
+ ViewType2["DE_MOB_OPT_VIEW"] = "DEMOBOPTVIEW";
2583
+ ViewType2["DE_MOB_PANEL_VIEW"] = "DEMOBPANELVIEW";
2584
+ ViewType2["DE_MOB_PANEL_VIEW9"] = "DEMOBPANELVIEW9";
2585
+ ViewType2["DE_MOB_PICKUP_LIST_VIEW"] = "DEMOBPICKUPLISTVIEW";
2586
+ ViewType2["DE_MOB_PICKUP_MDVIEW"] = "DEMOBPICKUPMDVIEW";
2587
+ ViewType2["DE_MOB_PICKUP_TREE_VIEW"] = "DEMOBPICKUPTREEVIEW";
2588
+ ViewType2["DE_MOB_PICKUP_VIEW"] = "DEMOBPICKUPVIEW";
2589
+ ViewType2["DE_MOB_PORTAL_VIEW"] = "DEMOBPORTALVIEW";
2590
+ ViewType2["DE_MOB_PORTAL_VIEW9"] = "DEMOBPORTALVIEW9";
2591
+ ViewType2["DE_MOB_REDIRECT_VIEW"] = "DEMOBREDIRECTVIEW";
2592
+ ViewType2["DE_MOB_REPORT_VIEW"] = "DEMOBREPORTVIEW";
2593
+ ViewType2["DE_MOB_TAB_EXP_VIEW"] = "DEMOBTABEXPVIEW";
2594
+ ViewType2["DE_MOB_TAB_EXP_VIEW9"] = "DEMOBTABEXPVIEW9";
2595
+ ViewType2["DE_MOB_TAB_SEARCH_VIEW"] = "DEMOBTABSEARCHVIEW";
2596
+ ViewType2["DE_MOB_TAB_SEARCH_VIEW9"] = "DEMOBTABSEARCHVIEW9";
2597
+ ViewType2["DE_MOB_TREE_EXP_VIEW"] = "DEMOBTREEEXPVIEW";
2598
+ ViewType2["DEMOBTREEEXPVIEW9"] = "DEMOBTREEEXPVIEW9";
2599
+ ViewType2["DE_MOB_TREE_VIEW"] = "DEMOBTREEVIEW";
2600
+ ViewType2["DE_MOB_WFACTION_VIEW"] = "DEMOBWFACTIONVIEW";
2601
+ ViewType2["DE_MOB_WF_DATA_REDIRECT_VIEW"] = "DEMOBWFDATAREDIRECTVIEW";
2602
+ ViewType2["DE_MOB_WF_DYNAACTIO_NVIEW"] = "DEMOBWFDYNAACTIONVIEW";
2603
+ ViewType2["DE_MOB_WFDYNA_EDIT_VIEW"] = "DEMOBWFDYNAEDITVIEW";
2604
+ ViewType2["DE_MOB_WF_DYNA_EDIT_VIEW3"] = "DEMOBWFDYNAEDITVIEW3";
2605
+ ViewType2["DE_MOB_WF_DYNA_EXP_MDVIEW"] = "DEMOBWFDYNAEXPMDVIEW";
2606
+ ViewType2["DE_MO_BWF_DYNA_START_VIEW"] = "DEMOBWFDYNASTARTVIEW";
2607
+ ViewType2["DE_MOB_WF_EDIT_VIEW"] = "DEMOBWFEDITVIEW";
2608
+ ViewType2["DE_MOB_WF_EDIT_VIEW3"] = "DEMOBWFEDITVIEW3";
2609
+ ViewType2["DE_MOB_WF_MDVIEW"] = "DEMOBWFMDVIEW";
2610
+ ViewType2["DE_MOB_WF_PROXY_RESULT_VIEW"] = "DEMOBWFPROXYRESULTVIEW";
2611
+ ViewType2["DE_MOB_WF_PROXY_START_VIEW"] = "DEMOBWFPROXYSTARTVIEW";
2612
+ ViewType2["DE_MOB_WF_START_VIEW"] = "DEMOBWFSTARTVIEW";
2613
+ ViewType2["DE_MOB_WIZARD_VIEW"] = "DEMOBWIZARDVIEW";
2614
+ ViewType2["DE_MPICKUP_VIEW"] = "DEMPICKUPVIEW";
2615
+ ViewType2["DE_MPICKUP_VIEW2"] = "DEMPICKUPVIEW2";
2616
+ ViewType2["DE_OPT_VIEW"] = "DEOPTVIEW";
2617
+ ViewType2["DE_PANEL_VIEW"] = "DEPANELVIEW";
2618
+ ViewType2["DE_PANEL_VIEW9"] = "DEPANELVIEW9";
2619
+ ViewType2["DE_PICKUP_DATA_VIEW"] = "DEPICKUPDATAVIEW";
2620
+ ViewType2["DE_PICKUP_GRID_VIEW"] = "DEPICKUPGRIDVIEW";
2621
+ ViewType2["DE_PICKUP_TREE_VIEW"] = "DEPICKUPTREEVIEW";
2622
+ ViewType2["DE_PICKUP_VIEW"] = "DEPICKUPVIEW";
2623
+ ViewType2["DE_PICKUP_VIEW2"] = "DEPICKUPVIEW2";
2624
+ ViewType2["DE_PICK_UP_VIEW3"] = "DEPICKUPVIEW3";
2625
+ ViewType2["DE_PORTAL_VIEW"] = "DEPORTALVIEW";
2626
+ ViewType2["DE_PORTAL_VIEW9"] = "DEPORTALVIEW9";
2627
+ ViewType2["DE_REDIRECT_VIEW"] = "DEREDIRECTVIEW";
2628
+ ViewType2["DE_REPORT_VIEW"] = "DEREPORTVIEW";
2629
+ ViewType2["DE_TAB_EXP_VIEW"] = "DETABEXPVIEW";
2630
+ ViewType2["DE_TAB_EXP_VIEW9"] = "DETABEXPVIEW9";
2631
+ ViewType2["DE_TAB_SEARCH_VIEW"] = "DETABSEARCHVIEW";
2632
+ ViewType2["DE_TAB_SEARCH_VIEW9"] = "DETABSEARCHVIEW9";
2633
+ ViewType2["DE_TREE_EXP_VIEW"] = "DETREEEXPVIEW";
2634
+ ViewType2["DE_TREE_EXP_VIEW2"] = "DETREEEXPVIEW2";
2635
+ ViewType2["DE_TREE_EXP_VIEW3"] = "DETREEEXPVIEW3";
2636
+ ViewType2["DE_TREE_GRID_EXVIEW"] = "DETREEGRIDEXVIEW";
2637
+ ViewType2["DE_TREE_GRID_EXVIEW9"] = "DETREEGRIDEXVIEW9";
2638
+ ViewType2["DE_TREE_GRID_VIEW"] = "DETREEGRIDVIEW";
2639
+ ViewType2["DE_TREE_GRID_VIEW9"] = "DETREEGRIDVIEW9";
2640
+ ViewType2["DE_TREE_VIEW"] = "DETREEVIEW";
2641
+ ViewType2["DE_TREE_VIEW9"] = "DETREEVIEW9";
2642
+ ViewType2["DE_WF_ACTION_VIEW"] = "DEWFACTIONVIEW";
2643
+ ViewType2["DE_WF_DATA_REDIRECT_VIEW"] = "DEWFDATAREDIRECTVIEW";
2644
+ ViewType2["DE_WF_DYNA_ACTION_VIEW"] = "DEWFDYNAACTIONVIEW";
2645
+ ViewType2["DE_WF_DYNA_EDIT_VIEW"] = "DEWFDYNAEDITVIEW";
2646
+ ViewType2["DE_WF_DYNA_EDIT_VIEW3"] = "DEWFDYNAEDITVIEW3";
2647
+ ViewType2["DE_WF_DYNA_EXP_GRID_VIEW"] = "DEWFDYNAEXPGRIDVIEW";
2648
+ ViewType2["DE_WF_DYNA_START_VIEW"] = "DEWFDYNASTARTVIEW";
2649
+ ViewType2["DE_WF_EDIT_PROXY_DATA_VIEW"] = "DEWFEDITPROXYDATAVIEW";
2650
+ ViewType2["DE_WF_EDIT_VIEW"] = "DEWFEDITVIEW";
2651
+ ViewType2["DE_WF_EDIT_VIEW2"] = "DEWFEDITVIEW2";
2652
+ ViewType2["DE_WF_EDIT_VIEW3"] = "DEWFEDITVIEW3";
2653
+ ViewType2["DE_WF_EDIT_VIEW9"] = "DEWFEDITVIEW9";
2654
+ ViewType2["DE_WF_EXP_VIEW"] = "DEWFEXPVIEW";
2655
+ ViewType2["DE_WF_GRID_VIEW"] = "DEWFGRIDVIEW";
2656
+ ViewType2["DE_WF_PROXY_DATA_VIEW"] = "DEWFPROXYDATAVIEW";
2657
+ ViewType2["DE_WF_PROXY_RESULT_VIEW"] = "DEWFPROXYRESULTVIEW";
2658
+ ViewType2["DE_WF_PROXY_START_VIEW"] = "DEWFPROXYSTARTVIEW";
2659
+ ViewType2["DE_WF_START_VIEW"] = "DEWFSTARTVIEW";
2660
+ ViewType2["DE_WIZARD_VIEW"] = "DEWIZARDVIEW";
2661
+ return ViewType2;
2662
+ })(ViewType || {});
2663
+
2664
+ // src/constant/view-mode.ts
2665
+ var ViewMode = /* @__PURE__ */ ((ViewMode2) => {
2666
+ ViewMode2["ROUTE"] = "ROUTE";
2667
+ ViewMode2["MODAL"] = "MODAL";
2668
+ ViewMode2["DRAWER"] = "DRAWER";
2669
+ ViewMode2["EMBED"] = "EMBED";
2670
+ ViewMode2["POPOVER"] = "POPOVER";
2671
+ return ViewMode2;
2672
+ })(ViewMode || {});
2673
+
2674
+ // src/constant/studio-event.ts
2675
+ var StudioViewEvents = class {
2676
+ };
2677
+ /**
2678
+ * 视图加载
2679
+ */
2680
+ StudioViewEvents.onViewMounted = "onMounted";
2681
+ /**
2682
+ * 视图销毁
2683
+ */
2684
+ StudioViewEvents.onViewDestroyed = "onDestroyed";
2685
+ var StudioPanelEvents = class {
2686
+ };
2687
+ /**
2688
+ * 点击事件
2689
+ */
2690
+ StudioPanelEvents.onClick = "onClick";
2691
+ /**
2692
+ * 值变更事件
2693
+ */
2694
+ StudioPanelEvents.onChange = "onChange";
2695
+ /**
2696
+ * 输入事件
2697
+ */
2698
+ StudioPanelEvents.onEnter = "onEnter";
2699
+ /**
2700
+ * 离开事件
2701
+ */
2702
+ StudioPanelEvents.onLeave = "onLeave";
2703
+ var StudioControlEvents = class {
2704
+ };
2705
+ /**
2706
+ * 加载之前
2707
+ */
2708
+ StudioControlEvents.onBeforeLoad = "onBeforeLoad";
2709
+ /**
2710
+ * 加载成功
2711
+ */
2712
+ StudioControlEvents.onLoadSuccess = "onLoadSuccess";
2713
+ /**
2714
+ * 加载失败
2715
+ */
2716
+ StudioControlEvents.onLoadError = "onLoadError";
2717
+ /**
2718
+ * 加载草稿之前
2719
+ */
2720
+ StudioControlEvents.onBeforeLoadDraft = "onBeforeLoadDraft";
2721
+ /**
2722
+ * 加载草稿成功
2723
+ */
2724
+ StudioControlEvents.onLoadDraftSuccess = "onLoadDraftSuccess";
2725
+ /**
2726
+ * 加载草稿失败
2727
+ */
2728
+ StudioControlEvents.onLoadDraftError = "onLoadDraftError";
2729
+ /**
2730
+ * 保存之前
2731
+ */
2732
+ StudioControlEvents.onBeforeSave = "onBeforeSave";
2733
+ /**
2734
+ * 保存成功
2735
+ */
2736
+ StudioControlEvents.onSaveSuccess = "onSaveSuccess";
2737
+ /**
2738
+ * 保存失败
2739
+ */
2740
+ StudioControlEvents.onSaveError = "onSaveError";
2741
+ /**
2742
+ * 删除之前
2743
+ */
2744
+ StudioControlEvents.onBeforeRemove = "onBeforeRemove";
2745
+ /**
2746
+ * 删除成功
2747
+ */
2748
+ StudioControlEvents.onRemoveSuccess = "onRemoveSuccess";
2749
+ /**
2750
+ * 删除失败
2751
+ */
2752
+ StudioControlEvents.onRemoveError = "onRemoveError";
2753
+ /**
2754
+ * 原生默认工具栏的点击事件名称
2755
+ */
2756
+ StudioControlEvents.CLICK = "onClick";
2757
+
2758
+ // src/service/utils/route-context/route-context.ts
2759
+ var excludeViewTypes = [
2760
+ "DEGRIDVIEW" /* DE_GRID_VIEW */,
2761
+ "DEGRIDEXPVIEW" /* DE_GRID_EXP_VIEW */,
2762
+ "DELISTVIEW" /* DE_LIST_VIEW */,
2763
+ "DELISTEXPVIEW" /* DE_LIST_EXP_VIEW */,
2764
+ "DEDATAVIEW" /* DE_DATA_VIEW */,
2765
+ "DEDATAVIEWEXPVIEW" /* DE_DATAVIEW_EXP_VIEW */,
2766
+ "DECALENDARVIEW" /* DE_CALENDAR_VIEW */,
2767
+ "DECALENDAREXPVIEW" /* DE_CALENDAR_EXP_VIEW */,
2768
+ "DECHARTVIEW" /* DE_CHART_VIEW */,
2769
+ "DECHARTEXPVIEW" /* DE_CHART_EXP_VIEW */,
2770
+ "DEKANBANVIEW" /* DE_KANBAN_VIEW */
2771
+ ];
2772
+ function calcRouteContext(context, pathItems, _appView) {
2773
+ let paths = [];
2774
+ pathItems.forEach((items) => {
2775
+ const values = [];
2776
+ for (let i = 0; i < items.length; i++) {
2777
+ const arr = [];
2778
+ const item = items[i];
2779
+ const val = context[item.name];
2780
+ if (val) {
2781
+ arr.push(item.name);
2782
+ arr.push(val);
2783
+ values.push(arr);
2784
+ }
2785
+ }
2786
+ paths.push(values);
2787
+ });
2788
+ paths = paths.sort((a, b) => b.length - a.length);
2789
+ const [pathArr] = paths;
2790
+ if (pathArr) {
2791
+ const obj = {};
2792
+ pathArr.forEach(([key, val]) => {
2793
+ obj[key] = val;
2794
+ });
2795
+ return obj;
2796
+ }
2797
+ return {};
2798
+ }
2799
+
2800
+ // src/service/utils/search-filter/search-filter.ts
2801
+ import { isEmpty as isEmpty6, isNil as isNil5 } from "ramda";
2802
+ var SearchFilter = class {
2803
+ /**
2804
+ * Creates an instance of SearchFilter.
2805
+ *
2806
+ * @param {*} context
2807
+ * @param {*} [data]
2808
+ * @memberof SearchFilter
2809
+ */
2810
+ constructor(context, data) {
2811
+ /**
2812
+ * 分页
2813
+ *
2814
+ * @type {number}
2815
+ * @memberof SearchFilter
2816
+ */
2817
+ this.page = 0;
2818
+ /**
2819
+ * 分页数据量
2820
+ *
2821
+ * @type {number}
2822
+ * @memberof SearchFilter
2823
+ */
2824
+ this.size = 1e3;
2825
+ /**
2826
+ * 数据
2827
+ *
2828
+ * @author chitanda
2829
+ * @date 2022-08-17 22:08:00
2830
+ * @type {IData}
2831
+ */
2832
+ this.data = {};
2833
+ /**
2834
+ * 排序属性
2835
+ *
2836
+ * @type {string}
2837
+ * @memberof SearchFilter
2838
+ */
2839
+ this.sortField = "srfordervalue";
2840
+ /**
2841
+ * 排序模式
2842
+ *
2843
+ * @type {('ASC' | 'DESC')}
2844
+ * @memberof SearchFilter
2845
+ */
2846
+ this.sortMode = "ASC";
2847
+ this.context = context;
2848
+ if (data) {
2849
+ if (!isNil5(data.page) && !isEmpty6(data.page)) {
2850
+ this.page = data.page;
2851
+ }
2852
+ if (!isNil5(data.size) && !isEmpty6(data.size)) {
2853
+ this.size = data.size;
2854
+ }
2855
+ if (!isNil5(data.query) && !isEmpty6(data.query)) {
2856
+ this.query = data.query;
2857
+ }
2858
+ if (!isNil5(data.sort) && !isEmpty6(data.sort)) {
2859
+ const arr = data.sort.split(",");
2860
+ if (arr.length >= 1) {
2861
+ [this.sortField] = arr;
2862
+ }
2863
+ if (arr.length >= 2) {
2864
+ this.sortMode = arr[1].toUpperCase();
2865
+ }
2866
+ }
2867
+ if (!isNil5(data.srfparentkey) && !isEmpty6(data.srfparentkey)) {
2868
+ this.srfparentkey = data.srfparentkey;
2869
+ }
2870
+ if (!isNil5(data.srfparentdename) && !isEmpty6(data.srfparentdename)) {
2871
+ this.srfparentdename = data.srfparentdename;
2872
+ }
2873
+ this.data = { ...data };
2874
+ delete this.data.page;
2875
+ delete this.data.size;
2876
+ delete this.data.query;
2877
+ delete this.data.sort;
2878
+ delete this.data.srfparentkey;
2879
+ delete this.data.srfparentdename;
2880
+ }
2881
+ }
2882
+ /**
2883
+ * 获取条件值
2884
+ *
2885
+ * @author chitanda
2886
+ * @date 2022-08-17 22:08:11
2887
+ * @param {string} key
2888
+ * @return {*} {unknown}
2889
+ */
2890
+ getValue(key) {
2891
+ if (this.data[key]) {
2892
+ return this.data[key];
2893
+ }
2894
+ return this.context[key];
2895
+ }
2896
+ };
2897
+
2898
+ // src/service/utils/service-path-util/service-path-util.ts
2899
+ import { pluralLower } from "@ibiz-template/core";
2900
+ var ServicePathUtil = class {
2901
+ constructor(app) {
2902
+ this.app = app;
2903
+ this.allDERss = [];
2904
+ /**
2905
+ * 应用实体关系
2906
+ *
2907
+ * @author chitanda
2908
+ * @date 2022-08-22 22:08:18
2909
+ * @protected
2910
+ * @type {Map<string, IAppDERS[]>} <应用实体, 应用实体父关系>
2911
+ */
2912
+ this.entityRsMap = /* @__PURE__ */ new Map();
2913
+ /**
2914
+ * 实体资源路径
2915
+ *
2916
+ * @author chitanda
2917
+ * @date 2022-08-22 22:08:58
2918
+ * @protected
2919
+ * @type {Map<string, ServicePathItem[][]>}
2920
+ */
2921
+ this.entityRsPathMap = /* @__PURE__ */ new Map();
2922
+ }
2923
+ /**
2924
+ * 初始化工具参数
2925
+ *
2926
+ * @author chitanda
2927
+ * @date 2022-08-22 21:08:47
2928
+ * @param {IParams} context
2929
+ * @return {*} {Promise<void>}
2930
+ */
2931
+ async init() {
2932
+ if (this.allDERss.length > 0) {
2933
+ return;
2934
+ }
2935
+ const list = this.app.appDataEntityList || [];
2936
+ this.allDERss = this.app.appDERSs;
2937
+ list.forEach((codeName) => {
2938
+ const items = this.allDERss.filter((item) => {
2939
+ if (item.minorDECodeName === codeName) {
2940
+ return item;
2941
+ }
2942
+ return null;
2943
+ });
2944
+ if (items.length > 0) {
2945
+ this.entityRsMap.set(codeName, items);
2946
+ }
2947
+ });
2948
+ }
2949
+ /**
2950
+ * 计算指定实体所有资源路径
2951
+ *
2952
+ * @author chitanda
2953
+ * @date 2022-08-22 22:08:54
2954
+ * @param {IParams} context
2955
+ * @param {string} codeName
2956
+ * @return {*} {Promise<ServicePathItem[][]>} 返回顺序为 [祖父实体,爷爷实体,父实体,当前实体]
2957
+ */
2958
+ calcPaths(codeName) {
2959
+ if (this.entityRsPathMap.has(codeName)) {
2960
+ return this.entityRsPathMap.get(codeName);
2961
+ }
2962
+ const deRss = this.entityRsMap.get(codeName);
2963
+ if (deRss) {
2964
+ const arr = this.calcDeepPath(deRss);
2965
+ this.deepFillPath(codeName, [codeName], arr);
2966
+ const paths = this.entityRsPathMap.get(codeName);
2967
+ if (paths) {
2968
+ const sortedPaths = this.sortPath(paths);
2969
+ this.entityRsPathMap.set(codeName, sortedPaths);
2970
+ return sortedPaths;
2971
+ }
2972
+ }
2973
+ return [
2974
+ [
2975
+ {
2976
+ deName: codeName,
2977
+ name: codeName.toLowerCase(),
2978
+ plural: pluralLower(codeName)
2979
+ }
2980
+ ]
2981
+ ];
2982
+ }
2983
+ /**
2984
+ * 计算递归资源路径
2985
+ *
2986
+ * @author chitanda
2987
+ * @date 2022-08-22 22:08:32
2988
+ * @protected
2989
+ * @param {IAppDERS[]} deRss
2990
+ * @return {*} {ServicePathDeep[]}
2991
+ */
2992
+ calcDeepPath(deRss, num = 0) {
2993
+ if (num > 10) {
2994
+ throw new Error("\u670D\u52A1\u8DEF\u5F84\u8BA1\u7B97\u8D85\u8FC7\u6700\u5927\u5C42\u7EA7 10");
2995
+ }
2996
+ num += 1;
2997
+ const arr = [];
2998
+ deRss.forEach((rs) => {
2999
+ const items = this.entityRsMap.get(rs.majorDECodeName) || [];
3000
+ arr.push([rs, this.calcDeepPath(items, num)]);
3001
+ });
3002
+ return arr;
3003
+ }
3004
+ /**
3005
+ * 递归填充计算所有资源路径
3006
+ *
3007
+ * @author chitanda
3008
+ * @date 2022-08-22 22:08:04
3009
+ * @protected
3010
+ * @param {string} deName
3011
+ * @param {string[]} pathNames
3012
+ * @param {ServicePathDeep[]} items
3013
+ */
3014
+ deepFillPath(deName, pathNames, items) {
3015
+ items.forEach((item) => {
3016
+ const [rs, children] = item;
3017
+ if (children.length > 0) {
3018
+ this.deepFillPath(
3019
+ deName,
3020
+ [...pathNames, rs.majorDECodeName],
3021
+ children
3022
+ );
3023
+ } else {
3024
+ if (!this.entityRsPathMap.has(deName)) {
3025
+ this.entityRsPathMap.set(deName, []);
3026
+ }
3027
+ const arr = this.entityRsPathMap.get(deName);
3028
+ arr.push(
3029
+ [
3030
+ ...pathNames.map((pathName) => {
3031
+ return {
3032
+ deName: pathName,
3033
+ name: pathName.toLowerCase(),
3034
+ plural: pluralLower(pathName)
3035
+ };
3036
+ }),
3037
+ {
3038
+ deName: rs.majorDECodeName,
3039
+ name: rs.majorDECodeName.toLowerCase(),
3040
+ plural: pluralLower(rs.majorDECodeName)
3041
+ }
3042
+ ].reverse()
3043
+ );
3044
+ }
3045
+ });
3046
+ }
3047
+ /**
3048
+ * 排序资源路径顺序
3049
+ *
3050
+ * @author chitanda
3051
+ * @date 2022-08-22 22:08:44
3052
+ * @protected
3053
+ * @param {ServicePathItem[][]} paths
3054
+ * @return {*} {ServicePathItem[][]}
3055
+ */
3056
+ sortPath(paths) {
3057
+ return paths.sort((a, b) => {
3058
+ return b.length - a.length;
3059
+ });
3060
+ }
3061
+ };
3062
+
3063
+ // src/service/service/code-list/code-list.service.ts
3064
+ var CodeListService = class {
3065
+ constructor(appModel) {
3066
+ this.appModel = appModel;
3067
+ /**
3068
+ * 所有代码表缓存
3069
+ *
3070
+ * @author lxm
3071
+ * @date 2022-08-25 20:08:16
3072
+ */
3073
+ this.allCodeLists = /* @__PURE__ */ new Map();
3074
+ /**
3075
+ * 代码表项数据缓存
3076
+ *
3077
+ * @author lxm
3078
+ * @date 2022-08-25 21:08:12
3079
+ * @protected
3080
+ * @type {Map<string, CodeListItem[]>}
3081
+ */
3082
+ this.cache = /* @__PURE__ */ new Map();
3083
+ }
3084
+ /**
3085
+ * 初始化所有代码表缓存
3086
+ *
3087
+ * @author lxm
3088
+ * @date 2022-08-25 21:08:32
3089
+ * @protected
3090
+ * @returns {*}
3091
+ */
3092
+ async initAllCodeList() {
3093
+ if (this.allCodeLists.size !== 0) {
3094
+ return null;
3095
+ }
3096
+ }
3097
+ /**
3098
+ * 获取静态代码表
3099
+ *
3100
+ * @author chitanda
3101
+ * @date 2022-08-25 15:08:11
3102
+ * @param {string} _tag
3103
+ * @return {*} {CodeListItem[]}
3104
+ */
3105
+ getStatic(codeList) {
3106
+ const codeName = codeList.codeName;
3107
+ if (this.cache.has(codeName)) {
3108
+ return this.cache.get(codeName);
3109
+ }
3110
+ const items = codeList.codeItems;
3111
+ let result = [];
3112
+ if (items == null ? void 0 : items.length) {
3113
+ result = this.formatStaticItems(items, codeList.codeItemValueNumber);
3114
+ }
3115
+ this.cache.set(codeName, Object.freeze(result));
3116
+ return result;
3117
+ }
3118
+ /**
3119
+ * 格式化代码表
3120
+ *
3121
+ * @author lxm
3122
+ * @date 2022-08-25 21:08:03
3123
+ * @protected
3124
+ * @param {ICodeItem[]} codeItems
3125
+ * @param {boolean} isValueNumber
3126
+ * @returns {*}
3127
+ */
3128
+ formatStaticItems(codeItems, isValueNumber) {
3129
+ return codeItems.map((codeItem) => {
3130
+ var _a;
3131
+ const _codeItem = {
3132
+ text: codeItem.text,
3133
+ value: isValueNumber ? Number(codeItem.value) : codeItem.value,
3134
+ color: codeItem.color,
3135
+ id: codeItem.codeName
3136
+ };
3137
+ if ((_a = codeItem.codeItems) == null ? void 0 : _a.length) {
3138
+ _codeItem.children = this.formatStaticItems(
3139
+ codeItem.codeItems,
3140
+ isValueNumber
3141
+ );
3142
+ }
3143
+ return Object.freeze(_codeItem);
3144
+ });
3145
+ }
3146
+ /**
3147
+ * 获取动态代码表
3148
+ *
3149
+ * @author lxm
3150
+ * @date 2022-08-25 21:08:06
3151
+ * @protected
3152
+ * @param {IAppCodeList} codeList
3153
+ * @returns {*} {IDatum[]}
3154
+ */
3155
+ async getDynamicCodeList(codeList, context = {}, params = {}) {
3156
+ let dynamicCache;
3157
+ const codeName = codeList.codeName;
3158
+ if (this.cache.has(codeName)) {
3159
+ dynamicCache = this.cache.get(codeName);
3160
+ } else {
3161
+ dynamicCache = new DynamicCodeListCache(codeList);
3162
+ this.cache.set(codeName, dynamicCache);
3163
+ await dynamicCache.init();
3164
+ }
3165
+ return dynamicCache.get(context, params);
3166
+ }
3167
+ /**
3168
+ * 获取代码表
3169
+ *
3170
+ * @author chitanda
3171
+ * @date 2022-08-25 15:08:45
3172
+ * @param {string} tag
3173
+ * @param {IParams} [context]
3174
+ * @param {IParams} [params]
3175
+ * @return {*} {Promise<CodeListItem[]>}
3176
+ */
3177
+ async get(tag, context, params) {
3178
+ if (this.allCodeLists.size === 0) {
3179
+ await this.initAllCodeList();
3180
+ }
3181
+ const codeList = this.allCodeLists.get(tag);
3182
+ if (!codeList) {
3183
+ throw new Error(`\u627E\u4E0D\u5230${tag}\u4EE3\u7801\u8868`);
3184
+ }
3185
+ if (codeList.codeListType === "STATIC") {
3186
+ return this.getStatic(codeList);
3187
+ }
3188
+ if (codeList.codeListType === "DYNAMIC") {
3189
+ return this.getDynamicCodeList(codeList, context, params);
3190
+ }
3191
+ return [];
3192
+ }
3193
+ };
3194
+
3195
+ // src/service/service/counter/counter.service.ts
3196
+ var CounterService = class {
3197
+ /**
3198
+ * 获取计数器
3199
+ *
3200
+ * @author chitanda
3201
+ * @date 2022-10-26 19:10:18
3202
+ * @param {IAppCounter} model
3203
+ * @return {*} {Promise<AppCounter>}
3204
+ */
3205
+ static async getCounter(model, context, params) {
3206
+ const id = model.id;
3207
+ if (this.counterMap.has(id)) {
3208
+ const counter2 = this.counterMap.get(id);
3209
+ if (counter2.isDestroyed === false) {
3210
+ return counter2;
3211
+ }
3212
+ this.counterMap.delete(id);
3213
+ }
3214
+ const counter = new AppCounter(model);
3215
+ await counter.init(context, params);
3216
+ this.counterMap.set(id, counter);
3217
+ return counter;
3218
+ }
3219
+ /**
3220
+ * 根据计数器引用获取计数器实例
3221
+ *
3222
+ * @author chitanda
3223
+ * @date 2022-10-26 20:10:20
3224
+ * @static
3225
+ * @param {IAppCounterRef} model
3226
+ * @param {IParams} context
3227
+ * @param {IParams} params
3228
+ * @return {*} {Promise<AppCounter>}
3229
+ */
3230
+ static async getCounterByRef(model, context, params) {
3231
+ return {};
3232
+ }
3233
+ };
3234
+ /**
3235
+ * 计数器组,应用级计数器缓存,不存在重复
3236
+ *
3237
+ * @author chitanda
3238
+ * @date 2022-10-26 19:10:54
3239
+ * @protected
3240
+ * @static
3241
+ * @type {Map<string, AppCounter>}
3242
+ */
3243
+ CounterService.counterMap = /* @__PURE__ */ new Map();
3244
+
3245
+ // src/service/service/entity/entity.service.ts
3246
+ import { ModelError as ModelError5, RuntimeError as RuntimeError5 } from "@ibiz-template/core";
3247
+
3248
+ // src/service/service/work-flow/work-flow.service.ts
3249
+ import { RuntimeError as RuntimeError4 } from "@ibiz-template/core";
3250
+ var WorkFlowService = class {
3251
+ /**
3252
+ * Creates an instance of WorkFlowService.
3253
+ * @author lxm
3254
+ * @date 2022-09-29 11:09:54
3255
+ * @param {IAppDataEntity} model 应用实体
3256
+ */
3257
+ constructor(model) {
3258
+ this.model = model;
3259
+ /**
3260
+ * 常规基础路径
3261
+ *
3262
+ * @author lxm
3263
+ * @date 2022-09-29 14:09:16
3264
+ * @private
3265
+ * @type {string}
3266
+ */
3267
+ this.commonBaseUrl = "";
3268
+ }
3269
+ /**
3270
+ * 获取基础路径
3271
+ *
3272
+ * @author lxm
3273
+ * @date 2022-09-29 14:09:40
3274
+ * @private
3275
+ * @returns {*}
3276
+ */
3277
+ getBaseUrl() {
3278
+ return this.commonBaseUrl;
3279
+ }
3280
+ /**
3281
+ * 获取activeData
3282
+ *
3283
+ * @private
3284
+ * @param {IData} data
3285
+ * @param {IParams} context
3286
+ * @returns {*}
3287
+ * @memberof WorkFlowService
3288
+ */
3289
+ getActiveData(data, context) {
3290
+ if (context.srfprocessinstanceid) {
3291
+ data.srfprocessinstanceid = context.srfprocessinstanceid;
3292
+ }
3293
+ return data;
3294
+ }
3295
+ /**
3296
+ * 根据当前步骤和任务获取工作流步骤数据(如:流程表单等)
3297
+ *
3298
+ * @author lxm
3299
+ * @date 2022-09-29 14:09:45
3300
+ * @param {IParams} context
3301
+ * @returns {*} {Promise<IHttpResponse<IDatum>>}
3302
+ */
3303
+ async getWFStep(context) {
3304
+ const { processDefinitionKey, taskDefinitionKey } = context;
3305
+ return this.app.net.get(
3306
+ `${this.getBaseUrl()}/process-definitions/${processDefinitionKey}/usertasks/${taskDefinitionKey}`
3307
+ );
3308
+ }
3309
+ /**
3310
+ * 根据业务主键和当前步骤获取操作路径
3311
+ *
3312
+ * @author lxm
3313
+ * @date 2022-09-29 14:09:52
3314
+ * @param {IParams} context 路径参数
3315
+ * @param {IDatum} data 数据
3316
+ * @returns {*} {Promise<IHttpResponse<IDatum>>}
3317
+ */
3318
+ async getWFLink(context, data) {
3319
+ const deKeyValue = context[this.model.codeName];
3320
+ const { taskDefinitionKey } = context;
3321
+ return this.app.net.post(
3322
+ `${this.getBaseUrl()}/${deKeyValue}/usertasks/${taskDefinitionKey}/ways`,
3323
+ { activedata: this.getActiveData(data, context) }
3324
+ );
3325
+ }
3326
+ /**
3327
+ * 根据业务主键获取工作流程进度
3328
+ *
3329
+ * @author lxm
3330
+ * @date 2022-09-29 14:09:45
3331
+ * @param {IParams} context
3332
+ * @returns {*} {Promise<IHttpResponse<IDatum>>}
3333
+ */
3334
+ async getWFHistory(context) {
3335
+ const deKeyValue = context[this.model.codeName];
3336
+ return this.app.net.get(
3337
+ `${this.getBaseUrl()}/${deKeyValue}/process-instances/alls/history`
3338
+ );
3339
+ }
3340
+ /**
3341
+ * 根据业务主键获取工作流流程图片
3342
+ *
3343
+ * @author lxm
3344
+ * @date 2022-10-27 16:10:13
3345
+ * @param {IParams} context
3346
+ * @returns {*} {Promise<IHttpResponse<IDatum>>}
3347
+ */
3348
+ async getWFProcessDiagram(context) {
3349
+ const deKeyValue = context[this.model.codeName];
3350
+ return this.app.net.request(
3351
+ `${this.getBaseUrl()}/${deKeyValue}/process-instances/alls/processdiagram`,
3352
+ {
3353
+ method: "post",
3354
+ data: {},
3355
+ responseType: "blob"
3356
+ }
3357
+ );
3358
+ }
3359
+ /**
3360
+ * 获取标准工作流版本信息
3361
+ *
3362
+ * @author lxm
3363
+ * @date 2022-09-29 14:09:45
3364
+ * @returns {*} {Promise<IHttpResponse<IDatum>>}
3365
+ */
3366
+ async getWFVersion() {
3367
+ return this.app.net.get(`${this.getBaseUrl()}/process-definitions2`);
3368
+ }
3369
+ /**
3370
+ * 启动工作流
3371
+ *
3372
+ * @author lxm
3373
+ * @date 2022-09-30 17:09:51
3374
+ * @param {IParams} context 路径参数
3375
+ * @param {IParams} params 请求参数
3376
+ * @param {IDatum} data 数据
3377
+ * @returns {*} {Promise<IHttpResponse<IDatum>>}
3378
+ */
3379
+ async wfStart(context, params, data) {
3380
+ return this.app.net.post(
3381
+ `${this.getBaseUrl()}/${context[this.model.codeName]}/process-instances`,
3382
+ {
3383
+ ...params,
3384
+ activedata: this.getActiveData(data, context)
3385
+ }
3386
+ );
3387
+ }
3388
+ /**
3389
+ * 提交工作流
3390
+ *
3391
+ * @author lxm
3392
+ * @date 2022-09-30 17:09:51
3393
+ * @param {IParams} context 路径参数
3394
+ * @param {IParams} params 请求参数
3395
+ * @param {IDatum} data 数据
3396
+ * @returns {*} {Promise<IHttpResponse<IDatum>>}
3397
+ */
3398
+ async wfSubmit(context, params, data) {
3399
+ return this.app.net.post(
3400
+ `${this.getBaseUrl()}/${context[this.model.codeName]}/tasks/${params.taskId}`,
3401
+ {
3402
+ ...params,
3403
+ activedata: this.getActiveData(data, context)
3404
+ }
3405
+ );
3406
+ }
3407
+ /**
3408
+ * 提交工作流
3409
+ *
3410
+ * @author lxm
3411
+ * @date 2022-09-30 17:09:51
3412
+ * @param {IParams} context 路径参数
3413
+ * @param {IParams} params 请求参数
3414
+ * @param {IDatum} data 数据
3415
+ * @returns {*} {Promise<IHttpResponse<IDatum>>}
3416
+ */
3417
+ async wfWithdraw(context, params, data) {
3418
+ return this.app.net.post(
3419
+ `${this.getBaseUrl()}/${context[this.model.codeName]}/tasks/${params.taskId}/withdraw`,
3420
+ {
3421
+ ...params,
3422
+ activedata: this.getActiveData(data, context)
3423
+ }
3424
+ );
3425
+ }
3426
+ /**
3427
+ * 调用工作流接口
3428
+ *
3429
+ * @author lxm
3430
+ * @date 2022-09-30 17:09:38
3431
+ * @param {string} methodName 接口名称
3432
+ * @param {IParams} context 路径参数
3433
+ * @param {IParams} [params={}] 查询参数
3434
+ * @param {IDatum} [data={}] 主数据数据
3435
+ * @returns {*} {Promise<IHttpResponse<IDatum>>}
3436
+ */
3437
+ async exec(methodName, context, params = {}, data = {}) {
3438
+ switch (methodName) {
3439
+ case "WFSTART":
3440
+ return this.wfStart(context, params, data);
3441
+ case "WFSUBMIT":
3442
+ return this.wfSubmit(context, params, data);
3443
+ default: {
3444
+ throw new RuntimeError4(`\u300C${methodName}\u300D\u672A\u5B9E\u73B0`);
3445
+ }
3446
+ }
3447
+ }
3448
+ };
3449
+
3450
+ // src/service/service/file/file.service.ts
3451
+ var FileService = class {
3452
+ /**
3453
+ * Creates an instance of FileService.
3454
+ * @author lxm
3455
+ * @date 2022-11-25 13:11:49
3456
+ * @param {IAppDataEntity} model 应用实体
3457
+ * @param {ServicePathItem[][]} paths 计算出的资源关系路径
3458
+ */
3459
+ constructor(model, paths) {
3460
+ this.model = model;
3461
+ this.paths = paths;
3462
+ }
3463
+ /**
3464
+ * 后台导出数据,返回文件流
3465
+ *
3466
+ * @author lxm
3467
+ * @date 2022-11-25 14:11:53
3468
+ * @param {IDEDataExport} dataExport 导出模型
3469
+ * @param {string} fetchAction 查询方法
3470
+ * @param {IParams} context 上下文
3471
+ * @param {IParams} params 请求参数
3472
+ * @returns {*} {Promise<IHttpResponse<Blob>>}
3473
+ */
3474
+ exportData(dataExport, fetchAction, context, params) {
3475
+ const resPath = calcResPath(context, this.paths);
3476
+ const exportUrl = `${resPath}/${this.model.codeName2}/exportdata/${fetchAction.toLowerCase()}/?srfexporttag=${dataExport.codeName}`;
3477
+ return ibiz.net.request(exportUrl, {
3478
+ method: "post",
3479
+ data: params,
3480
+ responseType: "blob"
3481
+ });
3482
+ }
3483
+ };
3484
+
3485
+ // src/service/service/entity/entity.service.ts
3486
+ var EntityService = class {
3487
+ /**
3488
+ * Creates an instance of EntityService.
3489
+ *
3490
+ * @author chitanda
3491
+ * @date 2022-08-24 18:08:44
3492
+ * @param {IAppDataEntity} model 应用实体模型
3493
+ * @param {ServicePathItem[][]} paths 计算出的资源关系路径
3494
+ */
3495
+ constructor(model, paths) {
3496
+ this.model = model;
3497
+ this.paths = paths;
3498
+ /**
3499
+ * 请求方法实例
3500
+ *
3501
+ * @author chitanda
3502
+ * @date 2022-10-10 12:10:13
3503
+ * @protected
3504
+ * @type {Map<string, Method>}
3505
+ */
3506
+ this.methodMap = /* @__PURE__ */ new Map();
3507
+ /**
3508
+ * 数据缓存
3509
+ *
3510
+ * @author chitanda
3511
+ * @date 2022-08-18 19:08:40
3512
+ * @type {EntityCache}
3513
+ */
3514
+ this.local = new EntityCache();
3515
+ this.wf = new WorkFlowService(model);
3516
+ this.file = new FileService(model, paths);
3517
+ }
3518
+ /**
3519
+ * 获取实体服务方法实例
3520
+ *
3521
+ * @author chitanda
3522
+ * @date 2022-10-10 14:10:53
3523
+ * @protected
3524
+ * @param {string} methodName
3525
+ * @return {*} {Method}
3526
+ */
3527
+ getMethod(methodName) {
3528
+ if (this.methodMap.has(methodName)) {
3529
+ return this.methodMap.get(methodName);
3530
+ }
3531
+ throw new ModelError5(this.model, `\u672A\u652F\u6301\u7684\u670D\u52A1\u65B9\u6CD5: ${methodName}`);
3532
+ }
3533
+ /**
3534
+ * 执行服务方法
3535
+ *
3536
+ * @author chitanda
3537
+ * @date 2022-09-13 19:09:55
3538
+ * @param {string} methodName
3539
+ * @param {IParams} context
3540
+ * @param {IData} [params={}] 请求参数
3541
+ * @param {IParams} [params2={}] 查询参数
3542
+ * @return {*} {Promise<IHttpResponse>}
3543
+ */
3544
+ exec(methodName, context, params = {}, params2 = {}) {
3545
+ const method = this.getMethod(methodName);
3546
+ if (method) {
3547
+ return method.exec(context, params, params2);
3548
+ }
3549
+ throw new RuntimeError5(`${this.model.codeName}\u672A\u652F\u6301\u300C${methodName}\u300D\u65B9\u6CD5`);
3550
+ }
3551
+ getPath(methodName, context, params = {}, params2 = {}) {
3552
+ const method = this.getMethod(methodName);
3553
+ if (method) {
3554
+ return method.exec(context, params, params2);
3555
+ }
3556
+ throw new RuntimeError5(`${this.model.codeName}\u672A\u652F\u6301\u300C${methodName}\u300D\u65B9\u6CD5`);
3557
+ }
3558
+ };
3559
+
3560
+ // src/service/constant/srfuf.ts
3561
+ var Srfuf = /* @__PURE__ */ ((Srfuf2) => {
3562
+ Srfuf2[Srfuf2["CREATE"] = 0] = "CREATE";
3563
+ Srfuf2[Srfuf2["UPDATE"] = 1] = "UPDATE";
3564
+ return Srfuf2;
3565
+ })(Srfuf || {});
3566
+
3567
+ // src/service/vo/control.vo.ts
3568
+ import { isNil as isNil6 } from "ramda";
3569
+ var ControlVO = class {
3570
+ /**
3571
+ * 是否是新建数据,0为新建
3572
+ *
3573
+ * @author lxm
3574
+ * @date 2022-09-06 22:09:24
3575
+ * @type {Srfuf}
3576
+ */
3577
+ get srfuf() {
3578
+ if (isNil6(this.$origin.srfuf)) {
3579
+ return this.srfkey ? 1 /* UPDATE */ : 0 /* CREATE */;
3580
+ }
3581
+ return this.$origin.srfuf;
3582
+ }
3583
+ /**
3584
+ * Creates an instance of ControlVO.
3585
+ * @author lxm
3586
+ * @date 2022-09-05 15:09:10
3587
+ * @param {IData} origin 后台原始数据
3588
+ * @param {Map<string, string>} dataUIMap 转换映射map,key为转换后的属性,value为映射字段描述信息
3589
+ */
3590
+ constructor($origin, $dataUIMap) {
3591
+ if (!$origin || !$dataUIMap) {
3592
+ return;
3593
+ }
3594
+ Object.defineProperty(this, "$origin", {
3595
+ enumerable: false,
3596
+ configurable: true,
3597
+ value: $origin || {}
3598
+ });
3599
+ Object.defineProperty(this, "$dataUIMap", {
3600
+ enumerable: false,
3601
+ configurable: true,
3602
+ value: $dataUIMap || /* @__PURE__ */ new Map()
3603
+ });
3604
+ this.$dataUIMap.forEach((mapField, key) => {
3605
+ const value = mapField.dataKey;
3606
+ this.linkProperty(key, value, mapField.isOriginField);
3607
+ });
3608
+ Object.keys($origin).forEach((value) => {
3609
+ if (!Object.prototype.hasOwnProperty.call(this, value)) {
3610
+ this.linkProperty(value, value);
3611
+ }
3612
+ });
3613
+ }
3614
+ /**
3615
+ * 关联实体属性
3616
+ *
3617
+ * @author lxm
3618
+ * @date 2022-10-18 15:10:48
3619
+ * @private
3620
+ * @param {string} uiKey 界面字段
3621
+ * @param {string} dataKey 数据字段
3622
+ * @param {boolean} [isOriginField=true] 是否是后台存储字段,是的话存取都在$origin里
3623
+ * @returns {*}
3624
+ */
3625
+ linkProperty(uiKey, dataKey, isOriginField = true) {
3626
+ if (uiKey === "srfuf") {
3627
+ return;
3628
+ }
3629
+ if (isOriginField || Object.prototype.hasOwnProperty.call(this.$origin, uiKey)) {
3630
+ Object.defineProperty(this, uiKey, {
3631
+ enumerable: true,
3632
+ configurable: true,
3633
+ get() {
3634
+ return this.$origin[dataKey];
3635
+ },
3636
+ set(val) {
3637
+ this.$origin[dataKey] = val;
3638
+ }
3639
+ });
3640
+ } else {
3641
+ Object.defineProperty(this, uiKey, {
3642
+ enumerable: true,
3643
+ configurable: true,
3644
+ writable: true,
3645
+ value: null
3646
+ });
3647
+ }
3648
+ }
3649
+ /**
3650
+ * 获取原始数据
3651
+ *
3652
+ * @author lxm
3653
+ * @date 2022-09-05 15:09:52
3654
+ * @returns {*}
3655
+ */
3656
+ getOrigin() {
3657
+ return this.$origin;
3658
+ }
3659
+ /**
3660
+ * 获取请求数据
3661
+ *
3662
+ * @author lxm
3663
+ * @date 2022-10-18 15:10:53
3664
+ * @returns {*}
3665
+ */
3666
+ getRequestData() {
3667
+ const requestData = { ...this.$origin };
3668
+ this.$dataUIMap.forEach((mapField) => {
3669
+ if (mapField.isRequestNeed !== mapField.isOriginField) {
3670
+ requestData[mapField.dataKey] = this[mapField.uiKey];
3671
+ }
3672
+ });
3673
+ return requestData;
3674
+ }
3675
+ /**
3676
+ * 设置原始数据
3677
+ *
3678
+ * @author lxm
3679
+ * @date 2022-10-17 20:10:39
3680
+ * @param {IData} data
3681
+ */
3682
+ setOrigin(data) {
3683
+ this.$origin = data instanceof ControlVO ? data.getOrigin() : data;
3684
+ }
3685
+ /**
3686
+ * 合并原始数据,有的字段合并,没有的不合并
3687
+ *
3688
+ * @author lxm
3689
+ * @date 2022-10-19 12:10:09
3690
+ * @param {(IData | ControlVO)} data
3691
+ */
3692
+ mergeOrigin(data) {
3693
+ Object.assign(
3694
+ this.$origin,
3695
+ data instanceof ControlVO ? data.getOrigin() : data
3696
+ );
3697
+ }
3698
+ /**
3699
+ * 临时处理,响应式需要
3700
+ *
3701
+ * @author lxm
3702
+ * @date 2022-10-19 12:10:11
3703
+ */
3704
+ reactiveInit() {
3705
+ this.$dataUIMap.forEach((value, key) => {
3706
+ if (this.$origin[key] === void 0) {
3707
+ this.$origin[key] = null;
3708
+ }
3709
+ });
3710
+ }
3711
+ };
3712
+
3713
+ // src/service/vo/tree-node-data/tree-node-data.ts
3714
+ var TreeNodeData = class {
3715
+ constructor(model, opts, _nodeRS, parentNodeData) {
3716
+ /**
3717
+ * 是否是叶子节点(没有子节点的节点)
3718
+ *
3719
+ * @type {boolean}
3720
+ * @memberof TreeNodeData
3721
+ */
3722
+ this.leaf = false;
3723
+ this.parent = parentNodeData;
3724
+ if (this.parent) {
3725
+ this.context = { ...this.parent.context };
3726
+ } else {
3727
+ this.context = {};
3728
+ }
3729
+ this.nodeId = model.id;
3730
+ }
3731
+ };
3732
+
3733
+ // src/service/vo/tree-node-data/tree-data-set-node-data.ts
3734
+ var TreeDataSetNodeData = class extends TreeNodeData {
3735
+ constructor(model, opts, nodeRS, parentNodeData) {
3736
+ super(model, opts, nodeRS, parentNodeData);
3737
+ const { data } = opts;
3738
+ this.deData = data;
3739
+ this.text = data.srfmajortext;
3740
+ this.value = data.srfkey;
3741
+ this.id = parentNodeData ? `${parentNodeData.id}:${model.id}${data.srfkey}` : model.id + data.srfkey;
3742
+ this.id = this.id.toLowerCase();
3743
+ }
3744
+ };
3745
+
3746
+ // src/service/vo/tree-node-data/tree-static-node-data.ts
3747
+ var TreeStaticNodeData = class extends TreeNodeData {
3748
+ constructor(model, opts, nodeRS, parentNodeData) {
3749
+ var _a;
3750
+ super(model, opts, nodeRS, parentNodeData);
3751
+ this.id = parentNodeData ? `${parentNodeData.id}:${model.id}` : model.id;
3752
+ this.id = this.id.toLowerCase();
3753
+ this.text = model.text;
3754
+ if (parentNodeData && nodeRS) {
3755
+ let parent = parentNodeData;
3756
+ for (let index = 1; index < nodeRS.parentValueLevel; index++) {
3757
+ parent = parent == null ? void 0 : parent.parent;
3758
+ }
3759
+ if (parent == null ? void 0 : parent.deData) {
3760
+ this.deData = parent.deData;
3761
+ }
3762
+ }
3763
+ this.value = model.nodeValue || ((_a = this.deData) == null ? void 0 : _a.value);
3764
+ }
3765
+ };
3766
+
3767
+ // src/service/vo/ui-map-field.ts
3768
+ import { isNil as isNil7 } from "ramda";
3769
+ var UIMapField = class {
3770
+ constructor(uiKey, dataKey, opts = {}) {
3771
+ /**
3772
+ * 是否存储到origin里面(默认false)
3773
+ *
3774
+ * @author lxm
3775
+ * @date 2022-10-18 14:10:24
3776
+ * @type {boolean}
3777
+ */
3778
+ this.isOriginField = false;
3779
+ /**
3780
+ * 是否是请求需要的字段(默认true)
3781
+ *
3782
+ * @author lxm
3783
+ * @date 2022-10-18 14:10:44
3784
+ * @type {boolean}
3785
+ */
3786
+ this.isRequestNeed = true;
3787
+ this.uiKey = uiKey;
3788
+ this.dataKey = dataKey;
3789
+ if (!isNil7(opts.isOriginField)) {
3790
+ this.isOriginField = opts.isOriginField;
3791
+ }
3792
+ if (!isNil7(opts.isRequestNeed)) {
3793
+ this.isRequestNeed = opts.isRequestNeed;
3794
+ }
3795
+ }
3796
+ };
3797
+
3798
+ // src/service/auth/auth.service.ts
3799
+ var AuthService = class {
3800
+ /**
3801
+ * v7 uaa 登录
3802
+ *
3803
+ * @author chitanda
3804
+ * @date 2022-07-19 18:07:54
3805
+ * @param {string} loginname
3806
+ * @param {string} password
3807
+ * @return {*} {Promise<IHttpResponse>}
3808
+ */
3809
+ async v7login(loginname, password) {
3810
+ const res = await ibiz.net.post(
3811
+ "/v7/login",
3812
+ { loginname, password },
3813
+ {},
3814
+ {
3815
+ // sass 模式下,注册在 sassMgr 管理平台的应用中心系统标识
3816
+ // srfdcsystem: ibiz.env.dcSystem,
3817
+ }
3818
+ );
3819
+ return res;
3820
+ }
3821
+ /**
3822
+ * v7 uaa 登出
3823
+ *
3824
+ * @author chitanda
3825
+ * @date 2022-09-14 18:07:54
3826
+ * @return {*} {Promise<IHttpResponse>}
3827
+ */
3828
+ async v7logout() {
3829
+ const res = await ibiz.net.get("/v7/logout", {});
3830
+ return res;
3831
+ }
3832
+ };
3833
+
3834
+ // src/service/authority/authority.service.ts
3835
+ import { MenuPermissionMode, RuntimeError as RuntimeError6 } from "@ibiz-template/core";
3836
+ var AuthorityService = class {
3837
+ constructor(appModel) {
3838
+ this.appModel = appModel;
3839
+ this.isInit = false;
3840
+ /**
3841
+ * 统一资源集合
3842
+ *
3843
+ * @author lxm
3844
+ * @date 2022-10-12 17:10:46
3845
+ * @private
3846
+ * @type {string[]}
3847
+ */
3848
+ this.resCodes = [];
3849
+ /**
3850
+ * 是否启用统一资源校验
3851
+ *
3852
+ * @author lxm
3853
+ * @date 2022-10-14 19:10:50
3854
+ * @private
3855
+ * @type {boolean}
3856
+ */
3857
+ this.enableResValidate = true;
3858
+ /**
3859
+ * RT菜单权限标识集合
3860
+ *
3861
+ * @author lxm
3862
+ * @date 2022-10-12 17:10:46
3863
+ * @private
3864
+ * @type {string[]}
3865
+ */
3866
+ this.rtMenuCodes = [];
3867
+ }
3868
+ /**
3869
+ * 权限服务初始化
3870
+ *
3871
+ * @author lxm
3872
+ * @date 2022-10-13 15:10:44
3873
+ * @param {*} [appData=ibiz.appData]
3874
+ * @returns {*} {Promise<void>}
3875
+ */
3876
+ async init(appData = ibiz.appData) {
3877
+ if (!appData) {
3878
+ throw new RuntimeError6("\u6CA1\u6709appData\u6570\u636E");
3879
+ }
3880
+ if (appData.unires) {
3881
+ this.resCodes = appData.unires;
3882
+ }
3883
+ if (appData.enablepermissionvalid === false) {
3884
+ this.enableResValidate = false;
3885
+ }
3886
+ if (appData.appmenu) {
3887
+ this.rtMenuCodes = appData.appmenu;
3888
+ }
3889
+ }
3890
+ /**
3891
+ * 根据统一资源计算出用户是否拥有该操作标识的权限
3892
+ *
3893
+ * @author lxm
3894
+ * @date 2022-10-13 15:10:56
3895
+ * @param {string[]} resCodes
3896
+ * @returns {*} {Promise<void>}
3897
+ */
3898
+ async hasOwnOPPrivs(dataAccessAction, entityModel) {
3899
+ const { appModel } = this;
3900
+ const opPrivs = [];
3901
+ if (appModel.deopprivs) {
3902
+ opPrivs.push(...appModel.deopprivs);
3903
+ }
3904
+ if (entityModel == null ? void 0 : entityModel.deopprivs) {
3905
+ opPrivs.push(...entityModel.deopprivs);
3906
+ }
3907
+ return false;
3908
+ }
3909
+ /**
3910
+ * 菜单项是否有权限
3911
+ *
3912
+ * @author lxm
3913
+ * @date 2022-10-12 18:10:26
3914
+ * @param {IAppMenuItem} menuItem 菜单项
3915
+ * @returns {*} {boolean}
3916
+ */
3917
+ hasMenuPermitted(menuItem) {
3918
+ if (!ibiz.env.enablePermission) {
3919
+ return true;
3920
+ }
3921
+ switch (ibiz.env.menuPermissionMode) {
3922
+ case MenuPermissionMode.RT:
3923
+ return this.calcMenuPermissionByRT(menuItem);
3924
+ case MenuPermissionMode.RESOURCE:
3925
+ return this.calcMenuPermissionByResource(menuItem);
3926
+ case MenuPermissionMode.MIXIN:
3927
+ return this.calcMenuPermissionByResource(menuItem) || this.calcMenuPermissionByRT(menuItem);
3928
+ default:
3929
+ return true;
3930
+ }
3931
+ }
3932
+ /**
3933
+ * 通过RT菜单标识计算菜单权限
3934
+ *
3935
+ * @author lxm
3936
+ * @date 2022-10-12 18:10:50
3937
+ * @protected
3938
+ * @param {AppMenuItemModel} menuItem
3939
+ * @returns {*} {boolean}
3940
+ */
3941
+ calcMenuPermissionByRT(menuItem) {
3942
+ return false;
3943
+ }
3944
+ /**
3945
+ * 通过统一资源计算菜单权限
3946
+ *
3947
+ * @author lxm
3948
+ * @date 2022-10-12 18:10:23
3949
+ * @protected
3950
+ * @param {IAppMenuItem} menuItem
3951
+ * @returns {*} {boolean}
3952
+ */
3953
+ calcMenuPermissionByResource(menuItem) {
3954
+ if (this.enableResValidate && menuItem.accessKey) {
3955
+ return this.resCodes.includes(menuItem.accessKey);
3956
+ }
3957
+ return true;
3958
+ }
3959
+ /**
3960
+ * 界面行为是否有权限
3961
+ *
3962
+ * @author lxm
3963
+ * @date 2022-10-13 18:10:06
3964
+ * @param {IDEUIAction} uiAction 界面行为
3965
+ * @param {IData} data 后台数据(key是实体属性)
3966
+ * @param {IAppDataEntity} entityModel 实体模型
3967
+ * @returns {*} {boolean}
3968
+ */
3969
+ hasUIActionPermitted(uiAction, data, entityModel) {
3970
+ const result = true;
3971
+ const { dataAccessAction } = uiAction;
3972
+ if (dataAccessAction) {
3973
+ if (this.enableResValidate && !this.hasOwnOPPrivs(dataAccessAction, entityModel)) {
3974
+ return false;
3975
+ }
3976
+ if (data) {
3977
+ if (data.srfopprivs && !data.srfopprivs.includes(dataAccessAction)) {
3978
+ return false;
3979
+ }
3980
+ if (!this.calcDeMainStatePermission(dataAccessAction, data, entityModel)) {
3981
+ return false;
3982
+ }
3983
+ }
3984
+ }
3985
+ return result;
3986
+ }
3987
+ /**
3988
+ * 计算主状态的权限
3989
+ *
3990
+ * @author lxm
3991
+ * @date 2022-10-13 18:10:34
3992
+ * @param {string} dataAccessAction 操作标识
3993
+ * @param {IData} data 后台数据
3994
+ * @param {IAppDataEntity} entityModel 实体模型
3995
+ * @returns {*}
3996
+ */
3997
+ calcDeMainStatePermission(dataAccessAction, data, entityModel) {
3998
+ return true;
3999
+ }
4000
+ };
4001
+
4002
+ // src/service/service-util.ts
4003
+ var ServiceUtil = class {
4004
+ /**
4005
+ * Creates an instance of ServiceUtil.
4006
+ *
4007
+ * @author chitanda
4008
+ * @date 2023-04-18 14:04:01
4009
+ * @param {IApplication} appModel
4010
+ */
4011
+ constructor(appModel) {
4012
+ this.appModel = appModel;
4013
+ /**
4014
+ * 实体服务缓存
4015
+ *
4016
+ * @author chitanda
4017
+ * @date 2022-08-17 23:08:36
4018
+ * @protected
4019
+ * @type {Map<string, EntityService>}
4020
+ */
4021
+ this.cache = /* @__PURE__ */ new Map();
4022
+ /**
4023
+ * 所有实体缓存
4024
+ *
4025
+ * @author chitanda
4026
+ * @date 2022-08-18 22:08:45
4027
+ * @protected
4028
+ * @type {Map<string, IAppDataEntity>}
4029
+ */
4030
+ this.allEntities = /* @__PURE__ */ new Map();
4031
+ }
4032
+ /**
4033
+ * 初始化实体缓存
4034
+ *
4035
+ * @author chitanda
4036
+ * @date 2022-12-23 10:12:57
4037
+ * @protected
4038
+ * @return {*} {Promise<void>}
4039
+ */
4040
+ async initAllEntities() {
4041
+ if (this.allEntities.size !== 0) {
4042
+ }
4043
+ }
4044
+ /**
4045
+ * 根据实体标识获取实体服务
4046
+ *
4047
+ * @author chitanda
4048
+ * @date 2022-12-23 10:12:24
4049
+ * @param {string} entityCodeName 实体标识
4050
+ * @param {IParams} [context] 上下文,用于计算模型所属沙箱环境
4051
+ * @return {*} {Promise<EntityService>}
4052
+ */
4053
+ async getService(entityCodeName) {
4054
+ return this.cache.get(entityCodeName);
4055
+ }
4056
+ /**
4057
+ * 清理所有服务, 当前临时域下的所有临时数据缓存
4058
+ *
4059
+ * @description 根据 srfsessionid 作为临时数据域
4060
+ * @author chitanda
4061
+ * @date 2022-08-18 14:08:48
4062
+ * @param {IParams} context
4063
+ */
4064
+ clearTempCache(context) {
4065
+ this.cache.forEach((service) => {
4066
+ service.local.clear(context);
4067
+ });
4068
+ }
4069
+ };
4070
+
4071
+ // src/app-hub.ts
4072
+ import { RuntimeError as RuntimeError7 } from "@ibiz-template/core";
4073
+
4074
+ // src/application.ts
4075
+ import { Net } from "@ibiz-template/core";
4076
+ var Application = class {
4077
+ /**
4078
+ * Creates an instance of Application.
4079
+ *
4080
+ * @author chitanda
4081
+ * @date 2022-12-22 15:12:26
4082
+ * @param {IApplication} model
4083
+ */
4084
+ constructor(model) {
4085
+ this.model = model;
4086
+ /**
4087
+ * 应用实体清单, 存储应用实体的代码标识
4088
+ *
4089
+ * @author chitanda
4090
+ * @date 2023-04-18 14:04:32
4091
+ * @type {string[]}
4092
+ */
4093
+ this.appDataEntityList = [];
4094
+ /**
4095
+ * 当前应用实体关系
4096
+ *
4097
+ * @author chitanda
4098
+ * @date 2023-04-18 14:04:56
4099
+ * @type {IAppDERS[]}
4100
+ */
4101
+ this.appDERSs = [];
4102
+ this.net = new Net({
4103
+ baseURL: `${ibiz.env.baseUrl}/${model.id}`
4104
+ });
4105
+ this.resourcePathUtil = new ServicePathUtil(this);
4106
+ this.es = new ServiceUtil(model);
4107
+ this.codeList = new CodeListService(model);
4108
+ this.authority = new AuthorityService(model);
4109
+ }
4110
+ /**
4111
+ * 当前应用标识
4112
+ *
4113
+ * @author chitanda
4114
+ * @date 2023-04-19 22:04:55
4115
+ * @readonly
4116
+ * @type {string}
4117
+ */
4118
+ get appId() {
4119
+ return this.model.appId;
4120
+ }
4121
+ /**
4122
+ * 初始化应用
4123
+ *
4124
+ * @author chitanda
4125
+ * @date 2023-04-19 11:04:02
4126
+ * @return {*} {Promise<void>}
4127
+ */
4128
+ async init() {
4129
+ await this.resourcePathUtil.init();
4130
+ await this.authority.init();
4131
+ }
4132
+ };
4133
+
4134
+ // src/hub/convert/app-menu-convert/app-menu-convert.ts
4135
+ var AppMenuConvert = class {
4136
+ /**
4137
+ * 转化
4138
+ *
4139
+ * @author chitanda
4140
+ * @date 2023-04-19 14:04:46
4141
+ * @param {IAppMenu} appMenu
4142
+ * @return {*} {IAppMenu}
4143
+ */
4144
+ parse(appMenu) {
4145
+ return appMenu;
4146
+ }
4147
+ };
4148
+
4149
+ // src/hub/convert/convert.ts
4150
+ var Convert = class {
4151
+ constructor() {
4152
+ /**
4153
+ * 应用菜单转换器
4154
+ *
4155
+ * @author chitanda
4156
+ * @date 2023-04-19 14:04:54
4157
+ */
4158
+ this.appMenu = new AppMenuConvert();
4159
+ }
4160
+ };
4161
+
4162
+ // src/app-hub.ts
4163
+ var AppHub = class {
4164
+ constructor() {
4165
+ /**
4166
+ * 多应用模式下,应用模型转换器
4167
+ *
4168
+ * @author chitanda
4169
+ * @date 2023-04-19 11:04:04
4170
+ */
4171
+ this.convert = new Convert();
4172
+ /**
4173
+ * 应用总集
4174
+ *
4175
+ * @author chitanda
4176
+ * @date 2022-12-21 14:12:45
4177
+ * @protected
4178
+ * @type {Map<string, Application>}
4179
+ */
4180
+ this.appMap = /* @__PURE__ */ new Map();
4181
+ /**
4182
+ * 实例化的应用模型
4183
+ *
4184
+ * @author chitanda
4185
+ * @date 2023-04-17 23:04:45
4186
+ * @protected
4187
+ * @type {Map<string, IApplication>}
4188
+ */
4189
+ this.apps = /* @__PURE__ */ new Map();
4190
+ /**
4191
+ * 当前基座下所有的应用视图
4192
+ *
4193
+ * @author chitanda
4194
+ * @date 2023-04-17 11:04:20
4195
+ * @protected
4196
+ * @type {Map<string, string>} Map<视图名称, 视图所属应用>
4197
+ */
4198
+ this.view2appMap = /* @__PURE__ */ new Map();
4199
+ /**
4200
+ * 实例化的应用视图模型
4201
+ *
4202
+ * @author chitanda
4203
+ * @date 2023-04-17 23:04:00
4204
+ * @protected
4205
+ * @type {Map<string, IAppView>}
4206
+ */
4207
+ this.views = /* @__PURE__ */ new Map();
4208
+ /**
4209
+ * 应用实体实例模型
4210
+ *
4211
+ * @author chitanda
4212
+ * @date 2023-04-17 23:04:32
4213
+ * @protected
4214
+ * @type {Map<string, Map<string, IAppDataEntity>>}
4215
+ */
4216
+ this.dataEntities = /* @__PURE__ */ new Map();
4217
+ /**
4218
+ * 默认首页视图名称
4219
+ *
4220
+ * @author chitanda
4221
+ * @date 2023-04-19 20:04:22
4222
+ * @type {string}
4223
+ */
4224
+ this.defaultAppIndexViewName = "Index";
4225
+ }
4226
+ /**
4227
+ * 注册模型加载适配器
4228
+ *
4229
+ * @author chitanda
4230
+ * @date 2023-04-17 23:04:14
4231
+ * @param {ModelLoaderProvider} provider
4232
+ */
4233
+ registerModelLoaderProvider(provider) {
4234
+ this.modelLoaderProvider = provider;
4235
+ }
4236
+ /**
4237
+ * 注册应用实例模型
4238
+ *
4239
+ * @author chitanda
4240
+ * @date 2023-04-17 23:04:29
4241
+ * @param {IApplication} model
4242
+ */
4243
+ registerApp(model) {
4244
+ this.apps.set(model.codeName, model);
4245
+ }
4246
+ /**
4247
+ * 注册应用视图实例模型
4248
+ *
4249
+ * @author chitanda
4250
+ * @date 2023-04-17 23:04:42
4251
+ * @param {IAppView} model
4252
+ */
4253
+ registerAppView(model) {
4254
+ this.views.set(model.codeName, model);
4255
+ }
4256
+ /**
4257
+ * 注册应用实体
4258
+ *
4259
+ * @author chitanda
4260
+ * @date 2023-04-17 23:04:24
4261
+ * @param {IAppDataEntity} model
4262
+ * @param {string} [appId=ibiz.env.appId]
4263
+ */
4264
+ registerAppDataEntity(model, appId = ibiz.env.appId) {
4265
+ if (!this.dataEntities.has(appId)) {
4266
+ this.dataEntities.set(appId, /* @__PURE__ */ new Map());
4267
+ }
4268
+ const map = this.dataEntities.get(appId);
4269
+ map.set(model.codeName, model);
4270
+ }
4271
+ /**
4272
+ * 设置应用视图所属应用
4273
+ *
4274
+ * @author chitanda
4275
+ * @date 2023-04-17 23:04:37
4276
+ * @param {string} name
4277
+ * @param {string} [appId=ibiz.env.appId]
4278
+ */
4279
+ setAppView(name, appId = ibiz.env.appId) {
4280
+ this.view2appMap.set(name, appId);
4281
+ }
4282
+ /**
4283
+ * 根据视图代码名称查找视图
4284
+ *
4285
+ * @author chitanda
4286
+ * @date 2023-04-17 21:04:14
4287
+ * @param {string} name
4288
+ * @return {*} {Promise<IAppView>}
4289
+ */
4290
+ async getAppView(name) {
4291
+ const appId = this.view2appMap.get(name) || ibiz.env.appId;
4292
+ if (!this.appMap.has(appId)) {
4293
+ await this.createApp(appId);
4294
+ }
4295
+ if (this.views.has(name)) {
4296
+ return this.views.get(name);
4297
+ }
4298
+ if (this.modelLoaderProvider) {
4299
+ const appView = await this.modelLoaderProvider.getAppView(appId, name);
4300
+ this.registerAppView(appView);
4301
+ return appView;
4302
+ }
4303
+ throw new RuntimeError7(`\u89C6\u56FE[${name}]\u4E0D\u5B58\u5728`);
4304
+ }
4305
+ /**
4306
+ * 根据应用实体代码名称查找应用视图
4307
+ *
4308
+ * @author chitanda
4309
+ * @date 2023-04-17 23:04:08
4310
+ * @param {string} name
4311
+ * @param {string} [appId=ibiz.env.appId]
4312
+ * @return {*} {Promise<IAppDataEntity>}
4313
+ */
4314
+ async getAppDataEntity(name, appId = ibiz.env.appId) {
4315
+ if (this.dataEntities.has(appId)) {
4316
+ const map = this.dataEntities.get(appId);
4317
+ if (map.has(name)) {
4318
+ return map.get(name);
4319
+ }
4320
+ }
4321
+ if (this.modelLoaderProvider) {
4322
+ const entity = await this.modelLoaderProvider.getAppDataEntity(
4323
+ appId,
4324
+ name
4325
+ );
4326
+ this.registerAppDataEntity(entity, appId);
4327
+ return entity;
4328
+ }
4329
+ throw new RuntimeError7(`\u672A\u627E\u5230\u5E94\u7528\u5B9E\u4F53[${name}]`);
4330
+ }
4331
+ /**
4332
+ * 新建 hub 应用
4333
+ *
4334
+ * @author chitanda
4335
+ * @date 2023-04-17 21:04:11
4336
+ * @param {string} id
4337
+ * @return {*} {Promise<Application>}
4338
+ */
4339
+ async createApp(id) {
4340
+ if (this.appMap.has(id)) {
4341
+ return this.appMap.get(id);
4342
+ }
4343
+ let appModel;
4344
+ if (this.apps.has(id)) {
4345
+ appModel = this.apps.get(id);
4346
+ } else if (this.modelLoaderProvider) {
4347
+ appModel = await this.modelLoaderProvider.getApp(id);
4348
+ this.registerApp(appModel);
4349
+ } else {
4350
+ throw new RuntimeError7(`\u672A\u627E\u5230\u5E94\u7528[${id}]\u6A21\u578B`);
4351
+ }
4352
+ const app = new Application(appModel);
4353
+ this.appMap.set(id, app);
4354
+ await app.init();
4355
+ return app;
4356
+ }
4357
+ /**
4358
+ * 异步获取应用对象,用于不确定应用是否已经加载的情况
4359
+ *
4360
+ * @author chitanda
4361
+ * @date 2023-04-17 21:04:41
4362
+ * @param {string} [key=ibiz.env.appId]
4363
+ * @return {*} {Promise<Application>}
4364
+ */
4365
+ async getAppAsync(key = ibiz.env.appId) {
4366
+ return this.createApp(key);
4367
+ }
4368
+ /**
4369
+ * 根据应用 id 或应用模型获取应用实例
4370
+ *
4371
+ * @author chitanda
4372
+ * @date 2023-04-17 22:04:42
4373
+ * @param {(string | IApplication)} [app]
4374
+ * @return {*} {Application}
4375
+ */
4376
+ getApp(app) {
4377
+ let key = null;
4378
+ if (app) {
4379
+ if (app instanceof Object) {
4380
+ key = app.id;
4381
+ } else {
4382
+ key = app;
4383
+ }
4384
+ } else {
4385
+ key = ibiz.env.appId;
4386
+ }
4387
+ return this.appMap.get(key);
4388
+ }
4389
+ };
4390
+
4391
+ // src/install.ts
4392
+ function install() {
4393
+ const { ibiz: ibiz2 } = window;
4394
+ ibiz2.hub = new AppHub();
4395
+ ibiz2.register = new RegisterCenter();
4396
+ ibiz2.config = new GlobalConfig();
4397
+ ibiz2.auth = new AuthService();
4398
+ installCommand();
4399
+ presetUIActionProvider();
4400
+ }
4401
+
4402
+ // src/plugin/plugin-static-resource/plugin-static-resource.ts
4403
+ var PluginStaticResource = class {
4404
+ /**
4405
+ * 插件静态资源工具类.
4406
+ *
4407
+ * @author chitanda
4408
+ * @date 2022-11-03 10:11:41
4409
+ * @param {string} mateUrl import.mate.url
4410
+ */
4411
+ constructor(mateUrl) {
4412
+ /**
4413
+ * 已经输出过路径的 style 标签
4414
+ *
4415
+ * @author chitanda
4416
+ * @date 2023-03-23 10:03:38
4417
+ * @protected
4418
+ * @type {Map<string, null>}
4419
+ */
4420
+ this.styleElementMap = /* @__PURE__ */ new Map();
4421
+ this.baseDir = mateUrl.substring(0, mateUrl.lastIndexOf("/"));
4422
+ }
4423
+ /**
4424
+ * 合并输出静态资源目录
4425
+ *
4426
+ * @author chitanda
4427
+ * @date 2022-11-03 10:11:39
4428
+ * @param {string} path
4429
+ * @return {*} {string}
4430
+ */
4431
+ dir(path) {
4432
+ return this.baseDir + path;
4433
+ }
4434
+ /**
4435
+ * 加载样式静态资源
4436
+ *
4437
+ * @author chitanda
4438
+ * @date 2023-03-23 10:03:49
4439
+ * @param {string[]} urls
4440
+ * @return {*} {Promise<void>}
4441
+ */
4442
+ async loadStyle(urls) {
4443
+ const all = urls.map((styleUrl) => {
4444
+ const url = this.dir(styleUrl);
4445
+ if (this.styleElementMap.has(url)) {
4446
+ return false;
4447
+ }
4448
+ this.styleElementMap.set(url, null);
4449
+ return new Promise((resolve, reject) => {
4450
+ const linkDom = document.createElement("link");
4451
+ linkDom.setAttribute("type", "text/css");
4452
+ linkDom.setAttribute("rel", "stylesheet");
4453
+ linkDom.setAttribute("href", url);
4454
+ linkDom.onload = resolve;
4455
+ linkDom.onerror = reject;
4456
+ document.head.appendChild(linkDom);
4457
+ });
4458
+ });
4459
+ await Promise.all(all);
4460
+ }
4461
+ };
4462
+
4463
+ // src/plugin/remote-plugin-item/remote-plugin-item.ts
4464
+ var RemotePluginItem = class {
4465
+ /**
4466
+ * Creates an instance of RemotePluginItem.
4467
+ *
4468
+ * @author chitanda
4469
+ * @date 2023-02-02 15:02:13
4470
+ * @param {string} tag 插件标识名称
4471
+ * @param {string} repo 插件路径
4472
+ * @param {RemotePluginConfig} config
4473
+ */
4474
+ constructor(tag, repo, config) {
4475
+ this.tag = tag;
4476
+ this.repo = repo;
4477
+ this.config = config;
4478
+ }
4479
+ };
4480
+ export {
4481
+ AppCounter,
4482
+ AppDEUIActionUtil,
4483
+ AppFuncCommand,
4484
+ Application,
4485
+ AuthService,
4486
+ AuthorityService,
4487
+ BackendUIActionHandler,
4488
+ BackendUIActionProvider,
4489
+ CodeListService,
4490
+ CommonSysUIActionHandler,
4491
+ CommonSysUIActionProvider,
4492
+ ControlType,
4493
+ ControlVO,
4494
+ CounterService,
4495
+ DEDQCondUtil,
4496
+ DynamicCodeListCache,
4497
+ EntityCache,
4498
+ EntityService,
4499
+ FrontUIActionHandler,
4500
+ FrontUIActionProvider,
4501
+ OpenAppViewCommand,
4502
+ PSDEDQCondEngine,
4503
+ PluginStaticResource,
4504
+ RegisterBase,
4505
+ RegisterCenter,
4506
+ RemotePluginItem,
4507
+ SearchFilter,
4508
+ ServicePathUtil,
4509
+ ServiceUtil,
4510
+ Srfuf,
4511
+ StudioControlEvents,
4512
+ StudioPanelEvents,
4513
+ StudioViewEvents,
4514
+ TreeDataSetNodeData,
4515
+ TreeStaticNodeData,
4516
+ UIActionHandler,
4517
+ UIActionRegister,
4518
+ UIMapField,
4519
+ ViewMode,
4520
+ ViewType,
4521
+ WFWithdrawUIActionHandler,
4522
+ WFWithdrawUIActionProvider,
4523
+ WorkFlowService,
4524
+ calcNavParams,
4525
+ calcResPath,
4526
+ calcRouteContext,
4527
+ compare,
4528
+ compareNumber,
4529
+ contains,
4530
+ convertNavData,
4531
+ convertNavDataByArray,
4532
+ convertNavDataByObject,
4533
+ getWFContext,
4534
+ install,
4535
+ installCommand,
4536
+ openRedirectView,
4537
+ presetUIActionProvider,
4538
+ strContain,
4539
+ testCond,
4540
+ toLocalOpenWFRedirectView,
4541
+ verifyDeRules,
4542
+ verifyFormGroupLogic,
4543
+ verifyPanelGroupLogic
4544
+ };